terraform apply
This commit is contained in:
parent
e52dc5c298
commit
92934e3b07
1 changed files with 17 additions and 4 deletions
21
.github/workflows/terraform-apply.yml
vendored
21
.github/workflows/terraform-apply.yml
vendored
|
|
@ -9,7 +9,7 @@ env:
|
||||||
TF_CLOUD_ORGANIZATION: "MealCraft"
|
TF_CLOUD_ORGANIZATION: "MealCraft"
|
||||||
TF_API_TOKEN: "${{ secrets.TF_API_TOKEN }}"
|
TF_API_TOKEN: "${{ secrets.TF_API_TOKEN }}"
|
||||||
TF_WORKSPACE: "production"
|
TF_WORKSPACE: "production"
|
||||||
CONFIG_DIRECTORY: "./"
|
CONFIG_DIRECTORY: aws_environment
|
||||||
TF_VAR_public_ip: "${{ secrets.PUBLIC_IP }}"
|
TF_VAR_public_ip: "${{ secrets.PUBLIC_IP }}"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -17,13 +17,22 @@ jobs:
|
||||||
if: github.repository != 'hashicorp-education/learn-terraform-github-actions'
|
if: github.repository != 'hashicorp-education/learn-terraform-github-actions'
|
||||||
name: "Terraform Apply"
|
name: "Terraform Apply"
|
||||||
runs-on: mealcraft-runners
|
runs-on: mealcraft-runners
|
||||||
container: ubuntu:22.04
|
container:
|
||||||
|
image: ghcr.io/catthehacker/ubuntu:runner-22.04
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Debug Paths
|
||||||
|
run: |
|
||||||
|
echo "Workspace: $GITHUB_WORKSPACE"
|
||||||
|
ls -R .
|
||||||
|
echo "CONFIG_DIRECTORY: $CONFIG_DIRECTORY"
|
||||||
|
ls -R "$CONFIG_DIRECTORY"
|
||||||
|
|
||||||
- name: Upload Configuration
|
- name: Upload Configuration
|
||||||
uses: hashicorp/tfc-workflows-github/actions/upload-configuration@v1.0.0
|
uses: hashicorp/tfc-workflows-github/actions/upload-configuration@v1.0.0
|
||||||
id: apply-upload
|
id: apply-upload
|
||||||
|
|
@ -38,10 +47,14 @@ jobs:
|
||||||
workspace: ${{ env.TF_WORKSPACE }}
|
workspace: ${{ env.TF_WORKSPACE }}
|
||||||
configuration_version: ${{ steps.apply-upload.outputs.configuration_version_id }}
|
configuration_version: ${{ steps.apply-upload.outputs.configuration_version_id }}
|
||||||
|
|
||||||
|
# Terraform marks the run as "confirmable" using lowercase attribute
|
||||||
- name: Apply
|
- name: Apply
|
||||||
|
if: fromJSON(steps.apply-run.outputs.payload).data.attributes.actions.is_confirmable
|
||||||
uses: hashicorp/tfc-workflows-github/actions/apply-run@v1.0.0
|
uses: hashicorp/tfc-workflows-github/actions/apply-run@v1.0.0
|
||||||
if: fromJSON(steps.apply-run.outputs.payload).data.attributes.actions.IsConfirmable
|
|
||||||
id: apply
|
id: apply
|
||||||
with:
|
with:
|
||||||
comment: "Apply Run from GitHub Actions CI ${{ github.sha }}"
|
comment: "Apply from GitHub Actions CI ${{ github.sha }}"
|
||||||
run: ${{ steps.apply-run.outputs.run_id }}
|
run: ${{ steps.apply-run.outputs.run_id }}
|
||||||
|
|
||||||
|
- name: Print TF_VAR_public_ip
|
||||||
|
run: 'echo "📡 Public IP used by Terraform: $TF_VAR_public_ip"'
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue