PePe Amengual
12/19/2023, 7:31 PMPePe Amengual
12/19/2023, 7:32 PMPePe Amengual
12/19/2023, 9:10 PMPePe Amengual
12/19/2023, 9:10 PMPePe Amengual
12/19/2023, 9:25 PMhas-affected-stacks: ${{ steps.affected.outputs.has-affected-stacks }}PePe Amengual
12/19/2023, 9:26 PMmatrix I guess is now what it was the stacks before?Igor Rodionov
12/19/2023, 9:29 PMPePe Amengual
12/19/2023, 9:29 PMIgor Rodionov
12/19/2023, 9:34 PMIgor Rodionov
12/19/2023, 9:35 PMnested-matrices-count: 1Igor Rodionov
12/19/2023, 9:35 PMIgor Rodionov
12/19/2023, 9:35 PMIgor Rodionov
12/19/2023, 9:35 PMPePe Amengual
12/19/2023, 9:35 PMPePe Amengual
12/19/2023, 9:36 PMname: Pull Request
on:
pull_request:
branches: [ 'main' ]
types: [opened, synchronize, reopened, closed, labeled, unlabeled]
jobs:
atmos-affected:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: affected
uses: cloudposse/github-action-atmos-affected-stacks@v2
with:
atmos-gitops-config-path: ./.github/config/atmos-gitops.yaml
nested-matrices-count: 1
outputs:
affected: ${{ steps.affected.outputs.affected }}
matrix: ${{ steps.affected.outputs.matrix }}
has-affected-stacks: ${{ steps.affected.outputs.has-affected-stacks }}
atmos-plan:
needs: ["atmos-affected"]
if: ${{ needs.atmos-affected.outputs.has-affected-stacks }}
name: ${{ matrix.stack_slug }}
runs-on: ['self-hosted']
strategy:
max-parallel: 10
fail-fast: false # Don't fail fast to avoid locking TF State
matrix: ${{ fromJson(needs.atmos-affected.outputs.stacks) }}
## Avoid running the same stack in parallel mode (from different workflows)
concurrency:
group: ${{ matrix.stack_slug }}
cancel-in-progress: false
steps:
- name: Plan Atmos Component
uses: cloudposse/github-action-atmos-terraform-plan@v1
with:
component: ${{ matrix.component }}
stack: ${{ matrix.stack }}PePe Amengual
12/19/2023, 9:36 PMmatrix: ${{ fromJson(needs.atmos-affected.outputs.stacks) }}Igor Rodionov
12/19/2023, 9:36 PMif: ${{ needs.atmos-affected.outputs.has-affected-stacks == 'true' }}Igor Rodionov
12/19/2023, 9:36 PMIgor Rodionov
12/19/2023, 9:36 PMIgor Rodionov
12/19/2023, 9:36 PMPePe Amengual
12/19/2023, 9:37 PMfromJson(needs.atmos-affected.outputs.matrix?Igor Rodionov
12/19/2023, 9:37 PMPePe Amengual
12/19/2023, 9:38 PMPePe Amengual
12/19/2023, 9:39 PMPePe Amengual
12/19/2023, 9:39 PMPePe Amengual
12/19/2023, 9:40 PMIgor Rodionov
12/19/2023, 9:42 PMnested-matrices-count - if you will hit the problem 256 matrix limit for terraform plan GHA you can use it to extend the limit up to 65k with nested matrixes and reusable workflows workaroundIgor Rodionov
12/19/2023, 9:43 PMPePe Amengual
12/19/2023, 9:44 PMWaiting for a runner to pick up this job...PePe Amengual
12/19/2023, 9:44 PMPePe Amengual
12/19/2023, 9:46 PMPePe Amengual
12/19/2023, 9:51 PMrun-on be github or matrix?PePe Amengual
12/19/2023, 9:51 PMatmos-plan:
needs: ["atmos-affected"]
if: ${{ needs.atmos-affected.outputs.has-affected-stacks == 'true' }}
name: ${{ matrix.stack_slug }}
runs-on: ['github']PePe Amengual
12/19/2023, 9:51 PMIgor Rodionov
12/19/2023, 9:53 PMPePe Amengual
12/19/2023, 9:55 PMPePe Amengual
12/19/2023, 9:59 PMPePe Amengual
12/19/2023, 9:59 PMPePe Amengual
12/19/2023, 10:01 PMjq -rc --arg key settings.github.actions_enabled '. | getpath($key | split("."))' OUTPUT_FILEPePe Amengual
12/19/2023, 10:01 PMPePe Amengual
12/19/2023, 10:01 PMPePe Amengual
12/19/2023, 11:06 PMterraform-state-role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha
terraform-plan-role: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
terraform-apply-role: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitopsPePe Amengual
12/19/2023, 11:07 PMcptest-core-ue2-auto-gitops-gha role in my automation accountPePe Amengual
12/19/2023, 11:07 PMcptest-core-gbl-identity-gitops in the identity accountPePe Amengual
12/19/2023, 11:07 PMPePe Amengual
12/19/2023, 11:21 PMPePe Amengual
12/19/2023, 11:21 PMIgor Rodionov
12/20/2023, 12:12 AMIgor Rodionov
12/20/2023, 12:12 AMIgor Rodionov
12/20/2023, 12:12 AMsettings:
github:
actions_enabled: trueIgor Rodionov
12/20/2023, 12:13 AMIgor Rodionov
12/20/2023, 12:13 AMcomponents:
terraform:
gha-tester:
settings:
github:
actions_enabled: true
metadata:
component: s3-bucket
inherits:
- s3-bucket/defaults
vars:
#enabled: false
name: gha-testing-2
tags:
foo: barIgor Rodionov
12/20/2023, 12:13 AMIgor Rodionov
12/20/2023, 12:16 AMIgor Rodionov
12/20/2023, 12:17 AMPePe Amengual
12/20/2023, 12:34 AMAssuming role with OIDC
Authenticated as assumedRoleId AROAWXCPEFSPJEZ4EJXCW:atmos-terraform-plan-gitops
Run set +e
Error:
'atmos.yaml' CLI config files not found in any of the searched paths: system dir, home dir, current dir, ENV vars.
You can download a sample config and adapt it to your requirements from <https://raw.githubusercontent.com/cloudposse/atmos/master/examples/complete/atmos.yaml>
with module.account_map.data.utils_component_config.config[0],
on .terraform/modules/account_map/modules/remote-state/main.tf line 1, in data "utils_component_config" "config":
1: data "utils_component_config" "config" {PePe Amengual
12/20/2023, 12:35 AMatmos.yaml base_path: "."PePe Amengual
12/20/2023, 2:35 AMATMOS_CLI_CONFIG ENV and I think the action is maybe not using the right dir?PePe Amengual
12/20/2023, 2:35 AM--output /home/runner/work/terraform-aws-infrastructure/terraform-aws-infrastructure/metadata/summary-pepe-ue1-nonprod-aws-config.md \PePe Amengual
12/20/2023, 2:35 AMPePe Amengual
12/20/2023, 2:36 AMATMOS_CLI_CONFIG_PATH: /home/runner/work/terraform-aws-infrastructure/terraform-aws-infrastructure/atmos.yamlPePe Amengual
12/20/2023, 2:37 AMatmos-config-path: atmos.yamlPePe Amengual
12/20/2023, 2:38 AMPePe Amengual
12/20/2023, 2:38 AM# Set ATMOS_BASE_PATH allow `cloudposse/utils` provider to read atmos config from the correct path
ATMOS_BASE_PATH="./"
echo "ATMOS_BASE_PATH=$(realpath ${ATMOS_BASE_PATH:-./})" >> $GITHUB_ENVPePe Amengual
12/20/2023, 1:07 PMPePe Amengual
12/21/2023, 10:16 PMIgor Rodionov
01/04/2024, 2:01 PM