Skip to main content
Welcome to this hands-on lesson on managing OpenTofu modules. You’ll learn how to inspect, configure, and apply a module to create an AWS IAM user.

1. Inspecting the Module Configuration

First, navigate to the project directory and open main.tf:
Key details:
  • A single module block named iam_iam-user.
  • Source: terraform-aws-modules/iam/aws//modules/iam-user
  • Version: 5.28.0
  • Requires one input: name (registry docs).

2. Supplying the Required Input

To create an IAM user named max, update the block:

3. Initializing and Planning

Initialize your working directory and generate a plan:
You’ll see three resources slated for creation:
The extra resources result from default boolean inputs.
The image shows a table listing AWS IAM resources and inputs, including their types, defaults, and whether they are required. It also includes a cookie consent notice at the bottom.
By default, the iam-user module defines these inputs:

4. Restricting Resource Creation

To limit the module to only create the IAM user, disable the access key and login profile:
Reinitialize and apply:
The new plan shows only the user resource:

5. Summary

You have now configured the iam-user module to create a single IAM user, controlling exactly which resources are deployed.

References

Watch Video

Practice Lab