File tree Expand file tree Collapse file tree
website/source/intro/examples Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,11 +22,25 @@ After you run `terraform apply` on this configuration, it will
2222automatically output the DNS address of the ELB. After your instance
2323registers, 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```
2841variable "aws_access_key" {}
2942variable "aws_secret_key" {}
43+ variable "key_path" {}
3044variable "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}"]
You can’t perform that action at this time.
0 commit comments