Skip to content

Commit d57c897

Browse files
Update terraform apply workflow [skip ci]
1 parent 1eea76a commit d57c897

File tree

7 files changed

+100
-65
lines changed

7 files changed

+100
-65
lines changed

.github/workflows/call_release_cdc.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,15 @@ jobs:
115115
TF_VAR_image_tag: ${{ steps.setsha.outputs.short_sha }}
116116
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117117

118-
- name: "Upload Terraform Plan as Artifact"
119-
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
118+
- name: Upload Terraform Plan as Artifact
119+
uses: pagopa/dx/actions/terraform-plan-upload@main
120+
env:
121+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
120122
with:
121-
name: tfplan
122-
path: ${{ env.DIR }}/tfplan-${{ inputs.tf_environment }}-${{ github.sha }}
123-
if-no-files-found: error
124-
retention-days: 14
123+
plan-file: tfplan-${{ inputs.tf_environment }}-${{ github.sha }}
124+
working-directory: ${{ env.DIR }}
125+
artifact-name: terraform-plan
126+
retention-days: 1
125127

126128
release:
127129
name: 'Release'
@@ -148,10 +150,13 @@ jobs:
148150
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
149151

150152
- name: Download Terraform Plan as Artifact
151-
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
153+
uses: pagopa/dx/actions/terraform-plan-download@main
154+
env:
155+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
152156
with:
153-
name: tfplan
154-
path: ${{ env.DIR }}
157+
plan-file: tfplan-${{ inputs.tf_environment }}-${{ github.sha }}
158+
working-directory: ${{ env.DIR }}
159+
artifact-name: terraform-plan
155160

156161
- name: Retrieve Terraform Modules from Cache
157162
id: cache-terraform-modules

.github/workflows/call_release_infra.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ jobs:
6969
env:
7070
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7171

72-
- name: "Upload Terraform Plan as Artifact"
73-
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
72+
- name: Upload Terraform Plan as Artifact
73+
uses: pagopa/dx/actions/terraform-plan-upload@main
74+
env:
75+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
7476
with:
75-
name: tfplan
76-
path: ${{ inputs.dir }}/tfplan-${{ env.TERRAFORM_ENVIRONMENT }}-${{ github.sha }}
77-
if-no-files-found: error
78-
retention-days: 14
77+
plan-file: tfplan-${{ env.TERRAFORM_ENVIRONMENT }}-${{ github.sha }}
78+
working-directory: ${{ inputs.dir }}
79+
artifact-name: terraform-plan
80+
retention-days: 1
7981

8082
apply:
8183
name: 'Terraform Apply'
@@ -100,12 +102,15 @@ jobs:
100102
client-id: ${{ secrets.ARM_CLIENT_ID }}
101103
tenant-id: ${{ vars.ARM_TENANT_ID }}
102104
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
103-
105+
104106
- name: Download Terraform Plan as Artifact
105-
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
107+
uses: pagopa/dx/actions/terraform-plan-download@main
108+
env:
109+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
106110
with:
107-
name: tfplan
108-
path: ${{ inputs.dir }}
111+
plan-file: tfplan-${{ env.TERRAFORM_ENVIRONMENT }}-${{ github.sha }}
112+
working-directory: ${{ inputs.dir }}
113+
artifact-name: terraform-plan
109114

110115
- name: Retrieve Terraform Modules from Cache
111116
id: cache-terraform-modules

.github/workflows/call_release_ms.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,16 @@ jobs:
115115
env:
116116
TF_VAR_image_tag: ${{ steps.setsha.outputs.short_sha }}
117117
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118-
119-
- name: "Upload Terraform Plan as Artifact"
120-
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
118+
119+
- name: Upload Terraform Plan as Artifact
120+
uses: pagopa/dx/actions/terraform-plan-upload@main
121+
env:
122+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
121123
with:
122-
name: tfplan
123-
path: ${{ env.DIR }}/tfplan-${{ inputs.tf_environment }}-${{ github.sha }}
124-
if-no-files-found: error
125-
retention-days: 14
124+
plan-file: tfplan-${{ inputs.tf_environment }}-${{ github.sha }}
125+
working-directory: ${{ env.DIR }}
126+
artifact-name: terraform-plan
127+
retention-days: 1
126128

127129
release:
128130
name: 'Release'
@@ -149,10 +151,13 @@ jobs:
149151
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
150152

151153
- name: Download Terraform Plan as Artifact
152-
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
154+
uses: pagopa/dx/actions/terraform-plan-download@main
155+
env:
156+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
153157
with:
154-
name: tfplan
155-
path: ${{ env.DIR }}
158+
plan-file: tfplan-${{ inputs.tf_environment }}-${{ github.sha }}
159+
working-directory: ${{ env.DIR }}
160+
artifact-name: terraform-plan
156161

157162
- name: Retrieve Terraform Modules from Cache
158163
id: cache-terraform-modules

.github/workflows/call_release_resources_infra.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ jobs:
9292
env:
9393
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9494

95-
- name: "Upload Terraform Plan as Artifact"
96-
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
95+
- name: Upload Terraform Plan as Artifact
96+
uses: pagopa/dx/actions/terraform-plan-upload@main
97+
env:
98+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
9799
with:
98-
name: tfplan
99-
path: ${{ inputs.dir }}/tfplan-${{ env.TERRAFORM_ENVIRONMENT }}-${{ github.sha }}
100-
if-no-files-found: error
101-
retention-days: 14
100+
plan-file: tfplan-${{ env.TERRAFORM_ENVIRONMENT }}-${{ github.sha }}
101+
working-directory: ${{ inputs.dir }}
102+
artifact-name: terraform-plan
103+
retention-days: 1
102104

103105
apply:
104106
name: 'Terraform Apply'
@@ -125,10 +127,13 @@ jobs:
125127
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
126128

127129
- name: Download Terraform Plan as Artifact
128-
uses: actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85 # v4.1.3
130+
uses: pagopa/dx/actions/terraform-plan-download@main
131+
env:
132+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
129133
with:
130-
name: tfplan
131-
path: ${{ inputs.dir }}
134+
plan-file: tfplan-${{ env.TERRAFORM_ENVIRONMENT }}-${{ github.sha }}
135+
working-directory: ${{ inputs.dir }}
136+
artifact-name: terraform-plan
132137

133138
- name: Retrieve Terraform Modules from Cache
134139
id: cache-terraform-modules

.github/workflows/release_hub_spid.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ jobs:
6969
TF_VAR_image_tag: ${{ inputs.release_version }}
7070
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7171

72-
- name: "Upload Terraform Plan as Artifact"
73-
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
72+
- name: Upload Terraform Plan as Artifact
73+
uses: pagopa/dx/actions/terraform-plan-upload@main
74+
env:
75+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
7476
with:
75-
name: tfplan
76-
path: ${{ env.dir }}/tfplan-${{ inputs.env }}-${{ github.sha }}
77-
if-no-files-found: error
78-
retention-days: 14
77+
plan-file: tfplan-${{ inputs.env }}-${{ github.sha }}
78+
working-directory: ${{ env.dir }}
79+
artifact-name: terraform-plan
80+
retention-days: 1
7981

8082
release:
8183
name: 'Release'
@@ -102,10 +104,13 @@ jobs:
102104
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
103105

104106
- name: Download Terraform Plan as Artifact
105-
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
107+
uses: pagopa/dx/actions/terraform-plan-download@main
108+
env:
109+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
106110
with:
107-
name: tfplan
108-
path: ${{ env.dir }}
111+
plan-file: tfplan-${{ inputs.env }}-${{ github.sha }}
112+
working-directory: ${{ env.dir }}
113+
artifact-name: terraform-plan
109114

110115
- name: Retrieve Terraform Modules from Cache
111116
id: cache-terraform-modules

.github/workflows/release_hub_spid_pnpg.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ jobs:
6969
TF_VAR_image_tag: ${{ inputs.release_version }}
7070
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7171

72-
- name: "Upload Terraform Plan as Artifact"
73-
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
72+
- name: Upload Terraform Plan as Artifact
73+
uses: pagopa/dx/actions/terraform-plan-upload@main
74+
env:
75+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
7476
with:
75-
name: tfplan
76-
path: ${{ env.dir }}/tfplan-${{ inputs.env }}-${{ github.sha }}
77-
if-no-files-found: error
78-
retention-days: 14
77+
plan-file: tfplan-${{ inputs.env }}-${{ github.sha }}
78+
working-directory: ${{ env.dir }}
79+
artifact-name: terraform-plan
80+
retention-days: 1
7981

8082
release:
8183
name: 'Release'
@@ -102,10 +104,13 @@ jobs:
102104
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
103105

104106
- name: Download Terraform Plan as Artifact
105-
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
107+
uses: pagopa/dx/actions/terraform-plan-download@main
108+
env:
109+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
106110
with:
107-
name: tfplan
108-
path: ${{ env.dir }}
111+
plan-file: tfplan-${{ inputs.env }}-${{ github.sha }}
112+
working-directory: ${{ env.dir }}
113+
artifact-name: terraform-plan
109114

110115
- name: Retrieve Terraform Modules from Cache
111116
id: cache-terraform-modules

.github/workflows/release_namirial_sign.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ jobs:
6969
TF_VAR_image_tag: ${{ inputs.release_version }}
7070
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7171

72-
- name: "Upload Terraform Plan as Artifact"
73-
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
72+
- name: Upload Terraform Plan as Artifact
73+
uses: pagopa/dx/actions/terraform-plan-upload@main
74+
env:
75+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
7476
with:
75-
name: tfplan
76-
path: ${{ env.dir }}/tfplan-${{ inputs.env }}-${{ github.sha }}
77-
if-no-files-found: error
78-
retention-days: 14
77+
plan-file: tfplan-${{ inputs.env }}-${{ github.sha }}
78+
working-directory: ${{ env.dir }}
79+
artifact-name: terraform-plan
80+
retention-days: 1
7981

8082
release:
8183
name: 'Release'
@@ -102,10 +104,13 @@ jobs:
102104
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
103105

104106
- name: Download Terraform Plan as Artifact
105-
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
107+
uses: pagopa/dx/actions/terraform-plan-download@main
108+
env:
109+
ARTIFACT_ENC_KEY: ${{ secrets.ARTIFACT_ENC_KEY }}
106110
with:
107-
name: tfplan
108-
path: ${{ env.dir }}
111+
plan-file: tfplan-${{ inputs.env }}-${{ github.sha }}
112+
working-directory: ${{ env.dir }}
113+
artifact-name: terraform-plan
109114

110115
- name: Retrieve Terraform Modules from Cache
111116
id: cache-terraform-modules

0 commit comments

Comments
 (0)