0
0
llucycodes42
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
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)}"
}