Created
December 20, 2023 22:54
-
-
Save alaamub/c5ea75eb68c082322353219833089e18 to your computer and use it in GitHub Desktop.
resourcely.yml
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
name: Combined Workflows | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
packages: read | |
jobs: | |
terraform: | |
name: 'Terraform' | |
runs-on: ubuntu-latest | |
environment: production | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Terraform Init | |
run: terraform init | |
- name: Terraform Plan | |
run: terraform plan -out=plan.raw | |
- name: Convert the plan to JSON | |
id: planToJson | |
run: terraform show -json plan.raw | |
- name: Save JSON to a file | |
uses: fishcharlie/CmdToFile@v1.0.0 | |
with: | |
data: ${{ steps.planToJson.outputs.stdout }} | |
output: plan.json | |
- name: Upload Terraform Plan Output | |
uses: actions/upload-artifact@v2 | |
with: | |
name: plan-file | |
path: plan.json | |
# - name: Terraform Apply | |
# if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
# run: terraform apply -auto-approve -input=false | |
resourcely-ci: | |
needs: terraform | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download Terraform Plan Output | |
uses: actions/download-artifact@v2 | |
with: | |
name: plan-file | |
path: tf-plan-files/ | |
- name: Resourcely CI | |
uses: Resourcely-Inc/resourcely-action@v1 | |
with: | |
resourcely_api_token: ${{ secrets.RESOURCELY_API_TOKEN }} | |
resourcely_api_host: "https://api.dev.resourcely.io" | |
tf_directory: "tf-plan-files" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment