Skip to content

Commit 42c6864

Browse files
committed
provider/aws: Update documentation to use t2.micro, provide Classic options (hashicorp#6801)
* provider/aws: Update documentation to use t2.micro, provide Classic options
1 parent 28ad394 commit 42c6864

5 files changed

Lines changed: 140 additions & 76 deletions

File tree

‎website/source/intro/getting-started/build.html.md‎

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,21 @@ loads all of them.
5353

5454
```
5555
provider "aws" {
56-
access_key = "ACCESS_KEY_HERE"
57-
secret_key = "SECRET_KEY_HERE"
58-
region = "us-east-1"
56+
access_key = "ACCESS_KEY_HERE"
57+
secret_key = "SECRET_KEY_HERE"
58+
region = "us-east-1"
5959
}
6060
6161
resource "aws_instance" "example" {
62-
ami = "ami-408c7f28"
63-
instance_type = "t1.micro"
62+
ami = "ami-0d729a60"
63+
instance_type = "t2.micro"
6464
}
6565
```
6666

67+
~> **Note**: The above configuation is designed to work on most EC2 accounts,
68+
with access to a default VPC. For EC2 Classic users, please use `t1.micro` for
69+
`instance_type`, and `ami-408c7f28` for the `ami`.
70+
6771
Replace the `ACCESS_KEY_HERE` and `SECRET_KEY_HERE` with your
6872
AWS access key and secret key, available from
6973
[this page](https://console.aws.amazon.com/iam/home?#security_credential).
@@ -95,7 +99,7 @@ Within the resource block itself is configuration for that
9599
resource. This is dependent on each resource provider and
96100
is fully documented within our
97101
[providers reference](/docs/providers/index.html). For our EC2 instance, we specify
98-
an AMI for Ubuntu, and request a "t1.micro" instance so we
102+
an AMI for Ubuntu, and request a "t2.micro" instance so we
99103
qualify under the free tier.
100104

101105
## Execution Plan
@@ -111,16 +115,24 @@ $ terraform plan
111115
...
112116
113117
+ aws_instance.example
114-
ami: "" => "ami-408c7f28"
115-
availability_zone: "" => "<computed>"
116-
instance_type: "" => "t1.micro"
117-
key_name: "" => "<computed>"
118-
private_dns: "" => "<computed>"
119-
private_ip: "" => "<computed>"
120-
public_dns: "" => "<computed>"
121-
public_ip: "" => "<computed>"
122-
security_groups: "" => "<computed>"
123-
subnet_id: "" => "<computed>"
118+
ami: "ami-0d729a60"
119+
availability_zone: "<computed>"
120+
ebs_block_device.#: "<computed>"
121+
ephemeral_block_device.#: "<computed>"
122+
instance_state: "<computed>"
123+
instance_type: "t2.micro"
124+
key_name: "<computed>"
125+
placement_group: "<computed>"
126+
private_dns: "<computed>"
127+
private_ip: "<computed>"
128+
public_dns: "<computed>"
129+
public_ip: "<computed>"
130+
root_block_device.#: "<computed>"
131+
security_groups.#: "<computed>"
132+
source_dest_check: "true"
133+
subnet_id: "<computed>"
134+
tenancy: "<computed>"
135+
vpc_security_group_ids.#: "<computed>"
124136
```
125137

126138
`terraform plan` shows what changes Terraform will apply to
@@ -148,8 +160,12 @@ since Terraform waits for the EC2 instance to become available.
148160
```
149161
$ terraform apply
150162
aws_instance.example: Creating...
151-
ami: "" => "ami-408c7f28"
152-
instance_type: "" => "t1.micro"
163+
ami: "" => "ami-0d729a60"
164+
instance_type: "" => "t2.micro"
165+
[...]
166+
167+
aws_instance.example: Still creating... (10s elapsed)
168+
aws_instance.example: Creation complete
153169
154170
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
155171
@@ -171,18 +187,17 @@ You can inspect the state using `terraform show`:
171187
```
172188
$ terraform show
173189
aws_instance.example:
174-
id = i-e60900cd
175-
ami = ami-408c7f28
176-
availability_zone = us-east-1c
177-
instance_type = t1.micro
178-
key_name =
179-
private_dns = domU-12-31-39-12-38-AB.compute-1.internal
180-
private_ip = 10.200.59.89
181-
public_dns = ec2-54-81-21-192.compute-1.amazonaws.com
182-
public_ip = 54.81.21.192
183-
security_groups.# = 1
184-
security_groups.0 = default
185-
subnet_id =
190+
id = i-32cf65a8
191+
ami = ami-0d729a60
192+
availability_zone = us-east-1a
193+
instance_state = running
194+
instance_type = t2.micro
195+
private_ip = 172.31.30.244
196+
public_dns = ec2-52-90-212-55.compute-1.amazonaws.com
197+
public_ip = 52.90.212.55
198+
subnet_id = subnet-1497024d
199+
vpc_security_group_ids.# = 1
200+
vpc_security_group_ids.3348721628 = sg-67652003
186201
```
187202

188203
You can see that by creating our resource, we've also gathered

‎website/source/intro/getting-started/change.html.md‎

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ resource in your configuration and change it to the following:
2828

2929
```
3030
resource "aws_instance" "example" {
31-
ami = "ami-b8b061d0"
32-
instance_type = "t1.micro"
31+
ami = "ami-13be557e"
32+
instance_type = "t2.micro"
3333
}
3434
```
3535

36-
We've changed the AMI from being an Ubuntu 14.04 AMI to being
37-
an Ubuntu 12.04 AMI. Terraform configurations are meant to be
36+
~> **Note:** EC2 Classic users please use AMI `ami-2106ed4c` and type `t1.micro`
37+
38+
We've changed the AMI from being an Ubuntu 14.04 LTS AMI to being
39+
an Ubuntu 16.04 LTS AMI. Terraform configurations are meant to be
3840
changed like this. You can also completely remove resources
3941
and Terraform will know to destroy the old one.
4042

@@ -47,15 +49,18 @@ $ terraform plan
4749
...
4850
4951
-/+ aws_instance.example
50-
ami: "ami-408c7f28" => "ami-b8b061d0" (forces new resource)
51-
availability_zone: "us-east-1c" => "<computed>"
52-
key_name: "" => "<computed>"
53-
private_dns: "domU-12-31-39-12-38-AB.compute-1.internal" => "<computed>"
54-
private_ip: "10.200.59.89" => "<computed>"
55-
public_dns: "ec2-54-81-21-192.compute-1.amazonaws.com" => "<computed>"
56-
public_ip: "54.81.21.192" => "<computed>"
57-
security_groups: "" => "<computed>"
58-
subnet_id: "" => "<computed>"
52+
ami: "ami-0d729a60" => "ami-13be557e" (forces new resource)
53+
availability_zone: "us-east-1a" => "<computed>"
54+
ebs_block_device.#: "0" => "<computed>"
55+
ephemeral_block_device.#: "0" => "<computed>"
56+
instance_state: "running" => "<computed>"
57+
instance_type: "t2.micro" => "t2.micro"
58+
private_dns: "ip-172-31-17-94.ec2.internal" => "<computed>"
59+
private_ip: "172.31.17.94" => "<computed>"
60+
public_dns: "ec2-54-82-183-4.compute-1.amazonaws.com" => "<computed>"
61+
public_ip: "54.82.183.4" => "<computed>"
62+
subnet_id: "subnet-1497024d" => "<computed>"
63+
vpc_security_group_ids.#: "1" => "<computed>"
5964
```
6065

6166
The prefix "-/+" means that Terraform will destroy and recreate
@@ -77,11 +82,33 @@ the change.
7782

7883
```
7984
$ terraform apply
85+
aws_instance.example: Refreshing state... (ID: i-64c268fe)
8086
aws_instance.example: Destroying...
81-
aws_instance.example: Modifying...
82-
ami: "ami-408c7f28" => "ami-b8b061d0"
83-
84-
Apply complete! Resources: 0 added, 1 changed, 1 destroyed.
87+
aws_instance.example: Destruction complete
88+
aws_instance.example: Creating...
89+
ami: "" => "ami-13be557e"
90+
availability_zone: "" => "<computed>"
91+
ebs_block_device.#: "" => "<computed>"
92+
ephemeral_block_device.#: "" => "<computed>"
93+
instance_state: "" => "<computed>"
94+
instance_type: "" => "t2.micro"
95+
key_name: "" => "<computed>"
96+
placement_group: "" => "<computed>"
97+
private_dns: "" => "<computed>"
98+
private_ip: "" => "<computed>"
99+
public_dns: "" => "<computed>"
100+
public_ip: "" => "<computed>"
101+
root_block_device.#: "" => "<computed>"
102+
security_groups.#: "" => "<computed>"
103+
source_dest_check: "" => "true"
104+
subnet_id: "" => "<computed>"
105+
tenancy: "" => "<computed>"
106+
vpc_security_group_ids.#: "" => "<computed>"
107+
aws_instance.example: Still creating... (10s elapsed)
108+
aws_instance.example: Still creating... (20s elapsed)
109+
aws_instance.example: Creation complete
110+
111+
Apply complete! Resources: 1 added, 0 changed, 1 destroyed.
85112
86113
...
87114
```

‎website/source/intro/getting-started/dependencies.html.md‎

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,35 @@ will look something like the following:
5959

6060
```
6161
$ terraform plan
62-
...
6362
6463
+ aws_eip.ip
65-
instance: "" => "${aws_instance.example.id}"
66-
private_ip: "" => "<computed>"
67-
public_ip: "" => "<computed>"
64+
allocation_id: "<computed>"
65+
association_id: "<computed>"
66+
domain: "<computed>"
67+
instance: "${aws_instance.example.id}"
68+
network_interface: "<computed>"
69+
private_ip: "<computed>"
70+
public_ip: "<computed>"
6871
6972
+ aws_instance.example
70-
ami: "" => "ami-b8b061d0"
71-
availability_zone: "" => "<computed>"
72-
instance_type: "" => "t1.micro"
73-
key_name: "" => "<computed>"
74-
private_dns: "" => "<computed>"
75-
private_ip: "" => "<computed>"
76-
public_dns: "" => "<computed>"
77-
public_ip: "" => "<computed>"
78-
security_groups: "" => "<computed>"
79-
subnet_id: "" => "<computed>"
73+
ami: "ami-13be557e"
74+
availability_zone: "<computed>"
75+
ebs_block_device.#: "<computed>"
76+
ephemeral_block_device.#: "<computed>"
77+
instance_state: "<computed>"
78+
instance_type: "t2.micro"
79+
key_name: "<computed>"
80+
placement_group: "<computed>"
81+
private_dns: "<computed>"
82+
private_ip: "<computed>"
83+
public_dns: "<computed>"
84+
public_ip: "<computed>"
85+
root_block_device.#: "<computed>"
86+
security_groups.#: "<computed>"
87+
source_dest_check: "true"
88+
subnet_id: "<computed>"
89+
tenancy: "<computed>"
90+
vpc_security_group_ids.#: "<computed>"
8091
```
8192

8293
Terraform will create two resources: the instance and the elastic
@@ -89,11 +100,22 @@ Next, run `terraform apply`. The output will look similar to the
89100
following:
90101

91102
```
103+
$ terraform apply
92104
aws_instance.example: Creating...
93-
ami: "" => "ami-b8b061d0"
94-
instance_type: "" => "t1.micro"
105+
ami: "" => "ami-13be557e"
106+
instance_type: "" => "t2.micro"
107+
[..]
108+
aws_instance.example: Still creating... (10s elapsed)
109+
aws_instance.example: Creation complete
95110
aws_eip.ip: Creating...
96-
instance: "" => "i-0e737b25"
111+
allocation_id: "" => "<computed>"
112+
association_id: "" => "<computed>"
113+
domain: "" => "<computed>"
114+
instance: "" => "i-f3d77d69"
115+
network_interface: "" => "<computed>"
116+
private_ip: "" => "<computed>"
117+
public_ip: "" => "<computed>"
118+
aws_eip.ip: Creation complete
97119
98120
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
99121
```
@@ -144,8 +166,8 @@ created in parallel to everything else.
144166

145167
```
146168
resource "aws_instance" "another" {
147-
ami = "ami-b8b061d0"
148-
instance_type = "t1.micro"
169+
ami = "ami-13be557e"
170+
instance_type = "t2.micro"
149171
}
150172
```
151173

‎website/source/intro/getting-started/provision.html.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ To define a provisioner, modify the resource block defining the
2525

2626
```
2727
resource "aws_instance" "example" {
28-
ami = "ami-b8b061d0"
29-
instance_type = "t1.micro"
28+
ami = "ami-13be557e"
29+
instance_type = "t2.micro"
3030
31-
provisioner "local-exec" {
32-
command = "echo ${aws_instance.example.public_ip} > file.txt"
33-
}
31+
provisioner "local-exec" {
32+
command = "echo ${aws_instance.example.public_ip} > file.txt"
33+
}
3434
}
3535
```
3636

@@ -61,8 +61,8 @@ then run `apply`:
6161
```
6262
$ terraform apply
6363
aws_instance.example: Creating...
64-
ami: "" => "ami-b8b061d0"
65-
instance_type: "" => "t1.micro"
64+
ami: "" => "ami-13be557e"
65+
instance_type: "" => "t2.micro"
6666
aws_eip.ip: Creating...
6767
instance: "" => "i-213f350a"
6868

‎website/source/intro/getting-started/variables.html.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ support for the "us-west-2" region as well:
124124
variable "amis" {
125125
type = "map"
126126
default = {
127-
us-east-1 = "ami-b8b061d0"
128-
us-west-2 = "ami-ef5e24df"
127+
us-east-1 = "ami-13be557e"
128+
us-west-2 = "ami-06b94666"
129129
}
130130
}
131131
```
@@ -138,7 +138,7 @@ Then, replace the "aws\_instance" with the following:
138138
```
139139
resource "aws_instance" "example" {
140140
ami = "${lookup(var.amis, var.region)}"
141-
instance_type = "t1.micro"
141+
instance_type = "t2.micro"
142142
}
143143
```
144144

0 commit comments

Comments
 (0)