diff --git a/sg-demo-8723/terraform/.gitignore b/sg-demo-8723/terraform/.gitignore new file mode 100644 index 0000000..05b2a76 --- /dev/null +++ b/sg-demo-8723/terraform/.gitignore @@ -0,0 +1,32 @@ +# Source: https://github.com/github/gitignore/blob/main/Terraform.gitignore +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Ignore transient lock info files created by terraform apply +.terraform.tfstate.lock.info + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc + diff --git a/sg-demo-8723/terraform/.metadata b/sg-demo-8723/terraform/.metadata new file mode 100644 index 0000000..d624ae1 --- /dev/null +++ b/sg-demo-8723/terraform/.metadata @@ -0,0 +1,7 @@ +{ + "app_stack_name": "sales-demo", + "iac_type": "Terraform", + "provider": "aws", + "multi_env": false, + "exporter": "terraform" +} \ No newline at end of file diff --git a/sg-demo-8723/terraform/README.md b/sg-demo-8723/terraform/README.md new file mode 100644 index 0000000..15f094c --- /dev/null +++ b/sg-demo-8723/terraform/README.md @@ -0,0 +1,3 @@ +# README +This is a readme file for IaC generated with StackGen. +You can modify your appStack -> [here](http://demo.cloud.stackgen.com/appstacks/d8070f24-e7ff-4414-80c9-305894c61a7b) diff --git a/sg-demo-8723/terraform/backend.tf b/sg-demo-8723/terraform/backend.tf new file mode 100644 index 0000000..1bcd7e3 --- /dev/null +++ b/sg-demo-8723/terraform/backend.tf @@ -0,0 +1,8 @@ +terraform { + backend "s3" { + bucket = "drift-detect-tfstates" + key = "sd-test-demo.tfstate" + region = "us-east-2" + encrypt = "true" + } +} diff --git a/sg-demo-8723/terraform/modules.tf.json b/sg-demo-8723/terraform/modules.tf.json new file mode 100644 index 0000000..5d10766 --- /dev/null +++ b/sg-demo-8723/terraform/modules.tf.json @@ -0,0 +1,65 @@ +{ + "module": { + "stackgen_19ce20e7-23b8-5eec-9eed-9b8ff05adec8": { + "availability_zone": "eu-west-1a", + "cidr_block": "112.10.3.0/26", + "map_public_ip_on_launch": false, + "source": "./modules/aws_subnet", + "tags": { + "Name": "sg-vpc4-5subnets-public-3" + }, + "vpc_id": "${module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.id}" + }, + "stackgen_2df86e4d-6319-535b-9462-69c4f185be7f": { + "availability_zone": "eu-west-1b", + "cidr_block": "112.10.2.0/26", + "map_public_ip_on_launch": false, + "source": "./modules/aws_subnet", + "tags": { + "Name": "sg-vpc4-5subnets-public-2" + }, + "vpc_id": "${module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.id}" + }, + "stackgen_7481e4a5-1f5b-5d2b-a1be-ad3c45069aa9": { + "availability_zone": "eu-west-1a", + "cidr_block": "112.10.5.0/24", + "map_public_ip_on_launch": false, + "source": "./modules/aws_subnet", + "tags": { + "Name": "sg-vpc4-5subnets-public-5" + }, + "vpc_id": "${module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.id}" + }, + "stackgen_880746c1-14ec-54f2-b021-718f7663d4e1": { + "availability_zone": "eu-west-1b", + "cidr_block": "112.10.0.0/24", + "map_public_ip_on_launch": false, + "source": "./modules/aws_subnet", + "tags": { + "Name": "sg-vpc4-5subnets-public-4" + }, + "vpc_id": "${module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.id}" + }, + "stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1": { + "cidr_block": "112.10.0.0/16", + "enable_dns_hostnames": true, + "enable_dns_support": true, + "enable_network_address_usage_metrics": false, + "instance_tenancy": "default", + "source": "./modules/aws_vpc", + "tags": { + "Name": "sg-vpc4-5subnets" + } + }, + "stackgen_e46b0268-d537-5202-9c0c-c031f1877081": { + "availability_zone": "eu-west-1a", + "cidr_block": "112.10.1.0/24", + "map_public_ip_on_launch": false, + "source": "./modules/aws_subnet", + "tags": { + "Name": "sg-vpc4-5subnets-public-1" + }, + "vpc_id": "${module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.id}" + } + } +} \ No newline at end of file diff --git a/sg-demo-8723/terraform/modules/aws_subnet/aws_subnet.tf b/sg-demo-8723/terraform/modules/aws_subnet/aws_subnet.tf new file mode 100644 index 0000000..443708b --- /dev/null +++ b/sg-demo-8723/terraform/modules/aws_subnet/aws_subnet.tf @@ -0,0 +1,9 @@ +resource "aws_subnet" "this" { + vpc_id = var.vpc_id + availability_zone = var.availability_zone + cidr_block = var.cidr_block + map_public_ip_on_launch = var.map_public_ip_on_launch + + tags = var.tags + +} diff --git a/sg-demo-8723/terraform/modules/aws_subnet/outputs.tf.json b/sg-demo-8723/terraform/modules/aws_subnet/outputs.tf.json new file mode 100644 index 0000000..53e901f --- /dev/null +++ b/sg-demo-8723/terraform/modules/aws_subnet/outputs.tf.json @@ -0,0 +1,14 @@ +{ + "output": { + "arn": { + "description": "The value of the arn output", + "sensitive": false, + "value": "${aws_subnet.this.arn}" + }, + "id": { + "description": "The value of the id output", + "sensitive": false, + "value": "${aws_subnet.this.id}" + } + } +} \ No newline at end of file diff --git a/sg-demo-8723/terraform/modules/aws_subnet/variables.tf.json b/sg-demo-8723/terraform/modules/aws_subnet/variables.tf.json new file mode 100644 index 0000000..cf9f712 --- /dev/null +++ b/sg-demo-8723/terraform/modules/aws_subnet/variables.tf.json @@ -0,0 +1,40 @@ +{ + "variable": { + "vpc_id": [ + { + "description": "The VPC ID", + "type": "string", + "nullable": false + } + ], + "cidr_block": [ + { + "description": "The CIDR block for the subnet", + "type": "string", + "nullable": true + } + ], + "availability_zone": [ + { + "description": "The availability zone", + "type": "string", + "nullable": true + } + ], + "tags": [ + { + "description": "The tags to apply to the subnet", + "type": "map(string)", + "nullable": true + } + ], + "map_public_ip_on_launch":[ + { + "description": "Specify true to indicate that instances launched into the subnet should be assigned a public IP address.", + "type": "bool", + "nullable": true, + "default": false + } + ] + } +} \ No newline at end of file diff --git a/sg-demo-8723/terraform/modules/aws_vpc/aws_vpc.tf b/sg-demo-8723/terraform/modules/aws_vpc/aws_vpc.tf new file mode 100644 index 0000000..ce66b21 --- /dev/null +++ b/sg-demo-8723/terraform/modules/aws_vpc/aws_vpc.tf @@ -0,0 +1,8 @@ +resource "aws_vpc" "this" { + cidr_block = var.cidr_block + instance_tenancy = var.instance_tenancy + enable_dns_support = var.enable_dns_support + enable_dns_hostnames = var.enable_dns_hostnames + enable_network_address_usage_metrics = var.enable_network_address_usage_metrics + tags = var.tags +} diff --git a/sg-demo-8723/terraform/modules/aws_vpc/outputs.tf.json b/sg-demo-8723/terraform/modules/aws_vpc/outputs.tf.json new file mode 100644 index 0000000..076a056 --- /dev/null +++ b/sg-demo-8723/terraform/modules/aws_vpc/outputs.tf.json @@ -0,0 +1,19 @@ +{ + "output": { + "arn": { + "description": "The value of the arn output", + "sensitive": false, + "value": "${aws_vpc.this.arn}" + }, + "id": { + "description": "The value of the id output", + "sensitive": false, + "value": "${aws_vpc.this.id}" + }, + "vpc_id": { + "description": "The value of the vpc_id output", + "sensitive": false, + "value": "${aws_vpc.this.id}" + } + } +} \ No newline at end of file diff --git a/sg-demo-8723/terraform/modules/aws_vpc/variables.tf.json b/sg-demo-8723/terraform/modules/aws_vpc/variables.tf.json new file mode 100644 index 0000000..f8fb561 --- /dev/null +++ b/sg-demo-8723/terraform/modules/aws_vpc/variables.tf.json @@ -0,0 +1,47 @@ +{ + "variable": { + "cidr_block": [ + { + "description": "The IPv4 CIDR block for the VPC.", + "nullable": false, + "type": "string" + } + ], + "instance_tenancy": [ + { + "description": "The IPv4 CIDR block for the VPC.", + "default": "default", + "type": "string" + } + ], + "enable_dns_support": [ + { + "description": "A boolean flag to enable/disable DNS support in the VPC.", + "default": true, + "type": "bool" + } + ], + "enable_network_address_usage_metrics": [ + { + "description": "Indicates whether Network Address Usage metrics are enabled for your VPC.", + "default": false, + "type": "bool" + } + ], + "enable_dns_hostnames": [ + { + "description": "A boolean flag to enable/disable DNS hostnames in the VPC.", + "default": false, + "type": "bool" + } + ], + "tags": [ + { + "description": "The tags to apply to the subnet", + "type": "map(string)", + "nullable": true, + "default": {} + } + ] + } +} diff --git a/sg-demo-8723/terraform/moves.tf b/sg-demo-8723/terraform/moves.tf new file mode 100644 index 0000000..4fb5751 --- /dev/null +++ b/sg-demo-8723/terraform/moves.tf @@ -0,0 +1,30 @@ +moved { + from = aws_subnet.public[3] + to = module.stackgen_880746c1-14ec-54f2-b021-718f7663d4e1.aws_subnet.this +} + +moved { + from = aws_subnet.public[0] + to = module.stackgen_e46b0268-d537-5202-9c0c-c031f1877081.aws_subnet.this +} + +moved { + from = aws_vpc.main + to = module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.aws_vpc.this +} + +moved { + from = aws_subnet.public[2] + to = module.stackgen_19ce20e7-23b8-5eec-9eed-9b8ff05adec8.aws_subnet.this +} + +moved { + from = aws_subnet.public[1] + to = module.stackgen_2df86e4d-6319-535b-9462-69c4f185be7f.aws_subnet.this +} + +moved { + from = aws_subnet.public[4] + to = module.stackgen_7481e4a5-1f5b-5d2b-a1be-ad3c45069aa9.aws_subnet.this +} + diff --git a/sg-demo-8723/terraform/outputs.tf b/sg-demo-8723/terraform/outputs.tf new file mode 100644 index 0000000..4c44afd --- /dev/null +++ b/sg-demo-8723/terraform/outputs.tf @@ -0,0 +1,65 @@ +output "aws_subnet_stackgen_880746c1-14ec-54f2-b021-718f7663d4e1_arn" { + value = module.stackgen_880746c1-14ec-54f2-b021-718f7663d4e1.arn + sensitive = false +} + +output "aws_subnet_stackgen_880746c1-14ec-54f2-b021-718f7663d4e1_id" { + value = module.stackgen_880746c1-14ec-54f2-b021-718f7663d4e1.id + sensitive = false +} + +output "aws_subnet_stackgen_e46b0268-d537-5202-9c0c-c031f1877081_arn" { + value = module.stackgen_e46b0268-d537-5202-9c0c-c031f1877081.arn + sensitive = false +} + +output "aws_subnet_stackgen_e46b0268-d537-5202-9c0c-c031f1877081_id" { + value = module.stackgen_e46b0268-d537-5202-9c0c-c031f1877081.id + sensitive = false +} + +output "aws_subnet_stackgen_19ce20e7-23b8-5eec-9eed-9b8ff05adec8_arn" { + value = module.stackgen_19ce20e7-23b8-5eec-9eed-9b8ff05adec8.arn + sensitive = false +} + +output "aws_subnet_stackgen_19ce20e7-23b8-5eec-9eed-9b8ff05adec8_id" { + value = module.stackgen_19ce20e7-23b8-5eec-9eed-9b8ff05adec8.id + sensitive = false +} + +output "aws_subnet_stackgen_2df86e4d-6319-535b-9462-69c4f185be7f_arn" { + value = module.stackgen_2df86e4d-6319-535b-9462-69c4f185be7f.arn + sensitive = false +} + +output "aws_subnet_stackgen_2df86e4d-6319-535b-9462-69c4f185be7f_id" { + value = module.stackgen_2df86e4d-6319-535b-9462-69c4f185be7f.id + sensitive = false +} + +output "aws_subnet_stackgen_7481e4a5-1f5b-5d2b-a1be-ad3c45069aa9_arn" { + value = module.stackgen_7481e4a5-1f5b-5d2b-a1be-ad3c45069aa9.arn + sensitive = false +} + +output "aws_subnet_stackgen_7481e4a5-1f5b-5d2b-a1be-ad3c45069aa9_id" { + value = module.stackgen_7481e4a5-1f5b-5d2b-a1be-ad3c45069aa9.id + sensitive = false +} + +output "aws_vpc_stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1_arn" { + value = module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.arn + sensitive = false +} + +output "aws_vpc_stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1_id" { + value = module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.id + sensitive = false +} + +output "aws_vpc_stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1_vpc_id" { + value = module.stackgen_cdda596c-e26d-521e-ad04-42444c83b5f1.vpc_id + sensitive = false +} + diff --git a/sg-demo-8723/terraform/provider.tf b/sg-demo-8723/terraform/provider.tf new file mode 100644 index 0000000..f411dbd --- /dev/null +++ b/sg-demo-8723/terraform/provider.tf @@ -0,0 +1,23 @@ +terraform { + required_version = ">= 1.0.0, < 2.0.0" + + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 5.0" + } + + awscc = { // AWS Cloud Control + source = "hashicorp/awscc" + version = "~> 1.0" + } + } +} + +provider "awscc" { + region = var.region +} + +provider "aws" { + region = var.region +} diff --git a/sg-demo-8723/terraform/variables.tf b/sg-demo-8723/terraform/variables.tf new file mode 100644 index 0000000..8075d7f --- /dev/null +++ b/sg-demo-8723/terraform/variables.tf @@ -0,0 +1,3 @@ +variable "region" { + description = "AWS region in which the project needs to be setup (us-east-1, ca-west-1, eu-west-3, etc)" +}