Skip to content

Commit 331b156

Browse files
author
iru
authored
Chore/refact homogeneization (#41)
* chore(refact): deploy vs. enable homogenization * chore(doc): example homogeneization * chore(doc): contrib homogeneization * chore(doc): cc/cs intro
1 parent 294c3cb commit 331b156

File tree

18 files changed

+45
-54
lines changed

18 files changed

+45
-54
lines changed

CONTRIBUTE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
Technical validation for terraform **lint**, **validation**, and **documentation**
5050

5151
We're using **pre-commit** | https://pre-commit.com
52-
- Defined in `/.pre-commit-config.yaml`
53-
- custom configuration | https://github.com/sysdiglabs/terraform-google-secure-for-cloud/blob/master/.pre-commit-config.yaml
54-
- current `terraform-docs` version, requires developer to create `README.md` file, with the enclosure tags for docs to insert the automated content
52+
- Defined in `/.pre-commit-config.yaml`
53+
- custom configuration | https://github.com/sysdiglabs/terraform-google-secure-for-cloud/blob/master/.pre-commit-config.yaml
54+
- current `terraform-docs` version, requires developer to create `README.md` file, with the enclosure tags for docs to insert the automated content
5555
```markdown
5656
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5757
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
@@ -72,7 +72,7 @@ Implemented vía **Terraform Kitchen** | https://newcontext-oss.github.io/kitche
7272

7373
Ruby 2.7 is required to launch the tests.
7474
Run `bundle install` to get kitchen-terraform bundle.
75-
GCP project and AWS credentials should be configured locally.
75+
Cloud Provider credentials should be configured locally.
7676
```shell
7777
# launch the tests, in other words, it will run `terraform apply`
7878
$ bundle exec kitchen converge

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ More info in [`./examples/single-account`](https://github.com/sysdiglabs/terrafo
2929

3030
### - Single-Account with a pre-existing Kubernetes Cluster
3131

32-
If you already own a Kubernetes Cluster on AWS, you can use it to deploy Sysdig Secure for Cloud, instead of default ECS cluster.
33-
32+
If you already own a Kubernetes Cluster on AWS, you can use it to deploy Sysdig Secure for Cloud, instead of default ECS cluster.<br/>
3433
More info in [`./examples/single-account-k8s`](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud/tree/master/examples/single-account-k8s)
3534

3635
### - Organizational
3736

38-
Using an organizational configuration Cloudtrail.
37+
Using an organizational configuration Cloudtrail.<br/>
3938
More info in [`./examples/organizational`](https://github.com/sysdiglabs/terraform-aws-secure-for-cloud/tree/master/examples/organizational)
4039

4140
![organizational diagram](https://raw.githubusercontent.com/sysdiglabs/terraform-aws-secure-for-cloud/5b7cf5e8028b3177536c9c847020ad6319342b44/examples/organizational/diagram-org.png)
@@ -109,9 +108,9 @@ Notice that:
109108
source_profile=<AWS_MANAGEMENT_ACCOUNT_PROFILE>
110109
```
111110
112-
- Q: How to test **cloud-scanner** image-scanning?<br/>
113-
A: Upload any image to the ECR repository of AWS. You should see a log in the ECS-cloud-scanner task + CodeBuild project being launched successfully
114-
<br/>
111+
- Q: How to test **cloud-scanner** image-scanning?<br/>
112+
A: Upload any image to the ECR repository of AWS. You should see a log in the ECS-cloud-scanner task + CodeBuild project being launched successfully
113+
<br/>
115114
116115
117116
<br/><br/>

examples/organizational/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Sysdig Secure for Cloud in AWS :: Shared Organizational Trail
1+
# Sysdig Secure for Cloud in AWS<br/>[ Example :: Shared Organizational Trail ]
22

33
Deploy Sysdig Secure for Cloud sharing the Trail within an organization.
44

examples/single-account-k8s/README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Sysdig Secure for Cloud in AWS <br/>:: Single-Account on Kubernetes Cluster
1+
# Sysdig Secure for Cloud in AWS <br/>[ Example :: Single-Account on Kubernetes Cluster ]
22

33
Deploy Sysdig Secure for Cloud in a provided existing Kubernetes Cluster.
44

@@ -17,17 +17,12 @@ All the required resources and workloads will be run under the same AWS account.
1717
Minimum requirements:
1818

1919
1. **AWS** profile credentials configuration
20-
2120
2. **Kubernetes** cluster configured within your helm provider
22-
2321
3. **Sysdig** Secure requirements, as input variable value
24-
2522
```
2623
sysdig_secure_api_token=<SECURE_API_TOKEN>
2724
```
2825

29-
30-
3126
## Usage
3227

3328
For quick testing, use this snippet on your terraform files
@@ -106,8 +101,8 @@ Notice that:
106101
| <a name="input_sysdig_secure_api_token"></a> [sysdig\_secure\_api\_token](#input\_sysdig\_secure\_api\_token) | Sysdig Secure API token | `string` | n/a | yes |
107102
| <a name="input_cloudtrail_is_multi_region_trail"></a> [cloudtrail\_is\_multi\_region\_trail](#input\_cloudtrail\_is\_multi\_region\_trail) | true/false whether cloudtrail will ingest multiregional events. testing/economization purpose. | `bool` | `true` | no |
108103
| <a name="input_cloudtrail_kms_enable"></a> [cloudtrail\_kms\_enable](#input\_cloudtrail\_kms\_enable) | true/false whether s3 should be encrypted. testing/economization purpose. | `bool` | `true` | no |
109-
| <a name="input_enable_cloud_connector"></a> [enable\_cloud\_connector](#input\_enable\_cloud\_connector) | true/false whether to provision cloud\_connector permissions | `bool` | `true` | no |
110-
| <a name="input_enable_cloud_scanning"></a> [enable\_cloud\_scanning](#input\_enable\_cloud\_scanning) | true/false whether to provision cloud\_scanning permissions | `bool` | `true` | no |
104+
| <a name="input_deploy_image_scanning"></a> [deploy\_image\_scanning](#input\_deploy\_image\_scanning) | true/false whether to deploy cloud\_scanning | `bool` | `true` | no |
105+
| <a name="input_deploy_threat_detection"></a> [deploy\_threat\_detection](#input\_deploy\_threat\_detection) | true/false whether to deploy cloud\_connector | `bool` | `true` | no |
111106
| <a name="input_name"></a> [name](#input\_name) | Name to be assigned to all child resources. A suffix may be added internally when required. Use default value unless you need to install multiple instances | `string` | `"sfc"` | no |
112107
| <a name="input_region"></a> [region](#input\_region) | Default region for resource creation | `string` | `"eu-central-1"` | no |
113108
| <a name="input_sysdig_secure_endpoint"></a> [sysdig\_secure\_endpoint](#input\_sysdig\_secure\_endpoint) | Sysdig Secure API endpoint | `string` | `"https://secure.sysdig.com"` | no |

examples/single-account-k8s/cloud-connector.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# requirements
33
#-------------------------------------
44
module "cloud_connector_sqs" {
5-
count = var.enable_cloud_connector ? 1 : 0
5+
count = var.deploy_threat_detection ? 1 : 0
66
source = "../../modules/infrastructure/sqs-sns-subscription"
77

88
name = "${var.name}-cloud_connector"
@@ -15,7 +15,7 @@ module "cloud_connector_sqs" {
1515
# cloud_connector
1616
#-------------------------------------
1717
resource "helm_release" "cloud_connector" {
18-
count = var.enable_cloud_connector ? 1 : 0
18+
count = var.deploy_threat_detection ? 1 : 0
1919

2020
name = "cloud-connector"
2121
repository = "https://charts.sysdig.com"

examples/single-account-k8s/cloud-scanning.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# requirements
33
#-------------------------------------
44
module "cloud_scanning_sqs" {
5-
count = var.enable_cloud_scanning ? 1 : 0
5+
count = var.deploy_image_scanning ? 1 : 0
66
source = "../../modules/infrastructure/sqs-sns-subscription"
77

88
name = "${var.name}-cloud_scanning"
@@ -12,7 +12,7 @@ module "cloud_scanning_sqs" {
1212

1313

1414
module "codebuild" {
15-
count = var.enable_cloud_scanning ? 1 : 0
15+
count = var.deploy_image_scanning ? 1 : 0
1616
source = "../../modules/infrastructure/codebuild"
1717

1818
secure_api_token_secret_name = module.ssm.secure_api_token_secret_name
@@ -26,7 +26,7 @@ module "codebuild" {
2626
# cloud_scanning
2727
#-------------------------------------
2828
resource "helm_release" "cloud_scanning" {
29-
count = var.enable_cloud_scanning ? 1 : 0
29+
count = var.deploy_image_scanning ? 1 : 0
3030
name = "cloud-scanning"
3131

3232
repository = "https://charts.sysdig.com"

examples/single-account-k8s/credentials.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ module "iam_user" {
22
source = "../../modules/infrastructure/permissions/iam-user"
33
name = var.name
44
ssm_secure_api_token_arn = module.ssm.secure_api_token_secret_arn
5-
enable_cloud_connector = var.enable_cloud_connector
6-
enable_cloud_scanning = var.enable_cloud_scanning
5+
deploy_threat_detection = var.deploy_threat_detection
6+
deploy_image_scanning = var.deploy_image_scanning
77
}

examples/single-account-k8s/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ variable "sysdig_secure_api_token" {
88
# optionals - with defaults
99
#---------------------------------
1010

11-
variable "enable_cloud_connector" {
11+
variable "deploy_threat_detection" {
1212
type = bool
13-
description = "true/false whether to provision cloud_connector permissions"
13+
description = "true/false whether to deploy cloud_connector"
1414
default = true
1515
}
1616

17-
variable "enable_cloud_scanning" {
17+
variable "deploy_image_scanning" {
1818
type = bool
19-
description = "true/false whether to provision cloud_scanning permissions"
19+
description = "true/false whether to deploy cloud_scanning"
2020
default = true
2121
}
2222

examples/single-account/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Sysdig Secure for Cloud in AWS :: Single-Account on ECS Fargate Service
1+
# Sysdig Secure for Cloud in AWS<br/>[ Example :: Single-Account ]
22

3-
Deploy Sysdig Secure for Cloud in a single AWS account
4-
5-
All the required resources and workloads will be run under the same AWS account.
3+
Deploy Sysdig Secure for Cloud in a single AWS account.<br/>
4+
All the required resources and workloads will be run under the same account.
65

76
![single-account diagram](https://raw.githubusercontent.com/sysdiglabs/terraform-aws-secure-for-cloud/7d142829a701ce78f13691a4af4be373625e7ee2/examples/single-account/diagram-single.png)
87

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ No modules.
5252
|------|-------------|------|---------|:--------:|
5353
| <a name="input_cloudtrail_s3_arn"></a> [cloudtrail\_s3\_arn](#input\_cloudtrail\_s3\_arn) | Cloudtrail S3 bucket ARN | `string` | n/a | yes |
5454
| <a name="input_user_arn"></a> [user\_arn](#input\_user\_arn) | ARN of the IAM user to which roles will be added | `string` | n/a | yes |
55-
| <a name="input_enable_cloud_connector"></a> [enable\_cloud\_connector](#input\_enable\_cloud\_connector) | true/false whether to provision cloud\_connector permissions | `bool` | `true` | no |
56-
| <a name="input_enable_cloud_scanning"></a> [enable\_cloud\_scanning](#input\_enable\_cloud\_scanning) | true/false whether to provision cloud\_scanning permissions | `bool` | `true` | no |
55+
| <a name="input_deploy_image_scanning"></a> [deploy\_image\_scanning](#input\_deploy\_image\_scanning) | true/false whether to provision cloud\_scanning permissions | `bool` | `true` | no |
56+
| <a name="input_deploy_threat_detection"></a> [deploy\_threat\_detection](#input\_deploy\_threat\_detection) | true/false whether to provision cloud\_connector permissions | `bool` | `true` | no |
5757
| <a name="input_name"></a> [name](#input\_name) | Name to be assigned to all child resources. A suffix may be added internally when required. Use default value unless you need to install multiple instances | `string` | `"sfc"` | no |
5858
| <a name="input_organizational_role_per_account"></a> [organizational\_role\_per\_account](#input\_organizational\_role\_per\_account) | Name of the organizational role deployed by AWS in each account of the organization | `string` | `"OrganizationAccountAccessRole"` | no |
5959
| <a name="input_tags"></a> [tags](#input\_tags) | sysdig secure-for-cloud tags | `map(string)` | <pre>{<br> "product": "sysdig-secure-for-cloud"<br>}</pre> | no |

modules/infrastructure/permissions/eks-org-role/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ data "aws_iam_policy_document" "sysdig_secure_for_cloud_role_trusted" {
2222
# ------------------------------
2323

2424
resource "aws_iam_role_policy" "sysdig_secure_for_cloud_role_s3" {
25-
count = var.enable_cloud_connector ? 1 : 0
25+
count = var.deploy_threat_detection ? 1 : 0
2626
name = "${var.name}-AllowCloudtrailS3Policy"
2727
role = aws_iam_role.secure_for_cloud_role.id
2828
policy = data.aws_iam_policy_document.sysdig_secure_for_cloud_role_s3[0].json
2929
}
3030
data "aws_iam_policy_document" "sysdig_secure_for_cloud_role_s3" {
31-
count = var.enable_cloud_connector ? 1 : 0
31+
count = var.deploy_threat_detection ? 1 : 0
3232
statement {
3333
effect = "Allow"
3434
actions = [
@@ -47,13 +47,13 @@ data "aws_iam_policy_document" "sysdig_secure_for_cloud_role_s3" {
4747
# enable image-scanning on member-account repositories
4848
# ------------------------------
4949
resource "aws_iam_role_policy" "sysdig_secure_for_cloud_role_assume_role" {
50-
count = var.enable_cloud_scanning ? 1 : 0
50+
count = var.deploy_image_scanning ? 1 : 0
5151
name = "${var.name}-AllowAssumeRoleInChildAccounts"
5252
role = aws_iam_role.secure_for_cloud_role.id
5353
policy = data.aws_iam_policy_document.sysdig_secure_for_cloud_role_assume_role[0].json
5454
}
5555
data "aws_iam_policy_document" "sysdig_secure_for_cloud_role_assume_role" {
56-
count = var.enable_cloud_scanning ? 1 : 0
56+
count = var.deploy_image_scanning ? 1 : 0
5757
statement {
5858
effect = "Allow"
5959
actions = [

modules/infrastructure/permissions/eks-org-role/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ variable "cloudtrail_s3_arn" {
1212
# optionals - with defaults
1313
#---------------------------------
1414

15-
variable "enable_cloud_connector" {
15+
variable "deploy_threat_detection" {
1616
type = bool
1717
description = "true/false whether to provision cloud_connector permissions"
1818
default = true
1919
}
2020

21-
variable "enable_cloud_scanning" {
21+
variable "deploy_image_scanning" {
2222
type = bool
2323
description = "true/false whether to provision cloud_scanning permissions"
2424
default = true

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Will create an IAM user and add add permissions for required modules
3737
|------|-------------|------|---------|:--------:|
3838
| <a name="input_cloudtrail_s3_bucket_arn"></a> [cloudtrail\_s3\_bucket\_arn](#input\_cloudtrail\_s3\_bucket\_arn) | ARN of cloudtrail s3 bucket | `string` | `"*"` | no |
3939
| <a name="input_cloudtrail_subscribed_sqs_arn"></a> [cloudtrail\_subscribed\_sqs\_arn](#input\_cloudtrail\_subscribed\_sqs\_arn) | ARN of the cloudtrail subscribed sqs's | `string` | `"*"` | no |
40-
| <a name="input_enable_cloud_connector"></a> [enable\_cloud\_connector](#input\_enable\_cloud\_connector) | true/false whether to provision cloud\_connector permissions | `bool` | `true` | no |
41-
| <a name="input_enable_cloud_scanning"></a> [enable\_cloud\_scanning](#input\_enable\_cloud\_scanning) | true/false whether to provision cloud\_scanning permissions | `bool` | `true` | no |
40+
| <a name="input_deploy_image_scanning"></a> [deploy\_image\_scanning](#input\_deploy\_image\_scanning) | true/false whether to provision cloud\_scanning permissions | `bool` | `true` | no |
41+
| <a name="input_deploy_threat_detection"></a> [deploy\_threat\_detection](#input\_deploy\_threat\_detection) | true/false whether to provision cloud\_connector permissions | `bool` | `true` | no |
4242
| <a name="input_name"></a> [name](#input\_name) | Name to be assigned to all child resources. A suffix may be added internally when required. Use default value unless you need to install multiple instances | `string` | `"sfc"` | no |
4343
| <a name="input_scanning_codebuild_project_arn"></a> [scanning\_codebuild\_project\_arn](#input\_scanning\_codebuild\_project\_arn) | ARN of codebuild to launch the image scanning process | `string` | `"*"` | no |
4444
| <a name="input_ssm_secure_api_token_arn"></a> [ssm\_secure\_api\_token\_arn](#input\_ssm\_secure\_api\_token\_arn) | ARN of the security credentials for the secure\_api\_token | `string` | `"*"` | no |

modules/infrastructure/permissions/iam-user/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module "credentials_general" {
2323

2424

2525
module "credentials_cloud_connector" {
26-
count = var.enable_cloud_connector ? 1 : 0
26+
count = var.deploy_threat_detection ? 1 : 0
2727
source = "../cloud-connector"
2828
name = var.name
2929

@@ -35,7 +35,7 @@ module "credentials_cloud_connector" {
3535
}
3636

3737
module "credentials_cloud_scanning" {
38-
count = var.enable_cloud_scanning ? 1 : 0
38+
count = var.deploy_image_scanning ? 1 : 0
3939
source = "../cloud-scanning"
4040
name = var.name
4141

modules/infrastructure/permissions/iam-user/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# optionals - with defaults
33
#---------------------------------
44

5-
variable "enable_cloud_connector" {
5+
variable "deploy_threat_detection" {
66
type = bool
77
description = "true/false whether to provision cloud_connector permissions"
88
default = true
99
}
1010

11-
variable "enable_cloud_scanning" {
11+
variable "deploy_image_scanning" {
1212
type = bool
1313
description = "true/false whether to provision cloud_scanning permissions"
1414
default = true

modules/services/cloud-connector/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Cloud Connector
22

3-
[Cloud Connector](https://github.com/sysdiglabs/cloud-connector)
4-
Deploys a Cloud Connector in AWS as an ECS container deployment that will detect events in your infrastructure.
5-
3+
A task deployed on an **ECS deployment** will detect events in your infrastructure.
64

75
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
86
## Requirements

modules/services/cloud-scanning/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Cloud Connector
22

3-
[Cloud Scanning](https://github.com/sysdiglabs/cloud-connector) (contained within cloud-connector project)
4-
Deploys a Cloud Scanning in AWS as an ECS container deployment that will detect events in your infrastructure.
3+
A task deployed on an **ECS deployment** will detect new images and will trigger image scans based on changes in your infrastructure into
4+
a **Code Build** run that will evaluate its status.
55

66

77
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

test/fixtures/organizational-k8s/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module "org_user" {
3636
aws = aws.admin
3737
}
3838
source = "../../../modules/infrastructure/permissions/iam-user"
39-
enable_cloud_scanning = false
39+
deploy_image_scanning = false
4040
cloudtrail_s3_bucket_arn = module.cloudtrail_s3_sns_sqs.cloudtrail_s3_arn
4141
cloudtrail_subscribed_sqs_arn = module.cloudtrail_s3_sns_sqs.cloudtrail_subscribed_sqs_arn
4242
}

0 commit comments

Comments
 (0)