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

[datadog_integration_azure] Add container_app_filters #2138

Merged
merged 9 commits into from
Oct 31, 2023
Merged
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
11 changes: 11 additions & 0 deletions datadog/resource_datadog_integration_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ func resourceDatadogIntegrationAzure() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"container_app_filters": {
Description: "This comma-separated list of tags (in the form `key:value,key:value`) defines a filter that Datadog uses when collecting metrics from Azure Container Apps. Only Container Apps that match one of the defined tags are imported into Datadog.",
Type: schema.TypeString,
Optional: true,
},
"automute": {
Description: "Silence monitors for expected Azure VM shutdowns.",
Type: schema.TypeBool,
Expand Down Expand Up @@ -108,6 +113,10 @@ func resourceDatadogIntegrationAzureRead(ctx context.Context, d *schema.Resource
if exists {
d.Set("app_service_plan_filters", appServicePlanFilters)
}
containerAppFilters, exists := integration.GetContainerAppFiltersOk()
if exists {
d.Set("container_app_filters", containerAppFilters)
}

return nil
}
Expand Down Expand Up @@ -192,6 +201,8 @@ func buildDatadogAzureIntegrationDefinition(terraformDefinition *schema.Resource
datadogDefinition.SetHostFilters(hostFilters.(string))
appServicePlanFilters := terraformDefinition.Get("app_service_plan_filters")
datadogDefinition.SetAppServicePlanFilters(appServicePlanFilters.(string))
containerAppFilters := terraformDefinition.Get("container_app_filters")
datadogDefinition.SetContainerAppFilters(containerAppFilters.(string))
automute := terraformDefinition.Get("automute")
datadogDefinition.SetAutomute(automute.(bool))
cspmEnabled := terraformDefinition.Get("cspm_enabled")
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-08-24T15:55:21.168119162+02:00
2023-10-27T10:18:52.967801-04:00
30 changes: 15 additions & 15 deletions datadog/tests/cassettes/TestAccDatadogIntegrationAzure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 1
interactions:
- request:
body: |
{"app_service_plan_filters":"","automute":false,"client_id":"testc7f6-1234-5678-9101-3fcbf464test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","cspm_enabled":false,"custom_metrics_enabled":false,"host_filters":"foo:bar,buzz:lightyear","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee"}
nkzou marked this conversation as resolved.
Show resolved Hide resolved
{"app_service_plan_filters":"","automute":false,"client_id":"testc7f6-1234-5678-9101-3fcbf464test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"","cspm_enabled":false,"custom_metrics_enabled":false,"host_filters":"foo:bar,buzz:lightyear","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee"}
form: {}
headers:
Accept:
Expand Down Expand Up @@ -31,7 +31,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","container_app_filters":"","app_service_plan_filters":"","host_filters":"foo:bar,buzz:lightyear","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -40,7 +40,7 @@ interactions:
duration: ""
- request:
body: |
{"app_service_plan_filters":"","automute":false,"client_id":"testc7f6-1234-5678-9101-3fcbf123test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","cspm_enabled":false,"custom_metrics_enabled":false,"host_filters":"foo:bar,buzz:lightyear","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee"}
{"app_service_plan_filters":"","automute":false,"client_id":"testc7f6-1234-5678-9101-3fcbf123test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"","cspm_enabled":false,"custom_metrics_enabled":false,"host_filters":"foo:bar,buzz:lightyear","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee"}
form: {}
headers:
Accept:
Expand Down Expand Up @@ -68,7 +68,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","container_app_filters":"","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","container_app_filters":"","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -85,7 +85,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","container_app_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","container_app_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -102,7 +102,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","container_app_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","container_app_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -119,7 +119,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","container_app_filters":"","app_service_plan_filters":"","host_filters":"foo:bar,buzz:lightyear","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","container_app_filters":"","app_service_plan_filters":"","host_filters":"foo:bar,buzz:lightyear","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -136,7 +136,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","app_service_plan_filters":"","host_filters":"foo:bar,buzz:lightyear","container_app_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","app_service_plan_filters":"","host_filters":"foo:bar,buzz:lightyear","container_app_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":["Invalid credentials. Datadog could not authenticate with Azure."],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -153,7 +153,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"foo:bar,buzz:lightyear","app_service_plan_filters":"","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf123test","container_app_filters":"","app_service_plan_filters":"","host_filters":"foo:bar,buzz:lightyear","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":[],"warnings":[]},{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","container_app_filters":"","app_service_plan_filters":"","host_filters":"foo:bar,buzz:lightyear","automute":false,"cspm_enabled":false,"custom_metrics_enabled":false,"errors":["Invalid credentials. Datadog could not authenticate with Azure."],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -162,7 +162,7 @@ interactions:
duration: ""
- request:
body: |
{"app_service_plan_filters":"","automute":false,"client_id":"testc7f6-1234-5678-9101-3fcbf123test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","cspm_enabled":false,"custom_metrics_enabled":false,"host_filters":"foo:bar,buzz:lightyear","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee"}
{"app_service_plan_filters":"","automute":false,"client_id":"testc7f6-1234-5678-9101-3fcbf123test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"","cspm_enabled":false,"custom_metrics_enabled":false,"host_filters":"foo:bar,buzz:lightyear","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee"}
form: {}
headers:
Accept:
Expand All @@ -182,7 +182,7 @@ interactions:
duration: ""
- request:
body: |
{"app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"client_id":"testc7f6-1234-5678-9101-3fcbf464test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","cspm_enabled":true,"custom_metrics_enabled":true,"host_filters":"","new_client_id":"testc7f6-1234-5678-9101-3fcbf464test","new_tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee"}
{"app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"client_id":"testc7f6-1234-5678-9101-3fcbf464test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"bazinga:bazingo,woody:pride","cspm_enabled":true,"custom_metrics_enabled":true,"host_filters":"","new_client_id":"testc7f6-1234-5678-9101-3fcbf464test","new_tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee"}
form: {}
headers:
Accept:
Expand Down Expand Up @@ -210,7 +210,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"","app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"cspm_enabled":true,"custom_metrics_enabled":true,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"","container_app_filters":"bazinga:bazingo,woody:pride","app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"cspm_enabled":true,"custom_metrics_enabled":true,"errors":["Invalid credentials. Datadog could not authenticate with Azure."],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -227,7 +227,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"","app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"cspm_enabled":true,"custom_metrics_enabled":true,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"","container_app_filters":"bazinga:bazingo,woody:pride","app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"cspm_enabled":true,"custom_metrics_enabled":true,"errors":["Invalid credentials. Datadog could not authenticate with Azure."],"warnings":[]}]
nkzou marked this conversation as resolved.
Show resolved Hide resolved
headers:
Content-Type:
- application/json
Expand All @@ -244,7 +244,7 @@ interactions:
method: GET
response:
body: |
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","host_filters":"","app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"cspm_enabled":true,"custom_metrics_enabled":true,"errors":[],"warnings":[]}]
[{"tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee","client_id":"testc7f6-1234-5678-9101-3fcbf464test","app_service_plan_filters":"bar:baz,stinky:pete","container_app_filters":"bazinga:bazingo,woody:pride","host_filters":"","automute":true,"cspm_enabled":true,"custom_metrics_enabled":true,"errors":["Invalid credentials. Datadog could not authenticate with Azure."],"warnings":[]}]
headers:
Content-Type:
- application/json
Expand All @@ -253,7 +253,7 @@ interactions:
duration: ""
- request:
body: |
{"app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"client_id":"testc7f6-1234-5678-9101-3fcbf464test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","cspm_enabled":true,"custom_metrics_enabled":true,"host_filters":"","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1692885321ee"}
{"app_service_plan_filters":"bar:baz,stinky:pete","automute":true,"client_id":"testc7f6-1234-5678-9101-3fcbf464test","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"bazinga:bazingo,woody:pride","cspm_enabled":true,"custom_metrics_enabled":true,"host_filters":"","tenant_name":"aaaaaaaa-bbbb-cccc-dddd-1698416332ee"}
form: {}
headers:
Accept:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-08-16T17:18:45.791398158+02:00
2023-10-27T11:14:21.361243-04:00
Loading