Skip to content

Commit 80b6640

Browse files
committed
website: move key vars out of AWS confiuration
1 parent c3b0417 commit 80b6640

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

‎website/source/intro/examples/aws.html.markdown‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,25 @@ After you run `terraform apply` on this configuration, it will
2222
automatically output the DNS address of the ELB. After your instance
2323
registers, this should respond with the default nginx web page.
2424

25+
The configuration file contains comments describing each
26+
resource.
27+
28+
## Command
29+
30+
```
31+
terraform apply \
32+
-var 'aws_access_key=YOUR_ACCESS_KEY' \
33+
-var 'aws_secret_key=YOUR_SECRET_KEY' \
34+
-var 'key_path=/path/to/key/pair.pem' \
35+
-var 'key_name=keypair-name'
36+
```
37+
2538
## Configuration
2639

2740
```
2841
variable "aws_access_key" {}
2942
variable "aws_secret_key" {}
43+
variable "key_path" {}
3044
variable "aws_region" {
3145
default = "us-west-2"
3246
}
@@ -98,7 +112,7 @@ resource "aws_instance" "web" {
98112
user = "ubuntu"
99113
100114
# The path to your keyfile
101-
key_file = "/Users/pearkes/Desktop/hashicorp-demo.pem"
115+
key_file = "${var.key_path}"
102116
}
103117
104118
instance_type = "m1.small"
@@ -112,7 +126,7 @@ resource "aws_instance" "web" {
112126
#
113127
# https://console.aws.amazon.com/ec2/v2/home?region=us-west-2#KeyPairs:
114128
#
115-
key_name = "hashicorp-demo"
129+
key_name = "${var.key_name}"
116130
117131
# Our Security group to allow HTTP and SSH access
118132
security_groups = ["${aws_security_group.default.name}"]

0 commit comments

Comments
 (0)