Correct README.md and add missing variable. Correct README.md execution instructions var name and use 'key_name' var as intended in 'aws_key_pair' resource
This commit is contained in:
parent
f4e274b2e3
commit
b923e879bd
|
@ -10,6 +10,10 @@ getting your application onto the servers. However, you could do so either via
|
||||||
management tool, or by pre-baking configured AMIs with
|
management tool, or by pre-baking configured AMIs with
|
||||||
[Packer](http://www.packer.io).
|
[Packer](http://www.packer.io).
|
||||||
|
|
||||||
|
This example will also create a new EC2 Key Pair in the specified AWS Region.
|
||||||
|
The key name and path to the public key must be specified via the
|
||||||
|
terraform command vars.
|
||||||
|
|
||||||
After you run `terraform apply` on this configuration, it will
|
After you run `terraform apply` on this configuration, it will
|
||||||
automatically output the DNS address of the ELB. After your instance
|
automatically output the DNS address of the ELB. After your instance
|
||||||
registers, this should respond with the default nginx web page.
|
registers, this should respond with the default nginx web page.
|
||||||
|
@ -22,11 +26,11 @@ Run with a command like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
terraform apply -var 'key_name={your_aws_key_name}' \
|
terraform apply -var 'key_name={your_aws_key_name}' \
|
||||||
-var 'key_path={location_of_your_key_in_your_local_machine}'`
|
-var 'public_key_path={location_of_your_key_in_your_local_machine}'`
|
||||||
```
|
```
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```
|
```
|
||||||
terraform apply -var 'key_name=terraform' -var 'key_path=/Users/jsmith/.ssh/terraform.pem'
|
terraform apply -var 'key_name=terraform' -var 'public_key_path=/Users/jsmith/.ssh/terraform.pub'
|
||||||
```
|
```
|
||||||
|
|
|
@ -100,7 +100,7 @@ resource "aws_elb" "web" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_key_pair" "auth" {
|
resource "aws_key_pair" "auth" {
|
||||||
key_name = "tf-aws-two-tier-example"
|
key_name = "${var.key_name}"
|
||||||
public_key = "${file(var.public_key_path)}"
|
public_key = "${file(var.public_key_path)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,14 @@ Path to the SSH public key to be used for authentication.
|
||||||
Ensure this keypair is added to your local SSH agent so provisioners can
|
Ensure this keypair is added to your local SSH agent so provisioners can
|
||||||
connect.
|
connect.
|
||||||
|
|
||||||
Example: ~/.ssh/id_rsa.pub
|
Example: ~/.ssh/terraform.pub
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "key_name" {
|
||||||
|
description = "Desired name of AWS key pair"
|
||||||
|
}
|
||||||
|
|
||||||
variable "aws_region" {
|
variable "aws_region" {
|
||||||
description = "AWS region to launch servers."
|
description = "AWS region to launch servers."
|
||||||
default = "us-west-2"
|
default = "us-west-2"
|
||||||
|
|
Loading…
Reference in New Issue