update :: tf token #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push] | |
jobs: | |
pluralith: | |
runs-on: ubuntu-latest | |
env: | |
working-directory: ./ | |
name: Run Pluralith | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set Terraform Cloud Token | |
run: | | |
echo "TF_TOKEN_app_terraform_io=${{ secrets.TF_TOKEN }}" >> $GITHUB_ENV | |
# Set up AWS credentials (using the aws-actions/configure-aws-credentials action) | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: ap-northeast-2 | |
# Set up Terraform | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_wrapper: false # This is recommended so the `terraform show` command outputs valid JSON | |
# Init Terraform project | |
- name: Terraform Init | |
run: terraform init | |
working-directory: "${{ env.working-directory }}" | |
# Set up and authenticate Pluralith | |
- name: Pluralith Init | |
uses: Pluralith/actions/[email protected] | |
with: | |
terraform-path: "${{ env.working-directory }}" | |
api-key: ${{ secrets.PLURALITH_API_KEY }} | |
# Run Pluralith to generate an infrastructure diagram and comment body | |
- name: Pluralith Run | |
uses: Pluralith/actions/[email protected] | |
with: | |
terraform-command: "plan" | |
terraform-path: "${{ env.working-directory }}" | |
show-changes: true | |
show-drift: true | |
show-costs: true # Requires Infracost to be set up in your pipeline | |
# Post the generated diagram as a GitHub comment | |
- name: Pluralith Comment | |
uses: Pluralith/actions/[email protected] | |
with: | |
terraform-path: "${{ env.working-directory }}" | |
target-type: commit |