@@ -66,27 +66,31 @@ references:
66
66
usage : |
67
67
### Config
68
68
69
- The action expects the atmos gitops configuration file to be present in the repository in `./.github/config/atmos-gitops.yaml` .
69
+ The action expects the atmos configuration file `atmos.yaml` to be present in the repository.
70
70
The config should have the following structure:
71
71
72
72
```yaml
73
- atmos-version: 1.45.3
74
- atmos-config-path: ./rootfs/usr/local/etc/atmos/
75
- terraform-state-bucket: cptest-core-ue2-auto-gitops
76
- terraform-state-table: cptest-core-ue2-auto-gitops
77
- terraform-state-role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha
78
- terraform-plan-role: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
79
- terraform-apply-role: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
80
- terraform-version: 1.5.2
81
- aws-region: us-east-2
82
- enable-infracost: false
83
- sort-by: .stack_slug
84
- group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-")
85
- ```
86
-
73
+ integrations:
74
+ github:
75
+ gitops:
76
+ terraform-version: 1.5.2
77
+ infracost-enabled: false
78
+ artifact-storage:
79
+ region: us-east-2
80
+ bucket: cptest-core-ue2-auto-gitops
81
+ table: cptest-core-ue2-auto-gitops-plan-storage
82
+ role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha
83
+ role:
84
+ plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
85
+ apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
86
+ matrix:
87
+ sort-by: .stack_slug
88
+ group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-")
89
+ ```
90
+
87
91
> [!IMPORTANT]
88
- > **Please note!** the `terraform-state-*` parameters refer to the S3 Bucket and corresponding meta storage DynamoDB table used to store the Terraform Plan files, and not the "Terraform State". These parameters will be renamed in a subsequent release.
89
-
92
+ > **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.
93
+
90
94
### GitHub Actions Workflow Example
91
95
92
96
In following GitHub workflow example first job will filter components that have settings `github.actions_enabled: true` and then in following job `stack_slug` will be printed to stdout.
@@ -101,7 +105,7 @@ usage: |
101
105
steps:
102
106
- name: Selected Components
103
107
id: components
104
- uses: cloudposse/github-action-atmos-terraform-select-components@v0
108
+ uses: cloudposse/github-action-atmos-terraform-select-components@v2
105
109
with:
106
110
atmos-config-path: "${{ github.workspace }}/rootfs/usr/local/etc/atmos/"
107
111
jq-query: 'to_entries[] | .key as $parent | .value.components.terraform | to_entries[] | select(.value.settings.github.actions_enabled // false) | [$parent, .key] | join(",")'
@@ -120,6 +124,104 @@ usage: |
120
124
echo "${{ matrix.stack_slug }}"
121
125
```
122
126
127
+ ### Migrating from `v1` to `v2`
128
+
129
+ The notable changes in `v2` are:
130
+
131
+ - `v2` works only with `atmos >= 1.63.0`
132
+ - `v2` drops `install-terraform` input because terraform is not required for affected stacks call
133
+ - `v2` 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`.
134
+
135
+ The following configuration fields now moved to GitHub action inputs with the same names
136
+
137
+ | name |
138
+ |-------------------------|
139
+ | `atmos-version` |
140
+ | `atmos-config-path` |
141
+
142
+
143
+ The following configuration fields moved to the `atmos.yaml` configuration file.
144
+
145
+ | name | YAML path in `atmos.yaml` |
146
+ |--------------------------|-------------------------------------------------|
147
+ | `aws-region` | `integrations.github.gitops.artifact-storage.region` |
148
+ | `terraform-state-bucket` | `integrations.github.gitops.artifact-storage.bucket` |
149
+ | `terraform-state-table` | `integrations.github.gitops.artifact-storage.table` |
150
+ | `terraform-state-role` | `integrations.github.gitops.artifact-storage.role` |
151
+ | `terraform-plan-role` | `integrations.github.gitops.role.plan` |
152
+ | `terraform-apply-role` | `integrations.github.gitops.role.apply` |
153
+ | `terraform-version` | `integrations.github.gitops.terraform-version` |
154
+ | `enable-infracost` | `integrations.github.gitops.infracost-enabled` |
155
+ | `sort-by` | `integrations.github.gitops.matrix.sort-by` |
156
+ | `group-by` | `integrations.github.gitops.matrix.group-by` |
157
+
158
+
159
+ For example, to migrate from `v1` to `v2`, you should have something similar to the following in your `atmos.yaml`:
160
+
161
+ `./.github/config/atmos.yaml`
162
+ ```yaml
163
+ # ... your existing configuration
164
+
165
+ integrations:
166
+ github:
167
+ gitops:
168
+ terraform-version: 1.5.2
169
+ infracost-enabled: false
170
+ artifact-storage:
171
+ region: us-east-2
172
+ bucket: cptest-core-ue2-auto-gitops
173
+ table: cptest-core-ue2-auto-gitops-plan-storage
174
+ role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha
175
+ role:
176
+ plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
177
+ apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
178
+ matrix:
179
+ sort-by: .stack_slug
180
+ group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-")
181
+ ```
182
+
183
+ `.github/workflows/main.yaml`
184
+ ```yaml
185
+ - name: Selected Components
186
+ id: components
187
+ uses: cloudposse/github-action-atmos-terraform-select-components@v2
188
+ with:
189
+ atmos-config-path: ./rootfs/usr/local/etc/atmos/
190
+ jq-query: 'to_entries[] | .key as $parent | .value.components.terraform | to_entries[] | select(.value.settings.github.actions_enabled // false) | [$parent, .key] | join(",")'
191
+ ```
192
+
193
+ This corresponds to the `v1` configuration (deprecated) below.
194
+
195
+ The `v1` configuration file `./.github/config/atmos-gitops.yaml` looked like this:
196
+ ```yaml
197
+ atmos-version: 1.45.3
198
+ atmos-config-path: ./rootfs/usr/local/etc/atmos/
199
+ terraform-state-bucket: cptest-core-ue2-auto-gitops
200
+ terraform-state-table: cptest-core-ue2-auto-gitops
201
+ terraform-state-role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha
202
+ terraform-plan-role: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
203
+ terraform-apply-role: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
204
+ terraform-version: 1.5.2
205
+ aws-region: us-east-2
206
+ enable-infracost: false
207
+ sort-by: .stack_slug
208
+ group-by: .stack_slug | split("-") | [.[0], .[2]] | join("-")
209
+ ```
210
+
211
+ And the `v1` GitHub Action Workflow looked like this.
212
+
213
+ `.github/workflows/main.yaml`
214
+ ```yaml
215
+ - name: Selected Components
216
+ id: components
217
+ uses: cloudposse/github-action-atmos-terraform-select-components@v1
218
+ with:
219
+ atmos-gitops-config-path: ./.github/config/atmos-gitops.yaml
220
+ jq-query: 'to_entries[] | .key as $parent | .value.components.terraform | to_entries[] | select(.value.settings.github.actions_enabled // false) | [$parent, .key] | join(",")'
221
+
222
+ ```
223
+
224
+
123
225
### Migrating from `v0` to `v1`
124
226
125
227
1. `v1` replaces the `jq-query` input parameter with a new parameter called `selected-filter` to simplify the query for end-users.
0 commit comments