Skip to content

Commit f24097b

Browse files
authored
fix: Fix managed zones issues (#654)
* remove redundant scope * ensure a trailing dot is added
1 parent 90f9462 commit f24097b

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

cmd/command/up/up.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"os"
7+
"strings"
78

89
"github.com/AlecAivazis/survey/v2"
910
"github.com/pluralsh/plural-cli/pkg/api"
@@ -223,12 +224,15 @@ func processAppDomain(domain string) error {
223224
// we also need to determine the managed DNS zone to use.
224225
// If there is one it will be automatically selected, if there are multiple,
225226
// the user will be prompted to select one.
226-
managedZones, err := provider.GetGcpManagedZones(project.Project, domain)
227+
228+
d := strings.TrimSuffix(domain, ".") + "." // GCP stores zone names with a trailing dot.
229+
230+
managedZones, err := provider.GetGcpManagedZones(project.Project, d)
227231
if err != nil {
228232
return err
229233
}
230234
if len(managedZones) == 0 {
231-
return fmt.Errorf("no managed DNS zones found for domain %s in project %s", domain, project.Project)
235+
return fmt.Errorf("no managed DNS zones found for domain %s in project %s", d, project.Project)
232236
}
233237

234238
var managedZone string

pkg/provider/gcp.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ func getGcpProjects() ([]string, error) {
134134
}
135135

136136
func GetGcpManagedZones(project, dnsName string) ([]string, error) {
137-
client, err := google.DefaultClient(context.Background(),
138-
gcompute.ComputeScope)
137+
client, err := google.DefaultClient(context.Background())
139138
if err != nil {
140139
return nil, err
141140
}

0 commit comments

Comments
 (0)