Help for the VSCode editor.
-
We have a new configuration directory located at the path /root/terraform-projects/things-to-do. Inspect this directory and find out the number of providers initialized within this directory.
Konw that when a configuration is initialized with
terraform init
, a subdirectory.terraform
is created by the init process.Inspect
/root/terraform-projects/things-to-do
directory as directed and look for.terraform
there. If it doesn't exist, then no providers are initialized. -
How about now? How many provider plugins are installed in this configuration directory?
The
.terraform
directory now exists. Expand this in the Explorer pane of the VSCode editor, and see that there is an entryregistry.terraform.io/hashicorp/local/2.3.0/linux_amd64/
This represents a single provider plugin. -
How many configuration files exist in the directory: /root/terraform-projects/things-to-do ?
Configuration files are genrally files with a
.tf
file extension. Count them. -
How many resources are configured in this configuration directory?
Count all the resource blocks used.
We can see two resources:
things-to-do
andmore-things-to-do
-
What is the version of the plugin for the local provider that has been downloaded for this configuration?
Referring back to what we did io Q2, we can see the version as part of the path
registry.terraform.io/hashicorp/local/2.3.0/linux_amd64/
-
Now, go ahead and create these resources using terraform!
Run the following
cd /root/terraform-projects/things-to-do terraform plan terraform apply
Note that we didn't do
terraform init
here. That was done for you by the setup phase of Q2. -
Information only
-
How many resources are configured within this configuration directory?
- Navigate to
christmas-wishlist
in the Eplorer pane. - Open each of the
.tf
files in turn - Count the resource blocks in each file.
- Sum the results
- Navigate to
-
What is the filename that will be created by the resource called cyberpunk?
Check the value for
filename
argument incyberpunk.tf
-
Create a new configuration file within the same directory called xbox.tf. This file should make use of the same local_file resource type with the below requirements:
-
Resource name:
xbox
-
filename:
root/xbox.txt
-
content:
Wouldn't mind an XBox either!
Reveal code
resource "local_file" "xbox" { filename = "/root/xbox.txt" content = "Wouldn't mind an XBox either!" }
Now run the following in the terminal
cd /root/terraform-projects/christmas-wishlist terraform init terraform plan terraform apply
-
-
Now, navigate to the directory /root/terraform-projects/provider-a. We have downloaded a plugin in this directory. Identify the name and type of provider.
- You can look in the
.terraform
directory beneathprovider-a
in the Explorer pane. Here we seelinode
- Go to https://registry.terraform.io and search for
linode
, then click on the result. - Now we see that the provder is "by: linode" and that linode is a partner. This means it is "verified". Official providers are "by: Hashicorp".
- You can look in the
-
Now, navigate to the directory /root/terraform-projects/provider-b. We have downloaded a plugin in this directory. Identify the name and type of provider.
Just as for the previous question, find the provider on terraform registry. Since it is neither by Hashicorp, nor by Ansible themselves and marked as Partner, it is therefore a community provider.
Anyone with golang programming skills can create a community provider and publish it to the registry.