This repo is a basic example of how to create an AWS EC2 instance through IaC.
To create the resource use the following commands:
terraform init: Generates the necessary files for Terraform to execute.terraform plan: Shows the changes that will be made (This requires the AWS CLI to be configured correctly).terraform apply: Executes the changes done to the AWS Resources.
After all that is done, a terraform.tfstate file will be created. This file contains the current state of the infraestructure. This file should not be maintained locally.
terraform destroy: Removes everything that is currently mapped in theterraform.tfstatefile.
Demonstration on how to create a basic AWS resource through configuration files.
Demonstration on how to create an AWS resource using an external module from them Terraform Registry
Demonstration on how to create an AWS resource by using code as modules, setting variables for inputs and outputs to be consumed by other resources.
Demonstration on how to implement a backend-state file in S3 along with the locking implemented through a DynamoDB Table.