Help for the VSCode editor.
-
Navigate to indicated directory in Explorer pane
-
Which configuration block is defined in the main.tf file at the moment?
module
-
What is the source of the module used in this configuration?
Public terraform registry
You can verify by searhcing for it at https://registry.terraform.io
-
What is the version of the module used?
Inspect the
version
argument to the module block. -
How many required arguments does this module expect?
Refer to the documentation and scroll down to the
inputs
section.Reveal
1
-
Which argument is to be specified, just to create an IAM User with this module?
From where you retrieved the previous answer in the documentatin, get the name of this required variable
Reveal
name
-
Now, update this module block that will allow it to create an IAM User called max.
-
Replace the comment in
main.tf
with the appropriate argumentReveal
name = "max" </details>
-
Init and plan
cd /root/terraform-projects/project-sapphire terraform init terraform plan
-
-
How many resources are set to be created in the execution plan ?
Examine the output of the
terraform plan
you just ran.Reveal
3
-
Which resources are set to be created?
Given we know how many resources will be created from the answer of the previous question, only one of the given options cann possibly be correct! Plus they're all present in the plan output.
Reveal
aws_iam_access_key
,aws_iam_user
andaws_iam_user_login_profile
-
Why is the module creating additional resources, when only the name for creating an IAM User was defined in the main.tf file?
Refer to the [documentation]https://registry.terraform.io/modules/terraform-aws-modules/iam/aws/latest/submodules/iam-user) and scroll down to the
inputs
section. Inspect the default values for arguments we did not provide.Reveal
The three resources will be created by default as per the modiule configuration.
-
We only want to create the IAM User. Update the module block to only allow create_user. Disable create_iam_access_key and create_iam_user_login_profile.
You should haqve esablished that there are some default
tru
boolean values for some arguments. These need to be explicitly setfalse
to disable the subresource creation.-
Update the mdule resource accordingly
Reveal
module "iam_iam-user" { source = "terraform-aws-modules/iam/aws//modules/iam-user" version = "3.4.0" name = "max" create_iam_user_login_profile = false create_iam_access_key = false }
-
Deploy
cd /root/terraform-projects/project-sapphire terraform plan terraform apply
-