From 8181a5ef61982fd55d2e1fbb4c23a2d14a3dab06 Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Wed, 19 Oct 2022 09:00:32 -0500 Subject: [PATCH 01/10] Create providers.tf --- providers.tf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 providers.tf diff --git a/providers.tf b/providers.tf new file mode 100644 index 0000000..a97b619 --- /dev/null +++ b/providers.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.27" + } + } + + required_version = ">= 0.14.9" +} + +provider "aws" { + profile = "default" + region = "us-east-1" +} From 630c1b49fe07ac27f64059ef1dac16a92c9cadf1 Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Wed, 19 Oct 2022 09:04:45 -0500 Subject: [PATCH 02/10] Create variables.tf --- variables.tf | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 variables.tf diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..e40fd7c --- /dev/null +++ b/variables.tf @@ -0,0 +1,19 @@ +variable "region" { + type = string + default = "us-east-1" +} + +variable "ami" { + type = string + default = "ami-026b57f3c383c2eec" +} + +variable "instance_type" { + type = string + default = "t2.micro" +} + +variable "tag" { + type = string + default = "acoop_instance" +} From 5a0c4ac28d59c2b724e732e3a3b7baf4165501fc Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Wed, 19 Oct 2022 09:07:59 -0500 Subject: [PATCH 03/10] Create main.tf --- main.tf | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 main.tf diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..e675bef --- /dev/null +++ b/main.tf @@ -0,0 +1,8 @@ +resource "aws_instance" "app_server" { + ami = var.ami + instance_type = var.instance_type + + tags = { + Name = var.tag + } +} From 2101d7620c15b932a5b4e7e763afb8bddb43d99b Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Wed, 19 Oct 2022 09:10:08 -0500 Subject: [PATCH 04/10] Create outputs.tf --- outputs.tf | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 outputs.tf diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..72d8678 --- /dev/null +++ b/outputs.tf @@ -0,0 +1,9 @@ +output "instance_id" { + description = "EC2 Instance ID" + value = aws_instance.app_server.id +} + +output "instance_public_ip" { + description = "Public IP to EC2 Instance" + value = aws_instance.app_server.public_ip +} From 98d017356cc6e9990a21bc19f14d5dd2b1b3e934 Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Wed, 19 Oct 2022 09:29:25 -0500 Subject: [PATCH 05/10] Create module.tf --- module.tf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 module.tf diff --git a/module.tf b/module.tf new file mode 100644 index 0000000..f5ddc22 --- /dev/null +++ b/module.tf @@ -0,0 +1,3 @@ +module "ec2-module" { + source = "./module/ec2/" +} From ec2f76b6ec5e46ea9ebeaeb06ef7c27393cd7e4b Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Wed, 19 Oct 2022 11:16:54 -0500 Subject: [PATCH 06/10] Update ec2.tf --- ec2.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ec2.tf b/ec2.tf index f55bdd8..b9650a0 100644 --- a/ec2.tf +++ b/ec2.tf @@ -11,7 +11,7 @@ terraform { provider "aws" { profile = "default" - region = "us-west-2" + region = "us-east-1" } resource "aws_instance" "app_server" { From a2ccccf510ed9bde042b71e296d91899d4de690c Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Fri, 21 Oct 2022 12:27:14 -0500 Subject: [PATCH 07/10] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a023c9 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# terraformec2 From 6ce50593764aa27504766cf4d4a62cbb9e5b1e16 Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Mon, 24 Oct 2022 09:04:07 -0500 Subject: [PATCH 08/10] Update ec2.tf --- ec2.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ec2.tf b/ec2.tf index b9650a0..f55bdd8 100644 --- a/ec2.tf +++ b/ec2.tf @@ -11,7 +11,7 @@ terraform { provider "aws" { profile = "default" - region = "us-east-1" + region = "us-west-2" } resource "aws_instance" "app_server" { From 20b7859af3d1a78aa99e75d612246652e03610a9 Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Mon, 24 Oct 2022 09:06:20 -0500 Subject: [PATCH 09/10] Update variables.tf --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index e40fd7c..570bcf9 100644 --- a/variables.tf +++ b/variables.tf @@ -1,6 +1,6 @@ variable "region" { type = string - default = "us-east-1" + default = "us-west-2" } variable "ami" { From 763583402fa06bc58c566ca5105bf598a9632b45 Mon Sep 17 00:00:00 2001 From: Ashlee Cooper Date: Mon, 24 Oct 2022 09:07:44 -0500 Subject: [PATCH 10/10] Update providers.tf --- providers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers.tf b/providers.tf index a97b619..b935e84 100644 --- a/providers.tf +++ b/providers.tf @@ -11,5 +11,5 @@ terraform { provider "aws" { profile = "default" - region = "us-east-1" + region = "var.region" }