Help for the VSCode editor.
-
Navigate to indicated directory in the Explorer pane.
-
Which provider is used by the configuration files in this directory?
Know that you can determine provider names from the reource type property of a resource block. The type is of the form
provider_type
.Here we can see two distinct resource types:
random_uuid
random_integer
From this, we can determine that there is only one provder in use:
random
-
Which two resource types are configured in the configuration files?
In determining the answer to Q2, we've also determined the answer to this question.
-
Inspect
output.tf
-
Run terraform init, plan and apply to create these resources.
cd /root/terraform-projects/data terraform init terraform plan terraform apply
-
What is the value of the output variable called id2 ?
Note that we can acutally see all the outputs from the
terraform apply
, however if the screen had been cleared or we were to come back later (in a real environment), we useterraform output
command.terraform output id2
The value for
id2
will be printed. -
What is the value of the output variable called order1 ?
terraform output order1
-
We have a new configuration directory located at the path /root/terraform-projects/output. Inspect the configuration files that are created in this directory.
Note that there is a
terraform.tfstate
file in this directory (more on this in later lectures). This means thatterraform apply
has already been run.cd /root/terraform-projects/output terraform output pet-name
-
We have just updated the main.tf file in this directory with a new resource block. Add a new output variable...
- Output Variable Name:
welcome_message
- Value: content of the resource called welcome
-
Add the output variable block
Reveal
output "welcome_message" { value = local_file.welcome.content }
-
Deploy
cd /root/terraform-projects/output terraform init terraform plan terraform apply
- Output Variable Name: