Skip to content

Commit

Permalink
chore: remove sns member policy when not-required (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
iru authored Jul 11, 2022
1 parent 72392e5 commit d5578ac
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 38 deletions.
6 changes: 3 additions & 3 deletions examples/organizational/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ $ terraform apply

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws.member"></a> [aws.member](#provider\_aws.member) | 4.21.0 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |
| <a name="provider_aws.member"></a> [aws.member](#provider\_aws.member) | 4.22.0 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.39 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/single-account-apprunner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $ terraform apply

| Name | Version |
|------|---------|
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.39 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/single-account-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $ terraform apply

| Name | Version |
|------|---------|
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.39 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions examples/single-account-k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ $ terraform apply

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.6.0 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.39 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/trigger-events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $ terraform apply

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/cloudtrail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
1 change: 1 addition & 0 deletions modules/infrastructure/cloudtrail/data.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data "aws_caller_identity" "me" {}
2 changes: 0 additions & 2 deletions modules/infrastructure/cloudtrail/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ resource "aws_cloudtrail" "cloudtrail" {
aws_sns_topic_policy.allow_cloudtrail_publish
]
}

data "aws_caller_identity" "me" {}
16 changes: 8 additions & 8 deletions modules/infrastructure/cloudtrail/sns_permissions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
locals {
cross_account = data.aws_caller_identity.me.account_id != var.organizational_config.sysdig_secure_for_cloud_member_account_id
}


resource "aws_sns_topic_policy" "allow_cloudtrail_publish" {
arn = aws_sns_topic.cloudtrail.arn
policy = data.aws_iam_policy_document.cloudtrail_sns.json
Expand All @@ -20,18 +25,13 @@ data "aws_iam_policy_document" "cloudtrail_sns" {
# Organizational Requirements
# note; this statement is required to be on the SNS creation, don't move to other module as policies cannot be overriten/exteneded after creation
dynamic "statement" {
for_each = var.is_organizational ? [1] : []
for_each = var.is_organizational && local.cross_account ? [1] : []
content {
sid = "AllowSysdigSecureForCloudSubscribe"
effect = "Allow"
principals {
identifiers = [
"arn:aws:iam::${var.organizational_config.sysdig_secure_for_cloud_member_account_id}:role/${var.organizational_config.organizational_role_per_account}"
]
type = "AWS"
# more open policy but without requiring aws provider role
# identifiers = ["sqs.amazonaws.com"]
# type = "Service"
identifiers = ["arn:aws:iam::${var.organizational_config.sysdig_secure_for_cloud_member_account_id}:role/${var.organizational_config.organizational_role_per_account}"]
type = "AWS"
}
actions = ["sns:Subscribe"]
resources = [aws_sns_topic.cloudtrail.arn]
Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/cloudtrail_s3-sns-sqs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ EVENT FILTER/fine-tunning, regarding what we want to send to Sysdig Cloud-Connec

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/codebuild/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/ecs-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/permissions/general/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ General permissions that apply to both cloud-connector and cloud-scanning module

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/permissions/iam-user/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Note: Contact us if this authentication system does not match your requirement.

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions modules/infrastructure/permissions/org-role-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ The aim of this module is to manage the organizational **managed account** requi

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws.member"></a> [aws.member](#provider\_aws.member) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |
| <a name="provider_aws.member"></a> [aws.member](#provider\_aws.member) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/permissions/org-role-eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The aim of this module is to manage the organizational **managed account** requi

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/resource-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/sqs-sns-subscription/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/infrastructure/ssm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ and pass it, in a safe way, to all the modules that require it.

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions modules/services/cloud-bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Deployed on **Sysdig Backend**

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |
| <a name="provider_random"></a> [random](#provider\_random) | 3.3.2 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.39 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions modules/services/cloud-connector-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ A task deployed on an **ECS deployment** will detect events in your infrastructu

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.21.0 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.37 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |
| <a name="provider_sysdig"></a> [sysdig](#provider\_sysdig) | 0.5.39 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions use-cases/_questionnaire.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ modules, and we also offer [AWS Cloudformation templates](https://github.com/sys
- if so, does that S3 bucket already have any "Event Notification System"? Is it an SNS we could subscribe to?
- if so, does that S3 bucket already have an "Amazon EventBridge" system activated?
- whether it's organizational or not, could you give us a quick picture of the account setup in terms of purpose?
- how many **regions** do you work with?
- how many **regions** do you work with?
- is secure for cloud to be deployed on the same region as your existing resources?
- (aws-only) if in previous point you said you have a cloudtrail, cloudtrail-sns, or cloudtrail-s3, in which region is it?
- (aws-only) if in previous point you said you have a cloudtrail, cloudtrail-sns, or cloudtrail-s3, in which region is it?
- how do you handle **IAM permissions**? would you let our Terraform scripts set them up for you, or you want to set them yourself manually? any restriction we may be aware of?
- how do you handle **outbound newtwork connection** securization? does your infrastructure have any customized VPC/firewally setup?
- **Deployment** type
Expand Down

0 comments on commit d5578ac

Please sign in to comment.