This workshop exercise demonstrates the use of Terraform code to set up the necessary infrastructure for your applications and other workloads in AWS. The objective of this exercise is to teach participants how a secure architecture can be achieve using AWS Cloud native microservices.
-
Github Actions: The code relies on Github Actions for automating the deployment and management of infrastructure changes. Github Actions provide a CI/CD pipeline that allows for continuous integration and continuous delivery of Terraform configurations, enabling automated testing, validation, and deployment of infrastructure updates. This integration ensures that any changes to the Terraform code are automatically tested and applied in a consistent and reliable manner.
-
Terraform Backend Configuration: The code configures the Terraform backend to use the created S3 bucket and DynamoDB table for storing and locking the state file, respectively.
-
Infrastructure Setup: The code configures a few EC2 instances with generic security groups in different subnets as an example to represents services that can host applications.
To use this code, follow these steps:
- Create an S3 Bucket.
- Create a DynamoDB Table with partition key
LockID
. - Create an IAM user and generate CLI credentials.
- Go to the file
main.tf
and enter the values for the S3 Bucket and DynamoDB Table.
- Please login to your github account. Yes you need one! 😆
- Fork the repository into your github account.
- From the cloned repo, go to the
Settings
tab. From the left hand menu bar chooseSecrets and variables
>Actions
and clickNew repository secret
. - Create two secret entries named
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
. Generate values from your IAM user account. - Test the code using the Validate World Skills Australia IaC Build workflow in the
Actions
tab.
After the resources are created, your S3 bucket and DynamoDB table will be referenced for managing the state of your Terraform configurations in AWS. Your infrastructure should look similar to this topology.
This code is open-source and available for non-commercial use only. Please see license file for additional usage limitations.