github.com/hazelops/ize@v1.1.12-0.20230915191306-97d7c0e48f11/examples/ecs-apps-monorepo/.ize/env/testnut/main.tf (about) 1 resource "aws_key_pair" "root" { 2 key_name = var.ec2_key_pair_name 3 public_key = var.ssh_public_key 4 5 lifecycle { 6 ignore_changes = [ 7 public_key 8 ] 9 } 10 } 11 12 module "vpc" { 13 source = "registry.terraform.io/terraform-aws-modules/vpc/aws" 14 version = "~> 3.0" 15 16 name = "${var.env}-vpc" 17 cidr = "10.0.0.0/16" 18 19 azs = [ 20 "us-east-1a", 21 "us-east-1b", 22 23 ] 24 public_subnets = [ 25 "10.0.1.0/24", 26 "10.0.2.0/24" 27 ] 28 29 private_subnets = [ 30 "10.0.3.0/24", 31 "10.0.4.0/24" 32 ] 33 34 enable_nat_gateway = true 35 single_nat_gateway = true 36 enable_dns_hostnames = true 37 manage_default_network_acl = true 38 default_network_acl_name = "${var.env}-${var.namespace}" 39 tags = { 40 Terraform = "true" 41 Env = var.env 42 } 43 } 44 45 data "aws_route53_zone" "root" { 46 name = "${var.root_domain_name}." 47 private_zone = false 48 } 49 50 resource "aws_route53_record" "env_ns_record" { 51 zone_id = data.aws_route53_zone.root.id 52 name = "${var.env}.${var.root_domain_name}" 53 type = "NS" 54 ttl = "60" 55 records = aws_route53_zone.env_domain.name_servers 56 } 57 58 59 resource "aws_route53_zone" "env_domain" { 60 name = "${var.env}.${var.root_domain_name}" 61 } 62 63 resource "aws_security_group" "default_permissive" { 64 name = "${var.env}-default-permissive" 65 vpc_id = module.vpc.vpc_id 66 description = "Managed by Terraform" 67 68 ingress { 69 protocol = -1 70 from_port = 0 71 to_port = 0 72 cidr_blocks = ["0.0.0.0/0"] 73 } 74 75 egress { 76 protocol = -1 77 from_port = 0 78 to_port = 0 79 cidr_blocks = ["0.0.0.0/0"] 80 } 81 82 tags = { 83 Terraform = "true" 84 Env = var.env 85 Name = "${var.env}-default-permissive" 86 } 87 } 88 89 module "ecs" { 90 source = "registry.terraform.io/terraform-aws-modules/ecs/aws" 91 version = "~> 3.0" 92 name = "${var.env}-${var.namespace}" 93 94 } 95 96 module "ec2_profile" { 97 source = "registry.terraform.io/terraform-aws-modules/ecs/aws//modules/ecs-instance-profile" 98 version = "~> 3.0" 99 name = "${var.env}-${var.namespace}" 100 include_ssm = true 101 } 102