Creating an infra using Terraform

As, I already mentioned Terraform introduction earlier on previous page.

Prerequisites

  1. IAM User with required ec2 policy

  2. aws cli

  3. terraform installed

Terraform

Also the terraform installation part.

Terraform installation

Here is the terraform code which can be used to create an infra.

  1. Clone the repo and use it

git clone https://github.com/whoami-anoint/wazu/
cd terraform/infra-templates/prod-minimal/
terraform validate
terraform init
terraform plan
terraform apply -auto-approve
  1. In case you want to destroy the infra, use the given command

terraform destroy -auto-approve

Let's check the validity of our terraform code:

The configuration is valid.

Pending issue on this challenge.

As I am using the organizational aws labs for learning purpose, I do have no access for this policy to create ec2 from iam users (aws cli) on this terraform. But we can try with any other account as we can see our code is valid too.

Last updated