Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scaffolding #5

Merged
merged 22 commits into from
Mar 26, 2024
Merged

Add scaffolding #5

merged 22 commits into from
Mar 26, 2024

Conversation

kunduso
Copy link
Owner

@kunduso kunduso commented Mar 25, 2024

The changes in this PR closes #1, closes #4 and closes #3

Copy link

github-actions bot commented Mar 25, 2024

Infracost report

💰 Monthly cost will increase by $17 📈

Project Cost change New monthly cost
kunduso/add-aws-ecr-ecs-fargate/infra/TFplan.JSON +$17 $17
Cost details
──────────────────────────────────
Project: kunduso/add-aws-ecr-ecs-fargate/infra/TFplan.JSON

+ aws_cloudwatch_log_group.logs
  Monthly cost depends on usage

    + Data ingested
      Monthly cost depends on usage
        +$0.50 per GB

    + Archival Storage
      Monthly cost depends on usage
        +$0.03 per GB

    + Insights queries data scanned
      Monthly cost depends on usage
        +$0.005 per GB

+ aws_ecr_repository.image_repo
  Monthly cost depends on usage

    + Storage
      Monthly cost depends on usage
        +$0.10 per GB

+ aws_kms_key.key
  +$1

    + Customer master key
      +$1

    + Requests
      Monthly cost depends on usage
        +$0.03 per 10k requests

    + ECC GenerateDataKeyPair requests
      Monthly cost depends on usage
        +$0.10 per 10k requests

    + RSA GenerateDataKeyPair requests
      Monthly cost depends on usage
        +$0.10 per 10k requests

+ aws_lb.app_lb
  +$16

    + Application load balancer
      +$16

    + Load balancer capacity units
      Monthly cost depends on usage
        +$5.84 per LCU

Monthly cost change for kunduso/add-aws-ecr-ecs-fargate/infra/TFplan.JSON
Amount:  +$17 ($0.00 → $17)

──────────────────────────────────
Key: ~ changed, + added, - removed

21 cloud resources were detected:
∙ 4 were estimated, 3 of which include usage-based costs, see https://infracost.io/usage-file
∙ 15 were free:
  ∙ 3 x aws_route_table_association
  ∙ 3 x aws_subnet
  ∙ 1 x aws_alb_listener
  ∙ 1 x aws_ecs_cluster
  ∙ 1 x aws_internet_gateway
  ∙ 1 x aws_kms_alias
  ∙ 1 x aws_lb_target_group
  ∙ 1 x aws_route
  ∙ 1 x aws_route_table
  ∙ 1 x aws_security_group
  ∙ 1 x aws_vpc
∙ 2 are not supported yet, see https://infracost.io/requested-resources:
  ∙ 1 x aws_kms_key_policy
  ∙ 1 x aws_service_discovery_http_namespace

Infracost estimate: Monthly cost will increase by $17 ↑
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ Project                                            ┃ Cost change ┃ New monthly cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━┫
┃ kunduso/add-aws-ecr-ecs-fargate/infra/TFplan.JSON  ┃        +$17 ┃ $17              ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━┛
This comment will be updated when code changes.

Copy link

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_ecr_repository.image_repo will be created
  + resource "aws_ecr_repository" "image_repo" {
      + arn                  = (known after apply)
      + id                   = (known after apply)
      + image_tag_mutability = "IMMUTABLE"
      + name                 = "app-5"
      + registry_id          = (known after apply)
      + repository_url       = (known after apply)
      + tags_all             = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }

      + image_scanning_configuration {
          + scan_on_push = true
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: TFplan.JSON

To perform exactly these actions, run the following command to apply:
    terraform apply "TFplan.JSON"

Pushed by: @kunduso, Action: pull_request

Copy link

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_ecr_repository.image_repo will be created
  + resource "aws_ecr_repository" "image_repo" {
      + arn                  = (known after apply)
      + id                   = (known after apply)
      + image_tag_mutability = "IMMUTABLE"
      + name                 = "app-5"
      + registry_id          = (known after apply)
      + repository_url       = (known after apply)
      + tags_all             = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }

      + image_scanning_configuration {
          + scan_on_push = true
        }
    }

  # aws_internet_gateway.this_igw will be created
  + resource "aws_internet_gateway" "this_igw" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + owner_id = (known after apply)
      + tags     = {
          + "Name" = "app-4-gateway"
        }
      + tags_all = {
          + "Name"   = "app-4-gateway"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id   = (known after apply)
    }

  # aws_route.internet_route will be created
  + resource "aws_route" "internet_route" {
      + destination_cidr_block = "0.0.0.0/0"
      + gateway_id             = (known after apply)
      + id                     = (known after apply)
      + instance_id            = (known after apply)
      + instance_owner_id      = (known after apply)
      + network_interface_id   = (known after apply)
      + origin                 = (known after apply)
      + route_table_id         = (known after apply)
      + state                  = (known after apply)
    }

  # aws_route_table.this_rt will be created
  + resource "aws_route_table" "this_rt" {
      + arn              = (known after apply)
      + id               = (known after apply)
      + owner_id         = (known after apply)
      + propagating_vgws = (known after apply)
      + route            = (known after apply)
      + tags             = {
          + "Name" = "app-4-route-table"
        }
      + tags_all         = {
          + "Name"   = "app-4-route-table"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id           = (known after apply)
    }

  # aws_route_table_association.public[0] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_route_table_association.public[1] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_route_table_association.public[2] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_security_group.web_pub_sg will be created
  + resource "aws_security_group" "web_pub_sg" {
      + arn                    = (known after apply)
      + description            = "allow inbound traffic"
      + egress                 = [
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = ""
              + from_port        = 0
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "-1"
              + security_groups  = []
              + self             = false
              + to_port          = 0
            },
        ]
      + id                     = (known after apply)
      + ingress                = [
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = "from vpc"
              + from_port        = 0
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "-1"
              + security_groups  = []
              + self             = false
              + to_port          = 0
            },
        ]
      + name                   = "allow_inbound_access"
      + name_prefix            = (known after apply)
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + tags                   = {
          + "Name" = "app-4-ec2-sg"
        }
      + tags_all               = {
          + "Name"   = "app-4-ec2-sg"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                 = (known after apply)
    }

  # aws_service_discovery_http_namespace.app4 will be created
  + resource "aws_service_discovery_http_namespace" "app4" {
      + arn         = (known after apply)
      + description = "The namespace for the ECS cluster. "
      + http_name   = (known after apply)
      + id          = (known after apply)
      + name        = "app-4"
      + tags_all    = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
    }

  # aws_subnet.public[0] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2a"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.0/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-1"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-1"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_subnet.public[1] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2b"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.32/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-2"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-2"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_subnet.public[2] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2c"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.64/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-3"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-3"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_vpc.this will be created
  + resource "aws_vpc" "this" {
      + arn                                  = (known after apply)
      + cidr_block                           = "11.90.30.0/25"
      + default_network_acl_id               = (known after apply)
      + default_route_table_id               = (known after apply)
      + default_security_group_id            = (known after apply)
      + dhcp_options_id                      = (known after apply)
      + enable_dns_hostnames                 = true
      + enable_dns_support                   = true
      + enable_network_address_usage_metrics = (known after apply)
      + id                                   = (known after apply)
      + instance_tenancy                     = "default"
      + ipv6_association_id                  = (known after apply)
      + ipv6_cidr_block                      = (known after apply)
      + ipv6_cidr_block_network_border_group = (known after apply)
      + main_route_table_id                  = (known after apply)
      + owner_id                             = (known after apply)
      + tags                                 = {
          + "Name" = "app-4"
        }
      + tags_all                             = {
          + "Name"   = "app-4"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
    }

Plan: 13 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: TFplan.JSON

To perform exactly these actions, run the following command to apply:
    terraform apply "TFplan.JSON"

Pushed by: @kunduso, Action: pull_request

Copy link

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_ecr_repository.image_repo will be created
  + resource "aws_ecr_repository" "image_repo" {
      + arn                  = (known after apply)
      + id                   = (known after apply)
      + image_tag_mutability = "IMMUTABLE"
      + name                 = "app-4"
      + registry_id          = (known after apply)
      + repository_url       = (known after apply)
      + tags_all             = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }

      + image_scanning_configuration {
          + scan_on_push = true
        }
    }

  # aws_ecs_cluster.app_cluster will be created
  + resource "aws_ecs_cluster" "app_cluster" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + name     = "app-4"
      + tags_all = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }

      + configuration {
          + execute_command_configuration {
              + logging = "OVERRIDE"
            }
        }

      + service_connect_defaults {
          + namespace = (known after apply)
        }

      + setting {
          + name  = "containerInsights"
          + value = "enabled"
        }
    }

  # aws_internet_gateway.this_igw will be created
  + resource "aws_internet_gateway" "this_igw" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + owner_id = (known after apply)
      + tags     = {
          + "Name" = "app-4-gateway"
        }
      + tags_all = {
          + "Name"   = "app-4-gateway"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id   = (known after apply)
    }

  # aws_route.internet_route will be created
  + resource "aws_route" "internet_route" {
      + destination_cidr_block = "0.0.0.0/0"
      + gateway_id             = (known after apply)
      + id                     = (known after apply)
      + instance_id            = (known after apply)
      + instance_owner_id      = (known after apply)
      + network_interface_id   = (known after apply)
      + origin                 = (known after apply)
      + route_table_id         = (known after apply)
      + state                  = (known after apply)
    }

  # aws_route_table.this_rt will be created
  + resource "aws_route_table" "this_rt" {
      + arn              = (known after apply)
      + id               = (known after apply)
      + owner_id         = (known after apply)
      + propagating_vgws = (known after apply)
      + route            = (known after apply)
      + tags             = {
          + "Name" = "app-4-route-table"
        }
      + tags_all         = {
          + "Name"   = "app-4-route-table"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id           = (known after apply)
    }

  # aws_route_table_association.public[0] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_route_table_association.public[1] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_route_table_association.public[2] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_security_group.web_pub_sg will be created
  + resource "aws_security_group" "web_pub_sg" {
      + arn                    = (known after apply)
      + description            = "allow inbound traffic"
      + egress                 = [
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = ""
              + from_port        = 0
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "-1"
              + security_groups  = []
              + self             = false
              + to_port          = 0
            },
        ]
      + id                     = (known after apply)
      + ingress                = [
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = "from vpc"
              + from_port        = 0
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "-1"
              + security_groups  = []
              + self             = false
              + to_port          = 0
            },
        ]
      + name                   = "allow_inbound_access"
      + name_prefix            = (known after apply)
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + tags                   = {
          + "Name" = "app-4-ec2-sg"
        }
      + tags_all               = {
          + "Name"   = "app-4-ec2-sg"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                 = (known after apply)
    }

  # aws_service_discovery_http_namespace.namespace will be created
  + resource "aws_service_discovery_http_namespace" "namespace" {
      + arn         = (known after apply)
      + description = "The namespace for the ECS cluster. "
      + http_name   = (known after apply)
      + id          = (known after apply)
      + name        = "app-4"
      + tags_all    = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
    }

  # aws_subnet.public[0] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2a"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.0/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-1"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-1"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_subnet.public[1] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2b"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.32/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-2"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-2"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_subnet.public[2] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2c"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.64/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-3"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-3"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_vpc.this will be created
  + resource "aws_vpc" "this" {
      + arn                                  = (known after apply)
      + cidr_block                           = "11.90.30.0/25"
      + default_network_acl_id               = (known after apply)
      + default_route_table_id               = (known after apply)
      + default_security_group_id            = (known after apply)
      + dhcp_options_id                      = (known after apply)
      + enable_dns_hostnames                 = true
      + enable_dns_support                   = true
      + enable_network_address_usage_metrics = (known after apply)
      + id                                   = (known after apply)
      + instance_tenancy                     = "default"
      + ipv6_association_id                  = (known after apply)
      + ipv6_cidr_block                      = (known after apply)
      + ipv6_cidr_block_network_border_group = (known after apply)
      + main_route_table_id                  = (known after apply)
      + owner_id                             = (known after apply)
      + tags                                 = {
          + "Name" = "app-4"
        }
      + tags_all                             = {
          + "Name"   = "app-4"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
    }

Plan: 14 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: TFplan.JSON

To perform exactly these actions, run the following command to apply:
    terraform apply "TFplan.JSON"

Pushed by: @kunduso, Action: pull_request

Copy link

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform
data.aws_caller_identity.current: Reading...
data.aws_caller_identity.current: Read complete after 0s [id=743794601996]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_alb_listener.listener will be created
  + resource "aws_alb_listener" "listener" {
      + arn               = (known after apply)
      + id                = (known after apply)
      + load_balancer_arn = (known after apply)
      + port              = 8080
      + protocol          = "HTTP"
      + ssl_policy        = (known after apply)
      + tags_all          = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }

      + default_action {
          + order            = (known after apply)
          + target_group_arn = (known after apply)
          + type             = "forward"
        }
    }

  # aws_cloudwatch_log_group.logs will be created
  + resource "aws_cloudwatch_log_group" "logs" {
      + arn               = (known after apply)
      + id                = (known after apply)
      + kms_key_id        = (known after apply)
      + log_group_class   = (known after apply)
      + name              = "/amazon-ecs/app-4/log"
      + name_prefix       = (known after apply)
      + retention_in_days = 365
      + skip_destroy      = false
      + tags_all          = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
    }

  # aws_ecr_repository.image_repo will be created
  + resource "aws_ecr_repository" "image_repo" {
      + arn                  = (known after apply)
      + id                   = (known after apply)
      + image_tag_mutability = "IMMUTABLE"
      + name                 = "app-4"
      + registry_id          = (known after apply)
      + repository_url       = (known after apply)
      + tags_all             = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }

      + image_scanning_configuration {
          + scan_on_push = true
        }
    }

  # aws_ecs_cluster.app_cluster will be created
  + resource "aws_ecs_cluster" "app_cluster" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + name     = "app-4"
      + tags_all = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }

      + configuration {
          + execute_command_configuration {
              + logging = "OVERRIDE"
            }
        }

      + service_connect_defaults {
          + namespace = (known after apply)
        }

      + setting {
          + name  = "containerInsights"
          + value = "enabled"
        }
    }

  # aws_internet_gateway.this_igw will be created
  + resource "aws_internet_gateway" "this_igw" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + owner_id = (known after apply)
      + tags     = {
          + "Name" = "app-4-gateway"
        }
      + tags_all = {
          + "Name"   = "app-4-gateway"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id   = (known after apply)
    }

  # aws_kms_alias.key will be created
  + resource "aws_kms_alias" "key" {
      + arn            = (known after apply)
      + id             = (known after apply)
      + name           = "alias/app-4"
      + name_prefix    = (known after apply)
      + target_key_arn = (known after apply)
      + target_key_id  = (known after apply)
    }

  # aws_kms_key.key will be created
  + resource "aws_kms_key" "key" {
      + arn                                = (known after apply)
      + bypass_policy_lockout_safety_check = false
      + customer_master_key_spec           = "SYMMETRIC_DEFAULT"
      + deletion_window_in_days            = 7
      + description                        = "KMS key for app-4"
      + enable_key_rotation                = true
      + id                                 = (known after apply)
      + is_enabled                         = true
      + key_id                             = (known after apply)
      + key_usage                          = "ENCRYPT_DECRYPT"
      + multi_region                       = (known after apply)
      + policy                             = (known after apply)
      + tags_all                           = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
    }

  # aws_kms_key_policy.encrypt_app will be created
  + resource "aws_kms_key_policy" "encrypt_app" {
      + bypass_policy_lockout_safety_check = false
      + id                                 = (known after apply)
      + key_id                             = (known after apply)
      + policy                             = jsonencode(
            {
              + Id        = "encryption-rest"
              + Statement = [
                  + {
                      + Action    = "kms:*"
                      + Effect    = "Allow"
                      + Principal = {
                          + AWS = "arn:aws:iam::743794601996:root"
                        }
                      + Resource  = "*"
                      + Sid       = "Enable IAM User Permissions"
                    },
                  + {
                      + Action    = [
                          + "kms:Encrypt*",
                          + "kms:Decrypt*",
                          + "kms:ReEncrypt*",
                          + "kms:GenerateDataKey*",
                          + "kms:Describe*",
                        ]
                      + Condition = {
                          + ArnEquals = {
                              + "kms:EncryptionContext:aws:logs:arn" = [
                                  + "arn:aws:logs:us-east-2:743794601996:log-group:/amazon-ecs/app-4/log",
                                ]
                            }
                        }
                      + Effect    = "Allow"
                      + Principal = {
                          + Service = "logs.us-east-2.amazonaws.com"
                        }
                      + Resource  = "*"
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
    }

  # aws_lb.app_lb will be created
  + resource "aws_lb" "app_lb" {
      + arn                                                          = (known after apply)
      + arn_suffix                                                   = (known after apply)
      + desync_mitigation_mode                                       = "defensive"
      + dns_name                                                     = (known after apply)
      + drop_invalid_header_fields                                   = false
      + enable_deletion_protection                                   = false
      + enable_http2                                                 = true
      + enable_tls_version_and_cipher_suite_headers                  = false
      + enable_waf_fail_open                                         = false
      + enable_xff_client_port                                       = false
      + enforce_security_group_inbound_rules_on_private_link_traffic = (known after apply)
      + id                                                           = (known after apply)
      + idle_timeout                                                 = 60
      + internal                                                     = false
      + ip_address_type                                              = (known after apply)
      + load_balancer_type                                           = "application"
      + name                                                         = "app-4"
      + name_prefix                                                  = (known after apply)
      + preserve_host_header                                         = false
      + security_groups                                              = (known after apply)
      + subnets                                                      = (known after apply)
      + tags_all                                                     = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                                       = (known after apply)
      + xff_header_processing_mode                                   = "append"
      + zone_id                                                      = (known after apply)
    }

  # aws_lb_target_group.target_group will be created
  + resource "aws_lb_target_group" "target_group" {
      + arn                                = (known after apply)
      + arn_suffix                         = (known after apply)
      + connection_termination             = (known after apply)
      + deregistration_delay               = "300"
      + id                                 = (known after apply)
      + ip_address_type                    = (known after apply)
      + lambda_multi_value_headers_enabled = false
      + load_balancer_arns                 = (known after apply)
      + load_balancing_algorithm_type      = (known after apply)
      + load_balancing_anomaly_mitigation  = (known after apply)
      + load_balancing_cross_zone_enabled  = (known after apply)
      + name                               = "app-4"
      + name_prefix                        = (known after apply)
      + port                               = 8080
      + preserve_client_ip                 = (known after apply)
      + protocol                           = "HTTP"
      + protocol_version                   = (known after apply)
      + proxy_protocol_v2                  = false
      + slow_start                         = 0
      + tags_all                           = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + target_type                        = "ip"
      + vpc_id                             = (known after apply)

      + health_check {
          + enabled             = true
          + healthy_threshold   = 3
          + interval            = 30
          + matcher             = "200,301,302,404"
          + path                = "/"
          + port                = "traffic-port"
          + protocol            = "HTTP"
          + timeout             = (known after apply)
          + unhealthy_threshold = 3
        }
    }

  # aws_route.internet_route will be created
  + resource "aws_route" "internet_route" {
      + destination_cidr_block = "0.0.0.0/0"
      + gateway_id             = (known after apply)
      + id                     = (known after apply)
      + instance_id            = (known after apply)
      + instance_owner_id      = (known after apply)
      + network_interface_id   = (known after apply)
      + origin                 = (known after apply)
      + route_table_id         = (known after apply)
      + state                  = (known after apply)
    }

  # aws_route_table.this_rt will be created
  + resource "aws_route_table" "this_rt" {
      + arn              = (known after apply)
      + id               = (known after apply)
      + owner_id         = (known after apply)
      + propagating_vgws = (known after apply)
      + route            = (known after apply)
      + tags             = {
          + "Name" = "app-4-route-table"
        }
      + tags_all         = {
          + "Name"   = "app-4-route-table"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id           = (known after apply)
    }

  # aws_route_table_association.public[0] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_route_table_association.public[1] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_route_table_association.public[2] will be created
  + resource "aws_route_table_association" "public" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # aws_security_group.web_pub_sg will be created
  + resource "aws_security_group" "web_pub_sg" {
      + arn                    = (known after apply)
      + description            = "allow inbound traffic"
      + egress                 = [
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = ""
              + from_port        = 0
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "-1"
              + security_groups  = []
              + self             = false
              + to_port          = 0
            },
        ]
      + id                     = (known after apply)
      + ingress                = [
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = "from vpc"
              + from_port        = 0
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "-1"
              + security_groups  = []
              + self             = false
              + to_port          = 0
            },
        ]
      + name                   = "allow_inbound_access"
      + name_prefix            = (known after apply)
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + tags                   = {
          + "Name" = "app-4-ec2-sg"
        }
      + tags_all               = {
          + "Name"   = "app-4-ec2-sg"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                 = (known after apply)
    }

  # aws_service_discovery_http_namespace.namespace will be created
  + resource "aws_service_discovery_http_namespace" "namespace" {
      + arn         = (known after apply)
      + description = "The namespace for the ECS cluster. "
      + http_name   = (known after apply)
      + id          = (known after apply)
      + name        = "app-4"
      + tags_all    = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
    }

  # aws_subnet.public[0] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2a"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.0/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-1"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-1"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_subnet.public[1] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2b"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.32/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-2"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-2"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_subnet.public[2] will be created
  + resource "aws_subnet" "public" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2c"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "11.90.30.64/27"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = false
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "app-4-public-3"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-public-3"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_vpc.this will be created
  + resource "aws_vpc" "this" {
      + arn                                  = (known after apply)
      + cidr_block                           = "11.90.30.0/25"
      + default_network_acl_id               = (known after apply)
      + default_route_table_id               = (known after apply)
      + default_security_group_id            = (known after apply)
      + dhcp_options_id                      = (known after apply)
      + enable_dns_hostnames                 = true
      + enable_dns_support                   = true
      + enable_network_address_usage_metrics = (known after apply)
      + id                                   = (known after apply)
      + instance_tenancy                     = "default"
      + ipv6_association_id                  = (known after apply)
      + ipv6_cidr_block                      = (known after apply)
      + ipv6_cidr_block_network_border_group = (known after apply)
      + main_route_table_id                  = (known after apply)
      + owner_id                             = (known after apply)
      + tags                                 = {
          + "Name" = "app-4"
        }
      + tags_all                             = {
          + "Name"   = "app-4"
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }
    }

Plan: 21 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: TFplan.JSON

To perform exactly these actions, run the following command to apply:
    terraform apply "TFplan.JSON"

Pushed by: @kunduso, Action: pull_request

@kunduso kunduso merged commit 2c9b8a6 into main Mar 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add underlying AWS Cloud infrastructure to host the Amazon ECS service Add pipeline Add scaffolding code
1 participant