What's new in Terraform v0.13

There are not many additions, but they are worth knowing, because they will help expand your possibilities when working with Terraform .





Let's take a look at the most useful new features when working with modules.





We will deploy the infrastructure in aws. Create three vpc



and network dev



, stage



and prod



contours.





source



- Terraform, child



.

, env



, , vpc_cidr



- IPv4- VPC CIDR.





:





variable "vpc_network_cidr" { 
   default    = {
       dev     = "172.16.1.0/24"
       stage  = "172.17.1.0/24"
       prod    = "172.18.1.0/24"
   }
}

variable "region" {
   default = "eu-west-2"
}
      
      



, . :





cidr_block



– IPv4- VPC CIDR. / 16 / 28





tags



- ""





vpc_id



- VPC





:





variable "vpc_cidr" {
   default = "172.16.0.0/16"
}

variable "env" {
   default = "dev"
}

variable "public_subnet_cidrs" { 
   default = [
      "172.16.1.0/24"
   ]
}

variable "private_subnet_cidrs" { 
   default = [
      "172.16.2.0/24"
   ] 
}
      
      



, vpc-prod



, . Terraform v0.13 :





depends_on = [module.vpc-dev, module.vpc-stage]



module "vpc-prod"



.





, , , dev



stage



, , vpc



prod



.





AWS vps



:





- . – .





count



for_each



. Terraform for_each



count



.





Terraform 0.13 , .









- for_each



. , .





: each.key



each.value



.





each.key - , .





each.value



- , .





- count



. , .





count.index



- ( 0), .







terraform apply



, , count



, [0], for_each



.





AWS vps



:






Administrator Linux. Advanced. . - Β« LustreΒ».













All Articles