Skip to content

Commit fcc823e

Browse files
committed
added name variable to aws
1 parent 8ec572d commit fcc823e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

infrastructure-as-code/aws-ec2-instance/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
This Terraform configuration provisions an EC2 instance in AWS.
33

44
## Details
5-
By default, this configuration provisions a Ubuntu 14.04 Base Image AMI (with ID ami-2e1ef954) with type t2.micro in the us-east-1 region. But the AMI ID, region, and type can all be set as variables.
5+
By default, this configuration provisions a Ubuntu 14.04 Base Image AMI (with ID ami-2e1ef954) with type t2.micro in the us-east-1 region. The AMI ID, region, and type can all be set as variables. You can also set the name variable to determine the value set for the Name tag.
66

77
Note that you need to set environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

infrastructure-as-code/aws-ec2-instance/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ resource "aws_instance" "ubuntu" {
1212
availability_zone = "${var.aws_region}a"
1313

1414
tags {
15-
Name = "Provisioned-by-Terraform"
15+
Name = "${var.name}"
1616
}
1717
}

infrastructure-as-code/aws-ec2-instance/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ variable "instance_type" {
1212
description = "type of EC2 instance to provision."
1313
default = "t2.micro"
1414
}
15+
16+
variable "name" {
17+
description = "name to pass to Name tag"
18+
default = "Provisioned by Terraform"
19+
}

0 commit comments

Comments
 (0)