diff --git a/.gitignore b/.gitignore index 861fb3f4..c08c456e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ *.tfstate.backup #.terraform.lock.hcl #*.tfvars +secrets.tfvars # Ignore .pem files #*.pem diff --git a/02-Terraform-Basics/02-02-Terraform-Command-Basics/terraform-manifests/.terraform.lock.hcl b/02-Terraform-Basics/02-02-Terraform-Command-Basics/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..ff0e4396 --- /dev/null +++ b/02-Terraform-Basics/02-02-Terraform-Command-Basics/terraform-manifests/.terraform.lock.hcl @@ -0,0 +1,20 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "3.61.0" + hashes = [ + "h1:YZaozdn4J1Ax01NkubRAdv809vlpJOXRBC4KsqBzpvA=", + "zh:0483ca802ddb0ae4f73144b4357ba72242c6e2641aeb460b1aa9a6f6965464b0", + "zh:274712214ebeb0c1269cbc468e5705bb5741dc45b05c05e9793ca97f22a1baa1", + "zh:3c6bd97a2ca809469ae38f6893348386c476cb3065b120b785353c1507401adf", + "zh:53dd41a9aed9860adbbeeb71a23e4f8195c656fd15a02c90fa2d302a5f577d8c", + "zh:65c639c547b97bc880fd83e65511c0f4bbfc91b63cada3b8c0d5776444221700", + "zh:a2769e19137ff480c1dd3e4f248e832df90fb6930a22c66264d9793895161714", + "zh:a5897a99332cc0071e46a71359b86a8e53ab09c1453e94cd7cf45a0b577ff590", + "zh:bdc2353642d16d8e2437a9015cd4216a1772be9736645cc17d1a197480e2b5b7", + "zh:cbeace1deae938f6c0aca3734e6088f3633ca09611aff701c15cb6d42f2b918a", + "zh:d33ca19012aabd98cc03fdeccd0bd5ce56e28f61a1dfbb2eea88e89487de7fb3", + "zh:d548b29a864b0687e85e8a993f208e25e3ecc40fcc5b671e1985754b32fdd658", + ] +} diff --git a/02-Terraform-Basics/02-02-Terraform-Command-Basics/terraform-manifests/ec2-instance.tf b/02-Terraform-Basics/02-02-Terraform-Command-Basics/terraform-manifests/ec2-instance.tf index 8b007c8c..fda513fa 100644 --- a/02-Terraform-Basics/02-02-Terraform-Command-Basics/terraform-manifests/ec2-instance.tf +++ b/02-Terraform-Basics/02-02-Terraform-Command-Basics/terraform-manifests/ec2-instance.tf @@ -11,11 +11,11 @@ terraform { # Provider Block provider "aws" { profile = "default" # AWS Credentials Profile configured on your local desktop terminal $HOME/.aws/credentials - region = "us-east-1" + region = "eu-west-1" } # Resource Block resource "aws_instance" "ec2demo" { - ami = "ami-0be2609ba883822ec" # Amazon Linux in us-east-1, update as per your region + ami = "ami-0d1bf5b68307103c2" # Amazon Linux in us-east-1, update as per your region instance_type = "t2.micro" } diff --git a/03-Terraform-Fundamental-Blocks/03-01-Terraform-Block/terraform-manifests/.terraform.lock.hcl b/03-Terraform-Fundamental-Blocks/03-01-Terraform-Block/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..32ddaf71 --- /dev/null +++ b/03-Terraform-Fundamental-Blocks/03-01-Terraform-Block/terraform-manifests/.terraform.lock.hcl @@ -0,0 +1,40 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "3.61.0" + constraints = "~> 3.0" + hashes = [ + "h1:YZaozdn4J1Ax01NkubRAdv809vlpJOXRBC4KsqBzpvA=", + "zh:0483ca802ddb0ae4f73144b4357ba72242c6e2641aeb460b1aa9a6f6965464b0", + "zh:274712214ebeb0c1269cbc468e5705bb5741dc45b05c05e9793ca97f22a1baa1", + "zh:3c6bd97a2ca809469ae38f6893348386c476cb3065b120b785353c1507401adf", + "zh:53dd41a9aed9860adbbeeb71a23e4f8195c656fd15a02c90fa2d302a5f577d8c", + "zh:65c639c547b97bc880fd83e65511c0f4bbfc91b63cada3b8c0d5776444221700", + "zh:a2769e19137ff480c1dd3e4f248e832df90fb6930a22c66264d9793895161714", + "zh:a5897a99332cc0071e46a71359b86a8e53ab09c1453e94cd7cf45a0b577ff590", + "zh:bdc2353642d16d8e2437a9015cd4216a1772be9736645cc17d1a197480e2b5b7", + "zh:cbeace1deae938f6c0aca3734e6088f3633ca09611aff701c15cb6d42f2b918a", + "zh:d33ca19012aabd98cc03fdeccd0bd5ce56e28f61a1dfbb2eea88e89487de7fb3", + "zh:d548b29a864b0687e85e8a993f208e25e3ecc40fcc5b671e1985754b32fdd658", + ] +} + +provider "registry.terraform.io/hashicorp/random" { + version = "3.1.0" + constraints = "~> 3.0" + hashes = [ + "h1:EPIax4Ftp2SNdB9pUfoSjxoueDoLc/Ck3EUoeX0Dvsg=", + "zh:2bbb3339f0643b5daa07480ef4397bd23a79963cc364cdfbb4e86354cb7725bc", + "zh:3cd456047805bf639fbf2c761b1848880ea703a054f76db51852008b11008626", + "zh:4f251b0eda5bb5e3dc26ea4400dba200018213654b69b4a5f96abee815b4f5ff", + "zh:7011332745ea061e517fe1319bd6c75054a314155cb2c1199a5b01fe1889a7e2", + "zh:738ed82858317ccc246691c8b85995bc125ac3b4143043219bd0437adc56c992", + "zh:7dbe52fac7bb21227acd7529b487511c91f4107db9cc4414f50d04ffc3cab427", + "zh:a3a9251fb15f93e4cfc1789800fc2d7414bbc18944ad4c5c98f466e6477c42bc", + "zh:a543ec1a3a8c20635cf374110bd2f87c07374cf2c50617eee2c669b3ceeeaa9f", + "zh:d9ab41d556a48bd7059f0810cf020500635bfc696c9fc3adab5ea8915c1d886b", + "zh:d9e13427a7d011dbd654e591b0337e6074eef8c3b9bb11b2e39eaaf257044fd7", + "zh:f7605bd1437752114baf601bdf6931debe6dc6bfe3006eb7e9bb9080931dca8a", + ] +} diff --git a/03-Terraform-Fundamental-Blocks/03-01-Terraform-Block/terraform-manifests/terraform-block.tf b/03-Terraform-Fundamental-Blocks/03-01-Terraform-Block/terraform-manifests/terraform-block.tf index ec9b5055..85611233 100644 --- a/03-Terraform-Fundamental-Blocks/03-01-Terraform-Block/terraform-manifests/terraform-block.tf +++ b/03-Terraform-Fundamental-Blocks/03-01-Terraform-Block/terraform-manifests/terraform-block.tf @@ -1,18 +1,24 @@ # Terraform Block terraform { - required_version = "~> 0.14.3" + required_version = "~> 1.0.0" required_providers { aws = { - source = "hashicorp/aws" + source = "hashicorp/aws" version = "~> 3.0" - } + } + random = { - source = "hashicorp/random" - version = "3.0.1" - } + source = "hashicorp/random" + version = "~> 3.0" + } } } +provider "aws" { + region = "eu-west-1" + profile = "default" +} + /* Play with Terraform Version required_version = "~> 0.14.3" diff --git a/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/.terraform.lock.hcl b/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..4546d899 --- /dev/null +++ b/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/.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 = "3.61.0" + constraints = "~> 3.0" + hashes = [ + "h1:YZaozdn4J1Ax01NkubRAdv809vlpJOXRBC4KsqBzpvA=", + "zh:0483ca802ddb0ae4f73144b4357ba72242c6e2641aeb460b1aa9a6f6965464b0", + "zh:274712214ebeb0c1269cbc468e5705bb5741dc45b05c05e9793ca97f22a1baa1", + "zh:3c6bd97a2ca809469ae38f6893348386c476cb3065b120b785353c1507401adf", + "zh:53dd41a9aed9860adbbeeb71a23e4f8195c656fd15a02c90fa2d302a5f577d8c", + "zh:65c639c547b97bc880fd83e65511c0f4bbfc91b63cada3b8c0d5776444221700", + "zh:a2769e19137ff480c1dd3e4f248e832df90fb6930a22c66264d9793895161714", + "zh:a5897a99332cc0071e46a71359b86a8e53ab09c1453e94cd7cf45a0b577ff590", + "zh:bdc2353642d16d8e2437a9015cd4216a1772be9736645cc17d1a197480e2b5b7", + "zh:cbeace1deae938f6c0aca3734e6088f3633ca09611aff701c15cb6d42f2b918a", + "zh:d33ca19012aabd98cc03fdeccd0bd5ce56e28f61a1dfbb2eea88e89487de7fb3", + "zh:d548b29a864b0687e85e8a993f208e25e3ecc40fcc5b671e1985754b32fdd658", + ] +} diff --git a/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/c1-versions.tf b/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/c1-versions.tf index 35c6c2bf..3a16372c 100644 --- a/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/c1-versions.tf +++ b/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/c1-versions.tf @@ -1,17 +1,18 @@ # Terraform Block terraform { - required_version = "~> 0.14.6" + required_version = "~> 1.0.0" + required_providers { aws = { source = "hashicorp/aws" version = "~> 3.0" - } + } } } # Provider Block provider "aws" { - region = "us-east-1" + region = "eu-west-1" profile = "default" } diff --git a/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/c2-vpc.tf b/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/c2-vpc.tf index b45c274d..4192ad30 100644 --- a/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/c2-vpc.tf +++ b/03-Terraform-Fundamental-Blocks/03-02-Provider-Block/terraform-manifests/c2-vpc.tf @@ -2,7 +2,9 @@ # Resource-1: Create VPC resource "aws_vpc" "myvpc" { cidr_block = "10.0.0.0/16" + tags = { "Name" = "myvpc" + "Created_by" = "Terraform" } } diff --git a/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/.terraform.lock.hcl b/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..4546d899 --- /dev/null +++ b/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/.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 = "3.61.0" + constraints = "~> 3.0" + hashes = [ + "h1:YZaozdn4J1Ax01NkubRAdv809vlpJOXRBC4KsqBzpvA=", + "zh:0483ca802ddb0ae4f73144b4357ba72242c6e2641aeb460b1aa9a6f6965464b0", + "zh:274712214ebeb0c1269cbc468e5705bb5741dc45b05c05e9793ca97f22a1baa1", + "zh:3c6bd97a2ca809469ae38f6893348386c476cb3065b120b785353c1507401adf", + "zh:53dd41a9aed9860adbbeeb71a23e4f8195c656fd15a02c90fa2d302a5f577d8c", + "zh:65c639c547b97bc880fd83e65511c0f4bbfc91b63cada3b8c0d5776444221700", + "zh:a2769e19137ff480c1dd3e4f248e832df90fb6930a22c66264d9793895161714", + "zh:a5897a99332cc0071e46a71359b86a8e53ab09c1453e94cd7cf45a0b577ff590", + "zh:bdc2353642d16d8e2437a9015cd4216a1772be9736645cc17d1a197480e2b5b7", + "zh:cbeace1deae938f6c0aca3734e6088f3633ca09611aff701c15cb6d42f2b918a", + "zh:d33ca19012aabd98cc03fdeccd0bd5ce56e28f61a1dfbb2eea88e89487de7fb3", + "zh:d548b29a864b0687e85e8a993f208e25e3ecc40fcc5b671e1985754b32fdd658", + ] +} diff --git a/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c1-versions.tf b/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c1-versions.tf index c53c441c..b76b25be 100644 --- a/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c1-versions.tf +++ b/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14.6" + required_version = "~> 1.0.0" required_providers { aws = { source = "hashicorp/aws" @@ -11,15 +11,15 @@ terraform { # Provider-1 for us-east-1 (Default Provider) provider "aws" { - region = "us-east-1" + region = "eu-west-1" profile = "default" } # Provider-2 for us-west-1 provider "aws" { - region = "us-west-1" + region = "eu-west-2" profile = "default" - alias = "aws-west-1" + alias = "aws-eu-west-2" } diff --git a/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c2-vpc-us-east-1.tf b/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c2-vpc-us-east-1.tf index eea9958c..d4f7a2bb 100644 --- a/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c2-vpc-us-east-1.tf +++ b/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c2-vpc-us-east-1.tf @@ -1,7 +1,8 @@ # Resource Block to Create VPC in us-east-1 which uses default provider -resource "aws_vpc" "vpc-us-east-1" { +resource "aws_vpc" "vpc-eu-west-1" { cidr_block = "10.1.0.0/16" + tags = { - "Name" = "vpc-us-east-1" + "Name" = "vpc-eu-west-1" } } diff --git a/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c3-vpc-us-west-1.tf b/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c3-vpc-us-west-1.tf index 8974f5a2..aa9cbf03 100644 --- a/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c3-vpc-us-west-1.tf +++ b/03-Terraform-Fundamental-Blocks/03-03-Multiple-Provider-Configurations/terraform-manifests/c3-vpc-us-west-1.tf @@ -1,9 +1,9 @@ # Resource Block to Create VPC in us-west-1 -resource "aws_vpc" "vpc-us-west-1" { +resource "aws_vpc" "vpc-eu-west-2" { cidr_block = "10.1.0.0/16" - provider = aws.aws-west-1 + provider = aws.aws-eu-west-2 tags = { - "Name" = "vpc-us-west-1" + "Name" = "vpc-eu-west-2" } } diff --git a/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/.terraform.lock.hcl b/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/.terraform.lock.hcl index 33acaed2..0a5b8186 100644 --- a/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/.terraform.lock.hcl +++ b/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/.terraform.lock.hcl @@ -2,22 +2,21 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "2.50.0" - constraints = ">= 2.0.0" + version = "3.61.0" + constraints = ">= 2.1.0" hashes = [ - "h1:aKw4NLrMEAflsl1OXCCz6Ewo4ay9dpgSpkNHujRXXO8=", - "zh:05be40c2d4ec798d6a64bdc9fa9de4c994cf8fe47997368bc0ce40120985b7a0", - "zh:14752329e73c68b63b68f971caaaf5248ceea9f2cdc166b3897d46ce96f25548", - "zh:291121fd0153945f5e21411ee5625b6ec688344af2afef193d1243a0762b3064", - "zh:49488c0d0fd6412f8e877c5b8839da13371dac87491c3bfae484ce9d7be67007", - "zh:5a8f55012dc61cb98ac116b09f2b1fe68a96174ba892ee1bae90e3137b779a5d", - "zh:77b68e5401c4977de5f172005f00dcfa724eb8ca938bd109bc74024c9550cb65", - "zh:8f0b3af9db522f92cdb93eec28c340c00b0679357b715eee70fc3f3777c26747", - "zh:9170bd7ef9a37bc960233bd9957ef46e1495b56bd329be4b0b578bfc744d5f0e", - "zh:a66344e70ad954529c395e2b58fe491d5cc27991654852a66c9a3572a4d48c6f", - "zh:b63e986afec187d6f708a37b64845d8e908c597902efe4eae7148ef07fa8aff5", - "zh:fcc6e9a1f8df9b8cde3d8bcb917294dd9b9283b6bb8db6435ad02fb9ff1fe410", - "zh:fdeaf059f86d0ab59cf68ece2e8cec522b506c47e2cfca7ba6125b1cd06b8680", + "h1:YZaozdn4J1Ax01NkubRAdv809vlpJOXRBC4KsqBzpvA=", + "zh:0483ca802ddb0ae4f73144b4357ba72242c6e2641aeb460b1aa9a6f6965464b0", + "zh:274712214ebeb0c1269cbc468e5705bb5741dc45b05c05e9793ca97f22a1baa1", + "zh:3c6bd97a2ca809469ae38f6893348386c476cb3065b120b785353c1507401adf", + "zh:53dd41a9aed9860adbbeeb71a23e4f8195c656fd15a02c90fa2d302a5f577d8c", + "zh:65c639c547b97bc880fd83e65511c0f4bbfc91b63cada3b8c0d5776444221700", + "zh:a2769e19137ff480c1dd3e4f248e832df90fb6930a22c66264d9793895161714", + "zh:a5897a99332cc0071e46a71359b86a8e53ab09c1453e94cd7cf45a0b577ff590", + "zh:bdc2353642d16d8e2437a9015cd4216a1772be9736645cc17d1a197480e2b5b7", + "zh:cbeace1deae938f6c0aca3734e6088f3633ca09611aff701c15cb6d42f2b918a", + "zh:d33ca19012aabd98cc03fdeccd0bd5ce56e28f61a1dfbb2eea88e89487de7fb3", + "zh:d548b29a864b0687e85e8a993f208e25e3ecc40fcc5b671e1985754b32fdd658", ] } @@ -25,6 +24,7 @@ provider "registry.terraform.io/hashicorp/random" { version = "3.0.0" constraints = "3.0.0" hashes = [ + "h1:+JUEdzBH7Od9JKdMMAIJlX9v6P8jfbMR7V4/FKXLAgY=", "h1:yhHJpb4IfQQfuio7qjUXuUFTU/s+ensuEpm23A+VWz0=", "zh:0fcb00ff8b87dcac1b0ee10831e47e0203a6c46aafd76cb140ba2bab81f02c6b", "zh:123c984c0e04bad910c421028d18aa2ca4af25a153264aef747521f4e7c36a17", diff --git a/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/c1-versions.tf b/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/c1-versions.tf index afd55097..ff8ca08d 100644 --- a/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/c1-versions.tf +++ b/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/c1-versions.tf @@ -1,12 +1,12 @@ # Terraform Settings Block terraform { # Terraform Version - required_version = "~> 0.14.6" + required_version = "~> 1.0.0" required_providers { # AWS Provider aws = { source = "hashicorp/aws" - version = ">= 2.0.0" + version = ">= 2.1.0" } # Random Provider random = { @@ -18,6 +18,6 @@ terraform { # Provider Block provider "aws" { - region = "us-east-1" + region = "eu-west-1" profile = "default" # Defining it for default profile is Optional } \ No newline at end of file diff --git a/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/c2-s3bucket.tf b/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/c2-s3bucket.tf index 83e740ba..eafd693a 100644 --- a/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/c2-s3bucket.tf +++ b/03-Terraform-Fundamental-Blocks/03-04-Providers-Dependency-Lock-File/terraform-manifests/c2-s3bucket.tf @@ -8,5 +8,5 @@ resource "random_pet" "petname" { resource "aws_s3_bucket" "sample" { bucket = random_pet.petname.id acl = "public-read" - region = "us-east-1" # Comment this if we are going to use AWS Provider v3.x version + #region = "eu-west-1" # Comment this if we are going to use AWS Provider v3.x version } diff --git a/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/.terraform.lock.hcl b/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..4546d899 --- /dev/null +++ b/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/.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 = "3.61.0" + constraints = "~> 3.0" + hashes = [ + "h1:YZaozdn4J1Ax01NkubRAdv809vlpJOXRBC4KsqBzpvA=", + "zh:0483ca802ddb0ae4f73144b4357ba72242c6e2641aeb460b1aa9a6f6965464b0", + "zh:274712214ebeb0c1269cbc468e5705bb5741dc45b05c05e9793ca97f22a1baa1", + "zh:3c6bd97a2ca809469ae38f6893348386c476cb3065b120b785353c1507401adf", + "zh:53dd41a9aed9860adbbeeb71a23e4f8195c656fd15a02c90fa2d302a5f577d8c", + "zh:65c639c547b97bc880fd83e65511c0f4bbfc91b63cada3b8c0d5776444221700", + "zh:a2769e19137ff480c1dd3e4f248e832df90fb6930a22c66264d9793895161714", + "zh:a5897a99332cc0071e46a71359b86a8e53ab09c1453e94cd7cf45a0b577ff590", + "zh:bdc2353642d16d8e2437a9015cd4216a1772be9736645cc17d1a197480e2b5b7", + "zh:cbeace1deae938f6c0aca3734e6088f3633ca09611aff701c15cb6d42f2b918a", + "zh:d33ca19012aabd98cc03fdeccd0bd5ce56e28f61a1dfbb2eea88e89487de7fb3", + "zh:d548b29a864b0687e85e8a993f208e25e3ecc40fcc5b671e1985754b32fdd658", + ] +} diff --git a/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/c1-versions.tf b/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/c1-versions.tf index e9cfb257..4246da4d 100644 --- a/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/c1-versions.tf +++ b/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" + required_version = "~> 1.0.0" required_providers { aws = { source = "hashicorp/aws" @@ -11,5 +11,5 @@ terraform { # Provider Block provider "aws" { - region = "us-east-1" + region = "eu-west-1" } diff --git a/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/c2-ec2-instance.tf b/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/c2-ec2-instance.tf index 3a0b2a5c..6ec9c1d0 100644 --- a/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/c2-ec2-instance.tf +++ b/04-Terraform-Resources/04-01-Resource-Syntax-and-Behavior/terraform-manifests/c2-ec2-instance.tf @@ -1,14 +1,14 @@ # Create EC2 Instance # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance -resource "aws_instance" "my-ec2-vm" { - ami = "ami-047a51fa27710816e" +resource "aws_instance" "my_resource_1" { + ami = "ami-0d1bf5b68307103c2" instance_type = "t2.micro" - availability_zone = "us-east-1a" - #availability_zone = "us-east-1b" + availability_zone = "eu-west-1a" + tags = { - "Name" = "web" - #"tag1" = "Update-test-1" + Name = "HelloWorld" + From = "Terraform Training" } -} +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/.terraform.lock.hcl b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c1-versions.tf b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c1-versions.tf new file mode 100644 index 00000000..f2fa0bb3 --- /dev/null +++ b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c1-versions.tf @@ -0,0 +1,14 @@ +terraform { + required_version = "~> 1.0.0" # which means >= 0.14.6 and < 0.15 + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } +} + +provider "aws" { + region = "eu-west-1" + profile = "default" +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c2-vpc.tf b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c2-vpc.tf new file mode 100644 index 00000000..6cae9237 --- /dev/null +++ b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c2-vpc.tf @@ -0,0 +1,75 @@ +resource "aws_vpc" "my-test-vpc" { + cidr_block = "10.0.0.0/16" + tags = { + Name = "my-test-vpc" + } +} + +#Add subnet +resource "aws_subnet" "my-test-subnet" { + vpc_id = aws_vpc.my-test-vpc.id + cidr_block = "10.0.1.0/24" + availability_zone = "eu-west-1b" + map_public_ip_on_launch = true + + tags = { + Name = "my-test-subnet" + } +} + +resource "aws_internet_gateway" "my-test-internet-gw" { + vpc_id = aws_vpc.my-test-vpc.id + + tags = { + Name = "my-test-internet-gw" + } +} + +resource "aws_route_table" "my-test-route-table" { + vpc_id = aws_vpc.my-test-vpc.id + + tags = { + Name = "my-test-route-table" + } +} + +resource "aws_route" "my-test-route" { + route_table_id = aws_route_table.my-test-route-table.id + destination_cidr_block = "0.0.0.0/16" + gateway_id = aws_internet_gateway.my-test-internet-gw.id +} + +resource "aws_route_table_association" "my-test-route-association" { + subnet_id = aws_subnet.my-test-subnet.id + route_table_id = aws_route_table.my-test-route-table.id +} + +resource "aws_security_group" "my-test-security-group" { + name = "dev-vpc-default-sg" + description = "Dev VPC Default Security Group" + vpc_id = aws_vpc.my-test-vpc.id + + ingress { + description = "Allow Port 22" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + description = "Allow Port 80" + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + description = "Allow all IP and Ports Outbound" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c3-ec2-instance.tf b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c3-ec2-instance.tf new file mode 100644 index 00000000..4b936dae --- /dev/null +++ b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c3-ec2-instance.tf @@ -0,0 +1,18 @@ +resource "aws_instance" "my-test-instance" { + ami = "ami-0d1bf5b68307103c2" + instance_type = "t2.micro" + key_name = "AWSS3_Instance_MayurAWS1" + subnet_id = aws_subnet.my-test-subnet.id + vpc_security_group_ids = [aws_security_group.my-test-security-group.id] + user_data = <<-EOF + #!/bin/bash + sudo yum update -y + sudo yum install httpd -y + sudo systemctl enable httpd + sudo systemctl start httpd + echo "

Welcome to StackSimplify ! AWS Infra created using Terraform in us-east-1 Region

" > /var/www/html/index.html + EOF + tags = { + "Name" = "myec2vm" + } +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c4-aws-eip.tf b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c4-aws-eip.tf new file mode 100644 index 00000000..48ac174b --- /dev/null +++ b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/Practice/c4-aws-eip.tf @@ -0,0 +1,7 @@ +resource "aws_eip" "my-test-elastic-ip" { + instance = aws_instance.my-test-instance.id + vpc = true + depends_on = [ + aws_internet_gateway.my-test-internet-gw + ] +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/terraform-manifests/c1-versions.tf b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/terraform-manifests/c1-versions.tf index c337f26e..2b10eacd 100644 --- a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/terraform-manifests/c1-versions.tf +++ b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14.6" # which means >= 0.14.6 and < 0.15 + required_version = "~> 1.0.0" # which means >= 0.14.6 and < 0.15 required_providers { aws = { source = "hashicorp/aws" @@ -11,7 +11,7 @@ terraform { # Provider Block provider "aws" { - region = "us-east-1" + region = "eu-west-1" profile = "default" } /* diff --git a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/terraform-manifests/c3-ec2-instance.tf b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/terraform-manifests/c3-ec2-instance.tf index c504b90b..bfddbd68 100644 --- a/04-Terraform-Resources/04-02-Meta-Argument-depends_on/terraform-manifests/c3-ec2-instance.tf +++ b/04-Terraform-Resources/04-02-Meta-Argument-depends_on/terraform-manifests/c3-ec2-instance.tf @@ -2,7 +2,7 @@ resource "aws_instance" "my-ec2-vm" { ami = "ami-047a51fa27710816e" # Amazon Linux instance_type = "t2.micro" - key_name = "terraform-key" + key_name = "AWSS3_Instance_MayurAWS1" subnet_id = aws_subnet.vpc-dev-public-subnet-1.id vpc_security_group_ids = [aws_security_group.dev-vpc-sg.id] #user_data = file("apache-install.sh") diff --git a/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/.terraform.lock.hcl b/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/c1-versions.tf b/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/c1-versions.tf new file mode 100644 index 00000000..f2fa0bb3 --- /dev/null +++ b/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/c1-versions.tf @@ -0,0 +1,14 @@ +terraform { + required_version = "~> 1.0.0" # which means >= 0.14.6 and < 0.15 + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } +} + +provider "aws" { + region = "eu-west-1" + profile = "default" +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/c2-ec2-vm.tf b/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/c2-ec2-vm.tf new file mode 100644 index 00000000..581c2d6a --- /dev/null +++ b/04-Terraform-Resources/04-03-Meta-Argument-count/Practice/c2-ec2-vm.tf @@ -0,0 +1,8 @@ +resource "aws_instance" "my-test-instance" { + ami = "ami-0d1bf5b68307103c2" + instance_type = "t2.micro" + count = 5 + tags = { + name = "ec2-Instance-${count.index}" + } +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/.terraform.lock.hcl b/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/c1-versions.tf b/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/c1-versions.tf new file mode 100644 index 00000000..f2fa0bb3 --- /dev/null +++ b/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/c1-versions.tf @@ -0,0 +1,14 @@ +terraform { + required_version = "~> 1.0.0" # which means >= 0.14.6 and < 0.15 + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } +} + +provider "aws" { + region = "eu-west-1" + profile = "default" +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/c2-s3-bucket.tf b/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/c2-s3-bucket.tf new file mode 100644 index 00000000..84059975 --- /dev/null +++ b/04-Terraform-Resources/04-04-Meta-Argument-for_each/Practice/c2-s3-bucket.tf @@ -0,0 +1,34 @@ +resource "aws_s3_bucket" "my-resource-bucket" { + for_each = { + dev = "my-dapp-bucket" + test = "my-tapp-bucket" + prod = "my-papp-bucket" + } + + + + bucket = "mayurhastak-${each.value}" + acl = "private" + + tags = { + Name = "mayurhastak-${each.value}" + Environment = "${each.key}" + } + +} + +resource "aws_iam_user" "iam-user" { + for_each = toset(["TMayur", "TSnehal"]) + + + name = "user-${each.key}" + tags = { + tag-key = "user-${each.key}" + } + + depends_on = [ + aws_s3_bucket.my-resource-bucket + ] + + +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/.terraform.lock.hcl b/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/c1-versions.tf b/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/c1-versions.tf index c99fa143..f2fa0bb3 100644 --- a/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/c1-versions.tf +++ b/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/c1-versions.tf @@ -1,6 +1,5 @@ -# Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means >= 0.14.6 and < 0.15 required_providers { aws = { source = "hashicorp/aws" @@ -9,12 +8,7 @@ terraform { } } -# Provider Block provider "aws" { - region = "us-east-1" + region = "eu-west-1" profile = "default" -} -/* -Note-1: AWS Credentials Profile (profile = "default") configured on your local desktop terminal -$HOME/.aws/credentials -*/ +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/c2-s3bucket.tf b/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/c2-s3bucket.tf index 5b898f95..b82e9094 100644 --- a/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/c2-s3bucket.tf +++ b/04-Terraform-Resources/04-04-Meta-Argument-for_each/v1-for_each-maps/c2-s3bucket.tf @@ -11,12 +11,12 @@ resource "aws_s3_bucket" "mys3bucket" { prod = "my-papp-bucket" } - bucket = "${each.key}-${each.value}" + bucket = "mayurhastak-${each.key}-${each.value}" acl = "private" tags = { Environment = each.key - bucketname = "${each.key}-${each.value}" + bucketname = "mayurhastak-${each.key}-${each.value}" eachvalue = each.value } } diff --git a/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/.terraform.lock.hcl b/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/c1-versions.tf b/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/c1-versions.tf new file mode 100644 index 00000000..f2fa0bb3 --- /dev/null +++ b/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/c1-versions.tf @@ -0,0 +1,14 @@ +terraform { + required_version = "~> 1.0.0" # which means >= 0.14.6 and < 0.15 + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } +} + +provider "aws" { + region = "eu-west-1" + profile = "default" +} \ No newline at end of file diff --git a/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/c2-ec2-instance.tf b/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/c2-ec2-instance.tf new file mode 100644 index 00000000..de6001e2 --- /dev/null +++ b/04-Terraform-Resources/04-05-Meta-Argument-lifecycle/Practice/c2-ec2-instance.tf @@ -0,0 +1,17 @@ +resource "aws_instance" "my-test-instance" { + ami = "ami-0d1bf5b68307103c2" + instance_type = var.ec2-instance-type + key_name = "AWSS3_Instance_MayurAWS1" + availability_zone = "eu-west-1a" + tags = { + "Name" = "myec2vm" + } + + lifecycle { + #create_before_destroy = true + #prevent_destroy = true + ignore_changes = [tags + + ] + } +} \ No newline at end of file diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/.terraform.lock.hcl b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c1-versions.tf b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c1-versions.tf new file mode 100644 index 00000000..e01782aa --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c1-versions.tf @@ -0,0 +1,14 @@ +terraform { + required_version = "~> 1.0.0" # which means >= 0.14.6 and < 0.15 + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } +} + +provider "aws" { + region = var.aws_region + profile = "default" +} \ No newline at end of file diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c2-variables.tf b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c2-variables.tf new file mode 100644 index 00000000..599767cf --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c2-variables.tf @@ -0,0 +1,66 @@ +variable "aws_region" { + description = "AWS Region" + default = "eu-west-1" + type = string +} + +variable "ec2-ami_id" { + description = "EC2-Ami-ID" + default = "ami-0d1bf5b68307103c2" + type = string + validation { + condition = length(var.ec2-ami_id) > 4 && substr(var.ec2-ami_id, 0, 4) == "ami-" + error_message = "The length should be greater than 4 and should start with ami-." + } +} + +variable "ec2-instance-count" { + default = 1 + type = number + description = "ec2-instance-count" +} + +variable "ec2-instance-type" { + description = "EC2 Instance Type" + type = string + default = "t2.micro" +} + +variable "ec2-instance-type-list" { + description = "EC2 Instance Type list" + type = list(any) + default = ["t2.micro", "t2.small", "t2.large"] +} + +variable "ec2-instance-tags-map" { + description = "EC2 Instance Tags" + type = map(string) + default = { + "Name" = "Ec2-Web" + "Tier" = "Web Tier" + } + +} + +variable "ec2-instance-type-map" { + description = "EC2 Instance Type map" + type = map(string) + default = { + "small-apps" = "t3.micro" + "medium-apps" = "t3.small" + "large-apps" = "t3.large" + } + +} + +variable "db_username" { + description = "AWS RDS Database admin username" + type = string + sensitive = true +} + +variable "db_password" { + description = "AWS RDS Database admin password" + type = string + sensitive = true +} \ No newline at end of file diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c3-security-group.tf b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c3-security-group.tf new file mode 100644 index 00000000..43b6b032 --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c3-security-group.tf @@ -0,0 +1,48 @@ +resource "aws_security_group" "vpc-ssh" { + name = "vpc-ssh" + description = "Dev VPC SSH" + ingress { + description = "Allow Port 22" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + egress { + description = "Allow all IP and Ports outbound" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} + +# Create Security Group - Web Traffic +resource "aws_security_group" "vpc-web" { + name = "vpc-web" + description = "Dev VPC Web" + + ingress { + description = "Allow Port 80" + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + description = "Allow Port 443" + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + description = "Allow all IP and Ports outbound" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} \ No newline at end of file diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c4-ec2-instance.tf b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c4-ec2-instance.tf new file mode 100644 index 00000000..adacaec2 --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c4-ec2-instance.tf @@ -0,0 +1,17 @@ +# Create EC2 Instance +resource "aws_instance" "my-ec2-vm" { + ami = var.ec2-ami_id + instance_type = var.ec2-instance-type-map["small-apps"] + key_name = "AWSS3_Instance_MayurAWS1" + count = var.ec2-instance-count + user_data = <<-EOF + #!/bin/bash + sudo yum update -y + sudo yum install httpd -y + sudo systemctl enable httpd + sudo systemctl start httpd + echo "

Welcome to StackSimplify ! AWS Infra created using Terraform in us-east-1 Region

" > /var/www/html/index.html + EOF + vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] + tags = var.ec2-instance-tags-map +} diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c5-rds-db.tf b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c5-rds-db.tf new file mode 100644 index 00000000..e3289631 --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/c5-rds-db.tf @@ -0,0 +1,11 @@ +resource "aws_db_instance" "db1" { + allocated_storage = 5 + engine = "mysql" + engine_version = "5.7" + instance_class = "db.t2.micro" + name = "mydb1" + username = var.db_username + password = var.db_password + parameter_group_name = "default.mysql5.7" + skip_final_snapshot = true +} \ No newline at end of file diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/terraform.tfvars b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/terraform.tfvars new file mode 100644 index 00000000..83a905fc --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/terraform.tfvars @@ -0,0 +1 @@ +ec2-instance-count = 2 diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/web.auto.tfvars b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/web.auto.tfvars new file mode 100644 index 00000000..82afe9d3 --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/web.auto.tfvars @@ -0,0 +1 @@ +ec2-instance-count = 3 diff --git a/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/web.tfvars b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/web.tfvars new file mode 100644 index 00000000..161c2fbf --- /dev/null +++ b/05-Terraform-Variables/05-01-Terraform-Input-Variables/Practice/web.tfvars @@ -0,0 +1,5 @@ +ec2-instance-count = 3 +ec2-instance-type = "t2.micro" + +# To use this file +#terraform plan -var-file="web.tfvars" diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/.terraform.lock.hcl b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c1-versions.tf b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c1-versions.tf new file mode 100644 index 00000000..e01782aa --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c1-versions.tf @@ -0,0 +1,14 @@ +terraform { + required_version = "~> 1.0.0" # which means >= 0.14.6 and < 0.15 + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } +} + +provider "aws" { + region = var.aws_region + profile = "default" +} \ No newline at end of file diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c2-variables.tf b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c2-variables.tf new file mode 100644 index 00000000..f1c8841c --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c2-variables.tf @@ -0,0 +1,68 @@ +variable "aws_region" { + description = "AWS Region" + default = "eu-west-1" + type = string +} + +variable "ec2-ami_id" { + description = "EC2-Ami-ID" + default = "ami-0d1bf5b68307103c2" + type = string + validation { + condition = length(var.ec2-ami_id) > 4 && substr(var.ec2-ami_id, 0, 4) == "ami-" + error_message = "The length should be greater than 4 and should start with ami-." + } +} + +variable "ec2-instance-count" { + default = 1 + type = number + description = "ec2-instance-count" +} + +variable "ec2-instance-type" { + description = "EC2 Instance Type" + type = string + default = "t2.micro" +} + +variable "ec2-instance-type-list" { + description = "EC2 Instance Type list" + type = list(any) + default = ["t2.micro", "t2.small", "t2.large"] +} + +variable "ec2-instance-tags-map" { + description = "EC2 Instance Tags" + type = map(string) + default = { + "Name" = "Ec2-Web" + "Tier" = "Web Tier" + } + +} + +variable "ec2-instance-type-map" { + description = "EC2 Instance Type map" + type = map(string) + default = { + "small-apps" = "t3.micro" + "medium-apps" = "t3.small" + "large-apps" = "t3.large" + } + +} + +/* +variable "db_username" { + description = "AWS RDS Database admin username" + type = string + sensitive = true +} + +variable "db_password" { + description = "AWS RDS Database admin password" + type = string + sensitive = true +} +*/ \ No newline at end of file diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c3-security-group.tf b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c3-security-group.tf new file mode 100644 index 00000000..43b6b032 --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c3-security-group.tf @@ -0,0 +1,48 @@ +resource "aws_security_group" "vpc-ssh" { + name = "vpc-ssh" + description = "Dev VPC SSH" + ingress { + description = "Allow Port 22" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + egress { + description = "Allow all IP and Ports outbound" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} + +# Create Security Group - Web Traffic +resource "aws_security_group" "vpc-web" { + name = "vpc-web" + description = "Dev VPC Web" + + ingress { + description = "Allow Port 80" + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + description = "Allow Port 443" + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + description = "Allow all IP and Ports outbound" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} \ No newline at end of file diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c4-ec2-instance.tf b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c4-ec2-instance.tf new file mode 100644 index 00000000..c293431b --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c4-ec2-instance.tf @@ -0,0 +1,17 @@ +# Create EC2 Instance +resource "aws_instance" "my-ec2-vm" { + ami = var.ec2-ami_id + instance_type = var.ec2-instance-type-map["small-apps"] + key_name = "AWSS3_Instance_MayurAWS1" + #count = var.ec2-instance-count + user_data = <<-EOF + #!/bin/bash + sudo yum update -y + sudo yum install httpd -y + sudo systemctl enable httpd + sudo systemctl start httpd + echo "

Welcome to StackSimplify ! AWS Infra created using Terraform in us-east-1 Region

" > /var/www/html/index.html + EOF + vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] + tags = var.ec2-instance-tags-map +} diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c5-outputs.tf b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c5-outputs.tf new file mode 100644 index 00000000..2e4938e5 --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/c5-outputs.tf @@ -0,0 +1,20 @@ +output "EC2-Instance-Public-IP" { + description = "EC2 Instacne Public IP" + value = aws_instance.my-ec2-vm.public_ip +} + +output "EC2-Intance-Private-IP" { + description = "EC2 Instance Private IP" + value = aws_instance.my-ec2-vm.private_ip +} + +output "EC2-Instance-Security-Groups" { + description = "EC2 Instance Security Groups" + value = aws_instance.my-ec2-vm.security_groups +} + +output "EC2-Public-DNS" { + description = "Public DNS URL of EC2 Instance" + value = "https://${aws_instance.my-ec2-vm.public_dns}" + +} \ No newline at end of file diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/terraform.tfvars b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/terraform.tfvars new file mode 100644 index 00000000..ae404890 --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/terraform.tfvars @@ -0,0 +1 @@ +ec2-instance-count = 1 diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/web.auto.tfvars b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/web.auto.tfvars new file mode 100644 index 00000000..72437c1c --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/web.auto.tfvars @@ -0,0 +1 @@ +ec2-instance-count = 1 \ No newline at end of file diff --git a/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/web.tfvars b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/web.tfvars new file mode 100644 index 00000000..c1587740 --- /dev/null +++ b/05-Terraform-Variables/05-02-Terraform-Output-Values/Practice/web.tfvars @@ -0,0 +1,5 @@ +ec2-instance-count = 1 +ec2-instance-type = "t2.micro" + +# To use this file +#terraform plan -var-file="web.tfvars" diff --git a/05-Terraform-Variables/05-03-Terraform-Local-Values/terraform-manifests/.terraform.lock.hcl b/05-Terraform-Variables/05-03-Terraform-Local-Values/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/05-Terraform-Variables/05-03-Terraform-Local-Values/terraform-manifests/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/05-Terraform-Variables/05-03-Terraform-Local-Values/terraform-manifests/c1-versions.tf b/05-Terraform-Variables/05-03-Terraform-Local-Values/terraform-manifests/c1-versions.tf index a305835c..3e990a7f 100644 --- a/05-Terraform-Variables/05-03-Terraform-Local-Values/terraform-manifests/c1-versions.tf +++ b/05-Terraform-Variables/05-03-Terraform-Local-Values/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" diff --git a/06-Terraform-Datasources/terraform-manifests/.terraform.lock.hcl b/06-Terraform-Datasources/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/06-Terraform-Datasources/terraform-manifests/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/06-Terraform-Datasources/terraform-manifests/c1-versions.tf b/06-Terraform-Datasources/terraform-manifests/c1-versions.tf index a305835c..3e990a7f 100644 --- a/06-Terraform-Datasources/terraform-manifests/c1-versions.tf +++ b/06-Terraform-Datasources/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" diff --git a/06-Terraform-Datasources/terraform-manifests/c2-variables.tf b/06-Terraform-Datasources/terraform-manifests/c2-variables.tf index 02504d42..bb4dee92 100644 --- a/06-Terraform-Datasources/terraform-manifests/c2-variables.tf +++ b/06-Terraform-Datasources/terraform-manifests/c2-variables.tf @@ -2,7 +2,7 @@ variable "aws_region" { description = "Region in which AWS Resources to be created" type = string - default = "us-east-1" + default = "eu-west-1" } /* diff --git a/06-Terraform-Datasources/terraform-manifests/c4-ec2-instance.tf b/06-Terraform-Datasources/terraform-manifests/c4-ec2-instance.tf index 1ff6a348..de8f5aa3 100644 --- a/06-Terraform-Datasources/terraform-manifests/c4-ec2-instance.tf +++ b/06-Terraform-Datasources/terraform-manifests/c4-ec2-instance.tf @@ -1,8 +1,8 @@ # Create EC2 Instance - Amazon Linux resource "aws_instance" "my-ec2-vm" { - ami = data.aws_ami.amzlinux.id + ami = data.aws_ami.amzlinux1.id instance_type = var.ec2_instance_type - key_name = "terraform-key" + key_name = "AWSS3_Instance_MayurAWS1" user_data = file("apache-install.sh") vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] tags = { diff --git a/06-Terraform-Datasources/terraform-manifests/c6-ami-datasource.tf b/06-Terraform-Datasources/terraform-manifests/c6-ami-datasource.tf index 4d0a0102..45359d88 100644 --- a/06-Terraform-Datasources/terraform-manifests/c6-ami-datasource.tf +++ b/06-Terraform-Datasources/terraform-manifests/c6-ami-datasource.tf @@ -18,4 +18,28 @@ data "aws_ami" "amzlinux" { name = "architecture" values = [ "x86_64" ] } -} \ No newline at end of file +} + + +data "aws_ami" "amzlinux1" { + most_recent = true + owners = ["amazon"] + filter { + name = "name" + values = ["amzn2-ami-hvm-*-gp2"] + } + + filter { + name = "root-device-type" + values = [ "ebs" ] + } + filter { + name = "virtualization-type" + values = [ "hvm" ] + } + filter { + name = "architecture" + values = [ "x86_64" ] + } +} + diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/.terraform.lock.hcl b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/.terraform.lock.hcl new file mode 100644 index 00000000..af6a3745 --- /dev/null +++ b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/.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 = "3.62.0" + constraints = "~> 3.0" + hashes = [ + "h1:eXmZtLWeH/OdYSjzFQ2rO/3TNskq4h+0xAaxRmBrSwg=", + "zh:08a94019e17304f5927d7c85b8f5dade6b9ffebeb7b06ec0643aaa1130c4c85d", + "zh:0e3709f6c1fed8c5119a5653bec7e3069258ddf91f62d851f8deeede10487fb8", + "zh:0ed32886abce5fee49f1ae49b84472558224366c31a638e51c63061c3126e7c2", + "zh:0f1ecbeddfa61d87701a3f3b463e508773171981bf6dad8b1313a9eafaffd5e1", + "zh:724cde4f27253b547714a606288ede17f5df67f430438478feed113d7acb5ac7", + "zh:81e6e751a168eab1a054230d4441b43c68693bfb6e0545536f2ea6dbb39fe9af", + "zh:84deaf1c6661ba0dbc07ac159109fb6746772476646d39854c755c8dfb7a8ac4", + "zh:909dcefc6c986c926ad856662ab5d38a3988b1906569387b5b58e7ddd89a155c", + "zh:d03886705e9f25d4bebeae115bb07e36adb14e778859cedb2bf3c3bed39f4d2b", + "zh:de9fc80c5a5d3be7535856242c823a92516eb7d5c16ae509fa10b92cd6b3fa9b", + "zh:e91dcd9eec8b779a9b089f2f8d45f1047f890cb7b9241490451da52c04cef63d", + ] +} diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/apache-install.sh b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/apache-install.sh new file mode 100644 index 00000000..709bbff1 --- /dev/null +++ b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/apache-install.sh @@ -0,0 +1,6 @@ +#! /bin/bash +sudo yum update -y +sudo yum install -y httpd +sudo systemctl enable httpd +sudo service httpd start +echo "

Welcome to StackSimplify ! AWS Infra created using Terraform in eu-west-1 Region

" | sudo tee /var/www/html/index.html \ No newline at end of file diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c1-versions.tf b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c1-versions.tf new file mode 100644 index 00000000..e8bb466e --- /dev/null +++ b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c1-versions.tf @@ -0,0 +1,29 @@ +# Terraform Block +terraform { + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } + + backend "s3" { + bucket = "testbucketofmayur" + key = "terraform/dev/terraform.tfstate" + region = "eu-west-1" + dynamodb_table = "terraform-dev-state-table" + } + +} + +# Provider Block +provider "aws" { + region = var.aws_region + profile = "default" +} +/* +Note-1: AWS Credentials Profile (profile = "default") configured on your local desktop terminal +$HOME/.aws/credentials +*/ + diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c2-variables.tf b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c2-variables.tf new file mode 100644 index 00000000..7c79327e --- /dev/null +++ b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c2-variables.tf @@ -0,0 +1,22 @@ +# Input Variables +variable "aws_region" { + description = "Region in which AWS Resources to be created" + type = string + default = "eu-west-1" +} + +/* +# Commented as we are going to get AMI ID from Datasource aws_ami +variable "ec2_ami_id" { + description = "AMI ID" + type = string + default = "ami-0915bcb5fa77e4892" +} +*/ + +variable "ec2_instance_type" { + description = "EC2 Instance Type" + type = string + default = "t2.micro" +} + diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c3-security-groups.tf b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c3-security-groups.tf new file mode 100644 index 00000000..01affa0e --- /dev/null +++ b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c3-security-groups.tf @@ -0,0 +1,57 @@ +# Create Security Group - SSH Traffic +resource "aws_security_group" "vpc-ssh" { + name = "vpc-ssh" + description = "Dev VPC SSH" + ingress { + description = "Allow Port 22" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + egress { + description = "Allow all ip and ports outboun" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} + +# Create Security Group - Web Traffic +resource "aws_security_group" "vpc-web" { + name = "vpc-web" + description = "Dev VPC web" + ingress { + description = "Allow Port 80" + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + description = "Allow Port 443" + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + description = "Allow all ip and ports outbound" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + description = "Allow Port 8080" + from_port = 8080 + to_port = 8080 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + +} \ No newline at end of file diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c4-ec2-instance.tf b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c4-ec2-instance.tf new file mode 100644 index 00000000..5b01eb5c --- /dev/null +++ b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c4-ec2-instance.tf @@ -0,0 +1,14 @@ +# Create EC2 Instance - Amazon Linux +resource "aws_instance" "my-ec2-vm-new" { + ami = data.aws_ami.amzlinux1.id + instance_type = var.ec2_instance_type + key_name = "AWSS3_Instance_MayurAWS1" + user_data = file("apache-install.sh") + vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] + tags = { + "Name" = "amz-linux-vm" + "target" = "Target Test1" + } +} + + diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c5-outputs.tf b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c5-outputs.tf new file mode 100644 index 00000000..aedc973f --- /dev/null +++ b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c5-outputs.tf @@ -0,0 +1,13 @@ +# Define Output Values + +# Attribute Reference +output "ec2_instance_publicip" { + description = "EC2 Instance Public IP" + value = aws_instance.my-ec2-vm-new.public_ip +} + +# Attribute Reference - Create Public DNS URL +output "ec2_publicdns" { + description = "Public DNS URL of an EC2 Instance" + value = aws_instance.my-ec2-vm-new.public_dns +} diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c6-ami-datasource.tf b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c6-ami-datasource.tf new file mode 100644 index 00000000..7c0eab9f --- /dev/null +++ b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/c6-ami-datasource.tf @@ -0,0 +1,45 @@ +# Get latest AMI ID for Amazon Linux2 OS +data "aws_ami" "amzlinux" { + most_recent = true + owners = ["amazon"] + filter { + name = "name" + values = ["amzn2-ami-hvm-*-gp2"] + } + filter { + name = "root-device-type" + values = ["ebs"] + } + filter { + name = "virtualization-type" + values = ["hvm"] + } + filter { + name = "architecture" + values = ["x86_64"] + } +} + + +data "aws_ami" "amzlinux1" { + most_recent = true + owners = ["amazon"] + filter { + name = "name" + values = ["amzn2-ami-hvm-*-gp2"] + } + + filter { + name = "root-device-type" + values = ["ebs"] + } + filter { + name = "virtualization-type" + values = ["hvm"] + } + filter { + name = "architecture" + values = ["x86_64"] + } +} + diff --git a/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/v1plan.out b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/v1plan.out new file mode 100644 index 00000000..bdbc1209 Binary files /dev/null and b/07-Terraform-State/07-01-Terraform-Remote-State-Storage-and-Locking/Practice/v1plan.out differ diff --git a/08-Terraform-Workspaces/v1-local-backend/.terraform.lock.hcl b/08-Terraform-Workspaces/v1-local-backend/.terraform.lock.hcl new file mode 100644 index 00000000..208a723b --- /dev/null +++ b/08-Terraform-Workspaces/v1-local-backend/.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 = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} diff --git a/08-Terraform-Workspaces/v1-local-backend/c1-versions.tf b/08-Terraform-Workspaces/v1-local-backend/c1-versions.tf index a305835c..3e990a7f 100644 --- a/08-Terraform-Workspaces/v1-local-backend/c1-versions.tf +++ b/08-Terraform-Workspaces/v1-local-backend/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" diff --git a/08-Terraform-Workspaces/v1-local-backend/c2-variables.tf b/08-Terraform-Workspaces/v1-local-backend/c2-variables.tf index f55f87b6..7b53081c 100644 --- a/08-Terraform-Workspaces/v1-local-backend/c2-variables.tf +++ b/08-Terraform-Workspaces/v1-local-backend/c2-variables.tf @@ -2,7 +2,7 @@ variable "aws_region" { description = "Region in which AWS Resources to be created" type = string - default = "us-east-1" + default = "eu-west-1" } variable "instance_type" { diff --git a/08-Terraform-Workspaces/v1-local-backend/c4-ec2-instance.tf b/08-Terraform-Workspaces/v1-local-backend/c4-ec2-instance.tf index 458caf16..d8d9d3f5 100644 --- a/08-Terraform-Workspaces/v1-local-backend/c4-ec2-instance.tf +++ b/08-Terraform-Workspaces/v1-local-backend/c4-ec2-instance.tf @@ -2,12 +2,12 @@ resource "aws_instance" "my-ec2-vm" { ami = data.aws_ami.amzlinux.id instance_type = var.instance_type - key_name = "terraform-key" + key_name = "AWSS3_Instance_MayurAWS1" count = terraform.workspace == "default" ? 2 : 1 user_data = file("apache-install.sh") vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] tags = { - "Name" = "vm-${terraform.workspace}-${count.index}" + "Name" = terraform.workspace == "default" ? "vm-${count.index}" : "vm-${terraform.workspace}-${count.index}" } } diff --git a/08-Terraform-Workspaces/v2-remote-backend/.terraform.lock.hcl b/08-Terraform-Workspaces/v2-remote-backend/.terraform.lock.hcl new file mode 100644 index 00000000..208a723b --- /dev/null +++ b/08-Terraform-Workspaces/v2-remote-backend/.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 = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} diff --git a/08-Terraform-Workspaces/v2-remote-backend/c1-versions.tf b/08-Terraform-Workspaces/v2-remote-backend/c1-versions.tf index b7e50ad0..116c3d62 100644 --- a/08-Terraform-Workspaces/v2-remote-backend/c1-versions.tf +++ b/08-Terraform-Workspaces/v2-remote-backend/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" @@ -8,13 +8,11 @@ terraform { } } # Adding Backend as S3 for Remote State Storage - backend "s3" { - bucket = "terraform-stacksimplify" - key = "workspaces/terraform.tfstate" - region = "us-east-1" - - # For State Locking - dynamodb_table = "terraform-dev-state-table" + backend "s3" { + bucket = "testbucketofmayur" + key = "terraform/dev/workspaces/terraform.tfstate" + region = "eu-west-1" + dynamodb_table = "terraform-dev-state-table" } } diff --git a/08-Terraform-Workspaces/v2-remote-backend/c2-variables.tf b/08-Terraform-Workspaces/v2-remote-backend/c2-variables.tf index f55f87b6..7b53081c 100644 --- a/08-Terraform-Workspaces/v2-remote-backend/c2-variables.tf +++ b/08-Terraform-Workspaces/v2-remote-backend/c2-variables.tf @@ -2,7 +2,7 @@ variable "aws_region" { description = "Region in which AWS Resources to be created" type = string - default = "us-east-1" + default = "eu-west-1" } variable "instance_type" { diff --git a/08-Terraform-Workspaces/v2-remote-backend/c4-ec2-instance.tf b/08-Terraform-Workspaces/v2-remote-backend/c4-ec2-instance.tf index 458caf16..2de71210 100644 --- a/08-Terraform-Workspaces/v2-remote-backend/c4-ec2-instance.tf +++ b/08-Terraform-Workspaces/v2-remote-backend/c4-ec2-instance.tf @@ -2,12 +2,12 @@ resource "aws_instance" "my-ec2-vm" { ami = data.aws_ami.amzlinux.id instance_type = var.instance_type - key_name = "terraform-key" + key_name = "AWSS3_Instance_MayurAWS1" count = terraform.workspace == "default" ? 2 : 1 user_data = file("apache-install.sh") vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] tags = { - "Name" = "vm-${terraform.workspace}-${count.index}" + "Name" = terraform.workspace == "default" ? "vm-${count.index}" : "vm-${terraform.workspace}-${count.index}" } } diff --git a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/.terraform.lock.hcl b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..208a723b --- /dev/null +++ b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/.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 = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} diff --git a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c1-versions.tf b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c1-versions.tf index a305835c..3e990a7f 100644 --- a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c1-versions.tf +++ b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" diff --git a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c2-variables.tf b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c2-variables.tf index f55f87b6..7b53081c 100644 --- a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c2-variables.tf +++ b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c2-variables.tf @@ -2,7 +2,7 @@ variable "aws_region" { description = "Region in which AWS Resources to be created" type = string - default = "us-east-1" + default = "eu-west-1" } variable "instance_type" { diff --git a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c4-ec2-instance.tf b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c4-ec2-instance.tf index 0770ed1a..ecc5af86 100644 --- a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c4-ec2-instance.tf +++ b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/c4-ec2-instance.tf @@ -2,7 +2,7 @@ resource "aws_instance" "my-ec2-vm" { ami = data.aws_ami.amzlinux.id instance_type = var.instance_type - key_name = "terraform-key" + key_name = "AWS-S3-Mayur-Key2" #count = terraform.workspace == "default" ? 1 : 1 user_data = file("apache-install.sh") vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] @@ -43,6 +43,12 @@ resource "aws_instance" "my-ec2-vm" { destination = "/tmp" } + provisioner "file" { + source = "apps/file-copy.html" # when "/" at the end is added - CONTENTS of FOLDER WILL BE COPIED + destination = "/var/www/html/file-copy.html" + on_failure = continue + } + /* # Enable this during Section 09-01 Step-05 diff --git a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/private-key/terraform-key.pem b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/private-key/terraform-key.pem index fab1eb2a..3f034bb4 100644 --- a/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/private-key/terraform-key.pem +++ b/09-Terraform-Provisioners/09-01-File-Provisioner/terraform-manifests/private-key/terraform-key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAnzQtbXStFNU4znotckbPpAbQvymSYBvIRhObDObmhZLzs/Qm -lm57HBU18NcdAeEmKjHyu/2CI4Wwor3TJ+LTKHIldHmCt+26dSN5889Km99Af674 -nuPg9fTt8IXhY83aO0AeEnFivC+lk9+6Xezv7J7Llsmyx3kvUGE4uUEPNPuNcjdU -OrSlQ/Th9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sOETbHjCOC5jl/62g+qOF7FxPPLjdCqE3eBQ +uFInMXXPt4s8IwZa3QbtCuS+k02r3pzKzALNEqJvfrEzOHsOyzmhwiGbutu8je+h +HiWkxBMRQtgzIkxRWroO8i1gosAxJUux7OQPmqufWmrbnC1vp92ZIr8CgYEA3OBi +FiSHw10JKfx++dh59Rm7+fiC+QrtDXaAzTlQz08Vc9bo7cQ+VKQ7oIGoGyBSvc24 +U6PWzd9ooMYZW/4vRvOUBDOmagCkr0CZghjgCg8R3KzeKccBjbPHvylF/5nUBYtv +3f5EOWw6UBjYIi0Au1n0VeqvMDBAKrsCzfQw/CUCgYBawyKscF3wQGJyZxo0La27 +yMAuQkeiJvBE1QAN7nFleZu3ibDOaM0FabO4z7znV9WG/i6Qr3cJqyVi9ZW+pB8u +fFVoL/UvtdZ8clWOKivSViH3pZB86iWJ148btV40h2h/9dIWWU0aGR1iFsmy8Hc2 +/Q+gd1wvbPCfpAszUT3jiwKBgFP6B7DtgKSZecN52Xj6ghvbBeobPwiay9gDhyL/ +uKapJbneKr9DjoM10enLgfOWTX8WeQ9ryl6Jo0kFKF0efjEWqN8UGCBTUEnFYNfi +x0NryVnCa9EsdX2/raETeyacAM1+3zBi3OOML3uGhp4vyAhzQf9sc+D5Z1wXsBBH +2Fv1AoGAHwNFy+pwLExc4fVc93/2QSklzhjZ748uKAEVxg47YjZScJcVPuwADJKN +btDUkU2R/Hv61fvs+UkkD5tQ+2nfAyxKJTT11JEm/h9dyJ0G+WGrd6KglA2V4asJ +S9THhY5biHwTCgb29IJR1FlTAjmKiSYy/nqQmcW/1ztF3nOzgLg= -----END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/.terraform.lock.hcl b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..208a723b --- /dev/null +++ b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/.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 = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} diff --git a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c1-versions.tf b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c1-versions.tf index a305835c..3e990a7f 100644 --- a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c1-versions.tf +++ b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" diff --git a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c2-variables.tf b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c2-variables.tf index f55f87b6..7b53081c 100644 --- a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c2-variables.tf +++ b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c2-variables.tf @@ -2,7 +2,7 @@ variable "aws_region" { description = "Region in which AWS Resources to be created" type = string - default = "us-east-1" + default = "eu-west-1" } variable "instance_type" { diff --git a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c4-ec2-instance.tf b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c4-ec2-instance.tf index b70cf60c..a04fdcdf 100644 --- a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c4-ec2-instance.tf +++ b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/c4-ec2-instance.tf @@ -2,7 +2,7 @@ resource "aws_instance" "my-ec2-vm" { ami = data.aws_ami.amzlinux.id instance_type = var.instance_type - key_name = "terraform-key" + key_name = "AWS-S3-Mayur-Key2" #count = terraform.workspace == "default" ? 1 : 1 user_data = file("apache-install.sh") vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] diff --git a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/private-key/terraform-key.pem b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/private-key/terraform-key.pem index fab1eb2a..3f034bb4 100644 --- a/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/private-key/terraform-key.pem +++ b/09-Terraform-Provisioners/09-02-remote-exec-provisioner/terraform-manifests/private-key/terraform-key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAnzQtbXStFNU4znotckbPpAbQvymSYBvIRhObDObmhZ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hjvxdiBnnrUDv57omU9oATR9Eb0douYZBoQraaT/OOE4pyeS3lAY6uKuH +hVRTCYmkA7ADLQBPxDwX5kSbh3UWvEJeUu0+z69PxkV+EugaUK+D96PdqYm6prme +E85W4ZkCgYEA/ldut3h3twkrbrHLsOETbHjCOC5jl/62g+qOF7FxPPLjdCqE3eBQ +uFInMXXPt4s8IwZa3QbtCuS+k02r3pzKzALNEqJvfrEzOHsOyzmhwiGbutu8je+h +HiWkxBMRQtgzIkxRWroO8i1gosAxJUux7OQPmqufWmrbnC1vp92ZIr8CgYEA3OBi +FiSHw10JKfx++dh59Rm7+fiC+QrtDXaAzTlQz08Vc9bo7cQ+VKQ7oIGoGyBSvc24 +U6PWzd9ooMYZW/4vRvOUBDOmagCkr0CZghjgCg8R3KzeKccBjbPHvylF/5nUBYtv +3f5EOWw6UBjYIi0Au1n0VeqvMDBAKrsCzfQw/CUCgYBawyKscF3wQGJyZxo0La27 +yMAuQkeiJvBE1QAN7nFleZu3ibDOaM0FabO4z7znV9WG/i6Qr3cJqyVi9ZW+pB8u +fFVoL/UvtdZ8clWOKivSViH3pZB86iWJ148btV40h2h/9dIWWU0aGR1iFsmy8Hc2 +/Q+gd1wvbPCfpAszUT3jiwKBgFP6B7DtgKSZecN52Xj6ghvbBeobPwiay9gDhyL/ +uKapJbneKr9DjoM10enLgfOWTX8WeQ9ryl6Jo0kFKF0efjEWqN8UGCBTUEnFYNfi +x0NryVnCa9EsdX2/raETeyacAM1+3zBi3OOML3uGhp4vyAhzQf9sc+D5Z1wXsBBH +2Fv1AoGAHwNFy+pwLExc4fVc93/2QSklzhjZ748uKAEVxg47YjZScJcVPuwADJKN +btDUkU2R/Hv61fvs+UkkD5tQ+2nfAyxKJTT11JEm/h9dyJ0G+WGrd6KglA2V4asJ +S9THhY5biHwTCgb29IJR1FlTAjmKiSYy/nqQmcW/1ztF3nOzgLg= -----END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/.terraform.lock.hcl b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..208a723b --- /dev/null +++ b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/.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 = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} diff --git a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c1-versions.tf b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c1-versions.tf index a305835c..3e990a7f 100644 --- a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c1-versions.tf +++ b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" diff --git a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c2-variables.tf b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c2-variables.tf index f55f87b6..7b53081c 100644 --- a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c2-variables.tf +++ b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c2-variables.tf @@ -2,7 +2,7 @@ variable "aws_region" { description = "Region in which AWS Resources to be created" type = string - default = "us-east-1" + default = "eu-west-1" } variable "instance_type" { diff --git a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c4-ec2-instance.tf b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c4-ec2-instance.tf index 99e22323..7cc81edb 100644 --- a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c4-ec2-instance.tf +++ b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/c4-ec2-instance.tf @@ -2,7 +2,7 @@ resource "aws_instance" "my-ec2-vm" { ami = data.aws_ami.amzlinux.id instance_type = var.instance_type - key_name = "terraform-key" + key_name = "AWS-S3-Mayur-Key2" #count = terraform.workspace == "default" ? 1 : 1 user_data = file("apache-install.sh") vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] diff --git a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/local-exec-output-files/creation-time-private-ip.txt b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/local-exec-output-files/creation-time-private-ip.txt new file mode 100644 index 00000000..c8927920 --- /dev/null +++ b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/local-exec-output-files/creation-time-private-ip.txt @@ -0,0 +1 @@ +172.31.25.122 diff --git a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/local-exec-output-files/destroy-time.txt b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/local-exec-output-files/destroy-time.txt new file mode 100644 index 00000000..d3e08e84 --- /dev/null +++ b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/local-exec-output-files/destroy-time.txt @@ -0,0 +1 @@ +Destroy-time provisioner Instanace Destroyed at `date` diff --git a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/private-key/terraform-key.pem b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/private-key/terraform-key.pem index fab1eb2a..3f034bb4 100644 --- a/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/private-key/terraform-key.pem +++ b/09-Terraform-Provisioners/09-03-local-exec-provisioner/terraform-manifests/private-key/terraform-key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAnzQtbXStFNU4znotckbPpAbQvymSYBvIRhObDObmhZLzs/Qm -lm57HBU18NcdAeEmKjHyu/2CI4Wwor3TJ+LTKHIldHmCt+26dSN5889Km99Af674 -nuPg9fTt8IXhY83aO0AeEnFivC+lk9+6Xezv7J7Llsmyx3kvUGE4uUEPNPuNcjdU -OrSlQ/Th9FPWBsTL8wLQCfQaPIQhZT8fXnvNGViTpZ/YqcoKGmkXcMl/+Pi0Xccs -ID3Egl18sV5uWr6T1DSMqhhwWYbl+IagZYUeKQ6Lg5znAtnX2/OHhDep6pGcf+aE -jbRkhQWgfLIVYhNXkAGxdxBEA2fQO0wvnaKI6wIDAQABAoIBABmUZqApmQ253LDA -TMEJw58VQUEVyuEKVbl8uPLvvqZDoEiPuAt/oOQ4PDyAM7bzmBA7ikbOSrSubF0Z -pu3HsinTfVUjmO84kTb1Bkk4S0KUMmbRlDzjXGfofLqiqD5C+wd+G9bWxQ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0VeqvMDBAKrsCzfQw/CUCgYBawyKscF3wQGJyZxo0La27 +yMAuQkeiJvBE1QAN7nFleZu3ibDOaM0FabO4z7znV9WG/i6Qr3cJqyVi9ZW+pB8u +fFVoL/UvtdZ8clWOKivSViH3pZB86iWJ148btV40h2h/9dIWWU0aGR1iFsmy8Hc2 +/Q+gd1wvbPCfpAszUT3jiwKBgFP6B7DtgKSZecN52Xj6ghvbBeobPwiay9gDhyL/ +uKapJbneKr9DjoM10enLgfOWTX8WeQ9ryl6Jo0kFKF0efjEWqN8UGCBTUEnFYNfi +x0NryVnCa9EsdX2/raETeyacAM1+3zBi3OOML3uGhp4vyAhzQf9sc+D5Z1wXsBBH +2Fv1AoGAHwNFy+pwLExc4fVc93/2QSklzhjZ748uKAEVxg47YjZScJcVPuwADJKN +btDUkU2R/Hv61fvs+UkkD5tQ+2nfAyxKJTT11JEm/h9dyJ0G+WGrd6KglA2V4asJ +S9THhY5biHwTCgb29IJR1FlTAjmKiSYy/nqQmcW/1ztF3nOzgLg= -----END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/.terraform.lock.hcl b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..eb795f19 --- /dev/null +++ b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/.terraform.lock.hcl @@ -0,0 +1,57 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} + +provider "registry.terraform.io/hashicorp/null" { + version = "3.0.0" + constraints = "~> 3.0.0" + hashes = [ + "h1:GnUYWtyIRXT2ruijra2HtwGDb4z3Qk62ZFc1lAOlevo=", + "zh:05fb7eab469324c97e9b73a61d2ece6f91de4e9b493e573bfeda0f2077bc3a4c", + "zh:1688aa91885a395c4ae67636d411475d0b831e422e005dcf02eedacaafac3bb4", + "zh:24a0b1292e3a474f57c483a7a4512d797e041bc9c2fbaac42fe12e86a7fb5a3c", + "zh:2fc951bd0d1b9b23427acc93be09b6909d72871e464088171da60fbee4fdde03", + "zh:6db825759425599a326385a68acc6be2d9ba0d7d6ef587191d0cdc6daef9ac63", + "zh:85985763d02618993c32c294072cc6ec51f1692b803cb506fcfedca9d40eaec9", + "zh:a53186599c57058be1509f904da512342cfdc5d808efdaf02dec15f0f3cb039a", + "zh:c2e07b49b6efa676bdc7b00c06333ea1792a983a5720f9e2233db27323d2707c", + "zh:cdc8fe1096103cf5374751e2e8408ec4abd2eb67d5a1c5151fe2c7ecfd525bef", + "zh:dbdef21df0c012b0d08776f3d4f34eb0f2f229adfde07ff252a119e52c0f65b7", + ] +} + +provider "registry.terraform.io/hashicorp/time" { + version = "0.6.0" + constraints = "~> 0.6.0" + hashes = [ + "h1:IvRLj0HXlzF+MVqLjUkKBb42PVeKPbPq5uK01i4QDjM=", + "zh:130c61cb41888107bf1e2f1db05b4f664d63af70e7828c0ab16be9fc5302aede", + "zh:16132715a10cb31dc6ce6d9320904f84ddb32cbb74516e528009463370d6f715", + "zh:2fb8701ac13115bd92187a9c6e47ca2ecedf98943e48e3f5d8a8f3f4bd3fcdf4", + "zh:30b4b44748fbfa592a22664c31ac5f664ca5fd18265442a85cd0b41a99b21c86", + "zh:5205fa477ebcb1f7d82a701a9a511c6fd555ec209e523081d65b38a5a3423db5", + "zh:7584700dc1421f22f6352d61859774e9f6151c48e490f2c0f2ae019274bfd028", + "zh:7cc58b561fbb6c86a4f4a7e670434381a1ffa664ca559702fc7eb79ab36164e4", + "zh:b7d119ce2f948311a2acb8b32e027562cd291116ecf93af788318c168f82a856", + "zh:bd759418034e245f7ca4914ae72c0fbd82cedec12b32980f6ea74aa9c474ba7f", + "zh:c06c65224ee9aa8634f8d44552bc803aac0a3a8949b865137873c56d6b2025d7", + ] +} diff --git a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c1-versions.tf b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c1-versions.tf index 3cf00138..acea1594 100644 --- a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c1-versions.tf +++ b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" diff --git a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c2-variables.tf b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c2-variables.tf index f55f87b6..7b53081c 100644 --- a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c2-variables.tf +++ b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c2-variables.tf @@ -2,7 +2,7 @@ variable "aws_region" { description = "Region in which AWS Resources to be created" type = string - default = "us-east-1" + default = "eu-west-1" } variable "instance_type" { diff --git a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c4-ec2-instance.tf b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c4-ec2-instance.tf index deca3b32..b540d51f 100644 --- a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c4-ec2-instance.tf +++ b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/c4-ec2-instance.tf @@ -2,7 +2,7 @@ resource "aws_instance" "my-ec2-vm" { ami = data.aws_ami.amzlinux.id instance_type = var.instance_type - key_name = "terraform-key" + key_name = "AWS-S3-Mayur-Key2" #count = terraform.workspace == "default" ? 1 : 1 user_data = file("apache-install.sh") vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] @@ -42,7 +42,7 @@ resource "null_resource" "sync_app1_static" { # Copies the /tmp/app1 folder to Apache Webserver /var/www/html directory provisioner "remote-exec" { inline = [ - "sudo cp -r /tmp/app1 /var/www/html" + "sudo cp -r /tmp/app1/file1.html /var/www/html/index.html" ] } } diff --git a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/private-key/terraform-key.pem b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/private-key/terraform-key.pem index fab1eb2a..3f034bb4 100644 --- a/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/private-key/terraform-key.pem +++ b/09-Terraform-Provisioners/09-04-Null-Resource/terraform-manifests/private-key/terraform-key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAnzQtbXStFNU4znotckbPpAbQvymSYBvIRhObDObmhZLzs/Qm -lm57HBU18NcdAeEmKjHyu/2CI4Wwor3TJ+LTKHIldHmCt+26dSN5889Km99Af674 -nuPg9fTt8IXhY83aO0AeEnFivC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69PxkV+EugaUK+D96PdqYm6prme +E85W4ZkCgYEA/ldut3h3twkrbrHLsOETbHjCOC5jl/62g+qOF7FxPPLjdCqE3eBQ +uFInMXXPt4s8IwZa3QbtCuS+k02r3pzKzALNEqJvfrEzOHsOyzmhwiGbutu8je+h +HiWkxBMRQtgzIkxRWroO8i1gosAxJUux7OQPmqufWmrbnC1vp92ZIr8CgYEA3OBi +FiSHw10JKfx++dh59Rm7+fiC+QrtDXaAzTlQz08Vc9bo7cQ+VKQ7oIGoGyBSvc24 +U6PWzd9ooMYZW/4vRvOUBDOmagCkr0CZghjgCg8R3KzeKccBjbPHvylF/5nUBYtv +3f5EOWw6UBjYIi0Au1n0VeqvMDBAKrsCzfQw/CUCgYBawyKscF3wQGJyZxo0La27 +yMAuQkeiJvBE1QAN7nFleZu3ibDOaM0FabO4z7znV9WG/i6Qr3cJqyVi9ZW+pB8u +fFVoL/UvtdZ8clWOKivSViH3pZB86iWJ148btV40h2h/9dIWWU0aGR1iFsmy8Hc2 +/Q+gd1wvbPCfpAszUT3jiwKBgFP6B7DtgKSZecN52Xj6ghvbBeobPwiay9gDhyL/ +uKapJbneKr9DjoM10enLgfOWTX8WeQ9ryl6Jo0kFKF0efjEWqN8UGCBTUEnFYNfi +x0NryVnCa9EsdX2/raETeyacAM1+3zBi3OOML3uGhp4vyAhzQf9sc+D5Z1wXsBBH +2Fv1AoGAHwNFy+pwLExc4fVc93/2QSklzhjZ748uKAEVxg47YjZScJcVPuwADJKN +btDUkU2R/Hv61fvs+UkkD5tQ+2nfAyxKJTT11JEm/h9dyJ0G+WGrd6KglA2V4asJ +S9THhY5biHwTCgb29IJR1FlTAjmKiSYy/nqQmcW/1ztF3nOzgLg= -----END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/.terraform.lock.hcl b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/.terraform.lock.hcl new file mode 100644 index 00000000..208a723b --- /dev/null +++ b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/.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 = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} diff --git a/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/apache-install.sh b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/apache-install.sh new file mode 100644 index 00000000..709bbff1 --- /dev/null +++ b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/apache-install.sh @@ -0,0 +1,6 @@ +#! /bin/bash +sudo yum update -y +sudo yum install -y httpd +sudo systemctl enable httpd +sudo service httpd start +echo "

Welcome to StackSimplify ! AWS Infra created using Terraform in eu-west-1 Region

" | sudo tee /var/www/html/index.html \ No newline at end of file diff --git a/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c1-versions.tf b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c1-versions.tf new file mode 100644 index 00000000..549b5b27 --- /dev/null +++ b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c1-versions.tf @@ -0,0 +1,29 @@ +# Terraform Block +terraform { + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } + + backend "s3" { + bucket = "testbucketofmayur" + key = "terraform/modules/terraform.tfstate" + region = "eu-west-1" + dynamodb_table = "terraform-dev-state-table" + } + +} + +# Provider Block +provider "aws" { + region = var.aws_region + profile = "default" +} +/* +Note-1: AWS Credentials Profile (profile = "default") configured on your local desktop terminal +$HOME/.aws/credentials +*/ + diff --git a/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c2-variables.tf b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c2-variables.tf new file mode 100644 index 00000000..7c79327e --- /dev/null +++ b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c2-variables.tf @@ -0,0 +1,22 @@ +# Input Variables +variable "aws_region" { + description = "Region in which AWS Resources to be created" + type = string + default = "eu-west-1" +} + +/* +# Commented as we are going to get AMI ID from Datasource aws_ami +variable "ec2_ami_id" { + description = "AMI ID" + type = string + default = "ami-0915bcb5fa77e4892" +} +*/ + +variable "ec2_instance_type" { + description = "EC2 Instance Type" + type = string + default = "t2.micro" +} + diff --git a/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c3-security-groups.tf b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c3-security-groups.tf new file mode 100644 index 00000000..01affa0e --- /dev/null +++ b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c3-security-groups.tf @@ -0,0 +1,57 @@ +# Create Security Group - SSH Traffic +resource "aws_security_group" "vpc-ssh" { + name = "vpc-ssh" + description = "Dev VPC SSH" + ingress { + description = "Allow Port 22" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + egress { + description = "Allow all ip and ports outboun" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} + +# Create Security Group - Web Traffic +resource "aws_security_group" "vpc-web" { + name = "vpc-web" + description = "Dev VPC web" + ingress { + description = "Allow Port 80" + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + description = "Allow Port 443" + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + description = "Allow all ip and ports outbound" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + description = "Allow Port 8080" + from_port = 8080 + to_port = 8080 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + +} \ No newline at end of file diff --git a/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c4-ec2-instance.tf b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c4-ec2-instance.tf new file mode 100644 index 00000000..11f5e305 --- /dev/null +++ b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c4-ec2-instance.tf @@ -0,0 +1,21 @@ +module "ec2_instance" { + source = "terraform-aws-modules/ec2-instance/aws" + version = "~> 3.0" + + + name = "instance-1" + ami = data.aws_ami.amzlinux.id + instance_type = "t2.micro" + key_name = "AWS-S3-Mayur-Key2" + monitoring = true + vpc_security_group_ids = ["sg-c3652599"] + subnet_id = "subnet-cb7f3591" + + tags = { + Terraform = "true" + Environment = "dev" + } + + user_data = file("apache-install.sh") + +} \ No newline at end of file diff --git a/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c5-outputs.tf b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c5-outputs.tf new file mode 100644 index 00000000..89e1a073 --- /dev/null +++ b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c5-outputs.tf @@ -0,0 +1,14 @@ +output "ec2_instance_public_ip" { + description = "Public IP Addressess of EC2 Instances" + value = module.ec2_instance.*.public_ip +} + +output "ec2_instance_public_dns" { + description = "Public DNS for EC2 Instances" + value = module.ec2_instance.*.public_dns +} + +output "ec2_instance_private_ip" { + description = "Private IP Addresses for EC2 Instances" + value = module.ec2_instance.*.private_ip + } \ No newline at end of file diff --git a/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c6-ami-datasource.tf b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c6-ami-datasource.tf new file mode 100644 index 00000000..7c0eab9f --- /dev/null +++ b/10-Terraform-Modules/10-01-Terraform-Modules-Basics/Practice/c6-ami-datasource.tf @@ -0,0 +1,45 @@ +# Get latest AMI ID for Amazon Linux2 OS +data "aws_ami" "amzlinux" { + most_recent = true + owners = ["amazon"] + filter { + name = "name" + values = ["amzn2-ami-hvm-*-gp2"] + } + filter { + name = "root-device-type" + values = ["ebs"] + } + filter { + name = "virtualization-type" + values = ["hvm"] + } + filter { + name = "architecture" + values = ["x86_64"] + } +} + + +data "aws_ami" "amzlinux1" { + most_recent = true + owners = ["amazon"] + filter { + name = "name" + values = ["amzn2-ami-hvm-*-gp2"] + } + + filter { + name = "root-device-type" + values = ["ebs"] + } + filter { + name = "virtualization-type" + values = ["hvm"] + } + filter { + name = "architecture" + values = ["x86_64"] + } +} + diff --git a/10-Terraform-Modules/Practice_2/.terraform.lock.hcl b/10-Terraform-Modules/Practice_2/.terraform.lock.hcl new file mode 100644 index 00000000..208a723b --- /dev/null +++ b/10-Terraform-Modules/Practice_2/.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 = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} diff --git a/10-Terraform-Modules/Practice_2/main.tf b/10-Terraform-Modules/Practice_2/main.tf new file mode 100644 index 00000000..73a16a4b --- /dev/null +++ b/10-Terraform-Modules/Practice_2/main.tf @@ -0,0 +1,42 @@ +resource "aws_s3_bucket" "static_hosting_bucket" { + bucket = var.bucket_name + acl = "public-read" + policy = <Welcome to StackSimplify ! AWS Infra created using Terraform in us-east-1 Region" | sudo tee /var/www/html/index.html \ No newline at end of file diff --git a/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c1-versions.tf b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c1-versions.tf new file mode 100644 index 00000000..bfc56cfe --- /dev/null +++ b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c1-versions.tf @@ -0,0 +1,33 @@ +# Terraform Block +terraform { + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } + + # Update remote backend information + backend "remote" { + hostname = "app.terraform.io" + organization = "hcta-demo1-mayur" # Organization should already exists in Terraform Cloud + + workspaces { + name = "state-migration-demo" + # Two cases: + # Case-1: If workspace already exists, should not have any state files in states tab + # Case-2: If workspace not exists, during migration it will get created + } + } + +} + +# Provider Block +provider "aws" { + region = var.aws_region +} +/* +Note-1: AWS Credentials Profile (profile = "default") configured on your local desktop terminal +$HOME/.aws/credentials +*/ diff --git a/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c2-variables.tf b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c2-variables.tf new file mode 100644 index 00000000..bba754b9 --- /dev/null +++ b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c2-variables.tf @@ -0,0 +1,10 @@ +# Input Variables +variable "aws_region" { + description = "Region in which AWS Resources to be created" + type = string +} + +variable "instance_type" { + description = "EC2 Instance Type - Instance Sizing" + type = string +} \ No newline at end of file diff --git a/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c3-security-groups.tf b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c3-security-groups.tf new file mode 100644 index 00000000..98fe5ff7 --- /dev/null +++ b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c3-security-groups.tf @@ -0,0 +1,49 @@ +# Create Security Group - SSH Traffic +resource "aws_security_group" "vpc-ssh" { + name = "vpc-ssh-${terraform.workspace}" + description = "Dev VPC SSH" + ingress { + description = "Allow Port 22" + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + egress { + description = "Allow all ip and ports outboun" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} + +# Create Security Group - Web Traffic +resource "aws_security_group" "vpc-web" { + name = "vpc-web-${terraform.workspace}" + description = "Dev VPC web" + ingress { + description = "Allow Port 80" + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + description = "Allow Port 443" + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + description = "Allow all ip and ports outbound" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + +} \ No newline at end of file diff --git a/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c4-ec2-instance.tf b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c4-ec2-instance.tf new file mode 100644 index 00000000..550e12c2 --- /dev/null +++ b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c4-ec2-instance.tf @@ -0,0 +1,19 @@ +# Create EC2 Instance - Amazon2 Linux +resource "aws_instance" "my-ec2-vm" { + ami = data.aws_ami.amzlinux.id + instance_type = var.instance_type + count = 1 + #key_name = "terraform-key" + user_data = file("apache-install.sh") + vpc_security_group_ids = [aws_security_group.vpc-ssh.id, aws_security_group.vpc-web.id] + tags = { + "Name" = "Terraform-Cloud-${count.index}" + } +} + + + + + + + diff --git a/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c5-outputs.tf b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c5-outputs.tf new file mode 100644 index 00000000..ad086758 --- /dev/null +++ b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c5-outputs.tf @@ -0,0 +1,14 @@ +# Define Output Values + +# Attribute Reference +output "ec2_instance_publicip" { + description = "EC2 Instance Public IP" + value = aws_instance.my-ec2-vm.*.public_ip +} + + +# Attribute Reference - Create Public DNS URL +output "ec2_publicdns" { + description = "Public DNS URL of an EC2 Instance" + value = aws_instance.my-ec2-vm.*.public_dns +} diff --git a/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c6-ami-datasource.tf b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c6-ami-datasource.tf new file mode 100644 index 00000000..4d0a0102 --- /dev/null +++ b/11-Terraform-Cloud-and-Enterprise-Capabilities/Practice_5/c6-ami-datasource.tf @@ -0,0 +1,21 @@ +# Get latest AMI ID for Amazon Linux2 OS +data "aws_ami" "amzlinux" { + most_recent = true + owners = [ "amazon" ] + filter { + name = "name" + values = [ "amzn2-ami-hvm-*-gp2" ] + } + filter { + name = "root-device-type" + values = [ "ebs" ] + } + filter { + name = "virtualization-type" + values = [ "hvm" ] + } + filter { + name = "architecture" + values = [ "x86_64" ] + } +} \ No newline at end of file diff --git a/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/.terraform.lock.hcl b/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/.terraform.lock.hcl new file mode 100644 index 00000000..208a723b --- /dev/null +++ b/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/.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 = "3.63.0" + constraints = "~> 3.0" + hashes = [ + "h1:OrFmv6NFX1fqE10psnI8SmqeFRs02VIRcixqYqL0+Tc=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} diff --git a/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/c1-versions.tf b/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/c1-versions.tf index 1c52c2f4..330d2fc3 100644 --- a/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/c1-versions.tf +++ b/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/c1-versions.tf @@ -1,6 +1,6 @@ # Terraform Block terraform { - required_version = "~> 0.14" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx + required_version = "~> 1.0.0" # which means any version equal & above 0.14 like 0.15, 0.16 etc and < 1.xx required_providers { aws = { source = "hashicorp/aws" @@ -9,7 +9,7 @@ terraform { } # Update backend information as Terraform Cloud backend "remote" { - organization = "hcta-demo1" + organization = "hcta-demo1-mayur" workspaces { name = "sentinel-demo1" diff --git a/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/c2-variables.tf b/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/c2-variables.tf index d476f6d8..c03e267d 100644 --- a/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/c2-variables.tf +++ b/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/c2-variables.tf @@ -2,7 +2,7 @@ variable "aws_region" { description = "Region in which AWS Resources to be created" type = string - default = "us-east-1" + default = "eu-west-1" } # Input variable definitions @@ -10,7 +10,7 @@ variable "aws_region" { variable "bucket_name" { description = "Name of the S3 bucket. Must be Unique across AWS" type = string - default = "mybucket-1061" + default = "testbucketofmayur-3" } variable "tags" { diff --git a/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/static-files/index.html b/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/static-files/index.html index 337b6847..3914db65 100644 --- a/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/static-files/index.html +++ b/12-Terraform-Cloud-and-Sentinel/12-01-Terraform-Cloud-and-Sentinel-Policies/terraform-manifests/static-files/index.html @@ -5,6 +5,6 @@

Welcome to Stack Simplify - Terraform & Sentinel Demo

Sentinel Demo

-

Terraform Sentinel - Demo - V2

+

Terraform Sentinel - Demo - V4

\ No newline at end of file