Skip to content

fix: suppress plan drift for enable_binding_cookie, options_preflight_bypass, cors_headers on mcp type#7121

Open
t0rrant wants to merge 2 commits into
cloudflare:nextfrom
t0rrant:t0rrant/fix-mcp-computed-attrs
Open

fix: suppress plan drift for enable_binding_cookie, options_preflight_bypass, cors_headers on mcp type#7121
t0rrant wants to merge 2 commits into
cloudflare:nextfrom
t0rrant:t0rrant/fix-mcp-computed-attrs

Conversation

@t0rrant

@t0rrant t0rrant commented May 18, 2026

Copy link
Copy Markdown

Fixes #7120

Problem

The Cloudflare Access API returns enable_binding_cookie, options_preflight_bypass, and cors_headers for mcp type applications. However, the provider's type-based validator (RequiresOtherStringAttributeToBeOneOf with selfHostedAppTypes) rejects any HCL declaration of these attributes when type = "mcp". This creates irreconcilable plan drift: the provider stores the API values in state on import/refresh but cannot reconcile them via config, producing false -> null (and {...} -> null for cors_headers) on every plan.

Fix

Mirrors the existing handling of http_only_cookie_attribute, which already has Computed: true and is handled in modifyPlan:

  1. schema.go: add Computed: true to enable_binding_cookie, options_preflight_bypass, and cors_headers. Note: the v500 migration schema already had Computed: true on enable_binding_cookie and options_preflight_bypass, confirming this is a regression introduced when mcp type support was added in AUTH-7657 Add support for MCP & MCP_PORTAL Access Apps #6326.

  2. plan_modifiers.go: for non-selfHosted types (e.g. mcp), copy state values into the plan when config is null, suppressing the false -> null diff. The existing setDefaultAccordingToAppTypes calls handle the unknown -> null/default case for new resources.

  3. resource_test.go: remove enable_binding_cookie and options_preflight_bypass from ImportStateVerifyIgnore (they were workarounds for this bug), add ExpectNonEmptyPlan: false to the existing PlanOnly step to explicitly assert no drift after import.

@t0rrant
t0rrant requested a review from a team as a code owner May 18, 2026 15:42
…_bypass, cors_headers on mcp type

The Cloudflare Access API returns enable_binding_cookie, options_preflight_bypass,
and cors_headers for mcp type applications, but the provider's type-based validator
(RequiresOtherStringAttributeToBeOneOf with selfHostedAppTypes) rejects any HCL
declaration of these attributes when type = "mcp". This creates irreconcilable
plan drift: the provider stores the API values in state on import/refresh but
cannot reconcile them via config, producing false -> null on every plan.

The fix mirrors the existing handling of http_only_cookie_attribute (which already
has Computed: true and is handled in modifyPlan):

1. schema.go: add Computed: true to enable_binding_cookie, options_preflight_bypass,
   and cors_headers. Note: the v500 migration schema already had Computed: true on
   enable_binding_cookie and options_preflight_bypass, confirming this is a regression
   introduced when mcp type support was added in PR cloudflare#6326.

2. plan_modifiers.go: for non-selfHosted types (e.g. mcp), copy state values into
   the plan when config is null, suppressing the false -> null diff. The existing
   setDefaultAccordingToAppTypes calls handle the unknown -> null/default case for
   new resources.

Fixes: cloudflare#7120
@t0rrant
t0rrant force-pushed the t0rrant/fix-mcp-computed-attrs branch from d3292be to 4fdab28 Compare May 22, 2026 12:12
@t0rrant
t0rrant changed the base branch from main to next May 22, 2026 12:13
@musa-cf

musa-cf commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Can you attach the acceptance test output?

You can run them like so:
TF_ACC=1 go test ./internal/services/zero_trust_access_application -count 1 -v

@t0rrant

t0rrant commented Jun 9, 2026

Copy link
Copy Markdown
Author

Can you attach the acceptance test output?

You can run them like so: TF_ACC=1 go test ./internal/services/zero_trust_access_application -count 1 -v

=== RUN   TestZeroTrustAccessApplicationDataSourceModelSchemaParity
=== PAUSE TestZeroTrustAccessApplicationDataSourceModelSchemaParity
=== RUN   TestAccCloudflareAccessApplicationDataSource_AccountName
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationDataSource_AccountName (0.00s)
=== RUN   TestAccCloudflareAccessApplicationDataSource_AccountDomain
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationDataSource_AccountDomain (0.00s)
=== RUN   TestAccCloudflareAccessApplicationDataSource_ZoneName
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationDataSource_ZoneName (0.00s)
=== RUN   TestAccCloudflareAccessApplicationDataSource_ZoneDomain
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationDataSource_ZoneDomain (0.00s)
=== RUN   TestZeroTrustAccessApplicationsDataSourceModelSchemaParity
=== PAUSE TestZeroTrustAccessApplicationsDataSourceModelSchemaParity
=== RUN   TestZeroTrustAccessApplicationModelSchemaParity
=== PAUSE TestZeroTrustAccessApplicationModelSchemaParity
=== RUN   TestAccCloudflareAccessApplication_BasicZone
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_BasicZone (0.00s)
=== RUN   TestAccCloudflareAccessApplication_BasicAccount
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_BasicAccount (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSCIMConfigHttpBasic
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSCIMConfigHttpBasic (0.00s)
=== RUN   TestAccCloudflareAccessApplication_UpdateSCIMConfig
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_UpdateSCIMConfig (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSCIMConfigInvalidMappingSchema
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSCIMConfigInvalidMappingSchema (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSCIMConfigHttpBasicMissingRequired
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSCIMConfigHttpBasicMissingRequired (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSCIMConfigOAuthBearerToken
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSCIMConfigOAuthBearerToken (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSCIMConfigOAuth2
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSCIMConfigOAuth2 (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSCIMConfigOAuth2MissingRequired
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSCIMConfigOAuth2MissingRequired (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithCORS
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithCORS (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSAMLSaas
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSAMLSaas (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSAMLSaas_Import
=== PAUSE TestAccCloudflareAccessApplication_WithSAMLSaas_Import
=== RUN   TestAccCloudflareAccessApplication_WithOIDCSaas
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithOIDCSaas (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithOIDCSaas_Import
=== PAUSE TestAccCloudflareAccessApplication_WithOIDCSaas_Import
=== RUN   TestAccCloudflareAccessApplication_WithAutoRedirectToIdentity
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithAutoRedirectToIdentity (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithEnableBindingCookie
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithEnableBindingCookie (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithCustomDenyFields
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithCustomDenyFields (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithADefinedIdp
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithADefinedIdp (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithMultipleIdpsReordered
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithMultipleIdpsReordered (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithHttpOnlyCookieAttribute
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithHttpOnlyCookieAttribute (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithHTTPOnlyCookieAttributeSetToFalse
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithHTTPOnlyCookieAttributeSetToFalse (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSameSiteCookieAttribute
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSameSiteCookieAttribute (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithLogoURL
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithLogoURL (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSkipInterstitial
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSkipInterstitial (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithAppLauncherVisible
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithAppLauncherVisible (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithSelfHostedDomains
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSelfHostedDomains (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithDefinedTags
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithDefinedTags (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithLegacyPolicies
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithLegacyPolicies (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithReusablePolicies
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithReusablePolicies (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithReusablePolicies_InvalidPrecedence
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithReusablePolicies_InvalidPrecedence (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithAppLauncherCustomization
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithAppLauncherCustomization (0.00s)
=== RUN   TestAccCloudflareAccessApplication_Infrastructure
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_Infrastructure (0.00s)
=== RUN   TestAccCloudflareAccessApplication_RDP
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_RDP (0.00s)
=== RUN   TestAccCloudflareAccessApplicationWithZoneID
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationWithZoneID (0.00s)
=== RUN   TestAccCloudflareAccessApplicationWithMissingCORSMethods
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationWithMissingCORSMethods (0.00s)
=== RUN   TestAccCloudflareAccessApplicationWithMissingCORSOrigins
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationWithMissingCORSOrigins (0.00s)
=== RUN   TestAccCloudflareAccessApplicationWithInvalidSessionDuration
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationWithInvalidSessionDuration (0.00s)
=== RUN   TestAccCloudflareAccessApplicationWithInvalidPrivateDestination
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationWithInvalidPrivateDestination (0.00s)
=== RUN   TestAccCloudflareAccessApplicationWithDestinations
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationWithDestinations (0.00s)
=== RUN   TestAccCloudflareAccessApplicationMisconfiguredCORSCredentialsAllowingAllOrigins
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationMisconfiguredCORSCredentialsAllowingAllOrigins (0.00s)
=== RUN   TestAccCloudflareAccessApplicationWithInvalidSaas
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplicationWithInvalidSaas (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WarpInvalid
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WarpInvalid (0.00s)
=== RUN   TestAccCloudflareAccessApplication_BooleanFieldsPersistence
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_BooleanFieldsPersistence (0.00s)
=== RUN   TestAccCloudflareAccessApplication_AllowIframeFalsePersistence
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_AllowIframeFalsePersistence (0.00s)
=== RUN   TestAccCloudflareAccessApplication_BooleanFieldTransitions
    resource_test.go:1862: Account-level WARP setting keep gets toggled off
--- SKIP: TestAccCloudflareAccessApplication_BooleanFieldTransitions (0.00s)
=== RUN   TestAccCloudflareAccessApplication_TagsOrderIgnored
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_TagsOrderIgnored (0.00s)
=== RUN   TestAccCloudflareAccessApplication_MCPSetup
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_MCPSetup (0.00s)
=== RUN   TestAccCloudflareAccessApplication_ProxyEndpoint
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_ProxyEndpoint (0.00s)
=== RUN   TestAccUpgradeZeroTrustAccessApplication_FromPublishedV5
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccUpgradeZeroTrustAccessApplication_FromPublishedV5 (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithOAuthConfiguration
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithOAuthConfiguration (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithOAuthConfigurationMinimal
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithOAuthConfigurationMinimal (0.00s)
=== RUN   TestAccCloudflareAccessApplication_UpdateOAuthConfiguration
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_UpdateOAuthConfiguration (0.00s)
=== RUN   TestAccCloudflareAccessApplication_WithMFAConfig
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithMFAConfig (0.00s)
=== RUN   TestAccCloudflareAccessApplication_MFAConfigInvalidType
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_MFAConfigInvalidType (0.00s)
=== RUN   TestAccCloudflareAccessApplication_InfrastructureWithPolicyMFAConfig
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_InfrastructureWithPolicyMFAConfig (0.00s)
=== CONT  TestZeroTrustAccessApplicationDataSourceModelSchemaParity
=== CONT  TestAccCloudflareAccessApplication_WithOIDCSaas_Import
=== CONT  TestZeroTrustAccessApplicationModelSchemaParity
=== CONT  TestAccCloudflareAccessApplication_WithSAMLSaas_Import
=== CONT  TestZeroTrustAccessApplicationsDataSourceModelSchemaParity
=== NAME  TestAccCloudflareAccessApplication_WithOIDCSaas_Import
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithOIDCSaas_Import (0.00s)
=== NAME  TestAccCloudflareAccessApplication_WithSAMLSaas_Import
    acctest.go:63: valid credentials are required for this acceptance test: one of CLOUDFLARE_API_KEY, CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_USER_SERVICE_KEY must be set
--- FAIL: TestAccCloudflareAccessApplication_WithSAMLSaas_Import (0.00s)
--- PASS: TestZeroTrustAccessApplicationDataSourceModelSchemaParity (0.00s)
=== NAME  TestZeroTrustAccessApplicationModelSchemaParity
    integrity.go:126: mismatch at ".@ZeroTrustAccessApplicationModel.options_preflight_bypass": expected "computed_optional", received "options_preflight_bypass,optional"
    integrity.go:126: mismatch at ".@ZeroTrustAccessApplicationModel.enable_binding_cookie": expected "computed_optional", received "enable_binding_cookie,optional"
    integrity.go:126: mismatch at ".@ZeroTrustAccessApplicationModel.cors_headers": expected "computed_optional", received "cors_headers,optional"
    integrity.go:129: If you are implementing a custom solution, you can suppress these warning(s) by adding the following to the test, as an example:
         + errs.Ignore(".@ZeroTrustAccessApplicationModel.options_preflight_bypass")
--- FAIL: TestZeroTrustAccessApplicationModelSchemaParity (0.00s)
--- PASS: TestZeroTrustAccessApplicationsDataSourceModelSchemaParity (0.00s)
FAIL
FAIL	github.com/cloudflare/terraform-provider-cloudflare/internal/services/zero_trust_access_application	0.028s
FAIL

I notice a schema mismatch, let me update the model.

…rs as computed_optional in model

Align model JSON struct tags with the resource schema, which already
declares these fields as Computed+Optional. Fixes the
TestZeroTrustAccessApplicationModelSchemaParity failure.
@musa-cf

musa-cf commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

I'm seeing multiple test failures, all with the same message:

=== RUN   TestAccCloudflareAccessApplicationWithDestinations
    resource_test.go:1617: Step 1/2 error: Error running pre-apply plan: exit status 1

        Error: Value Conversion Error

          with cloudflare_zero_trust_access_application.cftftesteursoccugf,
          on terraform_plugin_test.tf line 11, in resource "cloudflare_zero_trust_access_application" "cftftesteursoccugf":
          11: resource "cloudflare_zero_trust_access_application" "cftftesteursoccugf" {

        An unexpected error was encountered trying to build a value. This is always
        an error in the provider. Please report the following to the provider
        developer:

        Received unknown value, however the target type cannot handle unknown values.
        Use the corresponding `types` package type or a custom type that handles
        unknown values.

        Path: cors_headers
        Target Type:
        *zero_trust_access_application.ZeroTrustAccessApplicationCORSHeadersModel
        Suggested Type: basetypes.ObjectValue
--- FAIL: TestAccCloudflareAccessApplicationWithDestinations (0.35s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloudflare_zero_trust_access_application: enable_binding_cookie and options_preflight_bypass cause persistent plan drift when type = "mcp"

3 participants