Skip to content

Commit 8458661

Browse files
committed
Merge pull request hashicorp#4451 from daniel-bryant-uk/fix_aws_two_tier_example
Correct 'aws-two-tier' example README.md and add missing variable
2 parents c7573de + b923e87 commit 8458661

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

examples/aws-two-tier/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ getting your application onto the servers. However, you could do so either via
1010
management tool, or by pre-baking configured AMIs with
1111
[Packer](http://www.packer.io).
1212

13+
This example will also create a new EC2 Key Pair in the specified AWS Region.
14+
The key name and path to the public key must be specified via the
15+
terraform command vars.
16+
1317
After you run `terraform apply` on this configuration, it will
1418
automatically output the DNS address of the ELB. After your instance
1519
registers, this should respond with the default nginx web page.
@@ -22,11 +26,11 @@ Run with a command like this:
2226

2327
```
2428
terraform apply -var 'key_name={your_aws_key_name}' \
25-
-var 'key_path={location_of_your_key_in_your_local_machine}'`
29+
-var 'public_key_path={location_of_your_key_in_your_local_machine}'`
2630
```
2731

2832
For example:
2933

3034
```
31-
terraform apply -var 'key_name=terraform' -var 'key_path=/Users/jsmith/.ssh/terraform.pem'
35+
terraform apply -var 'key_name=terraform' -var 'public_key_path=/Users/jsmith/.ssh/terraform.pub'
3236
```

examples/aws-two-tier/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ resource "aws_elb" "web" {
100100
}
101101

102102
resource "aws_key_pair" "auth" {
103-
key_name = "tf-aws-two-tier-example"
103+
key_name = "${var.key_name}"
104104
public_key = "${file(var.public_key_path)}"
105105
}
106106

examples/aws-two-tier/variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ Path to the SSH public key to be used for authentication.
44
Ensure this keypair is added to your local SSH agent so provisioners can
55
connect.
66
7-
Example: ~/.ssh/id_rsa.pub
7+
Example: ~/.ssh/terraform.pub
88
DESCRIPTION
99
}
1010

11+
variable "key_name" {
12+
description = "Desired name of AWS key pair"
13+
}
14+
1115
variable "aws_region" {
1216
description = "AWS region to launch servers."
1317
default = "us-west-2"

0 commit comments

Comments
 (0)