diff --git a/cdktf-go/.gitignore b/cdktf-go/.gitignore new file mode 100644 index 00000000..4033944b --- /dev/null +++ b/cdktf-go/.gitignore @@ -0,0 +1,21 @@ + +# cdktf and terraform ignores +.terraform +cdktf.out +cdktf.log +*terraform.*.tfstate* +generated + +# src https://github.com/github/gitignore/blob/master/Go.gitignore +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out diff --git a/cdktf-go/README.md b/cdktf-go/README.md new file mode 100644 index 00000000..423a0646 --- /dev/null +++ b/cdktf-go/README.md @@ -0,0 +1,48 @@ +# Running the cdktf-go example + +## Install dependencies +1. Install an IDE like VSCode (https://code.visualstudio.com/). Then +2. Install golang, terraform, cdktf: + +On MacOS: +``` +brew install go cdktf terraform +``` + +On Windows / Mac / Linux with vagrant: +``` +git clone https://github.com/wardviaene/devops-box +cd devops-box +vagrant up +vagrant ssh +/vagrant/scripts/install_cdktf.sh # kicks of install of golang / npm / cdktf +``` + +On Windows, install a package manager (https://chocolatey.org/), then: +``` +choco install nodejs +npm install --global cdktf-cli@latest +``` + +# Download & init the provider + +``` +cdktf get +go mod tidy +``` + +Note: can take a some time to finish + +# Provision + +This provisions the infrastructure on AWS. + +``` +cdktf deploy +``` + +# Initialize new project +If you'd like to initialize your own project, you can use this command (I used the same command to initialize this project): +``` +cdktf init --template="go" --local +``` diff --git a/cdktf-go/cdktf.json b/cdktf-go/cdktf.json new file mode 100644 index 00000000..8eafb3a4 --- /dev/null +++ b/cdktf-go/cdktf.json @@ -0,0 +1,14 @@ +{ + "language": "go", + "app": "go run main.go", + "codeMakerOutput": "generated", + "projectId": "1f093b2f-3904-471b-984a-a6efe009927e", + "terraformProviders": [ + "hashicorp/aws@~> 3.67.0" + ], + "terraformModules": [], + "context": { + "excludeStackIdFromLogicalIds": "true", +"allowSepCharsInLogicalIds": "true" + } +} \ No newline at end of file diff --git a/cdktf-go/go.mod b/cdktf-go/go.mod new file mode 100644 index 00000000..f036105d --- /dev/null +++ b/cdktf-go/go.mod @@ -0,0 +1,10 @@ +module cdk.tf/go/stack + +go 1.16 + +require github.com/aws/constructs-go/constructs/v10 v10.0.25 + +require ( + github.com/aws/jsii-runtime-go v1.50.0 + github.com/hashicorp/terraform-cdk-go/cdktf v0.8.6 +) diff --git a/cdktf-go/go.sum b/cdktf-go/go.sum new file mode 100644 index 00000000..75c3d5cd --- /dev/null +++ b/cdktf-go/go.sum @@ -0,0 +1,18 @@ +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/aws/constructs-go/constructs/v10 v10.0.25 h1:yY4u3qgRs99+OqNXNwS6BPazHN+Tr7ttJSlpbFHoM98= +github.com/aws/constructs-go/constructs/v10 v10.0.25/go.mod h1:Tk3teOB9AAvXsgGcl3MLrOv0iTSv4UTQStQ5TQ+OIJc= +github.com/aws/jsii-runtime-go v1.50.0 h1:HT96p8bIkG4Be56pgHUeN+QydnGJTB+VBYd6ouVBWN0= +github.com/aws/jsii-runtime-go v1.50.0/go.mod h1:6tZnlstx8bAB3vnLFF9n8bbkI//LDblAek9zFyMXV3E= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/hashicorp/terraform-cdk-go/cdktf v0.8.6 h1:ClziHluDMDHjG2DEYaePZwnHAlYMiiTCgQJ2YF6Bpc4= +github.com/hashicorp/terraform-cdk-go/cdktf v0.8.6/go.mod h1:j+G48UF4TkctRpf9SQ1mMy7fIwP8nc+DYWumI249BqY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cdktf-go/main.go b/cdktf-go/main.go new file mode 100644 index 00000000..4cf8cf92 --- /dev/null +++ b/cdktf-go/main.go @@ -0,0 +1,58 @@ +package main + +import ( + "github.com/aws/constructs-go/constructs/v10" + "github.com/aws/jsii-runtime-go" + "github.com/hashicorp/terraform-cdk-go/cdktf" + + "cdk.tf/go/stack/generated/hashicorp/aws" + "cdk.tf/go/stack/generated/hashicorp/aws/ec2" +) + +func NewMyStack(scope constructs.Construct, id string) cdktf.TerraformStack { + stack := cdktf.NewTerraformStack(scope, &id) + + // The code that defines your stack goes here + + aws.NewAwsProvider(stack, jsii.String("aws"), &aws.AwsProviderConfig{ + Region: jsii.String("eu-west-1"), + }) + + amiID := getUbuntuAMI(stack) + + instance := ec2.NewInstance(stack, jsii.String("compute"), &ec2.InstanceConfig{ + Ami: amiID.Id(), + InstanceType: jsii.String("t2.micro"), + }) + + cdktf.NewTerraformOutput(stack, jsii.String("public_ip"), &cdktf.TerraformOutputConfig{ + Value: instance.PublicIp(), + }) + + return stack +} + +func main() { + app := cdktf.NewApp(nil) + + NewMyStack(app, "cdktf-go") + + app.Synth() +} + +func getUbuntuAMI(stack cdktf.TerraformStack) ec2.DataAwsAmi { + return ec2.NewDataAwsAmi(stack, jsii.String("computeAMI"), &ec2.DataAwsAmiConfig{ + Filter: &[]*ec2.DataAwsAmiFilter{ + { + Name: jsii.String("name"), + Values: jsii.Strings("ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"), + }, + { + Name: jsii.String("virtualization-type"), + Values: jsii.Strings("hvm"), + }, + }, + Owners: jsii.Strings("099720109477"), + MostRecent: true, + }) +} diff --git a/codepipeline-demo/app/config/buildspec.yml b/codepipeline-demo/app/config/buildspec.yml index c32d8e09..2ecbf53a 100644 --- a/codepipeline-demo/app/config/buildspec.yml +++ b/codepipeline-demo/app/config/buildspec.yml @@ -3,7 +3,8 @@ version: 0.2 phases: pre_build: commands: - - $(aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com) + - echo Logging in to Amazon ECR... + - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com build: commands: - docker build -t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$CODEBUILD_RESOLVED_SOURCE_VERSION . diff --git a/codepipeline-demo/codebuild.tf b/codepipeline-demo/codebuild.tf index 2fc01eb0..7af07b12 100644 --- a/codepipeline-demo/codebuild.tf +++ b/codepipeline-demo/codebuild.tf @@ -17,7 +17,7 @@ resource "aws_codebuild_project" "demo" { environment { compute_type = "BUILD_GENERAL1_SMALL" - image = "aws/codebuild/docker:18.09.0" + image = "aws/codebuild/standard:5.0" type = "LINUX_CONTAINER" privileged_mode = true diff --git a/codepipeline-demo/codecommit.tf b/codepipeline-demo/codecommit.tf index b50f1eb0..26458384 100644 --- a/codepipeline-demo/codecommit.tf +++ b/codepipeline-demo/codecommit.tf @@ -1,4 +1,5 @@ -resource "aws_codecommit_repository" "demo" { - repository_name = "demo" - description = "This is the demo repository" -} +// uncomment the following lines to enable CodeCommit +//resource "aws_codecommit_repository" "demo" { +// repository_name = "demo" +// description = "This is the demo repository" +//} diff --git a/codepipeline-demo/codepipeline.tf b/codepipeline-demo/codepipeline.tf index ff446040..135bf676 100644 --- a/codepipeline-demo/codepipeline.tf +++ b/codepipeline-demo/codepipeline.tf @@ -21,13 +21,20 @@ resource "aws_codepipeline" "demo" { name = "Source" category = "Source" owner = "AWS" - provider = "CodeCommit" + //provider = "CodeCommit" + provider = "CodeStarSourceConnection" version = "1" output_artifacts = ["demo-docker-source"] + //configuration = { + // RepositoryName = aws_codecommit_repository.demo.repository_name + // BranchName = "master" + //} + // CodeStar configuration configuration = { - RepositoryName = aws_codecommit_repository.demo.repository_name - BranchName = "master" + ConnectionArn = aws_codestarconnections_connection.github.arn + FullRepositoryId = "wardviaene/docker-demo-codepipeline" // change this to your github username/repo + BranchName = "main" // change this to your branch } } } diff --git a/codepipeline-demo/codestar.tf b/codepipeline-demo/codestar.tf new file mode 100644 index 00000000..157f3f90 --- /dev/null +++ b/codepipeline-demo/codestar.tf @@ -0,0 +1,4 @@ +resource "aws_codestarconnections_connection" "github" { + name = "my-connection" + provider_type = "GitHub" +} \ No newline at end of file diff --git a/codepipeline-demo/iam-codepipeline.tf b/codepipeline-demo/iam-codepipeline.tf index 5b174256..24afffb7 100644 --- a/codepipeline-demo/iam-codepipeline.tf +++ b/codepipeline-demo/iam-codepipeline.tf @@ -61,7 +61,8 @@ data "aws_iam_policy_document" "demo-codepipeline-role-policy" { aws_kms_key.demo-artifacts.arn, ] } - statement { + // uncomment the following lines to enable CodeCommit + /*statement { effect = "Allow" actions = [ "codecommit:UploadArchive", @@ -74,6 +75,15 @@ data "aws_iam_policy_document" "demo-codepipeline-role-policy" { resources = [ aws_codecommit_repository.demo.arn, ] + }*/ + statement { + effect = "Allow" + actions = [ + "codestar-connections:UseConnection", + ] + resources = [ + aws_codestarconnections_connection.github.arn, + ] } statement { effect = "Allow" diff --git a/codepipeline-demo/s3.tf b/codepipeline-demo/s3.tf index 47f435ab..9e9b932c 100644 --- a/codepipeline-demo/s3.tf +++ b/codepipeline-demo/s3.tf @@ -3,16 +3,20 @@ # resource "aws_s3_bucket" "codebuild-cache" { bucket = "demo-codebuild-cache-${random_string.random.result}" - acl = "private" } resource "aws_s3_bucket" "demo-artifacts" { bucket = "demo-artifacts-${random_string.random.result}" - acl = "private" + + # lifecycle moved to aws_s3_bucket_lifecycle_configuration (Change starting from AWS Provider 4.x) +} + +resource "aws_s3_bucket_lifecycle_configuration" "demo-artifacts-lifecycle" { + bucket = aws_s3_bucket.demo-artifacts.id - lifecycle_rule { - id = "clean-up" - enabled = "true" + rule { + id = "clean-up" + status = "Enabled" expiration { days = 30 @@ -20,6 +24,7 @@ resource "aws_s3_bucket" "demo-artifacts" { } } + resource "random_string" "random" { length = 8 special = false diff --git a/codepipeline-demo/vpc.tf b/codepipeline-demo/vpc.tf index 83f5c209..bc2a85e8 100644 --- a/codepipeline-demo/vpc.tf +++ b/codepipeline-demo/vpc.tf @@ -1,6 +1,6 @@ module "vpc" { source = "terraform-aws-modules/vpc/aws" - version = "2.59.0" + version = "5.19.0" name = "vpc-module-demo" cidr = "10.0.0.0/16" diff --git a/datasource-demo/datasource.tf b/datasource-demo/datasource.tf new file mode 100644 index 00000000..09235074 --- /dev/null +++ b/datasource-demo/datasource.tf @@ -0,0 +1,17 @@ +data "terraform_remote_state" "first-steps" { + backend = "s3" + + config = { + bucket = "terraform-a49cd32" + key = "first-steps/terraform.tfstate" + region = "us-east-1" + } +} + +locals { + vpc_id = data.terraform_remote_state.first-steps.outputs.vpc_id +} + +output "vpc_id" { + value = local.vpc_id +} \ No newline at end of file diff --git a/demo-1/instance.tf b/demo-1/instance.tf index 4de24ff7..16de1449 100644 --- a/demo-1/instance.tf +++ b/demo-1/instance.tf @@ -1,5 +1,5 @@ resource "aws_instance" "example" { - ami = var.AMIS[var.AWS_REGION] + ami = lookup(var.AMIS, var.AWS_REGION, "") # last parameter is the default value instance_type = "t2.micro" } diff --git a/demo-10/cloudinit.tf b/demo-10/cloudinit.tf index 4c0b056f..08adc9ab 100644 --- a/demo-10/cloudinit.tf +++ b/demo-10/cloudinit.tf @@ -1,30 +1,22 @@ -data "template_file" "init-script" { - template = file("scripts/init.cfg") - vars = { - REGION = var.AWS_REGION - } -} - -data "template_file" "shell-script" { - template = file("scripts/volumes.sh") - vars = { - DEVICE = var.INSTANCE_DEVICE_NAME - } -} +# note: previous templatefile datasources have been replaced by the template_file() function -data "template_cloudinit_config" "cloudinit-example" { +data "cloudinit_config" "cloudinit-example" { gzip = false base64_encode = false part { filename = "init.cfg" content_type = "text/cloud-config" - content = data.template_file.init-script.rendered + content = templatefile("scripts/init.cfg", { + REGION = var.AWS_REGION + }) } part { content_type = "text/x-shellscript" - content = data.template_file.shell-script.rendered + content = templatefile("scripts/volumes.sh", { + DEVICE = var.INSTANCE_DEVICE_NAME + }) } } diff --git a/demo-10/instance.tf b/demo-10/instance.tf index 4f17b09e..4c0d0c9b 100644 --- a/demo-10/instance.tf +++ b/demo-10/instance.tf @@ -12,7 +12,7 @@ resource "aws_instance" "example" { key_name = aws_key_pair.mykeypair.key_name # user data - user_data = data.template_cloudinit_config.cloudinit-example.rendered + user_data = data.cloudinit_config.cloudinit-example.rendered } resource "aws_ebs_volume" "ebs-volume-1" { diff --git a/demo-10/scripts/volumes.sh b/demo-10/scripts/volumes.sh index 9c959bb4..431cc9e8 100644 --- a/demo-10/scripts/volumes.sh +++ b/demo-10/scripts/volumes.sh @@ -16,6 +16,12 @@ if [ "`echo -n $DEVICE_FS`" == "" ] ; then sleep 15 fi done + # make sure the device file in /dev/ exists + count=0 + until [[ -e ${DEVICE} || "$count" == "60" ]]; do + sleep 5 + count=$(expr $count + 1) + done pvcreate ${DEVICE} vgcreate data ${DEVICE} lvcreate --name volume1 -l 100%FREE data diff --git a/demo-10/vpc.tf b/demo-10/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/demo-10/vpc.tf +++ b/demo-10/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/demo-12/rds.tf b/demo-12/rds.tf index 15fbd4ca..d63f0ebf 100644 --- a/demo-12/rds.tf +++ b/demo-12/rds.tf @@ -18,10 +18,10 @@ resource "aws_db_parameter_group" "mariadb-parameters" { resource "aws_db_instance" "mariadb" { allocated_storage = 100 # 100 GB of storage, gives us more IOPS than a lower number engine = "mariadb" - engine_version = "10.4.13" + engine_version = "10.4" instance_class = "db.t2.small" # use micro if you want to use the free tier identifier = "mariadb" - name = "mariadb" + db_name = "mariadb" username = "root" # username password = var.RDS_PASSWORD # password db_subnet_group_name = aws_db_subnet_group.mariadb-subnet.name diff --git a/demo-12/vpc.tf b/demo-12/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/demo-12/vpc.tf +++ b/demo-12/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/demo-14/s3.tf b/demo-14/s3.tf index be32d4ff..fec26f8b 100644 --- a/demo-14/s3.tf +++ b/demo-14/s3.tf @@ -1,6 +1,5 @@ resource "aws_s3_bucket" "b" { bucket = "mybucket-c29df1" - acl = "private" tags = { Name = "mybucket-c29df1" diff --git a/demo-14/vpc.tf b/demo-14/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/demo-14/vpc.tf +++ b/demo-14/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/demo-15/vpc.tf b/demo-15/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/demo-15/vpc.tf +++ b/demo-15/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/demo-16/vpc.tf b/demo-16/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/demo-16/vpc.tf +++ b/demo-16/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/demo-17/elasticbeanstalk.tf b/demo-17/elasticbeanstalk.tf index 4f2bb6a8..a321a2cb 100644 --- a/demo-17/elasticbeanstalk.tf +++ b/demo-17/elasticbeanstalk.tf @@ -3,10 +3,16 @@ resource "aws_elastic_beanstalk_application" "app" { description = "app" } +# this automatically retrieves the latest solution stack +data "aws_elastic_beanstalk_solution_stack" "php-latest" { + most_recent = true + name_regex = "^64bit Amazon Linux (.*) running PHP 8.(.*)$" +} + resource "aws_elastic_beanstalk_environment" "app-prod" { name = "app-prod" application = aws_elastic_beanstalk_application.app.name - solution_stack_name = "64bit Amazon Linux 2018.03 v2.9.6 running PHP 7.3" + solution_stack_name = data.aws_elastic_beanstalk_solution_stack.php-latest.name setting { namespace = "aws:ec2:vpc" name = "VPCId" @@ -100,7 +106,7 @@ resource "aws_elastic_beanstalk_environment" "app-prod" { setting { namespace = "aws:elasticbeanstalk:application:environment" name = "RDS_DATABASE" - value = aws_db_instance.mariadb.name + value = aws_db_instance.mariadb.db_name } setting { namespace = "aws:elasticbeanstalk:application:environment" diff --git a/demo-17/rds.tf b/demo-17/rds.tf index 909c2cb9..94e537f8 100644 --- a/demo-17/rds.tf +++ b/demo-17/rds.tf @@ -21,7 +21,7 @@ resource "aws_db_instance" "mariadb" { engine_version = "10.4.13" instance_class = "db.t2.small" # use micro if you want to use the free tier identifier = "mariadb" - name = "mydatabase" # database name + db_name = "mydatabase" # database name username = "root" # username password = var.RDS_PASSWORD # password db_subnet_group_name = aws_db_subnet_group.mariadb-subnet.name diff --git a/demo-17/vpc.tf b/demo-17/vpc.tf index 186c599e..f3c0f8c0 100644 --- a/demo-17/vpc.tf +++ b/demo-17/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } @@ -145,7 +144,7 @@ resource "aws_route_table_association" "main-private-3-a" { # nat gw resource "aws_eip" "nat" { - vpc = true + domain = "vpc" } resource "aws_nat_gateway" "nat-gw" { diff --git a/demo-18/instance.tf b/demo-18/instance.tf index a2a6968e..1ff04bdd 100644 --- a/demo-18/instance.tf +++ b/demo-18/instance.tf @@ -3,7 +3,7 @@ data "aws_ami" "ubuntu" { filter { name = "name" - values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"] + values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"] } filter { diff --git a/demo-18/vpc.tf b/demo-18/vpc.tf index bb51baa7..bb61fcca 100644 --- a/demo-18/vpc.tf +++ b/demo-18/vpc.tf @@ -1,6 +1,6 @@ module "vpc-prod" { source = "terraform-aws-modules/vpc/aws" - version = "2.59.0" + version = "5.19.0" name = "vpc-prod" cidr = "10.0.0.0/16" @@ -20,7 +20,7 @@ module "vpc-prod" { module "vpc-dev" { source = "terraform-aws-modules/vpc/aws" - version = "2.59.0" + version = "5.19.0" name = "vpc-dev" cidr = "10.0.0.0/16" diff --git a/demo-18b/modules/instances/instance.tf b/demo-18b/modules/instances/instance.tf index c53488a5..06d56df2 100644 --- a/demo-18b/modules/instances/instance.tf +++ b/demo-18b/modules/instances/instance.tf @@ -21,7 +21,7 @@ data "aws_ami" "ubuntu" { filter { name = "name" - values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"] + values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"] } filter { diff --git a/demo-7/nat.tf b/demo-7/nat.tf index f32efc2b..e08c8cfd 100644 --- a/demo-7/nat.tf +++ b/demo-7/nat.tf @@ -1,6 +1,6 @@ # nat gw resource "aws_eip" "nat" { - vpc = true + domain = "vpc" } resource "aws_nat_gateway" "nat-gw" { diff --git a/demo-7/vpc.tf b/demo-7/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/demo-7/vpc.tf +++ b/demo-7/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/demo-8/vpc.tf b/demo-8/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/demo-8/vpc.tf +++ b/demo-8/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/demo-9/instance.tf b/demo-9/instance.tf index 88c11839..b4759f7c 100644 --- a/demo-9/instance.tf +++ b/demo-9/instance.tf @@ -22,8 +22,9 @@ resource "aws_ebs_volume" "ebs-volume-1" { } resource "aws_volume_attachment" "ebs-volume-1-attachment" { - device_name = "/dev/xvdh" - volume_id = aws_ebs_volume.ebs-volume-1.id - instance_id = aws_instance.example.id + device_name = "/dev/xvdh" + volume_id = aws_ebs_volume.ebs-volume-1.id + instance_id = aws_instance.example.id + stop_instance_before_detaching = true } diff --git a/demo-9/vpc.tf b/demo-9/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/demo-9/vpc.tf +++ b/demo-9/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/docker-demo-2/ecs.tf b/docker-demo-2/ecs.tf index 905bf698..9b1e277a 100644 --- a/docker-demo-2/ecs.tf +++ b/docker-demo-2/ecs.tf @@ -3,25 +3,49 @@ resource "aws_ecs_cluster" "example-cluster" { name = "example-cluster" } -resource "aws_launch_configuration" "ecs-example-launchconfig" { - name_prefix = "ecs-launchconfig" - image_id = var.ECS_AMIS[var.AWS_REGION] - instance_type = var.ECS_INSTANCE_TYPE - key_name = aws_key_pair.mykeypair.key_name - iam_instance_profile = aws_iam_instance_profile.ecs-ec2-role.id - security_groups = [aws_security_group.ecs-securitygroup.id] - user_data = "#!/bin/bash\necho 'ECS_CLUSTER=example-cluster' > /etc/ecs/ecs.config\nstart ecs" +resource "aws_launch_template" "ecs-example-launchconfig" { + name = "ecs-launchconfig" + image_id = var.ECS_AMIS[var.AWS_REGION] + instance_type = var.ECS_INSTANCE_TYPE + key_name = aws_key_pair.mykeypair.key_name + instance_initiated_shutdown_behavior = "terminate" + + iam_instance_profile { + name = aws_iam_instance_profile.ecs-ec2-role.id + } + + vpc_security_group_ids = [aws_security_group.ecs-securitygroup.id] + user_data = base64encode("#!/bin/bash\necho 'ECS_CLUSTER=example-cluster' > /etc/ecs/ecs.config\nstart ecs") + + credit_specification { + cpu_credits = "standard" + } + + tag_specifications { + resource_type = "instance" + + tags = { + Name = "ecs-example" + } + } + lifecycle { create_before_destroy = true } + } resource "aws_autoscaling_group" "ecs-example-autoscaling" { name = "ecs-example-autoscaling" vpc_zone_identifier = [aws_subnet.main-public-1.id, aws_subnet.main-public-2.id] - launch_configuration = aws_launch_configuration.ecs-example-launchconfig.name min_size = 1 max_size = 1 + + launch_template { + id = aws_launch_template.ecs-example-launchconfig.id + version = "$Latest" + } + tag { key = "Name" value = "ecs-ec2-container" diff --git a/docker-demo-2/myapp.tf b/docker-demo-2/myapp.tf index 58511798..d1649bf1 100644 --- a/docker-demo-2/myapp.tf +++ b/docker-demo-2/myapp.tf @@ -1,15 +1,10 @@ # app -data "template_file" "myapp-task-definition-template" { - template = file("templates/app.json.tpl") - vars = { - REPOSITORY_URL = replace(aws_ecr_repository.myapp.repository_url, "https://", "") - } -} - resource "aws_ecs_task_definition" "myapp-task-definition" { family = "myapp" - container_definitions = data.template_file.myapp-task-definition-template.rendered + container_definitions = templatefile("templates/app.json.tpl", { + REPOSITORY_URL = replace(aws_ecr_repository.myapp.repository_url, "https://", "") + }) } resource "aws_elb" "myapp-elb" { diff --git a/docker-demo-2/vpc.tf b/docker-demo-2/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/docker-demo-2/vpc.tf +++ b/docker-demo-2/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/docker-demo-3/cloudinit.tf b/docker-demo-3/cloudinit.tf index 8349a647..5e52cb3d 100644 --- a/docker-demo-3/cloudinit.tf +++ b/docker-demo-3/cloudinit.tf @@ -1,18 +1,13 @@ -data "template_file" "jenkins-init" { - template = file("scripts/jenkins-init.sh") - vars = { - DEVICE = var.INSTANCE_DEVICE_NAME - JENKINS_VERSION = var.JENKINS_VERSION - } -} - -data "template_cloudinit_config" "cloudinit-jenkins" { +data "cloudinit_config" "cloudinit-jenkins" { gzip = false base64_encode = false part { content_type = "text/x-shellscript" - content = data.template_file.jenkins-init.rendered + content = templatefile("scripts/jenkins-init.sh", { + DEVICE = var.INSTANCE_DEVICE_NAME + JENKINS_VERSION = var.JENKINS_VERSION + }) } } diff --git a/docker-demo-3/jenkins.tf b/docker-demo-3/jenkins.tf index 4f22287f..b0e62dc6 100644 --- a/docker-demo-3/jenkins.tf +++ b/docker-demo-3/jenkins.tf @@ -12,7 +12,7 @@ resource "aws_instance" "jenkins-instance" { key_name = aws_key_pair.mykeypair.key_name # user data - user_data = data.template_cloudinit_config.cloudinit-jenkins.rendered + user_data = data.cloudinit_config.cloudinit-jenkins.rendered } resource "aws_ebs_volume" "jenkins-data" { diff --git a/docker-demo-3/myapp.tf b/docker-demo-3/myapp.tf index d30b7449..75de2c55 100644 --- a/docker-demo-3/myapp.tf +++ b/docker-demo-3/myapp.tf @@ -1,16 +1,11 @@ # app -data "template_file" "myapp-task-definition-template" { - template = file("templates/app.json.tpl") - vars = { - REPOSITORY_URL = replace(aws_ecr_repository.myapp.repository_url, "https://", "") - APP_VERSION = var.MYAPP_VERSION - } -} - resource "aws_ecs_task_definition" "myapp-task-definition" { family = "myapp" - container_definitions = data.template_file.myapp-task-definition-template.rendered + container_definitions = templatefile("templates/app.json.tpl", { + REPOSITORY_URL = replace(aws_ecr_repository.myapp.repository_url, "https://", "") + APP_VERSION = var.MYAPP_VERSION + }) } resource "aws_ecs_service" "myapp-service" { diff --git a/docker-demo-3/s3.tf b/docker-demo-3/s3.tf index 9055ddef..f65e0a36 100644 --- a/docker-demo-3/s3.tf +++ b/docker-demo-3/s3.tf @@ -1,6 +1,5 @@ resource "aws_s3_bucket" "terraform-state" { bucket = "terraform-state-a2b6219" - acl = "private" tags = { Name = "Terraform state" diff --git a/docker-demo-3/scripts/jenkins-init.sh b/docker-demo-3/scripts/jenkins-init.sh index e6a4f377..22785de4 100644 --- a/docker-demo-3/scripts/jenkins-init.sh +++ b/docker-demo-3/scripts/jenkins-init.sh @@ -29,8 +29,12 @@ apt-get update apt-get install -y default-jre # install jenkins and docker -wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - -echo "deb http://pkg.jenkins.io/debian-stable binary/" >> /etc/apt/sources.list +curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \ + /usr/share/keyrings/jenkins-keyring.asc > /dev/null +echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ + https://pkg.jenkins.io/debian-stable binary/ | sudo tee \ + /etc/apt/sources.list.d/jenkins.list > /dev/null +apt-get update apt-get install -y jenkins=${JENKINS_VERSION} unzip docker.io # enable docker and add perms diff --git a/docker-demo-3/vars.tf b/docker-demo-3/vars.tf index 1a6489d7..cdc768b0 100644 --- a/docker-demo-3/vars.tf +++ b/docker-demo-3/vars.tf @@ -28,9 +28,9 @@ variable "ECS_AMIS" { variable "AMIS" { type = map(string) default = { - us-east-1 = "ami-13be557e" - us-west-2 = "ami-06b94666" - eu-west-1 = "ami-844e0bf7" + us-east-1 = "ami-01b996646377b6619" + us-west-2 = "ami-0637e7dc7fcc9a2d9" + eu-west-1 = "ami-081ff4b9aa4e81a08" } } @@ -39,6 +39,6 @@ variable "INSTANCE_DEVICE_NAME" { } variable "JENKINS_VERSION" { - default = "2.303.1" + default = "2.319.2" } diff --git a/docker-demo-3/vpc.tf b/docker-demo-3/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/docker-demo-3/vpc.tf +++ b/docker-demo-3/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/eks-demo/eks-cluster.tf b/eks-demo/eks-cluster.tf index bb7c44d0..18826aa0 100644 --- a/eks-demo/eks-cluster.tf +++ b/eks-demo/eks-cluster.tf @@ -4,14 +4,6 @@ resource "aws_eks_cluster" "demo" { vpc_config { security_group_ids = [aws_security_group.demo-cluster.id] - # TF-UPGRADE-TODO: In Terraform v0.10 and earlier, it was sometimes necessary to - # force an interpolation expression to be interpreted as a list by wrapping it - # in an extra set of list brackets. That form was supported for compatibilty in - # v0.11, but is no longer supported in Terraform v0.12. - # - # If the expression in the following list itself returns a list, remove the - # brackets to avoid interpretation as a list of lists. If the expression - # returns a single list item then leave it as-is and remove this TODO comment. subnet_ids = module.vpc.public_subnets } diff --git a/eks-demo/eks-workers.tf b/eks-demo/eks-workers.tf index 2d462a0d..75ff3baf 100644 --- a/eks-demo/eks-workers.tf +++ b/eks-demo/eks-workers.tf @@ -42,14 +42,6 @@ resource "aws_autoscaling_group" "demo" { max_size = 2 min_size = 1 name = "terraform-eks-demo" - # TF-UPGRADE-TODO: In Terraform v0.10 and earlier, it was sometimes necessary to - # force an interpolation expression to be interpreted as a list by wrapping it - # in an extra set of list brackets. That form was supported for compatibilty in - # v0.11, but is no longer supported in Terraform v0.12. - # - # If the expression in the following list itself returns a list, remove the - # brackets to avoid interpretation as a list of lists. If the expression - # returns a single list item then leave it as-is and remove this TODO comment. vpc_zone_identifier = module.vpc.public_subnets tag { diff --git a/eks-demo/external-ip.tf b/eks-demo/external-ip.tf index 5f953500..d5236b36 100644 --- a/eks-demo/external-ip.tf +++ b/eks-demo/external-ip.tf @@ -3,6 +3,6 @@ data "http" "workstation-external-ip" { } locals { - workstation-external-cidr = "${chomp(data.http.workstation-external-ip.body)}/32" + workstation-external-cidr = "${chomp(data.http.workstation-external-ip.response_body)}/32" } diff --git a/eks-demo/iam-workers.tf b/eks-demo/iam-workers.tf index 4c88301e..a921ebac 100644 --- a/eks-demo/iam-workers.tf +++ b/eks-demo/iam-workers.tf @@ -33,6 +33,11 @@ resource "aws_iam_role_policy_attachment" "demo-node-AmazonEC2ContainerRegistryR role = aws_iam_role.demo-node.name } +resource "aws_iam_role_policy_attachment" "demo-node-AmazonSSMManagedInstanceCore" { + policy_arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + role = aws_iam_role.demo-node.name +} + resource "aws_iam_instance_profile" "demo-node" { name = "terraform-eks-demo" role = aws_iam_role.demo-node.name diff --git a/eks-demo/securitygroups.tf b/eks-demo/securitygroups.tf index 504e78f1..3ee9c8ac 100644 --- a/eks-demo/securitygroups.tf +++ b/eks-demo/securitygroups.tf @@ -26,14 +26,6 @@ resource "aws_security_group_rule" "demo-cluster-ingress-node-https" { } resource "aws_security_group_rule" "demo-cluster-ingress-workstation-https" { - # TF-UPGRADE-TODO: In Terraform v0.10 and earlier, it was sometimes necessary to - # force an interpolation expression to be interpreted as a list by wrapping it - # in an extra set of list brackets. That form was supported for compatibilty in - # v0.11, but is no longer supported in Terraform v0.12. - # - # If the expression in the following list itself returns a list, remove the - # brackets to avoid interpretation as a list of lists. If the expression - # returns a single list item then leave it as-is and remove this TODO comment. cidr_blocks = [local.workstation-external-cidr] description = "Allow workstation to communicate with the cluster API Server" from_port = 443 diff --git a/eks-demo/vpc.tf b/eks-demo/vpc.tf index 1c959cbe..fcfdf7a6 100644 --- a/eks-demo/vpc.tf +++ b/eks-demo/vpc.tf @@ -1,6 +1,6 @@ module "vpc" { source = "terraform-aws-modules/vpc/aws" - version = "2.59.0" + version = "5.19.0" name = "vpc-module-demo" cidr = "10.0.0.0/16" diff --git a/first-steps-final/datasource.tf b/first-steps-final/datasource.tf new file mode 100644 index 00000000..9cf7e052 --- /dev/null +++ b/first-steps-final/datasource.tf @@ -0,0 +1,19 @@ +data "aws_ami" "ubuntu" { + most_recent = true + + filter { + name = "name" + values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"] + } + + filter { + name = "virtualization-type" + values = ["hvm"] + } + + owners = ["099720109477"] # Canonical +} + +//data "aws_caller_identity" "current" {} + +//data "aws_region" "current" {} diff --git a/first-steps-final/instance.tf b/first-steps-final/instance.tf new file mode 100644 index 00000000..cf406daa --- /dev/null +++ b/first-steps-final/instance.tf @@ -0,0 +1,67 @@ + +resource "aws_instance" "web" { + ami = data.aws_ami.ubuntu.id + instance_type = var.instance_type.example + + subnet_id = module.vpc.public_subnets[0] + + vpc_security_group_ids = [aws_security_group.allow_ssh.id] + + key_name = aws_key_pair.mykey.key_name + + user_data = templatefile("${path.module}/templates/web.tpl", { + "region" = var.aws_region + }) + + user_data_replace_on_change = true + + //connection { + // type = "ssh" + // user = "ubuntu" + // private_key = file("${path.module}/mykey") + // host = self.public_ip + //} + + //provisioner "remote-exec" { + // inline = [ + // "sudo apt-get update", + // "sudo apt-get -y install nginx", + // ] + //} + + tags = { + Name = "example" + } +} + + +resource "aws_security_group" "allow_ssh" { + name = "allow_ssh" + description = "Allow SSH inbound traffic and all outbound traffic" + vpc_id = module.vpc.vpc_id + + ingress { + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + ipv6_cidr_blocks = ["::/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + ipv6_cidr_blocks = ["::/0"] + } + + tags = { + Name = "allow_ssh" + } +} + +resource "aws_key_pair" "mykey" { + key_name = "mykey-demo" + public_key = file("${path.module}/mykey.pub") +} \ No newline at end of file diff --git a/first-steps-final/output.tf b/first-steps-final/output.tf new file mode 100644 index 00000000..04fc3746 --- /dev/null +++ b/first-steps-final/output.tf @@ -0,0 +1,11 @@ +output "public_ip" { + value = aws_instance.web.public_ip +} + +output "public_subnets" { + value = module.vpc.public_subnets +} + +output "vpc_id" { + value = module.vpc.vpc_id +} \ No newline at end of file diff --git a/first-steps-final/templates/web.tpl b/first-steps-final/templates/web.tpl new file mode 100644 index 00000000..f153fc13 --- /dev/null +++ b/first-steps-final/templates/web.tpl @@ -0,0 +1,5 @@ +#!/bin/bash + +apt-get update +apt-get install -y nginx aws-cli + diff --git a/first-steps-final/terraform.tf b/first-steps-final/terraform.tf new file mode 100644 index 00000000..ed0c9d1b --- /dev/null +++ b/first-steps-final/terraform.tf @@ -0,0 +1,12 @@ +terraform { + //backend "s3" { + // bucket = "terraform-a49cd32" + // key = "first-steps/terraform.tfstate" + // region = "us-east-1" + // + // dynamodb_table = "terraform-locking" + //} +} +provider "aws" { + region = "us-east-1" +} diff --git a/first-steps-final/variables.tf b/first-steps-final/variables.tf new file mode 100644 index 00000000..510b9a48 --- /dev/null +++ b/first-steps-final/variables.tf @@ -0,0 +1,11 @@ +variable "instance_type" { + type = map(any) + default = { + "example" = "t2.micro" + "other_instance" = "t4g.micro" + } +} + +variable "aws_region" { + default = "us-east-1" +} \ No newline at end of file diff --git a/first-steps-final/vpc.tf b/first-steps-final/vpc.tf new file mode 100644 index 00000000..8a4cb9b7 --- /dev/null +++ b/first-steps-final/vpc.tf @@ -0,0 +1,20 @@ +module "vpc" { + source = "terraform-aws-modules/vpc/aws" + + name = "my-vpc" + cidr = "10.0.0.0/16" + + azs = ["${var.aws_region}a", "${var.aws_region}b", "${var.aws_region}c"] + private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] + public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"] + + map_public_ip_on_launch = true + + enable_nat_gateway = false + enable_vpn_gateway = false + + tags = { + Terraform = "true" + Environment = "dev" + } +} diff --git a/jenkins-packer-demo/cloudinit.tf b/jenkins-packer-demo/cloudinit.tf index 359df49a..54401c81 100644 --- a/jenkins-packer-demo/cloudinit.tf +++ b/jenkins-packer-demo/cloudinit.tf @@ -1,19 +1,14 @@ -data "template_file" "jenkins-init" { - template = file("scripts/jenkins-init.sh") - vars = { - DEVICE = var.INSTANCE_DEVICE_NAME - JENKINS_VERSION = var.JENKINS_VERSION - TERRAFORM_VERSION = var.TERRAFORM_VERSION - } -} - -data "template_cloudinit_config" "cloudinit-jenkins" { +data "cloudinit_config" "cloudinit-jenkins" { gzip = false base64_encode = false part { content_type = "text/x-shellscript" - content = data.template_file.jenkins-init.rendered + content = templatefile("scripts/jenkins-init.sh", { + DEVICE = var.INSTANCE_DEVICE_NAME + JENKINS_VERSION = var.JENKINS_VERSION + TERRAFORM_VERSION = var.TERRAFORM_VERSION + }) } } diff --git a/jenkins-packer-demo/instance.tf b/jenkins-packer-demo/instance.tf index e7bbeb2b..5892d5e2 100644 --- a/jenkins-packer-demo/instance.tf +++ b/jenkins-packer-demo/instance.tf @@ -28,7 +28,7 @@ resource "aws_instance" "jenkins-instance" { key_name = aws_key_pair.mykeypair.key_name # user data - user_data = data.template_cloudinit_config.cloudinit-jenkins.rendered + user_data = data.cloudinit_config.cloudinit-jenkins.rendered # iam instance profile iam_instance_profile = aws_iam_instance_profile.jenkins-role.name diff --git a/jenkins-packer-demo/s3.tf b/jenkins-packer-demo/s3.tf index ad57a5cb..da29fd86 100644 --- a/jenkins-packer-demo/s3.tf +++ b/jenkins-packer-demo/s3.tf @@ -1,6 +1,5 @@ resource "aws_s3_bucket" "terraform-state" { bucket = "terraform-state-${random_string.random.result}" - acl = "private" tags = { Name = "Terraform state" diff --git a/jenkins-packer-demo/vars.tf b/jenkins-packer-demo/vars.tf index 9fd26c31..558b069b 100644 --- a/jenkins-packer-demo/vars.tf +++ b/jenkins-packer-demo/vars.tf @@ -15,7 +15,7 @@ variable "INSTANCE_DEVICE_NAME" { } variable "JENKINS_VERSION" { - default = "2.204.5" + default = "2.414.3" } variable "TERRAFORM_VERSION" { diff --git a/jenkins-packer-demo/vpc.tf b/jenkins-packer-demo/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/jenkins-packer-demo/vpc.tf +++ b/jenkins-packer-demo/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" } diff --git a/module-demo/ecs.tf b/module-demo/ecs.tf index 88ea6ee3..84f91941 100644 --- a/module-demo/ecs.tf +++ b/module-demo/ecs.tf @@ -16,20 +16,21 @@ module "my-ecs" { } module "my-service" { - source = "github.com/in4it/terraform-modules//modules/ecs-service" - vpc_id = module.vpc.vpc_id - application_name = "my-service" - application_port = "80" - application_version = "latest" - cluster_arn = module.my-ecs.cluster_arn - service_role_arn = module.my-ecs.service_role_arn - aws_region = var.AWS_REGION - healthcheck_matcher = "200" - cpu_reservation = "256" - memory_reservation = "128" - log_group = "my-log-group" - desired_count = 2 - alb_arn = module.my-alb.lb_arn + source = "github.com/in4it/terraform-modules//modules/ecs-service" + vpc_id = module.vpc.vpc_id + application_name = "my-service" + application_port = "80" + application_version = "latest" + cluster_arn = module.my-ecs.cluster_arn + service_role_arn = module.my-ecs.service_role_arn + aws_region = var.AWS_REGION + healthcheck_matcher = "200" + cpu_reservation = "256" + memory_reservation = "128" + log_group = "my-log-group" + desired_count = 2 + alb_arn = module.my-alb.lb_arn + deployment_controller = "ECS" } module "my-alb" { diff --git a/module-demo/vpc.tf b/module-demo/vpc.tf index 773f0eda..4e07fa8f 100644 --- a/module-demo/vpc.tf +++ b/module-demo/vpc.tf @@ -1,6 +1,6 @@ module "vpc" { source = "terraform-aws-modules/vpc/aws" - version = "2.59.0" + version = "5.19.0" name = "vpc-module-demo" cidr = "10.0.0.0/16" diff --git a/packer-demo/vpc.tf b/packer-demo/vpc.tf index 4e9d8092..a818d7bb 100644 --- a/packer-demo/vpc.tf +++ b/packer-demo/vpc.tf @@ -4,7 +4,6 @@ resource "aws_vpc" "main" { instance_tenancy = "default" enable_dns_support = "true" enable_dns_hostnames = "true" - enable_classiclink = "false" tags = { Name = "main" }