diff --git a/.semgrep.yml b/.semgrep.yml index 80fd0477fa..bc1ce1d14a 100644 --- a/.semgrep.yml +++ b/.semgrep.yml @@ -18,8 +18,11 @@ rules: - 'internal/sdkv2provider/resource_cloudflare_fallback_domain_test.go' patterns: - pattern-regex: '\d+\.\d+\.\d+\.\d+' + - pattern-not-regex: '-\d+\.\d+\.\d+\.\d+' - pattern-not: '127.0.0.1' - pattern-not: '0.0.0.0' + - pattern-not: '1.1.1.1' + - pattern-not: '1.0.0.1' - pattern-not-regex: '10\.\d+\.\d+.\d+' - pattern-not-regex: '192\.168\.\d+.\d+' - pattern-not-regex: '192\.0\.2\.\d+' # 192.0.2.0/24 (TEST-NET-1, rfc5737) @@ -156,6 +159,7 @@ rules: patterns: - pattern: '"account_id"' severity: WARNING + fix: "consts.AccountIDSchemaKey" - id: use-defined-zone-id-constant-instead-of-strings languages: - go @@ -168,4 +172,5 @@ rules: - 'templates/' patterns: - pattern: '"zone_id"' + fix: "consts.ZoneIDSchemaKey" severity: WARNING diff --git a/internal/framework/service/dcv_delegation/data_source_test.go b/internal/framework/service/dcv_delegation/data_source_test.go index 9753a2b444..a6b6e9b380 100644 --- a/internal/framework/service/dcv_delegation/data_source_test.go +++ b/internal/framework/service/dcv_delegation/data_source_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/cloudflare/terraform-provider-cloudflare/internal/acctest" + "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) @@ -21,7 +22,7 @@ func TestAccCloudflareDCVDelegationDataSource(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.cloudflare_dcv_delegation.test", "id"), resource.TestCheckResourceAttrSet("data.cloudflare_dcv_delegation.test", "hostname"), - resource.TestCheckResourceAttrSet("data.cloudflare_dcv_delegation.test", "zone_id"), + resource.TestCheckResourceAttrSet("data.cloudflare_dcv_delegation.test", consts.ZoneIDSchemaKey), ), }, }, diff --git a/internal/framework/service/dlp_datasets/data_source_test.go b/internal/framework/service/dlp_datasets/data_source_test.go index cf698ca482..cce6dc1825 100644 --- a/internal/framework/service/dlp_datasets/data_source_test.go +++ b/internal/framework/service/dlp_datasets/data_source_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/cloudflare/terraform-provider-cloudflare/internal/acctest" + "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) @@ -19,7 +20,7 @@ func TestAccCloudflareDLPDatasets_DataSource(t *testing.T) { { Config: testAccCheckCloudflareDlpDatasetsDataSourceConfig(accountID), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.cloudflare_dlp_datasets.my_datasets", "account_id"), + resource.TestCheckResourceAttrSet("data.cloudflare_dlp_datasets.my_datasets", consts.AccountIDSchemaKey), ), }, }, diff --git a/internal/framework/service/gateway_app_types/data_source_test.go b/internal/framework/service/gateway_app_types/data_source_test.go index 132419ec37..f1d788f949 100644 --- a/internal/framework/service/gateway_app_types/data_source_test.go +++ b/internal/framework/service/gateway_app_types/data_source_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/cloudflare/terraform-provider-cloudflare/internal/acctest" + "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) @@ -19,7 +20,7 @@ func TestAccCloudflareGatewayAppTypes_DataSource(t *testing.T) { { Config: testAccCheckCloudflareGatewayAppTypesDataSourceConfig(accountID), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.cloudflare_gateway_app_types.my_app_types", "account_id"), + resource.TestCheckResourceAttrSet("data.cloudflare_gateway_app_types.my_app_types", consts.AccountIDSchemaKey), resource.TestCheckResourceAttrSet("data.cloudflare_gateway_app_types.my_app_types", "app_types.#"), ), }, diff --git a/internal/framework/service/gateway_categories/data_source_test.go b/internal/framework/service/gateway_categories/data_source_test.go index e8cf0919b2..8d6320cb8d 100644 --- a/internal/framework/service/gateway_categories/data_source_test.go +++ b/internal/framework/service/gateway_categories/data_source_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/cloudflare/terraform-provider-cloudflare/internal/acctest" + "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) @@ -23,7 +24,7 @@ func TestAccCloudflareGatewayCategories_DataSource(t *testing.T) { { Config: testAccCheckCloudflareGatewayCategoriesDataSourceConfig(accountID), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.cloudflare_gateway_categories.my_categories", "account_id"), + resource.TestCheckResourceAttrSet("data.cloudflare_gateway_categories.my_categories", consts.AccountIDSchemaKey), resource.TestCheckResourceAttrSet("data.cloudflare_gateway_categories.my_categories", "categories.#"), ), }, diff --git a/internal/framework/service/hyperdrive_config/resource_test.go b/internal/framework/service/hyperdrive_config/resource_test.go index 7da932433a..e4e6c41a0e 100644 --- a/internal/framework/service/hyperdrive_config/resource_test.go +++ b/internal/framework/service/hyperdrive_config/resource_test.go @@ -9,6 +9,7 @@ import ( cfv1 "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/terraform-provider-cloudflare/internal/acctest" + "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" "github.com/cloudflare/terraform-provider-cloudflare/internal/utils" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-testing/helper/resource" @@ -113,7 +114,7 @@ func TestAccCloudflareHyperdriveConfig_Basic(t *testing.T) { return nil }, resource.TestCheckResourceAttr(resourceName, "name", rnd), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "origin.database", databaseName), resource.TestCheckResourceAttr(resourceName, "origin.host", databaseHostname), resource.TestCheckResourceAttr(resourceName, "origin.port", databasePort), @@ -146,7 +147,7 @@ func TestAccCloudflareHyperdriveConfig_Basic(t *testing.T) { ), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", updatedName), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "origin.database", databaseName), resource.TestCheckResourceAttr(resourceName, "origin.host", databaseHostname), resource.TestCheckResourceAttr(resourceName, "origin.port", databasePort), @@ -207,7 +208,7 @@ func TestAccCloudflareHyperdriveConfig_CachingSettings(t *testing.T) { ), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", rnd), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "origin.database", databaseName), resource.TestCheckResourceAttr(resourceName, "origin.host", databaseHostname), resource.TestCheckResourceAttr(resourceName, "origin.port", databasePort), @@ -293,7 +294,7 @@ func TestAccCloudflareHyperdriveConfig_HyperdriveOverAccess(t *testing.T) { return nil }, resource.TestCheckResourceAttr(resourceName, "name", rnd), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "origin.database", databaseName), resource.TestCheckResourceAttr(resourceName, "origin.host", databaseHostname), resource.TestCheckNoResourceAttr(resourceName, "origin.port"), @@ -324,7 +325,7 @@ func TestAccCloudflareHyperdriveConfig_HyperdriveOverAccess(t *testing.T) { ), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", updatedName), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "origin.database", databaseName), resource.TestCheckResourceAttr(resourceName, "origin.host", databaseHostname), resource.TestCheckNoResourceAttr(resourceName, "origin.port"), @@ -378,7 +379,7 @@ func TestAccCloudflareHyperdriveConfig_Minimum(t *testing.T) { ), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", rnd), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "origin.database", databaseName), resource.TestCheckResourceAttr(resourceName, "origin.host", databaseHostname), resource.TestCheckResourceAttr(resourceName, "origin.port", databasePort), diff --git a/internal/framework/service/infrastructure_access_target/data_source_test.go b/internal/framework/service/infrastructure_access_target/data_source_test.go index 878363bf81..b84c8c122d 100644 --- a/internal/framework/service/infrastructure_access_target/data_source_test.go +++ b/internal/framework/service/infrastructure_access_target/data_source_test.go @@ -24,7 +24,7 @@ func TestAccCloudflareInfrastructureAccessTarget_DataSource(t *testing.T) { resource.TestCheckNoResourceAttr("data.cloudflare_infrastructure_access_targets."+rnd1, "ip.ipv6"), resource.TestCheckResourceAttr("cloudflare_infrastructure_access_target."+rnd1, "hostname", rnd1), - resource.TestCheckResourceAttr("cloudflare_infrastructure_access_target."+rnd1, "ip.ipv4.ip_addr", "250.26.29.250"), + resource.TestCheckResourceAttr("cloudflare_infrastructure_access_target."+rnd1, "ip.ipv4.ip_addr", "198.51.100.1"), resource.TestCheckResourceAttr("cloudflare_infrastructure_access_target."+rnd1, "ip.ipv4.virtual_network_id", "b9c90134-52de-4903-81e8-004a3a06b435"), ), }, @@ -40,7 +40,7 @@ resource "cloudflare_infrastructure_access_target" "%[2]s" { hostname = "%[2]s" ip = { ipv4 = { - ip_addr = "250.26.29.250", + ip_addr = "198.51.100.1", virtual_network_id = "b9c90134-52de-4903-81e8-004a3a06b435" } } diff --git a/internal/framework/service/infrastructure_access_target/resource_test.go b/internal/framework/service/infrastructure_access_target/resource_test.go index 9904d366f9..aeb40c3815 100644 --- a/internal/framework/service/infrastructure_access_target/resource_test.go +++ b/internal/framework/service/infrastructure_access_target/resource_test.go @@ -59,7 +59,7 @@ func TestAccCloudflareInfrastructureAccessTarget_Basic(t *testing.T) { Config: testAccCloudflareInfrastructureAccessTargetCreate(accID, rnd), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "hostname", rnd), - resource.TestCheckResourceAttr(resourceName, "ip.ipv4.ip_addr", "250.26.29.250"), + resource.TestCheckResourceAttr(resourceName, "ip.ipv4.ip_addr", "198.51.100.1"), resource.TestCheckNoResourceAttr(resourceName, "ip.ipv6"), ), }, @@ -68,8 +68,8 @@ func TestAccCloudflareInfrastructureAccessTarget_Basic(t *testing.T) { Config: testAccCloudflareInfrastructureAccessTargetUpdate(accID, rnd), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "hostname", rnd+"-updated"), - resource.TestCheckResourceAttr(resourceName, "ip.ipv4.ip_addr", "250.26.29.250"), - resource.TestCheckResourceAttr(resourceName, "ip.ipv6.ip_addr", "64c0:64e8:f0b4:8dbf:7104:72b0:ec8f:f5e0"), + resource.TestCheckResourceAttr(resourceName, "ip.ipv4.ip_addr", "198.51.100.1"), + resource.TestCheckResourceAttr(resourceName, "ip.ipv6.ip_addr", "2001:db8::"), resource.TestCheckResourceAttr(resourceName, "ip.ipv6.virtual_network_id", "01920a8c-dc14-7bb2-b67b-14c858494a54"), ), }, @@ -84,7 +84,7 @@ resource "cloudflare_infrastructure_access_target" "%[2]s" { hostname = "%[2]s" ip = { ipv4 = { - ip_addr = "250.26.29.250" + ip_addr = "198.51.100.1" virtual_network_id = "01920a8c-dc14-7bb2-b67b-14c858494a54" } } @@ -98,11 +98,11 @@ resource "cloudflare_infrastructure_access_target" "%[2]s" { hostname = "%[2]s-updated" ip = { ipv4 = { - ip_addr = "250.26.29.250" + ip_addr = "198.51.100.1" virtual_network_id = "01920a8c-dc14-7bb2-b67b-14c858494a54" }, ipv6 = { - ip_addr = "64c0:64e8:f0b4:8dbf:7104:72b0:ec8f:f5e0" + ip_addr = "2001:db8::" virtual_network_id = "01920a8c-dc14-7bb2-b67b-14c858494a54" } } diff --git a/internal/framework/service/list_item/schema.go b/internal/framework/service/list_item/schema.go index dc3514f277..bc7b0de2d9 100644 --- a/internal/framework/service/list_item/schema.go +++ b/internal/framework/service/list_item/schema.go @@ -3,6 +3,7 @@ package list_item import ( "context" "fmt" + "github.com/MakeNowJust/heredoc/v2" "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" "github.com/cloudflare/terraform-provider-cloudflare/internal/utils" diff --git a/internal/framework/service/turnstile/resource_test.go b/internal/framework/service/turnstile/resource_test.go index 94dc63f334..f476c9a434 100644 --- a/internal/framework/service/turnstile/resource_test.go +++ b/internal/framework/service/turnstile/resource_test.go @@ -8,6 +8,7 @@ import ( cfv1 "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/terraform-provider-cloudflare/internal/acctest" + "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" "github.com/cloudflare/terraform-provider-cloudflare/internal/utils" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) @@ -58,7 +59,7 @@ func TestAccCloudflareTurnstileWidget_Basic(t *testing.T) { Config: testAccCheckCloudflareTurnstileWidgetBasic(rnd, accountID), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", rnd), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "bot_fight_mode", "false"), resource.TestCheckResourceAttr(resourceName, "domains.#", "1"), resource.TestCheckResourceAttr(resourceName, "domains.0", "example.com"), @@ -90,7 +91,7 @@ func TestAccCloudflareTurnstileWidget_Minimum(t *testing.T) { Config: testAccCheckCloudflareTurnstileWidgetMinimum(rnd, accountID), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", rnd), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "bot_fight_mode", "false"), resource.TestCheckResourceAttr(resourceName, "domains.#", "1"), resource.TestCheckResourceAttr(resourceName, "domains.0", "example.com"), @@ -122,7 +123,7 @@ func TestAccCloudflareTurnstileWidget_NoDomains(t *testing.T) { Config: testAccCheckCloudflareTurnstileWidgetNoDomains(rnd, accountID), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", rnd), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "bot_fight_mode", "false"), resource.TestCheckResourceAttr(resourceName, "domains.#", "0"), resource.TestCheckResourceAttr(resourceName, "mode", "managed"), diff --git a/internal/framework/service/user/data_source_test.go b/internal/framework/service/user/data_source_test.go index 54f0de29cb..9ee84c9d99 100644 --- a/internal/framework/service/user/data_source_test.go +++ b/internal/framework/service/user/data_source_test.go @@ -1,10 +1,11 @@ package user_test import ( - "github.com/cloudflare/terraform-provider-cloudflare/internal/acctest" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" "os" "testing" + + "github.com/cloudflare/terraform-provider-cloudflare/internal/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccCloudflareUserDataSource(t *testing.T) { diff --git a/internal/framework/service/user/schema.go b/internal/framework/service/user/schema.go index efd3351bf4..c14e23faa0 100644 --- a/internal/framework/service/user/schema.go +++ b/internal/framework/service/user/schema.go @@ -2,6 +2,7 @@ package user import ( "context" + "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" ) diff --git a/internal/sdkv2provider/resource_cloudflare_access_identity_provider_test.go b/internal/sdkv2provider/resource_cloudflare_access_identity_provider_test.go index f05e857024..27b3b692ba 100644 --- a/internal/sdkv2provider/resource_cloudflare_access_identity_provider_test.go +++ b/internal/sdkv2provider/resource_cloudflare_access_identity_provider_test.go @@ -220,7 +220,7 @@ func TestAccCloudflareAccessIdentityProvider_AzureAD(t *testing.T) { { Config: testAccCheckCloudflareAccessIdentityProviderAzureAD(accountID, rnd), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(resourceName, "name", rnd), resource.TestCheckResourceAttr(resourceName, "type", "azureAD"), resource.TestCheckResourceAttr(resourceName, "config.0.client_id", "test"), diff --git a/internal/sdkv2provider/resource_cloudflare_account_member_test.go b/internal/sdkv2provider/resource_cloudflare_account_member_test.go index c42e2f7f78..87367dc0ab 100644 --- a/internal/sdkv2provider/resource_cloudflare_account_member_test.go +++ b/internal/sdkv2provider/resource_cloudflare_account_member_test.go @@ -65,7 +65,7 @@ func TestAccCloudflareAccountMember_DirectAdd(t *testing.T) { { Config: testCloudflareAccountMemberDirectAdd(rnd, "millie@cloudflare.com", accountID), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(name, "account_id", accountID), + resource.TestCheckResourceAttr(name, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(name, "email_address", "millie@cloudflare.com"), resource.TestCheckResourceAttr(name, "role_ids.#", "1"), resource.TestCheckResourceAttr(name, "role_ids.0", "05784afa30c1afe1440e79d9351c7430"), diff --git a/internal/sdkv2provider/resource_cloudflare_api_shield_operation.go b/internal/sdkv2provider/resource_cloudflare_api_shield_operation.go index c91eac158a..8f81ebc43d 100644 --- a/internal/sdkv2provider/resource_cloudflare_api_shield_operation.go +++ b/internal/sdkv2provider/resource_cloudflare_api_shield_operation.go @@ -3,6 +3,7 @@ package sdkv2provider import ( "context" "fmt" + "github.com/pkg/errors" "github.com/MakeNowJust/heredoc/v2" diff --git a/internal/sdkv2provider/resource_cloudflare_device_dex_tests_test.go b/internal/sdkv2provider/resource_cloudflare_device_dex_tests_test.go index 98022be182..2390f65eaf 100644 --- a/internal/sdkv2provider/resource_cloudflare_device_dex_tests_test.go +++ b/internal/sdkv2provider/resource_cloudflare_device_dex_tests_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) @@ -20,7 +21,7 @@ func TestAccCloudflareDeviceDexTest_Traceroute(t *testing.T) { { Config: testAccCloudflareDeviceDexTestsTraceroute(accountID, rnd), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(name, "account_id", accountID), + resource.TestCheckResourceAttr(name, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(name, "name", rnd), resource.TestCheckResourceAttr(name, "description", rnd), resource.TestCheckResourceAttr(name, "interval", "0h30m0s"), @@ -46,7 +47,7 @@ func TestAccCloudflareDeviceDexTest_TracerouteIPv4(t *testing.T) { { Config: testAccCloudflareDeviceDexTestsTracerouteIpv4(accountID, rnd), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(name, "account_id", accountID), + resource.TestCheckResourceAttr(name, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(name, "name", rnd), resource.TestCheckResourceAttr(name, "description", rnd), resource.TestCheckResourceAttr(name, "interval", "0h30m0s"), @@ -72,7 +73,7 @@ func TestAccCloudflareDeviceDexTest_HTTP(t *testing.T) { { Config: testAccCloudflareDeviceDexTestsHttp(accountID, rnd), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(name, "account_id", accountID), + resource.TestCheckResourceAttr(name, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(name, "name", rnd), resource.TestCheckResourceAttr(name, "description", rnd), resource.TestCheckResourceAttr(name, "interval", "0h30m0s"), diff --git a/internal/sdkv2provider/resource_cloudflare_dlp_profile_test.go b/internal/sdkv2provider/resource_cloudflare_dlp_profile_test.go index 438ff2cd01..101346ba38 100644 --- a/internal/sdkv2provider/resource_cloudflare_dlp_profile_test.go +++ b/internal/sdkv2provider/resource_cloudflare_dlp_profile_test.go @@ -92,7 +92,7 @@ func TestAccCloudflareDLPProfile_CustomWithAllowedMatchCount(t *testing.T) { { Config: testAccCloudflareDLPProfileConfigCustomWithAllowedMatchCount(accountID, rnd, "custom profile", 42), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(name, "account_id", accountID), + resource.TestCheckResourceAttr(name, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(name, "name", rnd), resource.TestCheckResourceAttr(name, "description", "custom profile"), resource.TestCheckResourceAttr(name, "allowed_match_count", "42"), @@ -120,7 +120,7 @@ func TestAccCloudflareDLPProfile_CustomWithOCREnabled(t *testing.T) { { Config: testAccCloudflareDLPProfileConfigCustomWithOCREnabled(accountID, rnd, "custom profile", true), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(name, "account_id", accountID), + resource.TestCheckResourceAttr(name, consts.AccountIDSchemaKey, accountID), resource.TestCheckResourceAttr(name, "name", rnd), resource.TestCheckResourceAttr(name, "description", "custom profile"), resource.TestCheckResourceAttr(name, "allowed_match_count", "0"), diff --git a/internal/sdkv2provider/resource_cloudflare_queue_test.go b/internal/sdkv2provider/resource_cloudflare_queue_test.go index 7e4425784f..0e456bc794 100644 --- a/internal/sdkv2provider/resource_cloudflare_queue_test.go +++ b/internal/sdkv2provider/resource_cloudflare_queue_test.go @@ -60,14 +60,14 @@ func TestAccCloudflareQueue_Basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckCloudflareQueueExists(rnd, &queue), resource.TestCheckResourceAttr(resourceName, "name", rnd), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), ), }, { Config: testAccCheckCloudflareQueue(rnd, accountID, rnd+"-updated"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", rnd+"-updated"), - resource.TestCheckResourceAttr(resourceName, "account_id", accountID), + resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID), ), }, { diff --git a/internal/sdkv2provider/resource_cloudflare_regional_hostname.go b/internal/sdkv2provider/resource_cloudflare_regional_hostname.go index 80ca31b5a7..af463bb89c 100644 --- a/internal/sdkv2provider/resource_cloudflare_regional_hostname.go +++ b/internal/sdkv2provider/resource_cloudflare_regional_hostname.go @@ -3,10 +3,11 @@ package sdkv2provider import ( "context" "errors" + "time" + "github.com/MakeNowJust/heredoc/v2" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/terraform-provider-cloudflare/internal/consts" - "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"