Skip to content

Commit

Permalink
feat!: remove concurrency groups and adjust tests (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
swibrow authored Oct 16, 2024
1 parent 5f87d89 commit e255350
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->
<!--- Please describe how you tested your changes -->
- [ ] I have executed `pre-commit run -a` on my pull request
- [ ] I have executed `gen_docs_run` on my pull request
- [ ] I have executed `make gen_docs_run` on my pull request
<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->
17 changes: 14 additions & 3 deletions .github/workflows/_test-tf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ jobs:
run: echo "${{ fromJson(needs.test_tf_feature.outputs.tf_outputs).random_pet }}"

test_tf_plan:
needs: test_tf_feature
uses: ./.github/workflows/tf-plan.yaml
with:
environment: sandbox

test_tf_apply:
needs: test_tf_plan
uses: ./.github/workflows/tf-apply.yaml
with:
environment: sandbox
Expand All @@ -48,6 +46,19 @@ jobs:
environment: sandbox
tf_workspace: test/slash/replacement

test_tf_plan_no_environment:
uses: ./.github/workflows/tf-plan.yaml
with:
aws_account_id: 911453050078
aws_region: eu-central-1
aws_role_name: cicd-iac
tf_dir: tests/terraform/s3
tf_backend_configs: |
bucket=tf-state-911453050078
key=sandbox1.tfstate
workspace_key_prefix=github-workflows
tf_var_files: tests/terraform/s3/environment/sandbox.tfvars

test_upload_artifact:
runs-on: ubuntu-latest
steps:
Expand All @@ -69,7 +80,7 @@ jobs:
file_path="artifact-sample.txt"
test_tf_artifact_all:
needs: test_tf_artifact
needs: test_upload_artifact
uses: ./.github/workflows/tf-plan.yaml
with:
environment: sandbox
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/aws-secrets-copy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
id-token: write
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.destination_aws_oidc_role_arn }}-${{ inputs.destination_secret_name}}
cancel-in-progress: true
steps:
- name: Configure Source AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/tf-apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ jobs:
contents: read
id-token: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ inputs.environment }}
cancel-in-progress: false
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
ENVIRONMENT: ${{ inputs.environment }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_DIR: ${{ inputs.tf_dir || vars.tf_dir || '.' }}
TF_BACKEND_CONFIGS: ${{ inputs.tf_backend_configs || vars.tf_backend_configs }}
Expand Down Expand Up @@ -103,7 +101,7 @@ jobs:
eval "${{ inputs.tf_pre_run }}"
fi
with:
label: ${{ inputs.environment }}
label: ${{ env.ENVIRONMENT }}
path: ${{ env.TF_DIR}}
backend_config: ${{ env.TF_BACKEND_CONFIGS }}
backend_config_file: ${{ env.TF_BACKEND_CONFIG_FILES }}
Expand All @@ -115,6 +113,6 @@ jobs:
if: steps.tf_apply.outputs != ''
uses: tx-pts-dai/[email protected]
with:
summary_header: "Terraform Outputs"
summary_header: "Terraform Outputs | ${{ env.ENVIRONMENT}}"
string: ${{ toJson(steps.tf_apply.outputs) }}
data_type: "json"
3 changes: 0 additions & 3 deletions .github/workflows/tf-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ jobs:
contents: read
id-token: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ inputs.environment }}
cancel-in-progress: false
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tf-destroy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
runs-on: ubuntu-latest
environment: ${{ inputs.environment || null }}
env:
ENVIRONMENT: ${{ inputs.environment }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_DIR: ${{ inputs.tf_dir || vars.tf_dir || '.' }}
TF_BACKEND_CONFIGS: ${{ inputs.tf_backend_configs || vars.tf_backend_configs }}
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/tf-feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ jobs:
contents: read
id-token: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ inputs.environment }}
cancel-in-progress: false
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
Expand Down Expand Up @@ -130,6 +127,6 @@ jobs:
if: steps.tf_apply.outputs != ''
uses: tx-pts-dai/[email protected]
with:
summary_header: "Terraform Outputs"
summary_header: "Terraform Outputs | ${{ env.ENVIRONMENT}}"
string: ${{ toJson(steps.tf_apply.outputs) }}
data_type: "json"
8 changes: 3 additions & 5 deletions .github/workflows/tf-plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ jobs:
contents: read
id-token: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ inputs.environment }}
cancel-in-progress: false
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
ENVIRONMENT: ${{ inputs.environment }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_DIR: ${{ inputs.tf_dir || vars.tf_dir || '.' }}
TF_BACKEND_CONFIGS: ${{ inputs.tf_backend_configs || vars.tf_backend_configs }}
Expand Down Expand Up @@ -117,7 +115,7 @@ jobs:
eval "${{ inputs.tf_pre_run }}"
fi
with:
label: ${{ inputs.environment}}
label: ${{ env.ENVIRONMENT }}
add_github_comment: ${{ inputs.gh_comment }}
path: ${{ env.TF_DIR}}
backend_config: ${{ env.TF_BACKEND_CONFIGS }}
Expand All @@ -129,6 +127,6 @@ jobs:
if: github.event_name == 'pull_request'
uses: tx-pts-dai/[email protected]
with:
summary_header: "Terraform Plan"
summary_header: "Terraform Plan | ${{ env.ENVIRONMENT}} "
path: ${{ steps.plan.outputs.text_plan_path }}
data_type: "terraform"
5 changes: 4 additions & 1 deletion tests/terraform/s3/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
terraform {
backend "s3" {}
backend "s3" {
dynamodb_table = "terraform-lock"
region = "eu-central-1"
}
}

resource "random_pet" "this" {
Expand Down

0 comments on commit e255350

Please sign in to comment.