Skip to content

Commit e1b18e8

Browse files
author
iru
authored
chore: consolidate tf 0.15 and review ci (#94)
ci: re-enable validate org validation
1 parent 36e5e68 commit e1b18e8

File tree

25 files changed

+74
-31
lines changed

25 files changed

+74
-31
lines changed

.github/workflows/ci-pull-request.yaml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,27 @@ jobs:
6363
with:
6464
terraform_version: ${{ steps.minMax.outputs.minVersion }}
6565

66+
- name: Set up Go
67+
uses: actions/setup-go@v3
68+
with:
69+
go-version: ${{ env.GO_VERSION }}
70+
6671
- name: Install pre-commit dependencies
67-
run: pip install pre-commit
72+
run: |
73+
pip install pre-commit
74+
go install github.com/hashicorp/terraform-config-inspect@latest
75+
76+
- name: Execute generate-terraform-providers for organizational
77+
if: ${{ matrix.directory != '.' }}
78+
run: |
79+
pre-commit run generate_tf_providers -a
6880
69-
- name: Execute pre-commit
81+
- name: Execute pre-commit min_version 1
7082
# Run only validate pre-commit check on min version supported
7183
if: ${{ matrix.directory != '.' }}
7284
run: pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*
7385

74-
- name: Execute pre-commit
86+
- name: Execute pre-commit min_version 2
7587
# Run only validate pre-commit check on min version supported
7688
if: ${{ matrix.directory == '.' }}
7789
run: pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)
@@ -106,7 +118,7 @@ jobs:
106118
- name: Install Python
107119
uses: actions/setup-python@v2
108120
- name: Set up Go
109-
uses: actions/setup-go@v2
121+
uses: actions/setup-go@v3
110122
with:
111123
go-version: ${{ env.GO_VERSION }}
112124
- name: Install Terraform v${{ matrix.version }}
@@ -117,10 +129,11 @@ jobs:
117129
run: |
118130
pip install pre-commit
119131
go install github.com/terraform-docs/terraform-docs@v0.16.0
132+
go install github.com/hashicorp/terraform-config-inspect@latest
120133
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
121134
- name: Clean pre-commit cache
122135
run: pre-commit clean
123-
- name: Execute pre-commit
136+
- name: Execute pre-commit max_version
124137
# Run all pre-commit checks on max version supported
125138
if: ${{ matrix.version == needs.getTerraformMinMaxVersion.outputs.maxVersion }}
126139
run: pre-commit run --color=always --show-diff-on-failure --all-files

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ override.tf.json
4444
.kitchen/*
4545
test/fixtures/**/.kitchen/
4646
test/snippets/*
47+
48+
# pre-commit workarounds
49+
**/aliased-providers.tf.json

.pre-commit-config.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
# hooks:
1717
# - id: terraform_validate
1818
# name: Terraform validate
19-
# entry: .pre-commit-terraform-validate-examples.sh
19+
# entry: resources/scripts/terraform_validate.sh
2020
# pass_filenames: false
2121
# language: script
2222
# verbose: true
@@ -30,13 +30,25 @@ repos:
3030
language: system
3131
entry: bash -c "find . \( -iname ".terraform*" ! -iname ".terraform-docs*" ! -path "*/test/*" \) -print0 | xargs -0 rm -r; true"
3232

33+
34+
- repo: local
35+
# Adding this patch to fix organizational multi-provider terraform validate error
36+
# 'missing provider provider["registry.terraform.io/hashicorp/aws"].member'
37+
# https://github.com/antonbabenko/pre-commit-terraform/#terraform_validate
38+
hooks:
39+
- id: generate_tf_providers
40+
name: generate_tf_providers
41+
language: system
42+
entry: bash -c "./resources/scripts/generate_providers.sh ./modules/infrastructure/permissions/org-role-ecs ./examples/organizational"
43+
pass_filenames: false
44+
3345
- repo: https://github.com/antonbabenko/pre-commit-terraform
3446
rev: v1.64.0
3547
hooks:
3648
- id: terraform_fmt
3749
# https://github.com/antonbabenko/pre-commit-terraform#terraform_validate
3850
- id: terraform_validate
39-
exclude: (modules/infrastructure/permissions/org-role-ecs)|(examples/organizational)|(test)|(examples-internal)\/.*$
51+
exclude: (test)|(examples-internal)\/.*$
4052
- id: terraform_docs
4153
args:
4254
- '--args=--sort-by required'

examples/organizational/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ $ terraform apply
143143

144144
| Name | Version |
145145
|------|---------|
146-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0.0 |
147-
| <a name="provider_aws.member"></a> [aws.member](#provider\_aws.member) | >= 4.0.0 |
148-
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | >= 0.5.33 |
146+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
147+
| <a name="provider_aws.member"></a> [aws.member](#provider\_aws.member) | 4.15.0 |
148+
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
149149

150150
## Modules
151151

examples/single-account-k8s/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $ terraform apply
8484

8585
| Name | Version |
8686
|------|---------|
87-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
87+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
8888
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.5.1 |
8989
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
9090

examples/trigger-events/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $ terraform apply
4949

5050
| Name | Version |
5151
|------|---------|
52-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
52+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
5353

5454
## Modules
5555

modules/infrastructure/cloudtrail/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
| Name | Version |
1414
|------|---------|
15-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
15+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1616

1717
## Modules
1818

modules/infrastructure/cloudtrail_s3-sns-sqs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ EVENT FILTER/fine-tunning, regarding what we want to send to Sysdig Cloud-Connec
4646

4747
| Name | Version |
4848
|------|---------|
49-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
49+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
5050

5151
## Modules
5252

modules/infrastructure/codebuild/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
| Name | Version |
1414
|------|---------|
15-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
15+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1616

1717
## Modules
1818

modules/infrastructure/ecs-vpc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
| Name | Version |
1515
|------|---------|
16-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
16+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1717

1818
## Modules
1919

modules/infrastructure/permissions/cloud-connector/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
| Name | Version |
1414
|------|---------|
15-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
15+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1616

1717
## Modules
1818

modules/infrastructure/permissions/cloud-scanning/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
| Name | Version |
1414
|------|---------|
15-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
15+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1616

1717
## Modules
1818

modules/infrastructure/permissions/general/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ General permissions that apply to both cloud-connector and cloud-scanning module
1515

1616
| Name | Version |
1717
|------|---------|
18-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
18+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1919

2020
## Modules
2121

modules/infrastructure/permissions/iam-user/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Note: Contact us if this authentication system does not match your requirement.
4545

4646
| Name | Version |
4747
|------|---------|
48-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
48+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
4949

5050
## Modules
5151

modules/infrastructure/permissions/org-role-ecs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ The aim of this module is to manage the organizational **managed account** requi
3131

3232
| Name | Version |
3333
|------|---------|
34-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.50.0 |
35-
| <a name="provider_aws.member"></a> [aws.member](#provider\_aws.member) | >= 3.50.0 |
34+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
35+
| <a name="provider_aws.member"></a> [aws.member](#provider\_aws.member) | 4.15.0 |
3636

3737
## Modules
3838

modules/infrastructure/permissions/org-role-eks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The aim of this module is to manage the organizational **managed account** requi
2929

3030
| Name | Version |
3131
|------|---------|
32-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
32+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
3333

3434
## Modules
3535

modules/infrastructure/resource-group/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
| Name | Version |
1515
|------|---------|
16-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
16+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1717

1818
## Modules
1919

modules/infrastructure/sqs-sns-subscription/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
| Name | Version |
1414
|------|---------|
15-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
15+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1616

1717
## Modules
1818

modules/infrastructure/ssm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ and pass it, in a safe way, to all the modules that require it.
1616

1717
| Name | Version |
1818
|------|---------|
19-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
19+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
2020

2121
## Modules
2222

modules/services/cloud-bench/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Deployed on **Sysdig Backend**
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
30-
| <a name="provider_random"></a> [random](#provider\_random) | 3.1.3 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
30+
| <a name="provider_random"></a> [random](#provider\_random) | 3.2.0 |
3131
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
3232

3333
## Modules

modules/services/cloud-connector-ecs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A task deployed on an **ECS deployment** will detect events in your infrastructu
1515

1616
| Name | Version |
1717
|------|---------|
18-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
18+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.15.0 |
1919
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
2020

2121
## Modules
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
for path in "$@"
4+
do
5+
echo "$path"
6+
terraform-config-inspect --json "$path" | jq -r '
7+
[.required_providers[].aliases]
8+
| flatten
9+
| del(.[] | select(. == null))
10+
| reduce .[] as $entry (
11+
{};
12+
.provider[$entry.name] //= [] | .provider[$entry.name] += [{"alias": $entry.alias}]
13+
)
14+
' > "$path"/aliased-providers.tf.json
15+
done

resources/terraform-clean.sh renamed to resources/scripts/terraform-clean.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# use from root path ./resources/terraform-clean.sh
3+
# use from root path ./resources/scripts/terraform-clean.sh
44
# we don't wanna delete possible ./test state tests
55

66
pushd .

use-cases/_questionnaire.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ modules, and we also offer [AWS Cloudformation templates](https://github.com/sys
2222
- deployment type
2323
- are you familiar with the installation stack? Terraform, Cloudformation, AWS CDK, ...?
2424
- if you want to use Kubernetes workload for Sysdig deployment, what's your current way of deploying helm charts?
25-
25+
2626

2727

2828
### AWS

0 commit comments

Comments
 (0)