Git Product home page Git Product logo

githubaction_ci_terraform_ecr_docker_ecs_efs's Introduction

Github Actions Integration with terraform to create VPC,SG, ECR , ECS, EFS & mounting of EFS

What it contains

  1. This is a complete CI-CD pipeline through Github workflow actions present in .github folder along with Terraform code present in modules folder & environment/demo folder. As soon as there is a checkin in main branch a github workflow will trigger the terrform scripts with workflow name tearrform_plan_apply which will create the followings in AWS on broader level with terraform:

    A. VPC B. CIDR C. Subnets D. Necessary Security Groups E. Elastic Container Registry F. Create Elastic File Systems G. Mount the file syste. H. Create Tasks Definitions I. Mouting Point of EFS to data J. Necessary Policies. K. Policies to assume role.

**Note: We have commented out terraform apply Plan in our .github\workflows\terraform.yml file to prevent any accidental run for infra creation. However we have shown complete CI CD for question no 3 in https://github.com/praveen1664/Github-Bitcoin-Pipeline.git repo. At apply stage you will get below message: sh Terraform Apply is commented out to prevent any accidental run. We have implemented full pipeline in Question 3 in https://github.com/praveen1664/Github-Bitcoin-Pipeline.git repository. Here you can check the Terraform Plan for resource creation or destroy name=SELECTED_COLOR::green sh

  1. How it could be run?

It contain 2 Github Actions Work Flow as part of CI CD
1. "Terraform_Plan_Apply"
2. Terraform destroy
1. Workflow "Terraform_Plan_Apply" will triggred automatically with a push in main branch with Github Actions.
2. There is another GitHub Work which is provided to destroy the infra created in first step. Terraform Destroy Prsent in Gighub,Repo,Actions which could be triggered manually. No Automation is provided here. Please run this if you have run the first GitHub action workflow. It is used to

b. To destroy all the infrastructure created by teraform.

What You need

A valid Github Repo A Valid AWS account with programatic access enabled with access_key & secret_key.

What You need to do to test this code?

(A) Test it in Same repo, same github account my aws account in same structure the please contact me.


  1. Clone this repo & do some dummy checkin say add some comment in READMDEmd.
  2. Make some meaningful comments & do a push.
  3. The Github action "Terraform_Plan_Apply" will trigger automatically.
  4. You can Watch it to be completed in repo,Actions,Terraform_Plan_Apply workflow
  5. check all of the logs.
  6. You can contact me to see how the infra has been created in aws.
  7. Run anoher work flow to destroy the infra from repo , Actions, terraform_destroy to destroy the infra. (You need toenter Destroy to proceed further)

(B) Test this from command line on your system


  1. Take a system which have terraform installed.
  2. Install aws-cli
  3. do aws configure from cli.
  4. Clone my repository.
  5. In providers section uncomment the profile block & region
  6. Also remove my remote backend
  7. Goto , environment\demo folder & run following commands a) terraform init b) terraform plan c) terraform apply
  8. To destroy Please rund the following d) terraform destroy

(C) Want to test it with your github account then


  1. Clone this repo from main branch
  2. Remove my backend from providers section.
  3. Add your backend.
  4. Create your repo & update secrets in your repo by creating 2 variables a) AWS_ACCESS_KEY_ID for your user access Key b) AWS_SECRET_ACCESS_KEY for your secret Key.
  5. In .github\workflowfolder\terraform.yml update aws-region with your region of choice.
  6. Add this code to your repo.
  7. Do some dummy checkin to main.
  8. The Github action "Terraform_Plan_Apply" will trigger automatically.
  9. You can Watch it to be completed in repo,Actions,Terraform_Plan_Apply workflow
  10. Check all of the logs.
  11. You can cross check your aws account to verify the build.
  12. Run anoher work flow from repo , Actions, terraform_destroy to destroy the infra. (You need toenter Destroy to proceed further)

githubaction_ci_terraform_ecr_docker_ecs_efs's People

Contributors

praveen1664 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.