Skip to content

Creating a VPC using Terraform as IAAC and github actions as CI/CD for the NT548.P11 course - Fall 2024 semester at University of Information Technology - VNUHCM

Notifications You must be signed in to change notification settings

meowwkhoa/vpc-terraform-github-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

README.md

Introduction:

Creating a VPC using Terraform as IAAC and GitHub Actions as CI/CD for the NT548.P11 course - Fall 2024 semester at University of Information Technology - VNUHCM.

Repository structure:

vpc-terraform-github-actions
  ├── .github
  │   └── workflows
  │       └── terraform-deploy.yml                /* GitHub Actions workflow file */
  ├── modules
  │   ├── VPC
  │   │   ├── main.tf
  │   │   ├── outputs.tf
  │   │   └── variables.tf
  │   ├── NAT
  │   │   ├── main.tf
  │   │   ├── outputs.tf
  │   │   └── variables.tf
  │   ├── Route_Table
  │   │   ├── main.tf
  │   │   ├── outputs.tf
  │   │   └── variables.tf
  │   ├── Security_Groups
  │   │   ├── main.tf
  │   │   ├── outputs.tf
  │   │   └── variables.tf
  │   └── EC2
  │       ├── main.tf
  │       ├── outputs.tf
  │       └── variables.tf
  ├── main.tf
  ├── outputs.tf
  ├── variables.tf
  ├── assets                                      /* Images */
  └── README.md                                   /* Readme file with instructions */

Setup Instructions:

  1. Create AWS IAM User:

    • Go to the IAM section in AWS. IAM_section
    • Go to Users section. Users_section
    • Create a new user with your user name. Users_name
    • Attach the necessary policies. Permission
    • Now we can see our user on the AWS platform. All_users
    • Click on our user, then Security credentials. Credentials
    • Go to Access keys and click Create access key. Access_keys
    • Choose CLI. CLI
    • Then Create access key. Create_key
    • Now, we can either download the CSV file to save the keys or copy them directly. CSV
  2. Configure GitHub Secrets:

    • Go to the repository settings on GitHub. Settings

    • Navigate to the "Environments" section. Environments

    • Add the following secrets:

      • AWS_ACCESS_KEY_ID
      • AWS_SECRET_ACCESS_KEY
      • AWS_REGION (e.g., us-east-1)

      Access_key_pasting

Usage:

  1. Clone the Repository:

    git clone https://github.com/meowwkhoa/vpc-terraform-github-actions.git
    cd vpc-terraform-github-actions
  2. Create a New Branch:

    git checkout -b test
  3. Make Changes and Push:

  • Make any necessary changes to the code.
  • Stage and commit the changes:
    git add .
    git commit -m "test"
    git push origin test
  1. Create a Pull Request:
  • Go to the repository on GitHub.
  • Create a pull request from the test branch to the main branch.
  1. Monitor Deployment:

    • The GitHub Action will trigger automatically.

    • Logs of the GitHub Action automatic deployment. Logs

    • Monitor the infrastructure changes in the AWS Management Console.

    • Our infrastructure VPC group 12. VPC

    • Subnet VPC group 12. Subnet

    • Internet Gateway IGW group 12. IGW

    • Public Routable Public Routable group 12 and Private Routable Private Routable group 12. Route_table

    • NAT Gateway Group-12-NAT-Gateway. NAT

    • Elastic IP Group-12-NAT-EIP. EIP

    • Public Instance Public Instance group 12 and Private Instance Private Instance group 12. instances

    • Public Security Group Group 12: Public Security Group and Private Security Group Group 12: Private Security Group. SG

  2. Running a security scan with Checkov

    • The Github Action will trigger automatically.
    • Logs of the scanning process. Checkov

About

Creating a VPC using Terraform as IAAC and github actions as CI/CD for the NT548.P11 course - Fall 2024 semester at University of Information Technology - VNUHCM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages