variable "vpc_id" {}
      
      data "aws_vpc" "${selected}" {
         id = "\${var.vpc_id}"
      }
      
      resource "aws_subnet" "example" {
          vpc_id            = "\${data.aws_vpc.${selected}.id}"
          availability_zone = "us-west-2a"
          cidr_block        = "\${cidrsubnet(data.aws_vpc.${selected}.cidr_block, 4, 1)}"
      }
      Terraform language logo

      aws_vpc

      Terraform snippets

      This code snippet creates an AWS VPC and assigns it the VPC ID "{var.vpc_id}" . The VPC has an availability zone of "us-west-2a" and a CIDR block of "4.1.1.0/24" .

      Shortcut: tf_aws_vpc

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.