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 network #4

Merged
merged 5 commits into from
Oct 14, 2023
Merged

Add network #4

merged 5 commits into from
Oct 14, 2023

Conversation

kunduso
Copy link
Owner

@kunduso kunduso commented Oct 14, 2023

this pr closes #2

@kunduso kunduso self-assigned this Oct 14, 2023
Comment on lines +2 to +12
resource "aws_vpc" "this" {
cidr_block = var.vpc_cidr
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc#enable_dns_support
enable_dns_support = true
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc#enable_dns_hostnames
enable_dns_hostnames = true
#checkov:skip=CKV2_AWS_11: Not creating a flow log for this VPC
tags = {
"Name" = "app-4"
}
}

Check warning

Code scanning / checkov

Ensure VPC flow logging is enabled in all VPCs Warning

Ensure VPC flow logging is enabled in all VPCs
Comment on lines +68 to +72
resource "aws_eip" "nat_gateway" {
count = length(var.subnet_cidr_public)
domain = "vpc"
#checkov:skip=CKV2_AWS_19: The IP is attached to the NAT gateway
}

Check warning

Code scanning / checkov

Ensure that all EIP addresses allocated to a VPC are attached to EC2 instances Warning

Ensure that all EIP addresses allocated to a VPC are attached to EC2 instances
@kunduso kunduso temporarily deployed to production October 14, 2023 01:42 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

💰 Infracost estimate: monthly cost will increase by $33 📈

Project Cost change New monthly cost
kunduso/amazon-elasticache-redis-tf/TFplan.JSON +$33 $33
Infracost output
──────────────────────────────────
Project: kunduso/amazon-elasticache-redis-tf/TFplan.JSON

+ aws_nat_gateway.public[0]
  +$33

    + NAT gateway
      +$33

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

Monthly cost change for kunduso/amazon-elasticache-redis-tf/TFplan.JSON
Amount:  +$33 ($0.00 → $33)

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

19 cloud resources were detected:
∙ 1 was estimated, it includes usage-based costs, see https://infracost.io/usage-file
∙ 18 were free:
  ∙ 4 x aws_route_table
  ∙ 4 x aws_route_table_association
  ∙ 4 x aws_subnet
  ∙ 2 x aws_route
  ∙ 1 x aws_default_security_group
  ∙ 1 x aws_eip
  ∙ 1 x aws_internet_gateway
  ∙ 1 x aws_vpc

Infracost estimate: monthly cost will increase by $33 ↑
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ Project                                            ┃ Cost change ┃ New monthly cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━┫
┃ kunduso/amazon-elasticache-redis-tf/TFplan.JSON    ┃        +$33 ┃ $33              ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━┛
This comment will be updated when the cost estimate changes.

@github-actions
Copy link
Contributor

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖failure

Terraform Validation 🤖success

Show Plan

terraform
data.aws_availability_zones.available: Reading...
data.aws_availability_zones.available: Read complete after 1s [id=us-east-2]

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

Terraform planned the following actions, but then encountered a problem:

  # aws_default_security_group.default will be created
  + resource "aws_default_security_group" "default" {
      + arn                    = (known after apply)
      + description            = (known after apply)
      + egress                 = (known after apply)
      + id                     = (known after apply)
      + ingress                = (known after apply)
      + name                   = (known after apply)
      + name_prefix            = (known after apply)
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + tags_all               = {
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc_id                 = (known after apply)
    }

  # aws_eip.nat_gateway[0] will be created
  + resource "aws_eip" "nat_gateway" {
      + allocation_id        = (known after apply)
      + association_id       = (known after apply)
      + carrier_ip           = (known after apply)
      + customer_owned_ip    = (known after apply)
      + domain               = "vpc"
      + id                   = (known after apply)
      + instance             = (known after apply)
      + network_border_group = (known after apply)
      + network_interface    = (known after apply)
      + private_dns          = (known after apply)
      + private_ip           = (known after apply)
      + public_dns           = (known after apply)
      + public_ip            = (known after apply)
      + public_ipv4_pool     = (known after apply)
      + tags_all             = {
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc                  = (known after apply)
    }

  # 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-asg-elb-terraform"
        }
      + vpc_id   = (known after apply)
    }

  # aws_nat_gateway.public[0] will be created
  + resource "aws_nat_gateway" "public" {
      + allocation_id                      = (known after apply)
      + association_id                     = (known after apply)
      + connectivity_type                  = "public"
      + id                                 = (known after apply)
      + network_interface_id               = (known after apply)
      + private_ip                         = (known after apply)
      + public_ip                          = (known after apply)
      + secondary_private_ip_address_count = (known after apply)
      + secondary_private_ip_addresses     = (known after apply)
      + subnet_id                          = (known after apply)
      + tags                               = {
          + "Name" = "app-4-NAT-1"
        }
      + tags_all                           = {
          + "Name"   = "app-4-NAT-1"
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
    }

  # 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.private-route[0] will be created
  + resource "aws_route" "private-route" {
      + destination_cidr_block = "0.0.0.0/0"
      + id                     = (known after apply)
      + instance_id            = (known after apply)
      + instance_owner_id      = (known after apply)
      + nat_gateway_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.private[0] will be created
  + resource "aws_route_table" "private" {
      + 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-private-route-table-1"
        }
      + tags_all         = {
          + "Name"   = "app-4-private-route-table-1"
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc_id           = (known after apply)
    }

  # aws_route_table.private[1] will be created
  + resource "aws_route_table" "private" {
      + 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-private-route-table-2"
        }
      + tags_all         = {
          + "Name"   = "app-4-private-route-table-2"
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc_id           = (known after apply)
    }

  # aws_route_table.private[2] will be created
  + resource "aws_route_table" "private" {
      + 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-private-route-table-3"
        }
      + tags_all         = {
          + "Name"   = "app-4-private-route-table-3"
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc_id           = (known after apply)
    }

  # aws_route_table.public will be created
  + resource "aws_route_table" "public" {
      + 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-public"
        }
      + tags_all         = {
          + "Name"   = "app-4-public"
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc_id           = (known after apply)
    }

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

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

  # aws_route_table_association.private[2] will be created
  + resource "aws_route_table_association" "private" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_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_subnet.private[0] will be created
  + resource "aws_subnet" "private" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2a"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "10.20.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-private-1"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-private-1"
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_subnet.private[1] will be created
  + resource "aws_subnet" "private" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2b"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "10.20.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-private-2"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-private-2"
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_subnet.private[2] will be created
  + resource "aws_subnet" "private" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = "us-east-2c"
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "10.20.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-private-3"
        }
      + tags_all                                       = {
          + "Name"   = "app-4-private-3"
          + "Source" = "https://github.com/kunduso/add-asg-elb-terraform"
        }
      + vpc_id                                         = (known after apply)
    }

  # 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                                     = "10.20.30.96/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-asg-elb-terraform"
        }
      + vpc_id                                         = (known after apply)
    }

  # aws_vpc.this will be created
  + resource "aws_vpc" "this" {
      + arn                                  = (known after apply)
      + cidr_block                           = "10.20.32.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-asg-elb-terraform"
        }
    }

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

Pushed by: @kunduso, Action: pull_request

@kunduso kunduso merged commit ec9f5b3 into main Oct 14, 2023
5 checks passed
@kunduso kunduso deleted the add-network branch October 14, 2023 01:44
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 network and security groups
1 participant