Skip to content

Commit 83bd64f

Browse files
Fixes on the guide (#668)
1 parent e5b29d6 commit 83bd64f

8 files changed

+204
-26
lines changed

_docs-sources/guides/stay-up-to-date/cis/cis-1.5.0/deployment-walkthrough/step-1-check-your-live-infrastructure-is-cis-v1.4-compliant.md

Lines changed: 81 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,27 @@ Next install the AWS plugin with Steampipe:
3232
steampipe plugin install aws
3333
```
3434

35-
## 1.2 Configure Steampipe with AWS credentials
35+
## 1.2 Configure Steampipe to analyze all regions
36+
37+
The file `~/.steampipe/config/aws.spc`, that is created by Steampipe, needs to be updated to analyze all regions,
38+
by adding `regions = ["*"]`. Otherwise, multi-regions resouces, like AWS Config, IAM Access Analyzer will fail in the check:
39+
40+
```hcl
41+
connection "aws" {
42+
plugin = "aws"
43+
44+
# You may connect to one or more regions. If `regions` is not specified,
45+
# Steampipe will use a single default region using the same resolution
46+
# order as the AWS CLI:
47+
# 1. The `AWS_DEFAULT_REGION` or `AWS_REGION` environment variable
48+
# 2. The region specified in the active profile (`AWS_PROFILE` or default)
49+
regions = ["*"] # <- Update this line
50+
51+
# ... other existing config
52+
}
53+
```
3654

37-
The [Steampipe AWS plugin](https://hub.steampipe.io/plugins/turbot/aws) supports a range of options for granting
38-
Steampipe access to your AWS accounts.
3955

40-
In order for the compliance checks to work correctly, you need to:
41-
- Configure [multi-region connections](https://hub.steampipe.io/plugins/turbot/aws#multi-region-connections) so that Steampipe can access to all the regions you are using
42-
- Configure [multi-account connections](https://hub.steampipe.io/plugins/turbot/aws#multi-account-connections) so that Steampipe can access all the accounts you are using
4356

4457
## 1.3 Clone the Steampipe AWS Compliance Mod
4558

@@ -74,8 +87,69 @@ aws-vault exec dev -- aws iam generate-credential-report
7487
aws-vault exec dev -- steampipe check aws_compliance.benchmark.cis_v140
7588
```
7689

90+
### In case not all checks pass
91+
92+
:::caution
93+
94+
If you have failing checks, then there are manual steps necessary to your infrastructure achieve CIS compliance.
95+
96+
:::
97+
98+
After deploying a CIS Reference Architecture, there are steps that unfortunately can't be automated. See the [Manual steps](/guides/build-it-yourself/achieve-compliance/deployment-walkthrough/manual-steps) page, with step-by-step instructions
99+
to achieve complience.
100+
101+
102+
:::note
103+
104+
If you Reference Architecture was deployed before February 9th 2023, there are two extra steps that need to be followed:
105+
106+
:::
107+
108+
#### Enable `ap-northeast-3` at your `multi_region_common.hcl`
109+
110+
Add `ap-northeast-3` to the `opt_in_regions` local variable in `multi_region_common.hcl`.
111+
112+
```hcl title=multi_region_common.hcl
113+
# ----------------------------------------------------------------------------------------------------------------
114+
# MULTIREGION CONVENIENCE LOCALS
115+
# The following locals are used for constructing multi region provider configurations for the underlying module.
116+
# ----------------------------------------------------------------------------------------------------------------
117+
locals {
118+
# Creates resources in the specified regions. The best practice is to enable multiregion modules in all enabled
119+
# regions in your AWS account. To get the list of regions enabled in your AWS account, you can use the AWS CLI: aws
120+
# ec2 describe-regions.
121+
opt_in_regions = [
122+
...
123+
"ap-northeast-3"
124+
]
125+
126+
# ... other vars omitted for brevity ...
127+
```
128+
129+
There is a new region `me-central-1`, that you will need to add in the `multi_region_common.hcl` after doing the version updates.
130+
131+
### Enable AWS Organizations metrics filter
132+
133+
If the `4.15` recommendation is also failing, it's because the filter is still not created in the account. So in the
134+
files `_envcommon/landingzone/account-baseline-app/account-baseline-app-base.hcl` and `security/_global/account-baseline/terragrunt.hcl`,
135+
Add this a variable:
136+
137+
```hcl
138+
inputs = {
139+
# ... other variables above
140+
141+
cloudtrail_benchmark_alarm_enable_organizations_filters = true
142+
}
143+
```
144+
145+
Run `terragrunt apply` in each account to create the new metric filter.
146+
147+
If the check is still not working, the release [v0.44.1](https://github.com/gruntwork-io/terraform-aws-cis-service-catalog/releases/tag/v0.44.1)
148+
of the CIS Service Catalog contains a fix for the filter match Steampipe's query. In the next steps you will update
149+
the versions of CIS Service Catalog (and some other services) to the latest, so it will be fixed.
150+
77151
## Next steps
78152

79153
If you've confirmed that your live infrastructure is compliant with the CIS AWS Foundations Benchmark v1.4 then you're
80154
ready to move to [step 2](step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md) and update your
81-
references to the Gruntwork Infrastructure as Code Library. Otherwise, if some checks are failing you should check the [Manual steps](/guides/build-it-yourself/achieve-compliance/deployment-walkthrough/manual-steps) section, that contains extra steps to achieve CIS compliance.
155+
references to the Gruntwork Infrastructure as Code Library.

_docs-sources/guides/stay-up-to-date/cis/cis-1.5.0/deployment-walkthrough/step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,16 @@ Access Token with `repo` and `org` scope and set the environment variable `G
184184
export GITHUB_OAUTH_TOKEN="<YOUR_GITHUB_PAT>"
185185
```
186186

187-
Next, in your terminal navigate to the directory with your CIS `infrastructure-live` code and run Patcher’s `upgrade cis` command:
187+
Next, in your terminal navigate to the directory with your CIS `infrastructure-live` code and run Patcher’s `upgrade cis` command once on each environment (dev, prod, stage, security etc):
188188

189189

190190
```bash
191191
cd <PATH/TO/YOUR/INFRASTRUCTURE-LIVE/CODE>
192+
cd dev
192193
patcher upgrade cis
193194
```
194195

195-
Patcher will then scan your current directory and its subdirectories, looking for the files containing Terraform or Terragrunt
196-
dependencies.
196+
Patcher will then scan your current directory and its subdirectories, looking for the files containing Terraform or Terragrunt dependencies.
197197

198198
#### Analysis of module usage
199199

@@ -234,10 +234,18 @@ You must run the migration scripts. Failing to do so will result in data loss.
234234
:::
235235

236236
When Patcher completes successfully it provides a list migration scripts that need to be run before proceeding.
237+
In order to see the full path of the new scripts, run `git status`, and they will appear as a new file.
237238

238239

239240
![Screenshot of Patcher's summary.](/img/guides/stay-up-to-date/cis-1.5.0/patcher-summary.png)
240241

242+
Example:
243+
244+
```bash
245+
cd us-west-2/dev/data-stores/rds/
246+
aws-vault exec dev -- ./01_state_mv_rds_database.sh
247+
```
248+
241249
### Next Steps
242250

243251
:::caution

_docs-sources/guides/stay-up-to-date/cis/cis-1.5.0/deployment-walkthrough/step-3-update-the-account-baseline-modules.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ For Terraform, follow the migration guide in [the migration guide of the release
4747

4848
If you have successfully completed step 3.1 then you should now move to [step 4](step-4-verify-the-code-changes)
4949
in order to verify the changes that have been made. We strongly recommend that you verify the changes that have been
50-
made before executing `terraform/terragrunt apply`.
50+
made _before_ executing `terraform/terragrunt apply`.
51+

_docs-sources/guides/stay-up-to-date/cis/cis-1.5.0/deployment-walkthrough/step-4-verify-the-code-changes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,11 @@ When applying the changes manually, you can run `terragrunt run-all apply` insid
106106
security, shared etc), and waiting them to successful update before applying the changes before the next one, e.g. wait
107107
for `dev` to successfully finish before applying `prod`.
108108

109+
Example of using Terragrunt, after running Patcher in the `dev` folder:
110+
```
111+
aws-vault exec dev -- terragrunt run-all init
112+
aws-vault exec dev -- terragrunt run-all apply
113+
```
114+
109115
After the changes have been applied we recommend you complete [step 5](step-5-check-your-live-infrastructure-is-cis-v1.5-compliant)
110116
and confirm that your infrastructure is now CIS AWS Foundations Benchmark v1.5.0 compliant.

docs/guides/stay-up-to-date/cis/cis-1.5.0/deployment-walkthrough/step-1-check-your-live-infrastructure-is-cis-v1.4-compliant.md

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,27 @@ Next install the AWS plugin with Steampipe:
3232
steampipe plugin install aws
3333
```
3434

35-
## 1.2 Configure Steampipe with AWS credentials
35+
## 1.2 Configure Steampipe to analyze all regions
36+
37+
The file `~/.steampipe/config/aws.spc`, that is created by Steampipe, needs to be updated to analyze all regions,
38+
by adding `regions = ["*"]`. Otherwise, multi-regions resouces, like AWS Config, IAM Access Analyzer will fail in the check:
39+
40+
```hcl
41+
connection "aws" {
42+
plugin = "aws"
43+
44+
# You may connect to one or more regions. If `regions` is not specified,
45+
# Steampipe will use a single default region using the same resolution
46+
# order as the AWS CLI:
47+
# 1. The `AWS_DEFAULT_REGION` or `AWS_REGION` environment variable
48+
# 2. The region specified in the active profile (`AWS_PROFILE` or default)
49+
regions = ["*"] # <- Update this line
50+
51+
# ... other existing config
52+
}
53+
```
3654

37-
The [Steampipe AWS plugin](https://hub.steampipe.io/plugins/turbot/aws) supports a range of options for granting
38-
Steampipe access to your AWS accounts.
3955

40-
In order for the compliance checks to work correctly, you need to:
41-
- Configure [multi-region connections](https://hub.steampipe.io/plugins/turbot/aws#multi-region-connections) so that Steampipe can access to all the regions you are using
42-
- Configure [multi-account connections](https://hub.steampipe.io/plugins/turbot/aws#multi-account-connections) so that Steampipe can access all the accounts you are using
4356

4457
## 1.3 Clone the Steampipe AWS Compliance Mod
4558

@@ -74,16 +87,77 @@ aws-vault exec dev -- aws iam generate-credential-report
7487
aws-vault exec dev -- steampipe check aws_compliance.benchmark.cis_v140
7588
```
7689

90+
### In case not all checks pass
91+
92+
:::caution
93+
94+
If you have failing checks, then there are manual steps necessary to your infrastructure achieve CIS compliance.
95+
96+
:::
97+
98+
After deploying a CIS Reference Architecture, there are steps that unfortunately can't be automated. See the [Manual steps](/guides/build-it-yourself/achieve-compliance/deployment-walkthrough/manual-steps) page, with step-by-step instructions
99+
to achieve complience.
100+
101+
102+
:::note
103+
104+
If you Reference Architecture was deployed before February 9th 2023, there are two extra steps that need to be followed:
105+
106+
:::
107+
108+
#### Enable `ap-northeast-3` at your `multi_region_common.hcl`
109+
110+
Add `ap-northeast-3` to the `opt_in_regions` local variable in `multi_region_common.hcl`.
111+
112+
```hcl title=multi_region_common.hcl
113+
# ----------------------------------------------------------------------------------------------------------------
114+
# MULTIREGION CONVENIENCE LOCALS
115+
# The following locals are used for constructing multi region provider configurations for the underlying module.
116+
# ----------------------------------------------------------------------------------------------------------------
117+
locals {
118+
# Creates resources in the specified regions. The best practice is to enable multiregion modules in all enabled
119+
# regions in your AWS account. To get the list of regions enabled in your AWS account, you can use the AWS CLI: aws
120+
# ec2 describe-regions.
121+
opt_in_regions = [
122+
...
123+
"ap-northeast-3"
124+
]
125+
126+
# ... other vars omitted for brevity ...
127+
```
128+
129+
There is a new region `me-central-1`, that you will need to add in the `multi_region_common.hcl` after doing the version updates.
130+
131+
### Enable AWS Organizations metrics filter
132+
133+
If the `4.15` recommendation is also failing, it's because the filter is still not created in the account. So in the
134+
files `_envcommon/landingzone/account-baseline-app/account-baseline-app-base.hcl` and `security/_global/account-baseline/terragrunt.hcl`,
135+
Add this a variable:
136+
137+
```hcl
138+
inputs = {
139+
# ... other variables above
140+
141+
cloudtrail_benchmark_alarm_enable_organizations_filters = true
142+
}
143+
```
144+
145+
Run `terragrunt apply` in each account to create the new metric filter.
146+
147+
If the check is still not working, the release [v0.44.1](https://github.com/gruntwork-io/terraform-aws-cis-service-catalog/releases/tag/v0.44.1)
148+
of the CIS Service Catalog contains a fix for the filter match Steampipe's query. In the next steps you will update
149+
the versions of CIS Service Catalog (and some other services) to the latest, so it will be fixed.
150+
77151
## Next steps
78152

79153
If you've confirmed that your live infrastructure is compliant with the CIS AWS Foundations Benchmark v1.4 then you're
80154
ready to move to [step 2](step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md) and update your
81-
references to the Gruntwork Infrastructure as Code Library. Otherwise, if some checks are failing you should check the [Manual steps](/guides/build-it-yourself/achieve-compliance/deployment-walkthrough/manual-steps) section, that contains extra steps to achieve CIS compliance.
155+
references to the Gruntwork Infrastructure as Code Library.
82156

83157

84158
<!-- ##DOCS-SOURCER-START
85159
{
86160
"sourcePlugin": "local-copier",
87-
"hash": "62d099236900a6e8c664ee28cc061faf"
161+
"hash": "296848a030a0676c4e7051e606f41a7e"
88162
}
89163
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/cis/cis-1.5.0/deployment-walkthrough/step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,16 @@ Access Token with `repo` and `org` scope and set the environment variable `G
184184
export GITHUB_OAUTH_TOKEN="<YOUR_GITHUB_PAT>"
185185
```
186186

187-
Next, in your terminal navigate to the directory with your CIS `infrastructure-live` code and run Patcher’s `upgrade cis` command:
187+
Next, in your terminal navigate to the directory with your CIS `infrastructure-live` code and run Patcher’s `upgrade cis` command once on each environment (dev, prod, stage, security etc):
188188

189189

190190
```bash
191191
cd <PATH/TO/YOUR/INFRASTRUCTURE-LIVE/CODE>
192+
cd dev
192193
patcher upgrade cis
193194
```
194195

195-
Patcher will then scan your current directory and its subdirectories, looking for the files containing Terraform or Terragrunt
196-
dependencies.
196+
Patcher will then scan your current directory and its subdirectories, looking for the files containing Terraform or Terragrunt dependencies.
197197

198198
#### Analysis of module usage
199199

@@ -234,10 +234,18 @@ You must run the migration scripts. Failing to do so will result in data loss.
234234
:::
235235

236236
When Patcher completes successfully it provides a list migration scripts that need to be run before proceeding.
237+
In order to see the full path of the new scripts, run `git status`, and they will appear as a new file.
237238

238239

239240
![Screenshot of Patcher's summary.](/img/guides/stay-up-to-date/cis-1.5.0/patcher-summary.png)
240241

242+
Example:
243+
244+
```bash
245+
cd us-west-2/dev/data-stores/rds/
246+
aws-vault exec dev -- ./01_state_mv_rds_database.sh
247+
```
248+
241249
### Next Steps
242250

243251
:::caution
@@ -306,6 +314,6 @@ If you have successfully completed manually updating the modules to the minimum
306314
<!-- ##DOCS-SOURCER-START
307315
{
308316
"sourcePlugin": "local-copier",
309-
"hash": "edec39c8ee33888c076155f010db3e38"
317+
"hash": "46739fa913b27a01c8a920d59c43c5e3"
310318
}
311319
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/cis/cis-1.5.0/deployment-walkthrough/step-3-update-the-account-baseline-modules.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ For Terraform, follow the migration guide in [the migration guide of the release
4747

4848
If you have successfully completed step 3.1 then you should now move to [step 4](step-4-verify-the-code-changes)
4949
in order to verify the changes that have been made. We strongly recommend that you verify the changes that have been
50-
made before executing `terraform/terragrunt apply`.
50+
made _before_ executing `terraform/terragrunt apply`.
51+
5152

5253

5354
<!-- ##DOCS-SOURCER-START
5455
{
5556
"sourcePlugin": "local-copier",
56-
"hash": "3b2fcb8ea363ccb6299eb53b83284ce3"
57+
"hash": "1df1b78e9d68f5ff116c2faab5b27126"
5758
}
5859
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/cis/cis-1.5.0/deployment-walkthrough/step-4-verify-the-code-changes.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,19 @@ When applying the changes manually, you can run `terragrunt run-all apply` insid
106106
security, shared etc), and waiting them to successful update before applying the changes before the next one, e.g. wait
107107
for `dev` to successfully finish before applying `prod`.
108108

109+
Example of using Terragrunt, after running Patcher in the `dev` folder:
110+
```
111+
aws-vault exec dev -- terragrunt run-all init
112+
aws-vault exec dev -- terragrunt run-all apply
113+
```
114+
109115
After the changes have been applied we recommend you complete [step 5](step-5-check-your-live-infrastructure-is-cis-v1.5-compliant)
110116
and confirm that your infrastructure is now CIS AWS Foundations Benchmark v1.5.0 compliant.
111117

112118

113119
<!-- ##DOCS-SOURCER-START
114120
{
115121
"sourcePlugin": "local-copier",
116-
"hash": "d6bb869058ce4fda05e3b5e2e985657b"
122+
"hash": "9e04dae37862a686590bcfe5c62940d2"
117123
}
118124
##DOCS-SOURCER-END -->

0 commit comments

Comments
 (0)