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

feat: restructure and add new datadog integration policies #69

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

RoseSecurity
Copy link

Why

  • Expanding permission sets as Datadog and AWS evolve

What

  • Style update: change all join("", resource.kind.*.name) and resource.kind[0].name to one(resource.kind[*].name)
  • Deprecate var.integrations and add var.policies in its place
    1. Update the description to indicate it is deprecated
    2. Make its default value null
  • Add var.policies
  • Create a local.policies which is the list of policies specified via var.integrations and var.policies combined with mappings and then de-duplicated

Note

For compatibility, map var.integrations "core" -> "core_integration" and "all" -> "full_integration" when adding to local.policies.

  • Rename the "all" policy "full-integration" and update it
  • Rename iam_policy_all.tf -> iam-policy-full-integration.tf and rename all the resources etc. named "all" to "full_integration", and trigger it with policy name "full-integration"
  • Update the policy reference
  • Update the permissions (statement.actions) from those sources:
full-integration permissions
  actions = [
    "apigateway:GET",
    "autoscaling:Describe*",
    "backup:List*",
    "budgets:ViewBudget",
    "cloudfront:GetDistributionConfig",
    "cloudfront:ListDistributions",
    "cloudtrail:DescribeTrails",
    "cloudtrail:GetTrailStatus",
    "cloudtrail:LookupEvents",
    "cloudwatch:Describe*",
    "cloudwatch:Get*",
    "cloudwatch:List*",
    "codedeploy:List*",
    "codedeploy:BatchGet*",
    "directconnect:Describe*",
    "dynamodb:List*",
    "dynamodb:Describe*",
    "ec2:Describe*",
    "ec2:GetTransitGatewayPrefixListReferences",
    "ec2:SearchTransitGatewayRoutes",
    "ecs:Describe*",
    "ecs:List*",
    "elasticache:Describe*",
    "elasticache:List*",
    "elasticfilesystem:DescribeFileSystems",
    "elasticfilesystem:DescribeTags",
    "elasticfilesystem:DescribeAccessPoints",
    "elasticloadbalancing:Describe*",
    "elasticmapreduce:List*",
    "elasticmapreduce:Describe*",
    "es:ListTags",
    "es:ListDomainNames",
    "es:DescribeElasticsearchDomains",
    "events:CreateEventBus",
    "fsx:DescribeFileSystems",
    "fsx:ListTagsForResource",
    "health:DescribeEvents",
    "health:DescribeEventDetails",
    "health:DescribeAffectedEntities",
    "kinesis:List*",
    "kinesis:Describe*",
    "lambda:GetPolicy",
    "lambda:List*",
    "logs:DeleteSubscriptionFilter",
    "logs:DescribeLogGroups",
    "logs:DescribeLogStreams",
    "logs:DescribeSubscriptionFilters",
    "logs:FilterLogEvents",
    "logs:PutSubscriptionFilter",
    "logs:TestMetricFilter",
    "oam:ListSinks",
    "oam:ListAttachedLinks",
    "organizations:Describe*",
    "organizations:List*",
    "rds:Describe*",
    "rds:List*",
    "redshift:DescribeClusters",
    "redshift:DescribeLoggingStatus",
    "route53:List*",
    "s3:GetBucketLogging",
    "s3:GetBucketLocation",
    "s3:GetBucketNotification",
    "s3:GetBucketTagging",
    "s3:ListAllMyBuckets",
    "s3:PutBucketNotification",
    "ses:Get*",
    "sns:List*",
    "sns:Publish",
    "sns:GetSubscriptionAttributes",
    "sqs:ListQueues",
    "states:ListStateMachines",
    "states:DescribeStateMachine",
    "support:DescribeTrustedAdvisor*",
    "support:RefreshTrustedAdvisorCheck",
    "tag:GetResources",
    "tag:GetTagKeys",
    "tag:GetTagValues",
    "wafv2:ListLoggingConfigurations",
    "wafv2:GetLoggingConfiguration",
    "xray:BatchGetTraces",
    "xray:GetTraceSummaries"
  ],
resource-collection permissions
  actions = [
    "backup:ListRecoveryPointsByBackupVault",
    "bcm-data-exports:GetExport",
    "bcm-data-exports:ListExports",
    "cassandra:Select",
    "cur:DescribeReportDefinitions",
    "ec2:GetSnapshotBlockPublicAccessState",
    "glacier:GetVaultNotifications",
    "glue:ListRegistries",
    "lightsail:GetInstancePortStates",
    "savingsplans:DescribeSavingsPlanRates",
    "savingsplans:DescribeSavingsPlans",
    "timestream:DescribeEndpoints",
    "waf-regional:ListRuleGroups",
    "waf-regional:ListRules",
    "waf:ListRuleGroups",
    "waf:ListRules",
    "wafv2:GetIPSet",
    "wafv2:GetRegexPatternSet",
    "wafv2:GetRuleGroup"
  ],
  • Create iam-policy-security-audit.tf
  • Updated documentation and examples

@mergify mergify bot added the triage Needs triage label Jan 23, 2025
@RoseSecurity RoseSecurity changed the title feat: restructure integration policies feat: restructure and add new datadog integration policies Jan 23, 2025
@RoseSecurity
Copy link
Author

I would also suggest adding the ability to dynamically merge additional IAM policies into the full integration as needed. For instance, with Cloudcraft functionality currently in preview, there is no way to incorporate additional policies into the integration since all values are hardcoded. How would you feel about introducing a variable to merge additional policies into the full integration for scenarios like this?

@RoseSecurity
Copy link
Author

/terratest

}

locals {
resource_collection_count = local.enabled && contains(split(",", lower(join(",", local.policies))), "resource-collection") ? 1 : 0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this to be included in everything?

@RoseSecurity RoseSecurity marked this pull request as ready for review January 24, 2025 16:23
@RoseSecurity RoseSecurity requested review from a team as code owners January 24, 2025 16:23
@Gowiem Gowiem changed the title feat: restructure and add new datadog integration policies feat!: restructure and add new datadog integration policies Jan 24, 2025
@Gowiem Gowiem added major Breaking changes (or first stable release) enhancement New feature or request feature New functionality labels Jan 24, 2025
@RoseSecurity RoseSecurity changed the title feat!: restructure and add new datadog integration policies feat: restructure and add new datadog integration policies Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature New functionality major Breaking changes (or first stable release) triage Needs triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants