Skip to main content

Lab 38: User Variable Setup Using Terraform

The Nautilus DevOps team is automating IAM user creation using Terraform for better identity management.

For this task, create an AWS IAM User using Terraform with the following requirements:

  1. The IAM User name iamuser_yousuf should be stored in a variable named KKE_user.

Note:

    1. The configuration values should be stored in a variables.tf file.
    1. The Terraform script should be structured with a main.tf file referencing variables.tf.
  1. The Terraform working directory is /home/bob/terraform.

  2. Right-click under the EXPLORER section in VS Code and select Open in Integrated Terminal to launch the terminal.

# /home/bob/terraform/variables.tf
variable "KKE_eip" {
description = "The name to be used for the Elastic IP address."
type = string
default = "devops-eip"
}

# /home/bob/terraform/main.tf

resource "aws_eip" "devops_elastic_ip" {
# The tags block is used to name the resource in the AWS console.
tags = {
Name = var.KKE_eip
}
}
terraform init
# or apply forcefully without creating plan and applying it
terraform apply -auto-approve