From 9ffde5cf4186dfcaae087b39f3640e0e2e04b1ff Mon Sep 17 00:00:00 2001 From: apiazza-dd <120594144+apiazza-dd@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:07:48 -0500 Subject: [PATCH] Add Resources to Cloudflare Terraform Provider (#2633) * Allow customers to provision which resources they collect when configuring a Cloudflare account using the Terraform Provider and update tests accordingly. --- ..._datadog_integration_cloudflare_account.go | 34 +++- ...cDatadogSoftwareCatalogEntity_Basic.freeze | 2 +- ...AccDatadogSoftwareCatalogEntity_Basic.yaml | 28 +-- ...ccIntegrationCloudflareAccountBasic.freeze | 2 +- ...tAccIntegrationCloudflareAccountBasic.yaml | 163 ++++++++++++------ ...dog_integration_cloudflare_account_test.go | 13 +- .../integration_cloudflare_account.md | 1 + 7 files changed, 163 insertions(+), 80 deletions(-) diff --git a/datadog/fwprovider/resource_datadog_integration_cloudflare_account.go b/datadog/fwprovider/resource_datadog_integration_cloudflare_account.go index 030508a8f..df598271c 100644 --- a/datadog/fwprovider/resource_datadog_integration_cloudflare_account.go +++ b/datadog/fwprovider/resource_datadog_integration_cloudflare_account.go @@ -4,10 +4,12 @@ import ( "context" "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" frameworkPath "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/listdefault" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/types" @@ -26,10 +28,11 @@ type integrationCloudflareAccountResource struct { } type integrationCloudflareAccountModel struct { - ID types.String `tfsdk:"id"` - ApiKey types.String `tfsdk:"api_key"` - Email types.String `tfsdk:"email"` - Name types.String `tfsdk:"name"` + ID types.String `tfsdk:"id"` + ApiKey types.String `tfsdk:"api_key"` + Email types.String `tfsdk:"email"` + Name types.String `tfsdk:"name"` + Resources types.List `tfsdk:"resources"` } func NewIntegrationCloudflareAccountResource() resource.Resource { @@ -67,6 +70,13 @@ func (r *integrationCloudflareAccountResource) Schema(_ context.Context, _ resou }, }, "id": utils.ResourceIDAttribute(), + "resources": schema.ListAttribute{ + ElementType: types.StringType, + Optional: true, + Computed: true, + Description: "An allowlist of resources to restrict pulling metrics for including `web`, `dns`, `lb` (load balancer), `worker`)", + Default: listdefault.StaticValue(types.ListValueMust(types.StringType, []attr.Value{})), + }, }, } } @@ -193,6 +203,10 @@ func (r *integrationCloudflareAccountResource) updateState(ctx context.Context, if name, ok := attributes.GetNameOk(); ok { state.Name = types.StringValue(*name) } + + if resources, ok := attributes.GetResourcesOk(); ok { + state.Resources, _ = types.ListValueFrom(ctx, types.StringType, resources) + } } func (r *integrationCloudflareAccountResource) buildIntegrationCloudflareAccountRequestBody(ctx context.Context, state *integrationCloudflareAccountModel) (*datadogV2.CloudflareAccountCreateRequest, diag.Diagnostics) { @@ -205,6 +219,12 @@ func (r *integrationCloudflareAccountResource) buildIntegrationCloudflareAccount } attributes.SetName(state.Name.ValueString()) + if !state.Resources.IsNull() { + var resources []string + diags.Append(state.Resources.ElementsAs(ctx, &resources, false)...) + attributes.SetResources(resources) + } + req := datadogV2.NewCloudflareAccountCreateRequestWithDefaults() req.Data = *datadogV2.NewCloudflareAccountCreateRequestDataWithDefaults() req.Data.SetAttributes(*attributes) @@ -221,6 +241,12 @@ func (r *integrationCloudflareAccountResource) buildIntegrationCloudflareAccount attributes.SetEmail(state.Email.ValueString()) } + if !state.Resources.IsNull() { + var resources []string + diags.Append(state.Resources.ElementsAs(ctx, &resources, false)...) + attributes.SetResources(resources) + } + req := datadogV2.NewCloudflareAccountUpdateRequestWithDefaults() req.Data = *datadogV2.NewCloudflareAccountUpdateRequestDataWithDefaults() req.Data.SetAttributes(*attributes) diff --git a/datadog/tests/cassettes/TestAccDatadogSoftwareCatalogEntity_Basic.freeze b/datadog/tests/cassettes/TestAccDatadogSoftwareCatalogEntity_Basic.freeze index d0a175563..688c70b23 100644 --- a/datadog/tests/cassettes/TestAccDatadogSoftwareCatalogEntity_Basic.freeze +++ b/datadog/tests/cassettes/TestAccDatadogSoftwareCatalogEntity_Basic.freeze @@ -1 +1 @@ -2024-10-01T09:42:13.446934-04:00 \ No newline at end of file +2024-10-31T15:31:32.714325-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogSoftwareCatalogEntity_Basic.yaml b/datadog/tests/cassettes/TestAccDatadogSoftwareCatalogEntity_Basic.yaml index 69a129a5b..f0724b906 100644 --- a/datadog/tests/cassettes/TestAccDatadogSoftwareCatalogEntity_Basic.yaml +++ b/datadog/tests/cassettes/TestAccDatadogSoftwareCatalogEntity_Basic.yaml @@ -16,7 +16,7 @@ interactions: apiVersion: v3 kind: service metadata: - name: tf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133 + name: tf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092 displayName: Shopping Cart tags: - tag:value @@ -110,13 +110,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"data":[{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"entity","attributes":{"apiVersion":"v3","displayName":"Shopping Cart","kind":"service","name":"tf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133","namespace":"default","owner":"myteam","tags":["tag:value"]},"relationships":{"schema":{"data":{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"schema"}}},"meta":{"createdAt":"2024-10-01T13:42:14.508637517Z","modifiedAt":"2024-10-01T13:42:14.508637353Z","ingestionSource":"api","origin":"unknown"}}],"meta":{"count":1,"includeCount":1},"included":[{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"schema","attributes":{"schema":{"apiVersion":"v3","kind":"service","metadata":{"name":"tf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133","namespace":"default","displayName":"Shopping Cart","tags":["tag:value"],"owner":"myteam","links":[{"name":"shopping-cart runbook","type":"runbook","url":"https://runbook/shopping-cart"},{"name":"shopping-cart architecture","type":"doc","provider":"gdoc","url":"https://google.drive/shopping-cart-architecture"},{"name":"shopping-cart Wiki","type":"doc","provider":"wiki","url":"https://wiki/shopping-cart"},{"name":"shopping-cart source code","type":"repo","provider":"github","url":"http://github/shopping-cart"}],"contacts":[{"name":"Support Email","type":"email","contact":"team@shopping.com"},{"name":"Support Slack","type":"slack","contact":"https://www.slack.com/archives/shopping-cart"}],"additionalOwners":[{"name":"opsTeam","type":"operator"}],"managed":{"origin":{"origin":"unknown"},"ingestionSource":"api","createdAt":"2024-10-01T13:42:14.508637517Z","modifiedAt":"2024-10-01T13:42:14.508637353Z"}},"extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"integrations":{"pagerduty":{"serviceURL":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"opsgenie":{"serviceURL":"https://www.opsgenie.com/service/shopping-cart","region":"US"}},"datadog":{"performanceData":{"tags":["service:shopping-cart","hostname:shopping-cart"]},"events":[{"name":"deployment events","query":"app:myapp AND type:github"},{"name":"event type B","query":"app:myapp AND type:github"}],"logs":[{"name":"critical logs","query":"app:myapp AND type:github"},{"name":"ops logs","query":"app:myapp AND type:github"}],"pipelines":{"fingerprints":["fp1","fp2"]},"codeLocations":[{"repositoryURL":"http://github/shopping-cart.git","paths":["baz/*.c","bat/**/*","../plop/*.java"]},{"repositoryURL":"http://github/shopping-cart-2.git","paths":["baz/*.c","bat/**/*","../plop/*.java"]}]},"spec":{"lifecycle":"production","tier":"1","languages":["go","python"],"type":"web","dependsOn":["service:serviceA","service:serviceB"]}}}}]}' + body: '{"data":[{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"entity","attributes":{"apiVersion":"v3","displayName":"Shopping Cart","kind":"service","name":"tf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092","namespace":"default","owner":"myteam","tags":["tag:value"]},"relationships":{"schema":{"data":{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"schema"}}},"meta":{"createdAt":"2024-10-31T19:31:34.59798776Z","modifiedAt":"2024-10-31T19:31:34.59798765Z","ingestionSource":"api"}}],"meta":{"count":1,"includeCount":1},"included":[{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"schema","attributes":{"schema":{"apiVersion":"v3","kind":"service","metadata":{"name":"tf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092","namespace":"default","displayName":"Shopping Cart","tags":["tag:value"],"owner":"myteam","links":[{"name":"shopping-cart runbook","type":"runbook","url":"https://runbook/shopping-cart"},{"name":"shopping-cart architecture","type":"doc","provider":"gdoc","url":"https://google.drive/shopping-cart-architecture"},{"name":"shopping-cart Wiki","type":"doc","provider":"wiki","url":"https://wiki/shopping-cart"},{"name":"shopping-cart source code","type":"repo","provider":"github","url":"http://github/shopping-cart"}],"contacts":[{"name":"Support Email","type":"email","contact":"team@shopping.com"},{"name":"Support Slack","type":"slack","contact":"https://www.slack.com/archives/shopping-cart"}],"additionalOwners":[{"name":"opsTeam","type":"operator"}],"managed":{"ingestionSource":"api","createdAt":"2024-10-31T19:31:34.59798776Z","modifiedAt":"2024-10-31T19:31:34.59798765Z"}},"extensions":{"datadoghq.com/shopping-cart":{"customField":"customValue"}},"integrations":{"pagerduty":{"serviceURL":"https://www.pagerduty.com/service-directory/Pshopping-cart"},"opsgenie":{"serviceURL":"https://www.opsgenie.com/service/shopping-cart","region":"US"}},"datadog":{"performanceData":{"tags":["service:shopping-cart","hostname:shopping-cart"]},"events":[{"name":"deployment events","query":"app:myapp AND type:github"},{"name":"event type B","query":"app:myapp AND type:github"}],"logs":[{"name":"critical logs","query":"app:myapp AND type:github"},{"name":"ops logs","query":"app:myapp AND type:github"}],"pipelines":{"fingerprints":["fp1","fp2"]},"codeLocations":[{"repositoryURL":"http://github/shopping-cart.git","paths":["baz/*.c","bat/**/*","../plop/*.java"]},{"repositoryURL":"http://github/shopping-cart-2.git","paths":["baz/*.c","bat/**/*","../plop/*.java"]}]},"spec":{"lifecycle":"production","tier":"1","languages":["go","python"],"type":"web","dependsOn":["service:serviceA","service:serviceB"]}}}}]}' headers: Content-Type: - application/vnd.api+json status: 202 Accepted code: 202 - duration: 168.954833ms + duration: 151.978333ms - id: 1 request: proto: HTTP/1.1 @@ -133,7 +133,7 @@ interactions: headers: Content-Type: - application/json - url: https://api.datadoghq.com/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133&include=raw_schema + url: https://api.datadoghq.com/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092&include=raw_schema method: GET response: proto: HTTP/1.1 @@ -143,13 +143,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"data":[{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"entity","attributes":{"apiVersion":"v3","displayName":"Shopping Cart","kind":"service","name":"tf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133","namespace":"default","owner":"myteam","tags":["tag:value"]},"relationships":{"rawSchema":{"data":{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"rawSchema"}}},"meta":{"createdAt":"2024-10-01T13:42:14.508637517Z","modifiedAt":"2024-10-01T13:42:14.508637353Z","ingestionSource":"api","origin":"unknown"}}],"meta":{"count":1,"includeCount":1},"links":{"self":"/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133\u0026include=raw_schema\u0026page%5Blimit%5D=100\u0026page%5Boffset%5D=0"},"included":[{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"rawSchema","attributes":{"rawSchema":"LS0tCmFwaVZlcnNpb246IHYzCmtpbmQ6IHNlcnZpY2UKbWV0YWRhdGE6CiAgbmFtZTogdGYtdGVzdGFjY2RhdGFkb2dzb2Z0d2FyZWNhdGFsb2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AgICAtIGZwMgogIGNvZGVMb2NhdGlvbnM6CiAgICAtIHJlcG9zaXRvcnlVUkw6IGh0dHA6Ly9naXRodWIvc2hvcHBpbmctY2FydC5naXQKICAgICAgcGF0aHM6CiAgICAgICAgLSBiYXovKi5jCiAgICAgICAgLSBiYXQvKiovKgogICAgICAgIC0gLi4vcGxvcC8qLmphdmEKICAgIC0gcmVwb3NpdG9yeVVSTDogaHR0cDovL2dpdGh1Yi9zaG9wcGluZy1jYXJ0LTIuZ2l0CiAgICAgIHBhdGhzOgogICAgICAgIC0gYmF6LyouYwogICAgICAgIC0gYmF0LyoqLyoKICAgICAgICAtIC4uL3Bsb3AvKi5qYXZhCg=="}}]}' + body: '{"data":[{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"entity","attributes":{"apiVersion":"v3","displayName":"Shopping Cart","kind":"service","name":"tf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092","namespace":"default","owner":"myteam","tags":["tag:value"]},"relationships":{"rawSchema":{"data":{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"rawSchema"}}},"meta":{"createdAt":"2024-10-31T19:31:34.597987Z","modifiedAt":"2024-10-31T19:31:34.59798765Z","ingestionSource":"api"}}],"meta":{"count":1,"includeCount":1},"links":{"self":"/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092\u0026include=raw_schema\u0026page%5Blimit%5D=100\u0026page%5Boffset%5D=0"},"included":[{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"rawSchema","attributes":{"rawSchema":"LS0tCmFwaVZlcnNpb246IHYzCmtpbmQ6IHNlcnZpY2UKbWV0YWRhdGE6CiAgbmFtZTogdGYtdGVzdGFjY2RhdGFkb2dzb2Z0d2FyZWNhdGFsb2dlbnRpdHlfYmFzaWMtbG9jYWwtMTczMDQwMzA5MgogIGRpc3BsYXlOYW1lOiBTaG9wcGluZyBDYXJ0CiAgdGFnczoKICAgIC0gdGFnOnZ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ICAgcGF0aHM6CiAgICAgICAgLSBiYXovKi5jCiAgICAgICAgLSBiYXQvKiovKgogICAgICAgIC0gLi4vcGxvcC8qLmphdmEKICAgIC0gcmVwb3NpdG9yeVVSTDogaHR0cDovL2dpdGh1Yi9zaG9wcGluZy1jYXJ0LTIuZ2l0CiAgICAgIHBhdGhzOgogICAgICAgIC0gYmF6LyouYwogICAgICAgIC0gYmF0LyoqLyoKICAgICAgICAtIC4uL3Bsb3AvKi5qYXZhCg=="}}]}' headers: Content-Type: - application/vnd.api+json status: 200 OK code: 200 - duration: 59.836042ms + duration: 51.042417ms - id: 2 request: proto: HTTP/1.1 @@ -166,7 +166,7 @@ interactions: headers: Content-Type: - application/json - url: https://api.datadoghq.com/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133&include=raw_schema + url: https://api.datadoghq.com/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092&include=raw_schema method: GET response: proto: HTTP/1.1 @@ -176,13 +176,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"data":[{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"entity","attributes":{"apiVersion":"v3","displayName":"Shopping Cart","kind":"service","name":"tf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133","namespace":"default","owner":"myteam","tags":["tag:value"]},"relationships":{"rawSchema":{"data":{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"rawSchema"}}},"meta":{"createdAt":"2024-10-01T13:42:14.508637517Z","modifiedAt":"2024-10-01T13:42:14.508637353Z","ingestionSource":"api","origin":"unknown"}}],"meta":{"count":1,"includeCount":1},"links":{"self":"/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133\u0026include=raw_schema\u0026page%5Blimit%5D=100\u0026page%5Boffset%5D=0"},"included":[{"id":"d151ac5c-bcde-47ce-964e-38ee621f32c5","type":"rawSchema","attributes":{"rawSchema":"LS0tCmFwaVZlcnNpb246IHYzCmtpbmQ6IHNlcnZpY2UKbWV0YWRhdGE6CiAgbmFtZTogdGYtdGVzdGFjY2RhdGFkb2dzb2Z0d2FyZWNhdGFsb2dlbnRpdHlfYmFzaWMtbG9jYWwtMTcyNzc5MDEzMwogIGRpc3BsYXlOYW1lOiBTaG9wcGluZyBDYXJ0CiAgdGFnczoKICAgIC0gdGFnOnZhbHVlCiAgbGlua3M6CiAgICAtIG5hbWU6IHNob3BwaW5nLWNhcnQgcnVuYm9vawogICAgICB0eXBlOiBydW5ib29rCiAgICAgIHVybDogaHR0cHM6Ly9ydW5ib29rL3Nob3BwaW5nLWNhcnQKICAgIC0gbmFtZTogc2hvcHBpbmctY2FydCBhcmNoaXRlY3R1cmUKICAgICAgcHJvdmlkZXI6IGdkb2MKICAgICAgdXJsOiBodHRwczovL2dvb2dsZS5kcml2ZS9zaG9wcGluZy1jYXJ0LWFyY2hpdGVjdHVyZQogICAgICB0eXBlOiBkb2MKICAgIC0gbmFtZTogc2hvcHBpbmctY2FydCBXaWtpCiAgICAgIHByb3ZpZGVyOiB3aWtpCiAgICAgIHVybDogaHR0cHM6Ly93aWtpL3Nob3BwaW5nLWNhcnQKICAgICAgdHlwZTogZG9jCiAgICAtIG5hbWU6IHNob3BwaW5nLWNhcnQgc291cmNlIGNvZGUKICAgICAgcHJvdmlkZXI6IGdpdGh1YgogICAgICB1cmw6IGh0dHA6Ly9naXRodWIvc2hvcHBpbmctY2FydAogICAgICB0eXBlOiByZXBvCiAgY29udGFjdHM6CiAgICAtIG5hbWU6IFN1cHBvcnQgRW1haWwKICAgICAgdHlwZTogZW1haWwKICAgICAgY29udGFjdDogdGVhbUBzaG9wcGluZy5jb20KICAgIC0gbmFtZTogU3VwcG9ydCBTbGFjawogICAgICB0eXBlOiBzbGFjawogICAgICBjb250YWN0OiBodHRwczovL3d3dy5zbGFjay5jb20v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m15YXBwIEFORCB0eXBlOmdpdGh1YiIKICAgIC0gbmFtZTogIm9wcyBsb2dzIgogICAgICBxdWVyeTogImFwcDpteWFwcCBBTkQgdHlwZTpnaXRodWIiCiAgcGlwZWxpbmVzOgogICAgZmluZ2VycHJpbnRzOgogICAgICAtIGZwMQogICAgICAtIGZwMgogIGNvZGVMb2NhdGlvbnM6CiAgICAtIHJlcG9zaXRvcnlVUkw6IGh0dHA6Ly9naXRodWIvc2hvcHBpbmctY2FydC5naXQKICAgICAgcGF0aHM6CiAgICAgICAgLSBiYXovKi5jCiAgICAgICAgLSBiYXQvKiovKgogICAgICAgIC0gLi4vcGxvcC8qLmphdmEKICAgIC0gcmVwb3NpdG9yeVVSTDogaHR0cDovL2dpdGh1Yi9zaG9wcGluZy1jYXJ0LTIuZ2l0CiAgICAgIHBhdGhzOgogICAgICAgIC0gYmF6LyouYwogICAgICAgIC0gYmF0LyoqLyoKICAgICAgICAtIC4uL3Bsb3AvKi5qYXZhCg=="}}]}' + body: '{"data":[{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"entity","attributes":{"apiVersion":"v3","displayName":"Shopping Cart","kind":"service","name":"tf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092","namespace":"default","owner":"myteam","tags":["tag:value"]},"relationships":{"rawSchema":{"data":{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"rawSchema"}}},"meta":{"createdAt":"2024-10-31T19:31:34.597987Z","modifiedAt":"2024-10-31T19:31:34.59798765Z","ingestionSource":"api"}}],"meta":{"count":1,"includeCount":1},"links":{"self":"/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092\u0026include=raw_schema\u0026page%5Blimit%5D=100\u0026page%5Boffset%5D=0"},"included":[{"id":"cc393511-2952-4505-b6b5-cd3679834078","type":"rawSchema","attributes":{"rawSchema":"LS0tCmFwaVZlcnNpb246IHYzCmtpbmQ6IHNlcnZpY2UKbWV0YWRhd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IiCiAgcGlwZWxpbmVzOgogICAgZmluZ2VycHJpbnRzOgogICAgICAtIGZwMQogICAgICAtIGZwMgogIGNvZGVMb2NhdGlvbnM6CiAgICAtIHJlcG9zaXRvcnlVUkw6IGh0dHA6Ly9naXRodWIvc2hvcHBpbmctY2FydC5naXQKICAgICAgcGF0aHM6CiAgICAgICAgLSBiYXovKi5jCiAgICAgICAgLSBiYXQvKiovKgogICAgICAgIC0gLi4vcGxvcC8qLmphdmEKICAgIC0gcmVwb3NpdG9yeVVSTDogaHR0cDovL2dpdGh1Yi9zaG9wcGluZy1jYXJ0LTIuZ2l0CiAgICAgIHBhdGhzOgogICAgICAgIC0gYmF6LyouYwogICAgICAgIC0gYmF0LyoqLyoKICAgICAgICAtIC4uL3Bsb3AvKi5qYXZhCg=="}}]}' headers: Content-Type: - application/vnd.api+json status: 200 OK code: 200 - duration: 50.025541ms + duration: 51.854625ms - id: 3 request: proto: HTTP/1.1 @@ -199,7 +199,7 @@ interactions: headers: Content-Type: - application/json - url: https://api.datadoghq.com/api/v2/catalog/entity/service:default/tf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133 + url: https://api.datadoghq.com/api/v2/catalog/entity/service:default/tf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092 method: DELETE response: proto: HTTP/1.1 @@ -213,7 +213,7 @@ interactions: headers: {} status: 204 No Content code: 204 - duration: 82.44275ms + duration: 95.660916ms - id: 4 request: proto: HTTP/1.1 @@ -230,7 +230,7 @@ interactions: headers: Content-Type: - application/json - url: https://api.datadoghq.com/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133 + url: https://api.datadoghq.com/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092 method: GET response: proto: HTTP/1.1 @@ -240,10 +240,10 @@ interactions: trailer: {} content_length: 236 uncompressed: false - body: '{"data":[],"meta":{"count":0,"includeCount":0},"links":{"self":"/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1727790133\u0026page%5Blimit%5D=100\u0026page%5Boffset%5D=0"}}' + body: '{"data":[],"meta":{"count":0,"includeCount":0},"links":{"self":"/api/v2/catalog/entity?filter%5Bref%5D=service%3Adefault%2Ftf-testaccdatadogsoftwarecatalogentity_basic-local-1730403092\u0026page%5Blimit%5D=100\u0026page%5Boffset%5D=0"}}' headers: Content-Type: - application/vnd.api+json status: 200 OK code: 200 - duration: 57.225042ms + duration: 57.044125ms diff --git a/datadog/tests/cassettes/TestAccIntegrationCloudflareAccountBasic.freeze b/datadog/tests/cassettes/TestAccIntegrationCloudflareAccountBasic.freeze index 73a4efcbf..f43e6c7f3 100644 --- a/datadog/tests/cassettes/TestAccIntegrationCloudflareAccountBasic.freeze +++ b/datadog/tests/cassettes/TestAccIntegrationCloudflareAccountBasic.freeze @@ -1 +1 @@ -2023-04-10T08:26:30.816762-04:00 \ No newline at end of file +2024-10-31T16:13:12.292368-04:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccIntegrationCloudflareAccountBasic.yaml b/datadog/tests/cassettes/TestAccIntegrationCloudflareAccountBasic.yaml index bacee1ebd..448abfa4c 100644 --- a/datadog/tests/cassettes/TestAccIntegrationCloudflareAccountBasic.yaml +++ b/datadog/tests/cassettes/TestAccIntegrationCloudflareAccountBasic.yaml @@ -1,58 +1,109 @@ +--- version: 2 interactions: -- request: - body: | - {"data":{"attributes":{"api_key":"1234567891012331asdd","email":"test-email@example.com","name":"tf-TestAccIntegrationCloudflareAccountBasic-local-1681129590"},"type":"cloudflare-accounts"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - url: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts - method: POST - id: 0 - response: - body: | - {"data":{"type":"cloudflare-accounts","attributes":{"email":"test-email@example.com","name":"tf-TestAccIntegrationCloudflareAccountBasic-local-1681129590"},"id":"9e9054f8a21fd8dd20feee8e9fa31447"}} - headers: - Content-Type: - - application/json - status: 201 Created - code: 201 - duration: "0ms" -- request: - body: "" - form: {} - headers: - Accept: - - application/json - url: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/9e9054f8a21fd8dd20feee8e9fa31447 - method: GET - id: 1 - response: - body: | - {"data":{"type":"cloudflare-accounts","id":"9e9054f8a21fd8dd20feee8e9fa31447","attributes":{"email":"test-email@example.com","name":"tf-TestAccIntegrationCloudflareAccountBasic-local-1681129590"}}} - headers: - Content-Type: - - application/json - status: 200 OK - code: 200 - duration: "0ms" -- request: - body: "" - form: {} - headers: - Accept: - - '*/*' - url: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/9e9054f8a21fd8dd20feee8e9fa31447 - method: DELETE - id: 2 - response: - body: "" - headers: - Content-Type: - - text/html; charset=utf-8 - status: 204 No Content - code: 204 - duration: "0ms" + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 226 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: | + {"data":{"attributes":{"api_key":"12345","email":"test@email.com","name":"tf-TestAccIntegrationCloudflareAccountBasic-local-1730405592","resources":["web"]},"type":"cloudflare-accounts"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts + method: POST + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"data":{"type":"cloudflare-accounts","attributes":{"resources":["web"],"email":"test@email.com","zones":[],"name":"tf-TestAccIntegrationCloudflareAccountBasic-local-1730405592"},"id":"0b7e1a40578e2e4742c5183aa3b0502f9116ab249b16dc10ff09135a51663560"}} + headers: + Content-Type: + - application/json + status: 201 Created + code: 201 + duration: 554.743709ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/0b7e1a40578e2e4742c5183aa3b0502f9116ab249b16dc10ff09135a51663560 + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"data":{"type":"cloudflare-accounts","attributes":{"zones":[],"email":"test@email.com","resources":["web"],"name":"tf-TestAccIntegrationCloudflareAccountBasic-local-1730405592"},"id":"0b7e1a40578e2e4742c5183aa3b0502f9116ab249b16dc10ff09135a51663560"}} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 85.251292ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - '*/*' + url: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/0b7e1a40578e2e4742c5183aa3b0502f9116ab249b16dc10ff09135a51663560 + method: DELETE + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - text/html; charset=utf-8 + status: 204 No Content + code: 204 + duration: 194.638084ms diff --git a/datadog/tests/resource_datadog_integration_cloudflare_account_test.go b/datadog/tests/resource_datadog_integration_cloudflare_account_test.go index e286b79c7..ce0cf8c47 100644 --- a/datadog/tests/resource_datadog_integration_cloudflare_account_test.go +++ b/datadog/tests/resource_datadog_integration_cloudflare_account_test.go @@ -29,11 +29,15 @@ func TestAccIntegrationCloudflareAccountBasic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDatadogIntegrationCloudflareAccountExists(providers.frameworkProvider), resource.TestCheckResourceAttr( - "datadog_integration_cloudflare_account.foo", "api_key", "1234567891012331asdd"), + "datadog_integration_cloudflare_account.foo", "api_key", "12345"), resource.TestCheckResourceAttr( - "datadog_integration_cloudflare_account.foo", "email", "test-email@example.com"), + "datadog_integration_cloudflare_account.foo", "email", "test@email.com"), resource.TestCheckResourceAttr( "datadog_integration_cloudflare_account.foo", "name", uniq), + resource.TestCheckResourceAttr( + "datadog_integration_cloudflare_account.foo", "resources.#", "1"), + resource.TestCheckResourceAttr( + "datadog_integration_cloudflare_account.foo", "resources.0", "web"), ), }, }, @@ -43,9 +47,10 @@ func TestAccIntegrationCloudflareAccountBasic(t *testing.T) { func testAccCheckDatadogIntegrationCloudflareAccount(uniq string) string { return fmt.Sprintf(` resource "datadog_integration_cloudflare_account" "foo" { - api_key = "1234567891012331asdd" - email = "test-email@example.com" + api_key = "12345" + email = "test@email.com" name = "%s" + resources = ["web"] }`, uniq) } diff --git a/docs/resources/integration_cloudflare_account.md b/docs/resources/integration_cloudflare_account.md index 0c68ba98e..3395fda85 100644 --- a/docs/resources/integration_cloudflare_account.md +++ b/docs/resources/integration_cloudflare_account.md @@ -33,6 +33,7 @@ resource "datadog_integration_cloudflare_account" "foo" { ### Optional - `email` (String) The email associated with the Cloudflare account. If an API key is provided (and not a token), this field is also required. +- `resources` (List of String) An allowlist of resources to restrict pulling metrics for including `web`, `dns`, `lb` (load balancer), `worker`) ### Read-Only