Managing Applications and Infrastructure with Terraform-Deploying Infrastructure with Terraform-(2)Terraform for AWS-(8)Networking Part 3: The Root Module

2018年10月04日


Managing Applications and Infrastructure with Terraform-Deploying Infrastructure with Terraform
2. Terraform for AWS
8. Networking Part 3: The Root Module

Edit the main.tf file.

provider "aws" {
    region = var.aws_region
}

# Deploy Storage Resource
module "storage" {
    source = "./storage"
    project_name = var.project_name
}

# Deploy Networking Resources
module "networking" {
    source = "./networking"
    vpc_cidr = var.vpc_cidr
    public_cidrs = var.public_cidrs
    accessip = var.accessip
}

Edit the variables.tf file.
variable "aws_region" {}
variable "project_name" {}
variable "vpc_cidr" {}
variable "public_cidrs" {
    type = list
}
variable "accessip" {}

Edit networking/variables.tf file.
#---networking/variables.tf

variable "vpc_cidr" {}

variable "public_cidrs" {
    type = list
}

variable "accessip" {}

Edit the terraform.tfvars file.
aws_region = "us-west-2"
project_name = "la-terrafrom"
vpc_cidr = "10.123.0.0/16"
public_cidrs = [
    "10.123.1.0/24",
    "10.123.2.0/24"
    ]
accessip = "0.0.0.0/0"

ec2-user:~/environment/AWS/networking $ cd ..

ec2-user:~/environment/AWS $ terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Using previously-installed hashicorp/aws v3.9.0
- Using previously-installed hashicorp/random v3.0.0

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.

* hashicorp/aws: version = "~> 3.9.0"
* hashicorp/random: version = "~> 3.0.0"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

ec2-user:~/environment/AWS $ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

module.storage.random_id.tf_bucket_id: Refreshing state... [id=RlA]
module.networking.data.aws_availability_zones.available: Refreshing state...
module.storage.aws_s3_bucket.tf_code: Refreshing state... [id=la-terrafrom-18000]

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.networking.aws_default_route_table.tf_private_rt will be created
  + resource "aws_default_route_table" "tf_private_rt" {
      + default_route_table_id = (known after apply)
      + id                     = (known after apply)
      + owner_id               = (known after apply)
      + route                  = (known after apply)
      + tags                   = {
          + "Name" = "tf_private"
        }
      + vpc_id                 = (known after apply)
    }

  # module.networking.aws_internet_gateway.tf_internet_gateway will be created
  + resource "aws_internet_gateway" "tf_internet_gateway" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + owner_id = (known after apply)
      + tags     = {
          + "Name" = "tf_igw"
        }
      + vpc_id   = (known after apply)
    }

  # module.networking.aws_route_table.tf_public_rt will be created
  + resource "aws_route_table" "tf_public_rt" {
      + id               = (known after apply)
      + owner_id         = (known after apply)
      + propagating_vgws = (known after apply)
      + route            = [
          + {
              + cidr_block                = "0.0.0.0/0"
              + egress_only_gateway_id    = ""
              + gateway_id                = (known after apply)
              + instance_id               = ""
              + ipv6_cidr_block           = ""
              + local_gateway_id          = ""
              + nat_gateway_id            = ""
              + network_interface_id      = ""
              + transit_gateway_id        = ""
              + vpc_peering_connection_id = ""
            },
        ]
      + tags             = {
          + "Name" = "tf_public"
        }
      + vpc_id           = (known after apply)
    }

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

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

  # module.networking.aws_security_group.tf_public_sg will be created
  + resource "aws_security_group" "tf_public_sg" {
      + arn                    = (known after apply)
      + description            = "Used for access to the public instances"
      + 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_port        = 22
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "tcp"
              + security_groups  = []
              + self             = false
              + to_port          = 22
            },
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = ""
              + from_port        = 80
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "tcp"
              + security_groups  = []
              + self             = false
              + to_port          = 80
            },
        ]
      + name                   = "tf_public_sg"
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + vpc_id                 = (known after apply)
    }

  # module.networking.aws_subnet.tf_public_subnet[0] will be created
  + resource "aws_subnet" "tf_public_subnet" {
      + arn                             = (known after apply)
      + assign_ipv6_address_on_creation = false
      + availability_zone               = "us-west-2a"
      + availability_zone_id            = (known after apply)
      + cidr_block                      = "10.123.1.0/24"
      + id                              = (known after apply)
      + ipv6_cidr_block_association_id  = (known after apply)
      + map_public_ip_on_launch         = true
      + owner_id                        = (known after apply)
      + tags                            = {
          + "Name" = "tf_public_1"
        }
      + vpc_id                          = (known after apply)
    }

  # module.networking.aws_subnet.tf_public_subnet[1] will be created
  + resource "aws_subnet" "tf_public_subnet" {
      + arn                             = (known after apply)
      + assign_ipv6_address_on_creation = false
      + availability_zone               = "us-west-2b"
      + availability_zone_id            = (known after apply)
      + cidr_block                      = "10.123.2.0/24"
      + id                              = (known after apply)
      + ipv6_cidr_block_association_id  = (known after apply)
      + map_public_ip_on_launch         = true
      + owner_id                        = (known after apply)
      + tags                            = {
          + "Name" = "tf_public_2"
        }
      + vpc_id                          = (known after apply)
    }

  # module.networking.aws_vpc.tf_vpc will be created
  + resource "aws_vpc" "tf_vpc" {
      + arn                              = (known after apply)
      + assign_generated_ipv6_cidr_block = false
      + cidr_block                       = "10.123.0.0/16"
      + 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_classiclink               = (known after apply)
      + enable_classiclink_dns_support   = (known after apply)
      + enable_dns_hostnames             = true
      + enable_dns_support               = true
      + id                               = (known after apply)
      + instance_tenancy                 = "default"
      + ipv6_association_id              = (known after apply)
      + ipv6_cidr_block                  = (known after apply)
      + main_route_table_id              = (known after apply)
      + owner_id                         = (known after apply)
      + tags                             = {
          + "Name" = "tf_vpc"
        }
    }

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

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

ec2-user:~/environment/AWS $ terraform apply
module.storage.random_id.tf_bucket_id: Refreshing state... [id=RlA]
module.networking.data.aws_availability_zones.available: Refreshing state...
module.storage.aws_s3_bucket.tf_code: Refreshing state... [id=la-terrafrom-18000]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.networking.aws_default_route_table.tf_private_rt will be created
  + resource "aws_default_route_table" "tf_private_rt" {
      + default_route_table_id = (known after apply)
      + id                     = (known after apply)
      + owner_id               = (known after apply)
      + route                  = (known after apply)
      + tags                   = {
          + "Name" = "tf_private"
        }
      + vpc_id                 = (known after apply)
    }

  # module.networking.aws_internet_gateway.tf_internet_gateway will be created
  + resource "aws_internet_gateway" "tf_internet_gateway" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + owner_id = (known after apply)
      + tags     = {
          + "Name" = "tf_igw"
        }
      + vpc_id   = (known after apply)
    }

  # module.networking.aws_route_table.tf_public_rt will be created
  + resource "aws_route_table" "tf_public_rt" {
      + id               = (known after apply)
      + owner_id         = (known after apply)
      + propagating_vgws = (known after apply)
      + route            = [
          + {
              + cidr_block                = "0.0.0.0/0"
              + egress_only_gateway_id    = ""
              + gateway_id                = (known after apply)
              + instance_id               = ""
              + ipv6_cidr_block           = ""
              + local_gateway_id          = ""
              + nat_gateway_id            = ""
              + network_interface_id      = ""
              + transit_gateway_id        = ""
              + vpc_peering_connection_id = ""
            },
        ]
      + tags             = {
          + "Name" = "tf_public"
        }
      + vpc_id           = (known after apply)
    }

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

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

  # module.networking.aws_security_group.tf_public_sg will be created
  + resource "aws_security_group" "tf_public_sg" {
      + arn                    = (known after apply)
      + description            = "Used for access to the public instances"
      + 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_port        = 22
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "tcp"
              + security_groups  = []
              + self             = false
              + to_port          = 22
            },
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = ""
              + from_port        = 80
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "tcp"
              + security_groups  = []
              + self             = false
              + to_port          = 80
            },
        ]
      + name                   = "tf_public_sg"
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + vpc_id                 = (known after apply)
    }

  # module.networking.aws_subnet.tf_public_subnet[0] will be created
  + resource "aws_subnet" "tf_public_subnet" {
      + arn                             = (known after apply)
      + assign_ipv6_address_on_creation = false
      + availability_zone               = "us-west-2a"
      + availability_zone_id            = (known after apply)
      + cidr_block                      = "10.123.1.0/24"
      + id                              = (known after apply)
      + ipv6_cidr_block_association_id  = (known after apply)
      + map_public_ip_on_launch         = true
      + owner_id                        = (known after apply)
      + tags                            = {
          + "Name" = "tf_public_1"
        }
      + vpc_id                          = (known after apply)
    }

  # module.networking.aws_subnet.tf_public_subnet[1] will be created
  + resource "aws_subnet" "tf_public_subnet" {
      + arn                             = (known after apply)
      + assign_ipv6_address_on_creation = false
      + availability_zone               = "us-west-2b"
      + availability_zone_id            = (known after apply)
      + cidr_block                      = "10.123.2.0/24"
      + id                              = (known after apply)
      + ipv6_cidr_block_association_id  = (known after apply)
      + map_public_ip_on_launch         = true
      + owner_id                        = (known after apply)
      + tags                            = {
          + "Name" = "tf_public_2"
        }
      + vpc_id                          = (known after apply)
    }

  # module.networking.aws_vpc.tf_vpc will be created
  + resource "aws_vpc" "tf_vpc" {
      + arn                              = (known after apply)
      + assign_generated_ipv6_cidr_block = false
      + cidr_block                       = "10.123.0.0/16"
      + 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_classiclink               = (known after apply)
      + enable_classiclink_dns_support   = (known after apply)
      + enable_dns_hostnames             = true
      + enable_dns_support               = true
      + id                               = (known after apply)
      + instance_tenancy                 = "default"
      + ipv6_association_id              = (known after apply)
      + ipv6_cidr_block                  = (known after apply)
      + main_route_table_id              = (known after apply)
      + owner_id                         = (known after apply)
      + tags                             = {
          + "Name" = "tf_vpc"
        }
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.networking.aws_vpc.tf_vpc: Creating...
module.networking.aws_vpc.tf_vpc: Creation complete after 1s [id=vpc-019a49320e9269354]
module.networking.aws_default_route_table.tf_private_rt: Creating...
module.networking.aws_subnet.tf_public_subnet[0]: Creating...
module.networking.aws_subnet.tf_public_subnet[1]: Creating...
module.networking.aws_internet_gateway.tf_internet_gateway: Creating...
module.networking.aws_security_group.tf_public_sg: Creating...
module.networking.aws_default_route_table.tf_private_rt: Creation complete after 0s [id=rtb-043922806ca5159e5]
module.networking.aws_internet_gateway.tf_internet_gateway: Creation complete after 0s [id=igw-0b4aaeddd35aa5290]
module.networking.aws_route_table.tf_public_rt: Creating...
module.networking.aws_subnet.tf_public_subnet[1]: Creation complete after 0s [id=subnet-041c67314f6854f87]
module.networking.aws_subnet.tf_public_subnet[0]: Creation complete after 0s [id=subnet-02a3f1ec8e4c61922]
module.networking.aws_route_table.tf_public_rt: Creation complete after 1s [id=rtb-053a3d440ba55a6d5]
module.networking.aws_route_table_association.tf_public_assoc[1]: Creating...
module.networking.aws_route_table_association.tf_public_assoc[0]: Creating...
module.networking.aws_route_table_association.tf_public_assoc[0]: Creation complete after 0s [id=rtbassoc-0b88c9fe206ee13ac]
module.networking.aws_route_table_association.tf_public_assoc[1]: Creation complete after 0s [id=rtbassoc-06b93c2515abf2d55]
module.networking.aws_security_group.tf_public_sg: Creation complete after 1s [id=sg-085cfa7720d7b9003]

Apply complete! Resources: 9 added, 0 changed, 0 destroyed.

Outputs:

Bucket_Name = la-terrafrom-18000

ec2-user:~/environment/AWS $ terraform destroy
module.storage.random_id.tf_bucket_id: Refreshing state... [id=RlA]
module.networking.data.aws_availability_zones.available: Refreshing state... [id=2020-10-09 09:17:18.655922221 +0000 UTC]
module.networking.aws_vpc.tf_vpc: Refreshing state... [id=vpc-019a49320e9269354]
module.storage.aws_s3_bucket.tf_code: Refreshing state... [id=la-terrafrom-18000]
module.networking.aws_internet_gateway.tf_internet_gateway: Refreshing state... [id=igw-0b4aaeddd35aa5290]
module.networking.aws_default_route_table.tf_private_rt: Refreshing state... [id=rtb-043922806ca5159e5]
module.networking.aws_subnet.tf_public_subnet[0]: Refreshing state... [id=subnet-02a3f1ec8e4c61922]
module.networking.aws_security_group.tf_public_sg: Refreshing state... [id=sg-085cfa7720d7b9003]
module.networking.aws_subnet.tf_public_subnet[1]: Refreshing state... [id=subnet-041c67314f6854f87]
module.networking.aws_route_table.tf_public_rt: Refreshing state... [id=rtb-053a3d440ba55a6d5]
module.networking.aws_route_table_association.tf_public_assoc[1]: Refreshing state... [id=rtbassoc-06b93c2515abf2d55]
module.networking.aws_route_table_association.tf_public_assoc[0]: Refreshing state... [id=rtbassoc-0b88c9fe206ee13ac]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # module.networking.aws_default_route_table.tf_private_rt will be destroyed
  - resource "aws_default_route_table" "tf_private_rt" {
      - default_route_table_id = "rtb-043922806ca5159e5" -> null
      - id                     = "rtb-043922806ca5159e5" -> null
      - owner_id               = "124011853020" -> null
      - propagating_vgws       = [] -> null
      - route                  = [] -> null
      - tags                   = {
          - "Name" = "tf_private"
        } -> null
      - vpc_id                 = "vpc-019a49320e9269354" -> null
    }

  # module.networking.aws_internet_gateway.tf_internet_gateway will be destroyed
  - resource "aws_internet_gateway" "tf_internet_gateway" {
      - arn      = "arn:aws:ec2:us-west-2:124011853020:internet-gateway/igw-0b4aaeddd35aa5290" -> null
      - id       = "igw-0b4aaeddd35aa5290" -> null
      - owner_id = "124011853020" -> null
      - tags     = {
          - "Name" = "tf_igw"
        } -> null
      - vpc_id   = "vpc-019a49320e9269354" -> null
    }

  # module.networking.aws_route_table.tf_public_rt will be destroyed
  - resource "aws_route_table" "tf_public_rt" {
      - id               = "rtb-053a3d440ba55a6d5" -> null
      - owner_id         = "124011853020" -> null
      - propagating_vgws = [] -> null
      - route            = [
          - {
              - cidr_block                = "0.0.0.0/0"
              - egress_only_gateway_id    = ""
              - gateway_id                = "igw-0b4aaeddd35aa5290"
              - instance_id               = ""
              - ipv6_cidr_block           = ""
              - local_gateway_id          = ""
              - nat_gateway_id            = ""
              - network_interface_id      = ""
              - transit_gateway_id        = ""
              - vpc_peering_connection_id = ""
            },
        ] -> null
      - tags             = {
          - "Name" = "tf_public"
        } -> null
      - vpc_id           = "vpc-019a49320e9269354" -> null
    }

  # module.networking.aws_route_table_association.tf_public_assoc[0] will be destroyed
  - resource "aws_route_table_association" "tf_public_assoc" {
      - id             = "rtbassoc-0b88c9fe206ee13ac" -> null
      - route_table_id = "rtb-053a3d440ba55a6d5" -> null
      - subnet_id      = "subnet-02a3f1ec8e4c61922" -> null
    }

  # module.networking.aws_route_table_association.tf_public_assoc[1] will be destroyed
  - resource "aws_route_table_association" "tf_public_assoc" {
      - id             = "rtbassoc-06b93c2515abf2d55" -> null
      - route_table_id = "rtb-053a3d440ba55a6d5" -> null
      - subnet_id      = "subnet-041c67314f6854f87" -> null
    }

  # module.networking.aws_security_group.tf_public_sg will be destroyed
  - resource "aws_security_group" "tf_public_sg" {
      - arn                    = "arn:aws:ec2:us-west-2:124011853020:security-group/sg-085cfa7720d7b9003" -> null
      - description            = "Used for access to the public instances" -> null
      - 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
            },
        ] -> null
      - id                     = "sg-085cfa7720d7b9003" -> null
      - ingress                = [
          - {
              - cidr_blocks      = [
                  - "0.0.0.0/0",
                ]
              - description      = ""
              - from_port        = 22
              - ipv6_cidr_blocks = []
              - prefix_list_ids  = []
              - protocol         = "tcp"
              - security_groups  = []
              - self             = false
              - to_port          = 22
            },
          - {
              - cidr_blocks      = [
                  - "0.0.0.0/0",
                ]
              - description      = ""
              - from_port        = 80
              - ipv6_cidr_blocks = []
              - prefix_list_ids  = []
              - protocol         = "tcp"
              - security_groups  = []
              - self             = false
              - to_port          = 80
            },
        ] -> null
      - name                   = "tf_public_sg" -> null
      - owner_id               = "124011853020" -> null
      - revoke_rules_on_delete = false -> null
      - tags                   = {} -> null
      - vpc_id                 = "vpc-019a49320e9269354" -> null
    }

  # module.networking.aws_subnet.tf_public_subnet[0] will be destroyed
  - resource "aws_subnet" "tf_public_subnet" {
      - arn                             = "arn:aws:ec2:us-west-2:124011853020:subnet/subnet-02a3f1ec8e4c61922" -> null
      - assign_ipv6_address_on_creation = false -> null
      - availability_zone               = "us-west-2a" -> null
      - availability_zone_id            = "usw2-az1" -> null
      - cidr_block                      = "10.123.1.0/24" -> null
      - id                              = "subnet-02a3f1ec8e4c61922" -> null
      - map_public_ip_on_launch         = true -> null
      - owner_id                        = "124011853020" -> null
      - tags                            = {
          - "Name" = "tf_public_1"
        } -> null
      - vpc_id                          = "vpc-019a49320e9269354" -> null
    }

  # module.networking.aws_subnet.tf_public_subnet[1] will be destroyed
  - resource "aws_subnet" "tf_public_subnet" {
      - arn                             = "arn:aws:ec2:us-west-2:124011853020:subnet/subnet-041c67314f6854f87" -> null
      - assign_ipv6_address_on_creation = false -> null
      - availability_zone               = "us-west-2b" -> null
      - availability_zone_id            = "usw2-az2" -> null
      - cidr_block                      = "10.123.2.0/24" -> null
      - id                              = "subnet-041c67314f6854f87" -> null
      - map_public_ip_on_launch         = true -> null
      - owner_id                        = "124011853020" -> null
      - tags                            = {
          - "Name" = "tf_public_2"
        } -> null
      - vpc_id                          = "vpc-019a49320e9269354" -> null
    }

  # module.networking.aws_vpc.tf_vpc will be destroyed
  - resource "aws_vpc" "tf_vpc" {
      - arn                              = "arn:aws:ec2:us-west-2:124011853020:vpc/vpc-019a49320e9269354" -> null
      - assign_generated_ipv6_cidr_block = false -> null
      - cidr_block                       = "10.123.0.0/16" -> null
      - default_network_acl_id           = "acl-0c7a2db031a8e3854" -> null
      - default_route_table_id           = "rtb-043922806ca5159e5" -> null
      - default_security_group_id        = "sg-0bafa1d4345a642c7" -> null
      - dhcp_options_id                  = "dopt-cc5342a9" -> null
      - enable_classiclink               = false -> null
      - enable_classiclink_dns_support   = false -> null
      - enable_dns_hostnames             = true -> null
      - enable_dns_support               = true -> null
      - id                               = "vpc-019a49320e9269354" -> null
      - instance_tenancy                 = "default" -> null
      - main_route_table_id              = "rtb-043922806ca5159e5" -> null
      - owner_id                         = "124011853020" -> null
      - tags                             = {
          - "Name" = "tf_vpc"
        } -> null
    }

  # module.storage.aws_s3_bucket.tf_code will be destroyed
  - resource "aws_s3_bucket" "tf_code" {
      - acl                         = "private" -> null
      - arn                         = "arn:aws:s3:::la-terrafrom-18000" -> null
      - bucket                      = "la-terrafrom-18000" -> null
      - bucket_domain_name          = "la-terrafrom-18000.s3.amazonaws.com" -> null
      - bucket_regional_domain_name = "la-terrafrom-18000.s3.us-west-2.amazonaws.com" -> null
      - force_destroy               = true -> null
      - hosted_zone_id              = "Z3BJ6K6RIION7M" -> null
      - id                          = "la-terrafrom-18000" -> null
      - region                      = "us-west-2" -> null
      - request_payer               = "BucketOwner" -> null
      - tags                        = {
          - "Name" = "tf_bucket"
        } -> null

      - versioning {
          - enabled    = false -> null
          - mfa_delete = false -> null
        }
    }

  # module.storage.random_id.tf_bucket_id will be destroyed
  - resource "random_id" "tf_bucket_id" {
      - b64_std     = "RlA=" -> null
      - b64_url     = "RlA" -> null
      - byte_length = 2 -> null
      - dec         = "18000" -> null
      - hex         = "4650" -> null
      - id          = "RlA" -> null
    }

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

Changes to Outputs:
  - Bucket_Name = "la-terrafrom-18000" -> null

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

module.networking.aws_route_table_association.tf_public_assoc[1]: Destroying... [id=rtbassoc-06b93c2515abf2d55]
module.networking.aws_security_group.tf_public_sg: Destroying... [id=sg-085cfa7720d7b9003]
module.networking.aws_route_table_association.tf_public_assoc[0]: Destroying... [id=rtbassoc-0b88c9fe206ee13ac]
module.storage.aws_s3_bucket.tf_code: Destroying... [id=la-terrafrom-18000]
module.networking.aws_default_route_table.tf_private_rt: Destroying... [id=rtb-043922806ca5159e5]
module.networking.aws_default_route_table.tf_private_rt: Destruction complete after 0s
module.networking.aws_route_table_association.tf_public_assoc[1]: Destruction complete after 0s
module.networking.aws_route_table_association.tf_public_assoc[0]: Destruction complete after 0s
module.networking.aws_subnet.tf_public_subnet[0]: Destroying... [id=subnet-02a3f1ec8e4c61922]
module.networking.aws_route_table.tf_public_rt: Destroying... [id=rtb-053a3d440ba55a6d5]
module.networking.aws_subnet.tf_public_subnet[1]: Destroying... [id=subnet-041c67314f6854f87]
module.networking.aws_security_group.tf_public_sg: Destruction complete after 0s
module.storage.aws_s3_bucket.tf_code: Destruction complete after 0s
module.storage.random_id.tf_bucket_id: Destroying... [id=RlA]
module.storage.random_id.tf_bucket_id: Destruction complete after 0s
module.networking.aws_route_table.tf_public_rt: Destruction complete after 0s
module.networking.aws_internet_gateway.tf_internet_gateway: Destroying... [id=igw-0b4aaeddd35aa5290]
module.networking.aws_subnet.tf_public_subnet[1]: Destruction complete after 0s
module.networking.aws_subnet.tf_public_subnet[0]: Destruction complete after 0s
module.networking.aws_internet_gateway.tf_internet_gateway: Still destroying... [id=igw-0b4aaeddd35aa5290, 10s elapsed]
module.networking.aws_internet_gateway.tf_internet_gateway: Destruction complete after 10s
module.networking.aws_vpc.tf_vpc: Destroying... [id=vpc-019a49320e9269354]
module.networking.aws_vpc.tf_vpc: Destruction complete after 1s

Destroy complete! Resources: 11 destroyed.



Category: orchestration Tags: public

Upvote


Downvote