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

feat: add config to vpc.tf #42

Merged
merged 1 commit into from
Dec 16, 2024
Merged

feat: add config to vpc.tf #42

merged 1 commit into from
Dec 16, 2024

Conversation

DrInTech22
Copy link
Owner

No description provided.

@DrInTech22 DrInTech22 merged commit a1f2d80 into infra_main Dec 16, 2024
2 checks passed
Copy link

💰 Infracost report

This pull request is aligned with your company's FinOps policies and the Well-Architected Framework.

This comment will be updated when code changes.

Copy link

Terraform Plan 📖success

Show Plan
[command]/home/runner/work/_temp/79648dc5-94fe-4ac0-9315-c6a1324626ae/terraform-bin show -no-color tfplan.out

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # aws_instance.ec2 will be created
  + resource "aws_instance" "ec2" {
      + ami                                  = "ami-005fc0f236362e99f"
      + arn                                  = (known after apply)
      + associate_public_ip_address          = (known after apply)
      + availability_zone                    = "us-east-1a"
      + cpu_core_count                       = (known after apply)
      + cpu_threads_per_core                 = (known after apply)
      + disable_api_stop                     = (known after apply)
      + disable_api_termination              = (known after apply)
      + ebs_optimized                        = (known after apply)
      + enable_primary_ipv6                  = (known after apply)
      + get_password_data                    = false
      + host_id                              = (known after apply)
      + host_resource_group_arn              = (known after apply)
      + iam_instance_profile                 = (known after apply)
      + id                                   = (known after apply)
      + instance_initiated_shutdown_behavior = (known after apply)
      + instance_lifecycle                   = (known after apply)
      + instance_state                       = (known after apply)
      + instance_type                        = "t2.large"
      + ipv6_address_count                   = (known after apply)
      + ipv6_addresses                       = (known after apply)
      + key_name                             = "hello"
      + monitoring                           = (known after apply)
      + outpost_arn                          = (known after apply)
      + password_data                        = (known after apply)
      + placement_group                      = (known after apply)
      + placement_partition_number           = (known after apply)
      + primary_network_interface_id         = (known after apply)
      + private_dns                          = (known after apply)
      + private_ip                           = (known after apply)
      + public_dns                           = (known after apply)
      + public_ip                            = (known after apply)
      + secondary_private_ips                = (known after apply)
      + security_groups                      = (known after apply)
      + source_dest_check                    = true
      + spot_instance_request_id             = (known after apply)
      + subnet_id                            = (known after apply)
      + tags                                 = {
          + "Name" = "MainEC2Instance"
        }
      + tags_all                             = {
          + "Name" = "MainEC2Instance"
        }
      + tenancy                              = (known after apply)
      + user_data                            = (known after apply)
      + user_data_base64                     = (known after apply)
      + user_data_replace_on_change          = false
      + vpc_security_group_ids               = [
          + "sg-0f6e0721e5bf1ec6d",
        ]

      + capacity_reservation_specification (known after apply)

      + cpu_options (known after apply)

      + ebs_block_device (known after apply)

      + enclave_options (known after apply)

      + ephemeral_block_device (known after apply)

      + instance_market_options (known after apply)

      + maintenance_options (known after apply)

      + metadata_options (known after apply)

      + network_interface (known after apply)

      + private_dns_name_options (known after apply)

      + root_block_device {
          + delete_on_termination = true
          + device_name           = (known after apply)
          + encrypted             = (known after apply)
          + iops                  = (known after apply)
          + kms_key_id            = (known after apply)
          + tags_all              = (known after apply)
          + throughput            = (known after apply)
          + volume_id             = (known after apply)
          + volume_size           = 20
          + volume_type           = (known after apply)
        }
    }

  # aws_route53_record.db_record will be created
  + resource "aws_route53_record" "db_record" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "db.test.drintech.online"
      + records         = (known after apply)
      + ttl             = 300
      + type            = "A"
      + zone_id         = "Z01212662RD8CEFOSDUAM"
    }

  # aws_route53_record.frontend_record will be created
  + resource "aws_route53_record" "frontend_record" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "test.drintech.online"
      + records         = (known after apply)
      + ttl             = 300
      + type            = "A"
      + zone_id         = "Z01212662RD8CEFOSDUAM"
    }

  # aws_route53_record.traefik_record will be created
  + resource "aws_route53_record" "traefik_record" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "traefik.test.drintech.online"
      + records         = (known after apply)
      + ttl             = 300
      + type            = "A"
      + zone_id         = "Z01212662RD8CEFOSDUAM"
    }

  # aws_route53_record.www_db_record will be created
  + resource "aws_route53_record" "www_db_record" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "www.db.test.drintech.online"
      + records         = (known after apply)
      + ttl             = 300
      + type            = "A"
      + zone_id         = "Z01212662RD8CEFOSDUAM"
    }

  # aws_route53_record.www_frontend_record will be created
  + resource "aws_route53_record" "www_frontend_record" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "www.test.drintech.online"
      + records         = (known after apply)
      + ttl             = 300
      + type            = "A"
      + zone_id         = "Z01212662RD8CEFOSDUAM"
    }

  # aws_route53_record.www_traefik_record will be created
  + resource "aws_route53_record" "www_traefik_record" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "www.traefik.test.drintech.online"
      + records         = (known after apply)
      + ttl             = 300
      + type            = "A"
      + zone_id         = "Z01212662RD8CEFOSDUAM"
    }

  # aws_route_table_association.rt_association must be replaced
-/+ resource "aws_route_table_association" "rt_association" {
      ~ id             = "rtbassoc-0472a878ae0938254" -> (known after apply)
      ~ subnet_id      = "subnet-06ccd8fdc6e1db696" -> (known after apply) # forces replacement
        # (2 unchanged attributes hidden)
    }

  # aws_subnet.public_subnet must be replaced
-/+ resource "aws_subnet" "public_subnet" {
      ~ arn                                            = "arn:aws:ec2:us-east-1:447490812643:subnet/subnet-06ccd8fdc6e1db696" -> (known after apply)
      ~ availability_zone                              = "us-east-1f" -> "us-east-1a" # forces replacement
      ~ availability_zone_id                           = "use1-az5" -> (known after apply)
      - enable_lni_at_device_index                     = 0 -> null
      ~ id                                             = "subnet-06ccd8fdc6e1db696" -> (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      - map_customer_owned_ip_on_launch                = false -> null
      ~ owner_id                                       = "447490812643" -> (known after apply)
      ~ private_dns_hostname_type_on_launch            = "ip-name" -> (known after apply)
        tags                                           = {
            "Name" = "MainSubnet"
        }
        # (12 unchanged attributes hidden)
    }

  # local_file.ansible_inventory will be created
  + resource "local_file" "ansible_inventory" {
      + content              = (known after apply)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0777"
      + file_permission      = "0777"
      + filename             = "inventory.ini"
      + id                   = (known after apply)
    }

Plan: 10 to add, 0 to change, 2 to destroy.

Changes to Outputs:
  + instance_public_ip = (known after apply)
::debug::Terraform exited with code 0.
::debug::stdout: %0ATerraform used the selected providers to generate the following execution%0Aplan. Resource actions are indicated with the following symbols:%0A  + create%0A-/+ destroy and then create replacement%0A%0ATerraform will perform the following actions:%0A%0A  # aws_instance.ec2 will be created%0A  + resource "aws_instance" "ec2" {%0A      + ami                                  = "ami-005fc0f236362e99f"%0A      + arn                                  = (known after apply)%0A      + associate_public_ip_address          = (known after apply)%0A      + availability_zone                    = "us-east-1a"%0A      + cpu_core_count                       = (known after apply)%0A      + cpu_threads_per_core                 = (known after apply)%0A      + disable_api_stop                     = (known after apply)%0A      + disable_api_termination              = (known after apply)%0A      + ebs_optimized                        = (known after apply)%0A      + enable_primary_ipv6                  = (known after apply)%0A      + get_password_data                    = false%0A      + host_id                              = (known after apply)%0A      + host_resource_group_arn              = (known after apply)%0A      + iam_instance_profile                 = (known after apply)%0A      + id                                   = (known after apply)%0A      + instance_initiated_shutdown_behavior = (known after apply)%0A      + instance_lifecycle                   = (known after apply)%0A      + instance_state                       = (known after apply)%0A      + instance_type                        = "t2.large"%0A      + ipv6_address_count                   = (known after apply)%0A      + ipv6_addresses                       = (known after apply)%0A      + key_name                             = "hello"%0A      + monitoring                           = (known after apply)%0A      + outpost_arn                          = (known after apply)%0A      + password_data                        = (known after apply)%0A      + placement_group                      = (known after apply)%0A      + placement_partition_number           = (known after apply)%0A      + primary_network_interface_id         = (known after apply)%0A      + private_dns                          = (known after apply)%0A      + private_ip                           = (known after apply)%0A      + public_dns                           = (known after apply)%0A      + public_ip                            = (known after apply)%0A      + secondary_private_ips                = (known after apply)%0A      + security_groups                      = (known after apply)%0A      + source_dest_check                    = true%0A      + spot_instance_request_id             = (known after apply)%0A      + subnet_id                            = (known after apply)%0A      + tags                                 = {%0A          + "Name" = "MainEC2Instance"%0A        }%0A      + tags_all                             = {%0A          + "Name" = "MainEC2Instance"%0A        }%0A      + tenancy                              = (known after apply)%0A      + user_data                            = (known after apply)%0A      + user_data_base64                     = (known after apply)%0A      + user_data_replace_on_change          = false%0A      + vpc_security_group_ids               = [%0A          + "sg-0f6e0721e5bf1ec6d",%0A        ]%0A%0A      + capacity_reservation_specification (known after apply)%0A%0A      + cpu_options (known after apply)%0A%0A      + ebs_block_device (known after apply)%0A%0A      + enclave_options (known after apply)%0A%0A      + ephemeral_block_device (known after apply)%0A%0A      + instance_market_options (known after apply)%0A%0A      + maintenance_options (known after apply)%0A%0A      + metadata_options (known after apply)%0A%0A      + network_interface (known after apply)%0A%0A      + private_dns_name_options (known after apply)%0A%0A      + root_block_device {%0A          + delete_on_termination = true%0A          + device_name           = (known after apply)%0A          + encrypted             = (known after apply)%0A          + iops                  = (known after apply)%0A          + kms_key_id            = (known after apply)%0A          + tags_all              = (known after apply)%0A          + throughput            = (known after apply)%0A          + volume_id             = (known after apply)%0A          + volume_size           = 20%0A          + volume_type           = (known after apply)%0A        }%0A    }%0A%0A  # aws_route53_record.db_record will be created%0A  + resource "aws_route53_record" "db_record" {%0A      + allow_overwrite = (known after apply)%0A      + fqdn            = (known after apply)%0A      + id              = (known after apply)%0A      + name            = "db.test.drintech.online"%0A      + records         = (known after apply)%0A      + ttl             = 300%0A      + type            = "A"%0A      + zone_id         = "Z01212662RD8CEFOSDUAM"%0A    }%0A%0A  # aws_route53_record.frontend_record will be created%0A  + resource "aws_route53_record" "frontend_record" {%0A      + allow_overwrite = (known after apply)%0A      + fqdn            = (known after apply)%0A      + id              = (known after apply)%0A      + name            = "test.drintech.online"%0A      + records         = (known after apply)%0A      + ttl             = 300%0A      + type            = "A"%0A      + zone_id         = "Z01212662RD8CEFOSDUAM"%0A    }%0A%0A  # aws_route53_record.traefik_record will be created%0A  + resource "aws_route53_record" "traefik_record" {%0A      + allow_overwrite = (known after apply)%0A      + fqdn            = (known after apply)%0A      + id              = (known after apply)%0A      + name            = "traefik.test.drintech.online"%0A      + records         = (known after apply)%0A      + ttl             = 300%0A      + type            = "A"%0A      + zone_id         = "Z01212662RD8CEFOSDUAM"%0A    }%0A%0A  # aws_route53_record.www_db_record will be created%0A  + resource "aws_route53_record" "www_db_record" {%0A      + allow_overwrite = (known after apply)%0A      + fqdn            = (known after apply)%0A      + id              = (known after apply)%0A      + name            = "www.db.test.drintech.online"%0A      + records         = (known after apply)%0A      + ttl             = 300%0A      + type            = "A"%0A      + zone_id         = "Z01212662RD8CEFOSDUAM"%0A    }%0A%0A  # aws_route53_record.www_frontend_record will be created%0A  + resource "aws_route53_record" "www_frontend_record" {%0A      + allow_overwrite = (known after apply)%0A      + fqdn            = (known after apply)%0A      + id              = (known after apply)%0A      + name            = "www.test.drintech.online"%0A      + records         = (known after apply)%0A      + ttl             = 300%0A      + type            = "A"%0A      + zone_id         = "Z01212662RD8CEFOSDUAM"%0A    }%0A%0A  # aws_route53_record.www_traefik_record will be created%0A  + resource "aws_route53_record" "www_traefik_record" {%0A      + allow_overwrite = (known after apply)%0A      + fqdn            = (known after apply)%0A      + id              = (known after apply)%0A      + name            = "www.traefik.test.drintech.online"%0A      + records         = (known after apply)%0A      + ttl             = 300%0A      + type            = "A"%0A      + zone_id         = "Z01212662RD8CEFOSDUAM"%0A    }%0A%0A  # aws_route_table_association.rt_association must be replaced%0A-/+ resource "aws_route_table_association" "rt_association" {%0A      ~ id             = "rtbassoc-0472a878ae0938254" -> (known after apply)%0A      ~ subnet_id      = "subnet-06ccd8fdc6e1db696" -> (known after apply) # forces replacement%0A        # (2 unchanged attributes hidden)%0A    }%0A%0A  # aws_subnet.public_subnet must be replaced%0A-/+ resource "aws_subnet" "public_subnet" {%0A      ~ arn                                            = "arn:aws:ec2:us-east-1:447490812643:subnet/subnet-06ccd8fdc6e1db696" -> (known after apply)%0A      ~ availability_zone                              = "us-east-1f" -> "us-east-1a" # forces replacement%0A      ~ availability_zone_id                           = "use1-az5" -> (known after apply)%0A      - enable_lni_at_device_index                     = 0 -> null%0A      ~ id                                             = "subnet-06ccd8fdc6e1db696" -> (known after apply)%0A      + ipv6_cidr_block_association_id                 = (known after apply)%0A      - map_customer_owned_ip_on_launch                = false -> null%0A      ~ owner_id                                       = "447490812643" -> (known after apply)%0A      ~ private_dns_hostname_type_on_launch            = "ip-name" -> (known after apply)%0A        tags                                           = {%0A            "Name" = "MainSubnet"%0A        }%0A        # (12 unchanged attributes hidden)%0A    }%0A%0A  # local_file.ansible_inventory will be created%0A  + resource "local_file" "ansible_inventory" {%0A      + content              = (known after apply)%0A      + content_base64sha256 = (known after apply)%0A      + content_base64sha512 = (known after apply)%0A      + content_md5          = (known after apply)%0A      + content_sha1         = (known after apply)%0A      + content_sha256       = (known after apply)%0A      + content_sha512       = (known after apply)%0A      + directory_permission = "0777"%0A      + file_permission      = "0777"%0A      + filename             = "inventory.ini"%0A      + id                   = (known after apply)%0A    }%0A%0APlan: 10 to add, 0 to change, 2 to destroy.%0A%0AChanges to Outputs:%0A  + instance_public_ip = (known after apply)%0A
::debug::stderr: 
::debug::exitcode: 0

New Infracost Breakdown 💰

Show Breakdown
Project: main

 Name                                                      Monthly Qty  Unit                  Monthly Cost   
                                                                                                             
 aws_instance.ec2                                                                                            
 ├─ Instance usage (Linux/UNIX, on-demand, t2.large)               730  hours                       $67.74   
 └─ root_block_device                                                                                        
    └─ Storage (general purpose SSD, gp2)                           20  GB                           $2.00   
                                                                                                             
 aws_route53_record.db_record                                                                                
 ├─ Standard queries (first 1B)                       Monthly cost depends on usage: $0.40 per 1M queries    
 ├─ Latency based routing queries (first 1B)          Monthly cost depends on usage: $0.60 per 1M queries    
 └─ Geo DNS queries (first 1B)                        Monthly cost depends on usage: $0.70 per 1M queries    
                                                                                                             
 aws_route53_record.frontend_record                                                                          
 ├─ Standard queries (first 1B)                       Monthly cost depends on usage: $0.40 per 1M queries    
 ├─ Latency based routing queries (first 1B)          Monthly cost depends on usage: $0.60 per 1M queries    
 └─ Geo DNS queries (first 1B)                        Monthly cost depends on usage: $0.70 per 1M queries    
                                                                                                             
 aws_route53_record.traefik_record                                                                           
 ├─ Standard queries (first 1B)                       Monthly cost depends on usage: $0.40 per 1M queries    
 ├─ Latency based routing queries (first 1B)          Monthly cost depends on usage: $0.60 per 1M queries    
 └─ Geo DNS queries (first 1B)                        Monthly cost depends on usage: $0.70 per 1M queries    
                                                                                                             
 aws_route53_record.www_db_record                                                                            
 ├─ Standard queries (first 1B)                       Monthly cost depends on usage: $0.40 per 1M queries    
 ├─ Latency based routing queries (first 1B)          Monthly cost depends on usage: $0.60 per 1M queries    
 └─ Geo DNS queries (first 1B)                        Monthly cost depends on usage: $0.70 per 1M queries    
                                                                                                             
 aws_route53_record.www_frontend_record                                                                      
 ├─ Standard queries (first 1B)                       Monthly cost depends on usage: $0.40 per 1M queries    
 ├─ Latency based routing queries (first 1B)          Monthly cost depends on usage: $0.60 per 1M queries    
 └─ Geo DNS queries (first 1B)                        Monthly cost depends on usage: $0.70 per 1M queries    
                                                                                                             
 aws_route53_record.www_traefik_record                                                                       
 ├─ Standard queries (first 1B)                       Monthly cost depends on usage: $0.40 per 1M queries    
 ├─ Latency based routing queries (first 1B)          Monthly cost depends on usage: $0.60 per 1M queries    
 └─ Geo DNS queries (first 1B)                        Monthly cost depends on usage: $0.70 per 1M queries    
                                                                                                             
 OVERALL TOTAL                                                                                     $69.74 

*Usage costs can be estimated by updating Infracost Cloud settings, see docs for other options.

──────────────────────────────────
13 cloud resources were detected:
∙ 7 were estimated
∙ 6 were free

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Project                                            ┃ Baseline cost ┃ Usage cost* ┃ Total cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━┫
┃ main                                               ┃           $70 ┃           - ┃        $70 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━┛

Pushed by: @DrInTech22, Action: pull_request

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.

1 participant