From ee8ae9080ab9dd5c3e3f865144d6297cf2d56867 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 18 Sep 2024 12:40:26 +0200 Subject: [PATCH 001/121] Be cloud agnostic --- action.yml | 47 ++++++++++++++++++++++++++++++++++---- tests/terraform/atmos.yaml | 7 ++++++ 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 907a0eb7d..278953dbe 100644 --- a/action.yml +++ b/action.yml @@ -82,12 +82,22 @@ runs: run: |- echo "opentofu-version=$(atmos describe config -f json | jq -r '.integrations.github.gitops["opentofu-version"]')" >> $GITHUB_OUTPUT echo "terraform-version=$(atmos describe config -f json | jq -r '.integrations.github.gitops["terraform-version"]')" >> $GITHUB_OUTPUT - echo "enable-infracost=$(atmos describe config -f json | jq -r '.integrations.github.gitops["infracost-enabled"]')" >> $GITHUB_OUTPUT + echo "enable-infracost=$(atmos describe config -f json | jq -r '.integrations.github.gitops["infracost-enabled"]')" >> $GITHUB_OUTPUT + # AWS IAM role for Terraform plan + echo "terraform-plan-role=$(atmos describe config -f json | jq -r '.integrations.github.gitops.role.plan')" >> $GITHUB_OUTPUT + # AWS plan storage settings echo "aws-region=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].region')" >> $GITHUB_OUTPUT echo "terraform-state-role=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].role')" >> $GITHUB_OUTPUT echo "terraform-state-table=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].table')" >> $GITHUB_OUTPUT echo "terraform-state-bucket=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].bucket')" >> $GITHUB_OUTPUT - echo "terraform-plan-role=$(atmos describe config -f json | jq -r '.integrations.github.gitops.role.plan')" >> $GITHUB_OUTPUT + # Azure plan storage settings + echo "plan-repository-type=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["plan-repository-type"]')" >> $GITHUB_OUTPUT + echo "blob-account-name=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["blob-account-name"]')" >> $GITHUB_OUTPUT + echo "blob-container-name=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["blob-container-name"]')" >> $GITHUB_OUTPUT + echo "metadata-repository-type=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["metadata-repository-type"]')" >> $GITHUB_OUTPUT + echo "cosmos-container-name=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["cosmos-container-name"]')" >> $GITHUB_OUTPUT + echo "cosmos-database-name=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["cosmos-database-name"]')" >> $GITHUB_OUTPUT + echo "cosmos-endpoint=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["cosmos-endpoint"]')" >> $GITHUB_OUTPUT - name: Install Terraform if: ${{ steps.config.outputs.terraform-version != '' && steps.config.outputs.terraform-version != 'null' }} @@ -108,7 +118,11 @@ runs: tag: v4.11.0 - name: Configure Plan AWS Credentials - uses: aws-actions/configure-aws-credentials@v4.0.2 + uses: aws-actions/configure-aws-credentials@v4 + if: ${{ steps.config.outputs.aws-region != '' && + steps.config.outputs.aws-region != 'null' && + steps.config.outputs.terraform-plan-role != '' && + steps.config.outputs.terraform-plan-role != 'null' }} with: aws-region: ${{ steps.config.outputs.aws-region }} role-to-assume: ${{ steps.config.outputs.terraform-plan-role }} @@ -265,8 +279,12 @@ runs: rm -f ${TERRAFORM_OUTPUT_FILE} - name: Configure State AWS Credentials - if: ${{ steps.atmos-plan.outputs.error == 'false' }} - uses: aws-actions/configure-aws-credentials@v4.0.2 + uses: aws-actions/configure-aws-credentials@v4 + if: ${{ steps.atmos-plan.outputs.error == 'false' && + steps.config.outputs.aws-region != '' && + steps.config.outputs.aws-region != 'null' && + steps.config.outputs.terraform-state-role != '' && + steps.config.outputs.terraform-state-role != 'null' }} with: aws-region: ${{ steps.config.outputs.aws-region }} role-to-assume: ${{ steps.config.outputs.terraform-state-role }} @@ -283,8 +301,18 @@ runs: planPath: ${{ steps.vars.outputs.plan_file }} component: ${{ inputs.component }} stack: ${{ inputs.stack }} + # AWS settings tableName: ${{ steps.config.outputs.terraform-state-table }} bucketName: ${{ steps.config.outputs.terraform-state-bucket }} + # Azure settings + planRepositoryType: ${{ steps.config.outputs.plan-repository-type }} + blobAccountName: ${{ steps.config.outputs.blob-account-name }} + blobContainerName: ${{ steps.config.outputs.blob-container-name }} + metadataRepositoryType: ${{ steps.config.outputs.metadata-repository-type }} + cosmosContainerName: ${{ steps.config.outputs.cosmos-container-name }} + cosmosDatabaseName: ${{ steps.config.outputs.cosmos-database-name }} + cosmosEndpoint: ${{ steps.config.outputs.cosmos-endpoint }} + - name: Store Lockfile for New Plan if: ${{ steps.atmos-plan.outputs.error == 'false' }} @@ -295,8 +323,17 @@ runs: planPath: ${{ steps.vars.outputs.lock_file }} component: ${{ inputs.component }} stack: ${{ inputs.stack }}-lockfile + # AWS settings tableName: ${{ steps.config.outputs.terraform-state-table }} bucketName: ${{ steps.config.outputs.terraform-state-bucket }} + # Azure settings + planRepositoryType: ${{ steps.config.outputs.plan-repository-type }} + blobAccountName: ${{ steps.config.outputs.blob-account-name }} + blobContainerName: ${{ steps.config.outputs.blob-container-name }} + metadataRepositoryType: ${{ steps.config.outputs.metadata-repository-type }} + cosmosContainerName: ${{ steps.config.outputs.cosmos-container-name }} + cosmosDatabaseName: ${{ steps.config.outputs.cosmos-database-name }} + cosmosEndpoint: ${{ steps.config.outputs.cosmos-endpoint }} - name: Setup Infracost if: ${{ steps.config.outputs.enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index b5b6a9a7e..98cfe2c5d 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,6 +74,13 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ + plan-repository-type: azureblob + blob-account-name: tfplans + blob-container-name: plans + metadata-repository-type: cosmos + cosmos-container-name: terraform-plan-storage + cosmos-database-name: terraform-plan-storage + cosmos-endpoint: "https://my-cosmo-account.documents.azure.com:443/" role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ From 1397d4fe8c4432bf54c1a478a2db31ca3fd87719 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 18 Sep 2024 12:50:43 +0200 Subject: [PATCH 002/121] Be cloud agnostic --- tests/terraform/atmos.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index 98cfe2c5d..ed534b23d 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,13 +74,13 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: azureblob - blob-account-name: tfplans - blob-container-name: plans - metadata-repository-type: cosmos - cosmos-container-name: terraform-plan-storage - cosmos-database-name: terraform-plan-storage - cosmos-endpoint: "https://my-cosmo-account.documents.azure.com:443/" + plan-repository-type: + blob-account-name: + blob-container-name: + metadata-repository-type: + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ From 4fe650f0d522ce1b070207dc9715584c0861f67b Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 18 Sep 2024 13:00:08 +0200 Subject: [PATCH 003/121] Be cloud agnostic --- action.yml | 65 +++++++++++++++++++++++++++++++++++--- tests/terraform/atmos.yaml | 2 +- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 278953dbe..cab93bd1e 100644 --- a/action.yml +++ b/action.yml @@ -291,8 +291,12 @@ runs: role-session-name: "atmos-terraform-state-gitops" mask-aws-account-id: "no" - - name: Store New Plan - if: ${{ steps.atmos-plan.outputs.error == 'false' }} + - name: Store New Plan (AWS) + if: ${{ steps.atmos-plan.outputs.error == 'false' && + steps.config.outputs.terraform-state-table != '' && + steps.config.outputs.terraform-state-table != 'null' && + steps.config.outputs.terraform-state-bucket != '' && + steps.config.outputs.terraform-state-bucket != 'null' }} uses: cloudposse/github-action-terraform-plan-storage@v1 id: store-plan with: @@ -304,6 +308,31 @@ runs: # AWS settings tableName: ${{ steps.config.outputs.terraform-state-table }} bucketName: ${{ steps.config.outputs.terraform-state-bucket }} + + - name: Store New Plan (Azure) + if: ${{ steps.atmos-plan.outputs.error == 'false' && + steps.config.outputs.plan-repository-type != '' && + steps.config.outputs.plan-repository-type != 'null' && + steps.config.outputs.blob-account-name != '' && + steps.config.outputs.blob-account-name != 'null' + steps.config.outputs.blob-container-name != '' && + steps.config.outputs.blob-container-name != 'null' + steps.config.outputs.metadata-repository-type != '' && + steps.config.outputs.metadata-repository-type != 'null' + steps.config.outputs.cosmos-container-name != '' && + steps.config.outputs.cosmos-container-name != 'null' + steps.config.outputs.cosmos-database-name != '' && + steps.config.outputs.cosmos-database-name != 'null' + steps.config.outputs.cosmos-endpoint != '' && + steps.config.outputs.cosmos-endpoint != 'null' }} + uses: cloudposse/github-action-terraform-plan-storage@v1 + id: store-plan + with: + action: storePlan + commitSHA: ${{ inputs.sha }} + planPath: ${{ steps.vars.outputs.plan_file }} + component: ${{ inputs.component }} + stack: ${{ inputs.stack }} # Azure settings planRepositoryType: ${{ steps.config.outputs.plan-repository-type }} blobAccountName: ${{ steps.config.outputs.blob-account-name }} @@ -314,8 +343,12 @@ runs: cosmosEndpoint: ${{ steps.config.outputs.cosmos-endpoint }} - - name: Store Lockfile for New Plan - if: ${{ steps.atmos-plan.outputs.error == 'false' }} + - name: Store Lockfile for New Plan (AWS) + if: ${{ steps.atmos-plan.outputs.error == 'false' && + steps.config.outputs.terraform-state-table != '' && + steps.config.outputs.terraform-state-table != 'null' && + steps.config.outputs.terraform-state-bucket != '' && + steps.config.outputs.terraform-state-bucket != 'null' }} uses: cloudposse/github-action-terraform-plan-storage@v1 with: action: storePlan @@ -326,6 +359,30 @@ runs: # AWS settings tableName: ${{ steps.config.outputs.terraform-state-table }} bucketName: ${{ steps.config.outputs.terraform-state-bucket }} + + - name: Store Lockfile for New Plan (Azure) + if: ${{ steps.atmos-plan.outputs.error == 'false' && + steps.config.outputs.plan-repository-type != '' && + steps.config.outputs.plan-repository-type != 'null' && + steps.config.outputs.blob-account-name != '' && + steps.config.outputs.blob-account-name != 'null' + steps.config.outputs.blob-container-name != '' && + steps.config.outputs.blob-container-name != 'null' + steps.config.outputs.metadata-repository-type != '' && + steps.config.outputs.metadata-repository-type != 'null' + steps.config.outputs.cosmos-container-name != '' && + steps.config.outputs.cosmos-container-name != 'null' + steps.config.outputs.cosmos-database-name != '' && + steps.config.outputs.cosmos-database-name != 'null' + steps.config.outputs.cosmos-endpoint != '' && + steps.config.outputs.cosmos-endpoint != 'null' }} + uses: cloudposse/github-action-terraform-plan-storage@v1 + with: + action: storePlan + commitSHA: ${{ inputs.sha }} + planPath: ${{ steps.vars.outputs.lock_file }} + component: ${{ inputs.component }} + stack: ${{ inputs.stack }}-lockfile # Azure settings planRepositoryType: ${{ steps.config.outputs.plan-repository-type }} blobAccountName: ${{ steps.config.outputs.blob-account-name }} diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index ed534b23d..5946bce52 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -80,7 +80,7 @@ integrations: metadata-repository-type: cosmos-container-name: cosmos-database-name: - cosmos-endpoint: + cosmos-endpoint: role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ From 74f7f7ce9b317232f433560dff419c86ea404dfd Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 18 Sep 2024 13:08:17 +0200 Subject: [PATCH 004/121] Be cloud agnostic --- action.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index cab93bd1e..7f3ec155b 100644 --- a/action.yml +++ b/action.yml @@ -314,15 +314,15 @@ runs: steps.config.outputs.plan-repository-type != '' && steps.config.outputs.plan-repository-type != 'null' && steps.config.outputs.blob-account-name != '' && - steps.config.outputs.blob-account-name != 'null' + steps.config.outputs.blob-account-name != 'null' && steps.config.outputs.blob-container-name != '' && - steps.config.outputs.blob-container-name != 'null' + steps.config.outputs.blob-container-name != 'null' && steps.config.outputs.metadata-repository-type != '' && - steps.config.outputs.metadata-repository-type != 'null' + steps.config.outputs.metadata-repository-type != 'null' && steps.config.outputs.cosmos-container-name != '' && - steps.config.outputs.cosmos-container-name != 'null' + steps.config.outputs.cosmos-container-name != 'null' && steps.config.outputs.cosmos-database-name != '' && - steps.config.outputs.cosmos-database-name != 'null' + steps.config.outputs.cosmos-database-name != 'null' && steps.config.outputs.cosmos-endpoint != '' && steps.config.outputs.cosmos-endpoint != 'null' }} uses: cloudposse/github-action-terraform-plan-storage@v1 @@ -365,15 +365,15 @@ runs: steps.config.outputs.plan-repository-type != '' && steps.config.outputs.plan-repository-type != 'null' && steps.config.outputs.blob-account-name != '' && - steps.config.outputs.blob-account-name != 'null' + steps.config.outputs.blob-account-name != 'null' && steps.config.outputs.blob-container-name != '' && - steps.config.outputs.blob-container-name != 'null' + steps.config.outputs.blob-container-name != 'null' && steps.config.outputs.metadata-repository-type != '' && - steps.config.outputs.metadata-repository-type != 'null' + steps.config.outputs.metadata-repository-type != 'null' && steps.config.outputs.cosmos-container-name != '' && - steps.config.outputs.cosmos-container-name != 'null' + steps.config.outputs.cosmos-container-name != 'null' && steps.config.outputs.cosmos-database-name != '' && - steps.config.outputs.cosmos-database-name != 'null' + steps.config.outputs.cosmos-database-name != 'null' && steps.config.outputs.cosmos-endpoint != '' && steps.config.outputs.cosmos-endpoint != 'null' }} uses: cloudposse/github-action-terraform-plan-storage@v1 From 88ea3ed31b60e81f4275d567c97b7b3fcaa03124 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 18 Sep 2024 13:11:29 +0200 Subject: [PATCH 005/121] Be cloud agnostic --- action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/action.yml b/action.yml index 7f3ec155b..3c1b770b8 100644 --- a/action.yml +++ b/action.yml @@ -298,7 +298,6 @@ runs: steps.config.outputs.terraform-state-bucket != '' && steps.config.outputs.terraform-state-bucket != 'null' }} uses: cloudposse/github-action-terraform-plan-storage@v1 - id: store-plan with: action: storePlan commitSHA: ${{ inputs.sha }} @@ -326,7 +325,6 @@ runs: steps.config.outputs.cosmos-endpoint != '' && steps.config.outputs.cosmos-endpoint != 'null' }} uses: cloudposse/github-action-terraform-plan-storage@v1 - id: store-plan with: action: storePlan commitSHA: ${{ inputs.sha }} From 5b31e4da04e84ede3e751ef9cd97b788bad7ac86 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 18 Sep 2024 13:16:14 +0200 Subject: [PATCH 006/121] Be cloud agnostic --- tests/terraform/atmos.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index 5946bce52..98cfe2c5d 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,13 +74,13 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: - blob-account-name: - blob-container-name: - metadata-repository-type: - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: + plan-repository-type: azureblob + blob-account-name: tfplans + blob-container-name: plans + metadata-repository-type: cosmos + cosmos-container-name: terraform-plan-storage + cosmos-database-name: terraform-plan-storage + cosmos-endpoint: "https://my-cosmo-account.documents.azure.com:443/" role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ From fe84e837629580ab45ee909fb438fb467758032e Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 18 Sep 2024 22:34:12 +0300 Subject: [PATCH 007/121] Update atmos.yaml --- tests/terraform/atmos.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index 98cfe2c5d..b42963e5c 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,13 +74,13 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: azureblob - blob-account-name: tfplans - blob-container-name: plans - metadata-repository-type: cosmos - cosmos-container-name: terraform-plan-storage - cosmos-database-name: terraform-plan-storage - cosmos-endpoint: "https://my-cosmo-account.documents.azure.com:443/" + plan-repository-type: + blob-account-name: + blob-container-name: + metadata-repository-type: + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ From 17c444e6d8292f72a37c34664d07a4274b3d4a9d Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 19 Sep 2024 17:38:50 +0200 Subject: [PATCH 008/121] Added readme --- README.yaml | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/README.yaml b/README.yaml index f5ec6d6fe..8d00ccb0e 100644 --- a/README.yaml +++ b/README.yaml @@ -55,14 +55,24 @@ usage: |- ### Config + > [!IMPORTANT] + > **Please note!** This GitHub Action only works with `atmos >= 1.63.0`. If you are using `atmos < 1.63.0` please use `v1` version of this action. + The action expects the atmos configuration file `atmos.yaml` to be present in the repository. + + The action supports AWS and Azure to store Terraform plan files. + You can read more about plan storage in the [cloudposse/github-action-terraform-plan-storage](https://github.com/cloudposse/github-action-terraform-plan-storage?tab=readme-ov-file#aws-default) documentation. + Depends of cloud provider the following fields should be set in the `atmos.yaml`: + + #### AWS + The config should have the following structure: ```yaml integrations: github: gitops: - opentofu-version: 1.7.3 + opentofu-version: 1.7.3 terraform-version: 1.5.2 infracost-enabled: false artifact-storage: @@ -71,15 +81,38 @@ usage: |- table: cptest-core-ue2-auto-gitops-plan-storage role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha role: + # Set `plan` empty if you don't want to assume IAM role before terraform plan plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops matrix: sort-by: .stack_slug group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") ``` + + #### Azure - > [!IMPORTANT] - > **Please note!** This GitHub Action only works with `atmos >= 1.63.0`. If you are using `atmos < 1.63.0` please use `v1` version of this action. + The config should have the following structure: + + ```yaml + integrations: + github: + gitops: + opentofu-version: 1.7.3 + terraform-version: 1.5.2 + infracost-enabled: false + artifact-storage: + plan-repository-type: azureblob + blob-account-name: tfplans + blob-container-name: plans + metadata-repository-type: cosmos + cosmos-container-name: terraform-plan-storage + cosmos-database-name: terraform-plan-storage + cosmos-endpoint: "https://my-cosmo-account.documents.azure.com:443/" + # We remove the `role` section as it is AWS specific + matrix: + sort-by: .stack_slug + group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") + ``` ### Support OpenTofu From 19cf0a29e7d9be11ea3d44c404cbefd93b9ca393 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sat, 19 Oct 2024 21:45:24 -0700 Subject: [PATCH 009/121] Adding azure, cache restore, and use atmos-get-setting --- action.yml | 307 ++++++++++++++++++++++++----------------------------- 1 file changed, 139 insertions(+), 168 deletions(-) diff --git a/action.yml b/action.yml index 12f500d20..8f67ca79a 100644 --- a/action.yml +++ b/action.yml @@ -51,6 +51,10 @@ inputs: not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. default: ${{ github.server_url == 'https://github.com' && github.token || '' }} + restore-cache: + description: "Restore cache from previous job if needed. Useful when other files are automatically generated by the pipeline but not commited. Uses inputs.sha as cache key to restore." + required: false + default: 'false' outputs: summary: description: "Summary" @@ -76,34 +80,93 @@ runs: token: ${{ inputs.token }} install-wrapper: false - - name: config - shell: bash - id: config - run: |- - echo "opentofu-version=$(atmos describe config -f json | jq -r '.integrations.github.gitops["opentofu-version"]')" >> $GITHUB_OUTPUT - echo "terraform-version=$(atmos describe config -f json | jq -r '.integrations.github.gitops["terraform-version"]')" >> $GITHUB_OUTPUT - echo "enable-infracost=$(atmos describe config -f json | jq -r '.integrations.github.gitops["infracost-enabled"]')" >> $GITHUB_OUTPUT - # AWS IAM role for Terraform plan - echo "terraform-plan-role=$(atmos describe config -f json | jq -r '.integrations.github.gitops.role.plan')" >> $GITHUB_OUTPUT - # AWS plan storage settings - echo "aws-region=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].region')" >> $GITHUB_OUTPUT - echo "terraform-state-role=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].role')" >> $GITHUB_OUTPUT - echo "terraform-state-table=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].table')" >> $GITHUB_OUTPUT - echo "terraform-state-bucket=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].bucket')" >> $GITHUB_OUTPUT - # Azure plan storage settings - echo "plan-repository-type=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["plan-repository-type"]')" >> $GITHUB_OUTPUT - echo "blob-account-name=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["blob-account-name"]')" >> $GITHUB_OUTPUT - echo "blob-container-name=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["blob-container-name"]')" >> $GITHUB_OUTPUT - echo "metadata-repository-type=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["metadata-repository-type"]')" >> $GITHUB_OUTPUT - echo "cosmos-container-name=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["cosmos-container-name"]')" >> $GITHUB_OUTPUT - echo "cosmos-database-name=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["cosmos-database-name"]')" >> $GITHUB_OUTPUT - echo "cosmos-endpoint=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]["cosmos-endpoint"]')" >> $GITHUB_OUTPUT + - name: Get atmos settings + id: atmos-settings + uses: cloudposse/github-action-atmos-get-setting@v2 + with: + settings: | + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.github.actions_enabled + outputPath: enabled + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: component_info.component_path + outputPath: component-path + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: atmos_cli_config.base_path + outputPath: base-path + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: command + outputPath: command + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.opentofu-version + outputPath: opentofu-version + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.terraform-version + outputPath: terraform-version + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.infracost-enabled + outputPath: enable-infracost + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.role.plan + outputPath: terraform-plan-role + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.region + outputPath: aws-region + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.role + outputPath: terraform-state-role + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.table + outputPath: terraform-state-table + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.bucket + outputPath: terraform-state-bucket + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.plan-repository-type + outputPath: plan-repository-type + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.blob-account-name + outputPath: blob-account-name + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.blob-container-name + outputPath: blob-container-name + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.metadata-repository-type + outputPath: metadata-repository-type + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-container-name + outputPath: cosmos-container-name + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-database-name + outputPath: cosmos-database-name + - component: ${{ inputs.component }} + stack: ${{ inputs.stack }} + settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-endpoint + outputPath: cosmos-endpoint - name: Install Terraform - if: ${{ steps.config.outputs.terraform-version != '' && steps.config.outputs.terraform-version != 'null' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-version != '' && fromJson(steps.atmos-settings.outputs.settings).terraform-version != 'null' }} uses: hashicorp/setup-terraform@v3 with: - terraform_version: ${{ steps.config.outputs.terraform-version }} + terraform_version: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-version }} terraform_wrapper: false - name: Install Dependencies @@ -112,69 +175,51 @@ runs: cache: true config: |- opentofu/opentofu: - tag: ${{ startsWith(steps.config.outputs.opentofu-version, 'v') && steps.config.outputs.opentofu-version || format('v{0}', steps.config.outputs.opentofu-version) }} - skip: ${{ steps.config.outputs.opentofu-version == '' || steps.config.outputs.opentofu-version == 'null' }} + tag: ${{ startsWith(fromJson(steps.atmos-settings.outputs.settings).opentofu-version, 'v') && fromJson(steps.atmos-settings.outputs.settings).opentofu-version || format('v{0}', fromJson(steps.atmos-settings.outputs.settings).opentofu-version) }} + skip: ${{ fromJson(steps.atmos-settings.outputs.settings).opentofu-version == '' || fromJson(steps.atmos-settings.outputs.settings).opentofu-version == 'null' }} suzuki-shunsuke/tfcmt: tag: v4.11.0 - name: Configure Plan AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ steps.config.outputs.aws-region != '' && - steps.config.outputs.aws-region != 'null' && - steps.config.outputs.terraform-plan-role != '' && - steps.config.outputs.terraform-plan-role != 'null' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type != 'azureblob' }} with: - aws-region: ${{ steps.config.outputs.aws-region }} - role-to-assume: ${{ steps.config.outputs.terraform-plan-role }} + aws-region: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region }} + role-to-assume: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role }} role-session-name: "atmos-terraform-plan-gitops" mask-aws-account-id: "no" - - name: Get atmos settings - uses: cloudposse/github-action-atmos-get-setting@v1 - id: component + - name: Restore cache + if: ${{ inputs.restore-cache == 'true' }} + uses: actions/cache/restore@v4 with: - settings: | - - component: ${{ inputs.component }} - stack: ${{ inputs.stack }} - settingsPath: settings.github.actions_enabled - outputPath: enabled - - component: ${{ inputs.component }} - stack: ${{ inputs.stack }} - settingsPath: component_info.component_path - outputPath: component-path - - component: ${{ inputs.component }} - stack: ${{ inputs.stack }} - settingsPath: atmos_cli_config.base_path - outputPath: base-path - - component: ${{ inputs.component }} - stack: ${{ inputs.stack }} - settingsPath: command - outputPath: command + path: atmos + key: ${{ runner.os }}-${{ inputs.sha}} - name: Set atmos cli base path vars - if: ${{ fromJson(steps.component.outputs.settings).enabled }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} shell: bash run: |- # Set ATMOS_BASE_PATH allow `cloudposse/utils` provider to read atmos config from the correct path - ATMOS_BASE_PATH="${{ fromJson(steps.component.outputs.settings).base-path }}" + ATMOS_BASE_PATH="${{ fromJson(steps.atmos-settings.outputs.settings).base-path }}" echo "ATMOS_BASE_PATH=$(realpath ${ATMOS_BASE_PATH:-./})" >> $GITHUB_ENV - name: Prepare Artifacts Directory - if: ${{ fromJson(steps.component.outputs.settings).enabled }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} shell: bash run: | mkdir -p metadata - name: Define Job Variables - if: ${{ fromJson(steps.component.outputs.settings).enabled }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} id: vars shell: bash run: | STACK_NAME=$(echo "${{ inputs.stack }}" | sed 's#/#_#g') - COMPONENT_PATH=${{ fromJson(steps.component.outputs.settings).component-path }} + COMPONENT_PATH=${{ fromJson(steps.atmos-settings.outputs.settings).component-path }} COMPONENT_NAME=$(echo "${{ inputs.component }}" | sed 's#/#_#g') COMPONENT_SLUG="$STACK_NAME-$COMPONENT_NAME" - COMPONENT_CACHE_KEY=$(basename "${{ fromJson(steps.component.outputs.settings).component-path }}") + COMPONENT_CACHE_KEY=$(basename "${{ fromJson(steps.atmos-settings.outputs.settings).component-path }}") PLAN_FILE="$( realpath ${COMPONENT_PATH})/$COMPONENT_SLUG-${{ inputs.sha }}.planfile" LOCK_FILE="$( realpath ${COMPONENT_PATH})/.terraform.lock.hcl" @@ -197,14 +242,14 @@ runs: - name: Cache .terraform id: cache uses: actions/cache@v4 - if: ${{ fromJson(steps.component.outputs.settings).enabled }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} with: path: | ./${{ steps.vars.outputs.component_path }}/.terraform key: ${{ steps.vars.outputs.cache-key }} - name: Atmos Terraform Plan - if: ${{ fromJson(steps.component.outputs.settings).enabled }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} id: atmos-plan shell: bash run: | @@ -224,7 +269,7 @@ runs: -var "job:${{ github.job }}" \ -var "logoImage:${{ inputs.branding-logo-image }}" \ -var "logoUrl:${{ inputs.branding-logo-url }}" \ - -var "infracost_enabled:${{ steps.config.outputs.enable-infracost }}" \ + -var "infracost_enabled:${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" \ -var "driftModeEnabled:${{ inputs.drift-detection-mode-enabled }}" \ --output ${{ steps.vars.outputs.summary_file }} \ --log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \ @@ -280,50 +325,15 @@ runs: - name: Configure State AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ steps.atmos-plan.outputs.error == 'false' && - steps.config.outputs.aws-region != '' && - steps.config.outputs.aws-region != 'null' && - steps.config.outputs.terraform-state-role != '' && - steps.config.outputs.terraform-state-role != 'null' }} + if: ${{ steps.atmos-plan.outputs.error == 'false' && fromJson(steps.atmos-settings.outputs.settings).plan-repository-type != 'azureblob' }} with: - aws-region: ${{ steps.config.outputs.aws-region }} - role-to-assume: ${{ steps.config.outputs.terraform-state-role }} + aws-region: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region }} + role-to-assume: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-role }} role-session-name: "atmos-terraform-state-gitops" mask-aws-account-id: "no" - - name: Store New Plan (AWS) - if: ${{ steps.atmos-plan.outputs.error == 'false' && - steps.config.outputs.terraform-state-table != '' && - steps.config.outputs.terraform-state-table != 'null' && - steps.config.outputs.terraform-state-bucket != '' && - steps.config.outputs.terraform-state-bucket != 'null' }} - uses: cloudposse/github-action-terraform-plan-storage@v1 - with: - action: storePlan - commitSHA: ${{ inputs.sha }} - planPath: ${{ steps.vars.outputs.plan_file }} - component: ${{ inputs.component }} - stack: ${{ inputs.stack }} - # AWS settings - tableName: ${{ steps.config.outputs.terraform-state-table }} - bucketName: ${{ steps.config.outputs.terraform-state-bucket }} - - - name: Store New Plan (Azure) - if: ${{ steps.atmos-plan.outputs.error == 'false' && - steps.config.outputs.plan-repository-type != '' && - steps.config.outputs.plan-repository-type != 'null' && - steps.config.outputs.blob-account-name != '' && - steps.config.outputs.blob-account-name != 'null' && - steps.config.outputs.blob-container-name != '' && - steps.config.outputs.blob-container-name != 'null' && - steps.config.outputs.metadata-repository-type != '' && - steps.config.outputs.metadata-repository-type != 'null' && - steps.config.outputs.cosmos-container-name != '' && - steps.config.outputs.cosmos-container-name != 'null' && - steps.config.outputs.cosmos-database-name != '' && - steps.config.outputs.cosmos-database-name != 'null' && - steps.config.outputs.cosmos-endpoint != '' && - steps.config.outputs.cosmos-endpoint != 'null' }} + - name: Store New Plan + if: ${{ steps.atmos-plan.outputs.error == 'false' }} uses: cloudposse/github-action-terraform-plan-storage@v1 with: action: storePlan @@ -331,22 +341,18 @@ runs: planPath: ${{ steps.vars.outputs.plan_file }} component: ${{ inputs.component }} stack: ${{ inputs.stack }} - # Azure settings - planRepositoryType: ${{ steps.config.outputs.plan-repository-type }} - blobAccountName: ${{ steps.config.outputs.blob-account-name }} - blobContainerName: ${{ steps.config.outputs.blob-container-name }} - metadataRepositoryType: ${{ steps.config.outputs.metadata-repository-type }} - cosmosContainerName: ${{ steps.config.outputs.cosmos-container-name }} - cosmosDatabaseName: ${{ steps.config.outputs.cosmos-database-name }} - cosmosEndpoint: ${{ steps.config.outputs.cosmos-endpoint }} - - - - name: Store Lockfile for New Plan (AWS) - if: ${{ steps.atmos-plan.outputs.error == 'false' && - steps.config.outputs.terraform-state-table != '' && - steps.config.outputs.terraform-state-table != 'null' && - steps.config.outputs.terraform-state-bucket != '' && - steps.config.outputs.terraform-state-bucket != 'null' }} + planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type }} + blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name }} + blobContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-container-name }} + metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type }} + cosmosContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-container-name }} + cosmosDatabaseName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-database-name }} + cosmosEndpoint: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-endpoint }} + tableName: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-table }} + bucketName: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-bucket }} + + - name: Store Lockfile for New Plan + if: ${{ steps.atmos-plan.outputs.error == 'false' }} uses: cloudposse/github-action-terraform-plan-storage@v1 with: action: storePlan @@ -354,57 +360,31 @@ runs: planPath: ${{ steps.vars.outputs.lock_file }} component: ${{ inputs.component }} stack: ${{ inputs.stack }}-lockfile - # AWS settings - tableName: ${{ steps.config.outputs.terraform-state-table }} - bucketName: ${{ steps.config.outputs.terraform-state-bucket }} - - - name: Store Lockfile for New Plan (Azure) - if: ${{ steps.atmos-plan.outputs.error == 'false' && - steps.config.outputs.plan-repository-type != '' && - steps.config.outputs.plan-repository-type != 'null' && - steps.config.outputs.blob-account-name != '' && - steps.config.outputs.blob-account-name != 'null' && - steps.config.outputs.blob-container-name != '' && - steps.config.outputs.blob-container-name != 'null' && - steps.config.outputs.metadata-repository-type != '' && - steps.config.outputs.metadata-repository-type != 'null' && - steps.config.outputs.cosmos-container-name != '' && - steps.config.outputs.cosmos-container-name != 'null' && - steps.config.outputs.cosmos-database-name != '' && - steps.config.outputs.cosmos-database-name != 'null' && - steps.config.outputs.cosmos-endpoint != '' && - steps.config.outputs.cosmos-endpoint != 'null' }} - uses: cloudposse/github-action-terraform-plan-storage@v1 - with: - action: storePlan - commitSHA: ${{ inputs.sha }} - planPath: ${{ steps.vars.outputs.lock_file }} - component: ${{ inputs.component }} - stack: ${{ inputs.stack }}-lockfile - # Azure settings - planRepositoryType: ${{ steps.config.outputs.plan-repository-type }} - blobAccountName: ${{ steps.config.outputs.blob-account-name }} - blobContainerName: ${{ steps.config.outputs.blob-container-name }} - metadataRepositoryType: ${{ steps.config.outputs.metadata-repository-type }} - cosmosContainerName: ${{ steps.config.outputs.cosmos-container-name }} - cosmosDatabaseName: ${{ steps.config.outputs.cosmos-database-name }} - cosmosEndpoint: ${{ steps.config.outputs.cosmos-endpoint }} + planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type }} + blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name }} + blobContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-container-name }} + metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type }} + cosmosContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-container-name }} + cosmosDatabaseName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-database-name }} + cosmosEndpoint: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-endpoint }} + tableName: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-table }} + bucketName: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-bucket }} - name: Setup Infracost - if: ${{ steps.config.outputs.enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} uses: infracost/actions/setup@v3 with: api-key: ${{ inputs.infracost-api-key }} - name: Convert PLANFILE to JSON - if: ${{ steps.config.outputs.enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} shell: bash working-directory: ./${{ steps.vars.outputs.component_path }} run: | - ${{ fromJson(steps.component.outputs.settings).command }} show -json "${{ steps.vars.outputs.plan_file }}" > "${{ steps.vars.outputs.plan_file }}.json" + ${{ fromJson(steps.atmos-settings.outputs.settings).command }} show -json "${{ steps.vars.outputs.plan_file }}" > "${{ steps.vars.outputs.plan_file }}.json" - name: Generate Infracost Diff - if: ${{ steps.config.outputs.enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} id: infracost shell: bash run: | @@ -449,7 +429,7 @@ runs: sed -i -e '/%INFRACOST_DIFF%/{r /tmp/infracost.txt' -e 'd}' ${{ steps.vars.outputs.step_summary_file }} - name: Store Component Metadata to Artifacts - if: ${{ fromJson(steps.component.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }} shell: bash run: | echo -n '{ "stack": "${{ inputs.stack }}", "component": "${{ inputs.component }}", "componentPath": "${{ steps.vars.outputs.component_path }}", "drifted": '"${{ steps.atmos-plan.outputs.changes }}"', "error": '"${{ steps.atmos-plan.outputs.error }}"' }' > "metadata/${{ steps.vars.outputs.component_slug }}.metadata.json" @@ -493,17 +473,8 @@ runs: echo "rand=$(openssl rand -hex 5)" >> "$GITHUB_OUTPUT" - name: Upload Artifacts - if: ${{ fromJson(steps.component.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }} uses: actions/upload-artifact@v4 with: # The name of the artifact needs to be unique for every job run! - # This name is filtered in cloudposse/github-action-atmos-terraform-drift-detection by the "metadata-*" prefix - name: metadata-${{ github.run_id }}-${{ steps.generate.outputs.rand }} - path: metadata - retention-days: ${{ inputs.metadata-retention-days }} - - - name: Exit status - if: ${{ fromJson(steps.component.outputs.settings).enabled }} - shell: bash - run: | - exit ${{ steps.atmos-plan.outputs.result }} + # This name is filtered in cloudposse/github-action-atmos-terraform \ No newline at end of file From f8e62f76a7ec56da8ed7b90a1558e3225cee9232 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sat, 19 Oct 2024 22:06:01 -0700 Subject: [PATCH 010/121] Adding azure, cache restore, and use atmos-get-setting --- action.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 8f67ca79a..8370e8be1 100644 --- a/action.yml +++ b/action.yml @@ -473,8 +473,17 @@ runs: echo "rand=$(openssl rand -hex 5)" >> "$GITHUB_OUTPUT" - name: Upload Artifacts - if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }} + if: ${{ fromJson(steps.component.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }} uses: actions/upload-artifact@v4 with: # The name of the artifact needs to be unique for every job run! - # This name is filtered in cloudposse/github-action-atmos-terraform \ No newline at end of file + # This name is filtered in cloudposse/github-action-atmos-terraform-drift-detection by the "metadata-*" prefix + name: metadata-${{ github.run_id }}-${{ steps.generate.outputs.rand }} + path: metadata + retention-days: ${{ inputs.metadata-retention-days }} + + - name: Exit status + if: ${{ fromJson(steps.component.outputs.settings).enabled }} + shell: bash + run: | + exit ${{ steps.atmos-plan.outputs.result }} \ No newline at end of file From b6cfcd742f557a5ea3b8521033299ae5f4b0d890 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sat, 19 Oct 2024 22:56:30 -0700 Subject: [PATCH 011/121] Adding azure, cache restore, and use atmos-get-setting --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 8370e8be1..8c9daf070 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ inputs: atmos-version: description: The version of atmos to install required: false - default: ">= 1.63.0" + default: ">= 1.92.0" atmos-config-path: description: The path to the atmos.yaml file required: true From 3a3bc970a6a331219aaab2582f5b4d4859e4028c Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sat, 19 Oct 2024 23:01:47 -0700 Subject: [PATCH 012/121] Adding azure, cache restore, and use atmos-get-setting --- .github/workflows/integration-tests.yml | 2 +- .github/workflows/test-changes-exists-drift.yml | 2 +- .github/workflows/test-changes-exists.yml | 2 +- .github/workflows/test-failed-plan-drift.yml | 2 +- .github/workflows/test-failed-plan.yml | 2 +- .github/workflows/test-infra-cost.yml | 2 +- .github/workflows/test-no-changes-drift-more.yml | 2 +- .github/workflows/test-no-changes.yml | 2 +- .github/workflows/test-settings-action-disabled-drift.yml | 2 +- .github/workflows/test-settings-action-disabled.yml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 8ecabff0e..5bb010df5 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -41,4 +41,4 @@ jobs: component: "foobar" stack: "plat-ue2-sandbox" atmos-config-path: ${{ runner.temp }} - atmos-version: v1.81.0 + atmos-version: 1.92.0 diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index 5d9cf8c32..2ec20594d 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -50,7 +50,7 @@ jobs: sha: ${{ github.sha }} drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index 8279550bb..942df4659 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -48,7 +48,7 @@ jobs: stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-failed-plan-drift.yml b/.github/workflows/test-failed-plan-drift.yml index a3cf64cc7..f8f01b89a 100644 --- a/.github/workflows/test-failed-plan-drift.yml +++ b/.github/workflows/test-failed-plan-drift.yml @@ -50,7 +50,7 @@ jobs: sha: ${{ github.sha }} drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 05714dffe..1899969c5 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -49,7 +49,7 @@ jobs: stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index db52f05f5..0e924ead8 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -51,7 +51,7 @@ jobs: infracost-api-key: ${{ secrets.INFRACOST_API_KEY }} debug: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-no-changes-drift-more.yml b/.github/workflows/test-no-changes-drift-more.yml index b436a9f43..1bdb55c29 100644 --- a/.github/workflows/test-no-changes-drift-more.yml +++ b/.github/workflows/test-no-changes-drift-more.yml @@ -49,7 +49,7 @@ jobs: sha: ${{ github.sha }} drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-no-changes.yml b/.github/workflows/test-no-changes.yml index 56bd7064b..bea103667 100644 --- a/.github/workflows/test-no-changes.yml +++ b/.github/workflows/test-no-changes.yml @@ -48,7 +48,7 @@ jobs: stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-settings-action-disabled-drift.yml b/.github/workflows/test-settings-action-disabled-drift.yml index be9d6df3d..637bd26c2 100644 --- a/.github/workflows/test-settings-action-disabled-drift.yml +++ b/.github/workflows/test-settings-action-disabled-drift.yml @@ -49,7 +49,7 @@ jobs: sha: ${{ github.sha }} drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-settings-action-disabled.yml b/.github/workflows/test-settings-action-disabled.yml index 6bc59389a..289d05c25 100644 --- a/.github/workflows/test-settings-action-disabled.yml +++ b/.github/workflows/test-settings-action-disabled.yml @@ -48,7 +48,7 @@ jobs: stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} - atmos-version: 1.81.0 + atmos-version: 1.92.0 outputs: result: ${{ steps.current.outcome }} From a2f075b69a7be01d3dfaeed26e8cdcf2be8bf3fc Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 12:27:55 -0700 Subject: [PATCH 013/121] Fixing tests --- tests/terraform/atmos.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index b42963e5c..30abd9958 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,7 +74,7 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: + plan-repository-type: azureblob blob-account-name: blob-container-name: metadata-repository-type: From efd8d588b9b51da02c318be735f6f41d2d184ff6 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 12:47:20 -0700 Subject: [PATCH 014/121] Fixing tests --- .../stacks/catalog/foobar-changes.yaml | 18 ++++++++++++++++++ .../stacks/catalog/foobar-disabled.yaml | 19 +++++++++++++++++++ .../terraform/stacks/catalog/foobar-fail.yaml | 18 ++++++++++++++++++ tests/terraform/stacks/catalog/foobar.yaml | 18 ++++++++++++++++++ 4 files changed, 73 insertions(+) diff --git a/tests/terraform/stacks/catalog/foobar-changes.yaml b/tests/terraform/stacks/catalog/foobar-changes.yaml index edd546794..b6e8790da 100644 --- a/tests/terraform/stacks/catalog/foobar-changes.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes.yaml @@ -5,6 +5,24 @@ components: settings: github: actions_enabled: true + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: azureblob + blob-account-name: + blob-container-name: + metadata-repository-type: + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/terraform/stacks/catalog/foobar-disabled.yaml b/tests/terraform/stacks/catalog/foobar-disabled.yaml index dea88ba5b..dd2e59846 100644 --- a/tests/terraform/stacks/catalog/foobar-disabled.yaml +++ b/tests/terraform/stacks/catalog/foobar-disabled.yaml @@ -4,6 +4,25 @@ components: settings: github: actions_enabled: false + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: azureblob + blob-account-name: + blob-container-name: + metadata-repository-type: + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ + vars: example: blue enabled: true diff --git a/tests/terraform/stacks/catalog/foobar-fail.yaml b/tests/terraform/stacks/catalog/foobar-fail.yaml index adf352793..120a76043 100644 --- a/tests/terraform/stacks/catalog/foobar-fail.yaml +++ b/tests/terraform/stacks/catalog/foobar-fail.yaml @@ -5,6 +5,24 @@ components: settings: github: actions_enabled: true + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: azureblob + blob-account-name: + blob-container-name: + metadata-repository-type: + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index 53ba98fa2..cb09234e2 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -4,6 +4,24 @@ components: settings: github: actions_enabled: true + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: azureblob + blob-account-name: + blob-container-name: + metadata-repository-type: + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: false From 2f02e912b7b83f8ab36211d8a1951acdbdf06fd4 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:06:21 -0700 Subject: [PATCH 015/121] Fixing tests --- .github/workflows/integration-tests.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 5bb010df5..23953b102 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -25,15 +25,19 @@ jobs: - shell: bash run: | mkdir -p ${{ runner.temp }} - cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + for file in ${{ runner.temp }}/*.yaml; do + if [ -f "$file" ]; then + sed -i -e 's#__INFRACOST_ENABLED__#false#g' "$file" + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' "$file" + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' "$file" + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' "$file" + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' "$file" + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' "$file" + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' "$file" + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' "$file" + fi + done - name: Plan Atmos Component uses: ./ From 018dfcbc0be851bae10ab0c09b501e6eafd72f16 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:12:25 -0700 Subject: [PATCH 016/121] Fixing tests --- .github/workflows/integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 23953b102..26e1e6ca3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -38,6 +38,7 @@ jobs: sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' "$file" fi done + ls -l ${{ runner.temp }}/ - name: Plan Atmos Component uses: ./ From 2b9c490cfa608f68b8a32dff983e526d3d754bf4 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:17:32 -0700 Subject: [PATCH 017/121] Fixing tests --- .github/workflows/integration-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 26e1e6ca3..43f4db3d8 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -26,7 +26,8 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - for file in ${{ runner.temp }}/*.yaml; do + + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e 's#__INFRACOST_ENABLED__#false#g' "$file" sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' "$file" @@ -38,7 +39,7 @@ jobs: sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' "$file" fi done - ls -l ${{ runner.temp }}/ + cat ./tests/terraform/stacks/catalog/foobar.yaml - name: Plan Atmos Component uses: ./ From fa9e842a295c40eeb88351579945aec9b13615fb Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:24:34 -0700 Subject: [PATCH 018/121] Fixing tests --- action.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/action.yml b/action.yml index 8c9daf070..5b208dc22 100644 --- a/action.yml +++ b/action.yml @@ -103,63 +103,63 @@ runs: outputPath: command - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.opentofu-version + settingsPath: settings.github.gitops.opentofu-version outputPath: opentofu-version - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.terraform-version + settingsPath: settings.github.gitops.terraform-version outputPath: terraform-version - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.infracost-enabled + settingsPath: settings.github.gitops.infracost-enabled outputPath: enable-infracost - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.role.plan + settingsPath: settings.github.gitops.role.plan outputPath: terraform-plan-role - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.region + settingsPath: settings.github.gitops.artifact-storage.region outputPath: aws-region - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.role + settingsPath: settings.github.gitops.artifact-storage.role outputPath: terraform-state-role - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.table + settingsPath: settings.github.gitops.artifact-storage.table outputPath: terraform-state-table - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.bucket + settingsPath: settings.github.gitops.artifact-storage.bucket outputPath: terraform-state-bucket - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.plan-repository-type + settingsPath: settings.github.gitops.artifact-storage.plan-repository-type outputPath: plan-repository-type - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.blob-account-name + settingsPath: settings.github.gitops.artifact-storage.blob-account-name outputPath: blob-account-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.blob-container-name + settingsPath: settings.github.gitops.artifact-storage.blob-container-name outputPath: blob-container-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.metadata-repository-type + settingsPath: settings.github.gitops.artifact-storage.metadata-repository-type outputPath: metadata-repository-type - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-container-name + settingsPath: settings.github.gitops.artifact-storage.cosmos-container-name outputPath: cosmos-container-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-database-name + settingsPath: settings.github.gitops.artifact-storage.cosmos-database-name outputPath: cosmos-database-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-endpoint + settingsPath: settings.github.gitops.artifact-storage.cosmos-endpoint outputPath: cosmos-endpoint - name: Install Terraform From ebfcb2de10d558b9549f9bfe84377accfca051d3 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:25:55 -0700 Subject: [PATCH 019/121] Fixing tests --- tests/terraform/stacks/catalog/foobar-changes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/terraform/stacks/catalog/foobar-changes.yaml b/tests/terraform/stacks/catalog/foobar-changes.yaml index b6e8790da..01fcda509 100644 --- a/tests/terraform/stacks/catalog/foobar-changes.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes.yaml @@ -16,7 +16,7 @@ components: plan-repository-type: azureblob blob-account-name: blob-container-name: - metadata-repository-type: + metadata-repository-type: azureblob cosmos-container-name: cosmos-database-name: cosmos-endpoint: From 832baf128a5b88b3a21647aba2b5ebc6e0e4da0c Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:33:09 -0700 Subject: [PATCH 020/121] Fixing tests --- tests/terraform/stacks/catalog/foobar-changes.yaml | 2 +- tests/terraform/stacks/catalog/foobar-disabled.yaml | 2 +- tests/terraform/stacks/catalog/foobar-fail.yaml | 2 +- tests/terraform/stacks/catalog/foobar.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/terraform/stacks/catalog/foobar-changes.yaml b/tests/terraform/stacks/catalog/foobar-changes.yaml index 01fcda509..fd703396d 100644 --- a/tests/terraform/stacks/catalog/foobar-changes.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes.yaml @@ -16,7 +16,7 @@ components: plan-repository-type: azureblob blob-account-name: blob-container-name: - metadata-repository-type: azureblob + metadata-repository-type: cosmos cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar-disabled.yaml b/tests/terraform/stacks/catalog/foobar-disabled.yaml index dd2e59846..3b4267851 100644 --- a/tests/terraform/stacks/catalog/foobar-disabled.yaml +++ b/tests/terraform/stacks/catalog/foobar-disabled.yaml @@ -15,7 +15,7 @@ components: plan-repository-type: azureblob blob-account-name: blob-container-name: - metadata-repository-type: + metadata-repository-type: cosmos cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar-fail.yaml b/tests/terraform/stacks/catalog/foobar-fail.yaml index 120a76043..ae363adba 100644 --- a/tests/terraform/stacks/catalog/foobar-fail.yaml +++ b/tests/terraform/stacks/catalog/foobar-fail.yaml @@ -16,7 +16,7 @@ components: plan-repository-type: azureblob blob-account-name: blob-container-name: - metadata-repository-type: + metadata-repository-type: cosmos cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index cb09234e2..1a0bb444d 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -15,7 +15,7 @@ components: plan-repository-type: azureblob blob-account-name: blob-container-name: - metadata-repository-type: + metadata-repository-type: cosmos cosmos-container-name: cosmos-database-name: cosmos-endpoint: From 9f0bd6c39b0c9eadc2efea7bcbea656b81320277 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:58:23 -0700 Subject: [PATCH 021/121] Fixing tests --- action.yml | 4 ++-- tests/terraform/stacks/catalog/foobar-changes.yaml | 4 ++-- tests/terraform/stacks/catalog/foobar-disabled.yaml | 4 ++-- tests/terraform/stacks/catalog/foobar-fail.yaml | 4 ++-- tests/terraform/stacks/catalog/foobar.yaml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index 5b208dc22..461caaa66 100644 --- a/action.yml +++ b/action.yml @@ -182,7 +182,7 @@ runs: - name: Configure Plan AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type != 'azureblob' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 'aws' }} with: aws-region: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region }} role-to-assume: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role }} @@ -325,7 +325,7 @@ runs: - name: Configure State AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ steps.atmos-plan.outputs.error == 'false' && fromJson(steps.atmos-settings.outputs.settings).plan-repository-type != 'azureblob' }} + if: ${{ steps.atmos-plan.outputs.error == 'false' && fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 'aws' }} with: aws-region: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region }} role-to-assume: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-role }} diff --git a/tests/terraform/stacks/catalog/foobar-changes.yaml b/tests/terraform/stacks/catalog/foobar-changes.yaml index fd703396d..db8dcf3c8 100644 --- a/tests/terraform/stacks/catalog/foobar-changes.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes.yaml @@ -13,10 +13,10 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: azureblob + plan-repository-type: aws blob-account-name: blob-container-name: - metadata-repository-type: cosmos + metadata-repository-type: dynamodb cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar-disabled.yaml b/tests/terraform/stacks/catalog/foobar-disabled.yaml index 3b4267851..3711419e6 100644 --- a/tests/terraform/stacks/catalog/foobar-disabled.yaml +++ b/tests/terraform/stacks/catalog/foobar-disabled.yaml @@ -12,10 +12,10 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: azureblob + plan-repository-type: aws blob-account-name: blob-container-name: - metadata-repository-type: cosmos + metadata-repository-type: dynamodb cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar-fail.yaml b/tests/terraform/stacks/catalog/foobar-fail.yaml index ae363adba..75c1b490f 100644 --- a/tests/terraform/stacks/catalog/foobar-fail.yaml +++ b/tests/terraform/stacks/catalog/foobar-fail.yaml @@ -13,10 +13,10 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: azureblob + plan-repository-type: aws blob-account-name: blob-container-name: - metadata-repository-type: cosmos + metadata-repository-type: dynamodb cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index 1a0bb444d..214c86431 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -12,10 +12,10 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: azureblob + plan-repository-type: aws blob-account-name: blob-container-name: - metadata-repository-type: cosmos + metadata-repository-type: dynamodb cosmos-container-name: cosmos-database-name: cosmos-endpoint: From 5733b2b75b51031aa7b801115fd3c28a849f6eab Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 15:47:06 -0700 Subject: [PATCH 022/121] Fixing tests --- action.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index 461caaa66..d9b8f0013 100644 --- a/action.yml +++ b/action.yml @@ -63,10 +63,17 @@ outputs: runs: using: "composite" steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.sha }} + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # ref: ${{ inputs.sha }} + + # - name: Restore cache + # if: ${{ inputs.restore-cache == 'true' }} + # uses: actions/cache/restore@v4 + # with: + # path: atmos + # key: ${{ runner.os }}-${{ inputs.sha}} - name: Set atmos cli config path vars shell: bash @@ -189,13 +196,6 @@ runs: role-session-name: "atmos-terraform-plan-gitops" mask-aws-account-id: "no" - - name: Restore cache - if: ${{ inputs.restore-cache == 'true' }} - uses: actions/cache/restore@v4 - with: - path: atmos - key: ${{ runner.os }}-${{ inputs.sha}} - - name: Set atmos cli base path vars if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} shell: bash From e5fbce8cbb5ff1420d1d4ca31234f251eb2b80bd Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 15:51:07 -0700 Subject: [PATCH 023/121] Fixing tests --- .github/workflows/integration-tests.yml | 16 ++++++++-------- .../terraform/stacks/catalog/foobar-changes.yaml | 2 +- .../stacks/catalog/foobar-disabled.yaml | 2 +- tests/terraform/stacks/catalog/foobar-fail.yaml | 2 +- tests/terraform/stacks/catalog/foobar.yaml | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 43f4db3d8..c9b6c1398 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -29,14 +29,14 @@ jobs: for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then - sed -i -e 's#__INFRACOST_ENABLED__#false#g' "$file" - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' "$file" - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' "$file" - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' "$file" - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' "$file" - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' "$file" - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' "$file" - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' "$file" + sed -i -e "s#__INFRACOST_ENABLED__#false#g' "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" fi done cat ./tests/terraform/stacks/catalog/foobar.yaml diff --git a/tests/terraform/stacks/catalog/foobar-changes.yaml b/tests/terraform/stacks/catalog/foobar-changes.yaml index db8dcf3c8..3b8d81b1d 100644 --- a/tests/terraform/stacks/catalog/foobar-changes.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes.yaml @@ -16,7 +16,7 @@ components: plan-repository-type: aws blob-account-name: blob-container-name: - metadata-repository-type: dynamodb + metadata-repository-type: dynamo cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar-disabled.yaml b/tests/terraform/stacks/catalog/foobar-disabled.yaml index 3711419e6..0aa80801c 100644 --- a/tests/terraform/stacks/catalog/foobar-disabled.yaml +++ b/tests/terraform/stacks/catalog/foobar-disabled.yaml @@ -15,7 +15,7 @@ components: plan-repository-type: aws blob-account-name: blob-container-name: - metadata-repository-type: dynamodb + metadata-repository-type: dynamo cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar-fail.yaml b/tests/terraform/stacks/catalog/foobar-fail.yaml index 75c1b490f..7059f5cf0 100644 --- a/tests/terraform/stacks/catalog/foobar-fail.yaml +++ b/tests/terraform/stacks/catalog/foobar-fail.yaml @@ -16,7 +16,7 @@ components: plan-repository-type: aws blob-account-name: blob-container-name: - metadata-repository-type: dynamodb + metadata-repository-type: dynamo cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index 214c86431..929b47f6d 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -15,7 +15,7 @@ components: plan-repository-type: aws blob-account-name: blob-container-name: - metadata-repository-type: dynamodb + metadata-repository-type: dynamo cosmos-container-name: cosmos-database-name: cosmos-endpoint: From 043990e4b6ff9904b656771438e92c7348fc1d53 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 15:51:55 -0700 Subject: [PATCH 024/121] Fixing tests --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c9b6c1398..e7f7fb004 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -29,7 +29,7 @@ jobs: for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g' "$file" + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" From 13d4a845c185f859a4a5a11521824bfa916410fd Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 15:54:37 -0700 Subject: [PATCH 025/121] Fixing tests --- action.yml | 24 +++++++++---------- .../stacks/catalog/foobar-changes.yaml | 2 +- .../stacks/catalog/foobar-disabled.yaml | 2 +- .../terraform/stacks/catalog/foobar-fail.yaml | 2 +- tests/terraform/stacks/catalog/foobar.yaml | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/action.yml b/action.yml index d9b8f0013..e175b889e 100644 --- a/action.yml +++ b/action.yml @@ -63,17 +63,17 @@ outputs: runs: using: "composite" steps: - # - name: Checkout - # uses: actions/checkout@v4 - # with: - # ref: ${{ inputs.sha }} + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.sha }} - # - name: Restore cache - # if: ${{ inputs.restore-cache == 'true' }} - # uses: actions/cache/restore@v4 - # with: - # path: atmos - # key: ${{ runner.os }}-${{ inputs.sha}} + - name: Restore cache + if: ${{ inputs.restore-cache == 'true' }} + uses: actions/cache/restore@v4 + with: + path: atmos + key: ${{ runner.os }}-${{ inputs.sha}} - name: Set atmos cli config path vars shell: bash @@ -189,7 +189,7 @@ runs: - name: Configure Plan AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 'aws' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' }} with: aws-region: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region }} role-to-assume: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role }} @@ -325,7 +325,7 @@ runs: - name: Configure State AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ steps.atmos-plan.outputs.error == 'false' && fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 'aws' }} + if: ${{ steps.atmos-plan.outputs.error == 'false' && fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' }} with: aws-region: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region }} role-to-assume: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-role }} diff --git a/tests/terraform/stacks/catalog/foobar-changes.yaml b/tests/terraform/stacks/catalog/foobar-changes.yaml index 3b8d81b1d..e2399e98b 100644 --- a/tests/terraform/stacks/catalog/foobar-changes.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes.yaml @@ -13,7 +13,7 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: aws + plan-repository-type: s3 blob-account-name: blob-container-name: metadata-repository-type: dynamo diff --git a/tests/terraform/stacks/catalog/foobar-disabled.yaml b/tests/terraform/stacks/catalog/foobar-disabled.yaml index 0aa80801c..989cc461e 100644 --- a/tests/terraform/stacks/catalog/foobar-disabled.yaml +++ b/tests/terraform/stacks/catalog/foobar-disabled.yaml @@ -12,7 +12,7 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: aws + plan-repository-type: s3 blob-account-name: blob-container-name: metadata-repository-type: dynamo diff --git a/tests/terraform/stacks/catalog/foobar-fail.yaml b/tests/terraform/stacks/catalog/foobar-fail.yaml index 7059f5cf0..758cdb7c8 100644 --- a/tests/terraform/stacks/catalog/foobar-fail.yaml +++ b/tests/terraform/stacks/catalog/foobar-fail.yaml @@ -13,7 +13,7 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: aws + plan-repository-type: s3 blob-account-name: blob-container-name: metadata-repository-type: dynamo diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index 929b47f6d..c2a7011a6 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -12,7 +12,7 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: aws + plan-repository-type: s3 blob-account-name: blob-container-name: metadata-repository-type: dynamo From cd5d07258e530ec58ae6428b0b07d4bfdbecb2de Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 16:47:50 -0700 Subject: [PATCH 026/121] Fixing tests --- .github/workflows/integration-tests.yml | 7 +++++++ action.yml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e7f7fb004..25c6ea2e8 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -41,6 +41,12 @@ jobs: done cat ./tests/terraform/stacks/catalog/foobar.yaml + - name: Cache atmos files + uses: actions/cache@v4 + with: + path: atmos + key: ${{ runner.os }}-${{ github.event.pull_request.head.sha }} + - name: Plan Atmos Component uses: ./ with: @@ -48,3 +54,4 @@ jobs: stack: "plat-ue2-sandbox" atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + restore-cache: true diff --git a/action.yml b/action.yml index e175b889e..9c73ce362 100644 --- a/action.yml +++ b/action.yml @@ -73,7 +73,7 @@ runs: uses: actions/cache/restore@v4 with: path: atmos - key: ${{ runner.os }}-${{ inputs.sha}} + key: ${{ runner.os }}-${{ inputs.sha }} - name: Set atmos cli config path vars shell: bash From 3cf49d1c6ba8166527be1f95a805d1daaced5191 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 16:51:04 -0700 Subject: [PATCH 027/121] Fixing tests --- .github/workflows/integration-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 25c6ea2e8..52ade6f23 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -44,8 +44,8 @@ jobs: - name: Cache atmos files uses: actions/cache@v4 with: - path: atmos - key: ${{ runner.os }}-${{ github.event.pull_request.head.sha }} + path: ./ + key: ${{ runner.os }}-${{ github.sha }} - name: Plan Atmos Component uses: ./ @@ -55,3 +55,4 @@ jobs: atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 restore-cache: true + sha: ${{ github.sha }} From 29cabff82322ca574f234e5afdd8e396a44b43e5 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 16:54:01 -0700 Subject: [PATCH 028/121] Fixing tests --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9c73ce362..062fd4a7c 100644 --- a/action.yml +++ b/action.yml @@ -72,7 +72,7 @@ runs: if: ${{ inputs.restore-cache == 'true' }} uses: actions/cache/restore@v4 with: - path: atmos + path: ./ key: ${{ runner.os }}-${{ inputs.sha }} - name: Set atmos cli config path vars From e049c963fa20073df4db10e9b1db7cbf1105c0dd Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 20:29:54 -0700 Subject: [PATCH 029/121] Fixing tests --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 062fd4a7c..839c17f5f 100644 --- a/action.yml +++ b/action.yml @@ -72,7 +72,7 @@ runs: if: ${{ inputs.restore-cache == 'true' }} uses: actions/cache/restore@v4 with: - path: ./ + path: ./stacks key: ${{ runner.os }}-${{ inputs.sha }} - name: Set atmos cli config path vars From 88bcf5bdbbf0dc3d4ae11c64e877d8d572a3fb3b Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 20:43:12 -0700 Subject: [PATCH 030/121] Fixing tests --- .github/workflows/integration-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 52ade6f23..6aa4664e2 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -13,6 +13,7 @@ env: permissions: id-token: write contents: read + actions: write jobs: test: @@ -44,7 +45,7 @@ jobs: - name: Cache atmos files uses: actions/cache@v4 with: - path: ./ + path: ./stacks key: ${{ runner.os }}-${{ github.sha }} - name: Plan Atmos Component From 91fa2f702f917f86b5da9d6b26057c46c3f7beed Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 20:53:50 -0700 Subject: [PATCH 031/121] Fixing tests --- .github/workflows/integration-tests.yml | 4 ++-- action.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 6aa4664e2..ef5016420 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -45,8 +45,8 @@ jobs: - name: Cache atmos files uses: actions/cache@v4 with: - path: ./stacks - key: ${{ runner.os }}-${{ github.sha }} + path: ./ + key: ${{ github.sha }} - name: Plan Atmos Component uses: ./ diff --git a/action.yml b/action.yml index 839c17f5f..02e25b86b 100644 --- a/action.yml +++ b/action.yml @@ -72,8 +72,8 @@ runs: if: ${{ inputs.restore-cache == 'true' }} uses: actions/cache/restore@v4 with: - path: ./stacks - key: ${{ runner.os }}-${{ inputs.sha }} + path: ./ + key: ${{ inputs.sha }} - name: Set atmos cli config path vars shell: bash From 0a40bc120dda56f390f63cceb04d9d753804582c Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 21:05:48 -0700 Subject: [PATCH 032/121] Fixing tests --- .github/workflows/integration-tests.yml | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index ef5016420..14cb530dd 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -46,7 +46,7 @@ jobs: uses: actions/cache@v4 with: path: ./ - key: ${{ github.sha }} + key: atmos - name: Plan Atmos Component uses: ./ diff --git a/action.yml b/action.yml index 02e25b86b..cee3fe7e6 100644 --- a/action.yml +++ b/action.yml @@ -73,7 +73,7 @@ runs: uses: actions/cache/restore@v4 with: path: ./ - key: ${{ inputs.sha }} + key: atmos - name: Set atmos cli config path vars shell: bash From 341ce9a5a564235eaba6b3163ded319c0e645307 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Sun, 20 Oct 2024 21:17:21 -0700 Subject: [PATCH 033/121] Fixing tests --- .github/workflows/integration-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 14cb530dd..d2b374050 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -14,6 +14,7 @@ permissions: id-token: write contents: read actions: write + pull-requests: write jobs: test: @@ -56,4 +57,4 @@ jobs: atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 restore-cache: true - sha: ${{ github.sha }} + #sha: ${{ github.sha }} From a57d7ff89b80f97c462e99411be14e5593dfcbac Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:39:59 -0700 Subject: [PATCH 034/121] Fixing tests --- .github/workflows/integration-tests.yml | 6 ------ action.yml | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index d2b374050..90a70acfa 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -43,12 +43,6 @@ jobs: done cat ./tests/terraform/stacks/catalog/foobar.yaml - - name: Cache atmos files - uses: actions/cache@v4 - with: - path: ./ - key: atmos - - name: Plan Atmos Component uses: ./ with: diff --git a/action.yml b/action.yml index cee3fe7e6..818b3695c 100644 --- a/action.yml +++ b/action.yml @@ -67,14 +67,8 @@ runs: uses: actions/checkout@v4 with: ref: ${{ inputs.sha }} + clean: ${{ inputs.restore-cache != 'true' }} - - name: Restore cache - if: ${{ inputs.restore-cache == 'true' }} - uses: actions/cache/restore@v4 - with: - path: ./ - key: atmos - - name: Set atmos cli config path vars shell: bash run: |- From cea520e27af916ab2011f35d64306186008aef95 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:46:21 -0700 Subject: [PATCH 035/121] Fixing tests --- .github/workflows/integration-tests.yml | 6 ++++++ action.yml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 90a70acfa..a53a2f131 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -43,6 +43,12 @@ jobs: done cat ./tests/terraform/stacks/catalog/foobar.yaml + - name: Cache atmos files + uses: actions/cache@v4 + with: + path: ./ + key: atmos-${{ github.sha }} + - name: Plan Atmos Component uses: ./ with: diff --git a/action.yml b/action.yml index 818b3695c..a0b8a1b85 100644 --- a/action.yml +++ b/action.yml @@ -69,6 +69,13 @@ runs: ref: ${{ inputs.sha }} clean: ${{ inputs.restore-cache != 'true' }} + - name: Restore cache + if: ${{ inputs.restore-cache == 'true' }} + uses: actions/cache/restore@v4 + with: + path: ./ + key: atmos-${{ inputs.sha }} + - name: Set atmos cli config path vars shell: bash run: |- From f68610870bf040804c7e73a6af2e64d26fe1c798 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:52:44 -0700 Subject: [PATCH 036/121] Fixing tests --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a53a2f131..ba1dc8539 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -57,4 +57,4 @@ jobs: atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 restore-cache: true - #sha: ${{ github.sha }} + sha: ${{ github.sha }} From ef900a5af486889359359556df330412af3aee70 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Mon, 21 Oct 2024 21:57:39 -0700 Subject: [PATCH 037/121] Fixing tests --- .github/workflows/integration-tests.yml | 12 ++++++------ action.yml | 8 +------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index ba1dc8539..717dd29df 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -43,11 +43,11 @@ jobs: done cat ./tests/terraform/stacks/catalog/foobar.yaml - - name: Cache atmos files - uses: actions/cache@v4 - with: - path: ./ - key: atmos-${{ github.sha }} + # - name: Cache atmos files + # uses: actions/cache@v4 + # with: + # path: ./ + # key: atmos-${{ github.sha }} - name: Plan Atmos Component uses: ./ @@ -57,4 +57,4 @@ jobs: atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 restore-cache: true - sha: ${{ github.sha }} + # sha: ${{ github.sha }} diff --git a/action.yml b/action.yml index a0b8a1b85..9c3834fe7 100644 --- a/action.yml +++ b/action.yml @@ -64,17 +64,11 @@ runs: using: "composite" steps: - name: Checkout + if: ${{ inputs.restore-cache == 'false' }} uses: actions/checkout@v4 with: ref: ${{ inputs.sha }} clean: ${{ inputs.restore-cache != 'true' }} - - - name: Restore cache - if: ${{ inputs.restore-cache == 'true' }} - uses: actions/cache/restore@v4 - with: - path: ./ - key: atmos-${{ inputs.sha }} - name: Set atmos cli config path vars shell: bash From 0538861a454e75af710df33f7846cd1e3eb82316 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:18:44 -0700 Subject: [PATCH 038/121] Fixing tests --- action.yml | 9 ++++----- tests/terraform/atmos.yaml | 17 ----------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/action.yml b/action.yml index 9c3834fe7..6c6d09f75 100644 --- a/action.yml +++ b/action.yml @@ -51,8 +51,8 @@ inputs: not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. default: ${{ github.server_url == 'https://github.com' && github.token || '' }} - restore-cache: - description: "Restore cache from previous job if needed. Useful when other files are automatically generated by the pipeline but not commited. Uses inputs.sha as cache key to restore." + do-not-checkout: + description: "Disable actions/checkout. Useful for when the checkout happens in a previous step and file are modified outside of git through other actions" required: false default: 'false' outputs: @@ -64,12 +64,11 @@ runs: using: "composite" steps: - name: Checkout - if: ${{ inputs.restore-cache == 'false' }} + if: ${{ inputs.do-not-checkout == 'false' }} uses: actions/checkout@v4 with: ref: ${{ inputs.sha }} - clean: ${{ inputs.restore-cache != 'true' }} - + - name: Set atmos cli config path vars shell: bash run: |- diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index 30abd9958..7dd3dc6a7 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -67,23 +67,6 @@ workflows: integrations: github: gitops: - terraform-version: 1.5.2 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: azureblob - blob-account-name: - blob-container-name: - metadata-repository-type: - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ matrix: sort-by: .stack_slug group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") From 31f1b2d0160c51ef8ee17c8995af860ac1c1e751 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:21:26 -0700 Subject: [PATCH 039/121] Fixing tests --- .github/workflows/integration-tests.yml | 13 ++--------- .../workflows/test-changes-exists-drift.yml | 21 +++++++++++------- .github/workflows/test-changes-exists.yml | 21 +++++++++++------- .github/workflows/test-failed-plan-drift.yml | 21 +++++++++++------- .github/workflows/test-failed-plan.yml | 21 +++++++++++------- .github/workflows/test-infra-cost.yml | 21 +++++++++++------- .../workflows/test-no-changes-drift-more.yml | 22 +++++++++++-------- .github/workflows/test-no-changes.yml | 22 +++++++++++-------- .../test-settings-action-disabled-drift.yml | 21 +++++++++++------- .../test-settings-action-disabled.yml | 21 +++++++++++------- 10 files changed, 119 insertions(+), 85 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 717dd29df..4ea21a53d 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -28,7 +28,6 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" @@ -41,14 +40,7 @@ jobs: sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" fi done - cat ./tests/terraform/stacks/catalog/foobar.yaml - - # - name: Cache atmos files - # uses: actions/cache@v4 - # with: - # path: ./ - # key: atmos-${{ github.sha }} - + - name: Plan Atmos Component uses: ./ with: @@ -56,5 +48,4 @@ jobs: stack: "plat-ue2-sandbox" atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 - restore-cache: true - # sha: ${{ github.sha }} + do-not-checkout: true \ No newline at end of file diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index 2ec20594d..de02733d3 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -31,14 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/opentofu/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component @@ -51,6 +55,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index 942df4659..341f4e20c 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -31,14 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component id: current @@ -49,6 +53,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-failed-plan-drift.yml b/.github/workflows/test-failed-plan-drift.yml index f8f01b89a..39c60dc1e 100644 --- a/.github/workflows/test-failed-plan-drift.yml +++ b/.github/workflows/test-failed-plan-drift.yml @@ -31,14 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component @@ -51,6 +55,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 1899969c5..d21569840 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -31,14 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sefor file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component @@ -50,6 +54,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 0e924ead8..20a542cdc 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -31,14 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#true#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component @@ -52,6 +56,7 @@ jobs: debug: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-no-changes-drift-more.yml b/.github/workflows/test-no-changes-drift-more.yml index 1bdb55c29..e253b994b 100644 --- a/.github/workflows/test-no-changes-drift-more.yml +++ b/.github/workflows/test-no-changes-drift-more.yml @@ -31,15 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component id: current uses: ./ @@ -50,6 +53,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-no-changes.yml b/.github/workflows/test-no-changes.yml index bea103667..a1be26bc6 100644 --- a/.github/workflows/test-no-changes.yml +++ b/.github/workflows/test-no-changes.yml @@ -31,15 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component id: current uses: ./ @@ -49,6 +52,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-settings-action-disabled-drift.yml b/.github/workflows/test-settings-action-disabled-drift.yml index 637bd26c2..704ed2bd2 100644 --- a/.github/workflows/test-settings-action-disabled-drift.yml +++ b/.github/workflows/test-settings-action-disabled-drift.yml @@ -31,14 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component id: current @@ -50,6 +54,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-settings-action-disabled.yml b/.github/workflows/test-settings-action-disabled.yml index 289d05c25..bb744d012 100644 --- a/.github/workflows/test-settings-action-disabled.yml +++ b/.github/workflows/test-settings-action-disabled.yml @@ -31,14 +31,18 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done - name: Plan Atmos Component id: current @@ -49,6 +53,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 + do-not-checkout: true outputs: result: ${{ steps.current.outcome }} From 50b462a6b390f1d9951676584fb3fccf517e7906 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:27:40 -0700 Subject: [PATCH 040/121] Fixing tests --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 6c6d09f75..898b34eae 100644 --- a/action.yml +++ b/action.yml @@ -467,7 +467,7 @@ runs: echo "rand=$(openssl rand -hex 5)" >> "$GITHUB_OUTPUT" - name: Upload Artifacts - if: ${{ fromJson(steps.component.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }} uses: actions/upload-artifact@v4 with: # The name of the artifact needs to be unique for every job run! @@ -477,7 +477,7 @@ runs: retention-days: ${{ inputs.metadata-retention-days }} - name: Exit status - if: ${{ fromJson(steps.component.outputs.settings).enabled }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} shell: bash run: | exit ${{ steps.atmos-plan.outputs.result }} \ No newline at end of file From a530dabe4403253a8cddd1951c2039f643c7f95e Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:31:59 -0700 Subject: [PATCH 041/121] Fixing tests --- .github/workflows/test-failed-plan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index d21569840..7dd754c74 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -31,7 +31,7 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sefor file in ./tests/terraform/stacks/catalog/*.yaml; do + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" From 68a95f5ad902fbd33f7715d14877d9b53af28cf9 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 19:58:07 -0700 Subject: [PATCH 042/121] Fixing tests --- tests/opentofu/atmos.yaml | 9 --------- .../stacks/catalog/foobar-changes.yaml | 18 +++++++++++++++++ .../stacks/catalog/foobar-disabled.yaml | 20 ++++++++++++++++++- .../opentofu/stacks/catalog/foobar-fail.yaml | 18 +++++++++++++++++ tests/opentofu/stacks/catalog/foobar.yaml | 18 +++++++++++++++++ 5 files changed, 73 insertions(+), 10 deletions(-) diff --git a/tests/opentofu/atmos.yaml b/tests/opentofu/atmos.yaml index 43083bc0c..e77539467 100644 --- a/tests/opentofu/atmos.yaml +++ b/tests/opentofu/atmos.yaml @@ -72,15 +72,6 @@ integrations: github: gitops: opentofu-version: 1.7.3 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ matrix: sort-by: .stack_slug group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") diff --git a/tests/opentofu/stacks/catalog/foobar-changes.yaml b/tests/opentofu/stacks/catalog/foobar-changes.yaml index edd546794..e2399e98b 100644 --- a/tests/opentofu/stacks/catalog/foobar-changes.yaml +++ b/tests/opentofu/stacks/catalog/foobar-changes.yaml @@ -5,6 +5,24 @@ components: settings: github: actions_enabled: true + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/opentofu/stacks/catalog/foobar-disabled.yaml b/tests/opentofu/stacks/catalog/foobar-disabled.yaml index dea88ba5b..6ce30ce9d 100644 --- a/tests/opentofu/stacks/catalog/foobar-disabled.yaml +++ b/tests/opentofu/stacks/catalog/foobar-disabled.yaml @@ -3,7 +3,25 @@ components: foobar-disabled: settings: github: - actions_enabled: false + actions_enabled: true + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/opentofu/stacks/catalog/foobar-fail.yaml b/tests/opentofu/stacks/catalog/foobar-fail.yaml index adf352793..758cdb7c8 100644 --- a/tests/opentofu/stacks/catalog/foobar-fail.yaml +++ b/tests/opentofu/stacks/catalog/foobar-fail.yaml @@ -5,6 +5,24 @@ components: settings: github: actions_enabled: true + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/opentofu/stacks/catalog/foobar.yaml b/tests/opentofu/stacks/catalog/foobar.yaml index 53ba98fa2..c2a7011a6 100644 --- a/tests/opentofu/stacks/catalog/foobar.yaml +++ b/tests/opentofu/stacks/catalog/foobar.yaml @@ -4,6 +4,24 @@ components: settings: github: actions_enabled: true + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: false From 10b62ead307373f593223fac3617f99f6a23253e Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:09:10 -0700 Subject: [PATCH 043/121] Fixing tests --- .github/workflows/test-changes-exists-drift.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index de02733d3..79b12ac40 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -24,8 +24,8 @@ jobs: needs: [setup] steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} + # with: + # ref: ${{ github.event.pull_request.head.ref }} - shell: bash run: | From 4248a8fa0473a6b7aeeddc6c76856b5475e180b8 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:20:16 -0700 Subject: [PATCH 044/121] Fixing tests --- .github/workflows/test-failed-plan-drift.yml | 4 ++-- tests/opentofu/stacks/catalog/foobar-changes.yaml | 2 +- tests/opentofu/stacks/catalog/foobar-disabled.yaml | 2 +- tests/opentofu/stacks/catalog/foobar-fail.yaml | 2 +- tests/opentofu/stacks/catalog/foobar.yaml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-failed-plan-drift.yml b/.github/workflows/test-failed-plan-drift.yml index 39c60dc1e..d5498cb91 100644 --- a/.github/workflows/test-failed-plan-drift.yml +++ b/.github/workflows/test-failed-plan-drift.yml @@ -24,8 +24,8 @@ jobs: needs: [setup] steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} + # with: + # ref: ${{ github.event.pull_request.head.ref }} - shell: bash run: | diff --git a/tests/opentofu/stacks/catalog/foobar-changes.yaml b/tests/opentofu/stacks/catalog/foobar-changes.yaml index e2399e98b..0ca41c1e6 100644 --- a/tests/opentofu/stacks/catalog/foobar-changes.yaml +++ b/tests/opentofu/stacks/catalog/foobar-changes.yaml @@ -6,7 +6,7 @@ components: github: actions_enabled: true gitops: - terraform-version: 1.5.2 + opentofu-version: 1.7.3 infracost-enabled: __INFRACOST_ENABLED__ artifact-storage: region: __STORAGE_REGION__ diff --git a/tests/opentofu/stacks/catalog/foobar-disabled.yaml b/tests/opentofu/stacks/catalog/foobar-disabled.yaml index 6ce30ce9d..442fc7950 100644 --- a/tests/opentofu/stacks/catalog/foobar-disabled.yaml +++ b/tests/opentofu/stacks/catalog/foobar-disabled.yaml @@ -5,7 +5,7 @@ components: github: actions_enabled: true gitops: - terraform-version: 1.5.2 + opentofu-version: 1.7.3 infracost-enabled: __INFRACOST_ENABLED__ artifact-storage: region: __STORAGE_REGION__ diff --git a/tests/opentofu/stacks/catalog/foobar-fail.yaml b/tests/opentofu/stacks/catalog/foobar-fail.yaml index 758cdb7c8..b9724a6e9 100644 --- a/tests/opentofu/stacks/catalog/foobar-fail.yaml +++ b/tests/opentofu/stacks/catalog/foobar-fail.yaml @@ -6,7 +6,7 @@ components: github: actions_enabled: true gitops: - terraform-version: 1.5.2 + opentofu-version: 1.7.3 infracost-enabled: __INFRACOST_ENABLED__ artifact-storage: region: __STORAGE_REGION__ diff --git a/tests/opentofu/stacks/catalog/foobar.yaml b/tests/opentofu/stacks/catalog/foobar.yaml index c2a7011a6..d24dce825 100644 --- a/tests/opentofu/stacks/catalog/foobar.yaml +++ b/tests/opentofu/stacks/catalog/foobar.yaml @@ -5,7 +5,7 @@ components: github: actions_enabled: true gitops: - terraform-version: 1.5.2 + opentofu-version: 1.7.3 infracost-enabled: __INFRACOST_ENABLED__ artifact-storage: region: __STORAGE_REGION__ From b71a76e8cfca3f0669bd9b1f8211acf943f7c808 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:23:46 -0700 Subject: [PATCH 045/121] Fixing tests --- .github/workflows/test-changes-exists-drift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index 79b12ac40..8831efd12 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -31,7 +31,7 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/opentofu/atmos.yaml ${{ runner.temp }}/atmos.yaml - for file in ./tests/terraform/stacks/catalog/*.yaml; do + for file in ./tests/opentofu/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" From f252cd45ea51ffee9a5afeb6c8826a6faa281142 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:30:53 -0700 Subject: [PATCH 046/121] Fixing tests --- .github/workflows/test-infra-cost.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 20a542cdc..188f8a7d6 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -33,7 +33,7 @@ jobs: cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__INFRACOST_ENABLED__#true#g" "$file" sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" From 8f378436f87697f0634a1d8f966187ce39404c5b Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:23:11 -0700 Subject: [PATCH 047/121] Testing one comment --- .github/workflows/test-infra-cost.yml | 2 -- action.yml | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 188f8a7d6..30d7f10c1 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -169,8 +169,6 @@ jobs: ``` - - teardown: runs-on: ubuntu-latest diff --git a/action.yml b/action.yml index 898b34eae..1195d0c3d 100644 --- a/action.yml +++ b/action.yml @@ -382,12 +382,12 @@ runs: id: infracost shell: bash run: | - infracost diff \ + INFRACOST_LOG_LEVEL= debug infracost diff \ --path="${{ steps.vars.outputs.plan_file }}.json" \ --format=diff \ --project-name "${{ inputs.stack }}-${{ inputs.component }}" \ --out-file=/tmp/infracost.txt - infracost diff \ + INFRACOST_LOG_LEVEL= debug infracost diff \ --path="${{ steps.vars.outputs.plan_file }}.json" \ --format=json \ --project-name "${{ inputs.stack }}-${{ inputs.component }}" \ From 6c5c416915f35ea465d285f0598f0ec6eda35a1e Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:54:12 -0700 Subject: [PATCH 048/121] Testing one comment --- action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 1195d0c3d..e71455e6b 100644 --- a/action.yml +++ b/action.yml @@ -382,12 +382,13 @@ runs: id: infracost shell: bash run: | - INFRACOST_LOG_LEVEL= debug infracost diff \ + echo "Running Infracost diff" + INFRACOST_LOG_LEVEL=debug infracost diff \ --path="${{ steps.vars.outputs.plan_file }}.json" \ --format=diff \ --project-name "${{ inputs.stack }}-${{ inputs.component }}" \ --out-file=/tmp/infracost.txt - INFRACOST_LOG_LEVEL= debug infracost diff \ + INFRACOST_LOG_LEVEL=debug infracost diff \ --path="${{ steps.vars.outputs.plan_file }}.json" \ --format=json \ --project-name "${{ inputs.stack }}-${{ inputs.component }}" \ From 85c0751c5a3e3ded6b43fa96fff26fa8a4a95334 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:09:43 -0700 Subject: [PATCH 049/121] Debugging infracost --- action.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/action.yml b/action.yml index e71455e6b..b56408cd1 100644 --- a/action.yml +++ b/action.yml @@ -363,6 +363,14 @@ runs: cosmosEndpoint: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-endpoint }} tableName: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-table }} bucketName: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-bucket }} + + - name: Debug Infracost conditions + shell: bash + run: | + echo "enable-infracost: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" + echo "changes detected: ${{ steps.atmos-plan.outputs.changes }}" + echo "atmos-settings output: ${{ steps.atmos-settings.outputs.settings }}" + echo "atmos-plan output: ${{ toJson(steps.atmos-plan.outputs) }}" - name: Setup Infracost if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} From a9660eb41d3711f813db09a6bd4df9aa6abd8590 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:18:30 -0700 Subject: [PATCH 050/121] Debugging infracost --- action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/action.yml b/action.yml index b56408cd1..69094419f 100644 --- a/action.yml +++ b/action.yml @@ -371,12 +371,21 @@ runs: echo "changes detected: ${{ steps.atmos-plan.outputs.changes }}" echo "atmos-settings output: ${{ steps.atmos-settings.outputs.settings }}" echo "atmos-plan output: ${{ toJson(steps.atmos-plan.outputs) }}" + echo "Condition evaluation: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }}" - name: Setup Infracost if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} uses: infracost/actions/setup@v3 with: api-key: ${{ inputs.infracost-api-key }} + + - name: Debug After Infracost Setup + if: ${{ always() }} + shell: bash + run: | + echo "Infracost setup step has been attempted" + which infracost || echo "Infracost not found" + echo "INFRACOST_API_KEY is set: ${{ inputs.infracost-api-key != '' }}" - name: Convert PLANFILE to JSON if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} From 0d98c2ce0621e8ed8a4cfc6a167bd93a8f61b7a2 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:23:32 -0700 Subject: [PATCH 051/121] Testing one comment --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 69094419f..6885e33ec 100644 --- a/action.yml +++ b/action.yml @@ -374,7 +374,7 @@ runs: echo "Condition evaluation: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }}" - name: Setup Infracost - if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == "true" && steps.atmos-plan.outputs.changes == "true" }} uses: infracost/actions/setup@v3 with: api-key: ${{ inputs.infracost-api-key }} From f749255fa6ce12df53f090305e0c43bde2e2f8fa Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:28:33 -0700 Subject: [PATCH 052/121] Debugging infracost --- action.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 6885e33ec..7e340b620 100644 --- a/action.yml +++ b/action.yml @@ -367,14 +367,15 @@ runs: - name: Debug Infracost conditions shell: bash run: | - echo "enable-infracost: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" - echo "changes detected: ${{ steps.atmos-plan.outputs.changes }}" - echo "atmos-settings output: ${{ steps.atmos-settings.outputs.settings }}" - echo "atmos-plan output: ${{ toJson(steps.atmos-plan.outputs) }}" - echo "Condition evaluation: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }}" - + echo "Raw enable-infracost value: ${{ steps.atmos-settings.outputs.settings }}" + echo "Raw changes value: ${{ steps.atmos-plan.outputs.changes }}" + echo "Parsed enable-infracost: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" + echo "Condition parts:" + echo "Part 1: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' }}" + echo "Part 2: ${{ steps.atmos-plan.outputs.changes == 'true' }}" + - name: Setup Infracost - if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == "true" && steps.atmos-plan.outputs.changes == "true" }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} uses: infracost/actions/setup@v3 with: api-key: ${{ inputs.infracost-api-key }} From 2aa6a3a3a69e882b7d613c38f87de2e498332f55 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:35:03 -0700 Subject: [PATCH 053/121] Debugging infracost --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 7e340b620..fa2b80c4c 100644 --- a/action.yml +++ b/action.yml @@ -371,9 +371,9 @@ runs: echo "Raw changes value: ${{ steps.atmos-plan.outputs.changes }}" echo "Parsed enable-infracost: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" echo "Condition parts:" - echo "Part 1: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' }}" + echo "Part 1: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == true }}" echo "Part 2: ${{ steps.atmos-plan.outputs.changes == 'true' }}" - + - name: Setup Infracost if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} uses: infracost/actions/setup@v3 From 285a6362b6650f94f1f99621afbecf999c0776dc Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:39:02 -0700 Subject: [PATCH 054/121] Testing one comment --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index fa2b80c4c..007210a90 100644 --- a/action.yml +++ b/action.yml @@ -375,7 +375,7 @@ runs: echo "Part 2: ${{ steps.atmos-plan.outputs.changes == 'true' }}" - name: Setup Infracost - if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == true && steps.atmos-plan.outputs.changes == 'true' }} uses: infracost/actions/setup@v3 with: api-key: ${{ inputs.infracost-api-key }} @@ -389,14 +389,14 @@ runs: echo "INFRACOST_API_KEY is set: ${{ inputs.infracost-api-key != '' }}" - name: Convert PLANFILE to JSON - if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == true && steps.atmos-plan.outputs.changes == 'true' }} shell: bash working-directory: ./${{ steps.vars.outputs.component_path }} run: | ${{ fromJson(steps.atmos-settings.outputs.settings).command }} show -json "${{ steps.vars.outputs.plan_file }}" > "${{ steps.vars.outputs.plan_file }}.json" - name: Generate Infracost Diff - if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == 'true' && steps.atmos-plan.outputs.changes == 'true' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == true && steps.atmos-plan.outputs.changes == 'true' }} id: infracost shell: bash run: | From be3c6bdfd79e3de954d2189ea4805c7eef77a7f3 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:41:19 -0700 Subject: [PATCH 055/121] Testing one comment --- action.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/action.yml b/action.yml index 007210a90..64d6cd38e 100644 --- a/action.yml +++ b/action.yml @@ -363,30 +363,12 @@ runs: cosmosEndpoint: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-endpoint }} tableName: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-table }} bucketName: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-bucket }} - - - name: Debug Infracost conditions - shell: bash - run: | - echo "Raw enable-infracost value: ${{ steps.atmos-settings.outputs.settings }}" - echo "Raw changes value: ${{ steps.atmos-plan.outputs.changes }}" - echo "Parsed enable-infracost: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" - echo "Condition parts:" - echo "Part 1: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == true }}" - echo "Part 2: ${{ steps.atmos-plan.outputs.changes == 'true' }}" - name: Setup Infracost if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == true && steps.atmos-plan.outputs.changes == 'true' }} uses: infracost/actions/setup@v3 with: api-key: ${{ inputs.infracost-api-key }} - - - name: Debug After Infracost Setup - if: ${{ always() }} - shell: bash - run: | - echo "Infracost setup step has been attempted" - which infracost || echo "Infracost not found" - echo "INFRACOST_API_KEY is set: ${{ inputs.infracost-api-key != '' }}" - name: Convert PLANFILE to JSON if: ${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost == true && steps.atmos-plan.outputs.changes == 'true' }} From 3cdae31464bc33abbc74dd7010ad27434197e63f Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:57:42 -0700 Subject: [PATCH 056/121] Updating docs --- README.md | 59 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index b04ee2241..c24b14919 100644 --- a/README.md +++ b/README.md @@ -66,27 +66,31 @@ this action. For more on setting up those components, see the `gitops` component ### Config -The action expects the atmos configuration file `atmos.yaml` to be present in the repository. +The action expects the atmos stack file in the component settings section to be present in the repository. The config should have the following structure: ```yaml -integrations: - github: - gitops: - opentofu-version: 1.7.3 - terraform-version: 1.5.2 - infracost-enabled: false - artifact-storage: - region: us-east-2 - bucket: cptest-core-ue2-auto-gitops - table: cptest-core-ue2-auto-gitops-plan-storage - role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha - role: - plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops - apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops - matrix: - sort-by: .stack_slug - group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") +components: + terraform: + foobar/changes: + component: foobar + settings: + github: + gitops: + opentofu-version: 1.7.3 + terraform-version: 1.5.2 + infracost-enabled: false + artifact-storage: + region: us-east-2 + bucket: cptest-core-ue2-auto-gitops + table: cptest-core-ue2-auto-gitops-plan-storage + role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha + role: + plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops + apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops + matrix: + sort-by: .stack_slug + group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") ``` > [!IMPORTANT] @@ -114,10 +118,14 @@ components: ... -integrations: - github: - gitops: - opentofu-version: 1.7.3 +components: + terraform: + foobar/changes: + component: foobar + settings: + github: + gitops: + opentofu-version: 1.7.3 ... ``` @@ -153,6 +161,13 @@ integrations: atmos-config-path: ./rootfs/usr/local/etc/atmos/ atmos-version: 1.81.0 ``` +### Migrating from `v2` to `v3` + +The notable changes in `v3` are: + +- `v3` moves the integration settings from the `atmos.yaml` file to the stack file in the component settings section, which allows more granular configuration of the GitHub Action per component and not global like in version `v2`. +- `v3` allow the the action to conditionally disable the `action/checkout` which is useful when files oare modified outside code commits. + ### Migrating from `v1` to `v2` From 14c3abd5885a07695a2b850d5621a819e7411c15 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:50:54 -0700 Subject: [PATCH 057/121] Adding pr-comment option --- action.yml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 64d6cd38e..c3dc7e548 100644 --- a/action.yml +++ b/action.yml @@ -55,6 +55,10 @@ inputs: description: "Disable actions/checkout. Useful for when the checkout happens in a previous step and file are modified outside of git through other actions" required: false default: 'false' + pr-comment: + description: "Set to 'true' to create a PR comment with the summary of the plan" + required: false + default: 'false' outputs: summary: description: "Summary" @@ -252,7 +256,7 @@ runs: TERRAFORM_OUTPUT_FILE="./terraform-${GITHUB_RUN_ID}-output.txt" tfcmt \ - --config ${GITHUB_ACTION_PATH}/config/summary.yaml \ + --config ${{ github.action_path }}/config/summary.yaml \ -owner "${{ github.repository_owner }}" \ -repo "${{ github.event.repository.name }}" \ -var "target:${{ steps.vars.outputs.component_slug }}" \ @@ -265,7 +269,7 @@ runs: -var "logoUrl:${{ inputs.branding-logo-url }}" \ -var "infracost_enabled:${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" \ -var "driftModeEnabled:${{ inputs.drift-detection-mode-enabled }}" \ - --output ${{ steps.vars.outputs.summary_file }} \ + $([[ "${{ inputs.pr-comment }}" == "false" ]] && echo "--output ${{ steps.vars.outputs.summary_file }}") \ --log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \ plan -- \ atmos terraform plan ${{ inputs.component }} \ @@ -276,6 +280,29 @@ runs: -no-color \ &> ${TERRAFORM_OUTPUT_FILE} + if [[ "${{ inputs.pr-comment }}" == "true" ]]; then + tfcmt \ + --config ${{ github.action_path }}/config/summary.yaml \ + -owner "${{ github.repository_owner }}" \ + -repo "${{ github.event.repository.name }}" \ + -var "target:${{ steps.vars.outputs.component_slug }}" \ + -var "component:${{ inputs.component }}" \ + -var "componentPath:${{ steps.vars.outputs.component_path }}" \ + -var "commitSHA:${{ inputs.sha }}" \ + -var "stack:${{ inputs.stack }}" \ + -var "job:${{ github.job }}" \ + -var "logoImage:${{ inputs.branding-logo-image }}" \ + -var "logoUrl:${{ inputs.branding-logo-url }}" \ + -var "infracost_enabled:${{ fromJson(steps.atmos-settings.outputs.settings).enable-infracost }}" \ + -var "driftModeEnabled:${{ inputs.drift-detection-mode-enabled }}" \ + --output ${{ steps.vars.outputs.summary_file }} \ + --log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \ + plan \ + -patch \ + -- \ + bash -c "cat ${TERRAFORM_OUTPUT_FILE}" + fi + TERRAFORM_RESULT=$? set -e From 352fb64d0083c909cb9a57de17a82268106cbe95 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:55:55 -0700 Subject: [PATCH 058/121] Adding pr-comment option --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c3dc7e548..4f6558156 100644 --- a/action.yml +++ b/action.yml @@ -300,7 +300,7 @@ runs: plan \ -patch \ -- \ - bash -c "cat ${TERRAFORM_OUTPUT_FILE}" + bash -c "cat ${TERRAFORM_OUTPUT_FILE}" fi TERRAFORM_RESULT=$? From db554317cfa1e0c19c9666cbb9e286781b333b10 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:11:48 -0700 Subject: [PATCH 059/121] Adding pr-comment option --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 4f6558156..a183b9a42 100644 --- a/action.yml +++ b/action.yml @@ -475,6 +475,7 @@ runs: if [ -f ${STEP_SUMMARY_FILE} ]; then echo "${STEP_SUMMARY_FILE} found" + cat ${STEP_SUMMARY_FILE} STEP_SUMMARY=$(cat ${STEP_SUMMARY_FILE} | jq -Rs .) echo "result=${STEP_SUMMARY}" >> $GITHUB_OUTPUT From 6a00858bec8ddb1e046827c822b5a62c1222b0f3 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:00:43 -0700 Subject: [PATCH 060/121] Adding pr-comment option --- .github/workflows/test-failed-plan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 7dd754c74..94f286901 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -122,10 +122,10 @@ jobs: exit status 1 ``` - + - + teardown: From 1d5c3cfb8a2a3699e0dddce0968f9289342d9eff Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:04:58 -0700 Subject: [PATCH 061/121] Adding pr-comment option --- .github/workflows/test-failed-plan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 94f286901..1757fd848 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -122,10 +122,10 @@ jobs: exit status 1 ``` - - + + teardown: From 5900709d7f5da2088802f03e143c544728f9740a Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:10:19 -0700 Subject: [PATCH 062/121] Adding pr-comment option --- .github/workflows/test-failed-plan.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 1757fd848..2863d1ebc 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -87,6 +87,9 @@ jobs: with: actual: "${{ fromJSON(needs.test.outputs.summary) }}" expected: | + echo "#############" + echo ${{ fromJSON(needs.test.outputs.summary) }} + echo "#############" ## Plan Failed for `foobar-fail` in `plat-ue2-sandbox` From 2bfe55790c9971726474d1f0aaf474a4f5f8df0c Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:58:56 -0700 Subject: [PATCH 063/121] Adding pr-comment option --- .github/workflows/test-failed-plan.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 2863d1ebc..7dd754c74 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -87,9 +87,6 @@ jobs: with: actual: "${{ fromJSON(needs.test.outputs.summary) }}" expected: | - echo "#############" - echo ${{ fromJSON(needs.test.outputs.summary) }} - echo "#############" ## Plan Failed for `foobar-fail` in `plat-ue2-sandbox` @@ -125,10 +122,10 @@ jobs: exit status 1 ``` + - - + teardown: From 57b3925345bcf85b051dc0ae461d87ece74e6436 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 24 Oct 2024 21:09:16 -0700 Subject: [PATCH 064/121] Adding pr-comment option --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index a183b9a42..796b04843 100644 --- a/action.yml +++ b/action.yml @@ -183,7 +183,7 @@ runs: tag: ${{ startsWith(fromJson(steps.atmos-settings.outputs.settings).opentofu-version, 'v') && fromJson(steps.atmos-settings.outputs.settings).opentofu-version || format('v{0}', fromJson(steps.atmos-settings.outputs.settings).opentofu-version) }} skip: ${{ fromJson(steps.atmos-settings.outputs.settings).opentofu-version == '' || fromJson(steps.atmos-settings.outputs.settings).opentofu-version == 'null' }} suzuki-shunsuke/tfcmt: - tag: v4.11.0 + tag: v4.14.0 - name: Configure Plan AWS Credentials uses: aws-actions/configure-aws-credentials@v4 @@ -280,6 +280,8 @@ runs: -no-color \ &> ${TERRAFORM_OUTPUT_FILE} + TERRAFORM_RESULT=$? + if [[ "${{ inputs.pr-comment }}" == "true" ]]; then tfcmt \ --config ${{ github.action_path }}/config/summary.yaml \ @@ -303,8 +305,6 @@ runs: bash -c "cat ${TERRAFORM_OUTPUT_FILE}" fi - TERRAFORM_RESULT=$? - set -e if [[ "${{ inputs.drift-detection-mode-enabled }}" == "true" ]]; then From 4d6cc6fba4c7f9a62ca1bf8a6155ddfcca6df8c9 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:00:39 -0700 Subject: [PATCH 065/121] Update README.md Co-authored-by: Erik Osterman (CEO @ Cloud Posse) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c24b14919..677458b7e 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ components: The notable changes in `v3` are: - `v3` moves the integration settings from the `atmos.yaml` file to the stack file in the component settings section, which allows more granular configuration of the GitHub Action per component and not global like in version `v2`. -- `v3` allow the the action to conditionally disable the `action/checkout` which is useful when files oare modified outside code commits. +- `v3` allow the the action to conditionally disable the `action/checkout` which is useful when files are modified outside code commits. ### Migrating from `v1` to `v2` From 3e9dbe6a963e04cc7c0648028b5528ec1f64fdec Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:00:46 -0700 Subject: [PATCH 066/121] Update README.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) --- README.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.yaml b/README.yaml index 8d00ccb0e..5d16288de 100644 --- a/README.yaml +++ b/README.yaml @@ -62,7 +62,7 @@ usage: |- The action supports AWS and Azure to store Terraform plan files. You can read more about plan storage in the [cloudposse/github-action-terraform-plan-storage](https://github.com/cloudposse/github-action-terraform-plan-storage?tab=readme-ov-file#aws-default) documentation. - Depends of cloud provider the following fields should be set in the `atmos.yaml`: + Depending on the cloud provider, the following fields should be set in the `atmos.yaml`: #### AWS From ee5b586f03c76493a71cb63ecd08d832538a23c2 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:26:04 -0700 Subject: [PATCH 067/121] Update .github/workflows/test-changes-exists-drift.yml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) --- .github/workflows/test-changes-exists-drift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index 8831efd12..7aee5bda0 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -55,7 +55,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.92.0 - do-not-checkout: true + checkout-enabled: false outputs: result: ${{ steps.current.outcome }} From c86d33d55c40e2dec09dca4d5e72d63f0b1e9bba Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:26:13 -0700 Subject: [PATCH 068/121] Update README.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) --- README.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.yaml b/README.yaml index 5d16288de..1e586aa4c 100644 --- a/README.yaml +++ b/README.yaml @@ -72,7 +72,7 @@ usage: |- integrations: github: gitops: - opentofu-version: 1.7.3 + opentofu-version: 1.7.3 terraform-version: 1.5.2 infracost-enabled: false artifact-storage: From 6fb06130c511e6625050a81c25d612678c50d9be Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:26:35 -0700 Subject: [PATCH 069/121] Update README.md Co-authored-by: Erik Osterman (CEO @ Cloud Posse) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 677458b7e..a09841d5b 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,7 @@ components: ``` ### Migrating from `v2` to `v3` +Nothing is required to migrate from `v2` to `v3`, however, you can now take advantage of new functionality. The notable changes in `v3` are: - `v3` moves the integration settings from the `atmos.yaml` file to the stack file in the component settings section, which allows more granular configuration of the GitHub Action per component and not global like in version `v2`. From be294528e3d845b13fec6e6bad3932f3b9de38ea Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:26:45 -0700 Subject: [PATCH 070/121] Update README.md Co-authored-by: Erik Osterman (CEO @ Cloud Posse) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a09841d5b..1b8ecf70e 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ components: Nothing is required to migrate from `v2` to `v3`, however, you can now take advantage of new functionality. The notable changes in `v3` are: -- `v3` moves the integration settings from the `atmos.yaml` file to the stack file in the component settings section, which allows more granular configuration of the GitHub Action per component and not global like in version `v2`. +- In `v3`, integration settings are read from each component's settings section within the stack file, inheriting from the `atmos.yaml` file. This allows for more granular configuration of the GitHub Action at the component level rather than globally, as in `v2`. You still have the option to set integration settings globally in `atmos.yaml` and extend them in each component's settings for finer control. - `v3` allow the the action to conditionally disable the `action/checkout` which is useful when files are modified outside code commits. From 71b46a0ca62570f99f0e0120136102f17ed57612 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:26:55 -0700 Subject: [PATCH 071/121] Update action.yml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 796b04843..e9113280d 100644 --- a/action.yml +++ b/action.yml @@ -68,7 +68,7 @@ runs: using: "composite" steps: - name: Checkout - if: ${{ inputs.do-not-checkout == 'false' }} + if: ${{ inputs.checkout-enabled == 'true' }} uses: actions/checkout@v4 with: ref: ${{ inputs.sha }} From 685c070dcee67d903eb194d1e9bf3e38dff6a1af Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:34:38 -0700 Subject: [PATCH 072/121] Removing .terraform folder cache to avoid race condition of TF select --- action.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/action.yml b/action.yml index e9113280d..7436207d5 100644 --- a/action.yml +++ b/action.yml @@ -237,15 +237,6 @@ runs: echo "step_summary_file=${STEP_SUMMARY_FILE}" >> $GITHUB_OUTPUT echo "issue_file=${ISSUE_SUMMARY_FILE}" >> $GITHUB_OUTPUT - - name: Cache .terraform - id: cache - uses: actions/cache@v4 - if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} - with: - path: | - ./${{ steps.vars.outputs.component_path }}/.terraform - key: ${{ steps.vars.outputs.cache-key }} - - name: Atmos Terraform Plan if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} id: atmos-plan From cc21edfd84ce87b8a721d18c6423c03372cc90c0 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:18:43 -0700 Subject: [PATCH 073/121] Update action.yml Co-authored-by: Igor Rodionov --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 7436207d5..63e458e50 100644 --- a/action.yml +++ b/action.yml @@ -51,7 +51,7 @@ inputs: not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. default: ${{ github.server_url == 'https://github.com' && github.token || '' }} - do-not-checkout: + skip-checkout: description: "Disable actions/checkout. Useful for when the checkout happens in a previous step and file are modified outside of git through other actions" required: false default: 'false' From 31bc762f928988cdb4152eceaf19197beb9bc401 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:18:58 -0700 Subject: [PATCH 074/121] Update action.yml Co-authored-by: Igor Rodionov --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 63e458e50..d023a6642 100644 --- a/action.yml +++ b/action.yml @@ -401,7 +401,7 @@ runs: shell: bash run: | echo "Running Infracost diff" - INFRACOST_LOG_LEVEL=debug infracost diff \ + infracost diff \ --path="${{ steps.vars.outputs.plan_file }}.json" \ --format=diff \ --project-name "${{ inputs.stack }}-${{ inputs.component }}" \ From 70c149352567d17dd5a1c72ec0d366490ba8c1c7 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:19:08 -0700 Subject: [PATCH 075/121] Update action.yml Co-authored-by: Igor Rodionov --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d023a6642..9326b7393 100644 --- a/action.yml +++ b/action.yml @@ -68,7 +68,7 @@ runs: using: "composite" steps: - name: Checkout - if: ${{ inputs.checkout-enabled == 'true' }} + if: ${{ inputs.skip-checkout != 'true' }} uses: actions/checkout@v4 with: ref: ${{ inputs.sha }} From 53fcae3ceb4919a391d7bf458a6ab6f22451d257 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:19:16 -0700 Subject: [PATCH 076/121] Update action.yml Co-authored-by: Igor Rodionov --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9326b7393..5e925e2da 100644 --- a/action.yml +++ b/action.yml @@ -406,7 +406,7 @@ runs: --format=diff \ --project-name "${{ inputs.stack }}-${{ inputs.component }}" \ --out-file=/tmp/infracost.txt - INFRACOST_LOG_LEVEL=debug infracost diff \ + infracost diff \ --path="${{ steps.vars.outputs.plan_file }}.json" \ --format=json \ --project-name "${{ inputs.stack }}-${{ inputs.component }}" \ From 155575b754358e7989e005cc0c1cec04e70845a1 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:21:30 -0700 Subject: [PATCH 077/121] Update action.yml Co-authored-by: Igor Rodionov --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 5e925e2da..16f8e0115 100644 --- a/action.yml +++ b/action.yml @@ -275,7 +275,7 @@ runs: if [[ "${{ inputs.pr-comment }}" == "true" ]]; then tfcmt \ - --config ${{ github.action_path }}/config/summary.yaml \ + --config ${GITHUB_ACTION_PATH}/config/summary.yaml \ -owner "${{ github.repository_owner }}" \ -repo "${{ github.event.repository.name }}" \ -var "target:${{ steps.vars.outputs.component_slug }}" \ From e1ffe38237251b98fb21fac2255078c9eec2a518 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:21:53 -0700 Subject: [PATCH 078/121] Update action.yml Co-authored-by: Igor Rodionov --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 16f8e0115..9a2ca517e 100644 --- a/action.yml +++ b/action.yml @@ -247,7 +247,7 @@ runs: TERRAFORM_OUTPUT_FILE="./terraform-${GITHUB_RUN_ID}-output.txt" tfcmt \ - --config ${{ github.action_path }}/config/summary.yaml \ + --config ${GITHUB_ACTION_PATH}/config/summary.yaml \ -owner "${{ github.repository_owner }}" \ -repo "${{ github.event.repository.name }}" \ -var "target:${{ steps.vars.outputs.component_slug }}" \ From 7851d846389a85f73a07d8112339d151c7a8ec5f Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:38:01 -0700 Subject: [PATCH 079/121] Addressing feedback --- README.md | 1 + action.yml | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1b8ecf70e..d0d16fa96 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ components: terraform-version: 1.5.2 infracost-enabled: false artifact-storage: + plan-repository-type: "dynamo" region: us-east-2 bucket: cptest-core-ue2-auto-gitops table: cptest-core-ue2-auto-gitops-plan-storage diff --git a/action.yml b/action.yml index 9a2ca517e..e07b500d6 100644 --- a/action.yml +++ b/action.yml @@ -237,12 +237,24 @@ runs: echo "step_summary_file=${STEP_SUMMARY_FILE}" >> $GITHUB_OUTPUT echo "issue_file=${ISSUE_SUMMARY_FILE}" >> $GITHUB_OUTPUT + - name: Cache .terraform + id: cache + uses: actions/cache@v4 + if: ${{ fromJson(steps.component.outputs.settings).enabled }} + with: + path: | + ./${{ steps.vars.outputs.component_path }}/.terraform + key: ${{ steps.vars.outputs.cache-key }} + - name: Atmos Terraform Plan if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} id: atmos-plan shell: bash run: | set +e + + # Remove the environment file from the cache to avoid conflicts with workspace select + rm -f ./${{ steps.vars.outputs.component_path }}/.terraform/environment TERRAFORM_OUTPUT_FILE="./terraform-${GITHUB_RUN_ID}-output.txt" @@ -401,7 +413,7 @@ runs: shell: bash run: | echo "Running Infracost diff" - infracost diff \ + infracost diff \ --path="${{ steps.vars.outputs.plan_file }}.json" \ --format=diff \ --project-name "${{ inputs.stack }}-${{ inputs.component }}" \ @@ -466,7 +478,6 @@ runs: if [ -f ${STEP_SUMMARY_FILE} ]; then echo "${STEP_SUMMARY_FILE} found" - cat ${STEP_SUMMARY_FILE} STEP_SUMMARY=$(cat ${STEP_SUMMARY_FILE} | jq -Rs .) echo "result=${STEP_SUMMARY}" >> $GITHUB_OUTPUT From cae6d0e2281a667797fa8ffe42b4849fa011a570 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:52:21 -0700 Subject: [PATCH 080/121] Addressing feedback --- .github/workflows/integration-tests.yml | 3 +-- .github/workflows/test-changes-exists-drift.yml | 3 +-- .github/workflows/test-changes-exists.yml | 3 +-- .github/workflows/test-failed-plan-drift.yml | 3 +-- .github/workflows/test-failed-plan.yml | 3 +-- .github/workflows/test-infra-cost.yml | 3 +-- .github/workflows/test-no-changes-drift-more.yml | 3 +-- .github/workflows/test-no-changes.yml | 3 +-- .github/workflows/test-settings-action-disabled-drift.yml | 3 +-- .github/workflows/test-settings-action-disabled.yml | 3 +-- action.yml | 2 +- 11 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 4ea21a53d..a95c7c68a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,5 +47,4 @@ jobs: component: "foobar" stack: "plat-ue2-sandbox" atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true \ No newline at end of file + atmos-version: 1.99.0 \ No newline at end of file diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index 7aee5bda0..ae0eb72b4 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -54,8 +54,7 @@ jobs: sha: ${{ github.sha }} drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - checkout-enabled: false + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index 341f4e20c..db0721002 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -52,8 +52,7 @@ jobs: stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-failed-plan-drift.yml b/.github/workflows/test-failed-plan-drift.yml index d5498cb91..b562895f1 100644 --- a/.github/workflows/test-failed-plan-drift.yml +++ b/.github/workflows/test-failed-plan-drift.yml @@ -54,8 +54,7 @@ jobs: sha: ${{ github.sha }} drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 7dd754c74..4f2f27d5d 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -53,8 +53,7 @@ jobs: stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 30d7f10c1..c2d9d77b8 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -55,8 +55,7 @@ jobs: infracost-api-key: ${{ secrets.INFRACOST_API_KEY }} debug: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-no-changes-drift-more.yml b/.github/workflows/test-no-changes-drift-more.yml index e253b994b..5cb72e495 100644 --- a/.github/workflows/test-no-changes-drift-more.yml +++ b/.github/workflows/test-no-changes-drift-more.yml @@ -52,8 +52,7 @@ jobs: sha: ${{ github.sha }} drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-no-changes.yml b/.github/workflows/test-no-changes.yml index a1be26bc6..10fd662a8 100644 --- a/.github/workflows/test-no-changes.yml +++ b/.github/workflows/test-no-changes.yml @@ -51,8 +51,7 @@ jobs: stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-settings-action-disabled-drift.yml b/.github/workflows/test-settings-action-disabled-drift.yml index 704ed2bd2..7bc46df2c 100644 --- a/.github/workflows/test-settings-action-disabled-drift.yml +++ b/.github/workflows/test-settings-action-disabled-drift.yml @@ -53,8 +53,7 @@ jobs: sha: ${{ github.sha }} drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-settings-action-disabled.yml b/.github/workflows/test-settings-action-disabled.yml index bb744d012..5fe6126a6 100644 --- a/.github/workflows/test-settings-action-disabled.yml +++ b/.github/workflows/test-settings-action-disabled.yml @@ -52,8 +52,7 @@ jobs: stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} - atmos-version: 1.92.0 - do-not-checkout: true + atmos-version: 1.99.0 outputs: result: ${{ steps.current.outcome }} diff --git a/action.yml b/action.yml index e07b500d6..0a7b3744b 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ inputs: atmos-version: description: The version of atmos to install required: false - default: ">= 1.92.0" + default: ">= 1.99.0" atmos-config-path: description: The path to the atmos.yaml file required: true From 999ae560d68e2189691184e572aafde309225c38 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 20:09:03 -0700 Subject: [PATCH 081/121] Addressing feedback --- .github/workflows/integration-tests.yml | 3 ++- .github/workflows/test-changes-exists-drift.yml | 1 + .github/workflows/test-changes-exists.yml | 1 + .github/workflows/test-failed-plan-drift.yml | 1 + .github/workflows/test-failed-plan.yml | 1 + .github/workflows/test-infra-cost.yml | 1 + .github/workflows/test-no-changes-drift-more.yml | 1 + .github/workflows/test-no-changes.yml | 1 + .github/workflows/test-settings-action-disabled-drift.yml | 1 + .github/workflows/test-settings-action-disabled.yml | 1 + 10 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a95c7c68a..1da2caaa8 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,4 +47,5 @@ jobs: component: "foobar" stack: "plat-ue2-sandbox" atmos-config-path: ${{ runner.temp }} - atmos-version: 1.99.0 \ No newline at end of file + atmos-version: 1.99.0 + skip-checkout: true \ No newline at end of file diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index ae0eb72b4..043101109 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -55,6 +55,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index db0721002..21ca90eba 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -53,6 +53,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-failed-plan-drift.yml b/.github/workflows/test-failed-plan-drift.yml index b562895f1..f6c497c08 100644 --- a/.github/workflows/test-failed-plan-drift.yml +++ b/.github/workflows/test-failed-plan-drift.yml @@ -55,6 +55,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 4f2f27d5d..eee0811d2 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -54,6 +54,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index c2d9d77b8..46e03d0fe 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -56,6 +56,7 @@ jobs: debug: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-no-changes-drift-more.yml b/.github/workflows/test-no-changes-drift-more.yml index 5cb72e495..a8debbc75 100644 --- a/.github/workflows/test-no-changes-drift-more.yml +++ b/.github/workflows/test-no-changes-drift-more.yml @@ -53,6 +53,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-no-changes.yml b/.github/workflows/test-no-changes.yml index 10fd662a8..22f3fc1ba 100644 --- a/.github/workflows/test-no-changes.yml +++ b/.github/workflows/test-no-changes.yml @@ -52,6 +52,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-settings-action-disabled-drift.yml b/.github/workflows/test-settings-action-disabled-drift.yml index 7bc46df2c..74991639d 100644 --- a/.github/workflows/test-settings-action-disabled-drift.yml +++ b/.github/workflows/test-settings-action-disabled-drift.yml @@ -54,6 +54,7 @@ jobs: drift-detection-mode-enabled: true atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} diff --git a/.github/workflows/test-settings-action-disabled.yml b/.github/workflows/test-settings-action-disabled.yml index 5fe6126a6..7127ec16d 100644 --- a/.github/workflows/test-settings-action-disabled.yml +++ b/.github/workflows/test-settings-action-disabled.yml @@ -53,6 +53,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 + skip-checkout: true outputs: result: ${{ steps.current.outcome }} From f1378087a6930a631de340682afe32c63e547d8a Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 20:16:41 -0700 Subject: [PATCH 082/121] Addressing feedback --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 1da2caaa8..60004c737 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,5 +47,5 @@ jobs: component: "foobar" stack: "plat-ue2-sandbox" atmos-config-path: ${{ runner.temp }} - atmos-version: 1.99.0 + atmos-version: 1.95.0 skip-checkout: true \ No newline at end of file From f4c6de5b3964aafd2a96346a729ae3aeb2bdd539 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Thu, 31 Oct 2024 20:20:33 -0700 Subject: [PATCH 083/121] Addressing feedback --- .github/workflows/integration-tests.yml | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 60004c737..1da2caaa8 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,5 +47,5 @@ jobs: component: "foobar" stack: "plat-ue2-sandbox" atmos-config-path: ${{ runner.temp }} - atmos-version: 1.95.0 + atmos-version: 1.99.0 skip-checkout: true \ No newline at end of file diff --git a/action.yml b/action.yml index 0a7b3744b..dda7816d4 100644 --- a/action.yml +++ b/action.yml @@ -240,7 +240,7 @@ runs: - name: Cache .terraform id: cache uses: actions/cache@v4 - if: ${{ fromJson(steps.component.outputs.settings).enabled }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} with: path: | ./${{ steps.vars.outputs.component_path }}/.terraform From 2763f9aa69a33ff55dc799ba7884a821032ea2df Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:09:42 -0700 Subject: [PATCH 084/121] Test with atmos integration in atmos.yaml and update atmos' --- .github/workflows/test-changes-exists.yml | 20 ++++++++------------ .github/workflows/test-infra-cost.yml | 23 +++++++++-------------- action.yml | 2 +- tests/terraform/atmos.yaml | 10 ++++++++++ 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index 21ca90eba..e18b03ed4 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -31,18 +31,14 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - for file in ./tests/terraform/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - name: Plan Atmos Component id: current diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 46e03d0fe..8220968a9 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -30,20 +30,15 @@ jobs: - shell: bash run: | mkdir -p ${{ runner.temp }} - cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - for file in ./tests/terraform/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#true#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - + cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - name: Plan Atmos Component id: current diff --git a/action.yml b/action.yml index dda7816d4..d98526694 100644 --- a/action.yml +++ b/action.yml @@ -275,6 +275,7 @@ runs: $([[ "${{ inputs.pr-comment }}" == "false" ]] && echo "--output ${{ steps.vars.outputs.summary_file }}") \ --log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \ plan -- \ + -patch \ atmos terraform plan ${{ inputs.component }} \ --stack ${{ inputs.stack }} \ -out="${{ steps.vars.outputs.plan_file }}" \ @@ -303,7 +304,6 @@ runs: --output ${{ steps.vars.outputs.summary_file }} \ --log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \ plan \ - -patch \ -- \ bash -c "cat ${TERRAFORM_OUTPUT_FILE}" fi diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index 7dd3dc6a7..b5b6a9a7e 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -67,6 +67,16 @@ workflows: integrations: github: gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ matrix: sort-by: .stack_slug group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") From c34d1e76c97bc8d399042201a1c257872175bf5e Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:14:09 -0700 Subject: [PATCH 085/121] Test with atmos integration in atmos.yaml and update atmos' --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d98526694..e3ab1cf91 100644 --- a/action.yml +++ b/action.yml @@ -275,7 +275,7 @@ runs: $([[ "${{ inputs.pr-comment }}" == "false" ]] && echo "--output ${{ steps.vars.outputs.summary_file }}") \ --log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \ plan -- \ - -patch \ + $([[ "${{ inputs.pr-comment }}" == "true" ]] && echo "-patch") \ atmos terraform plan ${{ inputs.component }} \ --stack ${{ inputs.stack }} \ -out="${{ steps.vars.outputs.plan_file }}" \ From 1f047e2ea9c3e809582f3869020c84ae6d0ef325 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:25:04 -0700 Subject: [PATCH 086/121] Test with atmos integration in atmos.yaml and update atmos' --- .github/workflows/test-changes-exists.yml | 2 +- .github/workflows/test-infra-cost.yml | 2 +- .../stacks/catalog/foobar-changes-atmos-configs.yaml | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 tests/terraform/stacks/catalog/foobar-changes-atmos-configs.yaml diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index e18b03ed4..aa21bd558 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -44,7 +44,7 @@ jobs: id: current uses: ./ with: - component: "foobar/changes" + component: "foobar/changes/atmos" stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 8220968a9..8f3e10a70 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -44,7 +44,7 @@ jobs: id: current uses: ./ with: - component: "foobar/changes" + component: "foobar/changes/atmos" stack: "plat-ue2-sandbox" sha: ${{ github.sha }} infracost-api-key: ${{ secrets.INFRACOST_API_KEY }} diff --git a/tests/terraform/stacks/catalog/foobar-changes-atmos-configs.yaml b/tests/terraform/stacks/catalog/foobar-changes-atmos-configs.yaml new file mode 100644 index 000000000..e6f1700c6 --- /dev/null +++ b/tests/terraform/stacks/catalog/foobar-changes-atmos-configs.yaml @@ -0,0 +1,9 @@ +components: + terraform: + foobar/changes/atmos: + component: foobar + vars: + example: blue + enabled: true + enable_failure: false + enable_warning: true From 17773dbfc40031e692c783a6ca20d998be674295 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:28:35 -0700 Subject: [PATCH 087/121] Test with atmos integration in atmos.yaml and update atmos' --- ...obar-changes-atmos-configs.yaml => foobar-changes-atmos.yaml} | 0 .../terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml | 1 + 2 files changed, 1 insertion(+) rename tests/terraform/stacks/catalog/{foobar-changes-atmos-configs.yaml => foobar-changes-atmos.yaml} (100%) diff --git a/tests/terraform/stacks/catalog/foobar-changes-atmos-configs.yaml b/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml similarity index 100% rename from tests/terraform/stacks/catalog/foobar-changes-atmos-configs.yaml rename to tests/terraform/stacks/catalog/foobar-changes-atmos.yaml diff --git a/tests/terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml b/tests/terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml index 89cf3d198..7d081d5e1 100644 --- a/tests/terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml +++ b/tests/terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml @@ -3,6 +3,7 @@ import: - catalog/foobar-fail - catalog/foobar-changes - catalog/foobar-disabled + - catalog/foobar-changes-atmos terraform: backend_type: local From 3f7c1ecf5d5f1c0ebe70ad3150923fa2bce3cca3 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:34:59 -0700 Subject: [PATCH 088/121] Test with atmos integration in atmos.yaml and update atmos' --- .github/workflows/test-changes-exists.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index aa21bd558..206b795a1 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -30,11 +30,11 @@ jobs: - shell: bash run: | mkdir -p ${{ runner.temp }} - cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml @@ -49,7 +49,7 @@ jobs: sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} atmos-version: 1.99.0 - skip-checkout: true + skip-checkout: false outputs: result: ${{ steps.current.outcome }} From 84ad808ad500c4d77f29436f04c50396a588bc40 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:56:20 -0700 Subject: [PATCH 089/121] Test with atmos integration in atmos.yaml and update atmos' --- tests/terraform/atmos.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index b5b6a9a7e..cf983766a 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -68,7 +68,7 @@ integrations: github: gitops: terraform-version: 1.5.2 - infracost-enabled: __INFRACOST_ENABLED__ + infracost-enabled: __KKINFRACOST_ENABLED__ artifact-storage: region: __STORAGE_REGION__ bucket: __STORAGE_BUCKET__ From cad8dc4e47f3f5395038717d5f0a127030bdeec7 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 17:35:29 +0100 Subject: [PATCH 090/121] Fix tests --- .../stacks/catalog/foobar-changes.yaml | 18 ------------------ .../stacks/catalog/foobar-changes.yaml | 18 ------------------ 2 files changed, 36 deletions(-) diff --git a/tests/opentofu/stacks/catalog/foobar-changes.yaml b/tests/opentofu/stacks/catalog/foobar-changes.yaml index 0ca41c1e6..edd546794 100644 --- a/tests/opentofu/stacks/catalog/foobar-changes.yaml +++ b/tests/opentofu/stacks/catalog/foobar-changes.yaml @@ -5,24 +5,6 @@ components: settings: github: actions_enabled: true - gitops: - opentofu-version: 1.7.3 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/terraform/stacks/catalog/foobar-changes.yaml b/tests/terraform/stacks/catalog/foobar-changes.yaml index e2399e98b..edd546794 100644 --- a/tests/terraform/stacks/catalog/foobar-changes.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes.yaml @@ -5,24 +5,6 @@ components: settings: github: actions_enabled: true - gitops: - terraform-version: 1.5.2 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ vars: example: blue enabled: true From 0fddbec68a8d8392d0c6d5c3fddfaa36d90af172 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 17:46:20 +0100 Subject: [PATCH 091/121] Fix tests --- tests/opentofu/atmos.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/opentofu/atmos.yaml b/tests/opentofu/atmos.yaml index e77539467..432db0c21 100644 --- a/tests/opentofu/atmos.yaml +++ b/tests/opentofu/atmos.yaml @@ -72,6 +72,16 @@ integrations: github: gitops: opentofu-version: 1.7.3 + terraform-version: 1.5.2 + infracost-enabled: __KKINFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ matrix: sort-by: .stack_slug group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") From ee01d9ae0b396abcb1fbc3e2daf3a0c32b24d4ca Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 21:07:54 +0100 Subject: [PATCH 092/121] Fix tests --- .../workflows/test-changes-exists-drift.yml | 4 +-- .github/workflows/test-changes-exists.yml | 26 +++++++++++++++++++ .github/workflows/test-failed-plan-drift.yml | 4 +-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index 043101109..a68291a5a 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -24,8 +24,8 @@ jobs: needs: [setup] steps: - uses: actions/checkout@v4 - # with: - # ref: ${{ github.event.pull_request.head.ref }} + with: + ref: ${{ github.event.pull_request.head.ref }} - shell: bash run: | diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index 206b795a1..c5b8fd7a3 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -40,6 +40,32 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + - name: Plan Atmos Component id: current uses: ./ diff --git a/.github/workflows/test-failed-plan-drift.yml b/.github/workflows/test-failed-plan-drift.yml index f6c497c08..47a5fb62b 100644 --- a/.github/workflows/test-failed-plan-drift.yml +++ b/.github/workflows/test-failed-plan-drift.yml @@ -24,8 +24,8 @@ jobs: needs: [setup] steps: - uses: actions/checkout@v4 - # with: - # ref: ${{ github.event.pull_request.head.ref }} + with: + ref: ${{ github.event.pull_request.head.ref }} - shell: bash run: | From dacd107a0d10fc46d069642f7bb8e92d0c5640bd Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 21:13:20 +0100 Subject: [PATCH 093/121] Fix tests --- .github/workflows/test-infra-cost.yml | 33 ++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 8f3e10a70..547b04caa 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -30,16 +30,43 @@ jobs: - shell: bash run: | mkdir -p ${{ runner.temp }} - cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + + - name: Plan Atmos Component id: current uses: ./ From 0d7223bb7c6a500bdf5f2f581cc64c595cb1bdd5 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 23:27:15 +0100 Subject: [PATCH 094/121] Fix tests --- tests/terraform/stacks/catalog/foobar.yaml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index c2a7011a6..53ba98fa2 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -4,24 +4,6 @@ components: settings: github: actions_enabled: true - gitops: - terraform-version: 1.5.2 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ vars: example: blue enabled: false From ecc51199e4027adb6d41f2a483e315fdd95b56c4 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 23:38:16 +0100 Subject: [PATCH 095/121] Fix tests --- .github/workflows/integration-tests.yml | 24 ++++++++++++++++++- .../workflows/test-changes-exists-drift.yml | 24 ++++++++++++++++++- .github/workflows/test-failed-plan-drift.yml | 22 +++++++++++++++++ .github/workflows/test-failed-plan.yml | 22 +++++++++++++++++ .../workflows/test-no-changes-drift-more.yml | 23 ++++++++++++++++++ .github/workflows/test-no-changes.yml | 23 ++++++++++++++++++ .../test-settings-action-disabled-drift.yml | 22 +++++++++++++++++ .../test-settings-action-disabled.yml | 22 +++++++++++++++++ tests/terraform/stacks/catalog/foobar.yaml | 18 ++++++++++++++ 9 files changed, 198 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 1da2caaa8..88e93f050 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -27,7 +27,29 @@ jobs: - shell: bash run: | mkdir -p ${{ runner.temp }} - cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index a68291a5a..93598788c 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -30,7 +30,16 @@ jobs: - shell: bash run: | mkdir -p ${{ runner.temp }} - cp ./tests/opentofu/atmos.yaml ${{ runner.temp }}/atmos.yaml + cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + for file in ./tests/opentofu/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" @@ -44,6 +53,19 @@ jobs: fi done + for file in ./tests/terraform/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + - name: Plan Atmos Component id: current diff --git a/.github/workflows/test-failed-plan-drift.yml b/.github/workflows/test-failed-plan-drift.yml index 47a5fb62b..355e22ae0 100644 --- a/.github/workflows/test-failed-plan-drift.yml +++ b/.github/workflows/test-failed-plan-drift.yml @@ -31,6 +31,28 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index eee0811d2..7efd1d0fc 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -31,6 +31,28 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-no-changes-drift-more.yml b/.github/workflows/test-no-changes-drift-more.yml index a8debbc75..7567dd703 100644 --- a/.github/workflows/test-no-changes-drift-more.yml +++ b/.github/workflows/test-no-changes-drift-more.yml @@ -31,6 +31,28 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" @@ -43,6 +65,7 @@ jobs: sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" fi done + - name: Plan Atmos Component id: current uses: ./ diff --git a/.github/workflows/test-no-changes.yml b/.github/workflows/test-no-changes.yml index 22f3fc1ba..6c644706f 100644 --- a/.github/workflows/test-no-changes.yml +++ b/.github/workflows/test-no-changes.yml @@ -31,6 +31,28 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" @@ -43,6 +65,7 @@ jobs: sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" fi done + - name: Plan Atmos Component id: current uses: ./ diff --git a/.github/workflows/test-settings-action-disabled-drift.yml b/.github/workflows/test-settings-action-disabled-drift.yml index 74991639d..8876fe608 100644 --- a/.github/workflows/test-settings-action-disabled-drift.yml +++ b/.github/workflows/test-settings-action-disabled-drift.yml @@ -31,6 +31,28 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-settings-action-disabled.yml b/.github/workflows/test-settings-action-disabled.yml index 7127ec16d..c3732d93e 100644 --- a/.github/workflows/test-settings-action-disabled.yml +++ b/.github/workflows/test-settings-action-disabled.yml @@ -31,6 +31,28 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml + + for file in ./tests/opentofu/stacks/catalog/*.yaml; do + if [ -f "$file" ]; then + sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" + sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" + sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" + sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" + fi + done + for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index 53ba98fa2..34a3d0fac 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -4,6 +4,24 @@ components: settings: github: actions_enabled: true + gitops: + terraform-version: 1.5.2 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: false From 382b56a6ed39e20cdc8066afaef685373bd22daf Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 23:50:03 +0100 Subject: [PATCH 096/121] Fix tests --- .github/workflows/integration-tests.yml | 13 ------------- .github/workflows/test-changes-exists-drift.yml | 15 +-------------- .github/workflows/test-changes-exists.yml | 13 ------------- .github/workflows/test-failed-plan-drift.yml | 13 ------------- .github/workflows/test-failed-plan.yml | 13 ------------- .github/workflows/test-infra-cost.yml | 13 ------------- .github/workflows/test-no-changes-drift-more.yml | 13 ------------- .github/workflows/test-no-changes.yml | 13 ------------- .../test-settings-action-disabled-drift.yml | 13 ------------- .../workflows/test-settings-action-disabled.yml | 13 ------------- 10 files changed, 1 insertion(+), 131 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 88e93f050..56d03049b 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,19 +37,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-changes-exists-drift.yml b/.github/workflows/test-changes-exists-drift.yml index 93598788c..6e5770301 100644 --- a/.github/workflows/test-changes-exists-drift.yml +++ b/.github/workflows/test-changes-exists-drift.yml @@ -30,7 +30,7 @@ jobs: - shell: bash run: | mkdir -p ${{ runner.temp }} - cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml + cp ./tests/opentofu/atmos.yaml ${{ runner.temp }}/atmos.yaml sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml @@ -53,19 +53,6 @@ jobs: fi done - for file in ./tests/terraform/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - - name: Plan Atmos Component id: current diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index c5b8fd7a3..d4a3b0fda 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -40,19 +40,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-failed-plan-drift.yml b/.github/workflows/test-failed-plan-drift.yml index 355e22ae0..1590ce45b 100644 --- a/.github/workflows/test-failed-plan-drift.yml +++ b/.github/workflows/test-failed-plan-drift.yml @@ -40,19 +40,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-failed-plan.yml b/.github/workflows/test-failed-plan.yml index 7efd1d0fc..54f744d40 100644 --- a/.github/workflows/test-failed-plan.yml +++ b/.github/workflows/test-failed-plan.yml @@ -40,19 +40,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 547b04caa..ff62db8cd 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -40,19 +40,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-no-changes-drift-more.yml b/.github/workflows/test-no-changes-drift-more.yml index 7567dd703..c06b67e55 100644 --- a/.github/workflows/test-no-changes-drift-more.yml +++ b/.github/workflows/test-no-changes-drift-more.yml @@ -40,19 +40,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-no-changes.yml b/.github/workflows/test-no-changes.yml index 6c644706f..30384d860 100644 --- a/.github/workflows/test-no-changes.yml +++ b/.github/workflows/test-no-changes.yml @@ -40,19 +40,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-settings-action-disabled-drift.yml b/.github/workflows/test-settings-action-disabled-drift.yml index 8876fe608..4a5118e0b 100644 --- a/.github/workflows/test-settings-action-disabled-drift.yml +++ b/.github/workflows/test-settings-action-disabled-drift.yml @@ -40,19 +40,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" diff --git a/.github/workflows/test-settings-action-disabled.yml b/.github/workflows/test-settings-action-disabled.yml index c3732d93e..b005408e6 100644 --- a/.github/workflows/test-settings-action-disabled.yml +++ b/.github/workflows/test-settings-action-disabled.yml @@ -40,19 +40,6 @@ jobs: sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml - for file in ./tests/opentofu/stacks/catalog/*.yaml; do - if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" - sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" - sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" - sed -i -e "s#__STORAGE_ROLE__#${{ secrets.TERRAFORM_STATE_ROLE }}#g" "$file" - sed -i -e "s#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" - fi - done - for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" From bbc98e1acccbfd4e5b846d9ea42f594b6d4c41cf Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 23:55:36 +0100 Subject: [PATCH 097/121] Fix tests --- .github/workflows/test-changes-exists.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index d4a3b0fda..4f4056ded 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -52,6 +52,8 @@ jobs: sed -i -e "s#__APPLY_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g" "$file" fi done + + cat ${{ runner.temp }}/atmos.yaml - name: Plan Atmos Component id: current From b4ee816aeadc843bc397133463831b487c692a4f Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 27 Nov 2024 23:59:55 +0100 Subject: [PATCH 098/121] Fix tests --- tests/opentofu/atmos.yaml | 2 +- tests/terraform/atmos.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/opentofu/atmos.yaml b/tests/opentofu/atmos.yaml index 432db0c21..eee571e25 100644 --- a/tests/opentofu/atmos.yaml +++ b/tests/opentofu/atmos.yaml @@ -73,7 +73,7 @@ integrations: gitops: opentofu-version: 1.7.3 terraform-version: 1.5.2 - infracost-enabled: __KKINFRACOST_ENABLED__ + infracost-enabled: __INFRACOST_ENABLED__ artifact-storage: region: __STORAGE_REGION__ bucket: __STORAGE_BUCKET__ diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index cf983766a..b5b6a9a7e 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -68,7 +68,7 @@ integrations: github: gitops: terraform-version: 1.5.2 - infracost-enabled: __KKINFRACOST_ENABLED__ + infracost-enabled: __INFRACOST_ENABLED__ artifact-storage: region: __STORAGE_REGION__ bucket: __STORAGE_BUCKET__ From d4ec526c84628a41a8216239b3f50f7c5c20b650 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 00:06:56 +0100 Subject: [PATCH 099/121] Fix tests --- tests/terraform/stacks/catalog/foobar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index 34a3d0fac..088a85af3 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -8,7 +8,7 @@ components: terraform-version: 1.5.2 infracost-enabled: __INFRACOST_ENABLED__ artifact-storage: - region: __STORAGE_REGION__ + region: __STORAGE_REGION_2__ bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ From 7a1ec123f99a67da1b83e0c6346ed7cb19334107 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 00:41:54 +0100 Subject: [PATCH 100/121] Fix tests --- result.json | 709 ++++++++++++++++++ .../stacks/catalog/foobar-changes.yaml | 3 +- .../opentofu/stacks/catalog/foobar-fail.yaml | 3 +- .../stacks/catalog/foobar-changes-atmos.yaml | 3 +- .../stacks/catalog/foobar-changes.yaml | 3 +- .../terraform/stacks/catalog/foobar-fail.yaml | 3 +- tests/terraform/stacks/catalog/foobar.yaml | 2 +- 7 files changed, 720 insertions(+), 6 deletions(-) create mode 100644 result.json diff --git a/result.json b/result.json new file mode 100644 index 000000000..c7c1f65b3 --- /dev/null +++ b/result.json @@ -0,0 +1,709 @@ +{ + "atmos_cli_config": { + "base_path": "./tests/terraform", + "components": { + "helmfile": { + "base_path": "components/helmfile", + "cluster_name_pattern": "{namespace}-{tenant}-{environment}-{stage}-eks-cluster", + "command": "", + "helm_aws_profile_pattern": "{namespace}-{tenant}-gbl-{stage}-helm", + "kubeconfig_path": "/conf/.kube/", + "use_eks": true + }, + "terraform": { + "append_user_agent": "Atmos/1.110.0 (Cloud Posse; +https://atmos.tools)", + "apply_auto_approve": false, + "auto_generate_backend_file": true, + "base_path": "components/terraform", + "command": "", + "deploy_run_init": true, + "init_run_reconfigure": true, + "shell": { + "prompt": "" + } + } + }, + "stacks": { + "base_path": "stacks", + "excluded_paths": [ + "**/_defaults.yaml" + ], + "included_paths": [ + "orgs/**/*" + ], + "name_pattern": "{tenant}-{environment}-{stage}", + "name_template": "" + }, + "workflows": { + "base_path": "stacks/workflows" + } + }, + "atmos_component": "foobar/changes", + "atmos_manifest": "orgs/foo/plat/sandbox/plat-ue2-sandbox", + "atmos_stack": "plat-ue2-sandbox", + "atmos_stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", + "backend": { + "path": "terraform.tfstate" + }, + "backend_type": "local", + "command": "terraform", + "component": "foobar", + "component_info": { + "component_path": "tests/terraform/components/terraform/foobar", + "component_type": "terraform", + "terraform_config": { + "path": "tests/terraform/components/terraform/foobar", + "variables": { + "additional_tag_map": { + "name": "additional_tag_map", + "type": "map(string)", + "description": "Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.\nThis is for some rare cases where resources want additional configuration of tags\nand therefore take a list of maps with tag key, value, and additional configuration.\n", + "default": {}, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 181 + } + }, + "attributes": { + "name": "attributes", + "type": "list(string)", + "description": "ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,\nin the order they appear in the list. New attributes are appended to the\nend of the list. The elements of the list are joined by the `delimiter`\nand treated as a single ID element.\n", + "default": [], + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 146 + } + }, + "context": { + "name": "context", + "type": "any", + "description": "Single object for setting entire context at once.\nSee description of individual variables for details.\nLeave string and numeric variables as `null` to use default value.\nIndividual variable settings (non-null) override settings in context object,\nexcept for attributes, tags, and additional_tag_map, which are merged.\n", + "default": { + "additional_tag_map": {}, + "attributes": [], + "delimiter": null, + "descriptor_formats": {}, + "enabled": true, + "environment": null, + "id_length_limit": null, + "label_key_case": null, + "label_order": [], + "label_value_case": null, + "labels_as_tags": [ + "unset" + ], + "name": null, + "namespace": null, + "regex_replace_chars": null, + "stage": null, + "tags": {}, + "tenant": null + }, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 50 + } + }, + "delimiter": { + "name": "delimiter", + "type": "string", + "description": "Delimiter to be used between ID elements.\nDefaults to `-` (hyphen). Set to `\"\"` to use no delimiter at all.\n", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 137 + } + }, + "descriptor_formats": { + "name": "descriptor_formats", + "type": "any", + "description": "Describe additional descriptors to be output in the `descriptors` output map.\nMap of maps. Keys are names of descriptors. Values are maps of the form\n`{\n format = string\n labels = list(string)\n}`\n(Type is `any` so the map values can later be enhanced to provide additional options.)\n`format` is a Terraform format string to be passed to the `format()` function.\n`labels` is a list of labels, in order, to pass to `format()` function.\nLabel values will be normalized before being passed to `format()` so they will be\nidentical to how they appear in `id`.\nDefault is `{}` (`descriptors` output will be empty).\n", + "default": {}, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 260 + } + }, + "enable_failure": { + "name": "enable_failure", + "type": "bool", + "description": "Always fail", + "default": false, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/variables.tf", + "line": 6 + } + }, + "enable_warning": { + "name": "enable_warning", + "type": "bool", + "description": "Enable warning", + "default": false, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/variables.tf", + "line": 12 + } + }, + "enabled": { + "name": "enabled", + "type": "bool", + "description": "Set to false to prevent the module from creating any resources", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 97 + } + }, + "environment": { + "name": "environment", + "type": "string", + "description": "ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT'", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 115 + } + }, + "example": { + "name": "example", + "type": "string", + "description": "testing variable", + "default": null, + "required": true, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/variables.tf", + "line": 1 + } + }, + "id_length_limit": { + "name": "id_length_limit", + "type": "number", + "description": "Limit `id` to this many characters (minimum 6).\nSet to `0` for unlimited length.\nSet to `null` for keep the existing setting, which defaults to `0`.\nDoes not affect `id_full`.\n", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 211 + } + }, + "label_key_case": { + "name": "label_key_case", + "type": "string", + "description": "Controls the letter case of the `tags` keys (label names) for tags generated by this module.\nDoes not affect keys of tags passed in via the `tags` input.\nPossible values: `lower`, `title`, `upper`.\nDefault value: `title`.\n", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 226 + } + }, + "label_order": { + "name": "label_order", + "type": "list(string)", + "description": "The order in which the labels (ID elements) appear in the `id`.\nDefaults to [\"namespace\", \"environment\", \"stage\", \"name\", \"attributes\"].\nYou can omit any of the 6 labels (\"tenant\" is the 6th), but at least one must be present.\n", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 191 + } + }, + "label_value_case": { + "name": "label_value_case", + "type": "string", + "description": "Controls the letter case of ID elements (labels) as included in `id`,\nset as tag values, and output by this module individually.\nDoes not affect values of tags passed in via the `tags` input.\nPossible values: `lower`, `title`, `upper` and `none` (no transformation).\nSet this to `title` and set `delimiter` to `\"\"` to yield Pascal Case IDs.\nDefault value: `lower`.\n", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 242 + } + }, + "labels_as_tags": { + "name": "labels_as_tags", + "type": "set(string)", + "description": "Set of labels (ID elements) to include as tags in the `tags` output.\nDefault is to include all labels.\nTags with empty values will not be included in the `tags` output.\nSet to `[]` to suppress all generated tags.\n**Notes:**\n The value of the `name` tag, if included, will be the `id`, not the `name`.\n Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be\n changed in later chained modules. Attempts to change it will be silently ignored.\n", + "default": [ + "default" + ], + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 157 + } + }, + "name": { + "name": "name", + "type": "string", + "description": "ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.\nThis is the only ID element not also included as a `tag`.\nThe \"name\" tag is set to the full `id` string. There is no tag with the value of the `name` input.\n", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 127 + } + }, + "namespace": { + "name": "namespace", + "type": "string", + "description": "ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 103 + } + }, + "regex_replace_chars": { + "name": "regex_replace_chars", + "type": "string", + "description": "Terraform regular expression (regex) string.\nCharacters matching the regex will be removed from the ID elements.\nIf not set, `\"/[^a-zA-Z0-9-]/\"` is used to remove all characters other than hyphens, letters and digits.\n", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 201 + } + }, + "stage": { + "name": "stage", + "type": "string", + "description": "ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release'", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 121 + } + }, + "tags": { + "name": "tags", + "type": "map(string)", + "description": "Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).\nNeither the tag keys nor the tag values will be modified by this module.\n", + "default": {}, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 172 + } + }, + "tenant": { + "name": "tenant", + "type": "string", + "description": "ID element _(Rarely used, not included by default)_. A customer identifier, indicating who this instance of a resource is for", + "default": null, + "required": false, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 109 + } + } + }, + "outputs": {}, + "required_providers": { + "random": {}, + "validation": { + "source": "tlkamp/validation", + "version_constraints": [ + "1.1.1" + ] + } + }, + "provider_configs": { + "validation": { + "name": "validation" + } + }, + "managed_resources": { + "random_id.foo": { + "mode": "managed", + "type": "random_id", + "name": "foo", + "provider": { + "name": "random" + }, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/main.tf", + "line": 1 + } + } + }, + "data_resources": { + "data.validation_warning.warn": { + "mode": "data", + "type": "validation_warning", + "name": "warn", + "provider": { + "name": "validation" + }, + "pos": { + "filename": "tests/terraform/components/terraform/foobar/main.tf", + "line": 20 + } + } + }, + "module_calls": { + "this": { + "name": "this", + "source": "cloudposse/label/null", + "version": "0.25.0", + "pos": { + "filename": "tests/terraform/components/terraform/foobar/context.tf", + "line": 23 + } + } + } + } + }, + "deps": [ + "catalog/foobar-changes", + "orgs/foo/plat/sandbox/plat-ue2-sandbox" + ], + "deps_all": [ + "catalog/foobar", + "catalog/foobar-changes", + "orgs/foo/plat/sandbox/plat-ue2-sandbox" + ], + "env": {}, + "imports": [ + "catalog/foobar", + "catalog/foobar-changes", + "catalog/foobar-changes-atmos", + "catalog/foobar-disabled", + "catalog/foobar-fail" + ], + "inheritance": [ + "foobar" + ], + "metadata": {}, + "overrides": {}, + "providers": {}, + "remote_state_backend": { + "path": "terraform.tfstate" + }, + "remote_state_backend_type": "local", + "settings": { + "github": { + "actions_enabled": true, + "gitops": { + "artifact-storage": { + "blob-account-name": null, + "blob-container-name": null, + "bucket": "__STORAGE_BUCKET_2__", + "cosmos-container-name": null, + "cosmos-database-name": null, + "cosmos-endpoint": null, + "metadata-repository-type": "dynamo", + "plan-repository-type": "s3", + "region": "__STORAGE_REGION_2__", + "role": "__STORAGE_ROLE_2__", + "table": "__STORAGE_TABLE_2__" + }, + "infracost-enabled": "__INFRACOST_ENABLED__", + "role": { + "apply": "__APPLY_ROLE__", + "plan": "__PLAN_ROLE__" + }, + "terraform-version": "1.5.2" + } + }, + "integrations": { + "github": { + "gitops": { + "artifact-storage": { + "bucket": "__STORAGE_BUCKET__", + "region": "__STORAGE_REGION__", + "role": "__STORAGE_ROLE__", + "table": "__STORAGE_TABLE__" + }, + "infracost-enabled": "__INFRACOST_ENABLED__", + "matrix": { + "group-by": ".stack_slug | split(\"-\") | [.[0], .[2]] | join(\"-\")", + "sort-by": ".stack_slug" + }, + "role": { + "apply": "__APPLY_ROLE__", + "plan": "__PLAN_ROLE__" + }, + "terraform-version": "1.5.2" + } + } + } + }, + "sources": { + "backend": { + "path": { + "final_value": "terraform.tfstate", + "name": "path", + "stack_dependencies": [ + { + "dependency_type": "inline", + "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", + "stack_file_section": "terraform.backend.local", + "variable_value": "terraform.tfstate" + } + ] + } + }, + "env": {}, + "settings": { + "github": { + "final_value": { + "actions_enabled": true, + "gitops": { + "artifact-storage": { + "blob-account-name": null, + "blob-container-name": null, + "bucket": "__STORAGE_BUCKET_2__", + "cosmos-container-name": null, + "cosmos-database-name": null, + "cosmos-endpoint": null, + "metadata-repository-type": "dynamo", + "plan-repository-type": "s3", + "region": "__STORAGE_REGION_2__", + "role": "__STORAGE_ROLE_2__", + "table": "__STORAGE_TABLE_2__" + }, + "infracost-enabled": "__INFRACOST_ENABLED__", + "role": { + "apply": "__APPLY_ROLE__", + "plan": "__PLAN_ROLE__" + }, + "terraform-version": "1.5.2" + } + }, + "name": "github", + "stack_dependencies": [ + { + "dependency_type": "import", + "stack_file": "catalog/foobar-changes", + "stack_file_section": "components.terraform.settings", + "variable_value": { + "actions_enabled": true + } + }, + { + "dependency_type": "import", + "stack_file": "catalog/foobar", + "stack_file_section": "components.terraform.settings", + "variable_value": { + "actions_enabled": true, + "gitops": { + "artifact-storage": { + "blob-account-name": null, + "blob-container-name": null, + "bucket": "__STORAGE_BUCKET_2__", + "cosmos-container-name": null, + "cosmos-database-name": null, + "cosmos-endpoint": null, + "metadata-repository-type": "dynamo", + "plan-repository-type": "s3", + "region": "__STORAGE_REGION_2__", + "role": "__STORAGE_ROLE_2__", + "table": "__STORAGE_TABLE_2__" + }, + "infracost-enabled": "__INFRACOST_ENABLED__", + "role": { + "apply": "__APPLY_ROLE__", + "plan": "__PLAN_ROLE__" + }, + "terraform-version": "1.5.2" + } + } + } + ] + }, + "integrations": { + "final_value": { + "github": { + "gitops": { + "artifact-storage": { + "bucket": "__STORAGE_BUCKET__", + "region": "__STORAGE_REGION__", + "role": "__STORAGE_ROLE__", + "table": "__STORAGE_TABLE__" + }, + "infracost-enabled": "__INFRACOST_ENABLED__", + "matrix": { + "group-by": ".stack_slug | split(\"-\") | [.[0], .[2]] | join(\"-\")", + "sort-by": ".stack_slug" + }, + "role": { + "apply": "__APPLY_ROLE__", + "plan": "__PLAN_ROLE__" + }, + "terraform-version": "1.5.2" + } + } + }, + "name": "integrations", + "stack_dependencies": [] + } + }, + "vars": { + "enable_failure": { + "final_value": false, + "name": "enable_failure", + "stack_dependencies": [ + { + "dependency_type": "import", + "stack_file": "catalog/foobar-changes", + "stack_file_section": "components.terraform.vars", + "variable_value": false + } + ] + }, + "enable_warning": { + "final_value": true, + "name": "enable_warning", + "stack_dependencies": [ + { + "dependency_type": "import", + "stack_file": "catalog/foobar-changes", + "stack_file_section": "components.terraform.vars", + "variable_value": true + } + ] + }, + "enabled": { + "final_value": true, + "name": "enabled", + "stack_dependencies": [ + { + "dependency_type": "import", + "stack_file": "catalog/foobar-changes", + "stack_file_section": "components.terraform.vars", + "variable_value": true + }, + { + "dependency_type": "import", + "stack_file": "catalog/foobar", + "stack_file_section": "components.terraform.vars", + "variable_value": false + } + ] + }, + "environment": { + "final_value": "ue2", + "name": "environment", + "stack_dependencies": [ + { + "dependency_type": "inline", + "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", + "stack_file_section": "terraform.vars", + "variable_value": "ue2" + } + ] + }, + "example": { + "final_value": "blue", + "name": "example", + "stack_dependencies": [ + { + "dependency_type": "import", + "stack_file": "catalog/foobar-changes", + "stack_file_section": "components.terraform.vars", + "variable_value": "blue" + }, + { + "dependency_type": "import", + "stack_file": "catalog/foobar", + "stack_file_section": "components.terraform.vars", + "variable_value": "blue" + } + ] + }, + "label_order": { + "final_value": [ + "namespace", + "tenant", + "environment", + "stage", + "name", + "attributes" + ], + "name": "label_order", + "stack_dependencies": [ + { + "dependency_type": "inline", + "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", + "stack_file_section": "terraform.vars", + "variable_value": [ + "namespace", + "tenant", + "environment", + "stage", + "name", + "attributes" + ] + } + ] + }, + "namespace": { + "final_value": "foo", + "name": "namespace", + "stack_dependencies": [ + { + "dependency_type": "inline", + "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", + "stack_file_section": "terraform.vars", + "variable_value": "foo" + } + ] + }, + "stage": { + "final_value": "sandbox", + "name": "stage", + "stack_dependencies": [ + { + "dependency_type": "inline", + "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", + "stack_file_section": "terraform.vars", + "variable_value": "sandbox" + } + ] + }, + "tenant": { + "final_value": "plat", + "name": "tenant", + "stack_dependencies": [ + { + "dependency_type": "inline", + "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", + "stack_file_section": "terraform.vars", + "variable_value": "plat" + } + ] + } + } + }, + "stack": "plat-ue2-sandbox", + "vars": { + "enable_failure": false, + "enable_warning": true, + "enabled": true, + "environment": "ue2", + "example": "blue", + "label_order": [ + "namespace", + "tenant", + "environment", + "stage", + "name", + "attributes" + ], + "namespace": "foo", + "stage": "sandbox", + "tenant": "plat" + }, + "workspace": "plat-ue2-sandbox-foobar-changes" +} diff --git a/tests/opentofu/stacks/catalog/foobar-changes.yaml b/tests/opentofu/stacks/catalog/foobar-changes.yaml index edd546794..ef18a1747 100644 --- a/tests/opentofu/stacks/catalog/foobar-changes.yaml +++ b/tests/opentofu/stacks/catalog/foobar-changes.yaml @@ -1,7 +1,8 @@ components: terraform: foobar/changes: - component: foobar + metadata: + component: foobar settings: github: actions_enabled: true diff --git a/tests/opentofu/stacks/catalog/foobar-fail.yaml b/tests/opentofu/stacks/catalog/foobar-fail.yaml index b9724a6e9..34deb08bf 100644 --- a/tests/opentofu/stacks/catalog/foobar-fail.yaml +++ b/tests/opentofu/stacks/catalog/foobar-fail.yaml @@ -1,7 +1,8 @@ components: terraform: foobar-fail: - component: foobar + metadata: + component: foobar settings: github: actions_enabled: true diff --git a/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml b/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml index e6f1700c6..18f83f497 100644 --- a/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml @@ -1,7 +1,8 @@ components: terraform: foobar/changes/atmos: - component: foobar + metadata: + component: foobar vars: example: blue enabled: true diff --git a/tests/terraform/stacks/catalog/foobar-changes.yaml b/tests/terraform/stacks/catalog/foobar-changes.yaml index edd546794..ef18a1747 100644 --- a/tests/terraform/stacks/catalog/foobar-changes.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes.yaml @@ -1,7 +1,8 @@ components: terraform: foobar/changes: - component: foobar + metadata: + component: foobar settings: github: actions_enabled: true diff --git a/tests/terraform/stacks/catalog/foobar-fail.yaml b/tests/terraform/stacks/catalog/foobar-fail.yaml index 758cdb7c8..e9f8fc607 100644 --- a/tests/terraform/stacks/catalog/foobar-fail.yaml +++ b/tests/terraform/stacks/catalog/foobar-fail.yaml @@ -1,7 +1,8 @@ components: terraform: foobar-fail: - component: foobar + metadata: + component: foobar settings: github: actions_enabled: true diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index 088a85af3..34a3d0fac 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -8,7 +8,7 @@ components: terraform-version: 1.5.2 infracost-enabled: __INFRACOST_ENABLED__ artifact-storage: - region: __STORAGE_REGION_2__ + region: __STORAGE_REGION__ bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ From f167c6d0e0d122411a12455ce34ba8a1409f84a1 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 14:24:33 +0100 Subject: [PATCH 101/121] Fix tests --- .github/workflows/test-changes-exists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index 4f4056ded..370cda431 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -59,7 +59,7 @@ jobs: id: current uses: ./ with: - component: "foobar/changes/atmos" + component: "foobar/changes" stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} From 1bf885aab46ef07d49749bff3482e5108c35d7f9 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 14:34:49 +0100 Subject: [PATCH 102/121] Fix tests --- .github/workflows/test-changes-exists.yml | 2 +- tests/terraform/stacks/catalog/foobar-changes-atmos.yaml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index 370cda431..4f4056ded 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -59,7 +59,7 @@ jobs: id: current uses: ./ with: - component: "foobar/changes" + component: "foobar/changes/atmos" stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} diff --git a/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml b/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml index 18f83f497..cc802dd1a 100644 --- a/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml +++ b/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml @@ -3,6 +3,9 @@ components: foobar/changes/atmos: metadata: component: foobar + settings: + github: + actions_enabled: true vars: example: blue enabled: true From 2dd630be9e66d109d875d69291389812e7182fbb Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 14:46:40 +0100 Subject: [PATCH 103/121] Fix tests --- tests/opentofu/atmos.yaml | 1 + tests/terraform/atmos.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/opentofu/atmos.yaml b/tests/opentofu/atmos.yaml index eee571e25..de15a6bf3 100644 --- a/tests/opentofu/atmos.yaml +++ b/tests/opentofu/atmos.yaml @@ -79,6 +79,7 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ + metadata-repository-type: dynamo role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index b5b6a9a7e..4725c30bc 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,6 +74,7 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ + metadata-repository-type: dynamo role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ From 7518cddcb91d87531d2375fae1ccb923bf53f304 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 15:01:14 +0100 Subject: [PATCH 104/121] Fix tests --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e3ab1cf91..4f3736022 100644 --- a/action.yml +++ b/action.yml @@ -152,7 +152,7 @@ runs: outputPath: blob-container-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.metadata-repository-type + settingsPath: settings.integrations.github.gitops.artifact-storage.metadata-repository-type outputPath: metadata-repository-type - component: ${{ inputs.component }} stack: ${{ inputs.stack }} From f41b4142301fa71c05cdfefae13f3b54819fdae8 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 15:09:01 +0100 Subject: [PATCH 105/121] Fix tests --- tests/opentofu/atmos.yaml | 1 + tests/terraform/atmos.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/opentofu/atmos.yaml b/tests/opentofu/atmos.yaml index de15a6bf3..550b173f6 100644 --- a/tests/opentofu/atmos.yaml +++ b/tests/opentofu/atmos.yaml @@ -79,6 +79,7 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ + plan-repository-type: s3 metadata-repository-type: dynamo role: plan: __PLAN_ROLE__ diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index 4725c30bc..ddf26506c 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,6 +74,7 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ + plan-repository-type: s3 metadata-repository-type: dynamo role: plan: __PLAN_ROLE__ From 0227829a5f902fc6988239c7f24c6fea694a5cdf Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 15:17:00 +0100 Subject: [PATCH 106/121] Fix tests --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4f3736022..60ac7409d 100644 --- a/action.yml +++ b/action.yml @@ -140,7 +140,7 @@ runs: outputPath: terraform-state-bucket - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.plan-repository-type + settingsPath: settings.integrations.github.gitops.artifact-storage.plan-repository-type outputPath: plan-repository-type - component: ${{ inputs.component }} stack: ${{ inputs.stack }} From de2719203f9912b485f760539289e294872a99a3 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 15:32:37 +0100 Subject: [PATCH 107/121] Fix tests --- action.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index 60ac7409d..1719ac410 100644 --- a/action.yml +++ b/action.yml @@ -108,35 +108,35 @@ runs: outputPath: command - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.opentofu-version + settingsPath: settings.integrations.github.gitops.opentofu-version outputPath: opentofu-version - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.terraform-version + settingsPath: settings.integrations.github.gitops.terraform-version outputPath: terraform-version - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.infracost-enabled + settingsPath: settings.integrations.github.gitops.infracost-enabled outputPath: enable-infracost - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.role.plan + settingsPath: settings.integrations.github.gitops.role.plan outputPath: terraform-plan-role - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.region + settingsPath: settings.integrations.github.gitops.artifact-storage.region outputPath: aws-region - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.role + settingsPath: settings.integrations.github.gitops.artifact-storage.role outputPath: terraform-state-role - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.table + settingsPath: settings.integrations.github.gitops.artifact-storage.table outputPath: terraform-state-table - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.bucket + settingsPath: settings.integrations.github.gitops.artifact-storage.bucket outputPath: terraform-state-bucket - component: ${{ inputs.component }} stack: ${{ inputs.stack }} @@ -144,11 +144,11 @@ runs: outputPath: plan-repository-type - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.blob-account-name + settingsPath: settings.integrations.github.gitops.artifact-storage.blob-account-name outputPath: blob-account-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.blob-container-name + settingsPath: settings.integrations.github.gitops.artifact-storage.blob-container-name outputPath: blob-container-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} @@ -156,15 +156,15 @@ runs: outputPath: metadata-repository-type - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.cosmos-container-name + settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-container-name outputPath: cosmos-container-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.cosmos-database-name + settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-database-name outputPath: cosmos-database-name - component: ${{ inputs.component }} stack: ${{ inputs.stack }} - settingsPath: settings.github.gitops.artifact-storage.cosmos-endpoint + settingsPath: settings.integrations.github.gitops.artifact-storage.cosmos-endpoint outputPath: cosmos-endpoint - name: Install Terraform From 4bb0219ec006a677ba79a4d6ae5cfbb86c2727d4 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 15:35:34 +0100 Subject: [PATCH 108/121] Fix tests --- .github/workflows/test-changes-exists.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-changes-exists.yml b/.github/workflows/test-changes-exists.yml index 4f4056ded..370cda431 100644 --- a/.github/workflows/test-changes-exists.yml +++ b/.github/workflows/test-changes-exists.yml @@ -59,7 +59,7 @@ jobs: id: current uses: ./ with: - component: "foobar/changes/atmos" + component: "foobar/changes" stack: "plat-ue2-sandbox" sha: ${{ github.sha }} atmos-config-path: ${{ runner.temp }} From f7474abab633e2b74b8d9531eaab671347d6968d Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 15:38:25 +0100 Subject: [PATCH 109/121] Fix tests --- .github/workflows/test-infra-cost.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index ff62db8cd..73aca1a80 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -58,7 +58,7 @@ jobs: id: current uses: ./ with: - component: "foobar/changes/atmos" + component: "foobar/changes" stack: "plat-ue2-sandbox" sha: ${{ github.sha }} infracost-api-key: ${{ secrets.INFRACOST_API_KEY }} From 470f18406ccf7bf3af4bcf0e1416fb68823c1282 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 15:45:00 +0100 Subject: [PATCH 110/121] Fix tests --- .github/workflows/test-infra-cost.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-infra-cost.yml b/.github/workflows/test-infra-cost.yml index 73aca1a80..0025da368 100644 --- a/.github/workflows/test-infra-cost.yml +++ b/.github/workflows/test-infra-cost.yml @@ -31,7 +31,7 @@ jobs: run: | mkdir -p ${{ runner.temp }} cp ./tests/terraform/atmos.yaml ${{ runner.temp }}/atmos.yaml - sed -i -e 's#__INFRACOST_ENABLED__#false#g' ${{ runner.temp }}/atmos.yaml + sed -i -e 's#__INFRACOST_ENABLED__#true#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_REGION__#${{ env.AWS_REGION }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g' ${{ runner.temp }}/atmos.yaml sed -i -e 's#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g' ${{ runner.temp }}/atmos.yaml @@ -42,7 +42,7 @@ jobs: for file in ./tests/terraform/stacks/catalog/*.yaml; do if [ -f "$file" ]; then - sed -i -e "s#__INFRACOST_ENABLED__#false#g" "$file" + sed -i -e "s#__INFRACOST_ENABLED__#true#g" "$file" sed -i -e "s#__STORAGE_REGION__#${{ env.AWS_REGION }}#g" "$file" sed -i -e "s#__STORAGE_BUCKET__#${{ secrets.TERRAFORM_STATE_BUCKET }}#g" "$file" sed -i -e "s#__STORAGE_TABLE__#${{ secrets.TERRAFORM_STATE_TABLE }}#g" "$file" From 1eb03efa1ced4172a1f006ae20ec74faacdc6464 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 18:05:58 +0100 Subject: [PATCH 111/121] Fix tests --- tests/opentofu/atmos.yaml | 13 ------ .../stacks/catalog/foobar-changes.yaml | 21 ++++++++++ .../stacks/catalog/foobar-disabled.yaml | 39 ++++++++++-------- .../opentofu/stacks/catalog/foobar-fail.yaml | 39 ++++++++++-------- tests/opentofu/stacks/catalog/foobar.yaml | 41 ++++++++++--------- .../stacks/catalog/foobar-changes-atmos.yaml | 13 ------ .../stacks/catalog/foobar-disabled.yaml | 19 --------- .../terraform/stacks/catalog/foobar-fail.yaml | 18 -------- tests/terraform/stacks/catalog/foobar.yaml | 18 -------- 9 files changed, 84 insertions(+), 137 deletions(-) delete mode 100644 tests/terraform/stacks/catalog/foobar-changes-atmos.yaml diff --git a/tests/opentofu/atmos.yaml b/tests/opentofu/atmos.yaml index 550b173f6..6d3cf7d5b 100644 --- a/tests/opentofu/atmos.yaml +++ b/tests/opentofu/atmos.yaml @@ -71,19 +71,6 @@ workflows: integrations: github: gitops: - opentofu-version: 1.7.3 - terraform-version: 1.5.2 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - metadata-repository-type: dynamo - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ matrix: sort-by: .stack_slug group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") diff --git a/tests/opentofu/stacks/catalog/foobar-changes.yaml b/tests/opentofu/stacks/catalog/foobar-changes.yaml index ef18a1747..cf239fb44 100644 --- a/tests/opentofu/stacks/catalog/foobar-changes.yaml +++ b/tests/opentofu/stacks/catalog/foobar-changes.yaml @@ -6,6 +6,27 @@ components: settings: github: actions_enabled: true + integrations: + github: + actions_enabled: true + gitops: + opentofu-version: 1.7.3 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/opentofu/stacks/catalog/foobar-disabled.yaml b/tests/opentofu/stacks/catalog/foobar-disabled.yaml index 442fc7950..0bc822780 100644 --- a/tests/opentofu/stacks/catalog/foobar-disabled.yaml +++ b/tests/opentofu/stacks/catalog/foobar-disabled.yaml @@ -4,24 +4,27 @@ components: settings: github: actions_enabled: true - gitops: - opentofu-version: 1.7.3 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ + integrations: + github: + actions_enabled: true + gitops: + opentofu-version: 1.7.3 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/opentofu/stacks/catalog/foobar-fail.yaml b/tests/opentofu/stacks/catalog/foobar-fail.yaml index 34deb08bf..94eb6edf4 100644 --- a/tests/opentofu/stacks/catalog/foobar-fail.yaml +++ b/tests/opentofu/stacks/catalog/foobar-fail.yaml @@ -6,24 +6,27 @@ components: settings: github: actions_enabled: true - gitops: - opentofu-version: 1.7.3 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ + integrations: + github: + actions_enabled: true + gitops: + opentofu-version: 1.7.3 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/opentofu/stacks/catalog/foobar.yaml b/tests/opentofu/stacks/catalog/foobar.yaml index d24dce825..6e931f55f 100644 --- a/tests/opentofu/stacks/catalog/foobar.yaml +++ b/tests/opentofu/stacks/catalog/foobar.yaml @@ -2,26 +2,27 @@ components: terraform: foobar: settings: - github: - actions_enabled: true - gitops: - opentofu-version: 1.7.3 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ + integrations: + github: + actions_enabled: true + gitops: + opentofu-version: 1.7.3 + infracost-enabled: __INFRACOST_ENABLED__ + artifact-storage: + region: __STORAGE_REGION__ + bucket: __STORAGE_BUCKET__ + table: __STORAGE_TABLE__ + role: __STORAGE_ROLE__ + plan-repository-type: s3 + blob-account-name: + blob-container-name: + metadata-repository-type: dynamo + cosmos-container-name: + cosmos-database-name: + cosmos-endpoint: + role: + plan: __PLAN_ROLE__ + apply: __APPLY_ROLE__ vars: example: blue enabled: false diff --git a/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml b/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml deleted file mode 100644 index cc802dd1a..000000000 --- a/tests/terraform/stacks/catalog/foobar-changes-atmos.yaml +++ /dev/null @@ -1,13 +0,0 @@ -components: - terraform: - foobar/changes/atmos: - metadata: - component: foobar - settings: - github: - actions_enabled: true - vars: - example: blue - enabled: true - enable_failure: false - enable_warning: true diff --git a/tests/terraform/stacks/catalog/foobar-disabled.yaml b/tests/terraform/stacks/catalog/foobar-disabled.yaml index 989cc461e..dea88ba5b 100644 --- a/tests/terraform/stacks/catalog/foobar-disabled.yaml +++ b/tests/terraform/stacks/catalog/foobar-disabled.yaml @@ -4,25 +4,6 @@ components: settings: github: actions_enabled: false - gitops: - terraform-version: 1.5.2 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ - vars: example: blue enabled: true diff --git a/tests/terraform/stacks/catalog/foobar-fail.yaml b/tests/terraform/stacks/catalog/foobar-fail.yaml index e9f8fc607..ee2cf1082 100644 --- a/tests/terraform/stacks/catalog/foobar-fail.yaml +++ b/tests/terraform/stacks/catalog/foobar-fail.yaml @@ -6,24 +6,6 @@ components: settings: github: actions_enabled: true - gitops: - terraform-version: 1.5.2 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ vars: example: blue enabled: true diff --git a/tests/terraform/stacks/catalog/foobar.yaml b/tests/terraform/stacks/catalog/foobar.yaml index 34a3d0fac..53ba98fa2 100644 --- a/tests/terraform/stacks/catalog/foobar.yaml +++ b/tests/terraform/stacks/catalog/foobar.yaml @@ -4,24 +4,6 @@ components: settings: github: actions_enabled: true - gitops: - terraform-version: 1.5.2 - infracost-enabled: __INFRACOST_ENABLED__ - artifact-storage: - region: __STORAGE_REGION__ - bucket: __STORAGE_BUCKET__ - table: __STORAGE_TABLE__ - role: __STORAGE_ROLE__ - plan-repository-type: s3 - blob-account-name: - blob-container-name: - metadata-repository-type: dynamo - cosmos-container-name: - cosmos-database-name: - cosmos-endpoint: - role: - plan: __PLAN_ROLE__ - apply: __APPLY_ROLE__ vars: example: blue enabled: false From abfb6cb03874a61cdd2808b707621e8388bc2098 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 18:08:26 +0100 Subject: [PATCH 112/121] Fix tests --- result.json | 709 ------------------ .../foo/plat/sandbox/plat-ue2-sandbox.yaml | 1 - 2 files changed, 710 deletions(-) delete mode 100644 result.json diff --git a/result.json b/result.json deleted file mode 100644 index c7c1f65b3..000000000 --- a/result.json +++ /dev/null @@ -1,709 +0,0 @@ -{ - "atmos_cli_config": { - "base_path": "./tests/terraform", - "components": { - "helmfile": { - "base_path": "components/helmfile", - "cluster_name_pattern": "{namespace}-{tenant}-{environment}-{stage}-eks-cluster", - "command": "", - "helm_aws_profile_pattern": "{namespace}-{tenant}-gbl-{stage}-helm", - "kubeconfig_path": "/conf/.kube/", - "use_eks": true - }, - "terraform": { - "append_user_agent": "Atmos/1.110.0 (Cloud Posse; +https://atmos.tools)", - "apply_auto_approve": false, - "auto_generate_backend_file": true, - "base_path": "components/terraform", - "command": "", - "deploy_run_init": true, - "init_run_reconfigure": true, - "shell": { - "prompt": "" - } - } - }, - "stacks": { - "base_path": "stacks", - "excluded_paths": [ - "**/_defaults.yaml" - ], - "included_paths": [ - "orgs/**/*" - ], - "name_pattern": "{tenant}-{environment}-{stage}", - "name_template": "" - }, - "workflows": { - "base_path": "stacks/workflows" - } - }, - "atmos_component": "foobar/changes", - "atmos_manifest": "orgs/foo/plat/sandbox/plat-ue2-sandbox", - "atmos_stack": "plat-ue2-sandbox", - "atmos_stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", - "backend": { - "path": "terraform.tfstate" - }, - "backend_type": "local", - "command": "terraform", - "component": "foobar", - "component_info": { - "component_path": "tests/terraform/components/terraform/foobar", - "component_type": "terraform", - "terraform_config": { - "path": "tests/terraform/components/terraform/foobar", - "variables": { - "additional_tag_map": { - "name": "additional_tag_map", - "type": "map(string)", - "description": "Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.\nThis is for some rare cases where resources want additional configuration of tags\nand therefore take a list of maps with tag key, value, and additional configuration.\n", - "default": {}, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 181 - } - }, - "attributes": { - "name": "attributes", - "type": "list(string)", - "description": "ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,\nin the order they appear in the list. New attributes are appended to the\nend of the list. The elements of the list are joined by the `delimiter`\nand treated as a single ID element.\n", - "default": [], - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 146 - } - }, - "context": { - "name": "context", - "type": "any", - "description": "Single object for setting entire context at once.\nSee description of individual variables for details.\nLeave string and numeric variables as `null` to use default value.\nIndividual variable settings (non-null) override settings in context object,\nexcept for attributes, tags, and additional_tag_map, which are merged.\n", - "default": { - "additional_tag_map": {}, - "attributes": [], - "delimiter": null, - "descriptor_formats": {}, - "enabled": true, - "environment": null, - "id_length_limit": null, - "label_key_case": null, - "label_order": [], - "label_value_case": null, - "labels_as_tags": [ - "unset" - ], - "name": null, - "namespace": null, - "regex_replace_chars": null, - "stage": null, - "tags": {}, - "tenant": null - }, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 50 - } - }, - "delimiter": { - "name": "delimiter", - "type": "string", - "description": "Delimiter to be used between ID elements.\nDefaults to `-` (hyphen). Set to `\"\"` to use no delimiter at all.\n", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 137 - } - }, - "descriptor_formats": { - "name": "descriptor_formats", - "type": "any", - "description": "Describe additional descriptors to be output in the `descriptors` output map.\nMap of maps. Keys are names of descriptors. Values are maps of the form\n`{\n format = string\n labels = list(string)\n}`\n(Type is `any` so the map values can later be enhanced to provide additional options.)\n`format` is a Terraform format string to be passed to the `format()` function.\n`labels` is a list of labels, in order, to pass to `format()` function.\nLabel values will be normalized before being passed to `format()` so they will be\nidentical to how they appear in `id`.\nDefault is `{}` (`descriptors` output will be empty).\n", - "default": {}, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 260 - } - }, - "enable_failure": { - "name": "enable_failure", - "type": "bool", - "description": "Always fail", - "default": false, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/variables.tf", - "line": 6 - } - }, - "enable_warning": { - "name": "enable_warning", - "type": "bool", - "description": "Enable warning", - "default": false, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/variables.tf", - "line": 12 - } - }, - "enabled": { - "name": "enabled", - "type": "bool", - "description": "Set to false to prevent the module from creating any resources", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 97 - } - }, - "environment": { - "name": "environment", - "type": "string", - "description": "ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT'", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 115 - } - }, - "example": { - "name": "example", - "type": "string", - "description": "testing variable", - "default": null, - "required": true, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/variables.tf", - "line": 1 - } - }, - "id_length_limit": { - "name": "id_length_limit", - "type": "number", - "description": "Limit `id` to this many characters (minimum 6).\nSet to `0` for unlimited length.\nSet to `null` for keep the existing setting, which defaults to `0`.\nDoes not affect `id_full`.\n", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 211 - } - }, - "label_key_case": { - "name": "label_key_case", - "type": "string", - "description": "Controls the letter case of the `tags` keys (label names) for tags generated by this module.\nDoes not affect keys of tags passed in via the `tags` input.\nPossible values: `lower`, `title`, `upper`.\nDefault value: `title`.\n", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 226 - } - }, - "label_order": { - "name": "label_order", - "type": "list(string)", - "description": "The order in which the labels (ID elements) appear in the `id`.\nDefaults to [\"namespace\", \"environment\", \"stage\", \"name\", \"attributes\"].\nYou can omit any of the 6 labels (\"tenant\" is the 6th), but at least one must be present.\n", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 191 - } - }, - "label_value_case": { - "name": "label_value_case", - "type": "string", - "description": "Controls the letter case of ID elements (labels) as included in `id`,\nset as tag values, and output by this module individually.\nDoes not affect values of tags passed in via the `tags` input.\nPossible values: `lower`, `title`, `upper` and `none` (no transformation).\nSet this to `title` and set `delimiter` to `\"\"` to yield Pascal Case IDs.\nDefault value: `lower`.\n", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 242 - } - }, - "labels_as_tags": { - "name": "labels_as_tags", - "type": "set(string)", - "description": "Set of labels (ID elements) to include as tags in the `tags` output.\nDefault is to include all labels.\nTags with empty values will not be included in the `tags` output.\nSet to `[]` to suppress all generated tags.\n**Notes:**\n The value of the `name` tag, if included, will be the `id`, not the `name`.\n Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be\n changed in later chained modules. Attempts to change it will be silently ignored.\n", - "default": [ - "default" - ], - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 157 - } - }, - "name": { - "name": "name", - "type": "string", - "description": "ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.\nThis is the only ID element not also included as a `tag`.\nThe \"name\" tag is set to the full `id` string. There is no tag with the value of the `name` input.\n", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 127 - } - }, - "namespace": { - "name": "namespace", - "type": "string", - "description": "ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 103 - } - }, - "regex_replace_chars": { - "name": "regex_replace_chars", - "type": "string", - "description": "Terraform regular expression (regex) string.\nCharacters matching the regex will be removed from the ID elements.\nIf not set, `\"/[^a-zA-Z0-9-]/\"` is used to remove all characters other than hyphens, letters and digits.\n", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 201 - } - }, - "stage": { - "name": "stage", - "type": "string", - "description": "ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release'", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 121 - } - }, - "tags": { - "name": "tags", - "type": "map(string)", - "description": "Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).\nNeither the tag keys nor the tag values will be modified by this module.\n", - "default": {}, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 172 - } - }, - "tenant": { - "name": "tenant", - "type": "string", - "description": "ID element _(Rarely used, not included by default)_. A customer identifier, indicating who this instance of a resource is for", - "default": null, - "required": false, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 109 - } - } - }, - "outputs": {}, - "required_providers": { - "random": {}, - "validation": { - "source": "tlkamp/validation", - "version_constraints": [ - "1.1.1" - ] - } - }, - "provider_configs": { - "validation": { - "name": "validation" - } - }, - "managed_resources": { - "random_id.foo": { - "mode": "managed", - "type": "random_id", - "name": "foo", - "provider": { - "name": "random" - }, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/main.tf", - "line": 1 - } - } - }, - "data_resources": { - "data.validation_warning.warn": { - "mode": "data", - "type": "validation_warning", - "name": "warn", - "provider": { - "name": "validation" - }, - "pos": { - "filename": "tests/terraform/components/terraform/foobar/main.tf", - "line": 20 - } - } - }, - "module_calls": { - "this": { - "name": "this", - "source": "cloudposse/label/null", - "version": "0.25.0", - "pos": { - "filename": "tests/terraform/components/terraform/foobar/context.tf", - "line": 23 - } - } - } - } - }, - "deps": [ - "catalog/foobar-changes", - "orgs/foo/plat/sandbox/plat-ue2-sandbox" - ], - "deps_all": [ - "catalog/foobar", - "catalog/foobar-changes", - "orgs/foo/plat/sandbox/plat-ue2-sandbox" - ], - "env": {}, - "imports": [ - "catalog/foobar", - "catalog/foobar-changes", - "catalog/foobar-changes-atmos", - "catalog/foobar-disabled", - "catalog/foobar-fail" - ], - "inheritance": [ - "foobar" - ], - "metadata": {}, - "overrides": {}, - "providers": {}, - "remote_state_backend": { - "path": "terraform.tfstate" - }, - "remote_state_backend_type": "local", - "settings": { - "github": { - "actions_enabled": true, - "gitops": { - "artifact-storage": { - "blob-account-name": null, - "blob-container-name": null, - "bucket": "__STORAGE_BUCKET_2__", - "cosmos-container-name": null, - "cosmos-database-name": null, - "cosmos-endpoint": null, - "metadata-repository-type": "dynamo", - "plan-repository-type": "s3", - "region": "__STORAGE_REGION_2__", - "role": "__STORAGE_ROLE_2__", - "table": "__STORAGE_TABLE_2__" - }, - "infracost-enabled": "__INFRACOST_ENABLED__", - "role": { - "apply": "__APPLY_ROLE__", - "plan": "__PLAN_ROLE__" - }, - "terraform-version": "1.5.2" - } - }, - "integrations": { - "github": { - "gitops": { - "artifact-storage": { - "bucket": "__STORAGE_BUCKET__", - "region": "__STORAGE_REGION__", - "role": "__STORAGE_ROLE__", - "table": "__STORAGE_TABLE__" - }, - "infracost-enabled": "__INFRACOST_ENABLED__", - "matrix": { - "group-by": ".stack_slug | split(\"-\") | [.[0], .[2]] | join(\"-\")", - "sort-by": ".stack_slug" - }, - "role": { - "apply": "__APPLY_ROLE__", - "plan": "__PLAN_ROLE__" - }, - "terraform-version": "1.5.2" - } - } - } - }, - "sources": { - "backend": { - "path": { - "final_value": "terraform.tfstate", - "name": "path", - "stack_dependencies": [ - { - "dependency_type": "inline", - "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", - "stack_file_section": "terraform.backend.local", - "variable_value": "terraform.tfstate" - } - ] - } - }, - "env": {}, - "settings": { - "github": { - "final_value": { - "actions_enabled": true, - "gitops": { - "artifact-storage": { - "blob-account-name": null, - "blob-container-name": null, - "bucket": "__STORAGE_BUCKET_2__", - "cosmos-container-name": null, - "cosmos-database-name": null, - "cosmos-endpoint": null, - "metadata-repository-type": "dynamo", - "plan-repository-type": "s3", - "region": "__STORAGE_REGION_2__", - "role": "__STORAGE_ROLE_2__", - "table": "__STORAGE_TABLE_2__" - }, - "infracost-enabled": "__INFRACOST_ENABLED__", - "role": { - "apply": "__APPLY_ROLE__", - "plan": "__PLAN_ROLE__" - }, - "terraform-version": "1.5.2" - } - }, - "name": "github", - "stack_dependencies": [ - { - "dependency_type": "import", - "stack_file": "catalog/foobar-changes", - "stack_file_section": "components.terraform.settings", - "variable_value": { - "actions_enabled": true - } - }, - { - "dependency_type": "import", - "stack_file": "catalog/foobar", - "stack_file_section": "components.terraform.settings", - "variable_value": { - "actions_enabled": true, - "gitops": { - "artifact-storage": { - "blob-account-name": null, - "blob-container-name": null, - "bucket": "__STORAGE_BUCKET_2__", - "cosmos-container-name": null, - "cosmos-database-name": null, - "cosmos-endpoint": null, - "metadata-repository-type": "dynamo", - "plan-repository-type": "s3", - "region": "__STORAGE_REGION_2__", - "role": "__STORAGE_ROLE_2__", - "table": "__STORAGE_TABLE_2__" - }, - "infracost-enabled": "__INFRACOST_ENABLED__", - "role": { - "apply": "__APPLY_ROLE__", - "plan": "__PLAN_ROLE__" - }, - "terraform-version": "1.5.2" - } - } - } - ] - }, - "integrations": { - "final_value": { - "github": { - "gitops": { - "artifact-storage": { - "bucket": "__STORAGE_BUCKET__", - "region": "__STORAGE_REGION__", - "role": "__STORAGE_ROLE__", - "table": "__STORAGE_TABLE__" - }, - "infracost-enabled": "__INFRACOST_ENABLED__", - "matrix": { - "group-by": ".stack_slug | split(\"-\") | [.[0], .[2]] | join(\"-\")", - "sort-by": ".stack_slug" - }, - "role": { - "apply": "__APPLY_ROLE__", - "plan": "__PLAN_ROLE__" - }, - "terraform-version": "1.5.2" - } - } - }, - "name": "integrations", - "stack_dependencies": [] - } - }, - "vars": { - "enable_failure": { - "final_value": false, - "name": "enable_failure", - "stack_dependencies": [ - { - "dependency_type": "import", - "stack_file": "catalog/foobar-changes", - "stack_file_section": "components.terraform.vars", - "variable_value": false - } - ] - }, - "enable_warning": { - "final_value": true, - "name": "enable_warning", - "stack_dependencies": [ - { - "dependency_type": "import", - "stack_file": "catalog/foobar-changes", - "stack_file_section": "components.terraform.vars", - "variable_value": true - } - ] - }, - "enabled": { - "final_value": true, - "name": "enabled", - "stack_dependencies": [ - { - "dependency_type": "import", - "stack_file": "catalog/foobar-changes", - "stack_file_section": "components.terraform.vars", - "variable_value": true - }, - { - "dependency_type": "import", - "stack_file": "catalog/foobar", - "stack_file_section": "components.terraform.vars", - "variable_value": false - } - ] - }, - "environment": { - "final_value": "ue2", - "name": "environment", - "stack_dependencies": [ - { - "dependency_type": "inline", - "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", - "stack_file_section": "terraform.vars", - "variable_value": "ue2" - } - ] - }, - "example": { - "final_value": "blue", - "name": "example", - "stack_dependencies": [ - { - "dependency_type": "import", - "stack_file": "catalog/foobar-changes", - "stack_file_section": "components.terraform.vars", - "variable_value": "blue" - }, - { - "dependency_type": "import", - "stack_file": "catalog/foobar", - "stack_file_section": "components.terraform.vars", - "variable_value": "blue" - } - ] - }, - "label_order": { - "final_value": [ - "namespace", - "tenant", - "environment", - "stage", - "name", - "attributes" - ], - "name": "label_order", - "stack_dependencies": [ - { - "dependency_type": "inline", - "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", - "stack_file_section": "terraform.vars", - "variable_value": [ - "namespace", - "tenant", - "environment", - "stage", - "name", - "attributes" - ] - } - ] - }, - "namespace": { - "final_value": "foo", - "name": "namespace", - "stack_dependencies": [ - { - "dependency_type": "inline", - "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", - "stack_file_section": "terraform.vars", - "variable_value": "foo" - } - ] - }, - "stage": { - "final_value": "sandbox", - "name": "stage", - "stack_dependencies": [ - { - "dependency_type": "inline", - "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", - "stack_file_section": "terraform.vars", - "variable_value": "sandbox" - } - ] - }, - "tenant": { - "final_value": "plat", - "name": "tenant", - "stack_dependencies": [ - { - "dependency_type": "inline", - "stack_file": "orgs/foo/plat/sandbox/plat-ue2-sandbox", - "stack_file_section": "terraform.vars", - "variable_value": "plat" - } - ] - } - } - }, - "stack": "plat-ue2-sandbox", - "vars": { - "enable_failure": false, - "enable_warning": true, - "enabled": true, - "environment": "ue2", - "example": "blue", - "label_order": [ - "namespace", - "tenant", - "environment", - "stage", - "name", - "attributes" - ], - "namespace": "foo", - "stage": "sandbox", - "tenant": "plat" - }, - "workspace": "plat-ue2-sandbox-foobar-changes" -} diff --git a/tests/terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml b/tests/terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml index 7d081d5e1..89cf3d198 100644 --- a/tests/terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml +++ b/tests/terraform/stacks/orgs/foo/plat/sandbox/plat-ue2-sandbox.yaml @@ -3,7 +3,6 @@ import: - catalog/foobar-fail - catalog/foobar-changes - catalog/foobar-disabled - - catalog/foobar-changes-atmos terraform: backend_type: local From 1d74ddde6ad97295c60a3f35c6030eec993a4952 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 28 Nov 2024 23:26:15 +0100 Subject: [PATCH 113/121] Reconsile with https://github.com/cloudposse/github-action-atmos-terraform-plan/pull/92 --- action.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 1719ac410..4ed762b72 100644 --- a/action.yml +++ b/action.yml @@ -187,7 +187,11 @@ runs: - name: Configure Plan AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' + fromJson(steps.atmos-settings.outputs.settings).aws-region != '' && + fromJson(steps.atmos-settings.outputs.settings).aws-region != 'null' && + fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role != '' && + fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role != 'null' }} with: aws-region: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region }} role-to-assume: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role }} @@ -349,7 +353,12 @@ runs: - name: Configure State AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ steps.atmos-plan.outputs.error == 'false' && fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' }} + if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' + steps.atmos-plan.outputs.error == 'false' && + fromJson(steps.atmos-settings.outputs.settings).aws-region != '' && + fromJson(steps.atmos-settings.outputs.settings).aws-region != 'null' && + fromJson(steps.atmos-settings.outputs.settings).terraform-state-role != '' && + fromJson(steps.atmos-settings.outputs.settings).terraform-state-role != 'null' }} with: aws-region: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region }} role-to-assume: ${{ fromJson(steps.atmos-settings.outputs.settings).terraform-state-role }} From 8228d63b682a97eafaaebeb36fb15878d66b08e2 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 29 Nov 2024 01:37:08 +0300 Subject: [PATCH 114/121] Update action.yml --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 4ed762b72..e8772b1ea 100644 --- a/action.yml +++ b/action.yml @@ -187,7 +187,7 @@ runs: - name: Configure Plan AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' + if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' && fromJson(steps.atmos-settings.outputs.settings).aws-region != '' && fromJson(steps.atmos-settings.outputs.settings).aws-region != 'null' && fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role != '' && @@ -353,7 +353,7 @@ runs: - name: Configure State AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' + if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' && steps.atmos-plan.outputs.error == 'false' && fromJson(steps.atmos-settings.outputs.settings).aws-region != '' && fromJson(steps.atmos-settings.outputs.settings).aws-region != 'null' && @@ -520,4 +520,4 @@ runs: if: ${{ fromJson(steps.atmos-settings.outputs.settings).enabled }} shell: bash run: | - exit ${{ steps.atmos-plan.outputs.result }} \ No newline at end of file + exit ${{ steps.atmos-plan.outputs.result }} From 8c10c231129decb305076b8b7613e58a439c339d Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 29 Nov 2024 14:43:20 +0100 Subject: [PATCH 115/121] Define default artifacts storage to s3 --- README.yaml | 16 ++++++++++++++-- action.yml | 15 ++++++++------- tests/terraform/atmos.yaml | 2 -- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.yaml b/README.yaml index 1e586aa4c..1658acf40 100644 --- a/README.yaml +++ b/README.yaml @@ -56,7 +56,9 @@ usage: |- ### Config > [!IMPORTANT] - > **Please note!** This GitHub Action only works with `atmos >= 1.63.0`. If you are using `atmos < 1.63.0` please use `v1` version of this action. + > **Please note!** This GitHub Action only works with `atmos >= 1.99.0`. + > If you are using `atmos >= 1.63.0, < 1.99.0` please use `v2` version of this action. + > If you are using `atmos < 1.63.0` please use `v1` version of this action. The action expects the atmos configuration file `atmos.yaml` to be present in the repository. @@ -76,6 +78,8 @@ usage: |- terraform-version: 1.5.2 infracost-enabled: false artifact-storage: + plan-repository-type: s3 + metadata-repository-type: dynamo region: us-east-2 bucket: cptest-core-ue2-auto-gitops table: cptest-core-ue2-auto-gitops-plan-storage @@ -102,9 +106,9 @@ usage: |- infracost-enabled: false artifact-storage: plan-repository-type: azureblob + metadata-repository-type: cosmos blob-account-name: tfplans blob-container-name: plans - metadata-repository-type: cosmos cosmos-container-name: terraform-plan-storage cosmos-database-name: terraform-plan-storage cosmos-endpoint: "https://my-cosmo-account.documents.azure.com:443/" @@ -175,7 +179,15 @@ usage: |- atmos-config-path: ./rootfs/usr/local/etc/atmos/ atmos-version: 1.81.0 ``` + + ### Migrating from `v2` to `v3` + The notable changes in `v3` are: + + - `v3` works only with `atmos >= 1.99.0` + - `v3` drops `install-terraform` input because terraform is not required for affected stacks call + - `v3` drops `atmos-gitops-config-path` input and the `./.github/config/atmos-gitops.yaml` config file. Now you have to use GitHub Actions environment variables to specify the location of the `atmos.yaml`. + ### Migrating from `v1` to `v2` The notable changes in `v2` are: diff --git a/action.yml b/action.yml index e8772b1ea..2e8f02f95 100644 --- a/action.yml +++ b/action.yml @@ -187,8 +187,7 @@ runs: - name: Configure Plan AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' && - fromJson(steps.atmos-settings.outputs.settings).aws-region != '' && + if: ${{ fromJson(steps.atmos-settings.outputs.settings).aws-region != '' && fromJson(steps.atmos-settings.outputs.settings).aws-region != 'null' && fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role != '' && fromJson(steps.atmos-settings.outputs.settings).terraform-plan-role != 'null' }} @@ -353,7 +352,9 @@ runs: - name: Configure State AWS Credentials uses: aws-actions/configure-aws-credentials@v4 - if: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' && + if: ${{ ( fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 's3' || + fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == '' || + fromJson(steps.atmos-settings.outputs.settings).plan-repository-type == 'null' ) && steps.atmos-plan.outputs.error == 'false' && fromJson(steps.atmos-settings.outputs.settings).aws-region != '' && fromJson(steps.atmos-settings.outputs.settings).aws-region != 'null' && @@ -374,8 +375,8 @@ runs: planPath: ${{ steps.vars.outputs.plan_file }} component: ${{ inputs.component }} stack: ${{ inputs.stack }} - planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type }} - blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name }} + planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type || 's3' }} + blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name || 'dynamo' }} blobContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-container-name }} metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type }} cosmosContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-container-name }} @@ -393,8 +394,8 @@ runs: planPath: ${{ steps.vars.outputs.lock_file }} component: ${{ inputs.component }} stack: ${{ inputs.stack }}-lockfile - planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type }} - blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name }} + planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type || 's3' }} + blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name || 'dynamo' }} blobContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-container-name }} metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type }} cosmosContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-container-name }} diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index ddf26506c..b5b6a9a7e 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,8 +74,6 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: s3 - metadata-repository-type: dynamo role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ From 20edc26e06c5eb9088bd3961beb1414fc3b6d24c Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 29 Nov 2024 14:51:23 +0100 Subject: [PATCH 116/121] Define default artifacts storage to s3 --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 2e8f02f95..fd8e0bae4 100644 --- a/action.yml +++ b/action.yml @@ -375,8 +375,8 @@ runs: planPath: ${{ steps.vars.outputs.plan_file }} component: ${{ inputs.component }} stack: ${{ inputs.stack }} - planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type || 's3' }} - blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name || 'dynamo' }} + planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type }} + blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name }} blobContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-container-name }} metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type }} cosmosContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-container-name }} From 6820ed86bd70b3e59736d9b0585f910e2d342dcd Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 29 Nov 2024 14:54:14 +0100 Subject: [PATCH 117/121] Define default artifacts storage to s3 --- action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index fd8e0bae4..93d136489 100644 --- a/action.yml +++ b/action.yml @@ -375,10 +375,10 @@ runs: planPath: ${{ steps.vars.outputs.plan_file }} component: ${{ inputs.component }} stack: ${{ inputs.stack }} - planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type }} + planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type || 's3' }} + metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type || 'dynamo' }} blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name }} blobContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-container-name }} - metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type }} cosmosContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-container-name }} cosmosDatabaseName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-database-name }} cosmosEndpoint: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-endpoint }} @@ -395,9 +395,9 @@ runs: component: ${{ inputs.component }} stack: ${{ inputs.stack }}-lockfile planRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).plan-repository-type || 's3' }} - blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name || 'dynamo' }} + metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type || 'dynamo' }} + blobAccountName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-account-name }} blobContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).blob-container-name }} - metadataRepositoryType: ${{ fromJson(steps.atmos-settings.outputs.settings).metadata-repository-type }} cosmosContainerName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-container-name }} cosmosDatabaseName: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-database-name }} cosmosEndpoint: ${{ fromJson(steps.atmos-settings.outputs.settings).cosmos-endpoint }} From b60ddbc24b1d2049129d30fdde8cc60232cc955a Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 29 Nov 2024 15:15:34 +0100 Subject: [PATCH 118/121] Define default artifacts storage to s3 --- tests/opentofu/stacks/catalog/foobar-changes.yaml | 2 -- tests/terraform/atmos.yaml | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/opentofu/stacks/catalog/foobar-changes.yaml b/tests/opentofu/stacks/catalog/foobar-changes.yaml index cf239fb44..4913e01b9 100644 --- a/tests/opentofu/stacks/catalog/foobar-changes.yaml +++ b/tests/opentofu/stacks/catalog/foobar-changes.yaml @@ -17,10 +17,8 @@ components: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ - plan-repository-type: s3 blob-account-name: blob-container-name: - metadata-repository-type: dynamo cosmos-container-name: cosmos-database-name: cosmos-endpoint: diff --git a/tests/terraform/atmos.yaml b/tests/terraform/atmos.yaml index b5b6a9a7e..ddf26506c 100644 --- a/tests/terraform/atmos.yaml +++ b/tests/terraform/atmos.yaml @@ -74,6 +74,8 @@ integrations: bucket: __STORAGE_BUCKET__ table: __STORAGE_TABLE__ role: __STORAGE_ROLE__ + plan-repository-type: s3 + metadata-repository-type: dynamo role: plan: __PLAN_ROLE__ apply: __APPLY_ROLE__ From 87a471a51fb5199c569833a81c145a079fc1bd19 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 29 Nov 2024 20:42:18 +0300 Subject: [PATCH 119/121] Update README.yaml --- README.yaml | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/README.yaml b/README.yaml index 1658acf40..860f4bbfa 100644 --- a/README.yaml +++ b/README.yaml @@ -57,7 +57,7 @@ usage: |- > [!IMPORTANT] > **Please note!** This GitHub Action only works with `atmos >= 1.99.0`. - > If you are using `atmos >= 1.63.0, < 1.99.0` please use `v2` version of this action. + > If you are using `atmos >= 1.63.0, < 1.99.0` please use `v2` or `v3` version of this action. > If you are using `atmos < 1.63.0` please use `v1` version of this action. The action expects the atmos configuration file `atmos.yaml` to be present in the repository. @@ -118,6 +118,32 @@ usage: |- group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") ``` + ### Stack level configuration + + > [!IMPORTANT] + > Wherever it is possible to specify `integration.github.gitops` on stack level + > it is required to define default values in `atmos.yaml` + + It is possible to override integration settings on a stack level by defining `settings.integrations`. + + ```yaml + components: + terraform: + foobar: + settings: + integrations: + github: + gitops: + artifact-storage: + bucket: cptest-plat-ue2-auto-gitops + table: cptest-plat-ue2-auto-gitops-plan-storage + role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-plat-ue2-auto-gitops-gha + role: + # Set `plan` empty if you don't want to assume IAM role before terraform plan + plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-plat-gbl-identity-gitops + apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-plat-gbl-identity-gitops + ``` + ### Support OpenTofu This action supports [OpenTofu](https://opentofu.org/). @@ -180,14 +206,28 @@ usage: |- atmos-version: 1.81.0 ``` + ### Migrating from `v3` to `v4` + + The notable changes in `v4` are: + + - `v4` works only with `atmos >= 1.99.0` + - `v4` support azure plan and metadata storage + - `v4` supports stack level integration gitops settings + - `v4` allow to skip internal checkout with `skip-checkout` input + - `v4` support creating summary comments to PR + + The only required migration step is updating atmos version to `>= 1.99.0` + ### Migrating from `v2` to `v3` The notable changes in `v3` are: - - `v3` works only with `atmos >= 1.99.0` - - `v3` drops `install-terraform` input because terraform is not required for affected stacks call - - `v3` drops `atmos-gitops-config-path` input and the `./.github/config/atmos-gitops.yaml` config file. Now you have to use GitHub Actions environment variables to specify the location of the `atmos.yaml`. - + - `v3` use `actions/upload-artifact@v4` to share artifacts so it is not compatible with `cloudposse/github-action-atmos-terraform-drift-detection` `< v2.0.0` + - `v3` support .terraform caching to performance improvment + + + No special migration steps required + ### Migrating from `v1` to `v2` The notable changes in `v2` are: From 4ff435ffdc758380dd21d3f4a7fdb253ec217add Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 29 Nov 2024 18:44:02 +0100 Subject: [PATCH 120/121] Update readme --- README.md | 142 +++++++++++++++++++++++++++++++----------- docs/github-action.md | 4 +- 2 files changed, 109 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index d0d16fa96..9ae1766b6 100644 --- a/README.md +++ b/README.md @@ -66,36 +66,94 @@ this action. For more on setting up those components, see the `gitops` component ### Config -The action expects the atmos stack file in the component settings section to be present in the repository. +> [!IMPORTANT] +> **Please note!** This GitHub Action only works with `atmos >= 1.99.0`. +> If you are using `atmos >= 1.63.0, < 1.99.0` please use `v2` or `v3` version of this action. +> If you are using `atmos < 1.63.0` please use `v1` version of this action. + +The action expects the atmos configuration file `atmos.yaml` to be present in the repository. + +The action supports AWS and Azure to store Terraform plan files. +You can read more about plan storage in the [cloudposse/github-action-terraform-plan-storage](https://github.com/cloudposse/github-action-terraform-plan-storage?tab=readme-ov-file#aws-default) documentation. +Depending on the cloud provider, the following fields should be set in the `atmos.yaml`: + +#### AWS + The config should have the following structure: ```yaml -components: - terraform: - foobar/changes: - component: foobar - settings: - github: - gitops: - opentofu-version: 1.7.3 - terraform-version: 1.5.2 - infracost-enabled: false - artifact-storage: - plan-repository-type: "dynamo" - region: us-east-2 - bucket: cptest-core-ue2-auto-gitops - table: cptest-core-ue2-auto-gitops-plan-storage - role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha - role: - plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops - apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops - matrix: - sort-by: .stack_slug - group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") +integrations: + github: + gitops: + opentofu-version: 1.7.3 + terraform-version: 1.5.2 + infracost-enabled: false + artifact-storage: + plan-repository-type: s3 + metadata-repository-type: dynamo + region: us-east-2 + bucket: cptest-core-ue2-auto-gitops + table: cptest-core-ue2-auto-gitops-plan-storage + role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha + role: + # Set `plan` empty if you don't want to assume IAM role before terraform plan + plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops + apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops + matrix: + sort-by: .stack_slug + group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") +``` + +#### Azure + +The config should have the following structure: + +```yaml +integrations: + github: + gitops: + opentofu-version: 1.7.3 + terraform-version: 1.5.2 + infracost-enabled: false + artifact-storage: + plan-repository-type: azureblob + metadata-repository-type: cosmos + blob-account-name: tfplans + blob-container-name: plans + cosmos-container-name: terraform-plan-storage + cosmos-database-name: terraform-plan-storage + cosmos-endpoint: "https://my-cosmo-account.documents.azure.com:443/" + # We remove the `role` section as it is AWS specific + matrix: + sort-by: .stack_slug + group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-") ``` +### Stack level configuration + > [!IMPORTANT] -> **Please note!** This GitHub Action only works with `atmos >= 1.63.0`. If you are using `atmos < 1.63.0` please use `v1` version of this action. +> Wherever it is possible to specify `integration.github.gitops` on stack level +> it is required to define default values in `atmos.yaml` + +It is possible to override integration settings on a stack level by defining `settings.integrations`. + +```yaml +components: + terraform: + foobar: + settings: + integrations: + github: + gitops: + artifact-storage: + bucket: cptest-plat-ue2-auto-gitops + table: cptest-plat-ue2-auto-gitops-plan-storage + role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-plat-ue2-auto-gitops-gha + role: + # Set `plan` empty if you don't want to assume IAM role before terraform plan + plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-plat-gbl-identity-gitops + apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-plat-gbl-identity-gitops +``` ### Support OpenTofu @@ -119,14 +177,10 @@ components: ... -components: - terraform: - foobar/changes: - component: foobar - settings: - github: - gitops: - opentofu-version: 1.7.3 +integrations: + github: + gitops: + opentofu-version: 1.7.3 ... ``` @@ -162,14 +216,28 @@ components: atmos-config-path: ./rootfs/usr/local/etc/atmos/ atmos-version: 1.81.0 ``` + +### Migrating from `v3` to `v4` + +The notable changes in `v4` are: + +- `v4` works only with `atmos >= 1.99.0` +- `v4` support azure plan and metadata storage +- `v4` supports stack level integration gitops settings +- `v4` allow to skip internal checkout with `skip-checkout` input +- `v4` support creating summary comments to PR + +The only required migration step is updating atmos version to `>= 1.99.0` + ### Migrating from `v2` to `v3` -Nothing is required to migrate from `v2` to `v3`, however, you can now take advantage of new functionality. The notable changes in `v3` are: -- In `v3`, integration settings are read from each component's settings section within the stack file, inheriting from the `atmos.yaml` file. This allows for more granular configuration of the GitHub Action at the component level rather than globally, as in `v2`. You still have the option to set integration settings globally in `atmos.yaml` and extend them in each component's settings for finer control. -- `v3` allow the the action to conditionally disable the `action/checkout` which is useful when files are modified outside code commits. +- `v3` use `actions/upload-artifact@v4` to share artifacts so it is not compatible with `cloudposse/github-action-atmos-terraform-drift-detection` `< v2.0.0` +- `v3` support .terraform caching to performance improvment + +No special migration steps required ### Migrating from `v1` to `v2` @@ -333,7 +401,7 @@ Which would produce the same behavior as in `v1`, doing this: | Name | Description | Default | Required | |------|-------------|---------|----------| | atmos-config-path | The path to the atmos.yaml file | N/A | true | -| atmos-version | The version of atmos to install | >= 1.63.0 | false | +| atmos-version | The version of atmos to install | >= 1.99.0 | false | | branding-logo-image | Branding logo image url | https://cloudposse.com/logo-300x69.svg | false | | branding-logo-url | Branding logo url | https://cloudposse.com/ | false | | component | The name of the component to plan. | N/A | true | @@ -341,7 +409,9 @@ Which would produce the same behavior as in `v1`, doing this: | drift-detection-mode-enabled | Indicate whether this action is used in drift detection workflow. | false | true | | infracost-api-key | Infracost API key | N/A | false | | metadata-retention-days | Infracost API key | 1 | false | +| pr-comment | Set to 'true' to create a PR comment with the summary of the plan | false | false | | sha | Commit SHA to plan. Default: github.sha | ${{ github.event.pull\_request.head.sha }} | true | +| skip-checkout | Disable actions/checkout. Useful for when the checkout happens in a previous step and file are modified outside of git through other actions | false | false | | stack | The stack name for the given component. | N/A | true | | token | Used to pull node distributions for Atmos from Cloud Posse's GitHub repository. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. | ${{ github.server\_url == 'https://github.com' && github.token \|\| '' }} | false | diff --git a/docs/github-action.md b/docs/github-action.md index 26c44b7db..8ca7f68de 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -5,7 +5,7 @@ | Name | Description | Default | Required | |------|-------------|---------|----------| | atmos-config-path | The path to the atmos.yaml file | N/A | true | -| atmos-version | The version of atmos to install | >= 1.63.0 | false | +| atmos-version | The version of atmos to install | >= 1.99.0 | false | | branding-logo-image | Branding logo image url | https://cloudposse.com/logo-300x69.svg | false | | branding-logo-url | Branding logo url | https://cloudposse.com/ | false | | component | The name of the component to plan. | N/A | true | @@ -13,7 +13,9 @@ | drift-detection-mode-enabled | Indicate whether this action is used in drift detection workflow. | false | true | | infracost-api-key | Infracost API key | N/A | false | | metadata-retention-days | Infracost API key | 1 | false | +| pr-comment | Set to 'true' to create a PR comment with the summary of the plan | false | false | | sha | Commit SHA to plan. Default: github.sha | ${{ github.event.pull\_request.head.sha }} | true | +| skip-checkout | Disable actions/checkout. Useful for when the checkout happens in a previous step and file are modified outside of git through other actions | false | false | | stack | The stack name for the given component. | N/A | true | | token | Used to pull node distributions for Atmos from Cloud Posse's GitHub repository. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. | ${{ github.server\_url == 'https://github.com' && github.token \|\| '' }} | false | From eed8ff94a232b671fe279a3cb886fdbb21cf9528 Mon Sep 17 00:00:00 2001 From: PePe Amengual <2208324+jamengual@users.noreply.github.com> Date: Fri, 29 Nov 2024 09:47:51 -0800 Subject: [PATCH 121/121] Adding patch option to tfcmt when pr.comment is enabled --- action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 93d136489..4110aeb20 100644 --- a/action.yml +++ b/action.yml @@ -277,8 +277,9 @@ runs: -var "driftModeEnabled:${{ inputs.drift-detection-mode-enabled }}" \ $([[ "${{ inputs.pr-comment }}" == "false" ]] && echo "--output ${{ steps.vars.outputs.summary_file }}") \ --log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \ - plan -- \ - $([[ "${{ inputs.pr-comment }}" == "true" ]] && echo "-patch") \ + plan \ + $([[ "${{ inputs.pr-comment }}" == "true" ]] && echo "-patch") \ + -- \ atmos terraform plan ${{ inputs.component }} \ --stack ${{ inputs.stack }} \ -out="${{ steps.vars.outputs.plan_file }}" \