-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
on: [push] | ||
jobs: | ||
pluralith: | ||
runs-on: ubuntu-latest | ||
env: | ||
working-directory: ./ | ||
|
||
name: Run Pluralith | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
# 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 |