@@ -266,9 +266,9 @@ func TestEnvVarsMatchIgnoringSecrets(t *testing.T) {
266266 expected : true ,
267267 },
268268 {
269- name : "source nil, dest empty" ,
270- source : nil ,
271- dest : & map [string ]PagesProjectDeploymentConfigsPreviewEnvVarsModel {},
269+ name : "source nil, dest empty" ,
270+ source : nil ,
271+ dest : & map [string ]PagesProjectDeploymentConfigsPreviewEnvVarsModel {},
272272 expected : true ,
273273 },
274274 {
@@ -402,7 +402,7 @@ func TestCompatibilityFlagsEqual(t *testing.T) {
402402}
403403
404404// TestNormalizeBuildConfig_EmptyStrings tests that build_config with empty strings
405- // is normalized to nil . This is the fix for the issue where the API returns empty
405+ // is normalized to null . This is the fix for the issue where the API returns empty
406406// strings for build_config fields (like build_command = ""), and the provider would
407407// incorrectly preserve these in the plan, causing "planned value for a non-computed
408408// attribute" errors.
@@ -414,14 +414,14 @@ func TestNormalizeBuildConfig_EmptyStrings(t *testing.T) {
414414 Name : types .StringValue ("test-project" ),
415415 AccountID : types .StringValue ("abc123" ),
416416 ProductionBranch : types .StringValue ("main" ),
417- BuildConfig : & PagesProjectBuildConfigModel {
418- BuildCaching : types .BoolNull (), // null bool
419- BuildCommand : types .StringValue ("" ), // empty string
420- DestinationDir : types .StringValue ("" ), // empty string
421- RootDir : types .StringValue ("" ), // empty string
422- WebAnalyticsTag : types .StringValue ("" ), // empty string
423- WebAnalyticsToken : types .StringValue ("" ), // empty string
424- },
417+ BuildConfig : customfield . NewObjectMust ( ctx , & PagesProjectBuildConfigModel {
418+ BuildCaching : types .BoolNull (), // null bool
419+ BuildCommand : types .StringValue ("" ), // empty string
420+ DestinationDir : types .StringValue ("" ), // empty string
421+ RootDir : types .StringValue ("" ), // empty string
422+ WebAnalyticsTag : types .StringValue ("" ), // empty string
423+ WebAnalyticsToken : types .StringValue ("" ), // empty string
424+ }) ,
425425 }
426426
427427 // Call NormalizeDeploymentConfigs
@@ -431,14 +431,14 @@ func TestNormalizeBuildConfig_EmptyStrings(t *testing.T) {
431431 t .Fatalf ("unexpected diagnostics: %v" , diags )
432432 }
433433
434- // build_config should be normalized to nil when all fields are empty/null
435- if result .BuildConfig != nil {
436- t .Errorf ("expected build_config to be nil when all fields are empty/null, got %+v" , result .BuildConfig )
434+ // build_config should be normalized to null when all fields are empty/null
435+ if ! result .BuildConfig . IsNull () {
436+ t .Errorf ("expected build_config to be null when all fields are empty/null, got %+v" , result .BuildConfig )
437437 }
438438}
439439
440440// TestNormalizeBuildConfig_WithActualValues tests that build_config with actual
441- // values is NOT normalized to nil .
441+ // values is NOT normalized to null .
442442func TestNormalizeBuildConfig_WithActualValues (t * testing.T ) {
443443 ctx := context .Background ()
444444
@@ -447,14 +447,14 @@ func TestNormalizeBuildConfig_WithActualValues(t *testing.T) {
447447 Name : types .StringValue ("test-project" ),
448448 AccountID : types .StringValue ("abc123" ),
449449 ProductionBranch : types .StringValue ("main" ),
450- BuildConfig : & PagesProjectBuildConfigModel {
450+ BuildConfig : customfield . NewObjectMust ( ctx , & PagesProjectBuildConfigModel {
451451 BuildCaching : types .BoolValue (true ),
452452 BuildCommand : types .StringValue ("npm run build" ),
453453 DestinationDir : types .StringValue ("dist" ),
454454 RootDir : types .StringValue ("/" ),
455- WebAnalyticsTag : types .StringValue ("" ), // empty is ok if others have values
456- WebAnalyticsToken : types .StringValue ("" ), // empty is ok if others have values
457- },
455+ WebAnalyticsTag : types .StringValue ("" ), // empty is ok if others have values
456+ WebAnalyticsToken : types .StringValue ("" ), // empty is ok if others have values
457+ }) ,
458458 }
459459
460460 // Call NormalizeDeploymentConfigs
@@ -464,8 +464,8 @@ func TestNormalizeBuildConfig_WithActualValues(t *testing.T) {
464464 t .Fatalf ("unexpected diagnostics: %v" , diags )
465465 }
466466
467- // build_config should NOT be nil when fields have actual values
468- if result .BuildConfig == nil {
467+ // build_config should NOT be null when fields have actual values
468+ if result .BuildConfig . IsNull () {
469469 t .Error ("expected build_config to be preserved when fields have actual values" )
470470 }
471471}
@@ -475,12 +475,12 @@ func TestNormalizeBuildConfig_WithActualValues(t *testing.T) {
475475func TestMergeBuildConfigFromState (t * testing.T ) {
476476 // Plan has some values but not all
477477 plan := & PagesProjectBuildConfigModel {
478- BuildCaching : types .BoolNull (), // not specified by user
478+ BuildCaching : types .BoolNull (), // not specified by user
479479 BuildCommand : types .StringValue ("yarn build" ), // user specified
480- DestinationDir : types .StringUnknown (), // unknown
481- RootDir : types .StringValue ("/app" ), // user specified
482- WebAnalyticsTag : types .StringNull (), // not specified
483- WebAnalyticsToken : types .StringNull (), // not specified
480+ DestinationDir : types .StringUnknown (), // unknown
481+ RootDir : types .StringValue ("/app" ), // user specified
482+ WebAnalyticsTag : types .StringNull (), // not specified
483+ WebAnalyticsToken : types .StringNull (), // not specified
484484 }
485485
486486 // State has values from a previous apply/import
@@ -526,4 +526,3 @@ func TestMergeBuildConfigFromState_NilInputs(t *testing.T) {
526526 mergeBuildConfigFromState (nil , & PagesProjectBuildConfigModel {})
527527 mergeBuildConfigFromState (& PagesProjectBuildConfigModel {}, nil )
528528}
529-
0 commit comments