How r3dact3d/aap-2.5-containerized-on-aws works
Main Components
• GitHub Repository: Represent the codebase which includes the Terraform configuration, GitHub Actions workflows (in .github/workflows), and post_data assets (e.g., the AAP installer package and manifest files).
• GitHub Actions Workflow: Show the pipeline that reacts to pull requests and push events. Include steps like checking out the code, setting up AWS credentials, running Terraform commands (init, validate, plan, and apply), and verifying S3 bucket existence.
• Terraform Infrastructure: Illustrate the components described in the Terraform files (main.tf, output.tf, user_data.txt). This component provisions:
• AWS EC2 Instance (a RHEL 9 machine) to run the Ansible Automation Platform.
• AWS S3 Bucket for state storage (as indicated by the environment variables used in the workflow).
• EC2 Instance Configuration & Provisioning: Detail how the provisioner “remote-exec” in main.tf configures the instance, including:
• Installing necessary packages (Ansible, wget, git, etc.).
• Setting the hostname.
• Downloading and extracting the AAP container bundle from post_data.
• Configuring SSH keys and the Ansible inventory.
• External Services & Credentials: Note the integration with AWS (for instance provisioning, S3, and credentials), and the Red Hat subscription services (using secrets like ORG_ID, ACTIVATION_KEY, RHN_USER, RHN_PASS).
Relationships and Data Flow
• That code changes in the GitHub repository (especially in the terraform directory) trigger the GitHub Actions workflows.
• That the EC2 instance (once created) runs scripts via remote_exec which download and run Ansible installation scripts from files in the post_data directory.
• How outputs from Terraform (like the public IP of the instance) feed back to allow SSH access for manual validation and post-infrastructure checks.
Architectural Patterns and Design Principles
• Infrastructure-as-Code (IaC): The use of Terraform for reproducible, automated infrastructure provisioning.
• CI/CD: The GitHub Actions workflow automates planning and applying changes based on branch events (pull_request for planning, push for apply).
• External Configuration and Secrets Management: Integration with AWS Secrets and external systems like Red Hat subscriptions highlight secure and parameterized deployment.
Final Touches
• Summaries or callouts for conditional logic used in the GitHub Actions workflow to differentiate between pull_request and push events.
• Relevant annotations about the use of external services (AWS, Red Hat) and dependencies like the post_data resources that are crucial for the Ansible installation.
This detailed decomposition will allow any observer (including a principal software engineer) to understand the overall system, the critical integration points, and the steps taken from code commit to a running Ansible Automation Platform instance on AWS.