Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to latest Sentinel Forwarder module #455

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

patheard
Copy link
Member

Summary

Update to the Terraform Sentinel Forwarder module that does not store its authentication credentials as Lambda env vars.

Related

@patheard patheard self-assigned this Apr 12, 2024
Update to the Terraform Sentinel Forwarder module that does
not store its authentication credentials as Lambda env vars.
@patheard patheard force-pushed the chore/sentinel-forwarder branch from 67410e8 to 013b4f5 Compare April 12, 2024 14:02
Copy link

cloud_asset_inventory

✅   Terraform Init: success
✅   Terraform Validate: success
✅   Terraform Format: success
✅   Terraform Plan: success
✅   Conftest: success

Plan: 1 to add, 2 to change, 0 to destroy
Show summary
CHANGE NAME
add module.sentinel_forwarder.aws_ssm_parameter.sentinel_forwarder_auth
update module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda
module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder
Show plan
Resource actions are indicated with the following symbols:
  + create
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # module.sentinel_forwarder.data.aws_iam_policy_document.sentinel_forwarder_lambda will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "sentinel_forwarder_lambda"  {
      ~ id      = "3222117311" -> (known after apply)
      ~ json    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = [
                          - "logs:PutLogEvents",
                          - "logs:CreateLogStream",
                        ]
                      - Effect   = "Allow"
                      - Resource = "arn:aws:logs:ca-central-1:794722365809:log-group:/aws/lambda/cloudquery-sentinel-forwarder:*"
                    },
                  - {
                      - Action   = [
                          - "xray:PutTraceSegments",
                          - "xray:PutTelemetryRecords",
                          - "xray:GetSamplingTargets",
                          - "xray:GetSamplingStatisticSummaries",
                          - "xray:GetSamplingRules",
                        ]
                      - Effect   = "Allow"
                      - Resource = "*"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> (known after apply)
      - version = "2012-10-17" -> null

      ~ statement {
          - not_actions   = [] -> null
          - not_resources = [] -> null
            # (3 unchanged attributes hidden)
        }
      ~ statement {
          - not_actions   = [] -> null
          - not_resources = [] -> null
            # (3 unchanged attributes hidden)
        }
      + statement {
          + actions   = [
              + "ssm:GetParameter",
              + "ssm:GetParameters",
            ]
          + effect    = "Allow"
          + resources = [
              + (known after apply),
            ]
        }
    }

  # module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda will be updated in-place
  ~ resource "aws_iam_policy" "sentinel_forwarder_lambda" {
        id        = "arn:aws:iam::794722365809:policy/SentinelForwarderLambda-cloudquery-sentinel-forwarder"
        name      = "SentinelForwarderLambda-cloudquery-sentinel-forwarder"
      ~ policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = [
                          - "logs:PutLogEvents",
                          - "logs:CreateLogStream",
                        ]
                      - Effect   = "Allow"
                      - Resource = "arn:aws:logs:ca-central-1:794722365809:log-group:/aws/lambda/cloudquery-sentinel-forwarder:*"
                      - Sid      = ""
                    },
                  - {
                      - Action   = [
                          - "xray:PutTraceSegments",
                          - "xray:PutTelemetryRecords",
                          - "xray:GetSamplingTargets",
                          - "xray:GetSamplingStatisticSummaries",
                          - "xray:GetSamplingRules",
                        ]
                      - Effect   = "Allow"
                      - Resource = "*"
                      - Sid      = ""
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> (known after apply)
        tags      = {}
        # (4 unchanged attributes hidden)
    }

  # module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder will be updated in-place
  ~ resource "aws_lambda_function" "sentinel_forwarder" {
      - code_signing_config_arn        = "" -> null
        id                             = "cloudquery-sentinel-forwarder"
      - image_uri                      = "" -> null
      - kms_key_arn                    = "" -> null
      ~ last_modified                  = "2023-04-18T16:10:58.000+0000" -> (known after apply)
      ~ layers                         = [
          - "arn:aws:lambda:ca-central-1:283582579564:layer:aws-sentinel-connector-layer:56",
          + "arn:aws:lambda:ca-central-1:283582579564:layer:aws-sentinel-connector-layer:125",
        ]
      - signing_job_arn                = "" -> null
      - signing_profile_version_arn    = "" -> null
      ~ source_code_hash               = "liR4yJNhp6SJtCjkSwnH0xGC0q00Uxebs1Cyqv8JLDw=" -> "mfdZfYUgPWLo+yh9aU8f33p2Tg+J0YOaJr3kKgPNVhE="
        tags                           = {
            "CostCentre" = "security-tools-794722365809"
        }
        # (20 unchanged attributes hidden)

      ~ environment {
          ~ variables = {
              - "CUSTOMER_ID" = (sensitive)
              - "LOG_TYPE"    = "cloudquery"
              - "SHARED_KEY"  = (sensitive)
            } -> (known after apply)
        }



        # (3 unchanged blocks hidden)
    }

  # module.sentinel_forwarder.aws_ssm_parameter.sentinel_forwarder_auth will be created
  + resource "aws_ssm_parameter" "sentinel_forwarder_auth" {
      + arn            = (known after apply)
      + data_type      = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + key_id         = (known after apply)
      + name           = "cloudquery-sentinel-forwarder-auth"
      + tags           = {
          + "CostCentre" = "security-tools-794722365809"
        }
      + tags_all       = {
          + "CostCentre" = "security-tools-794722365809"
        }
      + tier           = (known after apply)
      + type           = "SecureString"
      + value          = (sensitive value)
      + version        = (known after apply)
    }

Plan: 1 to add, 2 to change, 0 to destroy.

Warning: Argument is deprecated

  with module.cloudquery_s3_bucket.aws_s3_bucket.this,
  on .terraform/modules/cloudquery_s3_bucket/S3/main.tf line 8, in resource "aws_s3_bucket" "this":
   8: resource "aws_s3_bucket" "this" {

Use the aws_s3_bucket_versioning resource instead

(and 3 more similar warnings elsewhere)

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.cloudquery"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_cloudwatch_log_group.sentinel_forwarder_lambda"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda_s3[0]"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_role.sentinel_forwarder_lambda"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_ssm_parameter.sentinel_forwarder_auth"]

26 tests, 19 passed, 7 warnings, 0 failures, 0 exceptions

Copy link

csp_violation_report_service

✅   Terraform Init: success
✅   Terraform Validate: success
✅   Terraform Format: success
✅   Terraform Plan: success
✅   Conftest: success

Plan: 1 to add, 2 to change, 0 to destroy
Show summary
CHANGE NAME
add module.sentinel_forwarder.aws_ssm_parameter.sentinel_forwarder_auth
update module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda
module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder
Show plan
Resource actions are indicated with the following symbols:
  + create
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # module.sentinel_forwarder.data.aws_iam_policy_document.sentinel_forwarder_lambda will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "sentinel_forwarder_lambda"  {
      ~ id      = "3379243567" -> (known after apply)
      ~ json    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = [
                          - "logs:PutLogEvents",
                          - "logs:CreateLogStream",
                        ]
                      - Effect   = "Allow"
                      - Resource = "arn:aws:logs:ca-central-1:794722365809:log-group:/aws/lambda/csp_violation_report_service_sentinel:*"
                    },
                  - {
                      - Action   = [
                          - "xray:PutTraceSegments",
                          - "xray:PutTelemetryRecords",
                          - "xray:GetSamplingTargets",
                          - "xray:GetSamplingStatisticSummaries",
                          - "xray:GetSamplingRules",
                        ]
                      - Effect   = "Allow"
                      - Resource = "*"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> (known after apply)
      - version = "2012-10-17" -> null

      ~ statement {
          - not_actions   = [] -> null
          - not_resources = [] -> null
            # (3 unchanged attributes hidden)
        }
      ~ statement {
          - not_actions   = [] -> null
          - not_resources = [] -> null
            # (3 unchanged attributes hidden)
        }
      + statement {
          + actions   = [
              + "ssm:GetParameter",
              + "ssm:GetParameters",
            ]
          + effect    = "Allow"
          + resources = [
              + (known after apply),
            ]
        }
    }

  # module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda will be updated in-place
  ~ resource "aws_iam_policy" "sentinel_forwarder_lambda" {
        id        = "arn:aws:iam::794722365809:policy/SentinelForwarderLambda-csp_violation_report_service_sentinel"
        name      = "SentinelForwarderLambda-csp_violation_report_service_sentinel"
      ~ policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = [
                          - "logs:PutLogEvents",
                          - "logs:CreateLogStream",
                        ]
                      - Effect   = "Allow"
                      - Resource = "arn:aws:logs:ca-central-1:794722365809:log-group:/aws/lambda/csp_violation_report_service_sentinel:*"
                      - Sid      = ""
                    },
                  - {
                      - Action   = [
                          - "xray:PutTraceSegments",
                          - "xray:PutTelemetryRecords",
                          - "xray:GetSamplingTargets",
                          - "xray:GetSamplingStatisticSummaries",
                          - "xray:GetSamplingRules",
                        ]
                      - Effect   = "Allow"
                      - Resource = "*"
                      - Sid      = ""
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> (known after apply)
        tags      = {}
        # (4 unchanged attributes hidden)
    }

  # module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder will be updated in-place
  ~ resource "aws_lambda_function" "sentinel_forwarder" {
      - code_signing_config_arn        = "" -> null
        id                             = "csp_violation_report_service_sentinel"
      - image_uri                      = "" -> null
      - kms_key_arn                    = "" -> null
      ~ last_modified                  = "2023-09-06T20:12:30.533+0000" -> (known after apply)
      ~ layers                         = [
          - "arn:aws:lambda:ca-central-1:283582579564:layer:aws-sentinel-connector-layer:87",
          + "arn:aws:lambda:ca-central-1:283582579564:layer:aws-sentinel-connector-layer:125",
        ]
      - signing_job_arn                = "" -> null
      - signing_profile_version_arn    = "" -> null
      ~ source_code_hash               = "liR4yJNhp6SJtCjkSwnH0xGC0q00Uxebs1Cyqv8JLDw=" -> "mfdZfYUgPWLo+yh9aU8f33p2Tg+J0YOaJr3kKgPNVhE="
        tags                           = {
            "CostCentre" = "csp_violation_report_service"
        }
        # (20 unchanged attributes hidden)

      ~ environment {
          ~ variables = {
              - "CUSTOMER_ID" = (sensitive)
              - "LOG_TYPE"    = "ApplicationLog"
              - "SHARED_KEY"  = (sensitive)
            } -> (known after apply)
        }



        # (3 unchanged blocks hidden)
    }

  # module.sentinel_forwarder.aws_ssm_parameter.sentinel_forwarder_auth will be created
  + resource "aws_ssm_parameter" "sentinel_forwarder_auth" {
      + arn            = (known after apply)
      + data_type      = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + key_id         = (known after apply)
      + name           = "csp_violation_report_service_sentinel-auth"
      + tags           = {
          + "CostCentre" = "csp_violation_report_service"
        }
      + tags_all       = {
          + "CostCentre" = "csp_violation_report_service"
        }
      + tier           = (known after apply)
      + type           = "SecureString"
      + value          = (sensitive value)
      + version        = (known after apply)
    }

Plan: 1 to add, 2 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.csp_report_error"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_cloudwatch_log_group.sentinel_forwarder_lambda"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_policy.sentinel_forwarder_lambda"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_iam_role.sentinel_forwarder_lambda"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_lambda_function.sentinel_forwarder"]
WARN - plan.json - main - Missing Common Tags: ["module.sentinel_forwarder.aws_ssm_parameter.sentinel_forwarder_auth"]
WARN - plan.json - main - Cloudwatch log metric pattern is invalid: ["aws_cloudwatch_log_metric_filter.csp_report_error"]

25 tests, 18 passed, 7 warnings, 0 failures, 0 exceptions

@patheard patheard requested a review from a team April 12, 2024 14:05
@patheard patheard merged commit 5ec4496 into main Apr 12, 2024
9 checks passed
@patheard patheard deleted the chore/sentinel-forwarder branch April 12, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants