diff --git a/.ci/containers/build-environment/Dockerfile b/.ci/containers/build-environment/Dockerfile index 2f2dcb85ecf5..d2f11e881954 100644 --- a/.ci/containers/build-environment/Dockerfile +++ b/.ci/containers/build-environment/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Building Go dependencies -FROM golang:1.20-bullseye AS builder +FROM golang:1.21-bullseye AS builder # Set working directory WORKDIR /app @@ -15,7 +15,7 @@ RUN go mod download FROM ruby:3.1-bullseye # golang -COPY --from=golang:1.20-bullseye /usr/local/go /usr/local/go +COPY --from=golang:1.21-bullseye /usr/local/go /usr/local/go ENV GOPATH /go ENV PATH /usr/local/go/bin:$PATH ENV PATH $GOPATH/bin:$PATH diff --git a/.ci/containers/go-plus/Dockerfile b/.ci/containers/go-plus/Dockerfile index 655f976726bf..b37e5ee8b996 100644 --- a/.ci/containers/go-plus/Dockerfile +++ b/.ci/containers/go-plus/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Download go module cache for builds -FROM golang:1.20-bullseye AS builder +FROM golang:1.21-bullseye AS builder ENV GOCACHE=/go/cache RUN apt-get update && apt-get install -y unzip @@ -12,7 +12,7 @@ WORKDIR /app1/magic-modules-main/.ci/magician RUN go build -o /dev/null . # Stage 2: Creating the final image -FROM golang:1.20-bullseye +FROM golang:1.21-bullseye SHELL ["/bin/bash", "-c"] ENV GOCACHE=/go/cache diff --git a/.ci/magician/cmd/DIFF_COMMENT.md b/.ci/magician/cmd/DIFF_COMMENT.md new file mode 100644 index 000000000000..b2c44b960823 --- /dev/null +++ b/.ci/magician/cmd/DIFF_COMMENT.md @@ -0,0 +1,36 @@ +Hi there, I'm the Modular magician. I've detected the following information about your changes: + +## Diff report +{{ $diffsLength := len .Diffs }}{{if eq $diffsLength 0 }} +Your PR hasn't generated any diffs, but I'll let you know if a future commit does. +{{else}} +Your PR generated some diffs in downstreams - here they are. + +{{range .Diffs -}} +{{.Title}}: [Diff](https://github.com/modular-magician/{{.Repo}}/compare/auto-pr-{{$.PrNumber}}-old..auto-pr-{{$.PrNumber}}) ({{.DiffStats}}) +{{end -}} +{{end -}} + +{{- $breakingChangesLength := len .BreakingChanges }} +{{- if gt $breakingChangesLength 0}} +## Breaking Change(s) Detected + +The following breaking change(s) were detected within your pull request. + +{{- range .BreakingChanges}} +- {{.}}{{end}} + +If you believe this detection to be incorrect please raise the concern with your reviewer. +If you intend to make this change you will need to wait for a [major release](https://www.terraform.io/plugin/sdkv2/best-practices/versioning#example-major-number-increments) window. +An `override-breaking-change` label can be added to allow merging. +{{end}} +{{.MissingTests}} +{{- $errorsLength := len .Errors}} +{{- if gt $errorsLength 0}} +## Errors +{{range .Errors}} +{{.Title}}: +{{- range .Errors}} +- {{.}}{{end}} +{{end}} +{{- end -}} \ No newline at end of file diff --git a/.ci/magician/cmd/generate_comment.go b/.ci/magician/cmd/generate_comment.go index b78bbf35fd3c..d1d5cd2936b4 100644 --- a/.ci/magician/cmd/generate_comment.go +++ b/.ci/magician/cmd/generate_comment.go @@ -23,12 +23,41 @@ import ( "magician/source" "os" "path/filepath" - "regexp" + "sort" + "strconv" "strings" + "text/template" "github.com/spf13/cobra" + "golang.org/x/exp/maps" + + _ "embed" +) + +var ( + //go:embed DIFF_COMMENT.md + diffComment string ) +type Diff struct { + Title string + Repo string + DiffStats string +} + +type Errors struct { + Title string + Errors []string +} + +type diffCommentData struct { + PrNumber int + Diffs []Diff + BreakingChanges []string + MissingTests string + Errors []Errors +} + const allowBreakingChangesLabel = "override-breaking-change" var gcEnvironmentVariables = [...]string{ @@ -84,7 +113,22 @@ var generateCommentCmd = &cobra.Command{ os.Exit(1) } ctlr := source.NewController(filepath.Join("workspace", "go"), "modular-magician", env["GITHUB_TOKEN_DOWNSTREAMS"], rnr) - execGenerateComment(env, gh, rnr, ctlr) + prNumber, err := strconv.Atoi(env["PR_NUMBER"]) + if err != nil { + fmt.Println("Error parsing PR_NUMBER: ", err) + os.Exit(1) + } + execGenerateComment( + prNumber, + env["GITHUB_TOKEN_MAGIC_MODULES"], + env["BUILD_ID"], + env["BUILD_STEP"], + env["PROJECT_ID"], + env["COMMIT_SHA"], + gh, + rnr, + ctlr, + ) }, } @@ -96,196 +140,219 @@ func listGCEnvironmentVariables() string { return result } -func execGenerateComment(env map[string]string, gh GithubClient, rnr ExecRunner, ctlr *source.Controller) { - newBranch := "auto-pr-" + env["PR_NUMBER"] - oldBranch := "auto-pr-" + env["PR_NUMBER"] + "-old" +func execGenerateComment(prNumber int, ghTokenMagicModules, buildId, buildStep, projectId, commitSha string, gh GithubClient, rnr ExecRunner, ctlr *source.Controller) { + newBranch := fmt.Sprintf("auto-pr-%d", prNumber) + oldBranch := fmt.Sprintf("auto-pr-%d-old", prNumber) wd := rnr.GetCWD() mmLocalPath := filepath.Join(wd, "..", "..") - tpgRepoName := "terraform-provider-google" - tpgLocalPath := filepath.Join(mmLocalPath, "..", "tpg") - tpgbRepoName := "terraform-provider-google-beta" - tpgbLocalPath := filepath.Join(mmLocalPath, "..", "tpgb") - tfoicsRepoName := "docs-examples" - tfoicsLocalPath := filepath.Join(mmLocalPath, "..", "tfoics") - // For backwards compatibility until at least Nov 15 2021 - tfcRepoName := "terraform-google-conversion" - tfcLocalPath := filepath.Join(mmLocalPath, "..", "tfc") - - var diffs string - for _, repo := range []*source.Repo{ - { - Name: tpgRepoName, - Title: "Terraform GA", - Path: tpgLocalPath, - }, - { - Name: tpgbRepoName, - Title: "Terraform Beta", - Path: tpgbLocalPath, - }, - { - Name: tfcRepoName, - Title: "TF Conversion", - Path: tfcLocalPath, - DiffCanFail: true, - }, - { - Name: tfoicsRepoName, - Title: "TF OiCS", - Path: tfoicsLocalPath, - }, - } { - // TPG/TPGB difference - repoDiffs, err := cloneAndDiff(repo, oldBranch, newBranch, ctlr) + + tpgRepo := source.Repo{ + Name: "terraform-provider-google", + Title: "`google` provider", + Path: filepath.Join(mmLocalPath, "..", "tpg"), + Version: provider.GA, + } + tpgbRepo := source.Repo{ + Name: "terraform-provider-google-beta", + Title: "`google-beta` provider", + Path: filepath.Join(mmLocalPath, "..", "tpgb"), + Version: provider.Beta, + } + tgcRepo := source.Repo{ + Name: "terraform-google-conversion", + Title: "`terraform-google-conversion`", + Path: filepath.Join(mmLocalPath, "..", "tgc"), + Version: provider.Beta, + } + tfoicsRepo := source.Repo{ + Name: "docs-examples", + Title: "Open in Cloud Shell", + Path: filepath.Join(mmLocalPath, "..", "tfoics"), + } + + // Initialize repos + data := diffCommentData{ + PrNumber: prNumber, + } + errors := map[string][]string{"Other": []string{}} + var err error + for _, repo := range []*source.Repo{&tpgRepo, &tpgbRepo, &tgcRepo, &tfoicsRepo} { + errors[repo.Title] = []string{} + repo.Branch = newBranch + if err := ctlr.Clone(repo); err != nil { + fmt.Println("Failed to clone repo: ", err) + errors[repo.Title] = append(errors[repo.Title], "Failed to clone repo") + } else { + repo.Cloned = true + } + } + + diffs := []Diff{} + for _, repo := range []source.Repo{tpgRepo, tpgbRepo, tgcRepo, tfoicsRepo} { + if !repo.Cloned { + fmt.Println("Skipping diff; repo failed to clone: ", repo.Name) + continue + } + diffStats, err := computeDiff(&repo, oldBranch, ctlr) if err != nil { - fmt.Printf("Error cloning and diffing tpg repo: %v\n", err) - if !repo.DiffCanFail { - os.Exit(1) - } + fmt.Println("diffing repo: ", err) + errors[repo.Title] = append(errors[repo.Title], "Failed to compute repo diff stats") } - if repoDiffs != "" { - diffs += "\n" + repoDiffs + if diffStats != "" { + diffs = append(diffs, Diff{ + Title: repo.Title, + Repo: repo.Name, + DiffStats: diffStats, + }) } } + data.Diffs = diffs - var showBreakingChangesFailed bool - var err error + // The breaking changes are unique across both provider versions + uniqueBreakingChanges := map[string]struct{}{} diffProcessorPath := filepath.Join(mmLocalPath, "tools", "diff-processor") - // versionedBreakingChanges is a map of breaking change output by provider version. - versionedBreakingChanges := make(map[provider.Version]string, 2) - - env["OLD_REF"] = oldBranch - env["NEW_REF"] = newBranch - for _, repo := range []*source.Repo{ - { - Title: "TPG", - Path: tpgLocalPath, - Version: provider.GA, - }, - { - Title: "TPGB", - Path: tpgbLocalPath, - Version: provider.Beta, - }, - } { - // TPG(B) diff processor - err = buildDiffProcessor(diffProcessorPath, repo.Path, env, rnr) + diffProcessorEnv := map[string]string{ + "OLD_REF": oldBranch, + "NEW_REF": newBranch, + // Passthrough vars required for a valid build environment. + "PATH": os.Getenv("PATH"), + "GOPATH": os.Getenv("GOPATH"), + "HOME": os.Getenv("HOME"), + } + for _, repo := range []source.Repo{tpgRepo, tpgbRepo} { + if !repo.Cloned { + fmt.Println("Skipping breaking changes; repo failed to clone: ", repo.Name) + continue + } + err = buildDiffProcessor(diffProcessorPath, repo.Path, diffProcessorEnv, rnr) if err != nil { - fmt.Println(err) - os.Exit(1) + fmt.Println("building diff processor: ", err) + errors[repo.Title] = append(errors[repo.Title], "The diff processor failed to build. This is usually due to the downstream provider failing to compile.") + continue } - output, err := computeBreakingChanges(diffProcessorPath, rnr) + + breakingChanges, err := computeBreakingChanges(diffProcessorPath, rnr) if err != nil { - fmt.Println("Error computing TPG breaking changes: ", err) - showBreakingChangesFailed = true + fmt.Println("computing breaking changes: ", err) + errors[repo.Title] = append(errors[repo.Title], "The diff processor crashed while computing breaking changes. This is usually due to the downstream provider failing to compile.") + } + for _, breakingChange := range breakingChanges { + uniqueBreakingChanges[breakingChange] = struct{}{} } - versionedBreakingChanges[repo.Version] = strings.TrimSuffix(output, "\n") - err = addLabels(diffProcessorPath, env, rnr) + + addLabelsEnv := map[string]string{ + "GITHUB_TOKEN_MAGIC_MODULES": ghTokenMagicModules, + } + err = addLabels(prNumber, diffProcessorPath, addLabelsEnv, rnr) if err != nil { - fmt.Println("Error adding TPG labels to PR: ", err) + fmt.Println("adding service labels: ", err) + errors[repo.Title] = append(errors[repo.Title], "The diff processor crashed while adding labels.") } err = cleanDiffProcessor(diffProcessorPath, rnr) if err != nil { - fmt.Println("Error cleaning up diff processor: ", err) - os.Exit(1) + fmt.Println("cleaning up diff processor: ", err) + errors[repo.Title] = append(errors[repo.Title], "The diff processor failed to clean up properly.") } } + breakingChangesSlice := maps.Keys(uniqueBreakingChanges) + sort.Strings(breakingChangesSlice) + data.BreakingChanges = breakingChangesSlice - var breakingChanges string - if showBreakingChangesFailed { - breakingChanges = `## Breaking Change Detection Failed -The breaking change detector crashed during execution. This is usually due to the downstream provider(s) failing to compile. Please investigate or follow up with your reviewer.` - } else { - breakingChanges = combineBreakingChanges(versionedBreakingChanges[provider.GA], versionedBreakingChanges[provider.Beta]) - } - - // Missing test detector - missingTests, err := detectMissingTests(mmLocalPath, tpgbLocalPath, oldBranch, rnr) - if err != nil { - fmt.Println("Error setting up missing test detector: ", err) - os.Exit(1) - } - - message := "Hi there, I'm the Modular magician. I've detected the following information about your changes:\n\n" + // Update breaking changes status on PR breakingState := "success" - if breakingChanges != "" { - message += breakingChanges + "\n\n" + if len(uniqueBreakingChanges) > 0 { + breakingState = "failure" - pullRequest, err := gh.GetPullRequest(env["PR_NUMBER"]) + pullRequest, err := gh.GetPullRequest(strconv.Itoa(prNumber)) if err != nil { fmt.Printf("Error getting pull request: %v\n", err) - os.Exit(1) - } - - breakingChangesAllowed := false - for _, label := range pullRequest.Labels { - if label.Name == allowBreakingChangesLabel { - breakingChangesAllowed = true - break + errors["Other"] = append(errors["Other"], "Failed to check for `override-breaking-change` label") + } else { + for _, label := range pullRequest.Labels { + if label.Name == allowBreakingChangesLabel { + breakingState = "success" + break + } } } - if !breakingChangesAllowed { - breakingState = "failure" - } } - - if diffs == "" { - message += "## Diff report\nYour PR hasn't generated any diffs, but I'll let you know if a future commit does." - } else { - message += "## Diff report\nYour PR generated some diffs in downstreams - here they are.\n" + diffs + "\n" - if missingTests != "" { - message += "\n" + missingTests + "\n" - } + targetURL := fmt.Sprintf("https://console.cloud.google.com/cloud-build/builds;region=global/%s;step=%s?project=%s", buildId, buildStep, projectId) + if err = gh.PostBuildStatus(strconv.Itoa(prNumber), "terraform-provider-breaking-change-test", breakingState, targetURL, commitSha); err != nil { + fmt.Printf("Error posting build status for pr %d commit %s: %v\n", prNumber, commitSha, err) + errors["Other"] = append(errors["Other"], "Failed to update breaking-change status check with state: "+breakingState) } - if err := gh.PostComment(env["PR_NUMBER"], message); err != nil { - fmt.Printf("Error posting comment to PR %s: %v\n", env["PR_NUMBER"], err) + // Run missing test detector (currently only for beta) + missingTestsPath := mmLocalPath + for _, repo := range []source.Repo{tpgbRepo} { + if !repo.Cloned { + fmt.Println("Skipping missing tests; repo failed to clone: ", repo.Name) + continue + } + missingTests, err := detectMissingTests(missingTestsPath, repo.Path, oldBranch, rnr) + if err != nil { + fmt.Println("Error running missing test detector: ", err) + errors[repo.Title] = append(errors[repo.Title], "The missing test detector failed to run.") + } + data.MissingTests = missingTests + } + + // Run unit tests for missing test detector + if err = runMissingTestUnitTests( + mmLocalPath, + tpgbRepo.Path, + targetURL, + commitSha, + prNumber, + gh, + rnr, + ); err != nil { + fmt.Println("Error running missing test detector unit tests: ", err) + errors["Other"] = append(errors["Other"], "Missing test detector unit tests failed to run.") + } + + // Add errors to data as an ordered list + errorsList := []Errors{} + for _, repo := range []source.Repo{tpgRepo, tpgbRepo, tgcRepo, tfoicsRepo} { + if len(errors[repo.Title]) > 0 { + errorsList = append(errorsList, Errors{ + Title: repo.Title, + Errors: errors[repo.Title], + }) + } } - - targetURL := fmt.Sprintf("https://console.cloud.google.com/cloud-build/builds;region=global/%s;step=%s?project=%s", env["BUILD_ID"], env["BUILD_STEP"], env["PROJECT_ID"]) - if err := gh.PostBuildStatus(env["PR_NUMBER"], "terraform-provider-breaking-change-test", breakingState, targetURL, env["COMMIT_SHA"]); err != nil { - fmt.Printf("Error posting build status for pr %s commit %s: %v\n", env["PR_NUMBER"], env["COMMIT_SHA"], err) - os.Exit(1) + if len(errors["Other"]) > 0 { + errorsList = append(errorsList, Errors{ + Title: "Other", + Errors: errors["Other"], + }) } + data.Errors = errorsList - if err := rnr.PushDir(mmLocalPath); err != nil { - fmt.Println(err) + // Post diff comment + message, err := formatDiffComment(data) + if err != nil { + fmt.Println("Error formatting message: ", err) + fmt.Printf("Data: %v\n", data) os.Exit(1) } - if diffs := rnr.MustRun("git", []string{"diff", "HEAD", "origin/main", "tools/missing-test-detector"}, nil); diffs != "" { - fmt.Printf("Found diffs in missing test detector:\n%s\nRunning tests.\n", diffs) - if err := testTools(mmLocalPath, tpgbLocalPath, env, gh, rnr); err != nil { - fmt.Printf("Error testing tools in %s: %v\n", mmLocalPath, err) - os.Exit(1) - } - } - if err := rnr.PopDir(); err != nil { - fmt.Println(err) + if err := gh.PostComment(strconv.Itoa(prNumber), message); err != nil { + fmt.Printf("Error posting comment to PR %d: %v\n", prNumber, err) + fmt.Println("Comment: ", message) os.Exit(1) } } -func cloneAndDiff(repo *source.Repo, oldBranch, newBranch string, ctlr *source.Controller) (string, error) { - // Clone the repo to the desired repo.Path. - repo.Branch = newBranch - if err := ctlr.Clone(repo); err != nil { - return "", fmt.Errorf("error cloning %s: %v\n", repo.Name, err) - } - +func computeDiff(repo *source.Repo, oldBranch string, ctlr *source.Controller) (string, error) { if err := ctlr.Fetch(repo, oldBranch); err != nil { return "", err } - - // Return summary, if any. - diffs, err := ctlr.Diff(repo, oldBranch, newBranch) + // Get shortstat summary of the diff + diff, err := ctlr.Diff(repo, oldBranch, repo.Branch) if err != nil { return "", err } - if diffs == "" { - return "", nil - } - diffs = strings.TrimSuffix(diffs, "\n") - return fmt.Sprintf("%s: [Diff](https://github.com/modular-magician/%s/compare/%s..%s) (%s)", repo.Title, repo.Name, oldBranch, newBranch, diffs), nil + return strings.TrimSuffix(diff, "\n"), nil } // Build the diff processor for tpg or tpgb @@ -304,22 +371,27 @@ func buildDiffProcessor(diffProcessorPath, providerLocalPath string, env map[str return rnr.PopDir() } -func computeBreakingChanges(diffProcessorPath string, rnr ExecRunner) (string, error) { +func computeBreakingChanges(diffProcessorPath string, rnr ExecRunner) ([]string, error) { if err := rnr.PushDir(diffProcessorPath); err != nil { - return "", err + return nil, err } - breakingChanges, err := rnr.Run("bin/diff-processor", []string{"breaking-changes"}, nil) + output, err := rnr.Run("bin/diff-processor", []string{"breaking-changes"}, nil) if err != nil { - return "", err + return nil, err + } + + if output == "" { + return nil, nil } - return breakingChanges, rnr.PopDir() + + return strings.Split(strings.TrimSuffix(output, "\n"), "\n"), rnr.PopDir() } -func addLabels(diffProcessorPath string, env map[string]string, rnr ExecRunner) error { +func addLabels(prNumber int, diffProcessorPath string, env map[string]string, rnr ExecRunner) error { if err := rnr.PushDir(diffProcessorPath); err != nil { return err } - output, err := rnr.Run("bin/diff-processor", []string{"add-labels", env["PR_NUMBER"]}, env) + output, err := rnr.Run("bin/diff-processor", []string{"add-labels", strconv.Itoa(prNumber)}, env) fmt.Println(output) if err != nil { return err @@ -336,48 +408,6 @@ func cleanDiffProcessor(diffProcessorPath string, rnr ExecRunner) error { return nil } -// Get the breaking change message including the unique tpg messages and all tpgb messages. -func combineBreakingChanges(tpgBreaking, tpgbBreaking string) string { - var allMessages []string - if tpgBreaking == "" { - if tpgbBreaking == "" { - return "" - } - allMessages = strings.Split(tpgbBreaking, "\n") - } else if tpgbBreaking == "" { - allMessages = strings.Split(tpgBreaking, "\n") - } else { - dashExp := regexp.MustCompile("-.*") - tpgMessages := strings.Split(tpgBreaking, "\n") - tpgbMessages := strings.Split(tpgbBreaking, "\n") - tpgbSet := make(map[string]struct{}, len(tpgbMessages)) - var tpgUnique []string - for _, message := range tpgbMessages { - simple := dashExp.ReplaceAllString(message, "") - tpgbSet[simple] = struct{}{} - } - for _, message := range tpgMessages { - simple := dashExp.ReplaceAllString(message, "") - if _, ok := tpgbSet[simple]; !ok { - tpgUnique = append(tpgUnique, message) - } - } - allMessages = append(tpgUnique, tpgbMessages...) - } - if len(allMessages) > 0 { - return `## Breaking Change(s) Detected -The following breaking change(s) were detected within your pull request. - -* ` + strings.Join(allMessages, "\n* ") + ` - -If you believe this detection to be incorrect please raise the concern with your reviewer. -If you intend to make this change you will need to wait for a [major release](https://www.terraform.io/plugin/sdkv2/best-practices/versioning#example-major-number-increments) window. -An ` + "`override-breaking-change`" + ` label can be added to allow merging. -` - } - return "" -} - // Run the missing test detector and return the results. // Returns an empty string unless there are missing tests. // Error will be nil unless an error occurs during setup. @@ -449,9 +479,24 @@ func updatePackageName(name, path string, rnr ExecRunner) error { return rnr.PopDir() } -// Run unit tests for the missing test detector and diff processor. +// Run unit tests for the missing test detector. // Report results using Github API. -func testTools(mmLocalPath, tpgbLocalPath string, env map[string]string, gh GithubClient, rnr ExecRunner) error { +func runMissingTestUnitTests(mmLocalPath, tpgbLocalPath, targetURL, commitSha string, prNumber int, gh GithubClient, rnr ExecRunner) error { + if err := rnr.PushDir(mmLocalPath); err != nil { + return err + } + + diffs, err := rnr.Run("git", []string{"diff", "HEAD", "origin/main", "tools/missing-test-detector"}, nil) + if err != nil { + return err + } + if diffs == "" { + // Short-circuit if there are no changes to the missing test detector + return rnr.PopDir() + } + + fmt.Printf("Found diffs in missing test detector:\n%s\nRunning tests.\n", diffs) + missingTestDetectorPath := filepath.Join(mmLocalPath, "tools", "missing-test-detector") rnr.PushDir(missingTestDetectorPath) if _, err := rnr.Run("go", []string{"mod", "tidy"}, nil); err != nil { @@ -460,20 +505,33 @@ func testTools(mmLocalPath, tpgbLocalPath string, env map[string]string, gh Gith servicesDir := filepath.Join(tpgbLocalPath, "google-beta", "services") state := "success" if _, err := rnr.Run("go", []string{"test"}, map[string]string{ - "GOPATH": env["GOPATH"], - "HOME": env["HOME"], "SERVICES_DIR": servicesDir, + // Passthrough vars required for a valid build environment. + "GOPATH": os.Getenv("GOPATH"), + "HOME": os.Getenv("HOME"), }); err != nil { fmt.Printf("error from running go test in %s: %v\n", missingTestDetectorPath, err) state = "failure" } - targetURL := fmt.Sprintf("https://console.cloud.google.com/cloud-build/builds;region=global/%s;step=%s?project=%s", env["BUILD_ID"], env["BUILD_STEP"], env["PROJECT_ID"]) - if err := gh.PostBuildStatus(env["PR_NUMBER"], "unit-tests-missing-test-detector", state, targetURL, env["COMMIT_SHA"]); err != nil { + if err := gh.PostBuildStatus(strconv.Itoa(prNumber), "unit-tests-missing-test-detector", state, targetURL, commitSha); err != nil { return err } return rnr.PopDir() } +func formatDiffComment(data diffCommentData) (string, error) { + tmpl, err := template.New("DIFF_COMMENT.md").Parse(diffComment) + if err != nil { + panic(fmt.Sprintf("Unable to parse DIFF_COMMENT.md: %s", err)) + } + sb := new(strings.Builder) + err = tmpl.Execute(sb, data) + if err != nil { + return "", err + } + return sb.String(), nil +} + func init() { rootCmd.AddCommand(generateCommentCmd) } diff --git a/.ci/magician/cmd/generate_comment_test.go b/.ci/magician/cmd/generate_comment_test.go index c8a1c14ed487..456267619bb8 100644 --- a/.ci/magician/cmd/generate_comment_test.go +++ b/.ci/magician/cmd/generate_comment_test.go @@ -16,9 +16,12 @@ package cmd import ( - "magician/source" + "os" "reflect" "testing" + + "github.com/stretchr/testify/assert" + "magician/source" ) func TestExecGenerateComment(t *testing.T) { @@ -27,25 +30,27 @@ func TestExecGenerateComment(t *testing.T) { calledMethods: make(map[string][][]any), } ctlr := source.NewController("/mock/dir/go", "modular-magician", "*******", mr) - env := map[string]string{ - "BUILD_ID": "build1", - "BUILD_STEP": "17", - "COMMIT_SHA": "sha1", - "GITHUB_TOKEN_MAGIC_MODULES": "*******", - "PR_NUMBER": "pr1", - "PROJECT_ID": "project1", - } diffProcessorEnv := map[string]string{ - "BUILD_ID": "build1", - "BUILD_STEP": "17", - "COMMIT_SHA": "sha1", + "NEW_REF": "auto-pr-123456", + "OLD_REF": "auto-pr-123456-old", + "PATH": os.Getenv("PATH"), + "GOPATH": os.Getenv("GOPATH"), + "HOME": os.Getenv("HOME"), + } + addLabelsEnv := map[string]string{ "GITHUB_TOKEN_MAGIC_MODULES": "*******", - "NEW_REF": "auto-pr-pr1", - "OLD_REF": "auto-pr-pr1-old", - "PR_NUMBER": "pr1", - "PROJECT_ID": "project1", } - execGenerateComment(env, gh, mr, ctlr) + execGenerateComment( + 123456, + "*******", + "build1", + "17", + "project1", + "sha1", + gh, + mr, + ctlr, + ) for method, expectedCalls := range map[string][]ParameterList{ "Copy": { @@ -64,25 +69,25 @@ func TestExecGenerateComment(t *testing.T) { {"/mock/dir/magic-modules/tools/diff-processor/bin"}, }, "Run": { - {"/mock/dir/magic-modules/.ci/magician", "git", []string{"clone", "-b", "auto-pr-pr1", "https://modular-magician:*******@github.com/modular-magician/terraform-provider-google", "/mock/dir/tpg"}, map[string]string(nil)}, - {"/mock/dir/tpg", "git", []string{"fetch", "origin", "auto-pr-pr1-old"}, map[string]string(nil)}, - {"/mock/dir/tpg", "git", []string{"diff", "origin/auto-pr-pr1-old", "origin/auto-pr-pr1", "--shortstat"}, map[string]string(nil)}, - {"/mock/dir/magic-modules/.ci/magician", "git", []string{"clone", "-b", "auto-pr-pr1", "https://modular-magician:*******@github.com/modular-magician/terraform-provider-google-beta", "/mock/dir/tpgb"}, map[string]string(nil)}, - {"/mock/dir/tpgb", "git", []string{"fetch", "origin", "auto-pr-pr1-old"}, map[string]string(nil)}, - {"/mock/dir/tpgb", "git", []string{"diff", "origin/auto-pr-pr1-old", "origin/auto-pr-pr1", "--shortstat"}, map[string]string(nil)}, - {"/mock/dir/magic-modules/.ci/magician", "git", []string{"clone", "-b", "auto-pr-pr1", "https://modular-magician:*******@github.com/modular-magician/terraform-google-conversion", "/mock/dir/tfc"}, map[string]string(nil)}, - {"/mock/dir/tfc", "git", []string{"fetch", "origin", "auto-pr-pr1-old"}, map[string]string(nil)}, - {"/mock/dir/tfc", "git", []string{"diff", "origin/auto-pr-pr1-old", "origin/auto-pr-pr1", "--shortstat"}, map[string]string(nil)}, - {"/mock/dir/magic-modules/.ci/magician", "git", []string{"clone", "-b", "auto-pr-pr1", "https://modular-magician:*******@github.com/modular-magician/docs-examples", "/mock/dir/tfoics"}, map[string]string(nil)}, - {"/mock/dir/tfoics", "git", []string{"fetch", "origin", "auto-pr-pr1-old"}, map[string]string(nil)}, - {"/mock/dir/tfoics", "git", []string{"diff", "origin/auto-pr-pr1-old", "origin/auto-pr-pr1", "--shortstat"}, map[string]string(nil)}, + {"/mock/dir/magic-modules/.ci/magician", "git", []string{"clone", "-b", "auto-pr-123456", "https://modular-magician:*******@github.com/modular-magician/terraform-provider-google", "/mock/dir/tpg"}, map[string]string(nil)}, + {"/mock/dir/magic-modules/.ci/magician", "git", []string{"clone", "-b", "auto-pr-123456", "https://modular-magician:*******@github.com/modular-magician/terraform-provider-google-beta", "/mock/dir/tpgb"}, map[string]string(nil)}, + {"/mock/dir/magic-modules/.ci/magician", "git", []string{"clone", "-b", "auto-pr-123456", "https://modular-magician:*******@github.com/modular-magician/terraform-google-conversion", "/mock/dir/tgc"}, map[string]string(nil)}, + {"/mock/dir/magic-modules/.ci/magician", "git", []string{"clone", "-b", "auto-pr-123456", "https://modular-magician:*******@github.com/modular-magician/docs-examples", "/mock/dir/tfoics"}, map[string]string(nil)}, + {"/mock/dir/tpg", "git", []string{"fetch", "origin", "auto-pr-123456-old"}, map[string]string(nil)}, + {"/mock/dir/tpg", "git", []string{"diff", "origin/auto-pr-123456-old", "origin/auto-pr-123456", "--shortstat"}, map[string]string(nil)}, + {"/mock/dir/tpgb", "git", []string{"fetch", "origin", "auto-pr-123456-old"}, map[string]string(nil)}, + {"/mock/dir/tpgb", "git", []string{"diff", "origin/auto-pr-123456-old", "origin/auto-pr-123456", "--shortstat"}, map[string]string(nil)}, + {"/mock/dir/tgc", "git", []string{"fetch", "origin", "auto-pr-123456-old"}, map[string]string(nil)}, + {"/mock/dir/tgc", "git", []string{"diff", "origin/auto-pr-123456-old", "origin/auto-pr-123456", "--shortstat"}, map[string]string(nil)}, + {"/mock/dir/tfoics", "git", []string{"fetch", "origin", "auto-pr-123456-old"}, map[string]string(nil)}, + {"/mock/dir/tfoics", "git", []string{"diff", "origin/auto-pr-123456-old", "origin/auto-pr-123456", "--shortstat"}, map[string]string(nil)}, {"/mock/dir/magic-modules/tools/diff-processor", "make", []string{"build"}, diffProcessorEnv}, {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"breaking-changes"}, map[string]string(nil)}, - {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"add-labels", "pr1"}, diffProcessorEnv}, + {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"add-labels", "123456"}, addLabelsEnv}, {"/mock/dir/magic-modules/tools/diff-processor", "make", []string{"build"}, diffProcessorEnv}, {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"breaking-changes"}, map[string]string(nil)}, - {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"add-labels", "pr1"}, diffProcessorEnv}, - {"/mock/dir/tpgbold", "git", []string{"checkout", "origin/auto-pr-pr1-old"}, map[string]string(nil)}, + {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"add-labels", "123456"}, addLabelsEnv}, + {"/mock/dir/tpgbold", "git", []string{"checkout", "origin/auto-pr-123456-old"}, map[string]string(nil)}, {"/mock/dir/tpgbold", "find", []string{".", "-type", "f", "-name", "*.go", "-exec", "sed", "-i.bak", "s~github.com/hashicorp/terraform-provider-google-beta~google/provider/old~g", "{}", "+"}, map[string]string(nil)}, {"/mock/dir/tpgbold", "sed", []string{"-i.bak", "s|github.com/hashicorp/terraform-provider-google-beta|google/provider/old|g", "go.mod"}, map[string]string(nil)}, {"/mock/dir/tpgbold", "sed", []string{"-i.bak", "s|github.com/hashicorp/terraform-provider-google-beta|google/provider/old|g", "go.sum"}, map[string]string(nil)}, @@ -110,8 +115,8 @@ func TestExecGenerateComment(t *testing.T) { } for method, expectedCalls := range map[string][][]any{ - "PostBuildStatus": {{"pr1", "terraform-provider-breaking-change-test", "success", "https://console.cloud.google.com/cloud-build/builds;region=global/build1;step=17?project=project1", "sha1"}}, - "PostComment": {{"pr1", "Hi there, I'm the Modular magician. I've detected the following information about your changes:\n\n## Diff report\nYour PR generated some diffs in downstreams - here they are.\n\nTerraform GA: [Diff](https://github.com/modular-magician/terraform-provider-google/compare/auto-pr-pr1-old..auto-pr-pr1) ( 2 files changed, 40 insertions(+))\nTerraform Beta: [Diff](https://github.com/modular-magician/terraform-provider-google-beta/compare/auto-pr-pr1-old..auto-pr-pr1) ( 2 files changed, 40 insertions(+))\nTF Conversion: [Diff](https://github.com/modular-magician/terraform-google-conversion/compare/auto-pr-pr1-old..auto-pr-pr1) ( 1 file changed, 10 insertions(+))\n\n## Missing test report\nYour PR includes resource fields which are not covered by any test.\n\nResource: `google_folder_access_approval_settings` (3 total tests)\nPlease add an acceptance test which includes these fields. The test should include the following:\n\n```hcl\nresource \"google_folder_access_approval_settings\" \"primary\" {\n uncovered_field = # value needed\n}\n\n```\n\n"}}, + "PostBuildStatus": {{"123456", "terraform-provider-breaking-change-test", "success", "https://console.cloud.google.com/cloud-build/builds;region=global/build1;step=17?project=project1", "sha1"}}, + "PostComment": {{"123456", "Hi there, I'm the Modular magician. I've detected the following information about your changes:\n\n## Diff report\n\nYour PR generated some diffs in downstreams - here they are.\n\n`google` provider: [Diff](https://github.com/modular-magician/terraform-provider-google/compare/auto-pr-123456-old..auto-pr-123456) ( 2 files changed, 40 insertions(+))\n`google-beta` provider: [Diff](https://github.com/modular-magician/terraform-provider-google-beta/compare/auto-pr-123456-old..auto-pr-123456) ( 2 files changed, 40 insertions(+))\n`terraform-google-conversion`: [Diff](https://github.com/modular-magician/terraform-google-conversion/compare/auto-pr-123456-old..auto-pr-123456) ( 1 file changed, 10 insertions(+))\n\n## Missing test report\nYour PR includes resource fields which are not covered by any test.\n\nResource: `google_folder_access_approval_settings` (3 total tests)\nPlease add an acceptance test which includes these fields. The test should include the following:\n\n```hcl\nresource \"google_folder_access_approval_settings\" \"primary\" {\n uncovered_field = # value needed\n}\n\n```\n"}}, } { if actualCalls, ok := gh.calledMethods[method]; !ok { t.Fatalf("Found no calls for %s", method) @@ -126,3 +131,122 @@ func TestExecGenerateComment(t *testing.T) { } } } + +func TestFormatDiffComment(t *testing.T) { + cases := map[string]struct { + data diffCommentData + expectedStrings []string + notExpectedStrings []string + }{ + "basic message": { + data: diffCommentData{}, + expectedStrings: []string{"## Diff report", "hasn't generated any diffs"}, + notExpectedStrings: []string{ + "generated some diffs", + "## Breaking Change(s) Detected", + "## Errors", + "## Missing test report", + }, + }, + "errors are displayed": { + data: diffCommentData{ + Errors: []Errors{ + { + Title: "`google` provider", + Errors: []string{"Provider 1"}, + }, + { + Title: "Other", + Errors: []string{"Error 1", "Error 2"}, + }, + }, + }, + expectedStrings: []string{"## Diff report", "## Errors", "`google` provider:\n- Provider 1\n\nOther:\n- Error 1\n- Error 2\n"}, + notExpectedStrings: []string{ + "generated some diffs", + "## Breaking Change(s) Detected", + "## Missing test report", + }, + }, + "diffs are displayed": { + data: diffCommentData{ + PrNumber: 1234567890, + Diffs: []Diff{ + { + Title: "Repo 1", + Repo: "repo-1", + DiffStats: "+1 added, -1 removed", + }, + { + Title: "Repo 2", + Repo: "repo-2", + DiffStats: "+2 added, -2 removed", + }, + }, + }, + expectedStrings: []string{ + "## Diff report", + "generated some diffs", + "Repo 1: [Diff](https://github.com/modular-magician/repo-1/compare/auto-pr-1234567890-old..auto-pr-1234567890) (+1 added, -1 removed)\nRepo 2: [Diff](https://github.com/modular-magician/repo-2/compare/auto-pr-1234567890-old..auto-pr-1234567890) (+2 added, -2 removed)", + }, + notExpectedStrings: []string{ + "hasn't generated any diffs", + "## Breaking Change(s) Detected", + "## Errors", + "## Missing test report", + }, + }, + "breaking changes are displayed": { + data: diffCommentData{ + BreakingChanges: []string{ + "Breaking change 1", + "Breaking change 2", + }, + }, + expectedStrings: []string{ + "## Diff report", + "## Breaking Change(s) Detected", + "major release", + "`override-breaking-change`", + "- Breaking change 1\n- Breaking change 2\n", + }, + notExpectedStrings: []string{ + "generated some diffs", + "## Errors", + "## Missing test report", + }, + }, + "missing tests are displayed": { + data: diffCommentData{ + MissingTests: "## Missing test report", + }, + expectedStrings: []string{ + "## Diff report", + "## Missing test report", + }, + notExpectedStrings: []string{ + "generated some diffs", + "## Breaking Change(s) Detected", + "## Errors", + }, + }, + } + + for tn, tc := range cases { + tc := tc + t.Run(tn, func(t *testing.T) { + t.Parallel() + + comment, err := formatDiffComment(tc.data) + assert.Nil(t, err) + + for _, s := range tc.expectedStrings { + assert.Contains(t, comment, s) + } + + for _, s := range tc.notExpectedStrings { + assert.NotContains(t, comment, s) + } + }) + } +} diff --git a/.ci/magician/cmd/mock_runner_test.go b/.ci/magician/cmd/mock_runner_test.go index 5789d9878a3f..bc470b13d685 100644 --- a/.ci/magician/cmd/mock_runner_test.go +++ b/.ci/magician/cmd/mock_runner_test.go @@ -41,32 +41,33 @@ func NewMockRunner() MockRunner { return &mockRunner{ calledMethods: make(map[string][]ParameterList), cmdResults: map[string]string{ - "/mock/dir/tfc git [clone -b auto-pr-pr1 https://modular-magician:*******@github.com/modular-magician/docs-examples /mock/dir/tfoics] map[]": "", - "/mock/dir/tpgb git [clone -b auto-pr-pr1 https://modular-magician:*******@github.com/modular-magician/terraform-google-conversion /mock/dir/tfc] map[]": "", - " git [clone -b auto-pr-pr1 https://modular-magician:*******@github.com/modular-magician/terraform-provider-google /mock/dir/tpg] map[]": "", - "/mock/dir/tpg git [clone -b auto-pr-pr1 https://modular-magician:*******@github.com/modular-magician/terraform-provider-google-beta /mock/dir/tpgb] map[]": "", - "/mock/dir/magic-modules git [diff HEAD origin/main tools/missing-test-detector] map[]": "", - "/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [breaking-changes] map[]": "", - "/mock/dir/magic-modules/tools/diff-processor make [build] map[OLD_REF:auto-pr-pr1-old NEW_REF:auto-pr-pr1]": "", - "/mock/dir/magic-modules/tools/missing-test-detector go [mod edit -replace google/provider/new=/mock/dir/tpgb] map[]": "", - "/mock/dir/magic-modules/tools/missing-test-detector go [mod edit -replace google/provider/old=/mock/dir/tpgbold] map[]": "", - "/mock/dir/magic-modules/tools/missing-test-detector go [mod tidy] map[]": "", - "/mock/dir/magic-modules/tools/missing-test-detector go [run . -services-dir=/mock/dir/tpgb/google-beta/services] map[]": "## Missing test report\nYour PR includes resource fields which are not covered by any test.\n\nResource: `google_folder_access_approval_settings` (3 total tests)\nPlease add an acceptance test which includes these fields. The test should include the following:\n\n```hcl\nresource \"google_folder_access_approval_settings\" \"primary\" {\n uncovered_field = # value needed\n}\n\n```\n", - "/mock/dir/tfc git [diff origin/auto-pr-pr1-old origin/auto-pr-pr1 --shortstat] map[]": " 1 file changed, 10 insertions(+)\n", - "/mock/dir/tfc git [fetch origin auto-pr-pr1-old] map[]": "", - "/mock/dir/tfoics git [diff origin/auto-pr-pr1-old origin/auto-pr-pr1 --shortstat] map[]": "", - "/mock/dir/tfoics git [fetch origin auto-pr-pr1-old] map[]": "", - "/mock/dir/tpg git [diff origin/auto-pr-pr1-old origin/auto-pr-pr1 --shortstat] map[]": " 2 files changed, 40 insertions(+)\n", - "/mock/dir/tpg git [fetch origin auto-pr-pr1-old] map[]": "", - "/mock/dir/tpgb find [. -type f -name *.go -exec sed -i.bak s~github.com/hashicorp/terraform-provider-google-beta~google/provider/new~g {} +] map[]": "", - "/mock/dir/tpgb git [diff origin/auto-pr-pr1-old origin/auto-pr-pr1 --shortstat] map[]": " 2 files changed, 40 insertions(+)\n", - "/mock/dir/tpgb git [fetch origin auto-pr-pr1-old] map[]": "", - "/mock/dir/tpgb sed [-i.bak s|github.com/hashicorp/terraform-provider-google-beta|google/provider/new|g go.mod] map[]": "", - "/mock/dir/tpgb sed [-i.bak s|github.com/hashicorp/terraform-provider-google-beta|google/provider/new|g go.sum] map[]": "", - "/mock/dir/tpgbold find [. -type f -name *.go -exec sed -i.bak s~github.com/hashicorp/terraform-provider-google-beta~google/provider/old~g {} +] map[]": "", - "/mock/dir/tpgbold git [checkout origin/auto-pr-pr1-old] map[]": "", - "/mock/dir/tpgbold sed [-i.bak s|github.com/hashicorp/terraform-provider-google-beta|google/provider/old|g go.mod] map[]": "", - "/mock/dir/tpgbold sed [-i.bak s|github.com/hashicorp/terraform-provider-google-beta|google/provider/old|g go.sum] map[]": "", + "/mock/dir/magic-modules/.ci/magician git [clone -b auto-pr-123456 https://modular-magician:*******@github.com/modular-magician/docs-examples /mock/dir/tfoics] map[]": "", + "/mock/dir/magic-modules/.ci/magician git [clone -b auto-pr-123456 https://modular-magician:*******@github.com/modular-magician/terraform-google-conversion /mock/dir/tgc] map[]": "", + "/mock/dir/magic-modules/.ci/magician git [clone -b auto-pr-123456 https://modular-magician:*******@github.com/modular-magician/terraform-provider-google /mock/dir/tpg] map[]": "", + "/mock/dir/magic-modules/.ci/magician git [clone -b auto-pr-123456 https://modular-magician:*******@github.com/modular-magician/terraform-provider-google-beta /mock/dir/tpgb] map[]": "", + "/mock/dir/magic-modules git [diff HEAD origin/main tools/missing-test-detector] map[]": "", + "/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [breaking-changes] map[]": "", + "/mock/dir/magic-modules/tools/diff-processor make [build] map[NEW_REF:auto-pr-123456 OLD_REF:auto-pr-123456-old]": "", + "/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [add-labels 123456] map[GITHUB_TOKEN_MAGIC_MODULES:*******]": "", + "/mock/dir/magic-modules/tools/missing-test-detector go [mod edit -replace google/provider/new=/mock/dir/tpgb] map[]": "", + "/mock/dir/magic-modules/tools/missing-test-detector go [mod edit -replace google/provider/old=/mock/dir/tpgbold] map[]": "", + "/mock/dir/magic-modules/tools/missing-test-detector go [mod tidy] map[]": "", + "/mock/dir/magic-modules/tools/missing-test-detector go [run . -services-dir=/mock/dir/tpgb/google-beta/services] map[]": "## Missing test report\nYour PR includes resource fields which are not covered by any test.\n\nResource: `google_folder_access_approval_settings` (3 total tests)\nPlease add an acceptance test which includes these fields. The test should include the following:\n\n```hcl\nresource \"google_folder_access_approval_settings\" \"primary\" {\n uncovered_field = # value needed\n}\n\n```\n", + "/mock/dir/tgc git [diff origin/auto-pr-123456-old origin/auto-pr-123456 --shortstat] map[]": " 1 file changed, 10 insertions(+)\n", + "/mock/dir/tgc git [fetch origin auto-pr-123456-old] map[]": "", + "/mock/dir/tfoics git [diff origin/auto-pr-123456-old origin/auto-pr-123456 --shortstat] map[]": "", + "/mock/dir/tfoics git [fetch origin auto-pr-123456-old] map[]": "", + "/mock/dir/tpg git [diff origin/auto-pr-123456-old origin/auto-pr-123456 --shortstat] map[]": " 2 files changed, 40 insertions(+)\n", + "/mock/dir/tpg git [fetch origin auto-pr-123456-old] map[]": "", + "/mock/dir/tpgb find [. -type f -name *.go -exec sed -i.bak s~github.com/hashicorp/terraform-provider-google-beta~google/provider/new~g {} +] map[]": "", + "/mock/dir/tpgb git [diff origin/auto-pr-123456-old origin/auto-pr-123456 --shortstat] map[]": " 2 files changed, 40 insertions(+)\n", + "/mock/dir/tpgb git [fetch origin auto-pr-123456-old] map[]": "", + "/mock/dir/tpgb sed [-i.bak s|github.com/hashicorp/terraform-provider-google-beta|google/provider/new|g go.mod] map[]": "", + "/mock/dir/tpgb sed [-i.bak s|github.com/hashicorp/terraform-provider-google-beta|google/provider/new|g go.sum] map[]": "", + "/mock/dir/tpgbold find [. -type f -name *.go -exec sed -i.bak s~github.com/hashicorp/terraform-provider-google-beta~google/provider/old~g {} +] map[]": "", + "/mock/dir/tpgbold git [checkout origin/auto-pr-123456-old] map[]": "", + "/mock/dir/tpgbold sed [-i.bak s|github.com/hashicorp/terraform-provider-google-beta|google/provider/old|g go.mod] map[]": "", + "/mock/dir/tpgbold sed [-i.bak s|github.com/hashicorp/terraform-provider-google-beta|google/provider/old|g go.sum] map[]": "", }, cwd: "/mock/dir/magic-modules/.ci/magician", dirStack: list.New(), diff --git a/.ci/magician/go.mod b/.ci/magician/go.mod index 95f0b951ab1c..4f089f20df4f 100644 --- a/.ci/magician/go.mod +++ b/.ci/magician/go.mod @@ -1,6 +1,6 @@ module magician -go 1.20 +go 1.21 replace github.com/GoogleCloudPlatform/magic-modules/tools/issue-labeler => ../../tools/issue-labeler diff --git a/.ci/magician/source/repo.go b/.ci/magician/source/repo.go index 2d62d531431f..529cf97200ee 100644 --- a/.ci/magician/source/repo.go +++ b/.ci/magician/source/repo.go @@ -14,7 +14,7 @@ type Repo struct { Owner string // Owner of repo, optional Path string // local Path once cloned, including Name Version provider.Version - DiffCanFail bool // whether to allow the command to continue if cloning or diffing the repo fails + Cloned bool } type Controller struct { diff --git a/.ci/scripts/go-plus/magician/exec.sh b/.ci/scripts/go-plus/magician/exec.sh index a0cb4078e6b6..c438fb69cb22 100755 --- a/.ci/scripts/go-plus/magician/exec.sh +++ b/.ci/scripts/go-plus/magician/exec.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # Get the directory of the current script DIR="$(dirname $(realpath $0))" diff --git a/.ci/unit-tests/gcb-membership-checker-test.yml b/.ci/unit-tests/gcb-membership-checker-test.yml index 1c0c63636ba2..a77f10fc1f48 100644 --- a/.ci/unit-tests/gcb-membership-checker-test.yml +++ b/.ci/unit-tests/gcb-membership-checker-test.yml @@ -1,6 +1,6 @@ --- steps: - - name: 'golang:1.20' + - name: 'golang:1.21' args: - '-c' - | diff --git a/.github/actions/build-downstream/action.yml b/.github/actions/build-downstream/action.yml new file mode 100644 index 000000000000..012248b10862 --- /dev/null +++ b/.github/actions/build-downstream/action.yml @@ -0,0 +1,105 @@ +name: build +description: Generates given downstream Magic Modules Repository from `repo` input +inputs: + repo: + description: "provider repo" + required: true + token: + description: "github token" + required: true + +runs: + using: "composite" + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Ruby + uses: ruby/setup-ruby@036ef458ddccddb148a2b9fb67e95a22fdbf728b # v1.160.0 + with: + ruby-version: '3.1' + + - name: Cache Bundler gems + uses: actions/cache@v3 + with: + path: mmv1/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('mmv1/**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + + - name: Install Ruby dependencies + shell: bash + run: | + bundle config path mmv1/vendor/bundle + bundle install + working-directory: mmv1 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '^1.20' + + # Cache Go modules + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - run: go install golang.org/x/tools/cmd/goimports@latest + shell: bash + - name: Build ${{ inputs.repo }} + shell: bash + env: + BASE_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} + GITHUB_TOKEN: ${{ inputs.token }} + run: | + set -e + set -x + # Set GOPATH to a directory the runner user has access to + export GOPATH=~/go + + function clone_repo() { + export OUTPUT_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO + echo "OUTPUT_PATH=$OUTPUT_PATH" >> $GITHUB_ENV + GITHUB_PATH=https://x-access-token:$GITHUB_TOKEN@github.com/$UPSTREAM_OWNER/$GH_REPO + mkdir -p "$(dirname $OUTPUT_PATH)" + git clone $GITHUB_PATH $OUTPUT_PATH --branch $BASE_BRANCH + } + + GH_REPO="${{ inputs.repo }}" + if [ "$GH_REPO" == "docs-examples" ] && [ "$BASE_BRANCH" == "main" ]; then + BASE_BRANCH="master" + fi + + GITHUB_PATH=https://x-access-token:$GITHUB_TOKEN@github.com/$UPSTREAM_OWNER/$GH_REPO + + if [[ "$GH_REPO" == terraform-provider-google* ]]; then + UPSTREAM_OWNER=hashicorp + clone_repo + if [ "$GH_REPO" == "terraform-provider-google" ]; then + export VERSION=ga + else + export VERSION=beta + fi + make clean-provider + make provider + elif [ "$GH_REPO" == "terraform-google-conversion" ]; then + UPSTREAM_OWNER=GoogleCloudPlatform + clone_repo + make clean-tgc + make tgc + elif [ "$GH_REPO" == "docs-examples" ]; then + UPSTREAM_OWNER=terraform-google-modules + clone_repo + make tf-oics + else + echo "case not supported" + exit 1 + fi + + (current_dir=$(pwd) && cd $OUTPUT_PATH && zip -r "$current_dir/output.zip" .) \ No newline at end of file diff --git a/.github/workflows/build-downstream.yml b/.github/workflows/build-downstream.yml index 91f33499bd10..10fcc1c768da 100644 --- a/.github/workflows/build-downstream.yml +++ b/.github/workflows/build-downstream.yml @@ -47,7 +47,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '^1.20' + go-version: '^1.21' # Cache Go modules - name: Cache Go modules diff --git a/.github/workflows/membership-checker.yml b/.github/workflows/membership-checker.yml index 7a206b519eaa..6650f101acc2 100644 --- a/.github/workflows/membership-checker.yml +++ b/.github/workflows/membership-checker.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '^1.20.1' + go-version: '^1.21' - name: Run membership checker unit tests run: | cd .ci/magician diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index 2831ec975caa..de54d2e2f353 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -28,7 +28,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '^1.20' + go-version: '^1.21' # Disable caching for now due to issues with large provider dependency caches cache: false - name: Build magician diff --git a/.github/workflows/teamcity-services-diff-check-weekly.yml b/.github/workflows/teamcity-services-diff-check-weekly.yml index 5d857f0eda90..355501e14d51 100644 --- a/.github/workflows/teamcity-services-diff-check-weekly.yml +++ b/.github/workflows/teamcity-services-diff-check-weekly.yml @@ -7,61 +7,41 @@ on: # Scheduled checks to catch edge cases schedule: - # Every Tuesday morning - - cron: '0 4 * * 2' + # Every Monday and Tuesday morning + - cron: '0 4 * * 1-2' jobs: - terraform-provider-google: - uses: ./.github/workflows/build-downstream.yml - with: - repo: 'terraform-provider-google' - - terraform-provider-google-beta: - uses: ./.github/workflows/build-downstream.yml - with: - repo: 'terraform-provider-google-beta' - teamcity-services-diff-check: - needs: [terraform-provider-google, terraform-provider-google-beta] - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: '^1.20' - - - name: Download built artifacts - GA provider - uses: actions/download-artifact@v2 - with: - name: artifact-terraform-provider-google - path: artifacts - - - name: Unzip the artifacts and delete the zip - run: | - unzip -o artifacts/output.zip -d ./provider - rm artifacts/output.zip - - - name: Download built artifacts - Beta provider - uses: actions/download-artifact@v2 - with: - name: artifact-terraform-provider-google-beta - path: artifacts - - - name: Unzip the artifacts and delete the zip - run: | - unzip -o artifacts/output.zip -d ./provider - rm artifacts/output.zip - - - name: Check that new services have been added to the TeamCity configuration code - run: | - # Create lists of service packages in providers - ls provider/google/services > tools/teamcity-diff-check/services_ga.txt - ls provider/google-beta/services > tools/teamcity-diff-check/services_beta.txt - - # Run tool to compare service packages in the providers vs those listed in TeamCity config files - cd tools/teamcity-diff-check - go run main.go -service_file=services_ga - go run main.go -service_file=services_beta + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: TeamCity Google Provider Generate + uses: ./.github/actions/build-downstream + with: + repo: 'terraform-provider-google' + token: '$GITHUB_TOKEN' + # The path where GA/Beta providers are generated is grabbed from the OUTPUT_PATH that's set in build_downstream.yaml + # export OUTPUT_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO + # OUTPUT_PATH changes after each generate (GA/beta) + - name: Set GOOGLE_REPO_PATH to path where GA provider was generated + run: echo "GOOGLE_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV + - name: TeamCity Google Beta Provider Generate + uses: ./.github/actions/build-downstream + with: + repo: 'terraform-provider-google-beta' + token: '$GITHUB_TOKEN' + - name: Set GOOGLE_BETA_REPO_PATH to path where beta provider was generated + run: echo "GOOGLE_BETA_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV + - name: Check that new services have been added to the TeamCity configuration code + run: | + # Create lists of service packages in providers + ls ${{env.GOOGLE_REPO_PATH}}/google/services > tools/teamcity-diff-check/services_ga.txt + ls ${{env.GOOGLE_BETA_REPO_PATH}}/google-beta/services > tools/teamcity-diff-check/services_beta.txt + + # Run tool to compare service packages in the providers vs those listed in TeamCity config files + cd tools/teamcity-diff-check + go run main.go -service_file=services_ga + go run main.go -service_file=services_beta diff --git a/.github/workflows/teamcity-services-diff-check.yml b/.github/workflows/teamcity-services-diff-check.yml index 37dd8e218554..9ffee2130bdb 100644 --- a/.github/workflows/teamcity-services-diff-check.yml +++ b/.github/workflows/teamcity-services-diff-check.yml @@ -9,10 +9,10 @@ on: - 'mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt' - 'mmv1/products/**' jobs: - check-pr: + teamcity-services-diff-check: + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-22.04 - outputs: - services: ${{steps.services.outputs.services}} steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -24,61 +24,37 @@ jobs: newServices=$(($(git diff --name-only --diff-filter=A origin/main HEAD | grep -P "mmv1/products/.*/product.yaml" | wc -l))) echo "services=$newServices" >> "${GITHUB_OUTPUT}" if [ "$newServices" = "0" ];then - echo "No new service found." + echo "No new service found." fi - terraform-provider-google: - if: ${{needs.check-pr.outputs.services != '0'}} - needs: check-pr - uses: ./.github/workflows/build-downstream.yml - with: - repo: 'terraform-provider-google' - - terraform-provider-google-beta: - if: ${{needs.check-pr.outputs.services != '0'}} - needs: check-pr - uses: ./.github/workflows/build-downstream.yml - with: - repo: 'terraform-provider-google-beta' - - teamcity-services-diff-check: - needs: [terraform-provider-google, terraform-provider-google-beta] - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v4 + - name: TeamCity Google Provider Generate + id: generate + if: ${{steps.services.outputs.services != '0'}} + uses: ./.github/actions/build-downstream with: - go-version: '^1.20' - - - name: Download built artifacts - GA provider - uses: actions/download-artifact@v2 + repo: 'terraform-provider-google' + token: '$GITHUB_TOKEN' + # The path where GA/Beta providers are generated is grabbed from the OUTPUT_PATH that's set in build_downstream.yaml + # export OUTPUT_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO + # OUTPUT_PATH changes after each generate (GA/beta) + - name: Set GOOGLE_REPO_PATH to path where GA provider was generated + run: echo "GOOGLE_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV + - name: TeamCity Google Beta Provider Generate + if: steps.generate.outcome == 'success' + uses: ./.github/actions/build-downstream with: - name: artifact-terraform-provider-google - path: artifacts - - - name: Unzip the artifacts and delete the zip - run: | - unzip -o artifacts/output.zip -d ./provider - rm artifacts/output.zip - - - name: Download built artifacts - Beta provider - uses: actions/download-artifact@v2 - with: - name: artifact-terraform-provider-google-beta - path: artifacts - - - name: Unzip the artifacts and delete the zip - run: | - unzip -o artifacts/output.zip -d ./provider - rm artifacts/output.zip - + repo: 'terraform-provider-google-beta' + token: '$GITHUB_TOKEN' + - name: Set GOOGLE_BETA_REPO_PATH to path where beta provider was generated + run: echo "GOOGLE_BETA_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV + - name: Checkout Repository + if: steps.generate.outcome == 'success' + uses: actions/checkout@v4 - name: Check that new services have been added to the TeamCity configuration code + if: steps.generate.outcome == 'success' run: | # Create lists of service packages in providers - ls provider/google/services > tools/teamcity-diff-check/services_ga.txt - ls provider/google-beta/services > tools/teamcity-diff-check/services_beta.txt + ls ${{env.GOOGLE_REPO_PATH}}/google/services > tools/teamcity-diff-check/services_ga.txt + ls ${{env.GOOGLE_BETA_REPO_PATH}}/google-beta/services > tools/teamcity-diff-check/services_beta.txt # Run tool to compare service packages in the providers vs those listed in TeamCity config files cd tools/teamcity-diff-check diff --git a/.github/workflows/test-tgc.yml b/.github/workflows/test-tgc.yml index 190bb6ae68c0..1edfa5b9399a 100644 --- a/.github/workflows/test-tgc.yml +++ b/.github/workflows/test-tgc.yml @@ -80,7 +80,7 @@ jobs: if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }} uses: actions/setup-go@v4 with: - go-version: '^1.20' + go-version: '^1.21' - name: Build Terraform Google Conversion if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }} run: | diff --git a/.github/workflows/test-tpg.yml b/.github/workflows/test-tpg.yml index 9edca790e1ec..c59f4355f19d 100644 --- a/.github/workflows/test-tpg.yml +++ b/.github/workflows/test-tpg.yml @@ -70,7 +70,7 @@ jobs: if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }} uses: actions/setup-go@v4 with: - go-version: '^1.20' + go-version: '^1.21' - name: Build Provider if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }} run: | diff --git a/.github/workflows/unit-test-tgc.yml b/.github/workflows/unit-test-tgc.yml index f254f91240db..34011a802bed 100644 --- a/.github/workflows/unit-test-tgc.yml +++ b/.github/workflows/unit-test-tgc.yml @@ -30,7 +30,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '^1.20' + go-version: '^1.21' - name: Cache Go modules and build cache uses: actions/cache@v3 diff --git a/.github/workflows/unit-test-tpg.yml b/.github/workflows/unit-test-tpg.yml index ac925a0fe621..e394fd9ab8d4 100644 --- a/.github/workflows/unit-test-tpg.yml +++ b/.github/workflows/unit-test-tpg.yml @@ -28,7 +28,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '^1.20' + go-version: '^1.21' - name: Build Provider run: | diff --git a/.github/workflows/unit-tests-diff-processor.yml b/.github/workflows/unit-tests-diff-processor.yml index 91d081716ab3..8718b49b7e61 100644 --- a/.github/workflows/unit-tests-diff-processor.yml +++ b/.github/workflows/unit-tests-diff-processor.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '^1.20.1' + go-version: '^1.21.0' - name: Build run: | diff --git a/docs/go.mod b/docs/go.mod index 35af46f9dda9..8d0779b9cb98 100644 --- a/docs/go.mod +++ b/docs/go.mod @@ -1,6 +1,6 @@ module github.com/GoogleCloudPlatform/magic-modules/docs -go 1.20 +go 1.21 require ( github.com/alex-shpak/hugo-book v0.0.0-20230424134111-d86d5e70c7c0 // indirect diff --git a/mmv1/api/async.go b/mmv1/api/async.go index 55d756fa8312..dc4090fe7663 100644 --- a/mmv1/api/async.go +++ b/mmv1/api/async.go @@ -66,7 +66,7 @@ type Result struct { // Contains information about the result of an Operation - ResourceInsideResponse bool + ResourceInsideResponse bool `yaml:"resource_inside_response"` } // def validate diff --git a/mmv1/api/product.go b/mmv1/api/product.go index d56edeefb9be..5c5b718d8767 100644 --- a/mmv1/api/product.go +++ b/mmv1/api/product.go @@ -14,7 +14,11 @@ package api import ( + "log" + "strings" + "github.com/GoogleCloudPlatform/magic-modules/mmv1/api/product" + "github.com/GoogleCloudPlatform/magic-modules/mmv1/google" "golang.org/x/exp/slices" ) @@ -38,6 +42,7 @@ type Product struct { // Name string // Display Name: The full name of the GCP product; eg "Cloud Bigtable" + DisplayName string `yaml:"display_name"` Objects []*Resource @@ -48,7 +53,7 @@ type Product struct { // The API versions of this product - Versions []product.Version + Versions []*product.Version // The base URL for the service API endpoint // For example: `https://www.googleapis.com/compute/v1/` @@ -75,6 +80,9 @@ func (p *Product) Validate() { for _, o := range p.Objects { o.ProductMetadata = p } + + p.SetApiName() + p.SetDisplayName() } // def validate @@ -99,73 +107,82 @@ func (p *Product) Validate() { // check :versions, type: Array, item_type: Api::Product::Version, required: true // end -// // ==================== -// // Custom Getters -// // ==================== - -// // The name of the product's API; "compute", "accesscontextmanager" -// def api_name -// name.downcase -// end +// ==================== +// Custom Setters +// ==================== -// // The product full name is the "display name" in string form intended for -// // users to read in documentation; "Google Compute Engine", "Cloud Bigtable" -// def display_name -// if @display_name.nil? -// name.space_separated -// else -// @display_name -// end -// end +func (p *Product) SetApiName() { + // The name of the product's API; "compute", "accesscontextmanager" + p.ApiName = strings.ToLower(p.Name) +} -// // Most general version that exists for the product -// // If GA is present, use that, else beta, else alpha -// def lowest_version -// Version::ORDER.each do |ordered_version_name| -// @versions.each do |product_version| -// return product_version if ordered_version_name == product_version.name -// end -// end -// raise "Unable to find lowest version for product //{display_name}" -// end +// The product full name is the "display name" in string form intended for +// users to read in documentation; "Google Compute Engine", "Cloud Bigtable" +func (p *Product) SetDisplayName() { + if p.DisplayName == "" { + p.DisplayName = google.SpaceSeparated(p.Name) + } +} -// def version_obj(name) -// @versions.each do |v| -// return v if v.name == name -// end +// ==================== +// Version-related methods +// ==================== + +// Most general version that exists for the product +// If GA is present, use that, else beta, else alpha +func (p Product) lowestVersion() *product.Version { + for _, orderedVersionName := range product.ORDER { + for _, productVersion := range p.Versions { + if orderedVersionName == productVersion.Name { + return productVersion + } + } + } -// raise "API version '//{name}' does not exist for product '//{@name}'" -// end + log.Fatalf("Unable to find lowest version for product %s", p.DisplayName) + return nil +} -// // Get the version of the object specified by the version given if present -// // Or else fall back to the closest version in the chain defined by Version::ORDER -// def version_obj_or_closest(name) -// return version_obj(name) if exists_at_version(name) +func (p Product) versionObj(name string) *product.Version { + for _, v := range p.Versions { + if v.Name == name { + return v + } + } -// // versions should fall back to the closest version to them that exists -// name ||= Version::ORDER[0] -// lower_versions = Version::ORDER[0..Version::ORDER.index(name)] + log.Fatalf("API version '%s' does not exist for product '%s'", name, p.Name) + return nil +} -// lower_versions.reverse_each do |version| -// return version_obj(version) if exists_at_version(version) -// end +// Get the version of the object specified by the version given if present +// Or else fall back to the closest version in the chain defined by product.ORDER +func (p Product) VersionObjOrClosest(name string) *product.Version { + if p.ExistsAtVersion(name) { + return p.versionObj(name) + } -// raise "Could not find object for version //{name} and product //{display_name}" -// end + // versions should fall back to the closest version to them that exists + if name == "" { + name = product.ORDER[0] + } -// def exists_at_version_or_lower(name) -// // Versions aren't normally going to be empty since products need a -// // base_url. This nil check exists for atypical products, like _bundle. -// return true if @versions.nil? + lowerVersions := make([]string, 0) + for _, v := range product.ORDER { + lowerVersions = append(lowerVersions, v) + if v == name { + break + } + } -// name ||= Version::ORDER[0] -// return false unless Version::ORDER.include?(name) + for i := len(lowerVersions) - 1; i >= 0; i-- { + if p.ExistsAtVersion(lowerVersions[i]) { + return p.versionObj(lowerVersions[i]) + } + } -// (0..Version::ORDER.index(name)).each do |i| -// return true if exists_at_version(Version::ORDER[i]) -// end -// false -// end + log.Fatalf("Could not find object for version %s and product %s", name, p.DisplayName) + return nil +} func (p *Product) ExistsAtVersionOrLower(name string) bool { if !slices.Contains(product.ORDER, name) { @@ -190,20 +207,9 @@ func (p *Product) ExistsAtVersion(name string) bool { return false } -// def exists_at_version(name) -// // Versions aren't normally going to be empty since products need a -// // base_url. This nil check exists for atypical products, like _bundle. -// return true if @versions.nil? - -// @versions.any? { |v| v.name == name } -// end - -// // Not a conventional setter, so ignore rubocop's warning -// // rubocop:disable Naming/AccessorMethodName -// def set_properties_based_on_version(version) -// @base_url = version.base_url -// end -// // rubocop:enable Naming/AccessorMethodName +func (p *Product) SetPropertiesBasedOnVersion(version *product.Version) { + p.BaseUrl = version.BaseUrl +} // // ==================== // // Debugging Methods diff --git a/mmv1/api/product/version.go b/mmv1/api/product/version.go index 3c2ef6a670c0..aa5bdd335c10 100644 --- a/mmv1/api/product/version.go +++ b/mmv1/api/product/version.go @@ -13,6 +13,10 @@ package product +import ( + "golang.org/x/exp/slices" +) + // require 'api/object' var ORDER = []string{"ga", "beta", "alpha", "private"} @@ -50,3 +54,7 @@ type Version struct { // def <=>(other) // ORDER.index(name) <=> ORDER.index(other.name) if other.is_a?(Version) // end + +func (v *Version) CompareTo(other *Version) int { + return slices.Index(ORDER, v.Name) - slices.Index(ORDER, other.Name) +} diff --git a/mmv1/api/product_test.go b/mmv1/api/product_test.go new file mode 100644 index 000000000000..682cd7b6a784 --- /dev/null +++ b/mmv1/api/product_test.go @@ -0,0 +1,129 @@ +package api + +import ( + "reflect" + "testing" + + "github.com/GoogleCloudPlatform/magic-modules/mmv1/api/product" +) + +func TestProductLowestVersion(t *testing.T) { + t.Parallel() + + cases := []struct { + description string + obj Product + expected string + }{ + { + description: "lowest version is ga", + obj: Product{ + Versions: []*product.Version{ + &product.Version{ + Name: "beta", + BaseUrl: "beta_url", + }, + &product.Version{ + Name: "ga", + BaseUrl: "ga_url", + }, + &product.Version{ + Name: "alpha", + BaseUrl: "alpha_url", + }, + }, + }, + expected: "ga", + }, + { + description: "lowest version is ga", + obj: Product{ + Versions: []*product.Version{ + &product.Version{ + Name: "beta", + BaseUrl: "beta_url", + }, + &product.Version{ + Name: "alpha", + BaseUrl: "alpha_url", + }, + }, + }, + expected: "beta", + }, + } + + for _, tc := range cases { + tc := tc + + t.Run(tc.description, func(t *testing.T) { + t.Parallel() + + versionObj := tc.obj.lowestVersion() + + if got, want := versionObj.Name, tc.expected; !reflect.DeepEqual(got, want) { + t.Errorf("expected %v to be %v", got, want) + } + }) + } +} + +func TestProductVersionObjOrClosest(t *testing.T) { + t.Parallel() + + cases := []struct { + description string + obj Product + input string + expected string + }{ + { + description: "closest version object to ga", + obj: Product{ + Versions: []*product.Version{ + &product.Version{ + Name: "beta", + BaseUrl: "beta_url", + }, + &product.Version{ + Name: "ga", + BaseUrl: "ga_url", + }, + }, + }, + input: "ga", + expected: "ga", + }, + { + description: "closest version object to alpha", + obj: Product{ + Versions: []*product.Version{ + &product.Version{ + Name: "beta", + BaseUrl: "beta_url", + }, + &product.Version{ + Name: "ga", + BaseUrl: "ga_url", + }, + }, + }, + input: "alpha", + expected: "beta", + }, + } + + for _, tc := range cases { + tc := tc + + t.Run(tc.description, func(t *testing.T) { + t.Parallel() + + versionObj := tc.obj.VersionObjOrClosest(tc.input) + + if got, want := versionObj.Name, tc.expected; !reflect.DeepEqual(got, want) { + t.Errorf("expected %v to be %v", got, want) + } + }) + } +} diff --git a/mmv1/api/resource.go b/mmv1/api/resource.go index 894850e765c1..069c935af0d8 100644 --- a/mmv1/api/resource.go +++ b/mmv1/api/resource.go @@ -13,6 +13,7 @@ package api import ( + "github.com/GoogleCloudPlatform/magic-modules/mmv1/api/product" "github.com/GoogleCloudPlatform/magic-modules/mmv1/api/resource" "github.com/GoogleCloudPlatform/magic-modules/mmv1/provider/terraform" ) @@ -292,3 +293,40 @@ func (r *Resource) setResourceMetada(properties []*Type) { property.ResourceMetadata = r } } + +// ==================== +// Version-related methods +// ==================== + +func (r Resource) MinVersionObj() *product.Version { + if r.MinVersion != "" { + return r.ProductMetadata.versionObj(r.MinVersion) + } else { + return r.ProductMetadata.lowestVersion() + } +} + +func (r Resource) NotInVersion(version *product.Version) bool { + return version.CompareTo(r.MinVersionObj()) < 0 +} + +// Recurses through all nested properties and parameters and changes their +// 'exclude' instance variable if the property is at a version below the +// one that is passed in. +func (r *Resource) ExcludeIfNotInVersion(version *product.Version) { + if !r.Exclude { + r.Exclude = r.NotInVersion(version) + } + + if r.Properties != nil { + for _, p := range r.Properties { + p.ExcludeIfNotInVersion(version) + } + } + + if r.Parameters != nil { + for _, p := range r.Parameters { + p.ExcludeIfNotInVersion(version) + } + } +} diff --git a/mmv1/api/resource_test.go b/mmv1/api/resource_test.go new file mode 100644 index 000000000000..a9cb0c3c4a65 --- /dev/null +++ b/mmv1/api/resource_test.go @@ -0,0 +1,145 @@ +package api + +import ( + "reflect" + "testing" + + "github.com/GoogleCloudPlatform/magic-modules/mmv1/api/product" +) + +func TestResourceMinVersionObj(t *testing.T) { + t.Parallel() + p := Product{ + NamedObject: NamedObject{ + Name: "test", + }, + Versions: []*product.Version{ + &product.Version{ + Name: "beta", + BaseUrl: "beta_url", + }, + &product.Version{ + Name: "ga", + BaseUrl: "ga_url", + }, + &product.Version{ + Name: "alpha", + BaseUrl: "alpha_url", + }, + }, + } + + cases := []struct { + description string + obj Resource + expected string + }{ + { + description: "resource minVersion is empty", + obj: Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + ProductMetadata: &p, + }, + expected: "ga", + }, + { + description: "resource minVersion is not empty", + obj: Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "beta", + ProductMetadata: &p, + }, + expected: "beta", + }, + } + + for _, tc := range cases { + tc := tc + + t.Run(tc.description, func(t *testing.T) { + t.Parallel() + + versionObj := tc.obj.MinVersionObj() + + if got, want := versionObj.Name, tc.expected; !reflect.DeepEqual(got, want) { + t.Errorf("expected %v to be %v", got, want) + } + }) + } +} + +func TestResourceNotInVersion(t *testing.T) { + t.Parallel() + p := Product{ + NamedObject: NamedObject{ + Name: "test", + }, + Versions: []*product.Version{ + &product.Version{ + Name: "beta", + BaseUrl: "beta_url", + }, + &product.Version{ + Name: "ga", + BaseUrl: "ga_url", + }, + &product.Version{ + Name: "alpha", + BaseUrl: "alpha_url", + }, + }, + } + + cases := []struct { + description string + obj Resource + input *product.Version + expected bool + }{ + { + description: "ga is in version if MinVersion is empty", + obj: Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + ProductMetadata: &p, + }, + input: &product.Version{ + Name: "ga", + }, + expected: false, + }, + { + description: "ga is not in version if MinVersion is beta", + obj: Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "beta", + ProductMetadata: &p, + }, + input: &product.Version{ + Name: "ga", + }, + expected: true, + }, + } + + for _, tc := range cases { + tc := tc + + t.Run(tc.description, func(t *testing.T) { + t.Parallel() + + if got, want := tc.obj.NotInVersion(tc.input), tc.expected; !reflect.DeepEqual(got, want) { + t.Errorf("expected %v to be %v", got, want) + } + }) + } +} diff --git a/mmv1/api/type.go b/mmv1/api/type.go index 0fe6f165e6dd..f80777231810 100644 --- a/mmv1/api/type.go +++ b/mmv1/api/type.go @@ -13,6 +13,10 @@ package api +import ( + "github.com/GoogleCloudPlatform/magic-modules/mmv1/api/product" +) + // require 'api/object' // require 'google/string_utils' // require 'provider/terraform/validation' @@ -441,24 +445,33 @@ const MAX_NAME = 20 // // @__parent // } -// func (t *Type) min_version() { -// // if @min_version.nil? -// // @__resource.min_version -// // else -// // @__resource.__product.version_obj(@min_version) -// // end -// } +func (t *Type) MinVersionObj() *product.Version { + if t.MinVersion != "" { + return t.ResourceMetadata.ProductMetadata.versionObj(t.MinVersion) + } else { + return t.ResourceMetadata.MinVersionObj() + } +} -// func (t *Type) exact_version() { -// // return nil if @exact_version.nil? || @exact_version.empty? +func (t *Type) exactVersionObj() *product.Version { + if t.ExactVersion == "" { + return nil + } -// // @__resource.__product.version_obj(@exact_version) -// } + return t.ResourceMetadata.ProductMetadata.versionObj(t.ExactVersion) +} -// func (t *Type) exclude_if_not_in_version!(version) { -// // @exclude ||= exact_version != version unless exact_version.nil? -// // @exclude ||= version < min_version -// } +func (t *Type) ExcludeIfNotInVersion(version *product.Version) { + if !t.Exclude { + if versionObj := t.exactVersionObj(); versionObj != nil { + t.Exclude = versionObj.CompareTo(version) != 0 + } + + if !t.Exclude { + t.Exclude = version.CompareTo(t.MinVersionObj()) < 0 + } + } +} // // Overriding is_a? to enable class overrides. // // Ruby does not let you natively change types, so this is the next best diff --git a/mmv1/api/type_test.go b/mmv1/api/type_test.go new file mode 100644 index 000000000000..86c3e2e57b1e --- /dev/null +++ b/mmv1/api/type_test.go @@ -0,0 +1,214 @@ +package api + +import ( + "reflect" + "testing" + + "github.com/GoogleCloudPlatform/magic-modules/mmv1/api/product" +) + +func TestTypeMinVersionObj(t *testing.T) { + t.Parallel() + + p := Product{ + NamedObject: NamedObject{ + Name: "test", + }, + Versions: []*product.Version{ + &product.Version{ + Name: "beta", + BaseUrl: "beta_url", + }, + &product.Version{ + Name: "ga", + BaseUrl: "ga_url", + }, + &product.Version{ + Name: "alpha", + BaseUrl: "alpha_url", + }, + }, + } + + cases := []struct { + description string + obj Type + expected string + }{ + { + description: "type minVersion is empty and resource minVersion is empty", + obj: Type{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + ResourceMetadata: &Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + ProductMetadata: &p, + }, + }, + expected: "ga", + }, + { + description: "type minVersion is empty and resource minVersion is beta", + obj: Type{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + ResourceMetadata: &Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "beta", + ProductMetadata: &p, + }, + }, + expected: "beta", + }, + { + description: "type minVersion is not empty", + obj: Type{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "beta", + ResourceMetadata: &Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + ProductMetadata: &p, + }, + }, + expected: "beta", + }, + } + + for _, tc := range cases { + tc := tc + + t.Run(tc.description, func(t *testing.T) { + t.Parallel() + + versionObj := tc.obj.MinVersionObj() + + if got, want := versionObj.Name, tc.expected; !reflect.DeepEqual(got, want) { + t.Errorf("expected %v to be %v", got, want) + } + }) + } +} + +func TestTypeExcludeIfNotInVersion(t *testing.T) { + t.Parallel() + + p := Product{ + NamedObject: NamedObject{ + Name: "test", + }, + Versions: []*product.Version{ + &product.Version{ + Name: "beta", + BaseUrl: "beta_url", + }, + &product.Version{ + Name: "ga", + BaseUrl: "ga_url", + }, + &product.Version{ + Name: "alpha", + BaseUrl: "alpha_url", + }, + }, + } + + cases := []struct { + description string + obj Type + input *product.Version + expected bool + }{ + { + description: "type has Exclude true", + obj: Type{ + NamedObject: NamedObject{ + Name: "test", + }, + Exclude: true, + MinVersion: "", + ResourceMetadata: &Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + ProductMetadata: &p, + }, + }, + input: &product.Version{ + Name: "ga", + }, + expected: true, + }, + { + description: "type has Exclude false and not empty ExactVersion", + obj: Type{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + Exclude: false, + ExactVersion: "beta", + ResourceMetadata: &Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "beta", + ProductMetadata: &p, + }, + }, + input: &product.Version{ + Name: "ga", + }, + expected: true, + }, + { + description: "type has Exclude false and empty ExactVersion", + obj: Type{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "beta", + Exclude: false, + ExactVersion: "", + ResourceMetadata: &Resource{ + NamedObject: NamedObject{ + Name: "test", + }, + MinVersion: "", + ProductMetadata: &p, + }, + }, + input: &product.Version{ + Name: "ga", + }, + expected: true, + }, + } + + for _, tc := range cases { + tc := tc + + t.Run(tc.description, func(t *testing.T) { + t.Parallel() + + tc.obj.ExcludeIfNotInVersion(tc.input) + if got, want := tc.obj.Exclude, tc.expected; !reflect.DeepEqual(got, want) { + t.Errorf("expected %v to be %v", got, want) + } + }) + } +} diff --git a/mmv1/compiler.rb b/mmv1/compiler.rb index 2e4bc8b5b3ce..0f61a8eb4ccc 100755 --- a/mmv1/compiler.rb +++ b/mmv1/compiler.rb @@ -192,6 +192,9 @@ ) resource.validate resources.push(resource) + rescue StandardError => e + Google::LOGGER.error "Failed to compile #{file_path}: #{e}" + raise e end if override_dir @@ -221,6 +224,9 @@ ) resource.validate resources.push(resource) + rescue StandardError => e + Google::LOGGER.error "Failed to compile using override #{override_path}: #{e}" + raise e end end resources = resources.sort_by(&:name) diff --git a/mmv1/go.mod b/mmv1/go.mod index 24d9a6c630d1..58a9d896cd1a 100644 --- a/mmv1/go.mod +++ b/mmv1/go.mod @@ -1,6 +1,6 @@ module github.com/GoogleCloudPlatform/magic-modules/mmv1 -go 1.20 +go 1.21 require ( golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 diff --git a/mmv1/google/string_utils.go b/mmv1/google/string_utils.go new file mode 100644 index 000000000000..264f031893c6 --- /dev/null +++ b/mmv1/google/string_utils.go @@ -0,0 +1,111 @@ +// Copyright 2024 Google Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package google + +import ( + "regexp" + "strings" +) + +// // Helper class to process and mutate strings. +// class StringUtils +// // Converts string from camel case to underscore +// def self.underscore(source) +// source.gsub(/::/, '/') +// .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') +// .gsub(/([a-z\d])([A-Z])/, '\1_\2') +// .tr('-', '_') +// .tr('.', '_') +// .downcase +// end + +// // Converts from PascalCase to Space Separated +// def self.space_separated(source) +// tmp = source.gsub(/([A-Z]+)([A-Z][a-z])/, '\1 \2') +// .gsub(/([a-z\d])([A-Z])/, '\1 \2') +// .downcase +// tmp[0].upcase.concat(tmp[1..]) +// end + +// Converts from PascalCase to Space Separated +// For example, converts "AccessApproval" to "Access Approval" +func SpaceSeparated(source string) string { + tmp := regexp.MustCompile(`([A-Z]+)([A-Z][a-z])`).ReplaceAllString(source, "${1} ${2}") + tmp = regexp.MustCompile(`([a-z\d])([A-Z])`).ReplaceAllString(tmp, "${1} ${2}") + tmp = strings.ToLower(tmp) + tmp = strings.Title(tmp) + return tmp +} + +// // Converts a string to space-separated capitalized words +// def self.title(source) +// ss = space_separated(source) +// ss.gsub(/\b(? policies +// // indices -> indices +// return source if source.end_with?('ies') || source.end_with?('es') + +// // index -> indices +// return "//{source.gsub(/ex$/, '')}ices" if source.end_with?('ex') + +// // mesh -> meshes +// return "//{source}es" if source.end_with?('esh') + +// // key -> keys +// // gateway -> gateways +// return "//{source}s" if source.end_with?('ey') || source.end_with?('ay') + +// // policy -> policies +// return "//{source.gsub(/y$/, '')}ies" if source.end_with?('y') + +// "//{source}s" +// end + +// // Slimmed down version of ActiveSupport::Inflector code +// def self.camelize(term, uppercase_first_letter) +// acronyms_camelize_regex = /^(?:(?=a)b(?=\b|[A-Z_])|\w)/ + +// string = term.to_s +// string = if uppercase_first_letter +// string.sub(/^[a-z\d]*/) { |match| match.capitalize! || match } +// else +// string.sub(acronyms_camelize_regex) { |match| match.downcase! || match } +// end +// // handle snake case +// string.gsub!(/(?:_)([a-z\d]*)/i) do +// word = ::Regexp.last_match(1) +// word.capitalize! || word +// end +// string +// end +// end diff --git a/mmv1/products/accesscontextmanager/ServicePerimeter.yaml b/mmv1/products/accesscontextmanager/ServicePerimeter.yaml index b79c83c666cf..d6b02a13d48d 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeter.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeter.yaml @@ -71,6 +71,9 @@ examples: primary_resource_id: 'service-perimeter' vars: service_perimeter_name: 'restrict_bigquery_dryrun_storage' + - !ruby/object:Provider::Terraform::Examples + name: 'access_context_manager_service_perimeter_granular_controls' + skip_test: true custom_code: !ruby/object:Provider::Terraform::CustomCode encoder: templates/terraform/encoders/access_level_never_send_parent.go.erb custom_import: templates/terraform/custom_import/set_access_policy_parent_from_self_link.go.erb @@ -240,9 +243,10 @@ properties: item_type: Api::Type::String is_set: true description: | - A list of identities that are allowed access through this ingress policy. - Should be in the format of email address. The email address should represent - individual user or service account only. + 'A list of identities that are allowed access through this `IngressPolicy`. + To specify an identity or identity group, use the IAM v1 + format specified [here](https://cloud.google.com/iam/docs/principal-identifiers.md#v1). + The following prefixes are supprted: user, group, serviceAccount, principal, and principalSet.' - !ruby/object:Api::Type::Array name: 'sources' description: | @@ -364,9 +368,10 @@ properties: - !ruby/object:Api::Type::Array name: 'identities' description: | - A list of identities that are allowed access through this `EgressPolicy`. - Should be in the format of email address. The email address should - represent individual user or service account only. + 'A list of identities that are allowed access through this `EgressPolicy`. + To specify an identity or identity group, use the IAM v1 + format specified [here](https://cloud.google.com/iam/docs/principal-identifiers.md#v1). + The following prefixes are supprted: user, group, serviceAccount, principal, and principalSet.' is_set: true item_type: Api::Type::String - !ruby/object:Api::Type::NestedObject @@ -528,9 +533,10 @@ properties: item_type: Api::Type::String is_set: true description: | - A list of identities that are allowed access through this ingress policy. - Should be in the format of email address. The email address should represent - individual user or service account only. + 'A list of identities that are allowed access through this `IngressPolicy`. + To specify an identity or identity group, use the IAM v1 + format specified [here](https://cloud.google.com/iam/docs/principal-identifiers.md#v1). + The following prefixes are supprted: user, group, serviceAccount, principal, and principalSet.' - !ruby/object:Api::Type::Array name: 'sources' description: | @@ -652,9 +658,10 @@ properties: - !ruby/object:Api::Type::Array name: 'identities' description: | - A list of identities that are allowed access through this `EgressPolicy`. - Should be in the format of email address. The email address should - represent individual user or service account only. + 'A list of identities that are allowed access through this `EgressPolicy`. + To specify an identity or identity group, use the IAM v1 + format specified [here](https://cloud.google.com/iam/docs/principal-identifiers.md#v1). + The following prefixes are supprted: user, group, serviceAccount, principal, and principalSet.' item_type: Api::Type::String is_set: true - !ruby/object:Api::Type::NestedObject diff --git a/mmv1/products/accesscontextmanager/ServicePerimeterEgressPolicy.yaml b/mmv1/products/accesscontextmanager/ServicePerimeterEgressPolicy.yaml index 5e46e6770c0d..738ceefd98bd 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeterEgressPolicy.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeterEgressPolicy.yaml @@ -76,8 +76,8 @@ properties: name: 'identities' description: | A list of identities that are allowed access through this `EgressPolicy`. - Should be in the format of email address. The email address should - represent individual user or service account only. + Should be in the format of an email address. The email address should + represent an individual user, service account, or Google group. item_type: Api::Type::String - !ruby/object:Api::Type::Array name: 'sources' diff --git a/mmv1/products/accesscontextmanager/ServicePerimeterIngressPolicy.yaml b/mmv1/products/accesscontextmanager/ServicePerimeterIngressPolicy.yaml index 8e671e4096ee..195b87db9bfa 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeterIngressPolicy.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeterIngressPolicy.yaml @@ -78,9 +78,9 @@ properties: name: 'identities' item_type: Api::Type::String description: | - A list of identities that are allowed access through this ingress policy. - Should be in the format of email address. The email address should represent - individual user or service account only. + A list of identities that are allowed access through this `IngressPolicy`. + Should be in the format of an email address. The email address should represent + an individual user, service account, or Google group. - !ruby/object:Api::Type::Array name: 'sources' description: | diff --git a/mmv1/products/accesscontextmanager/ServicePerimeters.yaml b/mmv1/products/accesscontextmanager/ServicePerimeters.yaml index 2b941289d41a..655c3545a2e6 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeters.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeters.yaml @@ -220,9 +220,10 @@ properties: is_set: true item_type: Api::Type::String description: | - A list of identities that are allowed access through this ingress policy. - Should be in the format of email address. The email address should represent - individual user or service account only. + 'A list of identities that are allowed access through this `IngressPolicy`. + To specify an identity or identity group, use the IAM v1 format + specified [here](https://cloud.google.com/iam/docs/principal-identifiers.md#v1). + The following prefixes are supprted: user, group, serviceAccount, principal, and principalSet.' - !ruby/object:Api::Type::Array name: 'sources' description: | @@ -329,9 +330,10 @@ properties: - !ruby/object:Api::Type::Array name: 'identities' description: | - A list of identities that are allowed access through this `EgressPolicy`. - Should be in the format of email address. The email address should - represent individual user or service account only. + 'A list of identities that are allowed access through this `EgressPolicy`. + To specify an identity or identity group, use the IAM v1 format + specified [here](https://cloud.google.com/iam/docs/principal-identifiers.md#v1). + The following prefixes are supprted: user, group, serviceAccount, principal, and principalSet.' is_set: true item_type: Api::Type::String - !ruby/object:Api::Type::Array @@ -514,9 +516,10 @@ properties: is_set: true item_type: Api::Type::String description: | - A list of identities that are allowed access through this ingress policy. - Should be in the format of email address. The email address should represent - individual user or service account only. + 'A list of identities that are allowed access through this `IngressPolicy`. + To specify an identity or identity group, use the IAM v1 format + specified [here](https://cloud.google.com/iam/docs/principal-identifiers.md#v1). + The following prefixes are supprted: user, group, serviceAccount, principal, and principalSet.' - !ruby/object:Api::Type::Array name: 'sources' description: | @@ -623,9 +626,10 @@ properties: - !ruby/object:Api::Type::Array name: 'identities' description: | - A list of identities that are allowed access through this `EgressPolicy`. - Should be in the format of email address. The email address should - represent individual user or service account only. + 'A list of identities that are allowed access through this `EgressPolicy`. + To specify an identity or identity group, use the IAM v1 format + specified [here](https://cloud.google.com/iam/docs/principal-identifiers.md#v1). + The following prefixes are supprted: user, group, serviceAccount, principal, and principalSet.' item_type: Api::Type::String is_set: true - !ruby/object:Api::Type::Array diff --git a/mmv1/products/apphub/Service.yaml b/mmv1/products/apphub/Service.yaml new file mode 100644 index 000000000000..7558666e9582 --- /dev/null +++ b/mmv1/products/apphub/Service.yaml @@ -0,0 +1,235 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Resource +base_url: projects/{{project}}/locations/{{location}}/applications/{{application_id}}/services +create_url: projects/{{project}}/locations/{{location}}/applications/{{application_id}}/services?serviceId={{service_id}} +self_link: projects/{{project}}/locations/{{location}}/applications/{{application_id}}/services/{{service_id}} +id_format: projects/{{project}}/locations/{{location}}/applications/{{application_id}}/services/{{service_id}} +import_format: + - projects/{{project}}/locations/{{location}}/applications/{{application_id}}/services/{{service_id}} +name: Service +description: 'Service is a network/api interface that exposes some functionality to clients for consumption over the network. + Service typically has one or more Workloads behind it. It registers identified service to the Application.' +autogen_async: true +examples: + - !ruby/object:Provider::Terraform::Examples + name: "apphub_service_basic" + pull_external: true + primary_resource_id: "example" + vars: + application_id: "example-application-1" + service_project_attachment_id: "project-1" + ilb_network: "l7-ilb-network" + ilb_subnet: "l7-ilb-subnet" + forwarding_rule: "l7-ilb-forwarding-rule" + backend_service: "l7-ilb-backend-subnet" + health_check: "l7-ilb-hc" + test_env_vars: + org_id: :ORG_ID + billing_account: :BILLING_ACCT + - !ruby/object:Provider::Terraform::Examples + name: "apphub_service_full" + pull_external: true + primary_resource_id: "example" + vars: + application_id: "example-application-1" + service_project_attachment_id: "project-1" + display_name: "Example Service Full" + description: "Register service for testing" + business_name: "Alice" + business_email: "alice@google.com" + developer_name: "Bob" + developer_email: "bob@google.com" + operator_name: "Charlie" + operator_email: "charlie@google.com" + ilb_network: "l7-ilb-network" + ilb_subnet: "l7-ilb-subnet" + forwarding_rule: "l7-ilb-forwarding-rule" + backend_service: "l7-ilb-backend-subnet" + health_check: "l7-ilb-hc" + test_env_vars: + org_id: :ORG_ID + billing_account: :BILLING_ACCT +async: !ruby/object:Api::OpAsync + operation: !ruby/object:Api::OpAsync::Operation + path: name + base_url: "{{op_id}}" + wait_ms: 1000 + timeouts: + result: !ruby/object:Api::OpAsync::Result + path: response + resource_inside_response: true + status: !ruby/object:Api::OpAsync::Status + path: done + complete: true + allowed: + - true + - false + error: !ruby/object:Api::OpAsync::Error + path: error + message: message +update_verb: :PATCH +update_mask: true +parameters: + - !ruby/object:Api::Type::String + name: location + description: 'Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID} ' + url_param_only: true + required: true + immutable: true + - !ruby/object:Api::Type::String + name: applicationId + description: 'Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}' + url_param_only: true + required: true + immutable: true + - !ruby/object:Api::Type::String + name: serviceId + description: 'The Service identifier. ' + url_param_only: true + required: true + immutable: true +properties: + - !ruby/object:Api::Type::String + name: name + output: true + description: "Identifier. The resource name of a Service. Format:\n\"projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}\" " + - !ruby/object:Api::Type::String + name: displayName + description: 'User-defined name for the Service. ' + - !ruby/object:Api::Type::String + name: description + description: 'User-defined description of a Service. ' + - !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: uri + description: "Output only. The underlying resource URI (For example, URI of Forwarding + Rule, URL Map,\nand Backend Service). " + output: true + output: true + name: serviceReference + description: 'Reference to an underlying networking resource that can comprise a + Service. ' + - !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: gcpProject + description: "Output only. The service project identifier that the underlying + cloud resource resides in. " + output: true + - !ruby/object:Api::Type::String + name: location + description: "Output only. The location that the underlying resource resides in, + for example, us-west1. " + output: true + - !ruby/object:Api::Type::String + name: zone + description: "Output only. The location that the underlying resource resides in + if it is zonal, for example, us-west1-a). " + output: true + output: true + name: serviceProperties + description: 'Properties of an underlying cloud resource that can comprise a Service. ' + - !ruby/object:Api::Type::NestedObject + name: attributes + description: 'Consumer provided attributes. ' + properties: + - !ruby/object:Api::Type::NestedObject + name: criticality + description: 'Criticality of the Application, Service, or Workload ' + properties: + - !ruby/object:Api::Type::Enum + name: type + description: 'Criticality type. ' + required: true + values: + - :MISSION_CRITICAL + - :HIGH + - :MEDIUM + - :LOW + - !ruby/object:Api::Type::NestedObject + name: environment + description: 'Environment of the Application, Service, or Workload ' + properties: + - !ruby/object:Api::Type::Enum + name: type + description: 'Environment type. ' + required: true + values: + - :PRODUCTION + - :STAGING + - :TEST + - :DEVELOPMENT + - !ruby/object:Api::Type::Array + name: developerOwners + description: 'Developer team that owns development and coding. ' + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: displayName + description: 'Contact''s name. ' + - !ruby/object:Api::Type::String + name: email + description: 'Required. Email address of the contacts. ' + required: true + - !ruby/object:Api::Type::Array + name: operatorOwners + description: 'Operator team that ensures runtime and operations. ' + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: displayName + description: 'Contact''s name. ' + - !ruby/object:Api::Type::String + name: email + description: 'Required. Email address of the contacts. ' + required: true + - !ruby/object:Api::Type::Array + name: businessOwners + description: 'Business team that ensures user needs are met and value + is delivered ' + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: displayName + description: 'Contact''s name. ' + - !ruby/object:Api::Type::String + name: email + description: 'Required. Email address of the contacts. ' + required: true + - !ruby/object:Api::Type::String + name: discoveredService + diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress' + description: 'Immutable. The resource name of the original discovered + service. ' + required: true + immutable: true + - !ruby/object:Api::Type::String + name: createTime + description: 'Output only. Create time. ' + output: true + - !ruby/object:Api::Type::String + name: updateTime + description: 'Output only. Update time. ' + output: true + - !ruby/object:Api::Type::String + name: uid + description: "Output only. A universally unique identifier (UUID) for the `Service` + in the UUID4\nformat. " + output: true + - !ruby/object:Api::Type::String + name: state + description: "Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED" + output: true diff --git a/mmv1/products/apphub/Workload.yaml b/mmv1/products/apphub/Workload.yaml new file mode 100644 index 000000000000..b0c3466bb2d9 --- /dev/null +++ b/mmv1/products/apphub/Workload.yaml @@ -0,0 +1,228 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Resource +base_url: projects/{{project}}/locations/{{location}}/applications/{{application_id}}/workloads +create_url: projects/{{project}}/locations/{{location}}/applications/{{application_id}}/workloads?workloadId={{workload_id}} +self_link: projects/{{project}}/locations/{{location}}/applications/{{application_id}}/workloads/{{workload_id}} +id_format: projects/{{project}}/locations/{{location}}/applications/{{application_id}}/workloads/{{workload_id}} +import_format: + - projects/{{project}}/locations/{{location}}/applications/{{application_id}}/workloads/{{workload_id}} +name: Workload +description: 'Workload represents a binary deployment (such as Managed Instance Groups (MIGs), GKE deployments, etc.) that performs the smallest logical subset of business functionality. + It registers identified workload to the Application.' +autogen_async: true +examples: + - !ruby/object:Provider::Terraform::Examples + name: "apphub_workload_basic" + pull_external: true + primary_resource_id: "example" + vars: + application_id: "example-application-1" + service_project_attachment_id: "project-1" + ilb_network: "l7-ilb-network" + ilb_subnet: "l7-ilb-subnet" + instance_template: "l7-ilb-mig-template" + mig: "l7-ilb-mig1" + test_env_vars: + org_id: :ORG_ID + billing_account: :BILLING_ACCT + - !ruby/object:Provider::Terraform::Examples + name: "apphub_workload_full" + pull_external: true + primary_resource_id: "example" + vars: + application_id: "example-application-1" + service_project_attachment_id: "project-1" + display_name: "Example Service Full" + description: "Register service for testing" + business_name: "Alice" + business_email: "alice@google.com" + developer_name: "Bob" + developer_email: "bob@google.com" + operator_name: "Charlie" + operator_email: "charlie@google.com" + ilb_network: "l7-ilb-network" + ilb_subnet: "l7-ilb-subnet" + instance_template: "l7-ilb-mig-template" + mig: "l7-ilb-mig1" + test_env_vars: + org_id: :ORG_ID + billing_account: :BILLING_ACCT +async: !ruby/object:Api::OpAsync + operation: !ruby/object:Api::OpAsync::Operation + path: name + base_url: "{{op_id}}" + wait_ms: 1000 + timeouts: + result: !ruby/object:Api::OpAsync::Result + path: response + resource_inside_response: true + status: !ruby/object:Api::OpAsync::Status + path: done + complete: true + allowed: + - true + - false + error: !ruby/object:Api::OpAsync::Error + path: error + message: message +update_verb: :PATCH +update_mask: true +parameters: + - !ruby/object:Api::Type::String + name: location + description: 'Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID} ' + url_param_only: true + required: true + immutable: true + - !ruby/object:Api::Type::String + name: applicationId + description: 'Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}' + url_param_only: true + required: true + immutable: true + - !ruby/object:Api::Type::String + name: workloadId + description: 'The Workload identifier. ' + url_param_only: true + required: true + immutable: true +properties: + - !ruby/object:Api::Type::String + name: name + output: true + description: "Identifier. The resource name of the Workload. Format:\"projects/{host-project-id}/locations/{location}/applications/{application-id}/workloads/{workload-id}\" " + - !ruby/object:Api::Type::String + name: displayName + description: 'User-defined name for the Workload. ' + - !ruby/object:Api::Type::String + name: description + description: 'User-defined description of a Workload. ' + - !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: uri + description: 'Output only. The underlying compute resource uri. ' + output: true + output: true + name: workloadReference + description: 'Reference of an underlying compute resource represented by the Workload. ' + - !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: gcpProject + description: "Output only. The service project identifier that the underlying + cloud resource resides in. Empty for non cloud resources. " + output: true + - !ruby/object:Api::Type::String + name: location + description: "Output only. The location that the underlying compute resource resides + in (e.g us-west1). " + output: true + - !ruby/object:Api::Type::String + name: zone + description: "Output only. The location that the underlying compute resource resides + in if it is zonal (e.g us-west1-a). " + output: true + output: true + name: workloadProperties + description: 'Properties of an underlying compute resource represented by the Workload. ' + - !ruby/object:Api::Type::String + name: discoveredWorkload + diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress' + description: 'Immutable. The resource name of the original discovered workload. ' + required: true + immutable: true + - !ruby/object:Api::Type::NestedObject + name: attributes + description: 'Consumer provided attributes. ' + properties: + - !ruby/object:Api::Type::NestedObject + name: criticality + description: 'Criticality of the Application, Service, or Workload ' + properties: + - !ruby/object:Api::Type::Enum + name: type + description: 'Criticality type. ' + required: true + values: + - :MISSION_CRITICAL + - :HIGH + - :MEDIUM + - :LOW + - !ruby/object:Api::Type::NestedObject + name: environment + description: 'Environment of the Application, Service, or Workload ' + properties: + - !ruby/object:Api::Type::Enum + name: type + description: 'Environment type. ' + required: true + values: + - :PRODUCTION + - :STAGING + - :TEST + - :DEVELOPMENT + - !ruby/object:Api::Type::Array + name: developerOwners + description: 'Developer team that owns development and coding. ' + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: displayName + description: 'Contact''s name. ' + - !ruby/object:Api::Type::String + name: email + description: 'Email address of the contacts. ' + required: true + - !ruby/object:Api::Type::Array + name: operatorOwners + description: 'Operator team that ensures runtime and operations. ' + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: displayName + description: 'Contact''s name. ' + - !ruby/object:Api::Type::String + name: email + description: 'Email address of the contacts. ' + required: true + - !ruby/object:Api::Type::Array + name: businessOwners + description: 'Business team that ensures user needs are met and value is delivered ' + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: displayName + description: 'Contact''s name. ' + - !ruby/object:Api::Type::String + name: email + description: 'Email address of the contacts. ' + required: true + - !ruby/object:Api::Type::String + name: createTime + description: 'Output only. Create time. ' + output: true + - !ruby/object:Api::Type::String + name: updateTime + description: 'Output only. Update time. ' + output: true + - !ruby/object:Api::Type::String + name: uid + description: "Output only. A universally unique identifier (UUID) for the `Workload` in the UUID4 format. " + output: true + - !ruby/object:Api::Type::String + name: state + description: "Output only. Workload state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED" + output: true diff --git a/mmv1/products/cloudquotas/product.yaml b/mmv1/products/cloudquotas/product.yaml new file mode 100644 index 000000000000..53c82344b0d2 --- /dev/null +++ b/mmv1/products/cloudquotas/product.yaml @@ -0,0 +1,22 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Product +name: CloudQuotas +display_name: Cloud Quotas +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: https://cloudquotas.googleapis.com/v1/ +scopes: + - https://www.googleapis.com/auth/cloud-platform diff --git a/mmv1/products/compute/RegionUrlMap.yaml b/mmv1/products/compute/RegionUrlMap.yaml index 69d8e8fcb7ae..2d2645f08398 100644 --- a/mmv1/products/compute/RegionUrlMap.yaml +++ b/mmv1/products/compute/RegionUrlMap.yaml @@ -130,6 +130,15 @@ examples: skip_docs: true skip_test: true # Similar to other samples min_version: beta + - !ruby/object:Provider::Terraform::Examples + name: "region_url_map_path_template_match" + primary_resource_id: "urlmap" + vars: + url_map_name: "urlmap" + home_backend_service_name: "home-service" + cart_backend_service_name: "cart-service" + user_backend_service_name: "user-service" + health_check_name: "health-check" parameters: - !ruby/object:Api::Type::ResourceRef name: 'region' @@ -558,6 +567,18 @@ properties: and anchor supplied with the original URL. For regular expression grammar please see en.cppreference.com/w/cpp/regex/ecmascript Only one of prefixMatch, fullPathMatch or regexMatch must be specified. + - !ruby/object:Api::Type::String + name: 'pathTemplateMatch' + description: | + For satisfying the matchRule condition, the path of the request + must match the wildcard pattern specified in pathTemplateMatch + after removing any query parameters and anchor that may be part + of the original URL. + + pathTemplateMatch must be between 1 and 255 characters + (inclusive). The pattern specified by pathTemplateMatch may + have at most 5 wildcard operators and at most 5 variable + captures in total. - !ruby/object:Api::Type::NestedObject name: 'routeAction' description: | @@ -784,6 +805,23 @@ properties: Prior to forwarding the request to the selected backend service, the matching portion of the request's path is replaced by pathPrefixRewrite. The value must be between 1 and 1024 characters. + - !ruby/object:Api::Type::String + name: 'pathTemplateRewrite' + description: | + Prior to forwarding the request to the selected origin, if the + request matched a pathTemplateMatch, the matching portion of the + request's path is replaced re-written using the pattern specified + by pathTemplateRewrite. + + pathTemplateRewrite must be between 1 and 255 characters + (inclusive), must start with a '/', and must only use variables + captured by the route's pathTemplate matchers. + + pathTemplateRewrite may only be used when all of a route's + MatchRules specify pathTemplate. + + Only one of pathPrefixRewrite and pathTemplateRewrite may be + specified. - !ruby/object:Api::Type::Array name: 'weightedBackendServices' description: | diff --git a/mmv1/products/networksecurity/FirewallEndpointAssociation.yaml b/mmv1/products/networksecurity/FirewallEndpointAssociation.yaml new file mode 100644 index 000000000000..9a49eb7496fb --- /dev/null +++ b/mmv1/products/networksecurity/FirewallEndpointAssociation.yaml @@ -0,0 +1,122 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- !ruby/object:Api::Resource +name: 'FirewallEndpointAssociation' +base_url: '{{parent}}/locations/{{location}}/firewallEndpointAssociations' +create_url: '{{parent}}/locations/{{location}}/firewallEndpointAssociations?firewallEndpointId={{name}}' +self_link: '{{parent}}/locations/{{location}}/firewallEndpointAssociations/{{name}}' +min_version: beta +update_verb: :PATCH +update_mask: true +description: | + Firewall endpoint association links a firewall endpoint to a VPC network in + the same zone. After you define this association, Cloud Firewall forwards the + zonal workload traffic in your VPC network that requires layer 7 inspection to + the attached firewall endpoint. +references: + !ruby/object:Api::Resource::ReferenceLinks + api: 'https://cloud.google.com/firewall/docs/reference/network-security/rest/v1beta1/projects.locations.firewallEndpointAssociations#FirewallEndpointAssociation' + guides: + 'Firewall endpoint overview': 'https://cloud.google.com/firewall/docs/about-firewall-endpoints' + 'Create and associate firewall endpoints': 'https://cloud.google.com/firewall/docs/configure-firewall-endpoints' +async: !ruby/object:Api::OpAsync + include_project: true + operation: !ruby/object:Api::OpAsync::Operation + base_url: '{{op_id}}' + result: !ruby/object:Api::OpAsync::Result + resource_inside_response: true +import_format: [ + '{{%parent}}/locations/{{location}}/firewallEndpointAssociations/{{name}}' +] +examples: + - !ruby/object:Provider::Terraform::Examples + name: 'network_security_firewall_endpoint_association_basic' + primary_resource_id: 'default' + # Handwritten test will take care of creates and updates. + # Firewall endpoint association creation is subjet to firewall endpoint creation which is long and expensive. + skip_test: true + min_version: beta + vars: + resource_name_prefix: 'my-firewall-endpoint' + test_env_vars: + org_id: :ORG_ID + project: :PROJECT_NAME +parameters: + - !ruby/object:Api::Type::String + name: 'name' + required: true + immutable: true + url_param_only: true + description: | + The name of the firewall endpoint association resource. + - !ruby/object:Api::Type::String + name: 'location' + required: true + immutable: true + description: | + The location (zone) of the firewall endpoint association. + url_param_only: true + - !ruby/object:Api::Type::String + name: 'parent' + description: | + The name of the parent this firewall endpoint association belongs to. + Format: projects/{project_id}. + immutable: true + url_param_only: true +properties: + - !ruby/object:Api::Type::String + name: 'firewallEndpoint' + required: true + description: | + The URL of the firewall endpoint that is being associated. + - !ruby/object:Api::Type::String + name: 'network' + required: true + description: | + The URL of the network that is being associated. + - !ruby/object:Api::Type::String + name: 'tlsInspectionPolicy' + description: | + The URL of the TlsInspectionPolicy that is being associated. + - !ruby/object:Api::Type::KeyValueLabels + name: 'labels' + description: | + A map of key/value label pairs to assign to the resource. + - !ruby/object:Api::Type::String + name: 'selfLink' + description: | + Server-defined URL of this resource. + output: true + - !ruby/object:Api::Type::Time + name: 'createTime' + description: Time the firewall endpoint was created in UTC. + output: true + - !ruby/object:Api::Type::Time + name: 'updateTime' + description: Time the firewall endpoint was updated in UTC. + output: true + - !ruby/object:Api::Type::Boolean + name: 'reconciling' + description: | + Whether reconciling is in progress, recommended per https://google.aip.dev/128. + output: true + - !ruby/object:Api::Type::Enum + name: 'state' + description: The current state of the endpoint. + output: true + values: + - :ACTIVE + - :CREATING + - :DELETING + - :INACTIVE diff --git a/mmv1/products/notebooks/Instance.yaml b/mmv1/products/notebooks/Instance.yaml index b5fb92b0c1b1..613c50d70fab 100644 --- a/mmv1/products/notebooks/Instance.yaml +++ b/mmv1/products/notebooks/Instance.yaml @@ -393,6 +393,7 @@ properties: The Compute Engine tags to add to instance. item_type: Api::Type::String default_from_api: true + diff_suppress_func: NotebooksInstanceTagsDiffSuppress - !ruby/object:Api::Type::KeyValuePairs name: 'metadata' description: | diff --git a/mmv1/templates/terraform/constants/notebooks_instance.go b/mmv1/templates/terraform/constants/notebooks_instance.go index 230d2aece282..b1c47a704ffa 100644 --- a/mmv1/templates/terraform/constants/notebooks_instance.go +++ b/mmv1/templates/terraform/constants/notebooks_instance.go @@ -3,8 +3,22 @@ var NotebooksInstanceProvidedScopes = []string{ "https://www.googleapis.com/auth/userinfo.email", } +var NotebooksInstanceProvidedTags = []string{ + "deeplearning-vm", + "notebook-instance", +} + func NotebooksInstanceScopesDiffSuppress(_, _, _ string, d *schema.ResourceData) bool { - old, new := d.GetChange("service_account_scopes") + return NotebooksDiffSuppressTemplate("service_account_scopes", NotebooksInstanceProvidedScopes, d) +} + +func NotebooksInstanceTagsDiffSuppress(_, _, _ string, d *schema.ResourceData) bool { + return NotebooksDiffSuppressTemplate("tags", NotebooksInstanceProvidedTags, d) +} + +func NotebooksDiffSuppressTemplate(field string, defaults []string, d *schema.ResourceData) bool { + old, new := d.GetChange(field) + oldValue := old.([]interface{}) newValue := new.([]interface{}) oldValueList := []string{} @@ -17,7 +31,7 @@ func NotebooksInstanceScopesDiffSuppress(_, _, _ string, d *schema.ResourceData) for _, item := range newValue { newValueList = append(newValueList,item.(string)) } - newValueList= append(newValueList,NotebooksInstanceProvidedScopes...) + newValueList= append(newValueList,defaults...) sort.Strings(oldValueList) sort.Strings(newValueList) diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_granular_controls.tf.erb b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_granular_controls.tf.erb new file mode 100644 index 000000000000..728b3a87ca83 --- /dev/null +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_granular_controls.tf.erb @@ -0,0 +1,59 @@ +resource "google_access_context_manager_access_policy" "access-policy" { + parent = "organizations/123456789" + title = "Policy with Granular Controls Group Support" +} + +resource "google_access_context_manager_service_perimeter" "test-access" { + parent = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}" + name = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}/servicePerimeters/%s" + title = "%s" + perimeter_type = "PERIMETER_TYPE_REGULAR" + status { + restricted_services = ["bigquery.googleapis.com", "storage.googleapis.com"] + + vpc_accessible_services { + enable_restriction = true + allowed_services = ["bigquery.googleapis.com", "storage.googleapis.com"] + } + + ingress_policies { + ingress_from { + sources { + access_level = google_access_context_manager_access_level.test-access.name + } + identities = ["group:database-admins@google.com"] + identities = ["principal://iam.googleapis.com/locations/global/workforcePools/1234/subject/janedoe"] + identities = ["principalSet://iam.googleapis.com/locations/global/workforcePools/1234/*"] + } + + ingress_to { + resources = [ "*" ] + operations { + service_name = "storage.googleapis.com" + + method_selectors { + method = "google.storage.objects.create" + } + } + } + } + + egress_policies { + egress_from { + identities = ["group:database-admins@google.com"] + identities = ["principal://iam.googleapis.com/locations/global/workforcePools/1234/subject/janedoe"] + identities = ["principalSet://iam.googleapis.com/locations/global/workforcePools/1234/*"] + } + egress_to { + resources = [ "*" ] + operations { + service_name = "storage.googleapis.com" + + method_selectors { + method = "google.storage.objects.create" + } + } + } + } + } +} diff --git a/mmv1/templates/terraform/examples/apphub_service_basic.tf.erb b/mmv1/templates/terraform/examples/apphub_service_basic.tf.erb new file mode 100644 index 000000000000..f62288859da8 --- /dev/null +++ b/mmv1/templates/terraform/examples/apphub_service_basic.tf.erb @@ -0,0 +1,110 @@ +resource "google_apphub_application" "application" { + location = "us-central1" + application_id = "<%= ctx[:vars]['application_id'] %>" + scope { + type = "REGIONAL" + } +} + +resource "google_project" "service_project" { + project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + name = "Service Project" + org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" +} + +# Enable Compute API +resource "google_project_service" "compute_service_project" { + project = google_project.service_project.project_id + service = "compute.googleapis.com" +} + +resource "time_sleep" "wait_120s" { + depends_on = [google_project_service.compute_service_project] + + create_duration = "120s" +} + +resource "google_apphub_service_project_attachment" "service_project_attachment" { + service_project_attachment_id = google_project.service_project.project_id + depends_on = [time_sleep.wait_120s] +} + +# discovered service block +data "google_apphub_discovered_service" "catalog-service" { + provider = google + location = "us-central1" + service_uri = "//compute.googleapis.com/${google_compute_forwarding_rule.forwarding_rule.id}" + depends_on = [google_apphub_service_project_attachment.service_project_attachment, time_sleep.wait_120s_for_resource_ingestion] +} + +resource "time_sleep" "wait_120s_for_resource_ingestion" { + depends_on = [google_compute_forwarding_rule.forwarding_rule] + create_duration = "120s" +} + +resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + application_id = google_apphub_application.application.application_id + service_id = google_compute_forwarding_rule.forwarding_rule.name + discovered_service = data.google_apphub_discovered_service.catalog-service.name +} + + +#creates service + + +# VPC network +resource "google_compute_network" "ilb_network" { + name = "<%= ctx[:vars]['ilb_network'] %>" + project = google_project.service_project.project_id + auto_create_subnetworks = false + depends_on = [time_sleep.wait_120s] +} + + +# backend subnet +resource "google_compute_subnetwork" "ilb_subnet" { + name = "<%= ctx[:vars]['ilb_subnet'] %>" + project = google_project.service_project.project_id + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = google_compute_network.ilb_network.id +} + +# forwarding rule +resource "google_compute_forwarding_rule" "forwarding_rule" { + name ="<%= ctx[:vars]['forwarding_rule'] %>" + project = google_project.service_project.project_id + region = "us-central1" + ip_version = "IPV4" + load_balancing_scheme = "INTERNAL" + all_ports = true + backend_service = google_compute_region_backend_service.backend.id + network = google_compute_network.ilb_network.id + subnetwork = google_compute_subnetwork.ilb_subnet.id +} + + + +# backend service +resource "google_compute_region_backend_service" "backend" { + name = "<%= ctx[:vars]['backend_service'] %>" + project = google_project.service_project.project_id + region = "us-central1" + health_checks = [google_compute_health_check.default.id] +} + +# health check +resource "google_compute_health_check" "default" { + name = "<%= ctx[:vars]['health_check'] %>" + project = google_project.service_project.project_id + check_interval_sec = 1 + timeout_sec = 1 + tcp_health_check { + port = "80" + } + depends_on = [time_sleep.wait_120s] +} + + diff --git a/mmv1/templates/terraform/examples/apphub_service_full.tf.erb b/mmv1/templates/terraform/examples/apphub_service_full.tf.erb new file mode 100644 index 000000000000..2a0bdde9ed19 --- /dev/null +++ b/mmv1/templates/terraform/examples/apphub_service_full.tf.erb @@ -0,0 +1,132 @@ +resource "google_apphub_application" "application" { + location = "us-central1" + application_id = "<%= ctx[:vars]['application_id'] %>" + scope { + type = "REGIONAL" + } +} + +resource "google_project" "service_project" { + project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + name = "Service Project" + org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" +} + +# Enable Compute API +resource "google_project_service" "compute_service_project" { + project = google_project.service_project.project_id + service = "compute.googleapis.com" +} + +resource "time_sleep" "wait_120s" { + depends_on = [google_project_service.compute_service_project] + + create_duration = "120s" +} + +resource "google_apphub_service_project_attachment" "service_project_attachment" { + service_project_attachment_id = google_project.service_project.project_id + depends_on = [time_sleep.wait_120s] +} + +# discovered service block +data "google_apphub_discovered_service" "catalog-service" { + provider = google + location = "us-central1" + service_uri = "//compute.googleapis.com/${google_compute_forwarding_rule.forwarding_rule.id}" + depends_on = [google_apphub_service_project_attachment.service_project_attachment, time_sleep.wait_120s_for_resource_ingestion] +} + +resource "time_sleep" "wait_120s_for_resource_ingestion" { + depends_on = [google_compute_forwarding_rule.forwarding_rule] + create_duration = "120s" +} + +resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + application_id = google_apphub_application.application.application_id + service_id = google_compute_forwarding_rule.forwarding_rule.name + discovered_service = data.google_apphub_discovered_service.catalog-service.name + display_name = "<%= ctx[:vars]['display_name'] %>" + description = "<%= ctx[:vars]['description'] %>" + attributes { + environment { + type = "STAGING" + } + criticality { + type = "MISSION_CRITICAL" + } + business_owners { + display_name = "<%= ctx[:vars]['business_name'] %>" + email = "<%= ctx[:vars]['business_email'] %>" + } + developer_owners { + display_name = "<%= ctx[:vars]['developer_name'] %>" + email = "<%= ctx[:vars]['developer_email'] %>" + } + operator_owners { + display_name = "<%= ctx[:vars]['operator_name'] %>" + email = "<%= ctx[:vars]['operator_email'] %>" + } + } +} + + +#creates service + + +# VPC network +resource "google_compute_network" "ilb_network" { + name = "<%= ctx[:vars]['ilb_network'] %>" + project = google_project.service_project.project_id + auto_create_subnetworks = false + depends_on = [time_sleep.wait_120s] +} + + +# backend subnet +resource "google_compute_subnetwork" "ilb_subnet" { + name = "<%= ctx[:vars]['ilb_subnet'] %>" + project = google_project.service_project.project_id + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = google_compute_network.ilb_network.id +} + +# forwarding rule +resource "google_compute_forwarding_rule" "forwarding_rule" { + name ="<%= ctx[:vars]['forwarding_rule'] %>" + project = google_project.service_project.project_id + region = "us-central1" + ip_version = "IPV4" + load_balancing_scheme = "INTERNAL" + all_ports = true + backend_service = google_compute_region_backend_service.backend.id + network = google_compute_network.ilb_network.id + subnetwork = google_compute_subnetwork.ilb_subnet.id +} + + + +# backend service +resource "google_compute_region_backend_service" "backend" { + name = "<%= ctx[:vars]['backend_service'] %>" + project = google_project.service_project.project_id + region = "us-central1" + health_checks = [google_compute_health_check.default.id] +} + +# health check +resource "google_compute_health_check" "default" { + name = "<%= ctx[:vars]['health_check'] %>" + project = google_project.service_project.project_id + check_interval_sec = 1 + timeout_sec = 1 + tcp_health_check { + port = "80" + } + depends_on = [time_sleep.wait_120s] +} + + diff --git a/mmv1/templates/terraform/examples/apphub_workload_basic.tf.erb b/mmv1/templates/terraform/examples/apphub_workload_basic.tf.erb new file mode 100644 index 000000000000..0c9a57b3ce94 --- /dev/null +++ b/mmv1/templates/terraform/examples/apphub_workload_basic.tf.erb @@ -0,0 +1,126 @@ +resource "google_apphub_application" "application" { + location = "us-central1" + application_id = "<%= ctx[:vars]['application_id'] %>" + scope { + type = "REGIONAL" + } +} + +resource "google_project" "service_project" { + project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + name = "Service Project" + org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" +} + +# Enable Compute API +resource "google_project_service" "compute_service_project" { + project = google_project.service_project.project_id + service = "compute.googleapis.com" +} + +resource "time_sleep" "wait_120s" { + depends_on = [google_project_service.compute_service_project] + + create_duration = "120s" +} + +resource "google_apphub_service_project_attachment" "service_project_attachment" { + service_project_attachment_id = google_project.service_project.project_id + depends_on = [time_sleep.wait_120s] +} + + +# Discovered workload +data "google_apphub_discovered_workload" "catalog-workload" { + location = "us-central1" + workload_uri = "${replace(google_compute_region_instance_group_manager.mig.instance_group, "https://www.googleapis.com/compute/v1", "//compute.googleapis.com")}" + depends_on = [time_sleep.wait_120s_for_resource_ingestion] +} + +resource "time_sleep" "wait_120s_for_resource_ingestion" { + depends_on = [google_compute_region_instance_group_manager.mig] + create_duration = "120s" +} + +resource "google_apphub_workload" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + application_id = google_apphub_application.application.application_id + workload_id = google_compute_region_instance_group_manager.mig.name + discovered_workload = data.google_apphub_discovered_workload.catalog-workload.name +} + +#Workload creation + + +# VPC network +resource "google_compute_network" "ilb_network" { + name = "<%= ctx[:vars]['ilb_network'] %>" + project = google_project.service_project.project_id + auto_create_subnetworks = false + depends_on = [time_sleep.wait_120s] +} + +# backend subnet +resource "google_compute_subnetwork" "ilb_subnet" { + name = "<%= ctx[:vars]['ilb_subnet'] %>" + project = google_project.service_project.project_id + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = google_compute_network.ilb_network.id +} + +# instance template +resource "google_compute_instance_template" "instance_template" { + name = "<%= ctx[:vars]['instance_template'] %>" + project = google_project.service_project.project_id + machine_type = "e2-small" + tags = ["http-server"] + network_interface { + network = google_compute_network.ilb_network.id + subnetwork = google_compute_subnetwork.ilb_subnet.id + access_config { + # add external ip to fetch packages + } + } + disk { + source_image = "debian-cloud/debian-10" + auto_delete = true + boot = true + } + # install nginx and serve a simple web page + metadata = { + startup-script = <<-EOF1 + #! /bin/bash + set -euo pipefail + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y nginx-light jq + NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") + IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") + METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') + cat < /var/www/html/index.html +
+      Name: $NAME
+      IP: $IP
+      Metadata: $METADATA
+      
+ EOF + EOF1 + } + lifecycle { + create_before_destroy = true + } +} + +resource "google_compute_region_instance_group_manager" "mig" { + name = "<%= ctx[:vars]['mig'] %>" + project = google_project.service_project.project_id + region = "us-central1" + version { + instance_template = google_compute_instance_template.instance_template.id + name = "primary" + } + base_instance_name = "vm" + target_size = 2 +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/apphub_workload_full.tf.erb b/mmv1/templates/terraform/examples/apphub_workload_full.tf.erb new file mode 100644 index 000000000000..a81dd6326175 --- /dev/null +++ b/mmv1/templates/terraform/examples/apphub_workload_full.tf.erb @@ -0,0 +1,147 @@ +resource "google_apphub_application" "application" { + location = "us-central1" + application_id = "<%= ctx[:vars]['application_id'] %>" + scope { + type = "REGIONAL" + } +} + +resource "google_project" "service_project" { + project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + name = "Service Project" + org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" +} + +# Enable Compute API +resource "google_project_service" "compute_service_project" { + project = google_project.service_project.project_id + service = "compute.googleapis.com" +} + +resource "time_sleep" "wait_120s" { + depends_on = [google_project_service.compute_service_project] + + create_duration = "120s" +} + +resource "google_apphub_service_project_attachment" "service_project_attachment" { + service_project_attachment_id = google_project.service_project.project_id + depends_on = [time_sleep.wait_120s] +} + +# Discovered workload +data "google_apphub_discovered_workload" "catalog-workload" { + location = "us-central1" + workload_uri = "${replace(google_compute_region_instance_group_manager.mig.instance_group, "https://www.googleapis.com/compute/v1", "//compute.googleapis.com")}" + depends_on = [time_sleep.wait_120s_for_resource_ingestion] +} + +resource "time_sleep" "wait_120s_for_resource_ingestion" { + depends_on = [google_compute_region_instance_group_manager.mig] + create_duration = "120s" +} + +resource "google_apphub_workload" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + application_id = google_apphub_application.application.application_id + workload_id = google_compute_region_instance_group_manager.mig.name + discovered_workload = data.google_apphub_discovered_workload.catalog-workload.name + display_name = "<%= ctx[:vars]['display_name'] %>" + description = "<%= ctx[:vars]['description'] %>" + attributes { + environment { + type = "STAGING" + } + criticality { + type = "MISSION_CRITICAL" + } + business_owners { + display_name = "<%= ctx[:vars]['business_name'] %>" + email = "<%= ctx[:vars]['business_email'] %>" + } + developer_owners { + display_name = "<%= ctx[:vars]['developer_name'] %>" + email = "<%= ctx[:vars]['developer_email'] %>" + } + operator_owners { + display_name = "<%= ctx[:vars]['operator_name'] %>" + email = "<%= ctx[:vars]['operator_email'] %>" + } + } +} + +#Workload creation + + +# VPC network +resource "google_compute_network" "ilb_network" { + name = "<%= ctx[:vars]['ilb_network'] %>" + project = google_project.service_project.project_id + auto_create_subnetworks = false + depends_on = [time_sleep.wait_120s] +} + +# backend subnet +resource "google_compute_subnetwork" "ilb_subnet" { + name = "<%= ctx[:vars]['ilb_subnet'] %>" + project = google_project.service_project.project_id + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = google_compute_network.ilb_network.id +} + +# instance template +resource "google_compute_instance_template" "instance_template" { + name = "<%= ctx[:vars]['instance_template'] %>" + project = google_project.service_project.project_id + machine_type = "e2-small" + tags = ["http-server"] + network_interface { + network = google_compute_network.ilb_network.id + subnetwork = google_compute_subnetwork.ilb_subnet.id + access_config { + # add external ip to fetch packages + } + } + disk { + source_image = "debian-cloud/debian-10" + auto_delete = true + boot = true + } + # install nginx and serve a simple web page + metadata = { + startup-script = <<-EOF1 + #! /bin/bash + set -euo pipefail + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y nginx-light jq + NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") + IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") + METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') + cat < /var/www/html/index.html +
+      Name: $NAME
+      IP: $IP
+      Metadata: $METADATA
+      
+ EOF + EOF1 + } + lifecycle { + create_before_destroy = true + } +} + +resource "google_compute_region_instance_group_manager" "mig" { + name = "<%= ctx[:vars]['mig'] %>" + project = google_project.service_project.project_id + region = "us-central1" + version { + instance_template = google_compute_instance_template.instance_template.id + name = "primary" + } + base_instance_name = "vm" + target_size = 2 +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/network_security_firewall_endpoint_association_basic.tf.erb b/mmv1/templates/terraform/examples/network_security_firewall_endpoint_association_basic.tf.erb new file mode 100644 index 000000000000..ce6b59347058 --- /dev/null +++ b/mmv1/templates/terraform/examples/network_security_firewall_endpoint_association_basic.tf.erb @@ -0,0 +1,21 @@ +resource "google_network_security_firewall_endpoint" "<%= ctx[:primary_resource_id] %>" { + provider = google-beta + name = "<%= ctx[:vars]['resource_name_prefix'] %>" + parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + location = "us-central1-a" + + labels = { + foo = "bar" + } +} + +resource "google_network_security_firewall_endpoint_association" "<%= ctx[:primary_resource_id] %>_association" { + provider = google-beta + name = "<%= ctx[:vars]['resource_name_prefix'] %>-association" + parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + location = "us-central1-a" + + labels = { + foo = "bar" + } +} diff --git a/mmv1/templates/terraform/examples/notebook_instance_full.tf.erb b/mmv1/templates/terraform/examples/notebook_instance_full.tf.erb index 31f2af55ca3c..31de347bb0c6 100644 --- a/mmv1/templates/terraform/examples/notebook_instance_full.tf.erb +++ b/mmv1/templates/terraform/examples/notebook_instance_full.tf.erb @@ -34,6 +34,9 @@ resource "google_notebooks_instance" "<%= ctx[:primary_resource_id] %>" { "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/userinfo.email" ] + + tags = ["foo", "bar"] + disk_encryption = "CMEK" kms_key = "<%= ctx[:vars]['key_name'] %>" desired_state = "ACTIVE" diff --git a/mmv1/templates/terraform/examples/region_url_map_path_template_match.tf.erb b/mmv1/templates/terraform/examples/region_url_map_path_template_match.tf.erb new file mode 100644 index 000000000000..5a7008e1b80b --- /dev/null +++ b/mmv1/templates/terraform/examples/region_url_map_path_template_match.tf.erb @@ -0,0 +1,90 @@ +# [START cloudloadbalancing_url_map_path_template_match] +resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { + region = "us-central1" + + name = "<%= ctx[:vars]['url_map_name'] %>" + description = "a description" + + default_service = google_compute_region_backend_service.home-backend.id + + host_rule { + hosts = ["mysite.com"] + path_matcher = "mysite" + } + + path_matcher { + name = "mysite" + default_service = google_compute_region_backend_service.home-backend.id + + route_rules { + match_rules { + path_template_match = "/xyzwebservices/v2/xyz/users/{username=*}/carts/{cartid=**}" + } + service = google_compute_region_backend_service.cart-backend.id + priority = 1 + route_action { + url_rewrite { + path_template_rewrite = "/{username}-{cartid}/" + } + } + } + + route_rules { + match_rules { + path_template_match = "/xyzwebservices/v2/xyz/users/*/accountinfo/*" + } + service = google_compute_region_backend_service.user-backend.id + priority = 2 + } + } +} + +resource "google_compute_region_backend_service" "home-backend" { + region = "us-central1" + + name = "<%= ctx[:vars]['home_backend_service_name'] %>" + port_name = "http" + protocol = "HTTP" + timeout_sec = 10 + load_balancing_scheme = "EXTERNAL_MANAGED" + + health_checks = [google_compute_region_health_check.default.id] +} + +resource "google_compute_region_backend_service" "cart-backend" { + region = "us-central1" + + name = "<%= ctx[:vars]['cart_backend_service_name'] %>" + port_name = "http" + protocol = "HTTP" + timeout_sec = 10 + load_balancing_scheme = "EXTERNAL_MANAGED" + + health_checks = [google_compute_region_health_check.default.id] +} + +resource "google_compute_region_backend_service" "user-backend" { + region = "us-central1" + + name = "<%= ctx[:vars]['user_backend_service_name'] %>" + port_name = "http" + protocol = "HTTP" + timeout_sec = 10 + load_balancing_scheme = "EXTERNAL_MANAGED" + + health_checks = [google_compute_region_health_check.default.id] +} + +resource "google_compute_region_health_check" "default" { + region = "us-central1" + + name = "<%= ctx[:vars]['health_check_name'] %>" + check_interval_sec = 1 + timeout_sec = 1 + http_health_check { + port = 80 + request_path = "/" + } +} + +# [END cloudloadbalancing_url_map_path_template_match] diff --git a/mmv1/third_party/terraform/.go-version b/mmv1/third_party/terraform/.go-version index 5fb5a6b4f547..d2ab029d32c6 100644 --- a/mmv1/third_party/terraform/.go-version +++ b/mmv1/third_party/terraform/.go-version @@ -1 +1 @@ -1.20 +1.21 diff --git a/mmv1/third_party/terraform/.teamcity/USE_CONFIG_WITH_TEAMCITY.md b/mmv1/third_party/terraform/.teamcity/USE_CONFIG_WITH_TEAMCITY.md index 08bf66acb3a3..ee0d3c3a0cef 100644 --- a/mmv1/third_party/terraform/.teamcity/USE_CONFIG_WITH_TEAMCITY.md +++ b/mmv1/third_party/terraform/.teamcity/USE_CONFIG_WITH_TEAMCITY.md @@ -8,6 +8,10 @@ Contents: * [Editing configuration files](#editing-configuration-files) * [Pushing configuration changes to TeamCity](#pushing-configuration-changes-to-teamcity) +## Permissions + +Actions in this file require Project Administrator permissions - ask for these if you are unsure if you have them. + ## Using configuration files for the first time in a project diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_per_package.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_per_package.kt index 395dc4da4a9c..f9be546f7eec 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_per_package.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_per_package.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package builds diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_sweepers.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_sweepers.kt index 5d31f45db4bf..28ff7b99cdd0 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_sweepers.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_sweepers.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package builds diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_vcr_recording.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_vcr_recording.kt index d647e3294737..134070d909ae 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_vcr_recording.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_configuration_vcr_recording.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package builds diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_features.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_features.kt index 50734428b55f..ab2195c5111f 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_features.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_features.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package builds diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_parameters.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_parameters.kt index 7641bc858592..9786a95a44b4 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_parameters.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_parameters.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package builds diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt index 4682f1240eb9..7286b2b82f7c 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package builds diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt index 95127f85e439..c7a119b0a158 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_triggers.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package builds diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/vcr_build_steps.kt b/mmv1/third_party/terraform/.teamcity/components/builds/vcr_build_steps.kt index 4453c4fd73a8..05bcb261e901 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/vcr_build_steps.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/vcr_build_steps.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package builds diff --git a/mmv1/third_party/terraform/.teamcity/components/constants.kt b/mmv1/third_party/terraform/.teamcity/components/constants.kt index 7ecf16baa052..ba1cd010f3ab 100644 --- a/mmv1/third_party/terraform/.teamcity/components/constants.kt +++ b/mmv1/third_party/terraform/.teamcity/components/constants.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. // Provider name that matches the name in the Registry const val ProviderNameGa = "google" diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/packages.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/packages.kt index 2e4b11ffb516..8c5cdb3d4970 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/packages.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/packages.kt @@ -3,7 +3,15 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. + +/* + NOTE: This file is manually curated - any new packages added to the provider codebase will need to be accompanied with a change in this file. + When adding new entires make sure to ensure the path value is correct for TPG or TPGB + e.g. "path" to "./google/envvar" + versus + "path" to "./google-beta/envvar" +*/ package generated diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/per_service_parallelism.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/per_service_parallelism.kt index a57270c35250..175b063f26ac 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/per_service_parallelism.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/per_service_parallelism.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package generated diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt index 443987885a6f..13510630f136 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt @@ -3,7 +3,15 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. + +/* + NOTE: This file is manually curated - any new service packages added to the provider codebase will need to be accompanied with a change in this file. + When adding new entires make sure to ensure the path value is correct for TPG or TPGB + + For this file, services_beta.kt, please ensure paths are like: + "./google-beta/services/accessapproval" +*/ package generated @@ -178,6 +186,11 @@ var ServicesListBeta = mapOf( "displayName" to "Cloudids", "path" to "./google-beta/services/cloudids" ), + "cloudquotas" to mapOf( + "name" to "cloudquotas", + "displayName" to "Cloudquotas", + "path" to "./google-beta/services/cloudquotas" + ), "cloudrun" to mapOf( "name" to "cloudrun", "displayName" to "Cloudrun", @@ -693,4 +706,4 @@ var ServicesListBeta = mapOf( "displayName" to "Workstations", "path" to "./google-beta/services/workstations" ) -) \ No newline at end of file +) diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt index 08ce6c2ee82f..f4b303eccc69 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt @@ -3,7 +3,15 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. + +/* + NOTE: This file is manually curated - any new service packages added to the provider codebase will need to be accompanied with a change in this file. + When adding new entires make sure to ensure the path value is correct for TPG or TPGB + + For this file, services_ga.kt, please ensure paths are like: + "./google/services/accessapproval" +*/ package generated @@ -178,6 +186,11 @@ var ServicesListGa = mapOf( "displayName" to "Cloudids", "path" to "./google/services/cloudids" ), + "cloudquotas" to mapOf( + "name" to "cloudquotas", + "displayName" to "Cloudquotas", + "path" to "./google/services/cloudquotas" + ), "cloudrun" to mapOf( "name" to "cloudrun", "displayName" to "Cloudrun", @@ -688,4 +701,4 @@ var ServicesListGa = mapOf( "displayName" to "Workstations", "path" to "./google/services/workstations" ) -) \ No newline at end of file +) diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-provider-functions.kt b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-provider-functions.kt index 3c1752e227f7..a795ef342fb4 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-provider-functions.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/feature_branches/FEATURE-BRANCH-provider-functions.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package projects.feature_branches diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt b/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt index 3824dcbfa97d..72233a701534 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/google_beta_subproject.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package projects diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt b/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt index da23e7767c9e..19b4395d1c29 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/google_ga_subproject.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package projects diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/project_sweeper_project.kt b/mmv1/third_party/terraform/.teamcity/components/projects/project_sweeper_project.kt index 732822a52ff6..2a484f583f9b 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/project_sweeper_project.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/project_sweeper_project.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package projects diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt b/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt index c26ed498edd4..9ca0a89b446a 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/reused/mm_upstream.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package projects.reused diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt b/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt index 6fda2b7b7ab1..cb6455e5f752 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/reused/nightly_tests.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package projects.reused diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/reused/vcr_recording.kt b/mmv1/third_party/terraform/.teamcity/components/projects/reused/vcr_recording.kt index c9916b27a722..8df65299015f 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/reused/vcr_recording.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/reused/vcr_recording.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package projects.reused diff --git a/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt b/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt index a78260dfe650..a05e236a5a36 100644 --- a/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt +++ b/mmv1/third_party/terraform/.teamcity/components/projects/root_project.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package projects diff --git a/mmv1/third_party/terraform/.teamcity/components/unique_id.kt b/mmv1/third_party/terraform/.teamcity/components/unique_id.kt index 00635a8f783c..b9a56d762186 100644 --- a/mmv1/third_party/terraform/.teamcity/components/unique_id.kt +++ b/mmv1/third_party/terraform/.teamcity/components/unique_id.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. fun replaceCharsId(id: String): String{ var newId = id.replace("-", "") diff --git a/mmv1/third_party/terraform/.teamcity/components/vcs_roots/vcs_roots.kt b/mmv1/third_party/terraform/.teamcity/components/vcs_roots/vcs_roots.kt index 3ee70f25f1ef..0e696f91fd2f 100644 --- a/mmv1/third_party/terraform/.teamcity/components/vcs_roots/vcs_roots.kt +++ b/mmv1/third_party/terraform/.teamcity/components/vcs_roots/vcs_roots.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package vcs_roots diff --git a/mmv1/third_party/terraform/.teamcity/settings.kts b/mmv1/third_party/terraform/.teamcity/settings.kts index 7e748003d8f7..4e49b4abccb8 100644 --- a/mmv1/third_party/terraform/.teamcity/settings.kts +++ b/mmv1/third_party/terraform/.teamcity/settings.kts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. import projects.googleCloudRootProject import builds.AllContextParameters diff --git a/mmv1/third_party/terraform/.teamcity/tests/build_configuration_features.kt b/mmv1/third_party/terraform/.teamcity/tests/build_configuration_features.kt index ffde72f5ae79..7e3cc5b6ff58 100644 --- a/mmv1/third_party/terraform/.teamcity/tests/build_configuration_features.kt +++ b/mmv1/third_party/terraform/.teamcity/tests/build_configuration_features.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package tests diff --git a/mmv1/third_party/terraform/.teamcity/tests/context_parameters.kt b/mmv1/third_party/terraform/.teamcity/tests/context_parameters.kt index c9f373786be8..373ad78e29fe 100644 --- a/mmv1/third_party/terraform/.teamcity/tests/context_parameters.kt +++ b/mmv1/third_party/terraform/.teamcity/tests/context_parameters.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package tests diff --git a/mmv1/third_party/terraform/.teamcity/tests/nightly_tests_project.kt b/mmv1/third_party/terraform/.teamcity/tests/nightly_tests_project.kt index af3d7b8a9b24..fbdb4d9bd6d3 100644 --- a/mmv1/third_party/terraform/.teamcity/tests/nightly_tests_project.kt +++ b/mmv1/third_party/terraform/.teamcity/tests/nightly_tests_project.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package tests diff --git a/mmv1/third_party/terraform/.teamcity/tests/sweepers.kt b/mmv1/third_party/terraform/.teamcity/tests/sweepers.kt index b05e38573e96..67940004bc68 100644 --- a/mmv1/third_party/terraform/.teamcity/tests/sweepers.kt +++ b/mmv1/third_party/terraform/.teamcity/tests/sweepers.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package tests diff --git a/mmv1/third_party/terraform/.teamcity/tests/test_utils.kt b/mmv1/third_party/terraform/.teamcity/tests/test_utils.kt index 576e4b735c02..162a38eccf5c 100644 --- a/mmv1/third_party/terraform/.teamcity/tests/test_utils.kt +++ b/mmv1/third_party/terraform/.teamcity/tests/test_utils.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package tests diff --git a/mmv1/third_party/terraform/.teamcity/tests/vcs_roots.kt b/mmv1/third_party/terraform/.teamcity/tests/vcs_roots.kt index a46abc0a89af..ae56484af86e 100644 --- a/mmv1/third_party/terraform/.teamcity/tests/vcs_roots.kt +++ b/mmv1/third_party/terraform/.teamcity/tests/vcs_roots.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -// This file is controlled by MMv1, any changes made here will be overwritten +// This file is maintained in the GoogleCloudPlatform/magic-modules repository and copied into the downstream provider repositories. Any changes to this file in the downstream will be overwritten. package tests diff --git a/mmv1/third_party/terraform/go.mod.erb b/mmv1/third_party/terraform/go.mod.erb index fa30a092113d..812e2da3e939 100644 --- a/mmv1/third_party/terraform/go.mod.erb +++ b/mmv1/third_party/terraform/go.mod.erb @@ -1,7 +1,7 @@ <% autogen_exception -%> module github.com/hashicorp/terraform-provider-google -go 1.20 +go 1.21 require ( cloud.google.com/go/bigtable v1.19.0 diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index 63d8188cf48c..1cfc99eed33f 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -14,10 +14,12 @@ cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWO cloud.google.com/go/longrunning v0.5.5 h1:GOE6pZFdSrTb4KAiKnXsJBtlE6mEyaW44oKyMILWnOg= cloud.google.com/go/longrunning v0.5.5/go.mod h1:WV2LAxD8/rg5Z1cNW6FJ/ZpX4E4VnDnoTk0yawPBB7s= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.62.0 h1:s4Y6r6RrYLBnqosGXLwR0h1Gqr0VT3wgd6rqvHsD9OE= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.62.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.63.0 h1:eSOBYPZVnU2fZul9sAJFGLVCgv6stNVKkmsogKF7UeY= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.63.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= @@ -28,6 +30,7 @@ github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJE github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -47,12 +50,14 @@ github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbi github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/creachadair/staticfile v0.1.2/go.mod h1:a3qySzCIXEprDGxk6tSxSI+dBBdLzqeBOMhZ+o2d3pM= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -70,8 +75,11 @@ github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4/go.mod h1:GeIq9qoE github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92 h1:EipXK6U05IQ2wtuFRn4k3h0+2lXypzItoXGVyf4r9Io= github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92/go.mod h1:w9RqFVO2BM3xwWEcAB8Fwp0OviTBBEiRmSBDfbXnd3w= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git/v5 v5.10.1 h1:tu8/D8i+TWxgKpzQ3Vc43e+kkhXqtsZCKI/egajKnxk= +github.com/go-git/go-git/v5 v5.10.1/go.mod h1:uEuHjxkHap8kAl//V5F/nNWwqIYtP/402ddd05mp0wg= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -81,6 +89,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -106,6 +115,7 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -177,8 +187,11 @@ github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv2 github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -214,15 +227,18 @@ github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= +github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -234,6 +250,7 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -242,6 +259,7 @@ github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21 github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= @@ -258,6 +276,7 @@ go.opentelemetry.io/otel v1.23.0/go.mod h1:YCycw9ZeKhcJFrb34iVSkyT0iczq/zYDtZYFu go.opentelemetry.io/otel/metric v1.23.0 h1:pazkx7ss4LFVVYSxYew7L5I6qvLXHA0Ap2pwV+9Cnpo= go.opentelemetry.io/otel/metric v1.23.0/go.mod h1:MqUW2X2a6Q8RN96E2/nqNoT+z9BSms20Jb7Bbp+HiTo= go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= go.opentelemetry.io/otel/trace v1.23.0 h1:37Ik5Ib7xfYVb4V1UtnT97T1jI+AoIYkJyPkuL4iJgI= go.opentelemetry.io/otel/trace v1.23.0/go.mod h1:GSGTbIClEsuZrGIzoEHqsVfxgn5UkggkflQwDScNUsk= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -336,6 +355,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -359,6 +379,7 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -404,6 +425,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -413,5 +435,4 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.63.0 h1:eSOBYPZVnU2fZul9sAJFGLVCgv6stNVKkmsogKF7UeY= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.63.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.erb b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.erb index 33109889347c..f58f2b57e660 100644 --- a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.erb +++ b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.erb @@ -15,6 +15,9 @@ import ( "github.com/hashicorp/terraform-provider-google/google/services/dataflow" "github.com/hashicorp/terraform-provider-google/google/services/servicenetworking" "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" + <% if version == 'ga' -%> // https://github.com/hashicorp/terraform-provider-google/issues/15633 for details + "github.com/hashicorp/terraform-provider-google/google/services/cloudquotas" + <% end -%> ) // Datasources @@ -27,7 +30,9 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_alloydb_locations": alloydb.DataSourceAlloydbLocations(), "google_alloydb_supported_database_flags": alloydb.DataSourceAlloydbSupportedDatabaseFlags(), "google_artifact_registry_repository": artifactregistry.DataSourceArtifactRegistryRepository(), + "google_apphub_discovered_workload": apphub.DataSourceApphubDiscoveredWorkload(), "google_app_engine_default_service_account": appengine.DataSourceGoogleAppEngineDefaultServiceAccount(), + "google_apphub_discovered_service": apphub.DataSourceApphubDiscoveredService(), <% unless version == 'ga' -%> "google_backup_dr_management_server": backupdr.DataSourceGoogleCloudBackupDRService(), <% end -%> @@ -47,6 +52,7 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_cloud_identity_groups": cloudidentity.DataSourceGoogleCloudIdentityGroups(), "google_cloud_identity_group_memberships": cloudidentity.DataSourceGoogleCloudIdentityGroupMemberships(), "google_cloud_identity_group_lookup": cloudidentity.DataSourceGoogleCloudIdentityGroupLookup(), + "google_cloud_quotas_quota_info": cloudquotas.DataSourceGoogleCloudQuotasQuotaInfo(), "google_cloud_run_locations": cloudrun.DataSourceGoogleCloudRunLocations(), "google_cloud_run_service": cloudrun.DataSourceGoogleCloudRunService(), "google_cloud_run_v2_job": cloudrunv2.DataSourceGoogleCloudRunV2Job(), diff --git a/mmv1/third_party/terraform/scripts/go.mod b/mmv1/third_party/terraform/scripts/go.mod index 8db8f05e9c85..0265d3bcb20a 100644 --- a/mmv1/third_party/terraform/scripts/go.mod +++ b/mmv1/third_party/terraform/scripts/go.mod @@ -1,3 +1,3 @@ module github.com/hashicorp/terraform-provider-google/scripts -go 1.20 +go 1.21 diff --git a/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_service.go b/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_service.go new file mode 100644 index 000000000000..3efee7c6b6ae --- /dev/null +++ b/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_service.go @@ -0,0 +1,171 @@ +package apphub + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" +) + +func DataSourceApphubDiscoveredService() *schema.Resource { + return &schema.Resource{ + Read: dataSourceApphubDiscoveredServiceRead, + Schema: map[string]*schema.Schema{ + "project": { + Type: schema.TypeString, + Optional: true, + }, + "location": { + Type: schema.TypeString, + Required: true, + }, + "service_uri": { + Type: schema.TypeString, + Required: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "service_reference": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "uri": { + Type: schema.TypeString, + Computed: true, + }, + "path": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "service_properties": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "gcp_project": { + Type: schema.TypeString, + Computed: true, + }, + "location": { + Type: schema.TypeString, + Computed: true, + }, + "zone": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceApphubDiscoveredServiceRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*transport_tpg.Config) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + if err != nil { + return err + } + + url, err := tpgresource.ReplaceVars(d, config, "{{ApphubBasePath}}projects/{{project}}/locations/{{location}}/discoveredServices:lookup?uri={{service_uri}}") + if err != nil { + return err + } + + billingProject := "" + + // err == nil indicates that the billing_project value was found + if bp, err := tpgresource.GetBillingProject(d, config); err == nil { + billingProject = bp + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: userAgent, + }) + + if err != nil { + return transport_tpg.HandleDataSourceNotFoundError(err, d, fmt.Sprintf("ApphubDiscoveredService %q", d.Id()), url) + } + + if err := d.Set("name", flattenApphubDiscoveredServiceName(res["discoveredService"].(map[string]interface{})["name"], d, config)); err != nil { + return fmt.Errorf("Error setting service name: %s", err) + } + + if err := d.Set("service_reference", flattenApphubDiscoveredServiceReference(res["discoveredService"].(map[string]interface{})["serviceReference"], d, config)); err != nil { + return fmt.Errorf("Error setting service reference: %s", err) + } + + if err := d.Set("service_properties", flattenApphubDiscoveredServiceProperties(res["discoveredService"].(map[string]interface{})["serviceProperties"], d, config)); err != nil { + return fmt.Errorf("Error setting service properties: %s", err) + } + + d.SetId(res["discoveredService"].(map[string]interface{})["name"].(string)) + + return nil + +} + +func flattenApphubDiscoveredServiceReference(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["uri"] = flattenApphubDiscoveredServiceDataUri(original["uri"], d, config) + transformed["path"] = flattenApphubDiscoveredServiceDataPath(original["path"], d, config) + return []interface{}{transformed} +} + +func flattenApphubDiscoveredServiceProperties(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["gcp_project"] = flattenApphubDiscoveredServiceDataGcpProject(original["gcpProject"], d, config) + transformed["location"] = flattenApphubDiscoveredServiceDataLocation(original["location"], d, config) + transformed["zone"] = flattenApphubDiscoveredServiceDataZone(original["zone"], d, config) + return []interface{}{transformed} +} + +func flattenApphubDiscoveredServiceName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredServiceDataUri(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredServiceDataPath(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredServiceDataGcpProject(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredServiceDataLocation(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredServiceDataZone(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} diff --git a/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_service_test.go b/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_service_test.go new file mode 100644 index 000000000000..6aaeabd5b908 --- /dev/null +++ b/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_service_test.go @@ -0,0 +1,128 @@ +package apphub_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccDataSourceApphubDiscoveredService_basic(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "org_id": envvar.GetTestOrgFromEnv(t), + "random_suffix": acctest.RandString(t, 10), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "time": {}, + }, + Steps: []resource.TestStep{ + { + Config: testDataSourceApphubDiscoveredService_basic(context), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.google_apphub_discovered_service.catalog-service", "name"), + ), + }, + }, + }) +} + +func testDataSourceApphubDiscoveredService_basic(context map[string]interface{}) string { + return acctest.Nprintf( + ` +resource "google_project" "service_project" { + project_id ="tf-test-ah-%{random_suffix}" + name = "Service Project" + org_id = "%{org_id}" + billing_account = "%{billing_account}" +} + +# Enable Compute API +resource "google_project_service" "compute_service_project" { + project = google_project.service_project.project_id + service = "compute.googleapis.com" +} + +resource "time_sleep" "wait_120s" { + depends_on = [google_project_service.compute_service_project] + create_duration = "120s" +} + +resource "google_apphub_service_project_attachment" "service_project_attachment" { + service_project_attachment_id = google_project.service_project.project_id + depends_on = [time_sleep.wait_120s] +} + +# discovered service block +data "google_apphub_discovered_service" "catalog-service" { + location = "us-central1" + # ServiceReference | Application Hub | Google Cloud + # Using this reference means that this resource will not be provisioned until the forwarding rule is fully created + service_uri = "//compute.googleapis.com/${google_compute_forwarding_rule.forwarding_rule.id}" + depends_on = [time_sleep.wait_120s_for_resource_ingestion] +} + +# VPC network +resource "google_compute_network" "ilb_network" { + name = "ilb-network-%{random_suffix}" + project = google_project.service_project.project_id + auto_create_subnetworks = false + depends_on = [time_sleep.wait_120s] +} + +# backend subnet +resource "google_compute_subnetwork" "ilb_subnet" { + name = "ilb-subnet-%{random_suffix}" + project = google_project.service_project.project_id + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = google_compute_network.ilb_network.id +} + +# forwarding rule +resource "google_compute_forwarding_rule" "forwarding_rule" { + name = "forwarding-rule-%{random_suffix}" + project = google_project.service_project.project_id + region = "us-central1" + ip_version = "IPV4" + load_balancing_scheme = "INTERNAL" + all_ports = true + backend_service = google_compute_region_backend_service.backend.id + network = google_compute_network.ilb_network.id + subnetwork = google_compute_subnetwork.ilb_subnet.id +} + +resource "time_sleep" "wait_120s_for_resource_ingestion" { + depends_on = [google_compute_forwarding_rule.forwarding_rule] + create_duration = "120s" +} + +# backend service +resource "google_compute_region_backend_service" "backend" { + name = "backend-service-%{random_suffix}" + project = google_project.service_project.project_id + region = "us-central1" + health_checks = [google_compute_health_check.default.id] +} + +# health check +resource "google_compute_health_check" "default" { + name = "health-check-%{random_suffix}" + project = google_project.service_project.project_id + check_interval_sec = 1 + timeout_sec = 1 + + tcp_health_check { + port = "80" + } + depends_on = [time_sleep.wait_120s] +} +`, context) +} diff --git a/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_workload.go b/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_workload.go new file mode 100644 index 000000000000..1221ddc2c71e --- /dev/null +++ b/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_workload.go @@ -0,0 +1,162 @@ +package apphub + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" +) + +func DataSourceApphubDiscoveredWorkload() *schema.Resource { + return &schema.Resource{ + Read: dataSourceApphubDiscoveredWorkloadRead, + Schema: map[string]*schema.Schema{ + "project": { + Type: schema.TypeString, + Optional: true, + }, + "location": { + Type: schema.TypeString, + Required: true, + }, + "workload_uri": { + Type: schema.TypeString, + Required: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "workload_reference": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "uri": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "workload_properties": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "gcp_project": { + Type: schema.TypeString, + Computed: true, + }, + "location": { + Type: schema.TypeString, + Computed: true, + }, + "zone": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceApphubDiscoveredWorkloadRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*transport_tpg.Config) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + if err != nil { + return err + } + + url, err := tpgresource.ReplaceVars(d, config, fmt.Sprintf("{{ApphubBasePath}}projects/{{project}}/locations/{{location}}/discoveredWorkloads:lookup?uri={{workload_uri}}")) + if err != nil { + return err + } + + billingProject := "" + + // err == nil indicates that the billing_project value was found + if bp, err := tpgresource.GetBillingProject(d, config); err == nil { + billingProject = bp + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: userAgent, + }) + + if err != nil { + return transport_tpg.HandleDataSourceNotFoundError(err, d, fmt.Sprintf("ApphubDiscoveredWorkload %q", d.Id()), url) + } + + if err := d.Set("name", flattenApphubDiscoveredWorkloadName(res["discoveredWorkload"].(map[string]interface{})["name"], d, config)); err != nil { + return fmt.Errorf("Error setting workload name: %s", err) + } + + if err := d.Set("workload_reference", flattenApphubDiscoveredWorkloadReference(res["discoveredWorkload"].(map[string]interface{})["workloadReference"], d, config)); err != nil { + return fmt.Errorf("Error setting service reference: %s", err) + } + + if err := d.Set("workload_properties", flattenApphubDiscoveredWorkloadProperties(res["discoveredWorkload"].(map[string]interface{})["workloadProperties"], d, config)); err != nil { + return fmt.Errorf("Error setting workload properties: %s", err) + } + + d.SetId(res["discoveredWorkload"].(map[string]interface{})["name"].(string)) + + return nil + +} + +func flattenApphubDiscoveredWorkloadReference(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["uri"] = flattenApphubDiscoveredWorkloadDataUri(original["uri"], d, config) + return []interface{}{transformed} +} + +func flattenApphubDiscoveredWorkloadProperties(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["gcp_project"] = flattenApphubDiscoveredWorkloadDataGcpProject(original["gcpProject"], d, config) + transformed["location"] = flattenApphubDiscoveredWorkloadDataLocation(original["location"], d, config) + transformed["zone"] = flattenApphubDiscoveredWorkloadDataZone(original["zone"], d, config) + return []interface{}{transformed} +} + +func flattenApphubDiscoveredWorkloadName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredWorkloadDataUri(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredWorkloadDataGcpProject(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredWorkloadDataLocation(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenApphubDiscoveredWorkloadDataZone(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} diff --git a/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_workload_test.go b/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_workload_test.go new file mode 100644 index 000000000000..c305079251a0 --- /dev/null +++ b/mmv1/third_party/terraform/services/apphub/data_source_apphub_discovered_workload_test.go @@ -0,0 +1,145 @@ +package apphub_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccDataSourceApphubDiscoveredWorkload_basic(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "org_id": envvar.GetTestOrgFromEnv(t), + "random_suffix": acctest.RandString(t, 10), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "time": {}, + }, + Steps: []resource.TestStep{ + { + Config: testDataSourceApphubDiscoveredWorkload_basic(context), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.google_apphub_discovered_workload.catalog-workload", "name"), + ), + }, + }, + }) +} + +func testDataSourceApphubDiscoveredWorkload_basic(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_project" "service_project" { + project_id ="tf-test-ah-%{random_suffix}" + name = "Service Project" + org_id = "%{org_id}" + billing_account = "%{billing_account}" +} + +# Enable Compute API +resource "google_project_service" "compute_service_project" { + project = google_project.service_project.project_id + service = "compute.googleapis.com" +} + +resource "time_sleep" "wait_120s" { + depends_on = [google_project_service.compute_service_project] + create_duration = "120s" +} + +resource "google_apphub_service_project_attachment" "service_project_attachment" { + service_project_attachment_id = google_project.service_project.project_id + depends_on = [time_sleep.wait_120s] +} + +data "google_apphub_discovered_workload" "catalog-workload" { + location = "us-central1" + workload_uri = "${replace(google_compute_region_instance_group_manager.mig.instance_group, "https://www.googleapis.com/compute/v1", "//compute.googleapis.com")}" + depends_on = [time_sleep.wait_120s_for_resource_ingestion] +} + +# VPC network +resource "google_compute_network" "ilb_network" { + name = "l7-ilb-network-%{random_suffix}" + project = google_project.service_project.project_id + auto_create_subnetworks = false + depends_on = [time_sleep.wait_120s] +} + +# backend subnet +resource "google_compute_subnetwork" "ilb_subnet" { + name = "l7-ilb-subnetwork-%{random_suffix}" + project = google_project.service_project.project_id + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = google_compute_network.ilb_network.id +} + +resource "time_sleep" "wait_120s_for_resource_ingestion" { + depends_on = [google_compute_region_instance_group_manager.mig] + create_duration = "120s" +} + +# instance template +resource "google_compute_instance_template" "instance_template" { + name = "l7-ilb-mig-template-%{random_suffix}" + project = google_project.service_project.project_id + machine_type = "e2-small" + tags = ["http-server"] + network_interface { + network = google_compute_network.ilb_network.id + subnetwork = google_compute_subnetwork.ilb_subnet.id + access_config { + # add external ip to fetch packages + } + } + disk { + source_image = "debian-cloud/debian-10" + auto_delete = true + boot = true + } + # install nginx and serve a simple web page + metadata = { + startup-script = <<-EOF1 + #! /bin/bash + set -euo pipefail + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y nginx-light jq + NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") + IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") + METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') + cat < /var/www/html/index.html +
+      Name: $NAME
+      IP: $IP
+      Metadata: $METADATA
+      
+ EOF + EOF1 + } + lifecycle { + create_before_destroy = true + } +} + +resource "google_compute_region_instance_group_manager" "mig" { + name = "l7-ilb-mig1-%{random_suffix}" + project = google_project.service_project.project_id + region = "us-central1" + version { + instance_template = google_compute_instance_template.instance_template.id + name = "primary" + } + base_instance_name = "vm" + target_size = 2 +} +`, context) +} diff --git a/mmv1/third_party/terraform/services/apphub/resource_apphub_service_test.go b/mmv1/third_party/terraform/services/apphub/resource_apphub_service_test.go new file mode 100644 index 000000000000..0ea290f3992e --- /dev/null +++ b/mmv1/third_party/terraform/services/apphub/resource_apphub_service_test.go @@ -0,0 +1,163 @@ +package apphub_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccApphubService_serviceUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "random": {}, + "time": {}, + }, + CheckDestroy: testAccCheckApphubServiceDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccApphubService_apphubServiceFullExample(context), + }, + { + ResourceName: "google_apphub_service.example", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"location", "application_id", "service_id"}, + }, + { + Config: testAccApphubService_apphubServiceUpdate(context), + }, + { + ResourceName: "google_apphub_service.example", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"location", "application_id", "service_id"}, + }, + }, + }) +} + +func testAccApphubService_apphubServiceUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_apphub_application" "application" { + location = "us-central1" + application_id = "tf-test-example-application-1%{random_suffix}" + scope { + type = "REGIONAL" + } +} + +resource "google_project" "service_project" { + project_id ="tf-test-project-1%{random_suffix}" + name = "Service Project" + org_id = "%{org_id}" + billing_account = "%{billing_account}" +} + +# Enable Compute API +resource "google_project_service" "compute_service_project" { + project = google_project.service_project.project_id + service = "compute.googleapis.com" +} + +resource "time_sleep" "wait_120s" { + depends_on = [google_project_service.compute_service_project] + + create_duration = "120s" +} + +resource "google_apphub_service_project_attachment" "service_project_attachment" { + service_project_attachment_id = google_project.service_project.project_id + depends_on = [time_sleep.wait_120s] +} + +# discovered service block +data "google_apphub_discovered_service" "catalog-service" { + provider = google + location = "us-central1" + service_uri = "//compute.googleapis.com/${google_compute_forwarding_rule.forwarding_rule.id}" + depends_on = [google_apphub_service_project_attachment.service_project_attachment, time_sleep.wait_120s_for_resource_ingestion] +} + +resource "time_sleep" "wait_120s_for_resource_ingestion" { + depends_on = [google_compute_forwarding_rule.forwarding_rule] + create_duration = "120s" +} + +resource "google_apphub_service" "example" { + location = "us-central1" + application_id = google_apphub_application.application.application_id + service_id = google_compute_forwarding_rule.forwarding_rule.name + discovered_service = data.google_apphub_discovered_service.catalog-service.name +} + + +#creates service + + +# VPC network +resource "google_compute_network" "ilb_network" { + name = "tf-test-l7-ilb-network%{random_suffix}" + project = google_project.service_project.project_id + auto_create_subnetworks = false + depends_on = [time_sleep.wait_120s] +} + + +# backend subnet +resource "google_compute_subnetwork" "ilb_subnet" { + name = "tf-test-l7-ilb-subnet%{random_suffix}" + project = google_project.service_project.project_id + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = google_compute_network.ilb_network.id +} + +# forwarding rule +resource "google_compute_forwarding_rule" "forwarding_rule" { + name ="tf-test-l7-ilb-forwarding-rule%{random_suffix}" + project = google_project.service_project.project_id + region = "us-central1" + ip_version = "IPV4" + load_balancing_scheme = "INTERNAL" + all_ports = true + backend_service = google_compute_region_backend_service.backend.id + network = google_compute_network.ilb_network.id + subnetwork = google_compute_subnetwork.ilb_subnet.id +} + + + +# backend service +resource "google_compute_region_backend_service" "backend" { + name = "tf-test-l7-ilb-backend-subnet%{random_suffix}" + project = google_project.service_project.project_id + region = "us-central1" + health_checks = [google_compute_health_check.default.id] +} + +# health check +resource "google_compute_health_check" "default" { + name = "tf-test-l7-ilb-hc%{random_suffix}" + project = google_project.service_project.project_id + check_interval_sec = 1 + timeout_sec = 1 + tcp_health_check { + port = "80" + } + depends_on = [time_sleep.wait_120s] +} +`, context) +} diff --git a/mmv1/third_party/terraform/services/apphub/resource_apphub_workload_test.go b/mmv1/third_party/terraform/services/apphub/resource_apphub_workload_test.go new file mode 100644 index 000000000000..2897307d1a93 --- /dev/null +++ b/mmv1/third_party/terraform/services/apphub/resource_apphub_workload_test.go @@ -0,0 +1,180 @@ +package apphub_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccApphubWorkload_apphubWorkloadUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "random": {}, + "time": {}, + }, + CheckDestroy: testAccCheckApphubWorkloadDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccApphubWorkload_apphubWorkloadFullExample(context), + }, + { + ResourceName: "google_apphub_workload.example", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"location", "application_id", "workload_id"}, + }, + { + Config: testAccApphubWorkload_apphubWorkloadUpdate(context), + }, + { + ResourceName: "google_apphub_workload.example", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"location", "application_id", "workload_id"}, + }, + }, + }) +} + +func testAccApphubWorkload_apphubWorkloadUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_apphub_application" "application" { + location = "us-central1" + application_id = "tf-test-example-application-1%{random_suffix}" + scope { + type = "REGIONAL" + } +} + +resource "google_project" "service_project" { + project_id ="tf-test-project-1%{random_suffix}" + name = "Service Project" + org_id = "%{org_id}" + billing_account = "%{billing_account}" +} + +# Enable Compute API +resource "google_project_service" "compute_service_project" { + project = google_project.service_project.project_id + service = "compute.googleapis.com" +} + +resource "time_sleep" "wait_120s" { + depends_on = [google_project_service.compute_service_project] + + create_duration = "120s" +} + +resource "google_apphub_service_project_attachment" "service_project_attachment" { + service_project_attachment_id = google_project.service_project.project_id + depends_on = [time_sleep.wait_120s] +} + +# Discovered workload +data "google_apphub_discovered_workload" "catalog-workload" { + location = "us-central1" + workload_uri = "${replace(google_compute_region_instance_group_manager.mig.instance_group, "https://www.googleapis.com/compute/v1", "//compute.googleapis.com")}" + depends_on = [time_sleep.wait_120s_for_resource_ingestion] +} + +resource "time_sleep" "wait_120s_for_resource_ingestion" { + depends_on = [google_compute_region_instance_group_manager.mig] + create_duration = "120s" +} + +resource "google_apphub_workload" "example" { + location = "us-central1" + application_id = google_apphub_application.application.application_id + workload_id = google_compute_region_instance_group_manager.mig.name + discovered_workload = data.google_apphub_discovered_workload.catalog-workload.name +} + +#Workload creation + + +# VPC network +resource "google_compute_network" "ilb_network" { + name = "tf-test-l7-ilb-network%{random_suffix}" + project = google_project.service_project.project_id + auto_create_subnetworks = false + depends_on = [time_sleep.wait_120s] +} + +# backend subnet +resource "google_compute_subnetwork" "ilb_subnet" { + name = "tf-test-l7-ilb-subnet%{random_suffix}" + project = google_project.service_project.project_id + ip_cidr_range = "10.0.1.0/24" + region = "us-central1" + network = google_compute_network.ilb_network.id +} + +# instance template +resource "google_compute_instance_template" "instance_template" { + name = "tf-test-l7-ilb-mig-template%{random_suffix}" + project = google_project.service_project.project_id + machine_type = "e2-small" + tags = ["http-server"] + network_interface { + network = google_compute_network.ilb_network.id + subnetwork = google_compute_subnetwork.ilb_subnet.id + access_config { + # add external ip to fetch packages + } + } + disk { + source_image = "debian-cloud/debian-10" + auto_delete = true + boot = true + } + # install nginx and serve a simple web page + metadata = { + startup-script = <<-EOF1 + #! /bin/bash + set -euo pipefail + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y nginx-light jq + NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") + IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") + METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') + cat < /var/www/html/index.html +
+      Name: $NAME
+      IP: $IP
+      Metadata: $METADATA
+      
+ EOF + EOF1 + } + lifecycle { + create_before_destroy = true + } +} + +resource "google_compute_region_instance_group_manager" "mig" { + name = "tf-test-l7-ilb-mig1%{random_suffix}" + project = google_project.service_project.project_id + region = "us-central1" + version { + instance_template = google_compute_instance_template.instance_template.id + name = "primary" + } + base_instance_name = "vm" + target_size = 2 +} +`, context) +} diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_test.go b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_test.go index f4c23fd09306..eec2a3a37c56 100644 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_test.go +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_dataset_test.go @@ -98,6 +98,55 @@ func TestAccBigQueryDataset_basic(t *testing.T) { }) } +func TestAccBigQueryDataset_withComputedLabels(t *testing.T) { + // Skip it in VCR test because of the randomness of uuid in "labels" field + // which causes the replaying mode after recording mode failing in VCR test + acctest.SkipIfVcr(t) + t.Parallel() + + datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "random": {}, + }, + CheckDestroy: testAccCheckBigQueryDatasetDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccBigQueryDataset(datasetID), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("google_bigquery_dataset.test", "labels.%", "2"), + resource.TestCheckResourceAttr("google_bigquery_dataset.test", "labels.env", "foo"), + resource.TestCheckResourceAttr("google_bigquery_dataset.test", "labels.default_table_expiration_ms", "3600000"), + + resource.TestCheckResourceAttr("google_bigquery_dataset.test", "effective_labels.%", "2"), + resource.TestCheckResourceAttr("google_bigquery_dataset.test", "effective_labels.env", "foo"), + resource.TestCheckResourceAttr("google_bigquery_dataset.test", "effective_labels.default_table_expiration_ms", "3600000"), + ), + }, + { + ResourceName: "google_bigquery_dataset.test", + ImportState: true, + ImportStateVerify: true, + // The labels field in the state is decided by the configuration. + // During importing, the configuration is unavailable, so the labels field in the state after importing is empty. + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, + }, + { + Config: testAccBigQueryDatasetUpdated_withComputedLabels(datasetID), + }, + { + ResourceName: "google_bigquery_dataset.test", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, + }, + }, + }) +} + func TestAccBigQueryDataset_withProvider5(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() @@ -493,6 +542,27 @@ resource "google_bigquery_dataset" "test" { `, datasetID) } +func testAccBigQueryDatasetUpdated_withComputedLabels(datasetID string) string { + return fmt.Sprintf(` +resource "random_uuid" "test" { +} + +resource "google_bigquery_dataset" "test" { + dataset_id = "%s" + # friendly_name = "bar" + description = "This is a bar description" + location = "EU" + default_partition_expiration_ms = 7200000 + default_table_expiration_ms = 7200000 + + labels = { + env = "${random_uuid.test.result}" + default_table_expiration_ms = 7200000 + } +} +`, datasetID) +} + func testAccBigQueryDatasetDeleteContents(datasetID string) string { return fmt.Sprintf(` resource "google_bigquery_dataset" "contents_test" { diff --git a/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_test.go.erb b/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_test.go.erb index 2954e203a654..73d952177b0b 100644 --- a/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_test.go.erb +++ b/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_test.go.erb @@ -14,6 +14,47 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) +func TestAccCloudbuildWorkerPool_withComputedAnnotations(t *testing.T) { + // Skip it in VCR test because of the randomness of uuid in "annotations" field + // which causes the replaying mode after recording mode failing in VCR test + acctest.SkipIfVcr(t) + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + "project": envvar.GetTestProjectFromEnv(), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "random": {}, + }, + CheckDestroy: funcAccTestCloudbuildWorkerPoolCheckDestroy(t), + Steps: []resource.TestStep{ + { + Config: testAccCloudbuildWorkerPool_updated(context), + }, + { + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"annotations"}, + ResourceName: "google_cloudbuild_worker_pool.pool", + }, + { + Config: testAccCloudbuildWorkerPool_withComputedAnnotations(context), + }, + { + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"annotations"}, + ResourceName: "google_cloudbuild_worker_pool.pool", + }, + }, + }) +} + func TestAccCloudbuildWorkerPool_basic(t *testing.T) { t.Parallel() @@ -89,6 +130,28 @@ resource "google_cloudbuild_worker_pool" "pool" { `, context) } +func testAccCloudbuildWorkerPool_withComputedAnnotations(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "random_uuid" "test" { +} + +resource "google_cloudbuild_worker_pool" "pool" { + name = "pool%{random_suffix}" + location = "europe-west1" + worker_config { + disk_size_gb = 101 + machine_type = "e2-standard-4" + no_external_ip = false + } + + annotations = { + env = "${random_uuid.test.result}" + default_expiration_ms = 3600000 + } +} +`, context) +} + func testAccCloudbuildWorkerPool_noWorkerConfig(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_cloudbuild_worker_pool" "pool" { diff --git a/mmv1/third_party/terraform/services/cloudquotas/data_source_google_cloud_quotas_quota_info.go b/mmv1/third_party/terraform/services/cloudquotas/data_source_google_cloud_quotas_quota_info.go new file mode 100644 index 000000000000..e2ac85a5a99e --- /dev/null +++ b/mmv1/third_party/terraform/services/cloudquotas/data_source_google_cloud_quotas_quota_info.go @@ -0,0 +1,247 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 +package cloudquotas + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" +) + +func DataSourceGoogleCloudQuotasQuotaInfo() *schema.Resource { + return &schema.Resource{ + Read: dataSourceGoogleCloudQuotasQuotaInfoRead, + + Schema: map[string]*schema.Schema{ + "parent": { + Type: schema.TypeString, + Required: true, + }, + "service": { + Type: schema.TypeString, + Required: true, + }, + "quota_id": { + Type: schema.TypeString, + Required: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "metric": { + Type: schema.TypeString, + Computed: true, + }, + "is_precise": { + Type: schema.TypeBool, + Computed: true, + }, + "refresh_interval": { + Type: schema.TypeString, + Computed: true, + }, + "container_type": { + Type: schema.TypeString, + Computed: true, + }, + "dimensions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "metric_display_name": { + Type: schema.TypeString, + Computed: true, + }, + "quota_display_name": { + Type: schema.TypeString, + Computed: true, + }, + "metric_unit": { + Type: schema.TypeString, + Computed: true, + }, + "quota_increase_eligibility": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_eligible": { + Type: schema.TypeBool, + Computed: true, + }, + "ineligibility_reason": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "is_fixed": { + Type: schema.TypeBool, + Computed: true, + }, + "dimensions_infos": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dimensions": { + Type: schema.TypeMap, + Computed: true, + }, + "details": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "applicable_locations": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "is_concurrent": { + Type: schema.TypeBool, + Computed: true, + }, + "service_request_quota_uri": { + Type: schema.TypeString, + Computed: true, + }, + }, + UseJSONNumber: true, + } +} + +func dataSourceGoogleCloudQuotasQuotaInfoRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*transport_tpg.Config) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + if err != nil { + return err + } + + url, err := tpgresource.ReplaceVars(d, config, "{{CloudQuotasBasePath}}{{parent}}/locations/global/services/{{service}}/quotaInfos/{{quota_id}}") + if err != nil { + return fmt.Errorf("error setting api endpoint") + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + RawURL: url, + UserAgent: userAgent, + }) + + if err != nil { + return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("CloudQuotasQuotaInfo %q", d.Id())) + } + + if err := d.Set("name", res["name"]); err != nil { + return fmt.Errorf("error reading QuotaInfo name: %s", err) + } + if err := d.Set("quota_id", res["quotaId"]); err != nil { + return fmt.Errorf("error reading QuotaInfo quota_id: %s", err) + } + if err := d.Set("metric", res["metric"]); err != nil { + return fmt.Errorf("error reading QuotaInfo metric: %s", err) + } + if err := d.Set("service", res["service"]); err != nil { + return fmt.Errorf("error reading QuotaInfo service: %s", err) + } + if err := d.Set("is_precise", res["isPrecise"]); err != nil { + return fmt.Errorf("error reading QuotaInfo is_precise: %s", err) + } + if err := d.Set("refresh_interval", res["refreshInterval"]); err != nil { + return fmt.Errorf("error reading QuotaInfo refresh_interval: %s", err) + } + if err := d.Set("container_type", res["containerType"]); err != nil { + return fmt.Errorf("error reading QuotaInfo container_type: %s", err) + } + if err := d.Set("dimensions", res["dimensions"]); err != nil { + return fmt.Errorf("error reading QuotaInfo dimensions: %s", err) + } + if err := d.Set("metric_display_name", res["metricDisplayName"]); err != nil { + return fmt.Errorf("error reading QuotaInfo metric_display_name: %s", err) + } + if err := d.Set("quota_display_name", res["quotaDisplayName"]); err != nil { + return fmt.Errorf("error reading QuotaInfo quota_display_name: %s", err) + } + if err := d.Set("metric_unit", res["metricUnit"]); err != nil { + return fmt.Errorf("error reading QuotaInfo metric_unit: %s", err) + } + if err := d.Set("quota_increase_eligibility", flattenCloudQuotasQuotaInfoQuotaIncreaseEligibility(res["quotaIncreaseEligibility"], d, config)); err != nil { + return fmt.Errorf("error reading QuotaInfo quota_increase_eligibility: %s", err) + } + if err := d.Set("is_fixed", res["isFixed"]); err != nil { + return fmt.Errorf("error reading QuotaInfo is_fixed: %s", err) + } + if err := d.Set("dimensions_infos", flattenCloudQuotasQuotaInfoDimensionsInfos(res["dimensionsInfos"], d, config)); err != nil { + return fmt.Errorf("error reading QuotaInfo dimensions_infos: %s", err) + } + if err := d.Set("is_concurrent", res["isConcurrent"]); err != nil { + return fmt.Errorf("error reading QuotaInfo is_concurrent: %s", err) + } + if err := d.Set("service_request_quota_uri", res["serviceRequestQuotaUri"]); err != nil { + return fmt.Errorf("error reading QuotaInfo service_request_quota_uri: %s", err) + } + + d.SetId(res["name"].(string)) + return nil +} + +func flattenCloudQuotasQuotaInfoQuotaIncreaseEligibility(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["is_eligible"] = original["is_eligible"] + transformed["ineligibility_reason"] = original["ineligibility_reason"] + return []interface{}{transformed} +} + +func flattenCloudQuotasQuotaInfoDimensionsInfos(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) []interface{} { + if v == nil { + return make([]interface{}, 0) + } + + original := v.([]interface{}) + dimensionsInfos := make([]interface{}, 0, len(original)) + + for _, raw := range original { + data := make(map[string]interface{}) + data["details"] = flattenCloudQuotasQuotaInfoDetails(raw.(map[string]interface{})["details"], d, config) + data["applicable_locations"] = raw.(map[string]interface{})["applicableLocations"] + data["dimensions"] = raw.(map[string]interface{})["dimensions"] + + dimensionsInfos = append(dimensionsInfos, data) + } + return dimensionsInfos +} + +func flattenCloudQuotasQuotaInfoDetails(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + original, ok := v.(map[string]interface{}) + if !ok || len(original) == 0 { + return nil + } + + return []interface{}{ + map[string]interface{}{"value": original["value"]}, + } +} diff --git a/mmv1/third_party/terraform/services/cloudquotas/data_source_google_cloud_quotas_quota_info_test.go b/mmv1/third_party/terraform/services/cloudquotas/data_source_google_cloud_quotas_quota_info_test.go new file mode 100644 index 000000000000..9a4ff979b47d --- /dev/null +++ b/mmv1/third_party/terraform/services/cloudquotas/data_source_google_cloud_quotas_quota_info_test.go @@ -0,0 +1,61 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 +package cloudquotas_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccDataSourceGoogleQuotaInfo_basic(t *testing.T) { + t.Parallel() + + resourceName := "data.google_cloud_quotas_quota_info.my_quota_info" + service := "compute.googleapis.com" + quotaId := "CPUS-per-project-region" + + context := map[string]interface{}{ + "project": envvar.GetTestProjectFromEnv(), + "service": service, + "quota_id": quotaId, + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDataSourceGoogleQuotaInfo_basic(context), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(resourceName, "name"), + resource.TestCheckResourceAttr(resourceName, "quota_id", quotaId), + resource.TestCheckResourceAttr(resourceName, "metric", "compute.googleapis.com/cpus"), + resource.TestCheckResourceAttr(resourceName, "service", service), + resource.TestCheckResourceAttrSet(resourceName, "is_precise"), + resource.TestCheckResourceAttr(resourceName, "container_type", "PROJECT"), + resource.TestCheckResourceAttr(resourceName, "dimensions.0", "region"), + resource.TestCheckResourceAttr(resourceName, "metric_display_name", "CPUs"), + resource.TestCheckResourceAttr(resourceName, "quota_display_name", "CPUs"), + resource.TestCheckResourceAttrSet(resourceName, "metric_unit"), + resource.TestCheckResourceAttrSet(resourceName, "quota_increase_eligibility.0.is_eligible"), + resource.TestCheckResourceAttrSet(resourceName, "dimensions_infos.0.dimensions.region"), + resource.TestCheckResourceAttrSet(resourceName, "dimensions_infos.0.details.0.value"), + resource.TestCheckResourceAttrSet(resourceName, "dimensions_infos.0.applicable_locations.0"), + ), + }, + }, + }) +} + +func testAccDataSourceGoogleQuotaInfo_basic(context map[string]interface{}) string { + return acctest.Nprintf(` + data "google_cloud_quotas_quota_info" "my_quota_info" { + parent = "projects/%{project}" + quota_id = "%{quota_id}" + service = "%{service}" + } + `, context) +} diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_router_nat_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_router_nat_test.go.erb index b1c17157506f..7436c9ccfa45 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_router_nat_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_nat_test.go.erb @@ -1679,6 +1679,9 @@ resource "google_compute_router" "foobar" { name = "%s" region = google_compute_subnetwork.subnet1.region network = google_compute_network.foobar.self_link + depends_on = [ + google_network_connectivity_spoke.primary + ] } `, routerName, routerName, routerName, routerName, routerName, hubName, routerName, routerName) } @@ -1793,4 +1796,4 @@ resource "google_compute_router_nat" "foobar" { `, testAccComputeRouterNatBaseResourcesWithPrivateNatSubnetworks(routerName, hubName), routerName, ruleNumber, ruleDescription, match) } -<% end -%> \ No newline at end of file +<% end -%> diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.erb b/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.erb index 025ed420fdde..99126aceb3bf 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.erb @@ -207,7 +207,6 @@ var schemaNodePool = map[string]*schema.Schema{ }, }, -<% unless version == 'ga' -%> "queued_provisioning": { Type: schema.TypeList, Optional: true, @@ -225,7 +224,6 @@ var schemaNodePool = map[string]*schema.Schema{ }, }, }, -<% end -%> "max_pods_per_node": &schema.Schema{ Type: schema.TypeInt, @@ -988,7 +986,6 @@ func expandNodePool(d *schema.ResourceData, prefix string) (*container.NodePool, } } -<% unless version == 'ga' -%> if v, ok := d.GetOk(prefix + "queued_provisioning"); ok { if v.([]interface{}) != nil && v.([]interface{})[0] != nil { queued_provisioning := v.([]interface{})[0].(map[string]interface{}) @@ -997,7 +994,6 @@ func expandNodePool(d *schema.ResourceData, prefix string) (*container.NodePool, } } } -<% end -%> if v, ok := d.GetOk(prefix + "max_pods_per_node"); ok { np.MaxPodsConstraint = &container.MaxPodsConstraint{ @@ -1192,7 +1188,6 @@ func flattenNodePool(d *schema.ResourceData, config *transport_tpg.Config, np *c } } -<% unless version == 'ga' -%> if np.QueuedProvisioning != nil { nodePool["queued_provisioning"] = []map[string]interface{}{ { @@ -1200,7 +1195,6 @@ func flattenNodePool(d *schema.ResourceData, config *transport_tpg.Config, np *c }, } } -<% end -%> if np.MaxPodsConstraint != nil { nodePool["max_pods_per_node"] = np.MaxPodsConstraint.MaxPodsPerNode diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb index ec3e852d8ce6..ac04e9501c21 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.erb @@ -1950,7 +1950,6 @@ resource "google_container_node_pool" "np" { `, cluster, networkName, subnetworkName, policyName, np) } -<% unless version == 'ga' -%> func TestAccContainerNodePool_enableQueuedProvisioning(t *testing.T) { t.Parallel() @@ -2022,7 +2021,6 @@ resource "google_container_node_pool" "np" { } `, cluster, networkName, subnetworkName, np, enabled) } -<% end -%> func TestAccContainerNodePool_threadsPerCore(t *testing.T) { t.Parallel() diff --git a/mmv1/third_party/terraform/services/networksecurity/resource_network_security_firewall_endpoint_association_test.go.erb b/mmv1/third_party/terraform/services/networksecurity/resource_network_security_firewall_endpoint_association_test.go.erb new file mode 100644 index 000000000000..e10e75113914 --- /dev/null +++ b/mmv1/third_party/terraform/services/networksecurity/resource_network_security_firewall_endpoint_association_test.go.erb @@ -0,0 +1,154 @@ +<% autogen_exception -%> +package networksecurity_test +<% unless version == 'ga' -%> + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" +) + +func TestAccNetworkSecurityFirewallEndpointAssociations_basic(t *testing.T) { + acctest.SkipIfVcr(t) + t.Parallel() + + orgId := envvar.GetTestOrgFromEnv(t) + randomSuffix := acctest.RandString(t, 10) + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + CheckDestroy: testAccCheckNetworkSecurityFirewallEndpointDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccNetworkSecurityFirewallEndpointAssociation_basic(randomSuffix, orgId, ), + }, + { + ResourceName: "google_network_security_firewall_endpoint_association.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, + }, + { + Config: testAccNetworkSecurityFirewallEndpointAssociation_update(randomSuffix, orgId, ), + }, + { + ResourceName: "google_network_security_firewall_endpoint_association.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, + }, + }, + }) +} + +func testAccNetworkSecurityFirewallEndpointAssociation_basic(randomSuffix string, orgId string) string { + return fmt.Sprintf(` +resource "google_compute_network" "foobar" { + provider = google-beta + name = "tf-test-my-vpc%s" + auto_create_subnetworks = false +} + +resource "google_network_security_firewall_endpoint" "foobar" { + provider = google-beta + name = "tf-test-my-firewall-endpoint%s" + parent = "organizations/%s" + location = "us-central1-a" +} + +# TODO: add tlsInspectionPolicy once resource is ready +resource "google_network_security_firewall_endpoint_association" "foobar" { + provider = google-beta + name = "tf-test-my-firewall-endpoint%s" + parent = "organizations/%s" + location = "us-central1-a" + firewall_endpoint = google_network_security_firewall_endpoint.foobar.id + network = google_compute_network.foobar.id + + labels = { + foo = "bar" + } +} +`, randomSuffix, randomSuffix, orgId, randomSuffix, orgId) +} + +func testAccNetworkSecurityFirewallEndpointAssociation_update(randomSuffix string, orgId string) string { + return fmt.Sprintf(` +resource "google_compute_network" "foobar" { + provider = google-beta + name = "tf-test-my-vpc%s" + auto_create_subnetworks = false +} + +resource "google_network_security_firewall_endpoint" "foobar" { + provider = google-beta + name = "tf-test-my-firewall-endpoint%s" + parent = "organizations/%s" + location = "us-central1-a" +} + +# TODO: add tlsInspectionPolicy once resource is ready +resource "google_network_security_firewall_endpoint_association" "foobar" { + provider = google-beta + name = "tf-test-my-firewall-endpoint%s" + parent = "organizations/%s" + location = "us-central1-a" + firewall_endpoint = google_network_security_firewall_endpoint.foobar.id + network = google_compute_network.foobar.id + + labels = { + foo = "bar-updated" + } +} +`, randomSuffix, randomSuffix, orgId, randomSuffix, orgId) +} + +func testAccCheckNetworkSecurityFirewallEndpointAssociationDestroyProducer(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_network_security_firewall_endpoint_association" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := acctest.GoogleProviderConfig(t) + + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{NetworkSecurityBasePath}}{{parent}}/locations/{{location}}/firewallEndpointAssociations/{{name}}") + if err != nil { + return err + } + + billingProject := "" + + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: config.UserAgent, + }) + if err == nil { + return fmt.Errorf("NetworkSecurityFirewallEndpointAssociation still exists at %s", url) + } + } + + return nil + } +} + +<% end -%> diff --git a/mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go b/mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go index 11f8b050283d..25529a550cc2 100644 --- a/mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go +++ b/mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go @@ -446,10 +446,15 @@ resource "google_pubsub_subscription" "foo" { name = "%s" topic = google_pubsub_topic.foo.id - bigquery_config { - table = "${google_bigquery_table.test.project}.${google_bigquery_table.test.dataset_id}.${google_bigquery_table.test.table_id}" - use_table_schema = %t - } + bigquery_config { + table = "${google_bigquery_table.test.project}.${google_bigquery_table.test.dataset_id}.${google_bigquery_table.test.table_id}" + use_table_schema = %t + } + + depends_on = [ + google_project_iam_member.viewer, + google_project_iam_member.editor + ] } `, dataset, table, topic, subscription, useTableSchema) } diff --git a/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job.go b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job.go.erb similarity index 96% rename from mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job.go rename to mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job.go.erb index 148ab8c0af82..0a955d9f11b3 100644 --- a/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job.go +++ b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job.go.erb @@ -1,3 +1,4 @@ +<% autogen_exception -%> package storagetransfer import ( @@ -50,6 +51,12 @@ var ( "transfer_spec.0.aws_s3_data_source.0.aws_access_key", "transfer_spec.0.aws_s3_data_source.0.role_arn", } + <% unless version == 'ga' -%> + azureOptionCredentials = []string{ + "transfer_spec.0.azure_blob_storage_data_source.0.azure_credentials", + "transfer_spec.0.azure_blob_storage_data_source.0.credentials_secret", + } + <% end -%> ) func ResourceStorageTransferJob() *schema.Resource { @@ -559,9 +566,14 @@ func azureBlobStorageDataSchema() *schema.Resource { Description: `Root path to transfer objects. Must be an empty string or full path name that ends with a '/'. This field is treated as an object prefix. As such, it should generally not begin with a '/'.`, }, "azure_credentials": { - Type: schema.TypeList, - Required: true, - MaxItems: 1, + Type: schema.TypeList, + <% unless version == 'ga' -%> + Optional: true, + ExactlyOneOf: azureOptionCredentials, + <% else -%> + Required: true, + <% end -%> + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "sas_token": { @@ -574,6 +586,14 @@ func azureBlobStorageDataSchema() *schema.Resource { }, Description: ` Credentials used to authenticate API requests to Azure.`, }, + <% unless version == 'ga' -%> + "credentials_secret": { + Optional: true, + Type: schema.TypeString, + Description: `The Resource name of a secret in Secret Manager containing SAS Credentials in JSON form. Service Agent must have permissions to access secret. If credentials_secret is specified, do not specify azure_credentials.`, + ExactlyOneOf: azureOptionCredentials, + }, + <% end -%> }, } } @@ -1099,6 +1119,11 @@ func expandAzureCredentials(azureCredentials []interface{}) *storagetransfer.Azu } func flattenAzureCredentials(d *schema.ResourceData) []map[string]interface{} { + <% unless version == 'ga' -%> + if d.Get("transfer_spec.0.azure_blob_storage_data_source.0.azure_credentials.0.sas_token") == "" { + return []map[string]interface{}{} + } + <% end -%> data := map[string]interface{}{ "sas_token": d.Get("transfer_spec.0.azure_blob_storage_data_source.0.azure_credentials.0.sas_token"), } @@ -1114,19 +1139,25 @@ func expandAzureBlobStorageData(azureBlobStorageDatas []interface{}) *storagetra azureBlobStorageData := azureBlobStorageDatas[0].(map[string]interface{}) return &storagetransfer.AzureBlobStorageData{ - Container: azureBlobStorageData["container"].(string), - Path: azureBlobStorageData["path"].(string), - StorageAccount: azureBlobStorageData["storage_account"].(string), - AzureCredentials: expandAzureCredentials(azureBlobStorageData["azure_credentials"].([]interface{})), + Container: azureBlobStorageData["container"].(string), + Path: azureBlobStorageData["path"].(string), + StorageAccount: azureBlobStorageData["storage_account"].(string), + AzureCredentials: expandAzureCredentials(azureBlobStorageData["azure_credentials"].([]interface{})), + <% unless version == 'ga' -%> + CredentialsSecret: azureBlobStorageData["credentials_secret"].(string), + <% end -%> } } func flattenAzureBlobStorageData(azureBlobStorageData *storagetransfer.AzureBlobStorageData, d *schema.ResourceData) []map[string]interface{} { data := map[string]interface{}{ - "container": azureBlobStorageData.Container, - "path": azureBlobStorageData.Path, - "storage_account": azureBlobStorageData.StorageAccount, - "azure_credentials": flattenAzureCredentials(d), + "container": azureBlobStorageData.Container, + "path": azureBlobStorageData.Path, + "storage_account": azureBlobStorageData.StorageAccount, + "azure_credentials": flattenAzureCredentials(d), + <% unless version == 'ga' -%> + "credentials_secret": azureBlobStorageData.CredentialsSecret, + <% end -%> } return []map[string]interface{}{data} diff --git a/mmv1/third_party/terraform/tpgresource/annotations.go b/mmv1/third_party/terraform/tpgresource/annotations.go index 410fbd2355d4..d43d608d16de 100644 --- a/mmv1/third_party/terraform/tpgresource/annotations.go +++ b/mmv1/third_party/terraform/tpgresource/annotations.go @@ -17,6 +17,15 @@ func SetAnnotationsDiff(_ context.Context, d *schema.ResourceDiff, meta interfac return fmt.Errorf("`effective_annotations` field is not present in the resource schema.") } + // If "annotations" field is computed, set "effective_annotations" to computed. + // https://github.com/hashicorp/terraform-provider-google/issues/16217 + if !d.GetRawPlan().GetAttr("annotations").IsWhollyKnown() { + if err := d.SetNewComputed("effective_annotations"); err != nil { + return fmt.Errorf("error setting effective_annotations to computed: %w", err) + } + return nil + } + o, n := d.GetChange("annotations") effectiveAnnotations := d.Get("effective_annotations").(map[string]interface{}) diff --git a/mmv1/third_party/terraform/tpgresource/labels.go b/mmv1/third_party/terraform/tpgresource/labels.go index 0465456e254a..5cfaa93ef41a 100644 --- a/mmv1/third_party/terraform/tpgresource/labels.go +++ b/mmv1/third_party/terraform/tpgresource/labels.go @@ -69,6 +69,19 @@ func SetLabelsDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) return fmt.Errorf("`effective_labels` field is not present in the resource schema.") } + // If "labels" field is computed, set "terraform_labels" and "effective_labels" to computed. + // https://github.com/hashicorp/terraform-provider-google/issues/16217 + if !d.GetRawPlan().GetAttr("labels").IsWhollyKnown() { + if err := d.SetNewComputed("terraform_labels"); err != nil { + return fmt.Errorf("error setting terraform_labels to computed: %w", err) + } + + if err := d.SetNewComputed("effective_labels"); err != nil { + return fmt.Errorf("error setting effective_labels to computed: %w", err) + } + return nil + } + config := meta.(*transport_tpg.Config) // Merge provider default labels with the user defined labels in the resource to get terraform managed labels diff --git a/mmv1/third_party/terraform/website/docs/d/apphub_discovered_service.html.markdown b/mmv1/third_party/terraform/website/docs/d/apphub_discovered_service.html.markdown new file mode 100644 index 000000000000..272491b8d089 --- /dev/null +++ b/mmv1/third_party/terraform/website/docs/d/apphub_discovered_service.html.markdown @@ -0,0 +1,52 @@ +--- +subcategory: "Apphub" +description: |- + Get information about a discovered service. +--- + +# google\_apphub\_discovered_service + +Get information about a discovered service from its uri. + + +## Example Usage + + +```hcl +data "google_apphub_discovered_service" "my-service" { + location = "my-location" + service_uri = "my-service-uri" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project` - The host project of the discovered service. +* `service_uri` - (Required) The uri of the service. +* `location` - (Required) The location of the discovered service. + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + +* `name` - Resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}". + +* `service_reference` - Reference to an underlying networking resource that can comprise a Service. Structure is [documented below](#nested_service_reference) + +A `service_reference` object would contain the following fields: + +* `uri` - The underlying resource URI. + +* `path` - Additional path under the resource URI. + +* `service_properties` - Properties of an underlying compute resource that can comprise a Service. Structure is [documented below](#nested_service_properties) + +A `service_properties` object would contain the following fields: + +* `gcp_project` - The service project identifier that the underlying cloud resource resides in. + +* `location` - The location that the underlying resource resides in. + +* `zone` - The location that the underlying resource resides in if it is zonal. \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/d/apphub_discovered_workload.html.markdown b/mmv1/third_party/terraform/website/docs/d/apphub_discovered_workload.html.markdown new file mode 100644 index 000000000000..d9fc574eaff0 --- /dev/null +++ b/mmv1/third_party/terraform/website/docs/d/apphub_discovered_workload.html.markdown @@ -0,0 +1,50 @@ +--- +subcategory: "Apphub" +description: |- + Get information about a discovered workload. +--- + +# google\_apphub\_discovered_workload + +Get information about a discovered workload from its uri. + + +## Example Usage + + +```hcl +data "google_apphub_discovered_workload" "my-workload" { + location = "us-central1" + workload_uri = "my-workload-uri" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project` - The host project of the discovered workload. +* `workload_uri` - (Required) The uri of the workload (instance group managed by the Instance Group Manager). Example: "//compute.googleapis.com/projects/1/regions/us-east1/instanceGroups/id1" +* `location` - (Required) The location of the discovered workload. + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + +* `name` - Resource name of a Workload. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/workloads/{workload-id}". + +* `workload_reference` - Reference to an underlying networking resource that can comprise a Workload. Structure is [documented below](#nested_workload_reference) + +The `workload_reference` block supports: + +* `uri` - The underlying resource URI. + +* `workload_properties` - Properties of an underlying compute resource that can comprise a Workload. Structure is [documented below](#nested_workload_properties) + +The `workload_properties` block supports: + +* `gcp_project` - The service project identifier that the underlying cloud resource resides in. + +* `location` - The location that the underlying resource resides in. + +* `zone` - The location that the underlying resource resides in if it is zonal. diff --git a/mmv1/third_party/terraform/website/docs/d/cloud_quotas_quota_info.html.markdown b/mmv1/third_party/terraform/website/docs/d/cloud_quotas_quota_info.html.markdown new file mode 100644 index 000000000000..77e97d36489c --- /dev/null +++ b/mmv1/third_party/terraform/website/docs/d/cloud_quotas_quota_info.html.markdown @@ -0,0 +1,61 @@ +--- +subcategory: "Cloud Quotas" +--- + +# google\_cloud\_quotas\_quota\_info + +Provides information about a particular quota for a given project, folder or organization. + +## Example Usage + +```hcl +data "google_cloud_quotas_quota_info" "my_quota_info" { + parent = "projects/my-project" + service = "compute.googleapis.com" + quota_id = "CPUS-per-project-region" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `parent` - (Required) The parent of the quota info. Allowed parents are "projects/[project-id / number]" or "folders/[folder-id / number]" or "organizations/[org-id / number]. + +* `quota_id` - (Required) The id of the quota, which is unique within the service. + +* `service` - (Required) The name of the service in which the quota is defined. + +## Attributes Reference + +The following attributes are exported: + +* `name` - (Output) Resource name of this QuotaInfo, for example: `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion`. +* `metric` - (Output) The metric of the quota. It specifies the resources consumption the quota is defined for, for example: `compute.googleapis.com/cpus`. +* `is_precise` - (Output) Whether this is a precise quota. A precise quota is tracked with absolute precision. In contrast, an imprecise quota is not tracked with precision. +* `refresh_interval` - (Output) The reset time interval for the quota. Refresh interval applies to rate quota only. Example: "minute" for per minute, "day" for per day, or "10 seconds" for every 10 seconds. +* `container_type` - (Output) The container type of the QuotaInfo. +* `dimensions` - (Output) The dimensions the quota is defined on. +* `metric_display_name` - (Output) The display name of the quota metric. +* `quota_display_name` - (Output) The display name of the quota. +* `metric_unit` - (Output) The unit in which the metric value is reported, e.g., `MByte`. +* `quota_increase_eligibility` - (Output) Whether it is eligible to request a higher quota value for this quota. +* `is_fixed` - (Output) Whether the quota value is fixed or adjustable. +* `dimensions_infos` - (Output) The collection of dimensions info ordered by their dimensions from more specific ones to less specific ones. +* `is_concurrent` - (Output) Whether the quota is a concurrent quota. Concurrent quotas are enforced on the total number of concurrent operations in flight at any given time. +* `service_request_quota_uri` - (Output) URI to the page where users can request more quota for the cloud service, for example: `https://console.cloud.google.com/iam-admin/quotas`. + + The `quota_increase_eligibility` block supports: + +* `is_eligible` - Whether a higher quota value can be requested for the quota. +* `ineligibility_reason` - The enumeration of reasons when it is ineligible to request increase adjustment. + + The `dimensions_infos` block supports: +* `dimensions` - The map of dimensions for this dimensions info. The key of a map entry is "region", "zone" or the name of a service specific dimension, and the value of a map entry is the value of the dimension. If a dimension does not appear in the map of dimensions, the dimensions info applies to all the dimension values except for those that have another DimenisonInfo instance configured for the specific value. Example: {"provider" : "Foo Inc"} where "provider" is a service specific dimension of a quota. + + An object containing a list of "key": value pairs, for example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. +* `details` - The quota details for a map of dimensions. +* `applicable_locations` - The applicable regions or zones of this dimensions info. The field will be set to `['global']` for quotas that are not per region or per zone. Otherwise, it will be set to the list of locations this dimension info is applicable to. + + The `details` block supports: +* `value` - The value currently in effect and being enforced. diff --git a/mmv1/third_party/terraform/website/docs/index.html.markdown b/mmv1/third_party/terraform/website/docs/index.html.markdown index fee57ac9c426..d240af80b2cc 100644 --- a/mmv1/third_party/terraform/website/docs/index.html.markdown +++ b/mmv1/third_party/terraform/website/docs/index.html.markdown @@ -91,9 +91,9 @@ experience for you using the Google provider. If you have a bug or feature request without an existing issue -* and an existing resource or field is working in an unexpected way, [file a bug](https://github.com/hashicorp/terraform-provider-google/issues/new?template=bug.md). +* and an existing resource or field is working in an unexpected way, [file a bug](https://github.com/hashicorp/terraform-provider-google/issues/new?labels=bug&template=00_bug.yml). -* and you'd like the provider to support a new resource or field, [file an enhancement/feature request](https://github.com/hashicorp/terraform-provider-google/issues/new?template=enhancement.md). +* and you'd like the provider to support a new resource or field, [file an enhancement/feature request](https://github.com/hashicorp/terraform-provider-google/issues/new?labels=enhancement&template=01_enhancement.yml). The provider maintainers will often use the assignee field on an issue to mark who is working on it. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_security_policy.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_security_policy.html.markdown index 92d2b5ab5b4f..2cf421900b64 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_security_policy.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_security_policy.html.markdown @@ -280,9 +280,9 @@ The following arguments are supported: * `request_cookie` - (Optional) Request cookie whose value will be excluded from inspection during preconfigured WAF evaluation. Structure is [documented below](#nested_field_params). -* `request_uri` - (Optional) Request query parameter whose value will be excluded from inspection during preconfigured WAF evaluation. Note that the parameter can be in the query string or in the POST body. Structure is [documented below](#nested_field_params). +* `request_uri` - (Optional) Request URI from the request line to be excluded from inspection during preconfigured WAF evaluation. When specifying this field, the query or fragment part should be excluded. Structure is [documented below](#nested_field_params). -* `request_query_param` - (Optional) Request URI from the request line to be excluded from inspection during preconfigured WAF evaluation. When specifying this field, the query or fragment part should be excluded. Structure is [documented below](#nested_field_params). +* `request_query_param` - (Optional) Request query parameter whose value will be excluded from inspection during preconfigured WAF evaluation. Note that the parameter can be in the query string or in the POST body. Structure is [documented below](#nested_field_params). * `target_rule_set` - (Required) Target WAF rule set to apply the preconfigured WAF exclusion. diff --git a/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown index 3649ce923de7..cbe26898c6e3 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown @@ -172,7 +172,7 @@ cluster. * `placement_policy` - (Optional) Specifies a custom placement policy for the nodes. -* `queued_provisioning` - (Optional, Beta) Specifies node pool-level settings of queued provisioning. +* `queued_provisioning` - (Optional) Specifies node pool-level settings of queued provisioning. Structure is [documented below](#nested_queued_provisioning). The `autoscaling` block supports (either total or per zone limits are required): diff --git a/mmv1/third_party/terraform/website/docs/r/storage_transfer_job.html.markdown b/mmv1/third_party/terraform/website/docs/r/storage_transfer_job.html.markdown index c354672672d2..2f2d4ecb5d83 100644 --- a/mmv1/third_party/terraform/website/docs/r/storage_transfer_job.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/storage_transfer_job.html.markdown @@ -247,7 +247,9 @@ The `aws_access_key` block supports: * `path` - (Required) Root path to transfer objects. Must be an empty string or full path name that ends with a '/'. This field is treated as an object prefix. As such, it should generally not begin with a '/'. -* `azure_credentials` - (Required) Credentials used to authenticate API requests to Azure block. +* `credentials_secret` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Full Resource name of a secret in Secret Manager containing [SAS Credentials in JSON form](https://cloud.google.com/storage-transfer/docs/reference/rest/v1/TransferSpec#azureblobstoragedata:~:text=begin%20with%20a%20%27/%27.-,credentialsSecret,-string). Service Agent for Storage Transfer must have permissions to access secret. If credentials_secret is specified, do not specify azure_credentials.`, + +* `azure_credentials` - (Required in GA, Optional in [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Credentials used to authenticate API requests to Azure block. The `azure_credentials` block supports: diff --git a/scripts/doctor b/scripts/doctor index ce131165d7f6..6a39b637e35c 100755 --- a/scripts/doctor +++ b/scripts/doctor @@ -48,9 +48,9 @@ if [ $found -eq 0 ]; then else version=($(go version)) version=${version[2]} - if [[ "$version" < "go1.20.0" ]]; then + if [[ "$version" < "go1.21.0" ]]; then exitcode=1 - warn "yel" " $version is installed, but go 1.20 or later is required. See https://golang.org/doc/install for information on installing it." + warn "yel" " $version is installed, but go 1.21 or later is required. See https://golang.org/doc/install for information on installing it." fi if [[ -z "${GOPATH}" ]]; then exitcode=1 diff --git a/tools/diff-processor/GNUmakefile b/tools/diff-processor/GNUmakefile index 8e4f18ba9b05..c9e336230d17 100644 --- a/tools/diff-processor/GNUmakefile +++ b/tools/diff-processor/GNUmakefile @@ -56,3 +56,5 @@ endif go mod tidy mkdir -p bin/ go build -o ./bin/ . + +.PHONY: clone clean build diff --git a/tools/diff-processor/go.mod b/tools/diff-processor/go.mod index 78da81c6aeaa..f740f857b9cf 100644 --- a/tools/diff-processor/go.mod +++ b/tools/diff-processor/go.mod @@ -1,6 +1,6 @@ module github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor -go 1.20 +go 1.21 replace google/provider/old => ./old diff --git a/tools/go-changelog/go.mod b/tools/go-changelog/go.mod index 1dcdd361463b..3a898fd8dcdd 100644 --- a/tools/go-changelog/go.mod +++ b/tools/go-changelog/go.mod @@ -7,7 +7,6 @@ require ( github.com/go-git/go-git/v5 v5.4.2 github.com/google/go-github v17.0.0+incompatible github.com/google/go-querystring v1.0.0 // indirect - github.com/manifoldco/promptui v0.8.0 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/sync v0.0.0-20190423024810-112230192c58 ) diff --git a/tools/go-changelog/go.sum b/tools/go-changelog/go.sum index f15669f53a7b..ffa6cde2ab37 100644 --- a/tools/go-changelog/go.sum +++ b/tools/go-changelog/go.sum @@ -10,12 +10,6 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -47,8 +41,6 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU= -github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -59,16 +51,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a h1:weJVJJRzAJBFRlAiJQROKQs8oC9vOxvm4rZmBBk0ONw= -github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/manifoldco/promptui v0.8.0 h1:R95mMF+McvXZQ7j1g8ucVZE1gLP3Sv6j9vlF9kyRqQo= -github.com/manifoldco/promptui v0.8.0/go.mod h1:n4zTdgP0vr0S3w7/O/g98U+e0gwLScEXGwov2nIKuGQ= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= -github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= @@ -103,7 +87,6 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -121,7 +104,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/tools/issue-labeler/go.mod b/tools/issue-labeler/go.mod index a1fcbec43647..658e2f70955f 100644 --- a/tools/issue-labeler/go.mod +++ b/tools/issue-labeler/go.mod @@ -1,13 +1,11 @@ module github.com/GoogleCloudPlatform/magic-modules/tools/issue-labeler -go 1.20 +go 1.21 require ( github.com/golang/glog v1.1.1 + golang.org/x/exp v0.0.0-20230810033253-352e893a4cad gopkg.in/yaml.v2 v2.4.0 ) -require ( - golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/tools/issue-labeler/labeler/enrolled_teams.yml b/tools/issue-labeler/labeler/enrolled_teams.yml index f2d88536d0c8..8da24bb5c517 100755 --- a/tools/issue-labeler/labeler/enrolled_teams.yml +++ b/tools/issue-labeler/labeler/enrolled_teams.yml @@ -327,6 +327,7 @@ service/filestore: resources: - google_filestore_.* service/firebase: + team: firebase-terraform resources: - google_firebase_.* - google_firebaserules_.* @@ -529,6 +530,7 @@ service/redis-instance: resources: - google_redis_instance service/run: + team: cloud-run-control-plane resources: - google_cloud_run_.* - google_cloud_run_v2_.* diff --git a/tools/missing-test-detector/go.mod b/tools/missing-test-detector/go.mod index a074a5d1b471..e5d9ede9b28b 100644 --- a/tools/missing-test-detector/go.mod +++ b/tools/missing-test-detector/go.mod @@ -1,6 +1,6 @@ module github.com/GoogleCloudPlatform/magic-modules/tools/missing-test-detector -go 1.20 +go 1.21 replace google/provider/old => github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230302220542-203a52c6e3e1 @@ -11,85 +11,41 @@ require ( github.com/hashicorp/hcl/v2 v2.14.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 github.com/zclconf/go-cty v1.11.0 - google/provider/new v0.0.0-00010101000000-000000000000 - google/provider/old v0.0.0-00010101000000-000000000000 ) require ( - bitbucket.org/creachadair/stringset v0.0.8 // indirect - cloud.google.com/go v0.105.0 // indirect - cloud.google.com/go/bigtable v1.17.0 // indirect - cloud.google.com/go/compute v1.13.0 // indirect - cloud.google.com/go/compute/metadata v0.2.2 // indirect - cloud.google.com/go/iam v0.8.0 // indirect - cloud.google.com/go/longrunning v0.3.0 // indirect - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.51.0 // indirect github.com/agext/levenshtein v1.2.2 // indirect - github.com/apparentlymart/go-cidr v1.1.0 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect - github.com/cenkalti/backoff v2.2.1+incompatible // indirect - github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect - github.com/cespare/xxhash/v2 v2.1.1 // indirect - github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect - github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect - github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect github.com/fatih/color v1.13.0 // indirect - github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 // indirect - github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92 // indirect - github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect - github.com/googleapis/gax-go/v2 v2.7.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect - github.com/hashicorp/go-checkpoint v0.5.0 // indirect - github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect github.com/hashicorp/go-hclog v1.2.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.4.4 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/hc-install v0.4.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.17.3 // indirect - github.com/hashicorp/terraform-json v0.14.0 // indirect github.com/hashicorp/terraform-plugin-go v0.14.0 // indirect github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect - github.com/hashicorp/terraform-provider-google-beta v1.20.0 // indirect - github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect - github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect - github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect - github.com/kylelemons/godebug v1.1.0 // indirect + github.com/kr/pretty v0.2.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.0 // indirect - github.com/mitchellh/hashstructure v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect - github.com/oklog/run v1.0.0 // indirect - github.com/sirupsen/logrus v1.8.1 // indirect + github.com/sergi/go-diff v1.2.0 // indirect + github.com/stretchr/testify v1.8.1 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect github.com/vmihailenco/tagparser v0.1.1 // indirect - go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.105.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 // indirect - google.golang.org/grpc v1.51.0 // indirect google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/tools/missing-test-detector/go.sum b/tools/missing-test-detector/go.sum index 9200a80bcd61..0adca9eb9012 100644 --- a/tools/missing-test-detector/go.sum +++ b/tools/missing-test-detector/go.sum @@ -1,204 +1,52 @@ -bitbucket.org/creachadair/stringset v0.0.8 h1:gQqe4vs8XWgMyijfyKE6K8o4TcyGGrRXe0JvHgx5H+M= -bitbucket.org/creachadair/stringset v0.0.8/go.mod h1:AgthVMyMxC/6FK1KBJ2ALdqkZObGN8hOetgpwXyMn34= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y= -cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= -cloud.google.com/go/bigtable v1.17.0 h1:8t48YTxxFsYKy+AWuHdoePgAr4J2gEtntbdWclbEbco= -cloud.google.com/go/bigtable v1.17.0/go.mod h1:wtf7lFV1Wa5ay6aKa/gv/T2Ci7J6qXpBX8Ofij2z5mo= -cloud.google.com/go/compute v1.13.0 h1:AYrLkB8NPdDRslNp4Jxmzrhdr03fUAIDbiGFjLWowoU= -cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARyZtRXDJ8GE= -cloud.google.com/go/compute/metadata v0.2.2 h1:aWKAjYaBaOSrpKl57+jnS/3fJRQnxL7TvR/u1VVbt6k= -cloud.google.com/go/compute/metadata v0.2.2/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= -cloud.google.com/go/iam v0.8.0 h1:E2osAkZzxI/+8pZcxVLcDtAQx/u+hZXVryUaYQ5O0Kk= -cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= -cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs= -cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.51.0 h1:YhWTPhOf6gVpA9mSfnLOuL8Y6j8W5pzmHE7flXjTke4= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.51.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= -github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= -github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= -github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 h1:hzAQntlaYRkVSFEfj9OTWlVV1H155FMD8BTKktLv0QI= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 h1:zH8ljVhhq7yC0MIeUL/IviMtY8hx2mK8cN9wEYb8ggw= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/creachadair/staticfile v0.1.2/go.mod h1:a3qySzCIXEprDGxk6tSxSI+dBBdLzqeBOMhZ+o2d3pM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= -github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 h1:xvqufLtNVwAhN8NMyWklVgxnWohi+wtMGQMhtxexlm0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 h1:R+19WKQClnfMXS60cP5BmMe1wjZ4u0evY2p2Ar0ZTXo= -github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4/go.mod h1:GeIq9qoE43YdGnDXURnmKTnGg15pQz4mYkXSTChbneI= -github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92 h1:EipXK6U05IQ2wtuFRn4k3h0+2lXypzItoXGVyf4r9Io= -github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92/go.mod h1:w9RqFVO2BM3xwWEcAB8Fwp0OviTBBEiRmSBDfbXnd3w= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= -github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= -github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932 h1:5/4TSDzpDnHQ8rKEEQBjRlYx77mHOvXu08oGchxej7o= -github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932/go.mod h1:cC6EdPbj/17GFCPDK39NRarlMI+kt+O60S12cNB5J9Y= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs= -github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= -github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= -github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw= github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ= -github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk= -github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI= github.com/hashicorp/hcl/v2 v2.14.1 h1:x0BpjfZ+CYdbiz+8yZTQ+gdLO7IXvOut7Da+XJayx34= github.com/hashicorp/hcl/v2 v2.14.1/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU= -github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI= -github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= -github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4= github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE= github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 h1:FtCLTiTcykdsURXPt/ku7fYXm3y19nbzbZcUxHx9RbI= github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0/go.mod h1:80wf5oad1tW+oLnbXS4UTYmDCrl7BuN1Q+IA91X1a4Y= -github.com/hashicorp/terraform-provider-google-beta v1.20.0 h1:rxZwjTPOQgmSaBINGCRhGTf9svsFU3n1iaF5i3rYIbo= -github.com/hashicorp/terraform-provider-google-beta v1.20.0/go.mod h1:t8+8q1zjjAREhGZHvwPU35evEHk9FqNvCpP8+HwJ3Cw= -github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230302220542-203a52c6e3e1 h1:SQt8Fqd3Gn3/kztAZP66iPeAZWc0sSI8BuAInGlz7fY= -github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230302220542-203a52c6e3e1/go.mod h1:t2+a8diaNw8ijSr89vu1SXw8xaHPZ6xSHnNEnRHNfvk= -github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230303123138-8194a951d003 h1:JKikj+wm7GTMmjN27QJHiQpngOW/5JE7Az58Gk4YNcs= -github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230303123138-8194a951d003/go.mod h1:t2+a8diaNw8ijSr89vu1SXw8xaHPZ6xSHnNEnRHNfvk= -github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg= -github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= -github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= -github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jhump/protoreflect v1.6.1 h1:4/2yi5LyDPP7nN+Hiird1SAJ6YoxUm13/oxHGRnbPd8= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -206,10 +54,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= @@ -218,45 +64,24 @@ github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9 github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/hashstructure v1.1.0 h1:P6P1hdjqAAknpY/M1CGipelZgp+4y9ja9kmUZPXP+H0= -github.com/mitchellh/hashstructure v1.1.0/go.mod h1:xUDAozZz0Wmdiufv0uyhnHkUTN6/6d8ulp4AwfLKrmA= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= -github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -269,167 +94,44 @@ github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvC github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= -github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= -github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0= github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= -github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 h1:O8uGbHCqlTp2P6QJSLmCojM4mN6UemYv8K+dCnmHmu0= -golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/api v0.105.0 h1:t6P9Jj+6XTn4U9I2wycQai6Q/Kz7iOT+QzjJ3G2V4x8= -google.golang.org/api v0.105.0/go.mod h1:qh7eD5FJks5+BcE+cjBIm6Gz8vioK7EHvnlniqXBnqI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 h1:AGXp12e/9rItf6/4QymU7WsAUwCf+ICW75cuR91nJIc= -google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6/go.mod h1:1dOng4TWOomJrDGhpXjfCD35wQC6jnC7HpRmOFRqEV0= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= diff --git a/tools/teamcity-generator/go.mod b/tools/teamcity-generator/go.mod index 3f998f908e09..52feebc78ba3 100644 --- a/tools/teamcity-generator/go.mod +++ b/tools/teamcity-generator/go.mod @@ -1,5 +1,5 @@ module github.com/GoogleCloudPlatform/magic-modules/tools/teamcity-generator -go 1.20 +go 1.21 require golang.org/x/text v0.11.0 diff --git a/tpgtools/go.mod b/tpgtools/go.mod index 90f55b270e1e..370f45a397b2 100644 --- a/tpgtools/go.mod +++ b/tpgtools/go.mod @@ -1,6 +1,6 @@ module github.com/GoogleCloudPlatform/magic-modules/tpgtools -go 1.20 +go 1.21 require ( bitbucket.org/creachadair/stringset v0.0.11 diff --git a/tpgtools/go.sum b/tpgtools/go.sum index 30d683a7cf40..93cccba40a06 100644 --- a/tpgtools/go.sum +++ b/tpgtools/go.sum @@ -108,6 +108,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/tpgtools/override.go b/tpgtools/override.go index 5ce55962733c..53bd465818be 100644 --- a/tpgtools/override.go +++ b/tpgtools/override.go @@ -55,6 +55,7 @@ const ( TerraformProductName = "CUSTOM_TERRAFORM_PRODUCT_NAME" CustomTimeout = "CUSTOM_TIMEOUT" StateUpgrade = "STATE_UPGRADE" + GenerateLongFormTests = "GENERATE_LONG_FORM_TESTS" ) // Field-level Overrides diff --git a/tpgtools/property.go b/tpgtools/property.go index 62e5aa4fa51c..813b89e719ae 100644 --- a/tpgtools/property.go +++ b/tpgtools/property.go @@ -95,6 +95,11 @@ type Property struct { // the field being unset and being set to false. EnumBool bool + // Whether this field is only used as a url parameter + Parameter bool + // Whether this field has long form behavior in the DCL + HasLongForm bool + // An IdentityGetter is a function to retrieve the value of an "identity" field // from state. Identity fields will sometimes allow retrieval from multiple // fields or from the user's environment variables. @@ -210,7 +215,7 @@ func (t Type) IsSet() bool { } // Complex map is for maps of string --> object that are supported in DCL but -// not in Terraform. We handle this by adding a field in the Terraform schema +// not in Terraform. We handle this by adding a field in the Terraform schema // for the key in the map. This must be added via a COMPLEX_MAP_KEY_NAME // override func (t Type) IsComplexMap() bool { @@ -618,6 +623,9 @@ func createPropertiesFromSchema(schema *openapi.Schema, typeFetcher *TypeFetcher } } + p.Parameter, _ = v.Extension["x-dcl-parameter"].(bool) + p.HasLongForm, _ = v.Extension["x-dcl-has-long-form"].(bool) + // Handle object properties if len(v.Properties) > 0 { props, err := createPropertiesFromSchema(v, typeFetcher, overrides, resource, &p, location) @@ -691,11 +699,11 @@ func createPropertiesFromSchema(schema *openapi.Schema, typeFetcher *TypeFetcher return nil, fmt.Errorf("failed to find complex map key name for map named: %s", p.Name()) } keyProp := Property{ - title: cm.KeyName, - Type: Type{&openapi.Schema{Type: "string"}}, - resource: resource, - parent: &p, - Required: true, + title: cm.KeyName, + Type: Type{&openapi.Schema{Type: "string"}}, + resource: resource, + parent: &p, + Required: true, Description: "The name for the key in the map for which this object is mapped to in the API", } props = append([]Property{keyProp}, props...) diff --git a/tpgtools/resource.go b/tpgtools/resource.go index 5ceda2b47bb5..c7916dd303a1 100644 --- a/tpgtools/resource.go +++ b/tpgtools/resource.go @@ -178,6 +178,9 @@ type Resource struct { SchemaVersion int // The schema versions from 0 to the current schema version SchemaVersions []int + + // Whether to generate long form versions of resource sample tests + GenerateLongFormTests bool } type Link struct { @@ -711,6 +714,10 @@ func createResource(schema *openapi.Schema, info *openapi.Info, typeFetcher *Typ } } + if overrides.ResourceOverride(GenerateLongFormTests, location) { + res.GenerateLongFormTests = true + } + res.Samples = res.loadSamples() return &res, nil @@ -977,7 +984,23 @@ func (r *Resource) loadDCLSamples() []Sample { sample.IgnoreRead = append(sample.IgnoreRead, "annotations") } + if r.GenerateLongFormTests { + longFormSample := sample + longFormSample.LongForm = true + var longFormDependencies []Dependency + mainResourceLongForm := longFormSample.generateSampleDependencyWithName(primaryResource, "primary") + longFormDependencies = append(longFormDependencies, mainResourceLongForm) + for _, dFileName := range longFormSample.DependencyFileNames { + longFormDependency := sample.generateSampleDependency(dFileName) + longFormDependencies = append(longFormDependencies, longFormDependency) + } + longFormSample.DependencyList = longFormDependencies + longFormSample.TestSlug += "LongForm" + samples = append(samples, longFormSample) + } + samples = append(samples, sample) + } return samples diff --git a/tpgtools/sample.go b/tpgtools/sample.go index 057b74dfa518..c934575ea8bd 100644 --- a/tpgtools/sample.go +++ b/tpgtools/sample.go @@ -46,6 +46,9 @@ type Sample struct { // in the testcase. (if the test doesn't have a ga version of the test) HasGAEquivalent bool + // LongForm is whether this sample is a copy with long form fields expanded to include `/` + LongForm bool + // SamplesPath is the path to the directory where the original sample data is stored SamplesPath Filepath @@ -165,7 +168,7 @@ func findDCLReferencePackage(product SnakeCaseProductName) (DCLPackageName, erro } // BuildDependency produces a Dependency using a file and filename -func BuildDependency(fileName string, product SnakeCaseProductName, localname, version string, hasGAEquivalent bool, b []byte) (*Dependency, error) { +func BuildDependency(fileName string, product SnakeCaseProductName, localname, version string, hasGAEquivalent, makeLongForm bool, b []byte) (*Dependency, error) { // Miscellaneous name rather than "resource name" because this is the name in the sample json file - which might not match the TF name! // we have to account for that. var resourceName miscellaneousNameSnakeCase @@ -194,7 +197,7 @@ func BuildDependency(fileName string, product SnakeCaseProductName, localname, v return nil, fmt.Errorf("Error generating sample dependency reference %s: %s", fileName, err) } - block, err := ConvertSampleJSONToHCL(packageName, resourceName, version, hasGAEquivalent, b) + block, err := ConvertSampleJSONToHCL(packageName, resourceName, version, hasGAEquivalent, makeLongForm, b) if err != nil { glog.Errorf("failed to convert %q", fileName) return nil, fmt.Errorf("Error generating sample dependency %s: %s", fileName, err) @@ -223,7 +226,7 @@ func (s *Sample) generateSampleDependencyWithName(fileName, localname string) De dependencyBytes, err := ioutil.ReadFile(path.Join(string(s.SamplesPath), fileName)) version := s.resourceReference.versionMetadata.V product := s.resourceReference.productMetadata.ProductName - d, err := BuildDependency(fileName, product, localname, version, s.HasGAEquivalent, dependencyBytes) + d, err := BuildDependency(fileName, product, localname, version, s.HasGAEquivalent, s.LongForm, dependencyBytes) if err != nil { glog.Exit(err) } diff --git a/tpgtools/serialization.go.base b/tpgtools/serialization.go.base index 58f01e79d9ba..d29fea9ab9fd 100644 --- a/tpgtools/serialization.go.base +++ b/tpgtools/serialization.go.base @@ -8,7 +8,7 @@ func DCLToTerraformReference(product DCLPackageName, resource miscellaneousNameS return "", fmt.Errorf("unimplemented - did you run `make serialize`?") } -func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSnakeCase, version string, hasGAEquivalent bool, b []byte) (string, error) { +func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSnakeCase, version string, hasGAEquivalent, makeLongForm bool, b []byte) (string, error) { return "", fmt.Errorf("unimplemented - did you run `make serialize`?") } diff --git a/tpgtools/templates/serialization.go.tmpl b/tpgtools/templates/serialization.go.tmpl index faba0a38cdfc..c1c46b76f030 100644 --- a/tpgtools/templates/serialization.go.tmpl +++ b/tpgtools/templates/serialization.go.tmpl @@ -72,7 +72,7 @@ func DCLToTerraformReference(product DCLPackageName, resource miscellaneousNameS } // ConvertSampleJSONToHCL unmarshals json to an HCL string. -func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSnakeCase, version string, hasGAEquivalent bool, b []byte) (string, error) { +func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSnakeCase, version string, hasGAEquivalent, makeLongForm bool, b []byte) (string, error) { {{- range $version, $resList := $.Resources }} {{- if not (eq $version.V "ga") }} if version == "{{$version.V}}" { @@ -86,7 +86,7 @@ func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSn {{- if $res.CustomSerializer }} return {{$res.CustomSerializer}}(*r, hasGAEquivalent) {{- else }} - return {{$res.TitleCaseFullName}}{{$version.SerializationSuffix}}AsHCL(*r, hasGAEquivalent) + return {{$res.TitleCaseFullName}}{{$version.SerializationSuffix}}AsHCL(*r, hasGAEquivalent, makeLongForm) {{- end }} {{- end }} } @@ -103,7 +103,7 @@ func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSn {{- if $res.CustomSerializer }} return {{$res.CustomSerializer}}(*r, hasGAEquivalent) {{- else }} - return {{$res.TitleCaseFullName}}{{$version.SerializationSuffix}}AsHCL(*r, hasGAEquivalent) + return {{$res.TitleCaseFullName}}{{$version.SerializationSuffix}}AsHCL(*r, hasGAEquivalent, makeLongForm) {{- end }} {{- end }} default: @@ -123,7 +123,7 @@ func ConvertSampleJSONToHCL(product DCLPackageName, resource miscellaneousNameSn // the crucial point is that `terraform import; terraform apply` will not produce // any changes. We do not validate that the resource specified will pass terraform // validation unless is an object returned from the API after an Apply. -func {{ $res.TitleCaseFullName }}{{$version.SerializationSuffix}}AsHCL(r {{$res.Package}}{{$version.SerializationSuffix}}.{{$res.DCLStructName}}, hasGAEquivalent bool) (string, error) { +func {{ $res.TitleCaseFullName }}{{$version.SerializationSuffix}}AsHCL(r {{$res.Package}}{{$version.SerializationSuffix}}.{{$res.DCLStructName}}, hasGAEquivalent, makeLongForm bool) (string, error) { outputConfig := "resource \"{{$res.TerraformName}}\" \"output\" {\n" {{- range $field := $res.Properties}} {{- if $field.ShouldShowUpInSamples }} @@ -138,7 +138,15 @@ func {{ $res.TitleCaseFullName }}{{$version.SerializationSuffix}}AsHCL(r {{$res. } {{- else }} if r.{{$field.PackageName}} != nil { + {{- if or $field.Parameter $field.HasLongForm }} + if makeLongForm { + outputConfig += fmt.Sprintf("\t{{$field.Name}} = %#v\n", "long/form/" + *r.{{$field.PackageName}}) + } else { + outputConfig += fmt.Sprintf("\t{{$field.Name}} = %#v\n", *r.{{$field.PackageName}}) + } + {{- else }} outputConfig += fmt.Sprintf("\t{{$field.Name}} = %#v\n", *r.{{$field.PackageName}}) + {{- end }} } {{- end}} {{- else if $field.Type.IsObject }}