Skip to content

Commit 5ca389c

Browse files
[datadog_integration_gcp_sts] Add IsPerProjectQuotaEnabled field (#2999)
* add is per project quota enabled to terraform * Update docs/resources/integration_gcp_sts.md Co-authored-by: DeForest Richards <[email protected]> * update doc --------- Co-authored-by: DeForest Richards <[email protected]>
1 parent 62266ec commit 5ca389c

7 files changed

+91
-100
lines changed

datadog/fwprovider/resource_datadog_integration_gcp_sts.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type integrationGcpStsModel struct {
4747
IsCspmEnabled types.Bool `tfsdk:"is_cspm_enabled"`
4848
IsSecurityCommandCenterEnabled types.Bool `tfsdk:"is_security_command_center_enabled"`
4949
IsResourceChangeCollectionEnabled types.Bool `tfsdk:"is_resource_change_collection_enabled"`
50+
IsPerProjectQuotaEnabled types.Bool `tfsdk:"is_per_project_quota_enabled"`
5051
ResourceCollectionEnabled types.Bool `tfsdk:"resource_collection_enabled"`
5152
}
5253

@@ -131,6 +132,11 @@ func (r *integrationGcpStsResource) Schema(_ context.Context, _ resource.SchemaR
131132
Optional: true,
132133
Computed: true,
133134
},
135+
"is_per_project_quota_enabled": schema.BoolAttribute{
136+
Description: "When enabled, Datadog includes the `X-Goog-User-Project` header to attribute Google Cloud billing and quota usage to the monitored project instead of the default service account project.",
137+
Optional: true,
138+
Computed: true,
139+
},
134140
"resource_collection_enabled": schema.BoolAttribute{
135141
Description: "When enabled, Datadog scans for all resources in your GCP environment.",
136142
Optional: true,
@@ -329,6 +335,9 @@ func (r *integrationGcpStsResource) updateState(ctx context.Context, state *inte
329335
if isResourceChangeCollectionEnabled, ok := attributes.GetIsResourceChangeCollectionEnabledOk(); ok {
330336
state.IsResourceChangeCollectionEnabled = types.BoolValue(*isResourceChangeCollectionEnabled)
331337
}
338+
if isPerProjectQuotaEnabled, ok := attributes.GetIsPerProjectQuotaEnabledOk(); ok {
339+
state.IsPerProjectQuotaEnabled = types.BoolValue(*isPerProjectQuotaEnabled)
340+
}
332341
if resourceCollectionEnabled, ok := attributes.GetResourceCollectionEnabledOk(); ok {
333342
state.ResourceCollectionEnabled = types.BoolValue(*resourceCollectionEnabled)
334343
}
@@ -383,6 +392,9 @@ func (r *integrationGcpStsResource) buildIntegrationGcpStsRequestBody(ctx contex
383392
if !state.ResourceCollectionEnabled.IsUnknown() {
384393
attributes.SetResourceCollectionEnabled(state.ResourceCollectionEnabled.ValueBool())
385394
}
395+
if !state.IsPerProjectQuotaEnabled.IsUnknown() {
396+
attributes.SetIsPerProjectQuotaEnabled(state.IsPerProjectQuotaEnabled.ValueBool())
397+
}
386398

387399
return attributes, diags
388400
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-11-07T13:41:37.228942-05:00
1+
2025-05-01T19:18:24.377047-04:00

datadog/tests/cassettes/TestAccIntegrationGcpStsBasic.yaml

Lines changed: 46 additions & 64 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-11-07T13:41:47.58081-05:00
1+
2025-05-01T19:18:42.446099-04:00

datadog/tests/cassettes/TestAccIntegrationGcpStsDefault.yaml

Lines changed: 24 additions & 34 deletions
Large diffs are not rendered by default.

datadog/tests/resource_datadog_integration_gcp_sts_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func TestAccIntegrationGcpStsBasic(t *testing.T) {
3535
"datadog_integration_gcp_sts.foo", "is_security_command_center_enabled", "false"),
3636
resource.TestCheckResourceAttr(
3737
"datadog_integration_gcp_sts.foo", "is_resource_change_collection_enabled", "false"),
38+
resource.TestCheckResourceAttr(
39+
"datadog_integration_gcp_sts.foo", "is_per_project_quota_enabled", "false"),
3840
resource.TestCheckResourceAttr(
3941
"datadog_integration_gcp_sts.foo", "resource_collection_enabled", "false"),
4042
resource.TestCheckTypeSetElemAttr(
@@ -75,6 +77,8 @@ func TestAccIntegrationGcpStsBasic(t *testing.T) {
7577
"datadog_integration_gcp_sts.foo", "is_security_command_center_enabled", "true"),
7678
resource.TestCheckResourceAttr(
7779
"datadog_integration_gcp_sts.foo", "is_resource_change_collection_enabled", "true"),
80+
resource.TestCheckResourceAttr(
81+
"datadog_integration_gcp_sts.foo", "is_per_project_quota_enabled", "true"),
7882
resource.TestCheckResourceAttr(
7983
"datadog_integration_gcp_sts.foo", "resource_collection_enabled", "true"),
8084
resource.TestCheckNoResourceAttr(
@@ -138,6 +142,7 @@ resource "datadog_integration_gcp_sts" "foo" {
138142
resource_collection_enabled = "false"
139143
is_security_command_center_enabled = "false"
140144
is_resource_change_collection_enabled = "false"
145+
is_per_project_quota_enabled = "false"
141146
account_tags = ["a:tag", "another:one", "and:another"]
142147
}`, uniq)
143148
}
@@ -151,6 +156,7 @@ resource "datadog_integration_gcp_sts" "foo" {
151156
resource_collection_enabled = "true"
152157
is_security_command_center_enabled = "true"
153158
is_resource_change_collection_enabled = "true"
159+
is_per_project_quota_enabled = "true"
154160
}`, uniq)
155161
}
156162

docs/resources/integration_gcp_sts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ resource "datadog_integration_gcp_sts" "foo" {
5252
- `cloud_run_revision_filters` (Set of String) Tags to filter which Cloud Run revisions are imported into Datadog. Only revisions that meet specified criteria are monitored.
5353
- `host_filters` (Set of String) Your Host Filters.
5454
- `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.
55+
- `is_per_project_quota_enabled` (Boolean) When enabled, Datadog includes the `X-Goog-User-Project` header to attribute Google Cloud billing and quota usage to the monitored project instead of the default service account project.
5556
- `is_resource_change_collection_enabled` (Boolean) When enabled, Datadog scans for all resource change data in your Google Cloud environment.
5657
- `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`.
5758
- `metric_namespace_configs` (Set of Object) Configuration for a GCP metric namespace. (see [below for nested schema](#nestedatt--metric_namespace_configs))

0 commit comments

Comments
 (0)