How zetaaztra/ec2_terraform works
Main Components
• Terraform Configuration Files – These include main.tf, provider.tf, variables.tf, and outputs.tf. They define your infrastructure (the EC2 instance) and configuration details such as the AWS provider, input variables, and outputs.
• GitHub Workflows – Found under the .github/workflows folder (files: Main.yml, aws_tf_apply.yml, aws_tf_plan.yml). These scripts automate Terraform commands (e.g., terraform plan and terraform apply) as part of your CI/CD pipeline.
• AWS Cloud Platform – The target environment where the EC2 instance is provisioned.
Relationships and Interactions
• The GitHub repository acts as the source of truth for your Terraform scripts.
• Changes pushed to the repository trigger GitHub Actions, which run the configured workflows.
• The workflows execute Terraform commands that read the Terraform configuration files.
• Terraform interacts with the AWS API (using the settings in provider.tf) to provision the EC2 instance as defined in main.tf.
• Outputs from Terraform (defined in outputs.tf) can be used to quickly reference important details about the provisioned resources.
Architectural Patterns and Design Principles
• Infrastructure as Code – All infrastructure configuration is codified, making your deployment repeatable and version-controlled.
• CI/CD Pipeline – Automated workflows via GitHub Actions ensure that the Terraform plan and apply process is consistent and less error-prone.
• Separation of Concerns – The division between Terraform configuration files and workflow automation scripts helps maintain clarity in the project’s responsibilities.
Relevant Technologies and Tools
• Terraform – The core engine that interprets the configuration files.
• GitHub Actions – The automation tool for CI/CD that runs the Terraform workflows.
• AWS – The cloud provider where the EC2 instance is created.