Browse Source

[Camilla] Adds tag name to EC2 instance

Camilla 2 years ago
parent
commit
3f70ce512e
3 changed files with 13 additions and 1 deletions
  1. 1 0
      terraform/.gitignore
  2. 8 1
      terraform/README.md
  3. 4 0
      terraform/main.tf

+ 1 - 0
terraform/.gitignore

@@ -1 +1,2 @@
1 1
 terraform.tfstate
2
+terraform.tfstate.backup

+ 8 - 1
terraform/README.md

@@ -1,4 +1,4 @@
1
-#Terraform Spike
1
+# Terraform Spike
2 2
 
3 3
 ## Setup Terraform on your machine
4 4
 ```
@@ -16,6 +16,10 @@ Paste in the following code to create a simple EC2 Instance (replace with correc
16 16
 resource "aws_instance" "example" {
17 17
   ami = "ami-95f8d2f3"
18 18
   instance_type = "t2.micro"
19
+
20
+  tags {
21
+    Name = "terraform-hello-world"
22
+  }
19 23
 }
20 24
 ```
21 25
 
@@ -29,3 +33,6 @@ To actually run the file:
29 33
 ```
30 34
 terraform apply
31 35
 ```
36
+
37
+## Resources
38
+- (Introduction to Terraform (this is now OReilly book))[https://blog.gruntwork.io/an-introduction-to-terraform-f17df9c6d180]

+ 4 - 0
terraform/main.tf

@@ -1,4 +1,8 @@
1 1
 resource "aws_instance" "example" {
2 2
   ami = "ami-95f8d2f3"
3 3
   instance_type = "t2.micro"
4
+
5
+  tags {
6
+    Name = "terraform-hello-world"
7
+  }
4 8
 }