@@ -490,23 +490,27 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
490490 preexistingnetwork := installConfig .Config .GCP .Network != ""
491491
492492 // Search the project for a dns zone with the specified base domain.
493+ // When the user has selected a custom DNS solution, the zones should be skipped.
493494 publicZoneName := ""
494- if installConfig .Config .Publish == types .ExternalPublishingStrategy {
495- publicZone , err := client .GetDNSZone (ctx , installConfig .Config .GCP .ProjectID , installConfig .Config .BaseDomain , true )
496- if err != nil {
497- return errors .Wrapf (err , "failed to get GCP public zone" )
498- }
499- publicZoneName = publicZone .Name
500- }
501-
502495 privateZoneName := ""
503- if installConfig .Config .GCP .NetworkProjectID != "" {
504- privateZone , err := client .GetDNSZone (ctx , installConfig .Config .GCP .ProjectID , installConfig .Config .ClusterDomain (), false )
505- if err != nil {
506- return errors .Wrapf (err , "failed to get GCP private zone" )
496+
497+ if installConfig .Config .GCP .UserProvisionedDNS != gcp .UserProvisionedDNSEnabled {
498+ if installConfig .Config .Publish == types .ExternalPublishingStrategy {
499+ publicZone , err := client .GetDNSZone (ctx , installConfig .Config .GCP .ProjectID , installConfig .Config .BaseDomain , true )
500+ if err != nil {
501+ return errors .Wrapf (err , "failed to get GCP public zone" )
502+ }
503+ publicZoneName = publicZone .Name
507504 }
508- if privateZone != nil {
509- privateZoneName = privateZone .Name
505+
506+ if installConfig .Config .GCP .NetworkProjectID != "" {
507+ privateZone , err := client .GetDNSZone (ctx , installConfig .Config .GCP .ProjectID , installConfig .Config .ClusterDomain (), false )
508+ if err != nil {
509+ return errors .Wrapf (err , "failed to get GCP private zone" )
510+ }
511+ if privateZone != nil {
512+ privateZoneName = privateZone .Name
513+ }
510514 }
511515 }
512516
0 commit comments