Usernames and passwords referenced in the Terraform code, even as variables, will end up in plain text in the state file.
Consider the following Terraform 0.12 configuration snippet:
variable "vpc_cidrs" {
type = map
default = {
us-east-1 = "10.0.0.0/16"
us-east-2 = "10.1.0.0/16"
us-west-1 = "10.2.0.0/16"
us-west-2 = "10.3.0.0/16"
}
}
resource "aws_vpc" "shared" {
cidr_block = _____________
}
How would we define the cidr_block
for us-east-1 in the aws_vpc
resource using a variable?
variable "vpc_cidrs" {
type = map
default = {
us-east-1 = "10.0.0.0/16"
us-east-2 = "10.1.0.0/16"
us-west-1 = "10.2.0.0/16"
us-west-2 = "10.3.0.0/16"
}
}
resource "aws_vpc" "shared" {
cidr_block = _____________
}
cidr_block
for us-east-1 in the aws_vpc
resource using a variable?
We have defined the values for our variables in the
file terraform.tfvars
, and saved it in the same directory as our Terraform configuration. Which of the following commands will use those values when creating an execution plan?
- Incorrect:
terraform plan
- Incorrect:
terraform plan -var-file=terraform.tfvars
- Correct: All of the above
- Incorrect: None of the above
Which of the following Terraform commands will automatically refresh the state unless supplied with additional flags or arguments? Choose TWO correct answers.
- Correct:
terraform plan
- Incorrect:
terraform state
- Correct:
terraform apply
- Incorrect:
terraform validate
- Incorrect:
terraform output
What happens when we apply Terraform configuration? Choose TWO correct answers.
- Correct: Terraform makes any infrastructure changes defined in our configuration.
- Incorrect: Terraform gets the plugins that the configuration requires.
- Correct: Terraform updates the state file with any configuration changes it made.
- Incorrect: Terraform corrects formatting errors in our configuration.
- Incorrect: Terraform destroys and recreates all our infrastructure from scratch.
Which flag is used to find more information about a Terraform command? For example, you need additional information about how to use the plan
command. You would type: terraform plan
_____. Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
- -h
- -help
- --help
Return to README.md