From 53358c22ab6850dd2287c4fc87079ed19fa455e0 Mon Sep 17 00:00:00 2001 From: devtools-ci-cd Date: Thu, 22 May 2025 15:33:46 +0200 Subject: [PATCH] fix(domain): make project_id optional in DataSourceZone --- ...ata-source-domain-zone-basic.cassette.yaml | 122 +++++++++--------- internal/services/domain/zone_data_source.go | 2 +- .../services/domain/zone_data_source_test.go | 5 + 3 files changed, 67 insertions(+), 62 deletions(-) diff --git a/internal/services/domain/testdata/data-source-domain-zone-basic.cassette.yaml b/internal/services/domain/testdata/data-source-domain-zone-basic.cassette.yaml index 7886316a95..ec1e400d2c 100644 --- a/internal/services/domain/testdata/data-source-domain-zone-basic.cassette.yaml +++ b/internal/services/domain/testdata/data-source-domain-zone-basic.cassette.yaml @@ -36,9 +36,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:33 GMT + - Thu, 22 May 2025 13:32:05 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -46,10 +46,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - b46bc1aa-7950-4d9e-a9bf-403e991bb431 + - f099dcb8-10be-4387-a04e-3fa265b3c1c6 status: 200 OK code: 200 - duration: 367.966167ms + duration: 1.835743708s - id: 1 request: proto: HTTP/1.1 @@ -78,7 +78,7 @@ interactions: trailer: {} content_length: 319 uncompressed: false - body: '{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}' + body: '{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}' headers: Content-Length: - "319" @@ -87,9 +87,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:33 GMT + - Thu, 22 May 2025 13:32:06 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -97,10 +97,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - c267e618-8e7a-4197-a483-d763532525e5 + - 8e95b6b0-e464-4833-9bcc-f2733d3bda9b status: 200 OK code: 200 - duration: 677.307958ms + duration: 919.83275ms - id: 2 request: proto: HTTP/1.1 @@ -127,7 +127,7 @@ interactions: trailer: {} content_length: 351 uncompressed: false - body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}],"total_count":1}' + body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}],"total_count":1}' headers: Content-Length: - "351" @@ -136,9 +136,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:33 GMT + - Thu, 22 May 2025 13:32:07 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -146,10 +146,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 30de1bc8-6231-4737-a28e-b30a755e5da6 + - 0f5e9aa5-dd46-4f16-a7f6-8f74d2d10d1c status: 200 OK code: 200 - duration: 122.948458ms + duration: 438.5305ms - id: 3 request: proto: HTTP/1.1 @@ -166,7 +166,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.0; darwin; arm64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/domain/v2beta1/dns-zones?dns_zones=test-zone2.scaleway-terraform.com&domain=&order_by=domain_asc + url: https://api.scaleway.com/domain/v2beta1/dns-zones?dns_zones=test-zone2.scaleway-terraform.com&domain=&order_by=domain_asc&project_id=105bdce1-64c0-48ab-899d-868455867ecf method: GET response: proto: HTTP/2.0 @@ -176,7 +176,7 @@ interactions: trailer: {} content_length: 351 uncompressed: false - body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}],"total_count":1}' + body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}],"total_count":1}' headers: Content-Length: - "351" @@ -185,9 +185,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:33 GMT + - Thu, 22 May 2025 13:32:07 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -195,10 +195,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 43b6f551-8dcb-422c-a2e9-32761c716e5a + - 6730b081-49e9-4156-8af3-cf9ac38d0605 status: 200 OK code: 200 - duration: 81.226625ms + duration: 368.237042ms - id: 4 request: proto: HTTP/1.1 @@ -225,7 +225,7 @@ interactions: trailer: {} content_length: 351 uncompressed: false - body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}],"total_count":1}' + body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}],"total_count":1}' headers: Content-Length: - "351" @@ -234,9 +234,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:34 GMT + - Thu, 22 May 2025 13:32:07 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -244,10 +244,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - c93ff729-8cc4-43db-b20d-b867a3dc5231 + - 9362059f-f955-4123-b1f0-ac93c60d5676 status: 200 OK code: 200 - duration: 126.549833ms + duration: 95.6785ms - id: 5 request: proto: HTTP/1.1 @@ -264,7 +264,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.0; darwin; arm64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/domain/v2beta1/dns-zones?dns_zones=test-zone2.scaleway-terraform.com&domain=&order_by=domain_asc + url: https://api.scaleway.com/domain/v2beta1/dns-zones?dns_zones=test-zone2.scaleway-terraform.com&domain=&order_by=domain_asc&project_id=105bdce1-64c0-48ab-899d-868455867ecf method: GET response: proto: HTTP/2.0 @@ -274,7 +274,7 @@ interactions: trailer: {} content_length: 351 uncompressed: false - body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}],"total_count":1}' + body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}],"total_count":1}' headers: Content-Length: - "351" @@ -283,9 +283,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:34 GMT + - Thu, 22 May 2025 13:32:08 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -293,10 +293,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 4e716a84-4902-4fa7-8c1d-5a829940e59c + - efcf8a69-01de-40ce-ae56-7cc8169c298c status: 200 OK code: 200 - duration: 125.069958ms + duration: 100.374625ms - id: 6 request: proto: HTTP/1.1 @@ -323,7 +323,7 @@ interactions: trailer: {} content_length: 351 uncompressed: false - body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}],"total_count":1}' + body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}],"total_count":1}' headers: Content-Length: - "351" @@ -332,9 +332,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:35 GMT + - Thu, 22 May 2025 13:32:08 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -342,10 +342,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - cc1fa89e-a96e-43e4-bff3-6d4a047583fa + - 0294d6d3-dc2a-4531-bb0a-ca991c679c3a status: 200 OK code: 200 - duration: 94.3835ms + duration: 84.136458ms - id: 7 request: proto: HTTP/1.1 @@ -362,7 +362,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.0; darwin; arm64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/domain/v2beta1/dns-zones?dns_zones=test-zone2.scaleway-terraform.com&domain=&order_by=domain_asc + url: https://api.scaleway.com/domain/v2beta1/dns-zones?dns_zones=test-zone2.scaleway-terraform.com&domain=&order_by=domain_asc&project_id=105bdce1-64c0-48ab-899d-868455867ecf method: GET response: proto: HTTP/2.0 @@ -372,7 +372,7 @@ interactions: trailer: {} content_length: 351 uncompressed: false - body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}],"total_count":1}' + body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}],"total_count":1}' headers: Content-Length: - "351" @@ -381,9 +381,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:35 GMT + - Thu, 22 May 2025 13:32:08 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -391,10 +391,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 379af6f3-651b-4796-9b87-db928e53ec77 + - f8760664-3991-4880-8653-ddf8270f4375 status: 200 OK code: 200 - duration: 116.045125ms + duration: 92.947416ms - id: 8 request: proto: HTTP/1.1 @@ -411,7 +411,7 @@ interactions: headers: User-Agent: - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.0; darwin; arm64) terraform-provider/develop terraform/terraform-tests - url: https://api.scaleway.com/domain/v2beta1/dns-zones?dns_zones=test-zone2.scaleway-terraform.com&domain=&order_by=domain_asc + url: https://api.scaleway.com/domain/v2beta1/dns-zones?dns_zones=test-zone2.scaleway-terraform.com&domain=&order_by=domain_asc&project_id=105bdce1-64c0-48ab-899d-868455867ecf method: GET response: proto: HTTP/2.0 @@ -421,7 +421,7 @@ interactions: trailer: {} content_length: 351 uncompressed: false - body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}],"total_count":1}' + body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}],"total_count":1}' headers: Content-Length: - "351" @@ -430,9 +430,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:36 GMT + - Thu, 22 May 2025 13:32:09 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -440,10 +440,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 90e40b09-2b82-4270-8b99-c5d7c6e2e792 + - f90abbaa-30aa-4ea1-89c5-8d1469fac723 status: 200 OK code: 200 - duration: 100.135625ms + duration: 107.667208ms - id: 9 request: proto: HTTP/1.1 @@ -470,7 +470,7 @@ interactions: trailer: {} content_length: 351 uncompressed: false - body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-03-12T10:07:33Z"}],"total_count":1}' + body: '{"dns_zones":[{"domain":"scaleway-terraform.com","linked_products":[],"message":null,"ns":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_default":["ns0.dom.scw.cloud","ns1.dom.scw.cloud"],"ns_master":[],"project_id":"105bdce1-64c0-48ab-899d-868455867ecf","status":"active","subdomain":"test-zone2","updated_at":"2025-05-22T13:32:06Z"}],"total_count":1}' headers: Content-Length: - "351" @@ -479,9 +479,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:37 GMT + - Thu, 22 May 2025 13:32:10 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -489,10 +489,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 8983a052-cd12-424b-9a8a-e96822b4cd6e + - 4fe55631-e8da-498f-a614-3ff931a73091 status: 200 OK code: 200 - duration: 72.127875ms + duration: 370.122875ms - id: 10 request: proto: HTTP/1.1 @@ -528,9 +528,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:37 GMT + - Thu, 22 May 2025 13:32:10 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -538,10 +538,10 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - e303f5ee-05f6-4307-b1b1-3f3a6db4f6fb + - 497f7af5-04f4-49d3-b3d1-63cadba19029 status: 200 OK code: 200 - duration: 173.467375ms + duration: 322.378583ms - id: 11 request: proto: HTTP/1.1 @@ -577,9 +577,9 @@ interactions: Content-Type: - application/json Date: - - Wed, 12 Mar 2025 10:07:37 GMT + - Thu, 22 May 2025 13:32:10 GMT Server: - - Scaleway API Gateway (fr-par-1;edge03) + - Scaleway API Gateway (fr-par-2;edge02) Strict-Transport-Security: - max-age=63072000 X-Content-Type-Options: @@ -587,7 +587,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - bcde7c43-15fb-4939-9b3e-9c5f55ce2541 + - 681a9c59-1e1b-454c-a133-72d47d66a984 status: 200 OK code: 200 - duration: 76.222834ms + duration: 333.450125ms diff --git a/internal/services/domain/zone_data_source.go b/internal/services/domain/zone_data_source.go index 5560e3a6db..50b008f09c 100644 --- a/internal/services/domain/zone_data_source.go +++ b/internal/services/domain/zone_data_source.go @@ -13,7 +13,7 @@ func DataSourceZone() *schema.Resource { // Generate datasource schema from resource dsSchema := datasource.SchemaFromResourceSchema(ResourceZone().Schema) - datasource.AddOptionalFieldsToSchema(dsSchema, "domain", "subdomain") + datasource.AddOptionalFieldsToSchema(dsSchema, "domain", "subdomain", "project_id") return &schema.Resource{ ReadContext: DataSourceZoneRead, diff --git a/internal/services/domain/zone_data_source_test.go b/internal/services/domain/zone_data_source_test.go index 588a0d924c..116275f0a0 100644 --- a/internal/services/domain/zone_data_source_test.go +++ b/internal/services/domain/zone_data_source_test.go @@ -29,6 +29,7 @@ func TestAccDataSourceDomainZone_Basic(t *testing.T) { data scaleway_domain_zone test { domain = scaleway_domain_zone.main.domain subdomain = scaleway_domain_zone.main.subdomain + project_id = scaleway_domain_zone.main.project_id } `, acctest.TestDomain, testDNSZone), Check: resource.ComposeTestCheckFunc( @@ -36,6 +37,10 @@ func TestAccDataSourceDomainZone_Basic(t *testing.T) { resource.TestCheckResourceAttr("data.scaleway_domain_zone.test", "subdomain", testDNSZone), resource.TestCheckResourceAttr("data.scaleway_domain_zone.test", "domain", acctest.TestDomain), resource.TestCheckResourceAttr("data.scaleway_domain_zone.test", "status", "active"), + resource.TestCheckResourceAttrPair( + "data.scaleway_domain_zone.test", "project_id", + "scaleway_domain_zone.main", "project_id", + ), ), }, },