Help for the VSCode editor.
-
Which command can be used to create a visual representation of our terraform resources?
terraform graph
-
We have created a configuration directory /root/terraform-projects/project-shazam. The configuration file inside will be used to create an RSA type private key and then a certificate signing request or a csr using this key.
However, there is an error with the configuration. Use the terraform validate command, troubleshoot, and fix the issue.
You don't have to create the resources yet! You only need to fix the errors reported by terraform validate.
-
Get details about the error
cd /root/terraform-projects/project-shazam terraform validate
It tells us the error with the
private_key
resource -
Use the documentation to determine what the correct attribute name should be.
-
Try validating again
terraform validate
Success!
-
-
Great! If you completed the previous question correctly, terraform validate should have passed! Now run terraform plan and generate a configuration plan.
terraform plan
YES
-
Now, try creating the resources with a terraform apply.
terraform apply
NO
-
Information only
-
The error in the configuration is inside the resource block for the tls_cert_request type resource
NOTE: The question statement about the cause of the error is currently incorrect, as there has been a change to the
tls
provider since the questions were written. To pass this question, do the following- Remove the line
rsa_bits = 4096
- Remove the line
-
Now format the main.tf file into a canonical format.
terraform fmt
-
Now, navigate to the directory /root/terraform-projects/project-a. We have already created the resources specified in this configuration.
- Navigate to the given directory in the Explorer pane
- Open the file
terraform.tfstate
- Find the
filename
attribute and note its value for the answer.
-
In these terraform labs, we have used multiple providers so far. But, what are providers?
- Providers are plugins for the
terraform
program. terraform init
downloads these based on the content of your configuration files.- Other terraform commands which process your configuration load these plugins and call the code within them to process each resource specific to a given provider.
- Providers are plugins for the
-
Which one is a valid sub-command of the terraform providers command?
A sub-command is the value that comes next on the command line.
To list valid sub-commands of
terraform providers
doterraform providers --help
-
A new configuration directory /root/terraform-projects/provider has been created. We have already run the terraform init command.
Now check the provider plugins that have been downloaded from the command line utilityRunning
terraform providers
without a sub-command will give us the answer.cd /root/terraform-projects/provider terraform providers