July 2017
Beginner
208 pages
5h 10m
English
The easiest (after interactive mode) way to set variable values is to specify them as an argument to Terraform command. It's done with the multiple -var arguments to the command with the name and value of the variable following:
$> terraform plan -var 'environment=dev'
Note how instance type of the EC2 server is different because we set the variable environment to dev.
So far, we don't have any map or list variables for the root module. Let's add a list of CIDR blocks that are allowed to access default security group via SSH. Also, let's add map with CIDR blocks for our subnets. We will have two blocks: for private and for public subnets accordingly. In the end, variables.tf should look as follows:
variable "region" ...
Read now
Unlock full access