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

Added cloud_run_revision_filters option to the GCP STS integration #2344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions datadog/fwprovider/resource_datadog_integration_gcp_sts.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type integrationGcpStsModel struct {
ClientEmail types.String `tfsdk:"client_email"`
DelegateAccountEmail types.String `tfsdk:"delegate_account_email"`
HostFilters types.Set `tfsdk:"host_filters"`
CloudRunRevisionFilters types.Set `tfsdk:"cloud_run_revision_filters"`
IsCspmEnabled types.Bool `tfsdk:"is_cspm_enabled"`
IsSecurityCommandCenterEnabled types.Bool `tfsdk:"is_security_command_center_enabled"`
ResourceCollectionEnabled types.Bool `tfsdk:"resource_collection_enabled"`
Expand Down Expand Up @@ -86,6 +87,11 @@ func (r *integrationGcpStsResource) Schema(_ context.Context, _ resource.SchemaR
Description: "Your Host Filters.",
ElementType: types.StringType,
},
"cloud_run_revision_filters": schema.SetAttribute{
Optional: true,
Description: "Filters to be applied for GCP Cloud Run resources",
ElementType: types.StringType,
},
"is_cspm_enabled": schema.BoolAttribute{
Optional: true,
Computed: true,
Expand Down

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions datadog/tests/resource_datadog_integration_gcp_sts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func TestAccIntegrationGcpStsBasic(t *testing.T) {
"datadog_integration_gcp_sts.foo", "host_filters.*", "tag:one"),
resource.TestCheckTypeSetElemAttr(
"datadog_integration_gcp_sts.foo", "host_filters.*", "tag:two"),
resource.TestCheckTypeSetElemAttr(
"datadog_integration_gcp_sts.foo", "cloud_run_revision_filters.*", "tag:one"),
resource.TestCheckTypeSetElemAttr(
"datadog_integration_gcp_sts.foo", "cloud_run_revision_filters.*", "tag:two"),
resource.TestCheckTypeSetElemAttr(
"datadog_integration_gcp_sts.foo", "account_tags.*", "a:tag"),
resource.TestCheckTypeSetElemAttr(
Expand All @@ -63,6 +67,8 @@ func TestAccIntegrationGcpStsBasic(t *testing.T) {
"datadog_integration_gcp_sts.foo", "resource_collection_enabled", "true"),
resource.TestCheckNoResourceAttr(
"datadog_integration_gcp_sts.foo", "host_filters"),
resource.TestCheckNoResourceAttr(
"datadog_integration_gcp_sts.foo", "cloud_run_revision_filters"),
resource.TestCheckNoResourceAttr(
"datadog_integration_gcp_sts.foo", "account_tags"),
),
Expand Down Expand Up @@ -92,6 +98,8 @@ func TestAccIntegrationGcpStsDefault(t *testing.T) {
"datadog_integration_gcp_sts.foo", "is_cspm_enabled", "false"),
resource.TestCheckNoResourceAttr(
"datadog_integration_gcp_sts.foo", "host_filters"),
resource.TestCheckNoResourceAttr(
"datadog_integration_gcp_sts.foo", "cloud_run_revision_filters"),
),
},
},
Expand All @@ -104,6 +112,7 @@ resource "datadog_integration_gcp_sts" "foo" {
automute = "false"
client_email = "%[email protected]"
host_filters = ["tag:one", "tag:two"]
cloud_run_revision_filters = ["tag:one", "tag:two"]
is_cspm_enabled = "false"
resource_collection_enabled = "false"
is_security_command_center_enabled = "false"
Expand Down
10 changes: 6 additions & 4 deletions docs/resources/integration_gcp_sts.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ resource "google_service_account_iam_member" "sa_iam" {
}

resource "datadog_integration_gcp_sts" "foo" {
client_email = google_service_account.datadog_integration.email
host_filters = ["filter_one", "filter_two"]
automute = true
is_cspm_enabled = false
client_email = google_service_account.datadog_integration.email
host_filters = ["filter_one", "filter_two"]
cloud_run_revision_filters = ["tag:one", "tag:two"]
automute = true
is_cspm_enabled = false
}
```

Expand All @@ -49,6 +50,7 @@ resource "datadog_integration_gcp_sts" "foo" {
- `account_tags` (Set of String) Tags to be associated with GCP metrics and service checks from your account.
- `automute` (Boolean) Silence monitors for expected GCE instance shutdowns.
- `host_filters` (Set of String) Your Host Filters.
- `cloud_run_revision_filters` (Set of String) Filters to be applied for GCP Cloud Run resources.
- `is_cspm_enabled` (Boolean) Whether Datadog collects cloud security posture management resources from your GCP project. If enabled, requires `resource_collection_enabled` to also be enabled.
- `is_security_command_center_enabled` (Boolean) When enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account. Defaults to `false`.
- `resource_collection_enabled` (Boolean) When enabled, Datadog scans for all resources in your GCP environment.
Expand Down