Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] add reusable tf plan #47

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

AndyBoWu
Copy link
Contributor

@AndyBoWu AndyBoWu commented May 9, 2024

Description

Context

We need to use terraform plan and its related commands quite often before officially provision a bunch of cloud resources. This PR is created to group these steps and make them a reusable Github action workflow

Content

This PR adds the following functionalities

  1. parse env and aws_region from the given folder path. This means we need to enforce the folder creation and naming convention internally
  2. map env to AWS_ACCOUNT_ID which is being used for later iam role defition
  3. configure aws credential using OIDC
  4. install terraform on the runner to the given terraform_version
  5. terraform init
  6. terraform validate
  7. terraform plan
  8. post the output content to the PR when the workflow succeed

Notes

The following inputs are required to invoke this reusable Github action workflow

  workflow_call:
    inputs:
      path:
        type: string
        required: true
        description: 'Path to Terraform configuration'
      role: 
        type: string
        required: true
        description: 'Role to assume in the target AWS account'
      terraform_version:
        type: string
        required: true
        description: 'Terraform version to use'
    secrets:
      AWS_ACCOUNT_DEV_STAGING:
        description: 'AWS account ID for dev or staging environment'
        required: false
      AWS_ACCOUNT_PROD:
        description: 'AWS account ID for production environment'
        required: false

@AndyBoWu AndyBoWu force-pushed the feat/add_reusable_tf_plan branch 9 times, most recently from 1b4c720 to 05425ef Compare May 10, 2024 00:32
@AndyBoWu AndyBoWu force-pushed the feat/add_reusable_tf_plan branch from 05425ef to 0953737 Compare May 10, 2024 01:09
@edisonz0718 edisonz0718 self-requested a review May 10, 2024 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants