From 23df67978bf47ddc1c49a00457bc132676cd6618 Mon Sep 17 00:00:00 2001 From: Sewanu Date: Tue, 15 Nov 2022 13:27:53 +0000 Subject: [PATCH 1/3] modified --- 01_05_base/.terraform.lock.hcl | 21 +++++++++++++++++++++ 02_01_variables/.terraform.lock.hcl | 24 ++++++++++++++++++++++++ 02_01_variables/main.tf | 14 ++++++++++---- 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 01_05_base/.terraform.lock.hcl create mode 100644 02_01_variables/.terraform.lock.hcl diff --git a/01_05_base/.terraform.lock.hcl b/01_05_base/.terraform.lock.hcl new file mode 100644 index 0000000..4b39d8f --- /dev/null +++ b/01_05_base/.terraform.lock.hcl @@ -0,0 +1,21 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "4.36.1" + hashes = [ + "h1:04NI9x34nwhgghwevSGdsjssqy5zzvMsQg2Qjpmx/n0=", + "zh:19b16047b4f15e9b8538a2b925f1e860463984eed7d9bd78e870f3e884e827a7", + "zh:3c0db06a9a14b05a77f3fe1fc029a5fb153f4966964790ca8e71ecc3427d83f5", + "zh:3c7407a8229005e07bc274cbae6e3a464c441a88810bfc6eceb2414678fd08ae", + "zh:3d96fa82c037fafbd3e7f4edc1de32afb029416650f6e392c39182fc74a9e03a", + "zh:8f4f540c5f63d847c4b802ca84d148bb6275a3b0723deb09bf933a4800bc7209", + "zh:9802cb77472d6bcf24c196ce2ca6d02fac9db91558536325fec85f955b71a8a4", + "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", + "zh:a263352433878c89832c2e38f4fd56cf96ae9969c13b5c710d5ba043cbd95743", + "zh:aca7954a5f458ceb14bf0c04c961c4e1e9706bf3b854a1e90a97d0b20f0fe6d3", + "zh:d78f400332e87a97cce2e080db9d01beb01f38f5402514a6705d6b8167e7730d", + "zh:e14bdc49be1d8b7d2543d5c58078c84b76051085e8e6715a895dcfe6034b6098", + "zh:f2e400b88c8de170bb5027922226da1e9a6614c03f2a6756c15c3b930c2f460c", + ] +} diff --git a/02_01_variables/.terraform.lock.hcl b/02_01_variables/.terraform.lock.hcl new file mode 100644 index 0000000..3ca91b1 --- /dev/null +++ b/02_01_variables/.terraform.lock.hcl @@ -0,0 +1,24 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "4.39.0" + hashes = [ + "h1:tM2mSfH03Ert/Qd+EUMIavtwjPCM/no91VBH/8vobCE=", + "zh:08e3d453bbeaccda3f4ab7ae45f81d515ab49a765ce2d43f060842bb2e653846", + "zh:238a460231e9e6ca786b2cb2088a98edfc48f0e36c433edd7d65a250980f7566", + "zh:4d5663c2cf521e91caddd5508b13759110bc21b2e9543ff6a9f8cf8d02af1aeb", + "zh:5b397e46aac6db155b4b9162ac168010473d6309ae363301f0335184c1f50be6", + "zh:7178536cfebc6423336798aead72fe774f4d8118ae19ffe6a6a1108fe60608d7", + "zh:867c5269cea2fe15f7ea837507ad0fe97e8913be4348868b284c12217d689457", + "zh:88db4bb188f68011cb05eefb3ea7e5741da1d9acdb3c7bd517e715dfc8c0cfc3", + "zh:95b4da4bdbb2eb02333e52c2ced0c5f133d854f730e3744c0c239268c21feee6", + "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", + "zh:9bbe67eaa03bfb293913431b39879385e42473bdb61be842fd78b3c89333f1ba", + "zh:a06b9b5fbe8c84a0da431a22d9dd583143406846c1d8febe06f62fc89aeccd1d", + "zh:cb925338b164e916f289e717f8ecaacf5fd5df56790ec6296158e76d6131b914", + "zh:d9dbf68b0defc220085eda1348f439f724ce83a0636bec18dc83aa73fe2385d5", + "zh:eb59e6234e73bd0d48fe372201155802c9b920711a1da078e5b07508271312ee", + "zh:f68b2685ee86bcf314d74a20e97b5cbe0c63741827143f7a4ba7ec56555329dc", + ] +} diff --git a/02_01_variables/main.tf b/02_01_variables/main.tf index ff9d644..a4ee346 100644 --- a/02_01_variables/main.tf +++ b/02_01_variables/main.tf @@ -22,6 +22,10 @@ variable "environment_list" { default = ["DEV","QA","STAGE","PROD"] } +variable "deploy_environment" { + default = "DEV" +} + variable "environment_map" { type = map(string) default = { @@ -141,14 +145,16 @@ resource "aws_security_group" "sg-nodejs-instance" { # INSTANCE resource "aws_instance" "nodejs1" { ami = data.aws_ami.aws-linux.id - instance_type = var.environment_instance_type["DEV"] - //instance_type = var.environment_instance_settings["PROD"].instance_type + //instance_type = var.environment_instance_type["DEV"] + instance_type = var.environment_instance_settings[var.deploy_environment].instance_type subnet_id = aws_subnet.subnet1.id vpc_security_group_ids = [aws_security_group.sg-nodejs-instance.id] - monitoring = var.environment_instance_settings["PROD"].monitoring + monitoring = var.environment_instance_settings[var.deploy_environment].monitoring - tags = {Environment = var.environment_list[0]} + //tags = {Environment = var.environment_list[0]} + //tags = {Environment = var.deploy_environment[0]} + tags = {Environment = var.environment_map[var.deploy_environment]} } From 48a41cadd35c3ec0f161704cb73a27afcf9b39b2 Mon Sep 17 00:00:00 2001 From: Sewanu Projects <55129150+sewanu@users.noreply.github.com> Date: Tue, 6 Dec 2022 18:14:23 -0500 Subject: [PATCH 2/3] changes made to s3 name --- 03_02-03_remotestate/commands.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03_02-03_remotestate/commands.txt b/03_02-03_remotestate/commands.txt index 39d0f1c..e72035a 100644 --- a/03_02-03_remotestate/commands.txt +++ b/03_02-03_remotestate/commands.txt @@ -1,5 +1,5 @@ terraform init \ - -backend-config="bucket=red30-tfstate" \ + -backend-config="bucket=sewared30-tfstate" \ -backend-config="key=red30/ecommerceapp/app.state" \ -backend-config="region=us-east-2" \ -backend-config="dynamodb_table=red30-tfstatelock" \ From dc968e087217f9614370151ec3d44d969eeabb0d Mon Sep 17 00:00:00 2001 From: Sewanu Projects <55129150+sewanu@users.noreply.github.com> Date: Wed, 7 Dec 2022 17:17:42 -0500 Subject: [PATCH 3/3] commit update --- 03_02-03_remotestate/remote_resources/s3_backend.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/03_02-03_remotestate/remote_resources/s3_backend.tf b/03_02-03_remotestate/remote_resources/s3_backend.tf index 0f0f424..4892f55 100644 --- a/03_02-03_remotestate/remote_resources/s3_backend.tf +++ b/03_02-03_remotestate/remote_resources/s3_backend.tf @@ -28,7 +28,7 @@ data "aws_iam_user" "terraform" { # ////////////////////////////// # S3 BUCKET # ////////////////////////////// -resource "aws_s3_bucket" "red30-tfremotestate" { +resource "aws_s3_bucket" "sssred30-tfremotestate" { bucket = var.bucket_name force_destroy = true acl = "private" @@ -68,7 +68,7 @@ resource "aws_s3_bucket_public_access_block" "red30-tfremotestate" { # ////////////////////////////// # DYNAMODB TABLE # ////////////////////////////// -resource "aws_dynamodb_table" "tf_db_statelock" { +resource "aws_dynamodb_table" "ssstf_db_statelock" { name = "red30-tfstatelock" read_capacity = 20 write_capacity = 20