Skip to content

Commit e358cd1

Browse files
authored
Update Baselines with AWS, Azure and GCP Mod Installs (#833)
* Update AWS, Azure and GCP Mods * Install minimum mods for cis * Add service enable policies * rearrange * remove consoletimeout policy * remove example folder * rename folders * update README * Update README.md files * remove mappings, securityhub notifications, todo packs * update README * use table of links only * update README.md * update README for mods * update README for service enabled * update README for guardrails * remove defaults in variables
1 parent 19841e6 commit e358cd1

File tree

477 files changed

+4806
-22118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

477 files changed

+4806
-22118
lines changed

baselines/CHANGELOG.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

baselines/README.md

Lines changed: 43 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -4,120 +4,63 @@ Turbot Guardrails Baselines provide best-practice configurations and examples fo
44

55
## Current Baselines
66

7-
| Baseline | Path | Description |
8-
| --------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
9-
| Local Directory | [local_directory](./turbot/local_directory) | Create local directory and users in your workspace |
10-
| AWS Setup | [aws_setup](./aws/aws_setup) | Common quickstart setup for AWS - prepare your environment to import an AWS account |
11-
| AWS Account Import | [aws_account_import](./aws/aws_account_import) | Import an AWS Account into Guardrails |
12-
| AWS Services | [aws_services](./aws/aws_services) | Enable/Disable AWS Services in Guardrails |
13-
| GCP Setup | [gcp_setup](./gcp/gcp_setup) | Common quickstart setup for GCP - prepare your environment to import GCP Projects |
14-
| GCP Services | [gcp_services](./gcp/gcp_services) | Enable/Disable GCP Services in Guardrails & also enforce api enabled policy based on service Enable/Disable |
15-
| Azure Subscription Import | [azure_sub_import](./azure/azure_sub_import) | Import an Azure subscription into Guardrails |
16-
| Azure Subscription Readonly | [azure_sub_import_ro](./azure/azure_sub_create_then_import_ro) | Import an Azure subscription into Guardrails with event handler and readonly mode |
17-
| Azure Services | [azure_services](./azure/azure_services) | Enable/Disable Azure Services in Guardrails |
18-
| Azure Provider Registration | [azure_provider_registration](./azure/azure_provider_registration) | Set the policy for Azure provider registration |
19-
20-
## Prerequisites
21-
22-
To run Turbot Guardrails baselines, you must install:
7+
| Baseline | Path | Description |
8+
|-----------------------|--------------------------------------------------------|----------------------------------------------------------------------------------|
9+
| AWS Mods | [aws_mods](./aws/aws_mods) | A common list of AWS mods to install |
10+
| AWS Service Enabled | [aws_service_enabled](./aws/aws_service_enabled) | Enable or disable AWS services in Guardrails |
11+
| Azure Mods | [azure_mods](./azure/azure_mods) | A common list of Azure mods to install |
12+
| Azure Service Enabled | [azure_service_enabled](./azure/azure_service_enabled) | Enable or disable Azure services in Guardrails; register or deregister Azure providers |
13+
| GCP Mods | [gcp_mods](./gcp/gcp_mods) | A common list of Google Cloud Platform (GCP) mods to install |
14+
| GCP Service Enabled | [gcp_service_enabled](./gcp/gcp_service_enabled) | Enable or disable GCP services in Guardrails; enable or disable GCP Service APIs |
15+
| Folder Hierarchy | [folder_hierarchy](./guardrails/folder_hierarchy) | Create a folder hierarchy in your workspace |
16+
| Guardrails Mods | [guardrails_mods](./guardrails/guardrails_mods) | A common list of Guardrails mods to install |
17+
| Local Directory | [local_directory](./guardrails/local_directory) | Create a local directory and users in your workspace |
18+
| Turbot Directory | [turbot_directory](./guardrails/turbot_profiles) | Create Turbot directory and profiles in your workspace |
19+
| Workspace Settings | [workspace_settings](./guardrails/workspace_settings) | Apply a common set of policies for better management of your workspace |
20+
21+
## Getting Started
22+
23+
### Requirements
2324

2425
- [Terraform](https://developer.hashicorp.com/terraform/install)
25-
- [Turbot Guardrails Terraform Provider](https://turbot.com/guardrails/docs/reference/terraform)
2626

27-
Additionally, You must set your `config.tf` or environment variables to connect to your Turbot Guardrails workspace, as detail in the Turbot Guardrails Terraform Provider [Installation Instructions](https://turbot.com/guardrails/docs/reference/terraform/setup)
27+
### Credentials
2828

29-
## Running a Baseline
29+
To create a policy pack through Terraform:
3030

31-
To run a baseline:
31+
- Ensure you have `Turbot/Owner` permissions in Guardrails
32+
- [Create access keys](https://turbot.com/guardrails/docs/guides/iam/access-keys#generate-a-new-guardrails-api-access-key) in Guardrails
3233

33-
1. Install and configure the [prerequisites](#prerequisites)
34-
1. At the command line, go to the directory for the baseline, for example: `cd mod_install`
35-
1. Run `terraform init` to initialize terraform in the directory
36-
1. Edit any variables in the .tf file that you wish to change, or override with [environment variables](https://www.terraform.io/docs/commands/environment-variables.html) or [variable files](https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files)
37-
1. Run `terraform plan -var-file="<fileName>.tfvars"` and inspect the changes
38-
1. Run `terraform apply -var-file="<fileName>.tfvars"` to apply the configuration
34+
And then set your credentials:
3935

40-
## Contributing
36+
```sh
37+
export TURBOT_WORKSPACE=myworkspace.acme.com
38+
export TURBOT_ACCESS_KEY=acce6ac5-access-key-here
39+
export TURBOT_SECRET_KEY=a8af61ec-secret-key-here
40+
```
4141

42-
### Structure
42+
Please see [Turbot Guardrails Provider authentication](https://registry.terraform.io/providers/turbot/turbot/latest/docs#authentication) for additional authentication methods.
4343

44-
Baselines are implemented as independently deployable terraform configurations in a sub-directory of this repository.
44+
## Usage
4545

46-
Commonly changed parameters are implemented using variables. All variables have default values, but they may not be the settings that you want, you may change them as required.
46+
### Install Baseline
4747

48-
The baseline mods contain an individual `README.md` file and follows a specified file structure containing the parameters and configurations. Each baseline mod contains:
48+
Clone:
4949

50-
- `Variables.tf` containing the variable definitions
50+
```sh
51+
git clone https://github.com/turbot/guardrails-samples.git
52+
cd guardrails-samples/baselines/guardrails/local_directory
53+
```
5154

52-
- `main.tf` containing the terraform resources that creates the objects
55+
Run the Terraform to create the policy pack in your workspace:
5356

54-
- `outputs.tf` containing the return values defined. The file should be optionally created when there is an output block included in the configuration
57+
```sh
58+
terraform init
59+
terraform plan
60+
```
5561

56-
- `default.tfvars` containing the defaults for the variables
62+
Then apply the changes:
5763

64+
```sh
65+
terraform apply
5866
```
59-
Baseline
60-
.
61-
├── README.md
62-
├── main.tf
63-
├── variables.tf
64-
├── outputs.tf
65-
└── default.tfvar
66-
```
67-
68-
### Style Guide
69-
70-
Our baselines adopts styling conventions provided by [Terraform](https://www.terraform.io/docs/configuration/style.html) like:
71-
72-
- Align the equal to signs for arguments appearing on consecutive lines with values.
73-
- Variables should use snake case: `this_is_an_example`
74-
- Use empty lines to separate logical groups of arguments within a block.
75-
76-
To maintain consistency between files and modules, we recommend adopting the below added styling conventions:
77-
78-
- For each baseline, include the variable definitions in the variables.tf file, the resources in main.tf file, and the output in outputs.tf file.
79-
- For `turbot_policy_setting` and `turbot_policy_value` resources , include the policy type hierarchy in a comment before the resource. For example:
80-
81-
```terraform
82-
# AWS > Account > Turbot IAM Role > External ID
83-
resource "turbot_policy_setting" "turbotIamRoleExternalId" {
84-
resource = turbot_resource.account_resource.id
85-
type = "tmod:@turbot/aws#/policy/types/turbotIamRoleExternalId"
86-
value = var.turbot_external_id
87-
}
88-
```
89-
90-
- Use a single hash for comments that refer only to a single resource, immediately before the resource, for example:
91-
92-
```terraform
93-
# 1.4 Ensure access keys are rotated every 90 days or less (Scored)
94-
# AWS > IAM > Access Key > Active > Age
95-
# Setting value to "Force inactive if age > 90" days to meet remediation
96-
resource "turbot_policy_setting" "AWS_IAM_AccessKey_Active_Age" {
97-
resource = var.target_resource
98-
type = "tmod:@turbot/aws-iam#/policy/types/accessKeyActiveAge"
99-
value = "Force inactive if age > 90 days"
100-
}
101-
```
102-
103-
- Use 4 hashes for comments that describe a group of resources, or general behavior:
104-
105-
```terraform
106-
#### Set the credentials (Role, external id) for the account via Guardrails policies
107-
```
108-
109-
- All variables should have a description, and as a result should not require individual comments
110-
- Most variables should have a reasonable default
111-
- Where baselines apply policies, they generally should use a variable for the target resource
112-
113-
- it should be called target_resource
114-
- it should default to "tmod:@turbot/turbot#/"
115-
- it should have a comment that states that it may be changes or overridden
116-
117-
```terraform
118-
variable "target_resource" {
119-
type = "string"
120-
description = "Enter the target resource id or aka"
121-
default = "tmod:@turbot/turbot#/" # You may change/override this value to the id of target folder or resource
122-
}
123-
```

baselines/aws/aws_account_import/README.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

baselines/aws/aws_account_import/default.tfvars

Lines changed: 0 additions & 14 deletions
This file was deleted.

baselines/aws/aws_account_import/main.tf

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)