diff --git a/.ci/containers/build-environment/Dockerfile b/.ci/containers/build-environment/Dockerfile index 644d37c66695..b22577e1128a 100644 --- a/.ci/containers/build-environment/Dockerfile +++ b/.ci/containers/build-environment/Dockerfile @@ -1,3 +1,4 @@ +# Stage 1: Building Go dependencies FROM golang:1.23-bullseye AS builder # Set working directory @@ -10,6 +11,11 @@ ADD "https://raw.githubusercontent.com/GoogleCloudPlatform/magic-modules/main/tp # Install the go dependencies RUN go mod download +# Stage 2: Creating the final imag +FROM ruby:3.1-bullseye + +# golang +COPY --from=golang:1.23-bullseye /usr/local/go /usr/local/go ENV GOPATH /go ENV PATH /usr/local/go/bin:$PATH ENV PATH $GOPATH/bin:$PATH @@ -32,3 +38,12 @@ RUN git config --global user.email "magic-modules@google.com" RUN go install golang.org/x/tools/cmd/goimports@d088b475e3360caabc032aaee1dc66351d4e729a RUN go install github.com/github/hub@v2.11.2+incompatible + +ADD "https://raw.githubusercontent.com/GoogleCloudPlatform/magic-modules/refs/heads/legacy-ruby/mmv1/Gemfile" Gemfile +ADD "https://raw.githubusercontent.com/GoogleCloudPlatform/magic-modules/refs/heads/legacy-ruby/mmv1/Gemfile.lock" Gemfile.lock +RUN bundle install +RUN rm Gemfile Gemfile.lock + +# Copy Go dependencies from builder stage +COPY --from=builder /go/pkg /go/pkg + diff --git a/.ci/gcb-test-failure-ticket.yaml b/.ci/gcb-test-failure-ticket.yaml deleted file mode 100644 index 55701fc9515b..000000000000 --- a/.ci/gcb-test-failure-ticket.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -steps: - - name: 'gcr.io/graphite-docker-images/go-plus' - id: gcb-test-failure-ticket - entrypoint: '/workspace/.ci/scripts/go-plus/magician/exec.sh' - secretEnv: ["TEAMCITY_TOKEN"] - args: - - 'collect-nightly-test-status' - - $_CUSTOM_DATE - -timeout: 3600s -options: - machineType: 'N1_HIGHCPU_32' - -logsBucket: 'gs://cloudbuild-test-failure-ticket-logs' -availableSecrets: - secretManager: - - versionName: projects/673497134629/secrets/teamcity-token/versions/latest - env: TEAMCITY_TOKEN \ No newline at end of file diff --git a/.ci/infra/terraform/main.tf b/.ci/infra/terraform/main.tf index 2a259f5396bc..b367dcb37618 100644 --- a/.ci/infra/terraform/main.tf +++ b/.ci/infra/terraform/main.tf @@ -298,7 +298,6 @@ module "project-services" { "logging.googleapis.com", "looker.googleapis.com", "managedidentities.googleapis.com", - "managedkafka.googleapis.com", "memcache.googleapis.com", "memorystore.googleapis.com", "metastore.googleapis.com", @@ -317,7 +316,6 @@ module "project-services" { "osconfig.googleapis.com", "oslogin.googleapis.com", "parallelstore.googleapis.com", - "parametermanager.googleapis.com", "privateca.googleapis.com", "privilegedaccessmanager.googleapis.com", "pubsub.googleapis.com", @@ -469,13 +467,6 @@ resource "google_project_iam_member" "compute_agent_encrypter_decrypter" { member = "serviceAccount:service-${google_project.proj.number}@compute-system.iam.gserviceaccount.com" } -# TestAccColabRuntime_colabRuntimeBasicExample -# TestAccColabRuntime_colabRuntimeFullExample -resource "google_project_iam_member" "colab_admin_permissions" { - project = google_project.proj.project_id - role = "roles/aiplatform.colabEnterpriseAdmin" - member = "user:gterraformtestuser@gmail.com" -} data "google_organization" "org2" { organization = var.org2_id diff --git a/.ci/magician/cloudstorage/bucket.go b/.ci/magician/cloudstorage/bucket.go deleted file mode 100644 index 58b685c0d0f2..000000000000 --- a/.ci/magician/cloudstorage/bucket.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright 2025 Google LLC. All Rights Reserved. -* -* 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 cloudstorage - -import ( - "context" - "fmt" - "io" - "os" - "time" - - "cloud.google.com/go/storage" -) - -func (gcs *Client) WriteToGCSBucket(bucket, object, filePath string) error { - ctx := context.Background() - - client, err := storage.NewClient(ctx) - if err != nil { - return fmt.Errorf("storage.NewClient: %v", err) - } - defer client.Close() - - file, err := os.Open(filePath) - if err != nil { - return fmt.Errorf("os.Open: %w", err) - } - defer file.Close() - - ctx, cancel := context.WithTimeout(ctx, time.Second*50) - defer cancel() - - writer := client.Bucket(bucket).Object(object).NewWriter(ctx) - writer.ContentType = "application/json" - - if _, err = io.Copy(writer, file); err != nil { - return fmt.Errorf("io.Copy: %w", err) - } - if err := writer.Close(); err != nil { - return fmt.Errorf("Writer.Close: %w", err) - } - - fmt.Printf("File uploaded to bucket %s as %s\n", bucket, object) - return nil -} diff --git a/.ci/magician/cloudstorage/init.go b/.ci/magician/cloudstorage/init.go deleted file mode 100644 index 1c6b2c9d34d5..000000000000 --- a/.ci/magician/cloudstorage/init.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -* Copyright 2025 Google LLC. All Rights Reserved. -* -* 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 cloudstorage - -type Client struct { -} - -func NewClient() *Client { - return &Client{} -} diff --git a/.ci/magician/cmd/collect_nightly_test_status.go b/.ci/magician/cmd/collect_nightly_test_status.go deleted file mode 100644 index cec84375468a..000000000000 --- a/.ci/magician/cmd/collect_nightly_test_status.go +++ /dev/null @@ -1,228 +0,0 @@ -/* -* Copyright 2025 Google LLC. All Rights Reserved. -* -* 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 cmd - -import ( - "fmt" - "magician/cloudstorage" - "magician/provider" - "magician/teamcity" - utils "magician/utility" - "os" - "strconv" - "strings" - "time" - - "github.com/spf13/cobra" -) - -const ( - NIGHTLY_DATA_BUCKET = "nightly-test-data" -) - -var cntsRequiredEnvironmentVariables = [...]string{ - "TEAMCITY_TOKEN", -} - -type TestInfo struct { - Name string `json:"name"` - Status string `json:"status"` - Service string `json:"service"` - ErrorMessage string `json:"error_message"` - LogLink string `json"log_link` -} - -// collectNightlyTestStatusCmd represents the collectNightlyTestStatus command -var collectNightlyTestStatusCmd = &cobra.Command{ - Use: "collect-nightly-test-status", - Short: "Collects and stores nightly test status", - Long: `This command collects nightly test status, stores the data in JSON files and upload the files to GCS. - - - The command expects the following argument(s): - 1. Custom test date in YYYY-MM-DD format. default: ""(current time when the job is executed) - - It then performs the following operations: - 1. Collects nightly test status of the execution day or the specified test date (if provided) - 2. Stores the collected data in JSON files - 3. Uploads the JSON files to GCS - - The following environment variables are required: -` + listCNTSRequiredEnvironmentVariables(), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - env := make(map[string]string) - for _, ev := range cntsRequiredEnvironmentVariables { - val, ok := os.LookupEnv(ev) - if !ok { - return fmt.Errorf("did not provide %s environment variable", ev) - } - env[ev] = val - } - - tc := teamcity.NewClient(env["TEAMCITY_TOKEN"]) - gcs := cloudstorage.NewClient() - - now := time.Now() - - loc, err := time.LoadLocation("America/Los_Angeles") - if err != nil { - return fmt.Errorf("Error loading location: %s", err) - } - date := now.In(loc) - customDate := args[0] - // check if a specific date is provided - if customDate != "" { - parsedDate, err := time.Parse("2006-01-02", customDate) // input format YYYY-MM-DD - // Set the time to 6pm PT - date = time.Date(parsedDate.Year(), parsedDate.Month(), parsedDate.Day(), 18, 0, 0, 0, loc) - if err != nil { - return fmt.Errorf("invalid input time format: %w", err) - } - } - - return execCollectNightlyTestStatus(date, tc, gcs) - }, -} - -func listCNTSRequiredEnvironmentVariables() string { - var result string - for i, ev := range cntsRequiredEnvironmentVariables { - result += fmt.Sprintf("\t%2d. %s\n", i+1, ev) - } - return result -} - -func execCollectNightlyTestStatus(now time.Time, tc TeamcityClient, gcs CloudstorageClient) error { - lastday := now.AddDate(0, 0, -1) - formattedStartCut := lastday.Format(time.RFC3339) - formattedFinishCut := now.Format(time.RFC3339) - date := now.Format("2006-01-02") - - err := createTestReport(provider.GA, tc, gcs, formattedStartCut, formattedFinishCut, date) - if err != nil { - return fmt.Errorf("Error getting GA nightly test status: %w", err) - } - - err = createTestReport(provider.Beta, tc, gcs, formattedStartCut, formattedFinishCut, date) - if err != nil { - return fmt.Errorf("Error getting Beta nightly test status: %w", err) - } - - return nil -} - -func createTestReport(pVersion provider.Version, tc TeamcityClient, gcs CloudstorageClient, formattedStartCut, formattedFinishCut, date string) error { - // Get all service test builds - builds, err := tc.GetBuilds(pVersion.TeamCityNightlyProjectName(), formattedFinishCut, formattedStartCut) - if err != nil { - return err - } - - var testInfoList []TestInfo - for _, build := range builds.Builds { - // Get service package name - serviceName, err := convertServiceName(build.BuildTypeId) - if err != nil { - return fmt.Errorf("failed to convert test service name for %s: %v", build.BuildTypeId, err) - } - // Skip sweeper package - if serviceName == "sweeper" { - continue - } - - // Get test results - serviceTestResults, err := tc.GetTestResults(build) - if err != nil { - return fmt.Errorf("failed to get test results: %v", err) - } - if len(serviceTestResults.TestResults) == 0 { - fmt.Printf("Service %s has no tests\n", serviceName) - continue - } - - for _, testResult := range serviceTestResults.TestResults { - var errorMessage string - // Get test debug log gcs link - logLink := fmt.Sprintf("https://storage.cloud.google.com/teamcity-logs/nightly/%s/%s/%s/debug-%s-%s-%s-%s.txt", pVersion.TeamCityNightlyProjectName(), date, build.Number, pVersion.ProviderName(), build.Number, strconv.Itoa(build.Id), testResult.Name) - // Get concise error message - if testResult.Status == "FAILURE" { - errorMessage = convertErrorMessage(testResult.ErrorMessage) - } - testInfoList = append(testInfoList, TestInfo{ - Name: testResult.Name, - Status: testResult.Status, - Service: serviceName, - ErrorMessage: errorMessage, - LogLink: logLink, - }) - } - } - - // Write test status data to a JSON file - fmt.Println("Write test status") - testStatusFileName := fmt.Sprintf("%s-%s.json", date, pVersion.String()) - err = utils.WriteToJson(testInfoList, testStatusFileName) - if err != nil { - return err - } - - // Upload test status data file to gcs bucket - objectName := pVersion.String() + "/" + testStatusFileName - err = gcs.WriteToGCSBucket(NIGHTLY_DATA_BUCKET, objectName, testStatusFileName) - if err != nil { - return err - } - - return nil -} - -// convertServiceName extracts service package name from teamcity build type id -// input: TerraformProviders_GoogleCloud_GOOGLE_NIGHTLYTESTS_GOOGLE_PACKAGE_SECRETMANAGER -// output: secretmanager -func convertServiceName(servicePath string) (string, error) { - idx := strings.LastIndex(servicePath, "_") - - if idx != -1 { - return strings.ToLower(servicePath[idx+1:]), nil - } - return "", fmt.Errorf("wrong service path format for %s", servicePath) -} - -// convertErrorMessage returns concise error message -func convertErrorMessage(rawErrorMessage string) string { - - startMarker := "------- Stdout: -------" - endMarker := "------- Stderr: -------" - startIndex := strings.Index(rawErrorMessage, startMarker) - endIndex := strings.Index(rawErrorMessage, endMarker) - - if startIndex != -1 { - startIndex += len(startMarker) - } else { - startIndex = 0 - } - - if endIndex == -1 { - endIndex = len(rawErrorMessage) - } - - return strings.TrimSpace(rawErrorMessage[startIndex:endIndex]) -} - -func init() { - rootCmd.AddCommand(collectNightlyTestStatusCmd) -} diff --git a/.ci/magician/cmd/collect_nightly_test_status_test.go b/.ci/magician/cmd/collect_nightly_test_status_test.go deleted file mode 100644 index a1f11f8bb537..000000000000 --- a/.ci/magician/cmd/collect_nightly_test_status_test.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -* Copyright 2025 Google LLC. All Rights Reserved. -* -* 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 cmd - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestConvertServiceName(t *testing.T) { - cases := map[string]struct { - servicePath string - want string - wantError bool - }{ - "valid service path": { - servicePath: "TerraformProviders_GoogleCloud_GOOGLE_NIGHTLYTESTS_GOOGLE_PACKAGE_SECRETMANAGER", - want: "secretmanager", - wantError: false, - }, - "invalid service path": { - servicePath: "SECRETMANAGER", - want: "", - wantError: true, - }, - } - - for tn, tc := range cases { - t.Run(tn, func(t *testing.T) { - got, err := convertServiceName(tc.servicePath) - if tc.wantError { - assert.Error(t, err) - } else { - assert.NoError(t, err) - assert.Equal(t, tc.want, got) - } - }) - } -} - -func TestConvertErrorMessage(t *testing.T) { - cases := map[string]struct { - rawErrorMessage string - want string - }{ - "error message with start and end markers": { - rawErrorMessage: "------- Stdout: ------- === RUN TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === PAUSE TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === CONT TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample --- PASS: TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample (11.76s) PASS ------- Stderr: ------- 2025/01/21 08:06:22 [DEBUG] [transport] [server-transport 0xc002614000] Closing: EOF 2025/01/21 08:06:22 [DEBUG] [transport] [server-transport 0xc002614000] loopyWriter exiting with error: transport closed by client 2025/01/21 08:06:22", - want: "=== RUN TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === PAUSE TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === CONT TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample --- PASS: TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample (11.76s) PASS", - }, - "error message with start but no end markers": { - rawErrorMessage: "------- Stdout: ------- === RUN TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === PAUSE TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === CONT TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample --- PASS: TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample (11.76s) PASS", - want: "=== RUN TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === PAUSE TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === CONT TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample --- PASS: TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample (11.76s) PASS", - }, - "error message with no start but with end markers": { - rawErrorMessage: "=== RUN TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === PAUSE TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === CONT TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample --- PASS: TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample (11.76s) PASS ------- Stderr: ------- 2025/01/21 08:06:22 [DEBUG] [transport] [server-transport 0xc002614000] Closing: EOF 2025/01/21 08:06:22 [DEBUG] [transport] [server-transport 0xc002614000] loopyWriter exiting with error: transport closed by client 2025/01/21 08:06:22", - want: "=== RUN TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === PAUSE TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === CONT TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample --- PASS: TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample (11.76s) PASS", - }, - "error message with no start and no end markers": { - rawErrorMessage: "=== RUN TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === PAUSE TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === CONT TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample --- PASS: TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample (11.76s) PASS", - want: "=== RUN TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === PAUSE TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample === CONT TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample --- PASS: TestAccColabRuntimeTemplate_colabRuntimeTemplateBasicExample (11.76s) PASS", - }, - } - - for tn, tc := range cases { - t.Run(tn, func(t *testing.T) { - got := convertErrorMessage(tc.rawErrorMessage) - assert.Equal(t, tc.want, got) - }) - } -} diff --git a/.ci/magician/cmd/generate_comment.go b/.ci/magician/cmd/generate_comment.go index 2b4f78d04cd2..20a5d41b5d2d 100644 --- a/.ci/magician/cmd/generate_comment.go +++ b/.ci/magician/cmd/generate_comment.go @@ -73,10 +73,6 @@ type diffCommentData struct { Errors []Errors } -type simpleSchemaDiff struct { - AddedResources, ModifiedResources, RemovedResources []string -} - const allowBreakingChangesLabel = "override-breaking-change" var gcEnvironmentVariables = [...]string{ @@ -208,26 +204,24 @@ func execGenerateComment(prNumber int, ghTokenMagicModules, buildId, buildStep, repo.Branch = newBranch repo.Cloned = true if err := ctlr.Clone(repo); err != nil { - fmt.Printf("Failed to clone repo %q at branch %q: %s\n", repo.Name, newBranch, err) + fmt.Println("Failed to clone repo at new branch: ", err) errors[repo.Title] = append(errors[repo.Title], "Failed to clone repo at new branch") repo.Cloned = false } if err := ctlr.Fetch(repo, oldBranch); err != nil { - fmt.Printf("Failed to fetch branch %q for repo %q: %s\n", oldBranch, repo.Name, err) + fmt.Println("Failed to fetch old branch: ", err) errors[repo.Title] = append(errors[repo.Title], "Failed to clone repo at old branch") repo.Cloned = false continue } if repo.Name == "terraform-provider-google-beta" || repo.Name == "terraform-provider-google" { if err := ctlr.Checkout(repo, oldBranch); err != nil { - fmt.Printf("Failed to checkout branch %q for repo %q: %s\n", oldBranch, repo.Name, err) errors[repo.Title] = append(errors[repo.Title], fmt.Sprintf("Failed to checkout branch %s", oldBranch)) repo.Cloned = false continue } rnr.PushDir(repo.Path) if _, err := rnr.Run("make", []string{"build"}, nil); err != nil { - fmt.Printf("Failed to build branch %q for repo %q: %s\n", oldBranch, repo.Name, err) errors[repo.Title] = append(errors[repo.Title], fmt.Sprintf("Failed to build branch %s", oldBranch)) repo.Cloned = false } @@ -309,7 +303,7 @@ func execGenerateComment(prNumber int, ghTokenMagicModules, buildId, buildStep, data.MissingTests = missingTests } - affectedResources, err := computeAffectedResources(diffProcessorPath, rnr, repo) + affectedResources, err := changedSchemaResources(diffProcessorPath, rnr) if err != nil { fmt.Println("computing changed resource schemas: ", err) errors[repo.Title] = append(errors[repo.Title], "The diff processor crashed while computing changed resource schemas.") @@ -466,31 +460,27 @@ func computeBreakingChanges(diffProcessorPath string, rnr ExecRunner) ([]Breakin return changes, rnr.PopDir() } -func computeAffectedResources(diffProcessorPath string, rnr ExecRunner, repo source.Repo) ([]string, error) { +func changedSchemaResources(diffProcessorPath string, rnr ExecRunner) ([]string, error) { if err := rnr.PushDir(diffProcessorPath); err != nil { return nil, err } - output, err := rnr.Run("bin/diff-processor", []string{"schema-diff"}, nil) + output, err := rnr.Run("bin/diff-processor", []string{"changed-schema-resources"}, nil) if err != nil { return nil, err } - fmt.Printf("Schema diff for %q: %s\n", repo.Name, output) + fmt.Println("Resources with changed schemas: " + output) - var simpleDiff simpleSchemaDiff - if err = json.Unmarshal([]byte(output), &simpleDiff); err != nil { + var labels []string + if err = json.Unmarshal([]byte(output), &labels); err != nil { return nil, err } if err = rnr.PopDir(); err != nil { return nil, err } - var resources []string - resources = append(resources, simpleDiff.AddedResources...) - resources = append(resources, simpleDiff.ModifiedResources...) - resources = append(resources, simpleDiff.RemovedResources...) - return resources, nil + return labels, nil } // Run the missing test detector and return the results. diff --git a/.ci/magician/cmd/generate_comment_test.go b/.ci/magician/cmd/generate_comment_test.go index 057034f739d6..49ffa223fd5a 100644 --- a/.ci/magician/cmd/generate_comment_test.go +++ b/.ci/magician/cmd/generate_comment_test.go @@ -89,11 +89,11 @@ func TestExecGenerateComment(t *testing.T) { {"/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{"schema-diff"}, map[string]string(nil)}, + {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"changed-schema-resources"}, 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{"detect-missing-tests", "/mock/dir/tpgb/google-beta/services"}, map[string]string(nil)}, - {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"schema-diff"}, map[string]string(nil)}, + {"/mock/dir/magic-modules/tools/diff-processor", "bin/diff-processor", []string{"changed-schema-resources"}, map[string]string(nil)}, }, } { if actualCalls, ok := mr.Calls(method); !ok { diff --git a/.ci/magician/cmd/interfaces.go b/.ci/magician/cmd/interfaces.go index bf75f12c1558..61219ef38472 100644 --- a/.ci/magician/cmd/interfaces.go +++ b/.ci/magician/cmd/interfaces.go @@ -17,7 +17,6 @@ package cmd import ( "magician/github" - "magician/teamcity" ) type GithubClient interface { @@ -42,15 +41,6 @@ type CloudbuildClient interface { ApproveDownstreamGenAndTest(prNumber, commitSha string) error } -type CloudstorageClient interface { - WriteToGCSBucket(bucketName, objectName, filePath string) error -} - -type TeamcityClient interface { - GetBuilds(project, finishCut, startCut string) (teamcity.Builds, error) - GetTestResults(build teamcity.Build) (teamcity.TestResults, error) -} - type ExecRunner interface { GetCWD() string Copy(src, dest string) error diff --git a/.ci/magician/cmd/membership_checker_test.go b/.ci/magician/cmd/membership_checker_test.go index ae2dcd9f4e7d..c32c05cff319 100644 --- a/.ci/magician/cmd/membership_checker_test.go +++ b/.ci/magician/cmd/membership_checker_test.go @@ -57,7 +57,7 @@ func TestExecMembershipChecker_GooglerFlow(t *testing.T) { userType: github.GooglerUserType, calledMethods: make(map[string][][]any), requestedReviewers: []github.User{github.User{Login: "reviewer1"}}, - previousReviewers: []github.User{github.User{Login: github.GetRandomReviewer(nil)}, github.User{Login: "reviewer3"}}, + previousReviewers: []github.User{github.User{Login: github.GetRandomReviewer()}, github.User{Login: "reviewer3"}}, } cb := &mockCloudBuild{ calledMethods: make(map[string][][]any), @@ -83,8 +83,8 @@ func TestExecMembershipChecker_AmbiguousUserFlow(t *testing.T) { }, userType: github.CommunityUserType, calledMethods: make(map[string][][]any), - requestedReviewers: []github.User{github.User{Login: github.GetRandomReviewer(nil)}}, - previousReviewers: []github.User{github.User{Login: github.GetRandomReviewer(nil)}, github.User{Login: "reviewer3"}}, + requestedReviewers: []github.User{github.User{Login: github.GetRandomReviewer()}}, + previousReviewers: []github.User{github.User{Login: github.GetRandomReviewer()}, github.User{Login: "reviewer3"}}, } cb := &mockCloudBuild{ calledMethods: make(map[string][][]any), diff --git a/.ci/magician/cmd/mock_runner_test.go b/.ci/magician/cmd/mock_runner_test.go index 4de3d64d6978..166a97412d8f 100644 --- a/.ci/magician/cmd/mock_runner_test.go +++ b/.ci/magician/cmd/mock_runner_test.go @@ -70,7 +70,7 @@ func NewMockRunner() MockRunner { "/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/tools/diff-processor bin/diff-processor [breaking-changes] map[]": "", "/mock/dir/magic-modules/tools/diff-processor make [build] " + sortedEnvString(diffProcessorEnv): "", - "/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [schema-diff] map[]": "{\"AddedResources\": [\"google_alloydb_instance\"]}", + "/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [changed-schema-resources] map[]": "[\"google_alloydb_instance\"]", "/mock/dir/magic-modules/tools/diff-processor bin/diff-processor [detect-missing-tests /mock/dir/tpgb/google-beta/services] map[]": `{"google_folder_access_approval_settings":{"SuggestedTest":"resource \"google_folder_access_approval_settings\" \"primary\" {\n uncovered_field = # value needed\n}","Tests":["a","b","c"]}}`, "/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[]": "", diff --git a/.ci/magician/cmd/reassign_reviewer.go b/.ci/magician/cmd/reassign_reviewer.go index 8c6cf2b5211c..70259d7ebb8b 100644 --- a/.ci/magician/cmd/reassign_reviewer.go +++ b/.ci/magician/cmd/reassign_reviewer.go @@ -58,44 +58,29 @@ var reassignReviewerCmd = &cobra.Command{ } func execReassignReviewer(prNumber, newPrimaryReviewer string, gh GithubClient) error { - pullRequest, err := gh.GetPullRequest(prNumber) - if err != nil { - return err - } comments, err := gh.GetPullRequestComments(prNumber) if err != nil { return err } reviewerComment, currentReviewer := github.FindReviewerComment(comments) - if newPrimaryReviewer == "" { - newPrimaryReviewer = github.GetRandomReviewer([]string{currentReviewer, pullRequest.User.Login}) - } - - if newPrimaryReviewer == "" { - return errors.New("no primary reviewer found") - } - if newPrimaryReviewer == currentReviewer { - return fmt.Errorf("primary reviewer is already %s", newPrimaryReviewer) - } - - fmt.Println("New primary reviewer is ", newPrimaryReviewer) - comment := github.FormatReviewerComment(newPrimaryReviewer) if currentReviewer == "" { fmt.Println("No reviewer comment found, creating one") - err := gh.PostComment(prNumber, comment) + newPrimaryReviewer, err = createReviewComment(prNumber, newPrimaryReviewer, gh) if err != nil { return err } } else { - fmt.Println("Updating reviewer comment") - err := gh.UpdateComment(prNumber, comment, reviewerComment.ID) + fmt.Println("Reassigning to random reviewer") + newPrimaryReviewer, err = updateReviewComment(prNumber, currentReviewer, newPrimaryReviewer, reviewerComment.ID, gh) if err != nil { return err } } + fmt.Println("New primary reviewer is ", newPrimaryReviewer) + err = gh.RequestPullRequestReviewers(prNumber, []string{newPrimaryReviewer}) if err != nil { return err @@ -104,6 +89,38 @@ func execReassignReviewer(prNumber, newPrimaryReviewer string, gh GithubClient) return nil } +func createReviewComment(prNumber, newPrimaryReviewer string, gh GithubClient) (string, error) { + if newPrimaryReviewer == "" { + newPrimaryReviewer = github.GetRandomReviewer() + } + + if newPrimaryReviewer == "" { + return "", errors.New("no primary reviewer found") + } + + err := gh.PostComment(prNumber, github.FormatReviewerComment(newPrimaryReviewer)) + if err != nil { + return "", err + } + return newPrimaryReviewer, nil +} + +func updateReviewComment(prNumber, currentReviewer, newPrimaryReviewer string, reviewerCommentID int, gh GithubClient) (string, error) { + if newPrimaryReviewer == "" { + newPrimaryReviewer = github.GetNewRandomReviewer(currentReviewer) + } + + if currentReviewer == newPrimaryReviewer { + return newPrimaryReviewer, fmt.Errorf("primary reviewer is already %s", newPrimaryReviewer) + } + + err := gh.UpdateComment(prNumber, github.FormatReviewerComment(newPrimaryReviewer), reviewerCommentID) + if err != nil { + return "", err + } + return newPrimaryReviewer, nil +} + func init() { rootCmd.AddCommand(reassignReviewerCmd) } diff --git a/.ci/magician/cmd/request_reviewer_test.go b/.ci/magician/cmd/request_reviewer_test.go index 961482975c0e..b2af19be6b2d 100644 --- a/.ci/magician/cmd/request_reviewer_test.go +++ b/.ci/magician/cmd/request_reviewer_test.go @@ -24,7 +24,7 @@ import ( ) func TestExecRequestReviewer(t *testing.T) { - availableReviewers := github.AvailableReviewers(nil) + availableReviewers := github.AvailableReviewers() if len(availableReviewers) < 3 { t.Fatalf("not enough available reviewers (%v) to run TestExecRequestReviewer (need at least 3)", availableReviewers) } diff --git a/.ci/magician/cmd/scheduled_pr_reminders_test.go b/.ci/magician/cmd/scheduled_pr_reminders_test.go index 733f2c43027d..b2556f42aac5 100644 --- a/.ci/magician/cmd/scheduled_pr_reminders_test.go +++ b/.ci/magician/cmd/scheduled_pr_reminders_test.go @@ -11,7 +11,7 @@ import ( ) func TestNotificationState(t *testing.T) { - availableReviewers := membership.AvailableReviewers(nil) + availableReviewers := membership.AvailableReviewers() firstCoreReviewer := availableReviewers[0] secondCoreReviewer := availableReviewers[1] cases := map[string]struct { @@ -964,7 +964,7 @@ func TestShouldNotify(t *testing.T) { } func TestFormatReminderComment(t *testing.T) { - availableReviewers := membership.AvailableReviewers(nil) + availableReviewers := membership.AvailableReviewers() firstCoreReviewer := availableReviewers[0] secondCoreReviewer := availableReviewers[1] cases := map[string]struct { diff --git a/.ci/magician/github/membership.go b/.ci/magician/github/membership.go index a35e6a71402c..295e8a909022 100644 --- a/.ci/magician/github/membership.go +++ b/.ci/magician/github/membership.go @@ -19,7 +19,6 @@ import ( "fmt" utils "magician/utility" "math/rand" - "slices" "time" "golang.org/x/exp/maps" @@ -27,6 +26,28 @@ import ( type UserType int64 +type date struct { + year int + month int + day int + loc *time.Location +} + +type onVacationReviewer struct { + id string + startDate date + endDate date +} + +func newDate(year, month, day int, loc *time.Location) date { + return date{ + year: year, + month: month, + day: day, + loc: loc, + } +} + const ( CommunityUserType UserType = iota GooglerUserType @@ -81,33 +102,38 @@ func isOrgMember(author, org, githubToken string) bool { return err == nil } -// GetRandomReviewer returns a random available reviewer (optionally excluding some people from the reviewer pool) -func GetRandomReviewer(excludedReviewers []string) string { - availableReviewers := AvailableReviewers(excludedReviewers) +func GetRandomReviewer() string { + availableReviewers := AvailableReviewers() + reviewer := availableReviewers[rand.Intn(len(availableReviewers))] + return reviewer +} + +// Return a random reviewer other than the old reviewer +func GetNewRandomReviewer(oldReviewer string) string { + availableReviewers := AvailableReviewers() + availableReviewers = utils.Removes(availableReviewers, []string{oldReviewer}) reviewer := availableReviewers[rand.Intn(len(availableReviewers))] return reviewer } -func AvailableReviewers(excludedReviewers []string) []string { - return available(time.Now(), reviewerRotation, excludedReviewers) +func AvailableReviewers() []string { + return available(time.Now(), maps.Keys(reviewerRotation), onVacationReviewers) } -func available(nowTime time.Time, reviewerRotation map[string]ReviewerConfig, excludedReviewers []string) []string { - excludedReviewers = append(excludedReviewers, onVacation(nowTime, reviewerRotation)...) - ret := utils.Removes(maps.Keys(reviewerRotation), excludedReviewers) - slices.Sort(ret) - return ret +func available(nowTime time.Time, allReviewers []string, vacationList []onVacationReviewer) []string { + onVacationList := onVacation(nowTime, vacationList) + return utils.Removes(allReviewers, onVacationList) } -func onVacation(nowTime time.Time, reviewerRotation map[string]ReviewerConfig) []string { +func onVacation(nowTime time.Time, vacationList []onVacationReviewer) []string { var onVacationList []string - for reviewer, config := range reviewerRotation { - for _, v := range config.vacations { - if nowTime.Before(v.GetStart(config.timezone)) || nowTime.After(v.GetEnd(config.timezone)) { - continue - } - onVacationList = append(onVacationList, reviewer) + for _, reviewer := range vacationList { + start := time.Date(reviewer.startDate.year, time.Month(reviewer.startDate.month), reviewer.startDate.day, 0, 0, 0, 0, reviewer.startDate.loc) + end := time.Date(reviewer.endDate.year, time.Month(reviewer.endDate.month), reviewer.endDate.day, 0, 0, 0, 0, reviewer.endDate.loc).AddDate(0, 0, 1).Add(-1 * time.Millisecond) + if nowTime.Before(start) || nowTime.After(end) { + continue } + onVacationList = append(onVacationList, reviewer.id) } return onVacationList } diff --git a/.ci/magician/github/membership_data.go b/.ci/magician/github/membership_data.go index 4faada3bfbca..6b3362b111c1 100644 --- a/.ci/magician/github/membership_data.go +++ b/.ci/magician/github/membership_data.go @@ -2,123 +2,128 @@ package github import "time" -type date struct { - year int - month int - day int -} - -func newDate(year, month, day int) date { - return date{ - year: year, - month: month, - day: day, - } -} - -type Vacation struct { - startDate, endDate date -} - -// GetStart returns a time corresponding to the beginning of the start date in the given timezone. -func (v Vacation) GetStart(timezone *time.Location) time.Time { - if timezone == nil { - timezone = usPacific - } - return time.Date(v.startDate.year, time.Month(v.startDate.month), v.startDate.day, 0, 0, 0, 0, timezone) -} - -// GetEnd returns a time corresponding to the end of the end date in the given timezone -func (v Vacation) GetEnd(timezone *time.Location) time.Time { - if timezone == nil { - timezone = usPacific +var ( + // This is for the random-assignee rotation. + reviewerRotation = map[string]struct{}{ + "slevenick": {}, + "c2thorn": {}, + "rileykarson": {}, + "melinath": {}, + "ScottSuarez": {}, + "shuyama1": {}, + "roaks3": {}, + "zli82016": {}, + "trodge": {}, + "hao-nan-li": {}, + "NickElliot": {}, + "BBBmau": {}, + "SirGitsalot": {}, } - return time.Date(v.endDate.year, time.Month(v.endDate.month), v.endDate.day, 0, 0, 0, 0, timezone).AddDate(0, 0, 1).Add(-1 * time.Millisecond) -} - -type ReviewerConfig struct { - // timezone controls the timezone for vacation start / end dates. Default: US/Pacific. - timezone *time.Location - // vacations allows specifying times when new reviews should not be requested of the reviewer. - // Existing PRs will still have reviews re-requested. - // Both startDate and endDate are inclusive. - // Example: taking vacation from 2024-03-28 to 2024-04-02. - // { - // vacations: []Vacation{ - // startDate: newDate(2024, 3, 28), - // endDate: newDate(2024, 4, 2), - // }, - // }, - vacations []Vacation -} - -var ( - usPacific, _ = time.LoadLocation("US/Pacific") - usCentral, _ = time.LoadLocation("US/Central") - usEastern, _ = time.LoadLocation("US/Eastern") - london, _ = time.LoadLocation("Europe/London") + // This is for new team members who are onboarding + trustedContributors = map[string]struct{}{} - // This is for the random-assignee rotation. - reviewerRotation = map[string]ReviewerConfig{ - "BBBmau": { - vacations: []Vacation{ - { - startDate: newDate(2024, 11, 1), - endDate: newDate(2024, 11, 1), - }, - }, + // This is for reviewers who are "on vacation": will not receive new review assignments but will still receive re-requests for assigned PRs. + // User can specify the time zone like this, and following the example below: + pdtLoc, _ = time.LoadLocation("America/Los_Angeles") + bstLoc, _ = time.LoadLocation("Europe/London") + onVacationReviewers = []onVacationReviewer{ + // Example: taking vacation from 2024-03-28 to 2024-04-02 in pdt time zone. + // both ends are inclusive: + // { + // id: "xyz", + // startDate: newDate(2024, 3, 28, pdtLoc), + // endDate: newDate(2024, 4, 2, pdtLoc), + // }, + { + id: "BBBmau", + startDate: newDate(2024, 11, 1, pdtLoc), + endDate: newDate(2024, 11, 1, pdtLoc), }, - "c2thorn": { - vacations: []Vacation{}, + { + id: "hao-nan-li", + startDate: newDate(2024, 12, 23, pdtLoc), + endDate: newDate(2025, 1, 5, pdtLoc), }, - "hao-nan-li": { - vacations: []Vacation{}, + { + id: "ScottSuarez", + startDate: newDate(2024, 4, 30, pdtLoc), + endDate: newDate(2024, 7, 31, pdtLoc), }, - "melinath": { - vacations: []Vacation{}, + { + id: "shuyama1", + startDate: newDate(2024, 9, 26, pdtLoc), + endDate: newDate(2024, 10, 4, pdtLoc), }, - "NickElliot": { - vacations: []Vacation{}, + { + id: "melinath", + startDate: newDate(2024, 12, 19, pdtLoc), + endDate: newDate(2025, 1, 7, pdtLoc), }, - "rileykarson": { - vacations: []Vacation{}, + { + id: "slevenick", + startDate: newDate(2024, 7, 5, pdtLoc), + endDate: newDate(2024, 7, 16, pdtLoc), }, - "roaks3": { - vacations: []Vacation{}, + { + id: "c2thorn", + startDate: newDate(2024, 7, 10, pdtLoc), + endDate: newDate(2024, 7, 16, pdtLoc), }, - "ScottSuarez": { - vacations: []Vacation{}, + { + id: "rileykarson", + startDate: newDate(2024, 7, 18, pdtLoc), + endDate: newDate(2024, 8, 10, pdtLoc), }, - "shuyama1": { - vacations: []Vacation{}, + { + id: "roaks3", + startDate: newDate(2024, 8, 2, pdtLoc), + endDate: newDate(2024, 8, 9, pdtLoc), }, - "SirGitsalot": { - vacations: []Vacation{ - { - startDate: newDate(2025, 1, 18), - endDate: newDate(2025, 1, 25), - }, - }, + { + id: "slevenick", + startDate: newDate(2024, 8, 10, pdtLoc), + endDate: newDate(2024, 8, 17, pdtLoc), }, - "slevenick": { - vacations: []Vacation{}, + { + id: "trodge", + startDate: newDate(2024, 12, 5, pdtLoc), + endDate: newDate(2024, 12, 8, pdtLoc), }, - "trodge": { - vacations: []Vacation{}, + { + id: "roaks3", + startDate: newDate(2024, 9, 13, pdtLoc), + endDate: newDate(2024, 9, 20, pdtLoc), }, - "zli82016": { - vacations: []Vacation{ - { - startDate: newDate(2025, 1, 15), - endDate: newDate(2025, 2, 9), - }, - }, + { + id: "c2thorn", + startDate: newDate(2024, 10, 2, bstLoc), + endDate: newDate(2024, 10, 14, bstLoc), + }, + { + id: "ScottSuarez", + startDate: newDate(2024, 10, 31, bstLoc), + endDate: newDate(2024, 11, 17, bstLoc), + }, + { + id: "c2thorn", + startDate: newDate(2024, 11, 1, pdtLoc), + endDate: newDate(2024, 11, 11, pdtLoc), + }, + { + id: "shuyama1", + startDate: newDate(2024, 11, 26, pdtLoc), + endDate: newDate(2024, 12, 4, pdtLoc), + }, + { + id: "c2thorn", + startDate: newDate(2024, 11, 27, pdtLoc), + endDate: newDate(2024, 12, 9, pdtLoc), + }, + { + id: "roaks3", + startDate: newDate(2024, 12, 27, pdtLoc), + endDate: newDate(2025, 1, 5, pdtLoc), }, - } - - // This is for new team members who are onboarding - trustedContributors = map[string]struct{}{ - "bbasata": struct{}{}, } ) diff --git a/.ci/magician/github/membership_test.go b/.ci/magician/github/membership_test.go index 501adcf3f2e3..e41dce3a7566 100644 --- a/.ci/magician/github/membership_test.go +++ b/.ci/magician/github/membership_test.go @@ -30,224 +30,103 @@ func TestTrustedContributors(t *testing.T) { } } +func TestOnVacationReviewers(t *testing.T) { + for _, member := range onVacationReviewers { + if !IsCoreReviewer(member.id) { + t.Fatalf(`%v is not on reviewerRotation list`, member) + } + } +} + func TestAvailable(t *testing.T) { - // Double-check that timezones are loadable first. - _, err := time.LoadLocation("US/Eastern") + newYork, err := time.LoadLocation("America/New_York") if err != nil { t.Fatal(err) } - _, err = time.LoadLocation("US/Pacific") + la, err := time.LoadLocation("America/Los_Angeles") if err != nil { t.Fatal(err) } tests := []struct { - name string - rotation map[string]ReviewerConfig - timeNow time.Time - excludedReviewers []string - want []string + name string + rotation []string + onVacation []onVacationReviewer + timeNow time.Time + want []string }{ { - name: "reviewers on vacation start date are excluded", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - timezone: time.UTC, - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - }, + name: "reviewers on vacation start date are excluded", + rotation: []string{"id1", "id2"}, + onVacation: []onVacationReviewer{ + { + id: "id2", + startDate: newDate(2024, 3, 29, time.UTC), + endDate: newDate(2024, 4, 2, time.UTC), }, }, timeNow: time.Date(2024, 3, 29, 0, 0, 0, 0, time.UTC), want: []string{"id1"}, }, { - name: "reviewers on vacation end date are excluded", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - timezone: time.UTC, - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - }, + name: "reviewers on vacation end date are excluded", + rotation: []string{"id1", "id2"}, + onVacation: []onVacationReviewer{ + { + id: "id2", + startDate: newDate(2024, 3, 29, time.UTC), + endDate: newDate(2024, 4, 2, time.UTC), }, }, timeNow: time.Date(2024, 4, 2, 10, 0, 0, 0, time.UTC), want: []string{"id1"}, }, { - name: "reviewers are included after vacation ends", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - timezone: time.UTC, - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - }, + name: "reviewers are included after vacation ends", + rotation: []string{"id1", "id2"}, + onVacation: []onVacationReviewer{ + { + id: "id2", + startDate: newDate(2024, 3, 29, time.UTC), + endDate: newDate(2024, 4, 2, time.UTC), }, }, timeNow: time.Date(2024, 4, 3, 0, 0, 0, 0, time.UTC), want: []string{"id1", "id2"}, }, { - name: "reviewers are included before vacation starts", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - timezone: time.UTC, - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - }, + name: "reviewers are included before vacation starts", + rotation: []string{"id1", "id2"}, + onVacation: []onVacationReviewer{ + { + id: "id2", + startDate: newDate(2024, 3, 29, time.UTC), + endDate: newDate(2024, 4, 2, time.UTC), }, }, timeNow: time.Date(2024, 3, 28, 23, 0, 0, 0, time.UTC), want: []string{"id1", "id2"}, }, { - name: "reviewers are excluded if vacation has not ended in the specified time zone", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - }, - }, - }, - // it's still 2024-04-02 in Pacific time zone - timeNow: time.Date(2024, 4, 3, 0, 0, 0, 0, usEastern), - want: []string{"id1"}, - }, - { - name: "included before vacations", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - { - startDate: newDate(2024, 5, 2), - endDate: newDate(2024, 5, 5), - }, - }, - }, - }, - timeNow: time.Date(2024, 3, 1, 0, 0, 0, 0, usPacific), - want: []string{"id1", "id2"}, - }, - { - name: "excluded during first vacation", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - { - startDate: newDate(2024, 5, 2), - endDate: newDate(2024, 5, 5), - }, - }, - }, - }, - timeNow: time.Date(2024, 4, 1, 0, 0, 0, 0, usPacific), - want: []string{"id1"}, - }, - { - name: "included between vacations", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - { - startDate: newDate(2024, 5, 2), - endDate: newDate(2024, 5, 5), - }, - }, - }, - }, - timeNow: time.Date(2024, 4, 4, 0, 0, 0, 0, usPacific), - want: []string{"id1", "id2"}, - }, - { - name: "excluded during second vacation", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - { - startDate: newDate(2024, 5, 2), - endDate: newDate(2024, 5, 5), - }, - }, + name: "reviewers are excluded since vacation still not ends in the specified time zone", + rotation: []string{"id1", "id2"}, + onVacation: []onVacationReviewer{ + { + id: "id2", + startDate: newDate(2024, 3, 29, la), + endDate: newDate(2024, 4, 2, la), }, }, - timeNow: time.Date(2024, 5, 3, 0, 0, 0, 0, usPacific), + // it's still 2024-04-02 in LA time zone + timeNow: time.Date(2024, 4, 3, 0, 0, 0, 0, newYork), want: []string{"id1"}, }, - { - name: "included after vacations", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": { - vacations: []Vacation{ - { - startDate: newDate(2024, 3, 29), - endDate: newDate(2024, 4, 2), - }, - { - startDate: newDate(2024, 5, 2), - endDate: newDate(2024, 5, 5), - }, - }, - }, - }, - timeNow: time.Date(2024, 6, 1, 0, 0, 0, 0, usPacific), - want: []string{"id1", "id2"}, - }, - { - name: "explicitly excluded reviewers", - rotation: map[string]ReviewerConfig{ - "id1": {vacations: []Vacation{}}, - "id2": {vacations: []Vacation{}}, - }, - excludedReviewers: []string{"id2"}, - want: []string{"id1"}, - }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - got := available(test.timeNow, test.rotation, test.excludedReviewers) + got := available(test.timeNow, test.rotation, test.onVacation) if diff := cmp.Diff(test.want, got); diff != "" { - t.Errorf("available(%v, %v, %v) got diff: %s", test.timeNow, test.rotation, test.excludedReviewers, diff) + t.Errorf("available(%v, %v, %v) got diff: %s", test.timeNow, test.rotation, test.onVacation, diff) } }) } diff --git a/.ci/magician/github/reviewer_assignment.go b/.ci/magician/github/reviewer_assignment.go index bbd1cd7d1d45..39d4739057bd 100644 --- a/.ci/magician/github/reviewer_assignment.go +++ b/.ci/magician/github/reviewer_assignment.go @@ -49,7 +49,7 @@ func ChooseCoreReviewers(requestedReviewers, previousReviewers []User) (reviewer } if !hasPrimaryReviewer { - newPrimaryReviewer = GetRandomReviewer(nil) + newPrimaryReviewer = GetRandomReviewer() reviewersToRequest = append(reviewersToRequest, newPrimaryReviewer) } diff --git a/.ci/magician/github/reviewer_assignment_test.go b/.ci/magician/github/reviewer_assignment_test.go index 2d4537b0c118..31e57901e0aa 100644 --- a/.ci/magician/github/reviewer_assignment_test.go +++ b/.ci/magician/github/reviewer_assignment_test.go @@ -25,11 +25,11 @@ import ( ) func TestChooseCoreReviewers(t *testing.T) { - if len(AvailableReviewers(nil)) < 2 { - t.Fatalf("not enough available reviewers (%v) to test (need at least 2)", AvailableReviewers(nil)) + if len(AvailableReviewers()) < 2 { + t.Fatalf("not enough available reviewers (%v) to test (need at least 2)", AvailableReviewers()) } - firstCoreReviewer := AvailableReviewers(nil)[0] - secondCoreReviewer := AvailableReviewers(nil)[1] + firstCoreReviewer := AvailableReviewers()[0] + secondCoreReviewer := AvailableReviewers()[1] cases := map[string]struct { RequestedReviewers []User PreviousReviewers []User @@ -39,7 +39,7 @@ func TestChooseCoreReviewers(t *testing.T) { "no previous review requests assigns new reviewer from team": { RequestedReviewers: []User{}, PreviousReviewers: []User{}, - ExpectReviewersFromList: AvailableReviewers(nil), + ExpectReviewersFromList: AvailableReviewers(), ExpectPrimaryReviewer: true, }, "requested reviewer from team means that primary reviewer was already selected": { @@ -61,7 +61,7 @@ func TestChooseCoreReviewers(t *testing.T) { "previously involved reviewers that are not team members are ignored": { RequestedReviewers: []User{}, PreviousReviewers: []User{User{Login: "foobar"}}, - ExpectReviewersFromList: AvailableReviewers(nil), + ExpectReviewersFromList: AvailableReviewers(), ExpectPrimaryReviewer: true, }, "only previously involved team member reviewers will have review requested": { diff --git a/.ci/magician/go.mod b/.ci/magician/go.mod index 4b42dbec00bd..0ab0e7e857a4 100644 --- a/.ci/magician/go.mod +++ b/.ci/magician/go.mod @@ -10,66 +10,37 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 // indirect golang.org/x/exp v0.0.0-20230810033253-352e893a4cad - google.golang.org/api v0.214.0 + google.golang.org/api v0.114.0 ) require ( - cloud.google.com/go/storage v1.50.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v61 v61.0.0 github.com/otiai10/copy v1.12.0 - github.com/stretchr/testify v1.10.0 + github.com/stretchr/testify v1.8.4 gopkg.in/yaml.v2 v2.4.0 ) require ( - cel.dev/expr v0.16.1 // indirect - cloud.google.com/go v0.116.0 // indirect - cloud.google.com/go/auth v0.13.0 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect - cloud.google.com/go/compute/metadata v0.6.0 // indirect - cloud.google.com/go/iam v1.2.2 // indirect - cloud.google.com/go/monitoring v1.21.2 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect + cloud.google.com/go/compute/metadata v0.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/envoyproxy/go-control-plane/envoy v1.32.3 // indirect - github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect - github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/glog v1.2.2 // indirect + github.com/golang/glog v1.1.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/s2a-go v0.1.8 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect - github.com/googleapis/gax-go/v2 v2.14.0 // indirect - github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect + github.com/googleapis/gax-go/v2 v2.7.1 // indirect + github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/detectors/gcp v1.29.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect - go.opentelemetry.io/otel v1.29.0 // indirect - go.opentelemetry.io/otel/metric v1.29.0 // indirect - go.opentelemetry.io/otel/sdk v1.29.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect - go.opentelemetry.io/otel/trace v1.29.0 // indirect - golang.org/x/crypto v0.31.0 // indirect - golang.org/x/net v0.33.0 // indirect + golang.org/x/net v0.23.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect - golang.org/x/time v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect - google.golang.org/grpc v1.67.3 // indirect - google.golang.org/protobuf v1.35.2 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/grpc v1.56.3 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/.ci/magician/go.sum b/.ci/magician/go.sum index 752d1cf5a627..e2cf9c686669 100644 --- a/.ci/magician/go.sum +++ b/.ci/magician/go.sum @@ -1,73 +1,31 @@ -cel.dev/expr v0.16.1 h1:NR0+oFYzR1CqLFhTAqg3ql59G9VfN8fKq1TCHJ6gq1g= -cel.dev/expr v0.16.1/go.mod h1:AsGA5zb3WruAEQeQng1RZdGEXmBj0jvMWh6l5SnNuC8= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE= -cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U= -cloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs= -cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q= -cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU= -cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= -cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= -cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= -cloud.google.com/go/iam v1.2.2 h1:ozUSofHUGf/F4tCNy/mu9tHLTaxZFLOUiKzjcgWHGIA= -cloud.google.com/go/iam v1.2.2/go.mod h1:0Ys8ccaZHdI1dEUilwzqng/6ps2YB6vRsjIe00/+6JY= -cloud.google.com/go/logging v1.12.0 h1:ex1igYcGFd4S/RZWOCU51StlIEuey5bjqwH9ZYjHibk= -cloud.google.com/go/logging v1.12.0/go.mod h1:wwYBt5HlYP1InnrtYI0wtwttpVU1rifnMT7RejksUAM= -cloud.google.com/go/longrunning v0.6.2 h1:xjDfh1pQcWPEvnfjZmwjKQEcHnpz6lHjfy7Fo0MK+hc= -cloud.google.com/go/longrunning v0.6.2/go.mod h1:k/vIs83RN4bE3YCswdXC5PFfWVILjm3hpEUlSko4PiI= -cloud.google.com/go/monitoring v1.21.2 h1:FChwVtClH19E7pJ+e0xUhJPGksctZNVOk2UhMmblmdU= -cloud.google.com/go/monitoring v1.21.2/go.mod h1:hS3pXvaG8KgWTSz+dAdyzPrGUYmi2Q+WFX8g2hqVEZU= -cloud.google.com/go/storage v1.50.0 h1:3TbVkzTooBvnZsk7WaAQfOsNrdoM8QHusXA1cpk6QJs= -cloud.google.com/go/storage v1.50.0/go.mod h1:l7XeiD//vx5lfqE3RavfmU9yvk5Pp0Zhcv482poyafY= -cloud.google.com/go/trace v1.11.2 h1:4ZmaBdL8Ng/ajrgKqY5jfvzqMXbrDcBsUGXOT9aqTtI= -cloud.google.com/go/trace v1.11.2/go.mod h1:bn7OwXd4pd5rFuAnTrzBuoZ4ax2XQeG3qNgYmfCy0Io= +cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= +cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= +cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= +cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 h1:3c8yed4lgqTt+oTQ+JNMDo+F4xprBf+O/il4ZC0nRLw= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0/go.mod h1:obipzmGjfSjam60XLwGfqUkJsfiheAl+TUjG+4yzyPM= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1 h1:UQ0AhxogsIRZDkElkblfnwjc3IaltCm2HUMvezQaL7s= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1/go.mod h1:jyqM3eLpJ3IbIFDTKVz2rF9T/xWGW0rIriGwnz8l9Tk= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.48.1 h1:oTX4vsorBZo/Zdum6OKPA4o7544hm6smoRv1QjpTwGo= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.48.1/go.mod h1:0wEl7vrAD8mehJyohS9HZy+WyEOaQO2mJx86Cvh93kM= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 h1:8nn+rsCvTq9axyEh382S0PFLBeaFwNsT43IrPWzctRU= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1/go.mod h1:viRWSEhtMZqz1rhwmOVKkWl6SwmVowfL9O2YR5gI2PE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/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/xds/go v0.0.0-20240905190251-b4127c9b8d78 h1:QVw89YDxXxEe+l8gU8ETbOasdwEV+avkR75ZzsVV9WI= -github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +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/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.13.4 h1:zEqyPVyku6IvWCFwux4x9RxkLOMUL+1vC9xUFv5l2/M= -github.com/envoyproxy/go-control-plane v0.13.4/go.mod h1:kDfuBlDVsSj2MjrLEtRWtHlsWIFcGyB2RMO44Dc5GZA= -github.com/envoyproxy/go-control-plane/envoy v1.32.3 h1:hVEaommgvzTjTd4xCaFd+kEQ2iYBtGxP6luyLrx6uOk= -github.com/envoyproxy/go-control-plane/envoy v1.32.3/go.mod h1:F6hWupPfh75TBXGKA++MCT/CZHFq5r9/uwt/kQYkZfE= -github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= -github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= -github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= -github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -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/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= -github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.1.1 h1:jxpi2eWoU84wbX9iIEyAeeoac3FLuifZpY9tcNUD9kw= +github.com/golang/glog v1.1.1/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 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.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= @@ -76,6 +34,9 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W 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.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +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/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= @@ -83,23 +44,20 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/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.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v61 v61.0.0 h1:VwQCBwhyE9JclCI+22/7mLB1PuU9eowCXKY5pNlu1go= github.com/google/go-github/v61 v61.0.0/go.mod h1:0WR+KmsWX75G2EbpyGsGmradjo3IiciuI4BmdVCobQY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= -github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= -github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= -github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= -github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= -github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o= -github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk= +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.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/gax-go/v2 v2.7.1 h1:gF4c0zjUP2H/s/hEGyLA3I0fA2ZWjzYiONAD6cvPr8A= +github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -110,13 +68,12 @@ github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY= github.com/otiai10/copy v1.12.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww= github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 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/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= @@ -128,32 +85,12 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/detectors/gcp v1.29.0 h1:TiaiXB4DpGD3sdzNlYQxruQngn5Apwzi1X0DRhuGvDQ= -go.opentelemetry.io/contrib/detectors/gcp v1.29.0/go.mod h1:GW2aWZNwR2ZxDLdv8OyC2G8zkRoQBuURgV7RPQgcPoU= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= -go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= -go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0 h1:WDdP9acbMYjbKIyJUhTvtzj601sVJOqgWdUxSdR/Ysc= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0/go.mod h1:BLbf7zbNIONBLPwvFnwNHGj4zge8uTCM/UPIVW1Mq2I= -go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= -go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= -go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= -go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= -go.opentelemetry.io/otel/sdk/metric v1.29.0 h1:K2CfmJohnRgvZ9UAj2/FhIf/okdWcNdBwe1m8xFXiSY= -go.opentelemetry.io/otel/sdk/metric v1.29.0/go.mod h1:6zZLdCl2fkauYoZIOn/soQIDSWFmNSRcICarHfuhNJQ= -go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= -go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230810033253-352e893a4cad h1:g0bG7Z4uG+OgH2QDODnjp6ggkk1bJDsINcuWmJN1iJU= golang.org/x/exp v0.0.0-20230810033253-352e893a4cad/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= @@ -165,55 +102,51 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r 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-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= 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-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 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= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= -golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 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/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.214.0 h1:h2Gkq07OYi6kusGOaT/9rnNljuXmqPnaig7WGPmKbwA= -google.golang.org/api v0.214.0/go.mod h1:bYPpLG8AyeMWwDU6NXoB00xC0DFkikVvd5MfwoxjLqE= +google.golang.org/api v0.114.0 h1:1xQPji6cO2E2vLiI+C/XiFAnsn1WV3mjaEwGLhi3grE= +google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= 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.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-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk= -google.golang.org/genproto v0.0.0-20241118233622-e639e219e697/go.mod h1:JJrvXBWRZaFMxBufik1a4RpFw4HhgVtBBWQeQgUj2cc= -google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 h1:pgr/4QbFyktUv9CtQ/Fq4gzEE6/Xs7iCXbktaGzLHbQ= -google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697/go.mod h1:+D9ySVjN8nY8YCVjc5O7PZDIdZporIDY3KaGfJunh88= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= 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.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8= -google.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= +google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= 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= @@ -223,8 +156,10 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 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.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= -google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +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.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/.ci/magician/provider/version.go b/.ci/magician/provider/version.go index ff184d116a4d..8057c4aa973d 100644 --- a/.ci/magician/provider/version.go +++ b/.ci/magician/provider/version.go @@ -53,13 +53,3 @@ func (v Version) RepoName() string { } return "unknown" } - -func (v Version) TeamCityNightlyProjectName() string { - switch v { - case GA: - return "TerraformProviders_GoogleCloud_GOOGLE_NIGHTLYTESTS" - case Beta: - return "TerraformProviders_GoogleCloud_GOOGLE_BETA_NIGHTLYTESTS" - } - return "unknown" -} diff --git a/.ci/magician/teamcity/get.go b/.ci/magician/teamcity/get.go deleted file mode 100644 index 37f0ec8d4c17..000000000000 --- a/.ci/magician/teamcity/get.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -* Copyright 2025 Google LLC. All Rights Reserved. -* -* 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 teamcity - -import ( - "fmt" - - // "regexp" - utils "magician/utility" -) - -type Build struct { - Id int `json:"id"` - BuildTypeId string `json:"buildTypeId"` - BuildConfName string `json:"buildConfName"` - WebUrl string `json:"webUrl"` - Number string `json:"number"` -} - -type Builds struct { - Builds []Build `json:"build"` -} - -type TestResult struct { - Name string `json:"name"` - Id string `json:"id"` - ErrorMessage string `json:"details"` - Build Build `json:"build"` - FirstFailedUrl FirstFailed `json:"firstFailed"` - Status string `json:"status"` - Duration int `json:"duration"` -} -type TestResults struct { - TestResults []TestResult `json:"testOccurrence"` -} - -type FirstFailed struct { - Href string `json:"href"` -} - -func (tc *Client) GetBuilds(project, finishCut, startCut string) (Builds, error) { - url := fmt.Sprintf("https://hashicorp.teamcity.com/app/rest/builds?locator=count:500,tag:cron-trigger,project:%s,branch:refs/heads/nightly-test,finishDate:(date:%s,condition:before),startDate:(date:%s,condition:after)", project, finishCut, startCut) - - var builds Builds - - err := utils.RequestCall(url, "GET", tc.token, &builds, nil) - - return builds, err -} - -func (tc *Client) GetTestResults(build Build) (TestResults, error) { - url := fmt.Sprintf("https://hashicorp.teamcity.com/app/rest/testOccurrences?locator=count:5000,build:(id:%d)&fields=testOccurrence(id,name,status,duration,firstFailed(href),details,build(webUrl))", build.Id) - - var testResults TestResults - - err := utils.RequestCall(url, "GET", tc.token, &testResults, nil) - - return testResults, err -} diff --git a/.ci/magician/teamcity/init.go b/.ci/magician/teamcity/init.go deleted file mode 100644 index bfa6855716fa..000000000000 --- a/.ci/magician/teamcity/init.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Copyright 2025 Google LLC. All Rights Reserved. -* -* 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 teamcity - -type Client struct { - token string -} - -func NewClient(token string) *Client { - return &Client{ - token: token, - } -} diff --git a/.ci/magician/utility/utils.go b/.ci/magician/utility/utils.go index bf9c41c8ef33..7160bd000f6c 100644 --- a/.ci/magician/utility/utils.go +++ b/.ci/magician/utility/utils.go @@ -21,7 +21,6 @@ import ( "fmt" "io" "net/http" - "os" "golang.org/x/exp/slices" ) @@ -38,7 +37,6 @@ func RequestCall(url, method, credentials string, result any, body any) error { } req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", credentials)) req.Header.Set("Content-Type", "application/json") - req.Header.Set("Accept", "application/json") fmt.Println("") fmt.Println("request url: ", url) fmt.Println("request body: ", string(jsonBody)) // Convert to string @@ -83,16 +81,3 @@ func Removes(s1 []string, s2 []string) []string { } return result } - -func WriteToJson(data interface{}, path string) error { - rsBytes, err := json.MarshalIndent(data, "", " ") - if err != nil { - return fmt.Errorf("failed to marshal data: %w", err) - } - - if err := os.WriteFile(path, rsBytes, 0644); err != nil { - return fmt.Errorf("failed to write data to file: %v", err) - } - - return nil -} diff --git a/.github/actions/build-downstream/action.yml b/.github/actions/build-downstream/action.yml index 731810d372c6..012248b10862 100644 --- a/.github/actions/build-downstream/action.yml +++ b/.github/actions/build-downstream/action.yml @@ -16,6 +16,26 @@ runs: 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: diff --git a/.github/workflows/build-downstream.yml b/.github/workflows/build-downstream.yml index f6b0e02eeeee..39dc1b3d07b4 100644 --- a/.github/workflows/build-downstream.yml +++ b/.github/workflows/build-downstream.yml @@ -9,11 +9,15 @@ on: required: true type: string +concurrency: + group: ${{ inputs.repo }}-${{ github.event_name == 'pull_request' && format('pr-{0}-', github.event.pull_request.number) || format('commit-{0}', github.sha) }} + cancel-in-progress: true + jobs: generate-repository: runs-on: ubuntu-22.04 env: - BASE_BRANCH: ${{ github.event_name == 'merge_group' && github.event.merge_group.base_ref || github.event.pull_request.base.ref || github.ref_name }} + BASE_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout Repository @@ -21,6 +25,25 @@ jobs: 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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: mmv1/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('mmv1/**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + + - name: Install Ruby dependencies + run: | + bundle config path mmv1/vendor/bundle + bundle install + working-directory: mmv1 + - name: Set up Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: @@ -28,7 +51,7 @@ jobs: # Cache Go modules - name: Cache Go modules - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -85,7 +108,7 @@ jobs: (current_dir=$(pwd) && cd $OUTPUT_PATH && zip -r "$current_dir/output.zip" .) - name: Upload built artifacts - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: artifact-${{ inputs.repo }} path: output.zip \ No newline at end of file diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 59da3e72a7e6..55026329eadf 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'go' ] + language: [ 'go', 'ruby' ] steps: - name: Checkout repository diff --git a/.github/workflows/downstreams.yml b/.github/workflows/downstreams.yml index 941ff37242fd..98273ca7e18e 100644 --- a/.github/workflows/downstreams.yml +++ b/.github/workflows/downstreams.yml @@ -6,12 +6,9 @@ on: branches: - main - 'FEATURE-BRANCH-*' - merge_group: - types: [checks_requested] - pull_request: concurrency: - group: ${{ github.event_name == 'merge_group' && format('merge-group-{0}', github.event.merge_group.head_sha) || github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('commit-{0}', github.sha) }} + group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('commit-{0}', github.sha) }} cancel-in-progress: true jobs: diff --git a/.github/workflows/mmv1-rake-tests.yml b/.github/workflows/mmv1-rake-tests.yml new file mode 100644 index 000000000000..0c52a40890da --- /dev/null +++ b/.github/workflows/mmv1-rake-tests.yml @@ -0,0 +1,39 @@ +name: mmv1-rake-tests + +permissions: read-all + +on: + pull_request: + paths: + - 'mmv1/**/*.rb' + +jobs: + rake-tests: + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2 + with: + path: repo + fetch-depth: 2 + - name: Merge base branch + id: pull_request + run: | + cd repo + git config user.name "modular-magician" + git config user.email "magic-modules@google.com" + git fetch origin ${{ github.base_ref }} # Fetch the base branch + git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch + - name: Set up Ruby + uses: ruby/setup-ruby@036ef458ddccddb148a2b9fb67e95a22fdbf728b # v1.160.0 + with: + ruby-version: '3.1' + - name: Install dependencies + run: | + cd repo/mmv1 + bundle install + - name: Run rake tests + run: | + cd repo/mmv1 + bundle exec rake test + diff --git a/.github/workflows/reassign-reviewer.yml b/.github/workflows/reassign-reviewer.yml index b7e825dd72fe..f0d25840e7f9 100644 --- a/.github/workflows/reassign-reviewer.yml +++ b/.github/workflows/reassign-reviewer.yml @@ -42,4 +42,4 @@ jobs: go build . - name: Run command if: steps.read-comment.outputs.match != '' - run: .ci/magician/magician reassign-reviewer ${{ github.event.issue.number }} ${{ steps.read-comment.outputs.group1 }} + run: .ci/magician/magician reassign-reviewer ${{ github.event.issue.number }} ${{ steps.read-comment.outputs.match.group1 }} diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 9b8f01ae8cd8..ebbbca8699ac 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -50,7 +50,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: SARIF file path: results.sarif diff --git a/.github/workflows/unit-test-tgc.yml b/.github/workflows/unit-test-tgc.yml index 9c1ad44cda1d..4d4c7d5d0313 100644 --- a/.github/workflows/unit-test-tgc.yml +++ b/.github/workflows/unit-test-tgc.yml @@ -9,13 +9,13 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Download built artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: name: artifact-terraform-google-conversion path: artifacts-tgc - name: Download built artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: name: artifact-terraform-provider-google-beta path: artifacts-tpgb diff --git a/.github/workflows/unit-test-tpg.yml b/.github/workflows/unit-test-tpg.yml index e21b79031f61..a166122f7e3c 100644 --- a/.github/workflows/unit-test-tpg.yml +++ b/.github/workflows/unit-test-tpg.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Download built artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: name: artifact-${{ inputs.repo }} path: artifacts diff --git a/docs/content/code-review/create-pr.md b/docs/content/code-review/create-pr.md index 89b78168d6ae..445fd848411a 100644 --- a/docs/content/code-review/create-pr.md +++ b/docs/content/code-review/create-pr.md @@ -52,7 +52,7 @@ VCR test failures that do not immediately seem related to your PR are most likel git checkout modular-magician/auto-pr-PR_NUMBER make test make lint - make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' + make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool' ``` Replace PR_NUMBER with your PR's ID. {{< /tab >}} @@ -65,7 +65,7 @@ VCR test failures that do not immediately seem related to your PR are most likel git checkout modular-magician/auto-pr-PR_NUMBER make test make lint - make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' + make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool' ``` Replace PR_NUMBER with your PR's ID. {{< /tab >}} diff --git a/docs/content/code-review/release-notes.md b/docs/content/code-review/release-notes.md index ef8bb889d43e..75a10f6a1ebf 100644 --- a/docs/content/code-review/release-notes.md +++ b/docs/content/code-review/release-notes.md @@ -98,10 +98,10 @@ For each release note block, choose an appropriate type from the following list: Do | Don't -- | ----- Use past tense to describe the end state after the change is released. Start with a verb. For example, "added...", "fixed...", or "resolved...". You can use future tense to describe future changes, such as saying that a deprecated field will be removed in a future version. | Don't use present or future tense to describe changes that are included in the pull request. -Write user-focused release notes. For example, reference specific impacted terraform resource and field names, and discuss changes in behavior users will experience. | Avoid API field/resource/feature names. Avoid implementation details. Avoid language that requires understanding of provider internals. However, in case of substantial refactorings like API version changes or engine changes (tpgtools/DCL -> MMv1, handwritten <> MMv1) **do** cover the change so users can quickly identify the release if they are affected by the change. +Write user-focused release notes. For example, reference specific impacted terraform resource and field names, and discuss changes in behavior users will experience. | Avoid API field/resource/feature names. Avoid implementation details. Avoid language that requires understanding of provider internals. Surround resource or field names with backticks. | Don't use resource or field names without punctuation or with other punctuation like quotation marks. Use impersonal third person. | Don't use "I", "you", etc. -If the pull request impacts a specific product, begin your release note with that product name followed by a colon. Use lower case for the first letter after the colon. For example, `cloudrun: added...` For MMv1 resources, use the folder name that contains the yaml files as the product name; for handwritten or tpgtools resources, use the API subdomain; for broad cross-product changes, use `provider`. | Don't begin your release note with the full resource name. Don't add backticks around the product name. Don't capitalize the first letter after the colon. +If the pull request impacts any specific, begin your release note with that product name followed by a colon. Use lower case for the first letter after the colon. For example, `cloudrun: added...` For MMv1 resources, use the folder name that contains the yaml files as the product name; for handwritten or tpgtools resources, use the API subdomain; for broad cross-product changes, use `provider`. | Don't begin your release note with the full resource name. Don't add backticks around the product name. Don't capitalize the first letter after the colon. ### Examples diff --git a/docs/content/code-review/review-pr.md b/docs/content/code-review/review-pr.md index 6eb13e961dd5..bc796c5df425 100644 --- a/docs/content/code-review/review-pr.md +++ b/docs/content/code-review/review-pr.md @@ -46,6 +46,7 @@ The following types of PRs may require additional scrutiny and/or multiple revie * for example - a bugfix should test the bug (or explain why it's not feasible to do so in the description, including manual results when possible) and an enhancement should test the new behaviour(s). 1. all related PR presubmit tests have been completed successfully, including: * terraform-provider-breaking-change-test + * presubmit-rake-tests * terraform-provider-google-build-and-unit-tests * terraform-provider-google-beta-build-and-unit-tests * VCR-test diff --git a/docs/content/reference/metadata.md b/docs/content/reference/metadata.md index 2bf19e5cc14e..5b5e0cd7ae50 100644 --- a/docs/content/reference/metadata.md +++ b/docs/content/reference/metadata.md @@ -30,11 +30,3 @@ The version of the API used for this resource e.g., "v2". ### `api_resource_type_kind` The API "resource type kind" used for this resource e.g., "Function". - -### `fields` - -The list of fields used by this resource. Each field can contain the following attributes: - -- `field`: The name of the field in Terraform, including the path e.g., "build_config.source.storage_source.bucket" -- `api_field`: The name of the field in the API, including the path e.g., "build_config.source.storage_source.bucket". Defaults to the value of `field`. -- `provider_only`: If true, the field is only present in the provider. This primarily applies for virtual fields and url-only parameters. When set to true, `api_field` should be left empty, as it will be ignored. Default: `false`. diff --git a/docs/content/reference/resource.md b/docs/content/reference/resource.md index aba124408125..f42c687a9e7d 100644 --- a/docs/content/reference/resource.md +++ b/docs/content/reference/resource.md @@ -350,68 +350,3 @@ properties: - name: 'fieldOne' type: String ``` - -## Examples - -### `examples` - -A list of configurations that are used to generate documentation and tests. Each example supports the following common -attributes – for a full reference, see -[examples.go ↗](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/resource/examples.go): - -- `name`: snake_case name of the example. This corresponds to the configuration file in - [mmv1/templates/terraform/examples](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform/examples) (excluding the `.go.tmpl` suffix) and is used to generate the test name and the documentation header. -- `primary_resource_id`: The id of the resource under test. This is used by tests to automatically run additional checks. - Configuration files should reference this to avoid getting out of sync. For example: - `resource "google_compute_address" ""{{$.PrimaryResourceId}}" {` -- `bootstrap_iam`: specify member/role pairs that should always exist. `{project_number}` will be replaced with the - default project's project number. This avoids race conditions when modifying the IAM permissions for the default test project. - Permissions attached to resources created _in_ a test should instead be provisioned with standard terraform resources. -- `vars`: Key/value pairs of variables to inject into the configuration file. These can be referenced in the configuration file - with `{{index $.Vars "key"}}`. All resource IDs (even for resources not under test) should be declared with variables that - contain a `-` or `_`; this will ensure that, in tests, the resources are created with a `tf-test` prefix to allow automatic cleanup of dangling resources and a random suffix to avoid name collisions. -- `test_env_vars`: Key/value pairs of variable names and special values indicating variables that should be pulled from the - environment during tests. These will receive a neutral default value in documentation. Common special values include: - `PROJECT_NAME`, `REGION`, `ORG_ID`, `BILLING_ACCT`, `SERVICE_ACCT` (the test runner service account). -- `test_vars_overrides`: Key/value pairs of literal overrides for variables used in tests. This can be used to call functions to - generate or determine a variable's value. -- `min_version`: Set this to `beta` if the resource is in the `google` provider but the example will only work with the - `google-beta` provider (for example, because it includes a beta-only field.) -- `ignore_read_extra`: Properties to not check on import. This should be used in cases where a property will not be set on import, - for example write-only fields. -- `exclude_test`: If set to `true`, no test will be generated based on this example. -- `exclude_docs`: If set to `true`, no documentation will be generated based on this example. -- `exclude_import_test`: If set to `true`, no import test will be generated for this example. -- `skip_vcr`: See [Skip tests in VCR replaying mode]({{< ref "/test/test#skip-vcr" >}}) for more information about this flag. -- `skip_test`: If not empty, the test generated based on this example will always be skipped. In most cases, the value should be a - link to a ticket explaining the issue that needs to be resolved before the test can be unskipped. -- `external_providers`: A list of external providers that are needed for the testcase. This does add some latency to the testcase, - so only use if necessary. Common external providers: `random`, `time`. - -Example: - -```yaml -examples: - - name: service_resource_basic - primary_resource_id: example - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-healthcare.iam.gserviceaccount.com" - role: "roles/bigquery.dataEditor" - vars: - dataset_id: "my-dataset" - network_name: "my-network" - test_env_vars: - org_id: "ORG_ID" - test_vars_overrides: - network_name: 'acctest.BootstrapSharedServiceNetworkingConnection(t, "service-resource-network-config")' - min_version: "beta" - ignore_read_extra: - - 'foo' - exclude_test: true - exclude_docs: true - exclude_import_test: true - skip_vcr: true - skip_test: "https://github.com/hashicorp/terraform-provider-google/issues/20574" - external_providers: - - "time" -``` \ No newline at end of file diff --git a/docs/content/test/run-tests.md b/docs/content/test/run-tests.md index dba77194cb56..60ff14c06118 100644 --- a/docs/content/test/run-tests.md +++ b/docs/content/test/run-tests.md @@ -59,22 +59,16 @@ aliases: 1. Run acceptance tests for only modified resources. (Full test runs can take over 9 hours.) See [Go's documentation](https://pkg.go.dev/cmd/go#hdr-Testing_flags) for more information about `-run` and other flags. - ```bash - make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' - ``` - - To run all tests matching, e.g., `TestAccContainerNodePool*`, omit the trailing `$$`: - ```bash make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool' ``` - > **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges. +> **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges. 1. Optional: Save verbose test output (including API requests and responses) to a file for analysis. ```bash - TF_LOG=DEBUG make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' > output.log + TF_LOG=DEBUG make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic' > output.log ``` 1. Optional: Debug tests with [Delve](https://github.com/go-delve/delve). See [`dlv test` documentation](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_test.md) for information about available flags. @@ -101,19 +95,12 @@ aliases: ```bash make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool' ``` - - To run all tests matching, e.g., `TestAccContainerNodePool*`, omit the trailing `$$`: - - ```bash - make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool' - ``` - - > **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges. +> **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges. 1. Optional: Save verbose test output to a file for analysis. ```bash - TF_LOG=DEBUG make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' > output.log + TF_LOG=DEBUG make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool_basic' > output.log ``` 1. Optional: Debug tests with [Delve](https://github.com/go-delve/delve). See [`dlv test` documentation](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_test.md) for information about available flags. @@ -303,32 +290,6 @@ Configure Terraform to use locally-built binaries for `google` and `google-beta` TF_LOG=DEBUG TF_LOG_PATH=output.log TF_CLI_CONFIG_FILE="$HOME/tf-dev-override.tfrc" terraform apply ``` -### Run Tests with VCR Locally - -VCR tests record HTTP request/response interactions in cassettes and replay them in future runs without calling the real API. - -Running tests in `REPLAYING` mode locally can sometimes be useful. In particular, it can allow you to test more quickly, cheaply, and without spinning up real infrastructure, once you've got an initial recording. - -It can also be helpful for debugging tests that seem to work locally, but fail in CI in replaying mode. - -VCR is controlled via two variables: -- `VCR_MODE`: `REPLAYING` or `RECORDING` mode -- `VCR_PATH`: Path where recorded cassettes are stored. - -Ensure both variables are configured to properly trigger VCR tests locally. - -If you don't already have an existing cassette that's up to date, first do a run in `RECORDING` mode: - -```bash -VCR_PATH=$HOME/.vcr/ VCR_MODE=RECORDING make testacc TEST=./google/services/alloydb TESTARGS='-run=TestAccContainerNodePool_basic$$' -``` - -Now run the same test again in `REPLAYING` mode: - -```bash -VCR_PATH=$HOME/.vcr/ VCR_MODE=REPLAYING make testacc TEST=./google/services/alloydb TESTARGS='-run=TestAccContainerNodePool_basic$$' -``` - ### Cleanup To stop using developer overrides, stop setting `TF_CLI_CONFIG_FILE` in the commands you are executing. diff --git a/docs/content/test/test.md b/docs/content/test/test.md index 8ea3ca567786..4087d5e0031c 100644 --- a/docs/content/test/test.md +++ b/docs/content/test/test.md @@ -46,37 +46,27 @@ A create test is a test that creates the target resource and immediately destroy {{< tabs "create" >}} {{< tab "MMv1" >}} -1. Add an entry to your `RESOURCE_NAME.yaml` file's `examples`. The fields listed here are the most commonly-used. For a comprehensive reference, see [MMv1 resource reference: `examples` ↗]({{}}). - ```yaml - examples: - # name must correspond to a configuration file that you'll create in the next step. - # The name should include the product name, resource name, and a basic description - # of the test. This will be used to generate the test name and the documentation - # header. - - name: "PRODUCT_RESOURCE_basic" - # primary_resource_id will be used for the Terraform resource id in the configuration file. - primary_resource_id: "example" - # vars contains key/value pairs of variables to inject into the configuration file. - # These can be referenced in the configuration file as a key inside `{{$.Vars}}`. - # All resource IDs (even for resources not under test) should be declared - # with variables that contain a `-` or `_`; this will ensure that, in tests, - # the resources are created with a `tf-test` prefix to allow automatic cleanup - # of dangling resources and a random suffix to avoid name collisions. - vars: - network_name: "example-network" - # test_vars_overrides contains key/value pairs of literal overrides for - # variables used in tests. This can be used to call functions to - # generate or determine a variable's value – for example, bootstrapping - # a shared network for your product to avoid test failures due to limits - # on the default network. - test_vars_overrides: - network_name: 'acctest.BootstrapSharedServiceNetworkingConnection(t, "PRODUCT-RESOURCE-network-config")' - # Set min_version: beta if the resource is not beta-only and any beta-only fields are being tested. - min_version: beta - ``` +1. Using an editor of your choice, create a `*.tf.tmpl` file in [`mmv1/templates/terraform/examples/`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform/examples). The name of the file should include the service name, resource name, and a descriptor. For example, `compute_subnetwork_basic.tf.tmpl`. +2. Write the Terraform configuration for your test. This should include all of the required dependencies. For example, `google_compute_subnetwork` has a dependency on `google_compute_network`: + ```tf + resource "google_compute_subnetwork" "primary" { + name = "my-subnet" + ip_cidr_range = "10.1.0.0/16" + region = "us-central1" + network = google_compute_network.network.name + } -2. Create a `.tf.tmpl` file in [`mmv1/templates/terraform/examples/`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform/examples). The name of the file should match the name of the example created in the previous step. For example, `PRODUCT_RESOURCE_basic.tf.tmpl`. -3. In that file, write the Terraform configuration for your test. This should include all of the required dependencies. For example, `google_compute_subnetwork` has a dependency on `google_compute_network`: + resource "google_compute_network" "network" { + name = "my-network" + auto_create_subnetworks = false + } + ``` +3. If beta-only fields are being tested: + - Add `provider = google-beta` to every resource in the file. +4. Modify the configuration to use templated values. + - Replace the id of the primary resource you are testing with `{{$.PrimaryResourceId}}`. + - Replace fields that are identifiers, like `id` or `name`, with an appropriately named variable. For example, `{{index $.Vars "subnetwork_name"}}`. + - The resulting configuration for the above example would look like this: ```tf resource "google_compute_subnetwork" "{{$.PrimaryResourceId}}" { name = "{{index $.Vars "subnetwork_name"}}" @@ -90,8 +80,20 @@ A create test is a test that creates the target resource and immediately destroy auto_create_subnetworks = false } ``` -4. If the resource or the example is beta-only: - - Add `provider = google-beta` to every resource in the file. +5. Modify the relevant `RESOURCE_NAME.yaml` file under [magic-modules/mmv1/products](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products) to include an [`examples`](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/resource/examples.go) block with your test. The `name` must match the name of your `*.tf.tmpl` file. For example: + ```yaml + examples: + - name: "compute_subnetwork_basic" + primary_resource_id: "example" + vars: + subnetwork_name: "example-subnet" + network_name: "example-network" + ``` +{{< hint warning >}} +**Warning:** Values in `vars` must include a `-` (or `_`). They [trigger the addition of a `tf-test` prefix](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/resource/examples.go#L224), which the sweeper uses to clean them up after tests run. +{{< /hint >}} +6. If beta-only fields are being tested: + - Add `min_version: 'beta'` to the `examples` block in `RESOURCE_NAME.yaml`. {{< /tab >}} {{< tab "Handwritten" >}} This section assumes you've used the [Add a resource]({{< ref "/develop/add-resource" >}}) guide to create your handwritten resource, and you have a working MMv1 config. @@ -271,7 +273,7 @@ func TestSignatureAlgorithmDiffSuppress(t *testing.T) { } ``` -## Skip tests in VCR replaying mode {#skip-vcr} +## Skip tests in VCR replaying mode Acceptance tests are run in VCR replaying mode on PRs (using pre-recorded HTTP requests and responses) to reduce the time it takes to present results to contributors. However, not all resources or tests are possible to run in replaying mode. Incompatible tests should be skipped during VCR replaying mode. They will still run in our nightly test suite. @@ -327,9 +329,3 @@ These tests can still run in VCR replaying mode; however, REPLAYING mode can't b ## What's next? [Run your tests]({{< ref "/test/run-tests" >}}) - -## References - -* [Official Terraform documentation on Acceptance Tests](https://developer.hashicorp.com/terraform/plugin/sdkv2/testing/acceptance-tests) -* [MMv1 resource reference: `examples` ↗]({{}}) - diff --git a/mmv1/.rubocop.yml b/mmv1/.rubocop.yml new file mode 100644 index 000000000000..65b59c0f17e4 --- /dev/null +++ b/mmv1/.rubocop.yml @@ -0,0 +1,57 @@ +AllCops: + NewCops: enable + Exclude: + - 'build/**/*' + # We do not validate the templates as they will have code that will only be + # properly formatted when compiled for the target module. These files should + # be checked in their final generated form. + - 'products/**/files/*' + - 'products/**/examples/**/*' + - 'templates/**/*' + # TravisCI is installing the bundle deps in that directory. + - 'vendor/**/*' + +Metrics/AbcSize: + Enabled: false + +Metrics/ClassLength: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Metrics/ModuleLength: + Enabled: false + +Metrics/PerceivedComplexity: + Enabled: false + +Naming/MemoizedInstanceVariableName: + Enabled: false + +Style/FrozenStringLiteralComment: + Enabled: false + +Layout/LineLength: + Max: 100 + +Style/AccessorGrouping: + Enabled: false + +Style/CommandLiteral: + EnforcedStyle: percent_x + +# TODO: Turn this on and remove the usage at this point. It's not clear if this +# makes sense to do at the moment. +Style/OpenStructUse: + Enabled: false + +# Seems to generate invalid code +Style/HashTransformValues: + Enabled: false + +Metrics/ParameterLists: + Enabled: false diff --git a/mmv1/.ruby-version b/mmv1/.ruby-version new file mode 100644 index 000000000000..fd2a01863fdd --- /dev/null +++ b/mmv1/.ruby-version @@ -0,0 +1 @@ +3.1.0 diff --git a/mmv1/Gemfile b/mmv1/Gemfile new file mode 100644 index 000000000000..b0b4949b38d6 --- /dev/null +++ b/mmv1/Gemfile @@ -0,0 +1,12 @@ +source 'https://rubygems.org' + +gem 'binding_of_caller' +gem 'openapi_parser', '~> 1.0.0' +gem 'parallel' +gem 'rake' + +group :test do + gem 'mocha', '~> 1.3.0' + gem 'rspec' + gem 'rubocop', '>= 0.77.0' +end diff --git a/mmv1/Gemfile.lock b/mmv1/Gemfile.lock new file mode 100644 index 000000000000..15bdf9153dc2 --- /dev/null +++ b/mmv1/Gemfile.lock @@ -0,0 +1,64 @@ +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.2) + binding_of_caller (1.0.0) + debug_inspector (>= 0.0.1) + debug_inspector (1.1.0) + diff-lcs (1.5.0) + json (2.6.3) + metaclass (0.0.4) + mocha (1.3.0) + metaclass (~> 0.0.1) + openapi_parser (1.0.0) + parallel (1.22.1) + parser (3.2.0.0) + ast (~> 2.4.1) + rainbow (3.1.1) + rake (13.0.6) + regexp_parser (2.6.2) + rexml (3.3.3) + strscan + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.1) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) + rubocop (1.44.1) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.2.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.24.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.24.1) + parser (>= 3.1.1.0) + ruby-progressbar (1.11.0) + strscan (3.1.0) + unicode-display_width (2.4.2) + +PLATFORMS + ruby + +DEPENDENCIES + binding_of_caller + mocha (~> 1.3.0) + openapi_parser (~> 1.0.0) + parallel + rake + rspec + rubocop (>= 0.77.0) + +BUNDLED WITH + 2.4.6 diff --git a/mmv1/products/firebasedataconnect/product.yaml b/mmv1/Rakefile similarity index 61% rename from mmv1/products/firebasedataconnect/product.yaml rename to mmv1/Rakefile index 10a058af5eb7..b725e22450bc 100644 --- a/mmv1/products/firebasedataconnect/product.yaml +++ b/mmv1/Rakefile @@ -1,4 +1,4 @@ -# Copyright 2024 Google Inc. +# Copyright 2018 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 @@ -11,13 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- -name: FirebaseDataConnect -display_name: Firebase Data Connect -versions: - - name: ga - base_url: https://firebasedataconnect.googleapis.com/v1/ - - name: beta - base_url: https://firebasedataconnect.googleapis.com/v1beta/ -scopes: - - https://www.googleapis.com/auth/cloud-platform +# Configuration +$LOAD_PATH.unshift File.dirname(__FILE__) +Dir.chdir(File.dirname(__FILE__)) + +# Requires +require 'rspec/core/rake_task' +require 'rubocop/rake_task' + +RSpec::Core::RakeTask.new(:spec) +RuboCop::RakeTask.new + +# Test Tasks +desc 'Run all of the MM tests (rubocop, rspec)' +multitask test: %w[rubocop spec] diff --git a/mmv1/api/async.go b/mmv1/api/async.go index 8bef19423e07..f947c62741b3 100644 --- a/mmv1/api/async.go +++ b/mmv1/api/async.go @@ -17,6 +17,7 @@ import ( "log" "strings" + "github.com/GoogleCloudPlatform/magic-modules/mmv1/google" "golang.org/x/exp/slices" ) @@ -57,7 +58,6 @@ func NewOperation() *Operation { return op } -// It is only used in openapi-generate func NewAsync() *Async { oa := &Async{ Actions: []string{"create", "delete", "update"}, @@ -71,14 +71,24 @@ func NewAsync() *Async { type OpAsync struct { Result OpAsyncResult + Status OpAsyncStatus `yaml:"status,omitempty"` + + Error OpAsyncError + // If true, include project as an argument to OperationWaitTime. // It is intended for resources that calculate project/region from a selflink field IncludeProject bool `yaml:"include_project"` } type OpAsyncOperation struct { + Kind string `yaml:"kind,omitempty"` + + Path string `yaml:"path,omitempty"` + BaseUrl string `yaml:"base_url,omitempty"` + WaitMs int `yaml:"wait_ms,omitempty"` + // Use this if the resource includes the full operation url. FullUrl string `yaml:"full_url,omitempty"` } @@ -86,6 +96,27 @@ type OpAsyncOperation struct { // Represents the results of an Operation request type OpAsyncResult struct { ResourceInsideResponse bool `yaml:"resource_inside_response,omitempty"` + + Path string `yaml:"path,omitempty"` +} + +// Provides information to parse the result response to check operation +// status +type OpAsyncStatus struct { + Path string `yaml:"path,omitempty"` + + Complete bool `yaml:"complete,omitempty"` + + Allowed []bool `yaml:"allowed,omitempty"` +} + +// Provides information on how to retrieve errors of the executed operations +type OpAsyncError struct { + google.YamlValidator `yaml:"-"` + + Path string `yaml:"path,omitempty"` + + Message string `yaml:"message,omitempty"` } // Async implementation for polling in Terraform @@ -119,9 +150,6 @@ func (a *Async) UnmarshalYAML(unmarshal func(any) error) error { return err } - if a.Type == "" { - a.Type = "OpAsync" - } if a.Type == "PollAsync" && a.TargetOccurrences == 0 { a.TargetOccurrences = 1 } diff --git a/mmv1/api/resource.go b/mmv1/api/resource.go index 77e0824261e1..0599004861d2 100644 --- a/mmv1/api/resource.go +++ b/mmv1/api/resource.go @@ -337,8 +337,7 @@ type Resource struct { // fine-grained resources and legacy resources. ApiResourceTypeKind string `yaml:"api_resource_type_kind,omitempty"` - ImportPath string `yaml:"-"` - SourceYamlFile string `yaml:"-"` + ImportPath string `yaml:"-"` } func (r *Resource) UnmarshalYAML(unmarshal func(any) error) error { @@ -501,12 +500,6 @@ func (r Resource) UserParameters() []*Type { }) } -func (r Resource) UserVirtualFields() []*Type { - return google.Reject(r.VirtualFields, func(p *Type) bool { - return p.Exclude - }) -} - func (r Resource) ServiceVersion() string { if r.CaiBaseUrl != "" { return extractVersionFromBaseUrl(r.CaiBaseUrl) @@ -622,28 +615,6 @@ func (r Resource) RootProperties() []*Type { return props } -// Returns a sorted list of all "leaf" properties, meaning properties that have -// no children. -func (r Resource) LeafProperties() []*Type { - types := r.AllNestedProperties(google.Concat(r.RootProperties(), r.UserVirtualFields())) - - // Remove types that have children, because we only want "leaf" fields - types = slices.DeleteFunc(types, func(t *Type) bool { - nestedProperties := t.NestedProperties() - return len(nestedProperties) > 0 - }) - - // Sort types by lineage - slices.SortFunc(types, func(a, b *Type) int { - if a.MetadataLineage() < b.MetadataLineage() { - return -1 - } - return 1 - }) - - return types -} - // Return the product-level async object, or the resource-specific one // if one exists. func (r Resource) GetAsync() *Async { @@ -1788,45 +1759,3 @@ func (r Resource) CaiIamAssetNameTemplate(productBackendName string) string { } return fmt.Sprintf("//%s.googleapis.com/%s/{{%s}}", productBackendName, caiBaseUrl, r.IamParentResourceName()) } - -func urlContainsOnlyAllowedKeys(templateURL string, allowedKeys []string) bool { - // Create regex to match anything between {{ and }} - re := regexp.MustCompile(`{{\s*([^}]+)\s*}}`) - - // Find all matches in the template URL - matches := re.FindAllStringSubmatch(templateURL, -1) - - // Create a map of allowed keys for O(1) lookup - allowedKeysMap := make(map[string]bool) - for _, key := range allowedKeys { - allowedKeysMap[key] = true - } - - // Check each found key against the allowed keys - for _, match := range matches { - if len(match) < 2 { - continue - } - - // Trim spaces from the key - key := strings.TrimSpace(match[1]) - - // If the key isn't in our allowed list, return false - if !allowedKeysMap[key] { - return false - } - } - - return true -} - -func (r Resource) ShouldGenerateSweepers() bool { - allowedKeys := []string{"project", "region", "location", "zone", "billing_account"} - if !urlContainsOnlyAllowedKeys(r.ListUrlTemplate(), allowedKeys) { - return false - } - if r.ExcludeSweeper || r.CustomCode.CustomDelete != "" || r.CustomCode.PreDelete != "" || r.CustomCode.PostDelete != "" || r.ExcludeDelete { - return false - } - return true -} diff --git a/mmv1/api/resource/examples.go b/mmv1/api/resource/examples.go index 549617425feb..3304589a5c86 100644 --- a/mmv1/api/resource/examples.go +++ b/mmv1/api/resource/examples.go @@ -28,10 +28,6 @@ import ( "github.com/golang/glog" ) -type IamMember struct { - Member, Role string -} - // Generates configs to be shown as examples in docs and outputted as tests // from a shared template type Examples struct { @@ -53,13 +49,6 @@ type Examples struct { // object parent PrimaryResourceType string `yaml:"primary_resource_type,omitempty"` - // BootstrapIam will automatically bootstrap the given member/role pairs. - // This should be used in cases where specific IAM permissions must be - // present on the default test project, to avoid race conditions between - // tests. Permissions attached to resources created in a test should instead - // be provisioned with standard terraform resources. - BootstrapIam []IamMember `yaml:"bootstrap_iam,omitempty"` - // Vars is a Hash from template variable names to output variable names. // It will use the provided value as a prefix for generated tests, and // insert it into the docs verbatim. @@ -73,18 +62,18 @@ type Examples struct { // // test_env_vars is a Hash from template variable names to one of the // following symbols: - // - PROJECT_NAME - // - CREDENTIALS - // - REGION - // - ORG_ID - // - ORG_TARGET - // - BILLING_ACCT - // - MASTER_BILLING_ACCT - // - SERVICE_ACCT - // - CUST_ID - // - IDENTITY_USER - // - CHRONICLE_ID - // - VMWAREENGINE_PROJECT + // - :PROJECT_NAME + // - :CREDENTIALS + // - :REGION + // - :ORG_ID + // - :ORG_TARGET + // - :BILLING_ACCT + // - :MASTER_BILLING_ACCT + // - :SERVICE_ACCT + // - :CUST_ID + // - :IDENTITY_USER + // - :CHRONICLE_ID + // - :VMWAREENGINE_PROJECT // This list corresponds to the `get*FromEnv` methods in provider_test.go. TestEnvVars map[string]string `yaml:"test_env_vars,omitempty"` diff --git a/mmv1/api/resource/sweeper.go b/mmv1/api/resource/sweeper.go index 1072aab11244..44a30f598e83 100644 --- a/mmv1/api/resource/sweeper.go +++ b/mmv1/api/resource/sweeper.go @@ -13,18 +13,8 @@ package resource -// Sweeper provides configuration for the test sweeper type Sweeper struct { // The field checked by sweeper to determine // eligibility for deletion for generated resources - IdentifierField string `yaml:"identifier_field"` - Regions []string `yaml:"regions,omitempty"` - Prefixes []string `yaml:"prefixes,omitempty"` - URLSubstitutions []URLSubstitution `yaml:"url_substitutions,omitempty"` -} - -// URLSubstitution represents a region-zone pair for URL substitution -type URLSubstitution struct { - Region string `yaml:"region,omitempty"` - Zone string `yaml:"zone,omitempty"` + SweepableIdentifierField string `yaml:"sweepable_identifier_field"` } diff --git a/mmv1/api/resource_test.go b/mmv1/api/resource_test.go index 62a13fb58e96..4fb5bb868f9d 100644 --- a/mmv1/api/resource_test.go +++ b/mmv1/api/resource_test.go @@ -198,120 +198,3 @@ func TestResourceServiceVersion(t *testing.T) { }) } } - -func TestLeafProperties(t *testing.T) { - t.Parallel() - - cases := []struct { - description string - obj Resource - expected Type - }{ - { - description: "non-nested type", - obj: Resource{ - BaseUrl: "test", - Properties: []*Type{ - { - Name: "basic", - Type: "String", - }, - }, - }, - expected: Type{ - Name: "basic", - }, - }, - { - description: "nested type", - obj: Resource{ - BaseUrl: "test", - Properties: []*Type{ - { - Name: "root", - Type: "NestedObject", - Properties: []*Type{ - { - Name: "foo", - Type: "NestedObject", - Properties: []*Type{ - { - Name: "bars", - Type: "Array", - ItemType: &Type{ - Type: "NestedObject", - Properties: []*Type{ - { - Name: "fooBar", - Type: "String", - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - expected: Type{ - Name: "fooBar", - }, - }, - { - description: "nested virtual", - obj: Resource{ - BaseUrl: "test", - VirtualFields: []*Type{ - { - Name: "root", - Type: "NestedObject", - Properties: []*Type{ - { - Name: "foo", - Type: "String", - }, - }, - }, - }, - }, - expected: Type{ - Name: "foo", - }, - }, - { - description: "nested param", - obj: Resource{ - BaseUrl: "test", - Parameters: []*Type{ - { - Name: "root", - Type: "NestedObject", - Properties: []*Type{ - { - Name: "foo", - Type: "String", - }, - }, - }, - }, - }, - expected: Type{ - Name: "foo", - }, - }, - } - - for _, tc := range cases { - tc := tc - - t.Run(tc.description, func(t *testing.T) { - t.Parallel() - - tc.obj.SetDefault(nil) - if got, want := tc.obj.LeafProperties(), tc.expected; got[0].Name != want.Name { - t.Errorf("expected %q to be %q", got[0].Name, want.Name) - } - }) - } -} diff --git a/mmv1/api/type.go b/mmv1/api/type.go index 89eef1f40ce9..a4d187e08cc0 100644 --- a/mmv1/api/type.go +++ b/mmv1/api/type.go @@ -399,39 +399,6 @@ func (t Type) Lineage() string { return fmt.Sprintf("%s.%s", t.ParentMetadata.Lineage(), google.Underscore(t.Name)) } -// Returns a dot notation path to where the field is nested within the parent -// object. eg: parent.meta.label.foo -// This format is intended for resource metadata, to be used for connecting a Terraform -// type with a corresponding API type. -func (t Type) MetadataLineage() string { - if t.ParentMetadata == nil { - return google.Underscore(t.Name) - } - - // Skip arrays because otherwise the array name will be included twice - if t.ParentMetadata.IsA("Array") { - return t.ParentMetadata.MetadataLineage() - } - - return fmt.Sprintf("%s.%s", t.ParentMetadata.MetadataLineage(), google.Underscore(t.Name)) -} - -// Returns a dot notation path to where the field is nested within the parent -// object. eg: parent.meta.label.foo -// This format is intended for to represent an API type. -func (t Type) MetadataApiLineage() string { - apiName := t.ApiName - if t.ParentMetadata == nil { - return google.Underscore(apiName) - } - - if t.ParentMetadata.IsA("Array") { - return t.ParentMetadata.MetadataApiLineage() - } - - return fmt.Sprintf("%s.%s", t.ParentMetadata.MetadataApiLineage(), google.Underscore(apiName)) -} - // Returns the lineage in snake case func (t Type) LineageAsSnakeCase() string { if t.ParentMetadata == nil { @@ -1098,22 +1065,6 @@ func (t *Type) IsForceNew() bool { !(parent.FlattenObject && t.IsA("KeyValueLabels")))))) } -// Returns true if the type does not correspond to an API type -func (t *Type) ProviderOnly() bool { - // These are special case fields created by the generator which have no API counterpart - if t.IsA("KeyValueEffectiveLabels") || t.IsA("KeyValueTerraformLabels") { - return true - } - - if t.UrlParamOnly || t.ClientSide { - return true - } - - // The type is provider-only if any of its ancestors are provider-only (it is inherited) - parent := t.Parent() - return parent != nil && parent.ProviderOnly() -} - // Returns an updated path for a given Terraform field path (e.g. // 'a_field', 'parent_field.0.child_name'). Returns nil if the property // is not included in the resource's properties and removes keys that have diff --git a/mmv1/api/type_test.go b/mmv1/api/type_test.go index 3d46d120a31f..9d592d35a765 100644 --- a/mmv1/api/type_test.go +++ b/mmv1/api/type_test.go @@ -184,244 +184,3 @@ func TestTypeExcludeIfNotInVersion(t *testing.T) { }) } } - -func TestMetadataLineage(t *testing.T) { - t.Parallel() - - root := Type{ - Name: "root", - Type: "NestedObject", - Properties: []*Type{ - { - Name: "foo", - Type: "NestedObject", - Properties: []*Type{ - { - Name: "bars", - Type: "Array", - ItemType: &Type{ - Type: "NestedObject", - Properties: []*Type{ - { - Name: "fooBar", - Type: "String", - }, - }, - }, - }, - }, - }, - }, - } - root.SetDefault(&Resource{}) - - cases := []struct { - description string - obj Type - expected string - }{ - { - description: "root type", - obj: root, - expected: "root", - }, - { - description: "sub type", - obj: *root.Properties[0], - expected: "root.foo", - }, - { - description: "array", - obj: *root.Properties[0].Properties[0], - expected: "root.foo.bars", - }, - { - description: "array of objects", - obj: *root.Properties[0].Properties[0].ItemType.Properties[0], - expected: "root.foo.bars.foo_bar", - }, - } - - for _, tc := range cases { - tc := tc - - t.Run(tc.description, func(t *testing.T) { - t.Parallel() - - got := tc.obj.MetadataLineage() - if got != tc.expected { - t.Errorf("expected %q to be %q", got, tc.expected) - } - }) - } -} - -func TestMetadataApiLineage(t *testing.T) { - t.Parallel() - - root := Type{ - Name: "root", - Type: "NestedObject", - Properties: []*Type{ - { - Name: "foo", - Type: "NestedObject", - Properties: []*Type{ - { - Name: "bars", - Type: "Array", - ItemType: &Type{ - Type: "NestedObject", - Properties: []*Type{ - { - Name: "fooBar", - Type: "String", - }, - }, - }, - }, - }, - }, - { - Name: "baz", - ApiName: "bazbaz", - Type: "String", - }, - }, - } - root.SetDefault(&Resource{}) - - cases := []struct { - description string - obj Type - expected string - }{ - { - description: "root type", - obj: root, - expected: "root", - }, - { - description: "sub type", - obj: *root.Properties[0], - expected: "root.foo", - }, - { - description: "array", - obj: *root.Properties[0].Properties[0], - expected: "root.foo.bars", - }, - { - description: "array of objects", - obj: *root.Properties[0].Properties[0].ItemType.Properties[0], - expected: "root.foo.bars.foo_bar", - }, - { - description: "with api name", - obj: *root.Properties[1], - expected: "root.bazbaz", - }, - } - - for _, tc := range cases { - tc := tc - - t.Run(tc.description, func(t *testing.T) { - t.Parallel() - - got := tc.obj.MetadataApiLineage() - if got != tc.expected { - t.Errorf("expected %q to be %q", got, tc.expected) - } - }) - } -} - -func TestProviderOnly(t *testing.T) { - t.Parallel() - - nested := Type{ - Name: "foo", - ClientSide: true, - Type: "NestedObject", - Properties: []*Type{ - { - Name: "bar", - }, - }, - } - nested.SetDefault(&Resource{}) - - labeled := Resource{ - BaseUrl: "test", - Properties: []*Type{ - { - Name: "labels", - Type: "KeyValueLabels", - }, - }, - } - labeled.Properties = labeled.AddLabelsRelatedFields(labeled.PropertiesWithExcluded(), nil) - labeled.SetDefault(nil) - - cases := []struct { - description string - obj Type - expected bool - }{ - { - description: "normal", - obj: Type{ - Name: "foo", - }, - expected: false, - }, - { - description: "url param", - obj: Type{ - Name: "foo", - UrlParamOnly: true, - }, - expected: true, - }, - { - description: "virtual", - obj: Type{ - Name: "foo", - // Virtual fields will have this field set during SetDefault() - ClientSide: true, - }, - expected: true, - }, - { - description: "child of virtual", - obj: *nested.Properties[0], - expected: true, - }, - { - description: "terraform labels", - // Terraform labels are added first - obj: *labeled.Properties[1], - expected: true, - }, - { - description: "effective labels", - // Effective labels are added second - obj: *labeled.Properties[2], - expected: true, - }, - } - - for _, tc := range cases { - tc := tc - - t.Run(tc.description, func(t *testing.T) { - t.Parallel() - - got := tc.obj.ProviderOnly() - if got != tc.expected { - t.Errorf("expected %t to be %t", got, tc.expected) - } - }) - } -} diff --git a/mmv1/main.go b/mmv1/main.go index e4c8cfbb0427..214bfc49dbce 100644 --- a/mmv1/main.go +++ b/mmv1/main.go @@ -256,7 +256,6 @@ func GenerateProduct(productChannel chan string, providerToGenerate provider.Pro resource := &api.Resource{} api.Compile(resourceYamlPath, resource, overrideDirectory) - resource.SourceYamlFile = resourceYamlPath resource.TargetVersionName = *version resource.Properties = resource.AddLabelsRelatedFields(resource.PropertiesWithExcluded(), nil) diff --git a/mmv1/products/accesscontextmanager/AccessLevel.yaml b/mmv1/products/accesscontextmanager/AccessLevel.yaml index 42d727707851..98ddda93908f 100644 --- a/mmv1/products/accesscontextmanager/AccessLevel.yaml +++ b/mmv1/products/accesscontextmanager/AccessLevel.yaml @@ -39,7 +39,6 @@ self_link: '{{name}}' create_url: '{{parent}}/accessLevels' update_verb: 'PATCH' update_mask: true -mutex: '{{parent}}' import_format: - '{{name}}' timeouts: diff --git a/mmv1/products/accesscontextmanager/AccessLevelCondition.yaml b/mmv1/products/accesscontextmanager/AccessLevelCondition.yaml index 3409bf177c79..af0a6b2b7d20 100644 --- a/mmv1/products/accesscontextmanager/AccessLevelCondition.yaml +++ b/mmv1/products/accesscontextmanager/AccessLevelCondition.yaml @@ -47,7 +47,7 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' +mutex: '{{access_level}}' import_format: - '{{access_level}}' # no unique way to specify @@ -78,7 +78,6 @@ nested_query: is_list_of_ids: false modify_by_patch: true custom_code: - encoder: 'templates/terraform/encoders/access_context_manager_access_level_condition.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under AccessLevel exclude_sweeper: true @@ -249,9 +248,3 @@ properties: description: 'CIDR block IP subnetwork specification. Must be IPv4.' item_type: type: String - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true diff --git a/mmv1/products/accesscontextmanager/AccessLevels.yaml b/mmv1/products/accesscontextmanager/AccessLevels.yaml index 9425553ffbc6..45fbc20fc3c7 100644 --- a/mmv1/products/accesscontextmanager/AccessLevels.yaml +++ b/mmv1/products/accesscontextmanager/AccessLevels.yaml @@ -37,7 +37,6 @@ update_url: '{{parent}}/accessLevels:replaceAll' update_verb: 'POST' import_format: - '{{parent}}/accessLevels' -mutex: '{{parent}}' timeouts: insert_minutes: 20 update_minutes: 20 diff --git a/mmv1/products/accesscontextmanager/AccessPolicy.yaml b/mmv1/products/accesscontextmanager/AccessPolicy.yaml index eed47595008f..ef331b7d7fa4 100644 --- a/mmv1/products/accesscontextmanager/AccessPolicy.yaml +++ b/mmv1/products/accesscontextmanager/AccessPolicy.yaml @@ -37,7 +37,6 @@ update_verb: 'PATCH' update_mask: true import_format: - '{{name}}' -mutex: 'accessPolicies/{{name}}' timeouts: insert_minutes: 20 update_minutes: 20 diff --git a/mmv1/products/accesscontextmanager/AuthorizedOrgsDesc.yaml b/mmv1/products/accesscontextmanager/AuthorizedOrgsDesc.yaml index e8b1cfd103f9..27d5807fae9f 100644 --- a/mmv1/products/accesscontextmanager/AuthorizedOrgsDesc.yaml +++ b/mmv1/products/accesscontextmanager/AuthorizedOrgsDesc.yaml @@ -37,7 +37,6 @@ create_url: '{{parent}}/authorizedOrgsDescs' update_verb: 'PATCH' import_format: - '{{name}}' -mutex: '{{parent}}' timeouts: insert_minutes: 20 update_minutes: 20 diff --git a/mmv1/products/accesscontextmanager/EgressPolicy.yaml b/mmv1/products/accesscontextmanager/EgressPolicy.yaml index 43f71914ad88..f7cf7a82d013 100644 --- a/mmv1/products/accesscontextmanager/EgressPolicy.yaml +++ b/mmv1/products/accesscontextmanager/EgressPolicy.yaml @@ -28,7 +28,6 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' import_format: - '{{egress_policy_name}}/{{resource}}' timeouts: @@ -52,7 +51,6 @@ nested_query: is_list_of_ids: true modify_by_patch: true custom_code: - encoder: 'templates/terraform/encoders/access_context_manager_egress_policy.go.tmpl' custom_import: 'templates/terraform/custom_import/access_context_manager_service_perimeter_egress_policy.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under ServicePerimeter/IngressPolicy @@ -74,9 +72,3 @@ properties: A GCP resource that is inside of the service perimeter. required: true immutable: true - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true diff --git a/mmv1/products/accesscontextmanager/IngressPolicy.yaml b/mmv1/products/accesscontextmanager/IngressPolicy.yaml index 775c863dca08..84395d6d6ff4 100644 --- a/mmv1/products/accesscontextmanager/IngressPolicy.yaml +++ b/mmv1/products/accesscontextmanager/IngressPolicy.yaml @@ -28,7 +28,6 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' import_format: - '{{ingress_policy_name}}/{{resource}}' timeouts: @@ -52,7 +51,6 @@ nested_query: is_list_of_ids: true modify_by_patch: true custom_code: - encoder: 'templates/terraform/encoders/access_context_manager_ingress_policy.go.tmpl' custom_import: 'templates/terraform/custom_import/access_context_manager_service_perimeter_ingress_policy.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under ServicePerimeter/IngressPolicy @@ -74,9 +72,3 @@ properties: A GCP resource that is inside of the service perimeter. required: true immutable: true - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true diff --git a/mmv1/products/accesscontextmanager/ServicePerimeter.yaml b/mmv1/products/accesscontextmanager/ServicePerimeter.yaml index e0e1f5a28d6c..ce323709e7ca 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeter.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeter.yaml @@ -47,7 +47,7 @@ self_link: '{{name}}' create_url: '{{parent}}/servicePerimeters' update_verb: 'PATCH' update_mask: true -mutex: '{{parent}}' +mutex: '{{name}}' import_format: - '{{name}}' timeouts: @@ -348,10 +348,6 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - name: 'egressPolicies' type: Array description: | @@ -388,15 +384,6 @@ properties: - name: 'accessLevel' type: String description: 'An AccessLevel resource name that allows resources outside the ServicePerimeter to be accessed from the inside.' - - name: 'resource' - type: String - description: | - A Google Cloud resource that is allowed to egress the perimeter. - Requests from these resources are allowed to access data outside the perimeter. - Currently only projects are allowed. Project format: `projects/{project_number}`. - The resource may be in any Google Cloud organization, not just the - organization that the perimeter is defined in. `*` is not allowed, the - case of allowing all Google Cloud resources only is not supported. - name: 'sourceRestriction' type: Enum description: 'Whether to enforce traffic restrictions based on `sources` field. If the `sources` field is non-empty, then this field must be set to `SOURCE_RESTRICTION_ENABLED`.' @@ -476,10 +463,6 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - name: 'spec' type: NestedObject description: | @@ -674,10 +657,6 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - name: 'egressPolicies' type: Array description: | @@ -714,15 +693,6 @@ properties: - name: 'accessLevel' type: String description: 'An AccessLevel resource name that allows resources outside the ServicePerimeter to be accessed from the inside.' - - name: 'resource' - type: String - description: | - A Google Cloud resource that is allowed to egress the perimeter. - Requests from these resources are allowed to access data outside the perimeter. - Currently only projects are allowed. Project format: `projects/{project_number}`. - The resource may be in any Google Cloud organization, not just the - organization that the perimeter is defined in. `*` is not allowed, the - case of allowing all Google Cloud resources only is not supported. - name: 'sourceRestriction' type: Enum description: 'Whether to enforce traffic restrictions based on `sources` field. If the `sources` field is non-empty, then this field must be set to `SOURCE_RESTRICTION_ENABLED`.' @@ -800,10 +770,6 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - name: 'useExplicitDryRunSpec' type: Boolean description: | diff --git a/mmv1/products/accesscontextmanager/ServicePerimeterDryRunEgressPolicy.yaml b/mmv1/products/accesscontextmanager/ServicePerimeterDryRunEgressPolicy.yaml index baf7a7dd2cc5..ee2d5f68f0d9 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeterDryRunEgressPolicy.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeterDryRunEgressPolicy.yaml @@ -43,7 +43,7 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' +mutex: '{{perimeter}}' import_format: - '{{perimeter}}' exclude_import: true @@ -62,7 +62,6 @@ async: identity: - egressFrom - egressTo - - title nested_query: keys: - spec @@ -71,19 +70,15 @@ nested_query: modify_by_patch: true custom_code: constants: 'templates/terraform/constants/access_context_manager.go.tmpl' - encoder: 'templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl' - pre_create: 'templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl' + pre_create: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' pre_update: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' - pre_delete: 'templates/terraform/pre_delete/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl' - post_read: 'templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl' + pre_delete: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' custom_import: 'templates/terraform/custom_import/access_context_manager_service_perimeter_ingress_policy.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under ServicePerimeter exclude_sweeper: true examples: - name: 'access_context_manager_service_perimeter_dry_run_egress_policy' - vars: - egress_policy_title: 'egress policy title' exclude_test: true parameters: - name: 'perimeter' @@ -132,15 +127,6 @@ properties: - name: 'accessLevel' type: String description: 'An AccessLevel resource name that allows resources outside the ServicePerimeter to be accessed from the inside.' - - name: 'resource' - type: String - description: | - A Google Cloud resource that is allowed to egress the perimeter. - Requests from these resources are allowed to access data outside the perimeter. - Currently only projects are allowed. Project format: `projects/{project_number}`. - The resource may be in any Google Cloud organization, not just the - organization that the perimeter is defined in. `*` is not allowed, the - case of allowing all Google Cloud resources only is not supported. - name: 'sourceRestriction' type: Enum description: 'Whether to enforce traffic restrictions based on `sources` field. If the `sources` field is non-empty, then this field must be set to `SOURCE_RESTRICTION_ENABLED`.' @@ -208,19 +194,3 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - immutable: true - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true - - name: 'etag' - type: String - output: true - description: | - The perimeter etag is internally used to prevent overwriting the list of policies on PATCH calls. It is retrieved from the same GET perimeter API call that's used to get the current list of policies. The policy defined in this resource is added or removed from that list, and then this etag is sent with the PATCH call along with the updated policies. diff --git a/mmv1/products/accesscontextmanager/ServicePerimeterDryRunIngressPolicy.yaml b/mmv1/products/accesscontextmanager/ServicePerimeterDryRunIngressPolicy.yaml index 081fc8734704..76215dc4b917 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeterDryRunIngressPolicy.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeterDryRunIngressPolicy.yaml @@ -44,7 +44,7 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' +mutex: '{{perimeter}}' import_format: - '{{perimeter}}' exclude_import: true @@ -63,7 +63,6 @@ async: identity: - ingressFrom - ingressTo - - title nested_query: keys: - spec @@ -72,19 +71,15 @@ nested_query: modify_by_patch: true custom_code: constants: 'templates/terraform/constants/access_context_manager.go.tmpl' - encoder: 'templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl' - pre_create: 'templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl' + pre_create: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' pre_update: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' - pre_delete: 'templates/terraform/pre_delete/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl' - post_read: 'templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl' + pre_delete: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' custom_import: 'templates/terraform/custom_import/access_context_manager_service_perimeter_ingress_policy.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under ServicePerimeter exclude_sweeper: true examples: - name: 'access_context_manager_service_perimeter_dry_run_ingress_policy' - vars: - ingress_policy_title: 'ingress policy title' exclude_test: true parameters: - name: 'perimeter' @@ -208,18 +203,3 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true - - name: 'etag' - type: String - output: true - description: | - The perimeter etag is internally used to prevent overwriting the list of policies on PATCH calls. It is retrieved from the same GET perimeter API call that's used to get the current list of policies. The policy defined in this resource is added or removed from that list, and then this etag is sent with the PATCH call along with the updated policies. diff --git a/mmv1/products/accesscontextmanager/ServicePerimeterDryRunResource.yaml b/mmv1/products/accesscontextmanager/ServicePerimeterDryRunResource.yaml index 1ca763c5e5a5..c3c08c388ed8 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeterDryRunResource.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeterDryRunResource.yaml @@ -43,7 +43,7 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' +mutex: '{{perimeter_name}}' import_format: - '{{perimeter_name}}/{{resource}}' timeouts: @@ -67,11 +67,9 @@ nested_query: is_list_of_ids: true modify_by_patch: true custom_code: - encoder: 'templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_resource.go.tmpl' - pre_create: 'templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl' - pre_update: 'templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl' - pre_delete: 'templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl' - post_read: 'templates/terraform/post_read/access_context_manager_service_perimeter_dry_run_resource.go.tmpl' + pre_create: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' + pre_update: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' + pre_delete: 'templates/terraform/pre_create/access_context_manager_dry_run_resource.go.tmpl' custom_import: 'templates/terraform/custom_import/access_context_manager_service_perimeter_resource.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under ServicePerimeter @@ -101,14 +99,3 @@ properties: Format: projects/{project_number} required: true immutable: true - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true - - name: 'etag' - type: String - output: true - description: | - The perimeter etag is internally used to prevent overwriting the list of perimeter resources on PATCH calls. It is retrieved from the same GET perimeter API call that's used to get the current list of resources. The resource to add or remove is merged into that list and then this etag is sent with the PATCH call along with the updated resource list. diff --git a/mmv1/products/accesscontextmanager/ServicePerimeterEgressPolicy.yaml b/mmv1/products/accesscontextmanager/ServicePerimeterEgressPolicy.yaml index 471780edcf12..b8603fd524d4 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeterEgressPolicy.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeterEgressPolicy.yaml @@ -43,7 +43,7 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' +mutex: '{{perimeter}}' import_format: - '{{perimeter}}' exclude_import: true @@ -62,7 +62,6 @@ async: identity: - egressFrom - egressTo - - title nested_query: keys: - status @@ -72,17 +71,11 @@ nested_query: custom_code: constants: 'templates/terraform/constants/access_context_manager.go.tmpl' custom_import: 'templates/terraform/custom_import/access_context_manager_service_perimeter_egress_policy.go.tmpl' - encoder: 'templates/terraform/encoders/access_context_manager_service_perimeter_egress_policy.go.tmpl' - post_read: 'templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl' - pre_create: 'templates/terraform/pre_create/access_context_manager_service_perimeter_egress_policy.go.tmpl' - pre_delete: 'templates/terraform/pre_delete/access_context_manager_service_perimeter_egress_policy.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under ServicePerimeter exclude_sweeper: true examples: - name: 'access_context_manager_service_perimeter_egress_policy' - vars: - egress_policy_title: 'egress policy title' exclude_test: true parameters: - name: 'perimeter' @@ -131,15 +124,6 @@ properties: - name: 'accessLevel' type: String description: 'An AccessLevel resource name that allows resources outside the ServicePerimeter to be accessed from the inside.' - - name: 'resource' - type: String - description: | - A Google Cloud resource that is allowed to egress the perimeter. - Requests from these resources are allowed to access data outside the perimeter. - Currently only projects are allowed. Project format: `projects/{project_number}`. - The resource may be in any Google Cloud organization, not just the - organization that the perimeter is defined in. `*` is not allowed, the - case of allowing all Google Cloud resources only is not supported. - name: 'sourceRestriction' type: Enum description: 'Whether to enforce traffic restrictions based on `sources` field. If the `sources` field is non-empty, then this field must be set to `SOURCE_RESTRICTION_ENABLED`.' @@ -208,18 +192,3 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true - - name: 'etag' - type: String - output: true - description: | - The perimeter etag is internally used to prevent overwriting the list of policies on PATCH calls. It is retrieved from the same GET perimeter API call that's used to get the current list of policies. The policy defined in this resource is added or removed from that list, and then this etag is sent with the PATCH call along with the updated policies. diff --git a/mmv1/products/accesscontextmanager/ServicePerimeterIngressPolicy.yaml b/mmv1/products/accesscontextmanager/ServicePerimeterIngressPolicy.yaml index 3b1bc161bf7a..769ad47e5226 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeterIngressPolicy.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeterIngressPolicy.yaml @@ -44,7 +44,7 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' +mutex: '{{perimeter}}' import_format: - '{{perimeter}}' exclude_import: true @@ -63,7 +63,6 @@ async: identity: - ingressFrom - ingressTo - - title nested_query: keys: - status @@ -73,17 +72,11 @@ nested_query: custom_code: constants: 'templates/terraform/constants/access_context_manager.go.tmpl' custom_import: 'templates/terraform/custom_import/access_context_manager_service_perimeter_ingress_policy.go.tmpl' - encoder: 'templates/terraform/encoders/access_context_manager_service_perimeter_ingress_policy.go.tmpl' - post_read: 'templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl' - pre_create: 'templates/terraform/pre_create/access_context_manager_service_perimeter_ingress_policy.go.tmpl' - pre_delete: 'templates/terraform/pre_delete/access_context_manager_service_perimeter_ingress_policy.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under ServicePerimeter exclude_sweeper: true examples: - name: 'access_context_manager_service_perimeter_ingress_policy' - vars: - ingress_policy_title: 'ingress policy title' exclude_test: true parameters: - name: 'perimeter' @@ -210,18 +203,3 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true - - name: 'etag' - type: String - output: true - description: | - The perimeter etag is internally used to prevent overwriting the list of policies on PATCH calls. It is retrieved from the same GET perimeter API call that's used to get the current list of policies. The policy defined in this resource is added or removed from that list, and then this etag is sent with the PATCH call along with the updated policies. diff --git a/mmv1/products/accesscontextmanager/ServicePerimeterResource.yaml b/mmv1/products/accesscontextmanager/ServicePerimeterResource.yaml index e681af67c551..e5fb2f303ba2 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeterResource.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeterResource.yaml @@ -43,7 +43,7 @@ create_verb: 'PATCH' update_mask: true delete_verb: 'PATCH' immutable: true -mutex: '{{access_policy_id}}' +mutex: '{{perimeter_name}}' import_format: - '{{perimeter_name}}/{{resource}}' timeouts: @@ -67,11 +67,8 @@ nested_query: is_list_of_ids: true modify_by_patch: true custom_code: - encoder: 'templates/terraform/encoders/access_context_manager_service_perimeter_resource.go.tmpl' custom_import: 'templates/terraform/custom_import/access_context_manager_service_perimeter_resource.go.tmpl' post_read: 'templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl' - pre_create: 'templates/terraform/pre_create/access_context_manager_service_perimeter_resource.go.tmpl' - pre_delete: 'templates/terraform/pre_delete/access_context_manager_service_perimeter_resource.go.tmpl' exclude_tgc: true # Skipping the sweeper due to the non-standard base_url and because this is fine-grained under ServicePerimeter exclude_sweeper: true @@ -100,14 +97,3 @@ properties: Format: projects/{project_number} required: true immutable: true - - name: 'accessPolicyId' - type: String - description: | - The name of the Access Policy this resource belongs to. - ignore_read: true - output: true - - name: 'etag' - type: String - output: true - description: | - The perimeter etag is internally used to prevent overwriting the list of perimeter resources on PATCH calls. It is retrieved from the same GET perimeter API call that's used to get the current list of resources. The resource to add or remove is merged into that list and then this etag is sent with the PATCH call along with the updated resource list. diff --git a/mmv1/products/accesscontextmanager/ServicePerimeters.yaml b/mmv1/products/accesscontextmanager/ServicePerimeters.yaml index 527d644354bd..0c3b5a0ca944 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeters.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeters.yaml @@ -12,7 +12,7 @@ # limitations under the License. --- -# This is the plural of `ServicePerimeter`, any changes here should be made to `ServicePerimeter` as well + # This is the plural of `ServicePerimeter`, any changes here should be made to `ServicePerimeter` as well name: 'ServicePerimeters' api_resource_type_kind: ServicePerimeter description: | @@ -30,7 +30,6 @@ base_url: '{{parent}}/servicePerimeters:replaceAll' self_link: '{{parent}}/servicePerimeters' update_url: '{{parent}}/servicePerimeters:replaceAll' update_verb: 'POST' -mutex: '{{parent}}' import_format: - '{{parent}}/servicePerimeters' timeouts: @@ -329,10 +328,6 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - name: 'egressPolicies' type: Array description: | @@ -377,15 +372,6 @@ properties: - name: 'accessLevel' type: String description: 'An AccessLevel resource name that allows resources outside the ServicePerimeter to be accessed from the inside.' - - name: 'resource' - type: String - description: | - A Google Cloud resource that is allowed to egress the perimeter. - Requests from these resources are allowed to access data outside the perimeter. - Currently only projects are allowed. Project format: `projects/{project_number}`. - The resource may be in any Google Cloud organization, not just the - organization that the perimeter is defined in. `*` is not allowed, the - case of allowing all Google Cloud resources only is not supported. - name: 'sourceRestriction' type: Enum description: 'Whether to enforce traffic restrictions based on `sources` field. If the `sources` field is non-empty, then this field must be set to `SOURCE_RESTRICTION_ENABLED`.' @@ -454,10 +440,6 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - name: 'spec' type: NestedObject description: | @@ -645,10 +627,6 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - name: 'egressPolicies' type: Array description: | @@ -695,15 +673,6 @@ properties: - name: 'accessLevel' type: String description: 'An AccessLevel resource name that allows resources outside the ServicePerimeter to be accessed from the inside.' - - name: 'resource' - type: String - description: | - A Google Cloud resource that is allowed to egress the perimeter. - Requests from these resources are allowed to access data outside the perimeter. - Currently only projects are allowed. Project format: `projects/{project_number}`. - The resource may be in any Google Cloud organization, not just the - organization that the perimeter is defined in. `*` is not allowed, the - case of allowing all Google Cloud resources only is not supported. - name: 'sourceRestriction' type: Enum description: 'Whether to enforce traffic restrictions based on `sources` field. If the `sources` field is non-empty, then this field must be set to `SOURCE_RESTRICTION_ENABLED`.' @@ -772,10 +741,6 @@ properties: description: | Value for permission should be a valid Cloud IAM permission for the corresponding `serviceName` in `ApiOperation`. - - name: 'title' - type: 'string' - description: | - Human readable title. Must be unique within the perimeter. Does not affect behavior. - name: 'useExplicitDryRunSpec' type: Boolean description: | diff --git a/mmv1/products/alloydb/Cluster.yaml b/mmv1/products/alloydb/Cluster.yaml index 923e0e4c6ba6..65645b3d8089 100644 --- a/mmv1/products/alloydb/Cluster.yaml +++ b/mmv1/products/alloydb/Cluster.yaml @@ -110,13 +110,6 @@ virtual_fields: Possible values: DEFAULT, FORCE type: String default_value: "DEFAULT" - - name: 'skip_await_major_version_upgrade' - type: Boolean - default_value: true - description: | - Set to true to skip awaiting on the major version upgrade of the cluster. - Possible values: true, false - Default value: "true" parameters: - name: 'clusterId' type: String @@ -263,8 +256,7 @@ properties: - name: 'databaseVersion' type: String description: | - The database engine major version. This is an optional field and it's populated at the Cluster creation time. - Note: Changing this field to a higer version results in upgrading the AlloyDB cluster which is an irreversible change. + The database engine major version. This is an optional field and it's populated at the Cluster creation time. This field cannot be changed after cluster creation. default_from_api: true - name: 'pscConfig' type: NestedObject diff --git a/mmv1/products/alloydb/User.yaml b/mmv1/products/alloydb/User.yaml index df3ba9a3dcd3..2278fc07622f 100644 --- a/mmv1/products/alloydb/User.yaml +++ b/mmv1/products/alloydb/User.yaml @@ -119,7 +119,6 @@ properties: type: String description: | Password for this database user. - sensitive: true ignore_read: true - name: 'databaseRoles' type: Array diff --git a/mmv1/products/apigee/EndpointAttachment.yaml b/mmv1/products/apigee/EndpointAttachment.yaml index 7828f6c32ba1..26376d98e377 100644 --- a/mmv1/products/apigee/EndpointAttachment.yaml +++ b/mmv1/products/apigee/EndpointAttachment.yaml @@ -43,6 +43,19 @@ async: custom_code: custom_import: 'templates/terraform/custom_import/apigee_endpoint_attachment.go.tmpl' exclude_sweeper: true +examples: + - name: 'apigee_endpoint_attachment_basic' + exclude_test: true + # This is a more verbose version of the above that creates all + # the resources needed for the acceptance test. + - name: 'apigee_endpoint_attachment_basic_test' + primary_resource_id: 'apigee_endpoint_attachment' + test_env_vars: + org_id: 'ORG_ID' + billing_account: 'BILLING_ACCT' + exclude_docs: true + # Resource creation race + skip_vcr: true parameters: - name: 'orgId' type: String diff --git a/mmv1/products/apigee/Environment.yaml b/mmv1/products/apigee/Environment.yaml index 7157e1eb822f..e96a8cafd5b0 100644 --- a/mmv1/products/apigee/Environment.yaml +++ b/mmv1/products/apigee/Environment.yaml @@ -23,6 +23,9 @@ docs: base_url: 'environments' self_link: '{{org_id}}/environments/{{name}}' create_url: '{{org_id}}/environments' +update_url: '{{org_id}}/environments/{{name}}' +update_verb: 'PATCH' +update_mask: true import_format: - '{{org_id}}/environments/{{name}}' - '{{org_id}}/{{name}}' @@ -76,16 +79,6 @@ examples: # Resource creation race skip_vcr: true external_providers: ["time"] - - name: 'apigee_environment_basic_properties_test' - primary_resource_id: 'apigee_environment' - primary_resource_name: 'fmt.Sprintf("organizations/tf-test%s", context["random_suffix"]), fmt.Sprintf("tf-test%s", context["random_suffix"])' - test_env_vars: - org_id: 'ORG_ID' - billing_account: 'BILLING_ACCT' - exclude_docs: true - # Resource creation race - skip_vcr: true - external_providers: ["time"] - name: 'apigee_environment_patch_update_test' primary_resource_id: 'apigee_environment' primary_resource_name: 'fmt.Sprintf("organizations/tf-test%s", context["random_suffix"]), fmt.Sprintf("tf-test%s", context["random_suffix"])' @@ -194,23 +187,3 @@ properties: description: | Optional. URI of the forward proxy to be applied to the runtime instances in this environment. Must be in the format of {scheme}://{hostname}:{port}. Note that the scheme must be one of "http" or "https", and the port must be supplied. required: false - - name: 'properties' - type: NestedObject - description: | - Key-value pairs that may be used for customizing the environment. - properties: - - name: 'property' - type: Array - description: | - List of all properties in the object. - item_type: - type: NestedObject - properties: - - name: 'name' - type: String - description: | - The property key. - - name: 'value' - type: String - description: | - The property value. diff --git a/mmv1/products/apihub/ApiHubInstance.yaml b/mmv1/products/apihub/ApiHubInstance.yaml deleted file mode 100644 index fd2fc8ca92d4..000000000000 --- a/mmv1/products/apihub/ApiHubInstance.yaml +++ /dev/null @@ -1,150 +0,0 @@ -# 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. - ---- -name: ApiHubInstance -description: |- - An ApiHubInstance represents the instance resources of the API Hub. - Currently, only one ApiHub instance is allowed for each project. - Currently, updation/deletion of ApiHub instance is not allowed. -base_url: projects/{{project}}/locations/{{location}}/apiHubInstances -immutable: true -self_link: '{{name}}' -create_url: projects/{{project}}/locations/{{location}}/apiHubInstances?apiHubInstanceId={{api_hub_instance_id}} -id_format: '{{name}}' -import_format: - - projects/{{project}}/locations/{{location}}/apiHubInstances/{{api_hub_instance_id}} -custom_code: - custom_import: 'templates/terraform/custom_import/apihub_api_hub_instance_set_id.go.tmpl' -examples: - - name: apihub_api_hub_instance_basic - primary_resource_id: apihub-instance-without-search - vars: - instance_id: test-instance-basic - exclude_test: true - - name: apihub_api_hub_instance_full - primary_resource_id: apihub-instance-search - vars: - instance_id: test-instance-full - exclude_test: true -autogen_async: true -exclude_delete: true -async: - operation: - timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 - base_url: '{{op_id}}' - actions: - - create - - delete - - update - type: OpAsync - result: - resource_inside_response: true - include_project: false -autogen_status: QXBpSHViSW5zdGFuY2U= -parameters: - - name: location - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - required: true - - name: apiHubInstanceId - type: String - description: |- - Optional. Identifier to assign to the Api Hub instance. Must be unique within - scope of the parent resource. If the field is not provided, - system generated id will be used. - - This value should be 4-40 characters, and valid characters - are `/a-z[0-9]-_/`. - immutable: true - url_param_only: true -properties: - - name: description - type: String - description: Optional. Description of the ApiHub instance. - - name: name - type: String - description: |- - Identifier. Format: - `projects/{project}/locations/{location}/apiHubInstances/{apiHubInstance}`. - output: true - - name: createTime - type: String - description: Output only. Creation timestamp. - output: true - - name: updateTime - type: String - description: Output only. Last update timestamp. - output: true - - name: state - type: String - description: |- - Output only. The current state of the ApiHub instance. - Possible values: - STATE_UNSPECIFIED - INACTIVE - CREATING - ACTIVE - UPDATING - DELETING - FAILED - output: true - - name: stateMessage - type: String - description: |- - Output only. Extra information about ApiHub instance state. Currently the message - would be populated when state is `FAILED`. - output: true - - name: config - type: NestedObject - description: Available configurations to provision an ApiHub Instance. - required: true - properties: - - name: encryptionType - type: String - default_from_api: true - description: |- - Optional. Encryption type for the region. If the encryption type is CMEK, the - cmek_key_name must be provided. If no encryption type is provided, - GMEK will be used. - Possible values: - ENCRYPTION_TYPE_UNSPECIFIED - GMEK - CMEK - - name: cmekKeyName - type: String - description: |- - Optional. The Customer Managed Encryption Key (CMEK) used for data encryption. - The CMEK name should follow the format of - `projects/([^/]+)/locations/([^/]+)/keyRings/([^/]+)/cryptoKeys/([^/]+)`, - where the location must match the instance location. - If the CMEK is not provided, a GMEK will be created for the instance. - - name: disableSearch - type: Boolean - description: |- - Optional. If true, the search will be disabled for the instance. The default value - is false. - - name: vertexLocation - type: String - description: Optional. The name of the Vertex AI location where the data store is stored. - - name: labels - type: KeyValueLabels - description: |- - Optional. Instance labels to represent user-provided metadata. - Refer to cloud documentation on labels for more details. - https://cloud.google.com/compute/docs/labeling-resources diff --git a/mmv1/products/appengine/StandardAppVersion.yaml b/mmv1/products/appengine/StandardAppVersion.yaml index 48db020a4696..e6d35a64b845 100644 --- a/mmv1/products/appengine/StandardAppVersion.yaml +++ b/mmv1/products/appengine/StandardAppVersion.yaml @@ -407,9 +407,6 @@ properties: type: Integer description: | Maximum number of instances to run for this version. Set to zero to disable maxInstances configuration. - - **Note:** Starting from February 17, 2025, App Engine sets the maxInstances default for standard environment deployments to 20. This change doesn't impact existing apps. To override the default, specify a new value between 0 and 2147483647, and deploy a new version or redeploy over an existing version. To disable the maxInstances default configuration setting, specify the maximum permitted value 2147483647. - default_from_api: true - name: 'basicScaling' type: NestedObject description: | diff --git a/mmv1/products/apphub/Application.yaml b/mmv1/products/apphub/Application.yaml index 34f66b9ba088..cde922521370 100644 --- a/mmv1/products/apphub/Application.yaml +++ b/mmv1/products/apphub/Application.yaml @@ -29,7 +29,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 autogen_async: true -autogen_status: QXBwbGljYXRpb24= async: actions: ['create', 'delete', 'update'] type: 'OpAsync' @@ -41,11 +40,6 @@ custom_code: constants: 'templates/terraform/constants/apphub_application.go.tmpl' custom_diff: - 'apphubApplicationCustomizeDiff' -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us-east1" - - region: "global" examples: - name: 'apphub_application_basic' primary_resource_id: 'example' diff --git a/mmv1/products/apphub/Service.yaml b/mmv1/products/apphub/Service.yaml index c882fadf43ac..a7c59b3e9a36 100644 --- a/mmv1/products/apphub/Service.yaml +++ b/mmv1/products/apphub/Service.yaml @@ -29,7 +29,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 autogen_async: true -autogen_status: U2VydmljZQ== async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/apphub/ServiceProjectAttachment.yaml b/mmv1/products/apphub/ServiceProjectAttachment.yaml index 923012f8caeb..c7ddfb3bbe08 100644 --- a/mmv1/products/apphub/ServiceProjectAttachment.yaml +++ b/mmv1/products/apphub/ServiceProjectAttachment.yaml @@ -28,7 +28,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 autogen_async: true -autogen_status: U2VydmljZVByb2plY3RBdHRhY2htZW50 async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/apphub/Workload.yaml b/mmv1/products/apphub/Workload.yaml index bf4746d3db62..cdf4a131a8ad 100644 --- a/mmv1/products/apphub/Workload.yaml +++ b/mmv1/products/apphub/Workload.yaml @@ -29,7 +29,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 autogen_async: true -autogen_status: V29ya2xvYWQK async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/artifactregistry/Repository.yaml b/mmv1/products/artifactregistry/Repository.yaml index ccba02e34cb4..11584011fcf0 100644 --- a/mmv1/products/artifactregistry/Repository.yaml +++ b/mmv1/products/artifactregistry/Repository.yaml @@ -54,10 +54,6 @@ custom_code: constants: 'templates/terraform/constants/artifact_registry_repository.go.tmpl' encoder: 'templates/terraform/encoders/location_from_region.go.tmpl' pre_create: 'templates/terraform/pre_create/artifact_registry_remote_repository.go.tmpl' -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us" examples: - name: 'artifact_registry_repository_basic' primary_resource_id: 'my-repo' @@ -304,7 +300,6 @@ properties: Provides additional configuration details for repositories of the maven format type. allow_empty_object: true - diff_suppress_func: 'emptyMavenConfigDiffSuppress' properties: # Maven properties. - name: 'allowSnapshotOverwrites' @@ -373,7 +368,6 @@ properties: key_name: 'id' key_description: |- The policy ID. Must be unique within a repository. - set_hash_func: 'mapHashID' value_type: name: cleanupPolicies type: NestedObject @@ -422,14 +416,12 @@ properties: type: String description: |- Match versions older than a duration. - custom_expand: 'templates/terraform/custom_expand/duration_to_seconds.go.tmpl' - diff_suppress_func: 'durationDiffSuppress' + diff_suppress_func: 'tpgresource.DurationDiffSuppress' - name: 'newerThan' type: String description: |- Match versions newer than a duration. - custom_expand: 'templates/terraform/custom_expand/duration_to_seconds.go.tmpl' - diff_suppress_func: 'durationDiffSuppress' + diff_suppress_func: 'tpgresource.DurationDiffSuppress' - name: 'mostRecentVersions' type: NestedObject description: |- diff --git a/mmv1/products/backupdr/BackupVault.yaml b/mmv1/products/backupdr/BackupVault.yaml index 52f933b7f99a..f370888f3eef 100644 --- a/mmv1/products/backupdr/BackupVault.yaml +++ b/mmv1/products/backupdr/BackupVault.yaml @@ -38,6 +38,7 @@ async: result: resource_inside_response: true custom_code: + !ruby/object:Provider::Terraform::CustomCode pre_delete: 'templates/terraform/pre_delete/backup_dr_backup_vault.go.tmpl' examples: - name: 'backup_dr_backup_vault_full' diff --git a/mmv1/products/beyondcorp/Application.yaml b/mmv1/products/beyondcorp/Application.yaml deleted file mode 100644 index 0a28975dd61e..000000000000 --- a/mmv1/products/beyondcorp/Application.yaml +++ /dev/null @@ -1,119 +0,0 @@ -# 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. - ---- -name: Application -description: Specifies application endpoint(s) to protect behind a Security Gateway. -base_url: projects/{{project}}/locations/global/securityGateways/{{security_gateways_id}}/applications -update_mask: true -self_link: projects/{{project}}/locations/global/securityGateways/{{security_gateways_id}}/applications/{{application_id}} -create_url: projects/{{project}}/locations/global/securityGateways/{{security_gateways_id}}/applications?applicationId={{application_id}} -update_verb: PATCH -id_format: projects/{{project}}/locations/global/securityGateways/{{security_gateways_id}}/applications/{{application_id}} -import_format: - - projects/{{project}}/locations/global/securityGateways/{{security_gateways_id}}/applications/{{application_id}} -iam_policy: - method_name_separator: ':' - iam_conditions_request_type: 'QUERY_PARAM_NESTED' - allowed_iam_role: 'roles/beyondcorp.securityGatewayUser' - parent_resource_attribute: 'application_id' - import_format: - - 'projects/{{project}}/locations/global/securityGateways/{{security_gateways_id}}/applications/{{application_id}}' - - '{{application_id}}' -examples: - - name: beyondcorp_security_gateway_application_basic - primary_resource_id: example - primary_resource_name: 'fmt.Sprintf("default%s", context["random_suffix"]), fmt.Sprintf("google%s", context["random_suffix"])' - vars: - security_gateway_name: default - application_name: google -autogen_async: true -async: - operation: - timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 - base_url: '{{op_id}}' - actions: - - create - - delete - - update - type: OpAsync - result: - resource_inside_response: true - include_project: false -autogen_status: QXBwbGljYXRpb24= -parameters: - - name: securityGatewaysId - type: String - description: Part of `parent`. See documentation of `projectsId`. - immutable: true - url_param_only: true - required: true - - name: applicationId - type: String - description: |- - Optional. User-settable Application resource ID. - * Must start with a letter. - * Must contain between 4-63 characters from `/a-z-/`. - * Must end with a number or letter. - immutable: true - url_param_only: true - required: true -properties: - - name: createTime - type: String - description: Output only. Timestamp when the resource was created. - output: true - - name: displayName - type: String - description: |- - Optional. An arbitrary user-provided name for the Application resource. - Cannot exceed 64 characters. - - name: endpointMatchers - type: Array - description: |- - Required. Endpoint matchers associated with an application. - A combination of hostname and ports as endpoint matcher is used to match - the application. - Match conditions for OR logic. - An array of match conditions to allow for multiple matching criteria. - The rule is considered a match if one the conditions are met. - The conditions can be one of the following combination - (Hostname), (Hostname & Ports) - - EXAMPLES: - Hostname - ("*.abc.com"), ("xyz.abc.com") - Hostname and Ports - ("abc.com" and "22"), ("abc.com" and "22,33") etc - required: true - item_type: - type: NestedObject - properties: - - name: hostname - type: String - description: Required. Hostname of the application. - required: true - - name: ports - type: Array - description: Optional. Ports of the application. - item_type: - type: Integer - - name: name - type: String - description: Identifier. Name of the resource. - output: true - - name: updateTime - type: String - description: Output only. Timestamp when the resource was last modified. - output: true diff --git a/mmv1/products/beyondcorp/SecurityGateway.yaml b/mmv1/products/beyondcorp/SecurityGateway.yaml index 487b4608bf32..f715a562ed85 100644 --- a/mmv1/products/beyondcorp/SecurityGateway.yaml +++ b/mmv1/products/beyondcorp/SecurityGateway.yaml @@ -22,19 +22,9 @@ update_verb: PATCH id_format: projects/{{project}}/locations/{{location}}/securityGateways/{{security_gateway_id}} import_format: - projects/{{project}}/locations/{{location}}/securityGateways/{{security_gateway_id}} -iam_policy: - method_name_separator: ':' - iam_conditions_request_type: 'QUERY_PARAM_NESTED' - allowed_iam_role: 'roles/beyondcorp.securityGatewayUser' - parent_resource_attribute: 'security_gateway_id' - import_format: - - 'projects/{{project}}/locations/{{location}}/securityGateways/{{security_gateway_id}}' - - '{{security_gateway_id}}' examples: - name: beyondcorp_security_gateway_basic primary_resource_id: example - primary_resource_name: 'fmt.Sprintf("default%s", context["random_suffix"])' - region_override: 'global' vars: security_gateway_name: default autogen_async: true @@ -52,19 +42,16 @@ async: type: OpAsync result: resource_inside_response: true + error: {} include_project: false autogen_status: U2VjdXJpdHlHYXRld2F5 parameters: - name: location type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. Must be omitted or set to `global`. - deprecation_message: '`location` is deprecated and will be removed in a future major release.' + description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. immutable: true url_param_only: true - default_value: 'global' - validation: - regex: '^global$' - required: false + required: true - name: securityGatewayId type: String description: |- diff --git a/mmv1/products/biglake/Catalog.yaml b/mmv1/products/biglake/Catalog.yaml index 4ed53a7ee5af..4d14cc3cd65d 100644 --- a/mmv1/products/biglake/Catalog.yaml +++ b/mmv1/products/biglake/Catalog.yaml @@ -29,9 +29,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 custom_code: -sweeper: - url_substitutions: - - region: "US" examples: - name: 'bigquery_biglake_catalog' primary_resource_id: 'default' diff --git a/mmv1/products/bigquery/Dataset.yaml b/mmv1/products/bigquery/Dataset.yaml index 566e73026674..29b9af98caa9 100644 --- a/mmv1/products/bigquery/Dataset.yaml +++ b/mmv1/products/bigquery/Dataset.yaml @@ -428,7 +428,7 @@ properties: The tags attached to this table. Tag keys are globally unique. Tag key is expected to be in the namespaced format, for example "123456789012/environment" where 123456789012 is the ID of the parent organization or project resource for this tag key. Tag value is expected - to be the short name, for example "Production". See [Tag definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) + to be the short name, for example "Production". See [Tag definitions](/iam/docs/tags-access-control#definitions) for more details. - name: 'externalCatalogDatasetOptions' type: NestedObject diff --git a/mmv1/products/bigquery/Table.yaml b/mmv1/products/bigquery/Table.yaml index 79a514fcef87..b1dc8ab5a89a 100644 --- a/mmv1/products/bigquery/Table.yaml +++ b/mmv1/products/bigquery/Table.yaml @@ -270,28 +270,6 @@ properties: - 'TIME' - 'DATETIME' - 'RECORD' - - 'FOREIGN' - - name: 'foreignTypeDefinition' - type: String - description: | - Definition of the foreign data type. - Only valid for top-level schema fields (not nested fields). - If the type is FOREIGN, this field is required. - min_version: beta - - name: 'schemaForeignTypeInfo' - type: NestedObject - description: | - Specifies metadata of the foreign data type definition in field schema. - min_version: beta - properties: - - name: 'typeSystem' - type: Enum - description: | - The foreign type of the table. - required: true - enum_values: - - 'HIVE' - min_version: beta - name: 'encryptionConfiguration' type: NestedObject description: Custom encryption configuration @@ -571,8 +549,7 @@ properties: The tags attached to this table. Tag keys are globally unique. Tag key is expected to be in the namespaced format, for example "123456789012/environment" where 123456789012 is the ID of the parent organization or project resource for this tag key. Tag value is expected - to be the short name, for example "Production". See [Tag definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) - for more details. + to be the short name, for example "Production". - name: externalCatalogTableOptions type: NestedObject description: | diff --git a/mmv1/products/bigqueryanalyticshub/DataExchange.yaml b/mmv1/products/bigqueryanalyticshub/DataExchange.yaml index 03915fb20529..4677a3699c5f 100644 --- a/mmv1/products/bigqueryanalyticshub/DataExchange.yaml +++ b/mmv1/products/bigqueryanalyticshub/DataExchange.yaml @@ -41,9 +41,6 @@ iam_policy: - 'projects/{{project}}/locations/{{location}}/dataExchanges/{{data_exchange_id}}' - '{{data_exchange_id}}' custom_code: -sweeper: - url_substitutions: - - region: "US" examples: - name: 'bigquery_analyticshub_data_exchange_basic' primary_resource_id: 'data_exchange' diff --git a/mmv1/products/bigqueryanalyticshub/ListingSubscription.yaml b/mmv1/products/bigqueryanalyticshub/ListingSubscription.yaml deleted file mode 100644 index 57341914e783..000000000000 --- a/mmv1/products/bigqueryanalyticshub/ListingSubscription.yaml +++ /dev/null @@ -1,190 +0,0 @@ -# Copyright 2025 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. - ---- -name: 'ListingSubscription' -api_resource_type_kind: Subscription -description: A Bigquery Analytics Hub listing subscription -references: - guides: - 'Official Documentation': 'https://cloud.google.com/bigquery/docs/analytics-hub-introduction' - api: 'https://cloud.google.com/bigquery/docs/reference/analytics-hub/rest/v1/projects.locations.subscriptions' -base_url: 'projects/{{project}}/locations/{{location}}/subscriptions' -self_link: 'projects/{{project}}/locations/{{location}}/subscriptions/{{subscription_id}}' -create_url: 'projects/{{project}}/locations/{{location}}/dataExchanges/{{data_exchange_id}}/listings/{{listing_id}}:subscribe' -immutable: true -import_format: - - 'projects/{{project}}/locations/{{location}}/subscriptions/{{subscription_id}}' -custom_code: - post_create: templates/terraform/post_create/analytics_hub_subscription.go.tmpl - post_import: templates/terraform/post_import/analytics_hub_subscription.go.tmpl -sweeper: - url_substitutions: - - region: "US" -examples: - - name: 'bigquery_analyticshub_listing_subscription_basic' - primary_resource_id: 'subscription' - primary_resource_name: 'fmt.Sprintf(\"tf_test_my_data_exchange%s\", - context[\"\ - random_suffix\"]), fmt.Sprintf(\"tf_test_my_listing%s\", - context[\"random_suffix\"\ - ])' - region_override: 'US' - vars: - data_exchange_id: 'my_data_exchange' - listing_id: 'my_listing' - destination_dataset_id: 'destination_dataset' - description: 'example data exchange' -parameters: - - name: 'dataExchangeId' - type: String - description: |- - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces. - url_param_only: true - required: true - - name: 'listingId' - type: String - description: |- - The ID of the listing. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces. - url_param_only: true - required: true - - name: 'location' - type: String - description: | - The name of the location for this subscription. - url_param_only: true - required: true - custom_flatten: 'templates/terraform/custom_flatten/bigquery_dataset_location.go.tmpl' - diff_suppress_func: 'tpgresource.CaseDiffSuppress' -properties: - - name: 'destinationDataset' - type: NestedObject - required: true - ignore_read: true - description: - The destination dataset for this subscription. - properties: - - name: 'location' - type: String - description: | - The geographic location where the dataset should reside. - See https://cloud.google.com/bigquery/docs/locations for supported locations. - required: true - custom_flatten: 'templates/terraform/custom_flatten/bigquery_dataset_location.go.tmpl' - diff_suppress_func: 'tpgresource.CaseDiffSuppress' - - name: 'datasetReference' - type: NestedObject - required: true - description: A reference that identifies the destination dataset. - properties: - - name: 'datasetId' - type: String - description: A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters. - required: true - - name: 'projectId' - type: String - description: The ID of the project containing this dataset. - required: true - - name: 'friendlyName' - type: String - description: A descriptive name for the dataset. - - name: 'description' - type: String - description: A user-friendly description of the dataset. - - name: 'labels' - type: KeyValuePairs - description: | - The labels associated with this dataset. You can use these to - organize and group your datasets. - - name: 'name' - type: String - description: |- - The resource name of the subscription. e.g. "projects/myproject/locations/US/subscriptions/123" - output: true - - name: 'subscriptionId' - type: String - description: |- - The subscription id used to reference the subscription. - output: true - ignore_read: true - - name: 'creationTime' - type: Time - description: |- - Timestamp when the subscription was created. - output: true - - name: 'lastModifyTime' - type: Time - description: |- - Timestamp when the subscription was last modified. - output: true - - name: 'organizationId' - type: String - description: |- - Organization of the project this subscription belongs to. - output: true - - name: 'organizationDisplayName' - type: String - description: |- - Display name of the project of this subscription. - output: true - - name: 'state' - type: String - description: |- - Current state of the subscription. - output: true - - name: 'subscriberContact' - type: String - description: |- - Email of the subscriber. - output: true - - name: 'resourceType' - type: String - description: |- - Listing shared asset type. - output: true - - name: 'linkedDatasetMap' - output: true - type: Map - description: |- - Output only. Map of listing resource names to associated linked resource, - e.g. projects/123/locations/US/dataExchanges/456/listings/789 -> projects/123/datasets/my_dataset - key_name: resource_name - key_description: The associated linked resource - value_type: - name: linked_resource - type: NestedObject - properties: - - name: listing - type: string - description: Output only. Listing for which linked resource is created. - output: true - - name: linkedDataset - type: string - description: Output only. Name of the linked dataset, e.g. projects/subscriberproject/datasets/linkedDataset - output: true - - name: linkedResources - type: Array - description: | - Output only. Linked resources created in the subscription. Only contains values if state = STATE_ACTIVE. - output: true - item_type: - type: NestedObject - properties: - - name: listing - type: string - description: Output only. Listing for which linked resource is created. - output: true - - name: linkedDataset - type: string - description: Output only. Name of the linked dataset, e.g. projects/subscriberproject/datasets/linkedDataset - output: true diff --git a/mmv1/products/bigqueryanalyticshub/product.yaml b/mmv1/products/bigqueryanalyticshub/product.yaml index ea3b85f44a2e..ebbb6b142a4d 100644 --- a/mmv1/products/bigqueryanalyticshub/product.yaml +++ b/mmv1/products/bigqueryanalyticshub/product.yaml @@ -13,7 +13,7 @@ --- name: 'BigqueryAnalyticsHub' -display_name: 'BigQuery Analytics Hub' +display_name: 'Bigquery Analytics Hub' versions: - name: 'beta' base_url: 'https://analyticshub.googleapis.com/v1/' diff --git a/mmv1/products/bigqueryconnection/Connection.yaml b/mmv1/products/bigqueryconnection/Connection.yaml index c3c36324c5d6..f212a1359483 100644 --- a/mmv1/products/bigqueryconnection/Connection.yaml +++ b/mmv1/products/bigqueryconnection/Connection.yaml @@ -45,12 +45,6 @@ iam_policy: custom_code: encoder: 'templates/terraform/encoders/bigquery_connection.go.tmpl' post_create: 'templates/terraform/post_create/bigquery_connection_id.go.tmpl' -sweeper: - url_substitutions: - - region: "US" - - region: "EU" - - region: "azure-eastus2" - - region: "aws-us-east-1" examples: - name: 'bigquery_connection_cloud_resource' primary_resource_id: 'connection' @@ -70,10 +64,10 @@ examples: oics_vars_overrides: 'deletion_protection': 'false' ignore_read_extra: - # password removed + # password removed - 'cloud_sql.0.credential' external_providers: ["random", "time"] - # Random provider + # Random provider skip_vcr: true - name: 'bigquery_connection_full' primary_resource_id: 'connection' @@ -87,10 +81,10 @@ examples: oics_vars_overrides: 'deletion_protection': 'false' ignore_read_extra: - # password removed + # password removed - 'cloud_sql.0.credential' external_providers: ["random", "time"] - # Random provider + # Random provider skip_vcr: true - name: 'bigquery_connection_aws' primary_resource_id: 'connection' @@ -125,9 +119,6 @@ examples: connection_id: 'my-connection' - name: 'bigquery_connection_sql_with_cmek' primary_resource_id: 'bq-connection-cmek' - bootstrap_iam: - - member: "serviceAccount:bq-{project_number}@bigquery-encryption.iam.gserviceaccount.com" - role: "roles/cloudkms.cryptoKeyEncrypterDecrypter" vars: database_instance_name: 'my-database-instance' username: 'user' @@ -139,7 +130,7 @@ examples: oics_vars_overrides: 'deletion_protection': 'false' ignore_read_extra: - # password removed + # password removed - 'cloud_sql.0.credential' parameters: properties: diff --git a/mmv1/products/bigqueryreservation/CapacityCommitment.yaml b/mmv1/products/bigqueryreservation/CapacityCommitment.yaml index 71fa2d5ec70b..805bb9cb87e7 100644 --- a/mmv1/products/bigqueryreservation/CapacityCommitment.yaml +++ b/mmv1/products/bigqueryreservation/CapacityCommitment.yaml @@ -37,9 +37,6 @@ timeouts: custom_code: constants: 'templates/terraform/constants/bigquery_reservation_capacity_commitment.go.tmpl' custom_import: 'templates/terraform/custom_import/bigquery_reservation_capacity_commitment_set_id.go.tmpl' -sweeper: - url_substitutions: - - region: "us-west2" examples: - name: 'bigquery_reservation_capacity_commitment_basic' primary_resource_id: 'commitment' @@ -112,7 +109,6 @@ properties: type: String description: | The plan this capacity commitment is converted to after commitmentEndTime passes. Once the plan is changed, committed period is extended according to commitment plan. Only applicable for some commitment plans. - diff_suppress_func: 'bigqueryReservationCapacityCommitmentPlanDiffSuppressFunc' - name: 'edition' type: String description: | diff --git a/mmv1/products/blockchainnodeengine/product.yaml b/mmv1/products/blockchainnodeengine/product.yaml index 2acfdf55233f..da48df9a20cd 100644 --- a/mmv1/products/blockchainnodeengine/product.yaml +++ b/mmv1/products/blockchainnodeengine/product.yaml @@ -13,7 +13,7 @@ --- name: 'BlockchainNodeEngine' -display_name: 'Blockchain Node Engine' +display_name: 'Blockchain node engine' versions: - name: 'ga' base_url: 'https://blockchainnodeengine.googleapis.com/v1/' diff --git a/mmv1/products/certificatemanager/Certificate.yaml b/mmv1/products/certificatemanager/Certificate.yaml index 72e36dfec19f..cbd76d526496 100644 --- a/mmv1/products/certificatemanager/Certificate.yaml +++ b/mmv1/products/certificatemanager/Certificate.yaml @@ -40,13 +40,6 @@ custom_code: constants: 'templates/terraform/constants/cert_manager.tmpl' schema_version: 1 state_upgraders: true -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us-east1" - - region: "us-west2" - - region: "us-west1" - - region: "us-south1" examples: - name: 'certificate_manager_google_managed_certificate_dns' primary_resource_id: 'default' diff --git a/mmv1/products/certificatemanager/DnsAuthorization.yaml b/mmv1/products/certificatemanager/DnsAuthorization.yaml index fcf4cff5169a..36b53b8ac0ec 100644 --- a/mmv1/products/certificatemanager/DnsAuthorization.yaml +++ b/mmv1/products/certificatemanager/DnsAuthorization.yaml @@ -38,10 +38,6 @@ async: custom_code: schema_version: 1 state_upgraders: true -sweeper: - url_substitutions: - - region: "us-central1" - - region: "global" examples: - name: 'certificate_manager_dns_authorization_basic' primary_resource_id: 'default' diff --git a/mmv1/products/certificatemanager/TrustConfig.yaml b/mmv1/products/certificatemanager/TrustConfig.yaml index 35168a1d8fc9..7cff05cba687 100644 --- a/mmv1/products/certificatemanager/TrustConfig.yaml +++ b/mmv1/products/certificatemanager/TrustConfig.yaml @@ -40,10 +40,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "global" - - region: "us-central1" examples: - name: 'certificate_manager_trust_config' primary_resource_id: 'default' diff --git a/mmv1/products/certificatemanager/product.yaml b/mmv1/products/certificatemanager/product.yaml index 0c27db179fb9..2c0d7838a7bd 100644 --- a/mmv1/products/certificatemanager/product.yaml +++ b/mmv1/products/certificatemanager/product.yaml @@ -13,7 +13,7 @@ --- name: 'CertificateManager' -display_name: 'Certificate Manager' +display_name: 'Certificate manager' versions: - name: 'beta' base_url: 'https://certificatemanager.googleapis.com/v1/' diff --git a/mmv1/products/chronicle/DataAccessLabel.yaml b/mmv1/products/chronicle/DataAccessLabel.yaml index 3e8ea103e716..36428850ff45 100644 --- a/mmv1/products/chronicle/DataAccessLabel.yaml +++ b/mmv1/products/chronicle/DataAccessLabel.yaml @@ -27,7 +27,6 @@ import_format: - projects/{{project}}/locations/{{location}}/instances/{{instance}}/dataAccessLabels/{{data_access_label_id}} update_verb: PATCH update_mask: true -autogen_status: RGF0YUFjY2Vzc0xhYmVs examples: - name: 'chronicle_dataaccesslabel_basic' @@ -56,9 +55,9 @@ parameters: type: String description: |- Required. The ID to use for the data access label, which will become the label's - display name and the final component of the label's resource name. The - maximum number of characters should be 63. Regex pattern is as per AIP: - https://google.aip.dev/122#resource-id-segments + display name and the final component of the label's resource name. It must + only contain ASCII lowercase letters, numbers, and dashes; it must begin + with a letter, and it must not exceed 1000 characters. immutable: true url_param_only: true required: true diff --git a/mmv1/products/chronicle/DataAccessScope.yaml b/mmv1/products/chronicle/DataAccessScope.yaml index cfe6dfe6603c..d20c7b5472c0 100644 --- a/mmv1/products/chronicle/DataAccessScope.yaml +++ b/mmv1/products/chronicle/DataAccessScope.yaml @@ -27,7 +27,6 @@ import_format: - projects/{{project}}/locations/{{location}}/instances/{{instance}}/dataAccessScopes/{{data_access_scope_id}} update_verb: PATCH update_mask: true -autogen_status: RGF0YUFjY2Vzc1Njb3Bl examples: - name: 'chronicle_dataaccessscope_with_logtype' diff --git a/mmv1/products/chronicle/ReferenceList.yaml b/mmv1/products/chronicle/ReferenceList.yaml deleted file mode 100644 index aa2b312f8b09..000000000000 --- a/mmv1/products/chronicle/ReferenceList.yaml +++ /dev/null @@ -1,142 +0,0 @@ -# Copyright 2025 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. - ---- -name: ReferenceList -description: Reference lists are user-defined lists of values which users can use in multiple Rules. -min_version: 'beta' -references: - guides: - 'Google SecOps Guides': 'https://cloud.google.com/chronicle/docs/secops/secops-overview' - api: 'https://cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances.referenceLists' -base_url: projects/{{project}}/locations/{{location}}/instances/{{instance}}/referenceLists -self_link: projects/{{project}}/locations/{{location}}/instances/{{instance}}/referenceLists/{{reference_list_id}} -create_url: projects/{{project}}/locations/{{location}}/instances/{{instance}}/referenceLists?referenceListId={{reference_list_id}} -id_format: projects/{{project}}/locations/{{location}}/instances/{{instance}}/referenceLists/{{reference_list_id}} -import_format: - - projects/{{project}}/locations/{{location}}/instances/{{instance}}/referenceLists/{{reference_list_id}} -update_verb: PATCH -update_mask: true -exclude_delete: true -autogen_status: UmVmZXJlbmNlTGlzdA== - -examples: - - name: 'chronicle_referencelist_basic' - primary_resource_id: 'example' - min_version: 'beta' - vars: - reference_list_id: reference_list_id - test_env_vars: - chronicle_id: 'CHRONICLE_ID' - -parameters: - - name: location - type: String - description: The location of the resource. This is the geographical region where the Chronicle instance resides, such as "us" or "europe-west2". - immutable: true - url_param_only: true - required: true - - name: instance - type: String - description: The unique identifier for the Chronicle instance, which is the same as the customer ID. - immutable: true - url_param_only: true - required: true - - name: referenceListId - type: String - description: |- - Required. The ID to use for the reference list. This is also the display name for - the reference list. It must satisfy the following requirements: - - Starts with letter. - - Contains only letters, numbers and underscore. - - Has length < 256. - - Must be unique. - immutable: true - url_param_only: true - required: true -properties: - - name: name - type: String - description: |- - Output only. The resource name of the reference list. - Format: - projects/{project}/locations/{location}/instances/{instance}/referenceLists/{reference_list} - output: true - - name: description - type: String - description: Required. A user-provided description of the reference list. - required: true - - name: entries - type: Array - description: |- - Required. The entries of the reference list. - When listed, they are returned in the order that was specified at creation - or update. The combined size of the values of the reference list may not - exceed 6MB. - This is returned only when the view is REFERENCE_LIST_VIEW_FULL. - required: true - item_type: - type: NestedObject - properties: - - name: value - type: String - description: Required. The value of the entry. Maximum length is 512 characters. - required: true - - name: scopeInfo - type: NestedObject - output: true - description: ScopeInfo specifies the scope info of the reference list. - properties: - - name: referenceListScope - type: NestedObject - description: ReferenceListScope specifies the list of scope names of the reference list. - required: true - properties: - - name: scopeNames - type: Array - description: |- - Optional. The list of scope names of the reference list. The scope names should be - full resource names and should be of the format: - "projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}". - item_type: - type: String - - name: displayName - type: String - description: Output only. The unique display name of the reference list. - output: true - - name: revisionCreateTime - type: String - description: Output only. The timestamp when the reference list was last updated. - output: true - - name: rules - type: Array - description: |- - Output only. The resource names for the associated self-authored Rules that use this - reference list. - This is returned only when the view is REFERENCE_LIST_VIEW_FULL. - output: true - item_type: - type: String - - name: syntaxType - type: String - description: |2- - - Possible values: - REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING - REFERENCE_LIST_SYNTAX_TYPE_REGEX - REFERENCE_LIST_SYNTAX_TYPE_CIDR - required: true - - name: ruleAssociationsCount - type: Integer - description: Output only. The count of self-authored rules using the reference list. - output: true diff --git a/mmv1/products/chronicle/Retrohunt.yaml b/mmv1/products/chronicle/Retrohunt.yaml deleted file mode 100644 index 43081f6ec7c7..000000000000 --- a/mmv1/products/chronicle/Retrohunt.yaml +++ /dev/null @@ -1,151 +0,0 @@ -# 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. - ---- -name: Retrohunt -description: Retrohunt is an execution of a Rule over a time range in the past. -min_version: 'beta' -references: - guides: - 'Google SecOps Guides': 'https://cloud.google.com/chronicle/docs/secops/secops-overview' - api: 'https://cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances.rules.retrohunts' -base_url: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/retrohunts -immutable: true -self_link: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/retrohunts/{{retrohunt}} -create_url: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/retrohunts -id_format: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/retrohunts/{{retrohunt}} -import_format: - - projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/retrohunts/{{retrohunt}} -exclude_delete: true -autogen_status: UmV0cm9odW50 - -custom_code: - decoder: 'templates/terraform/decoders/chronicle_retrohunt.go.tmpl' - post_create: 'templates/terraform/post_create/chronicle_retrohunt_id.go.tmpl' -examples: - - name: 'chronicle_retrohunt_basic' - primary_resource_id: example - min_version: 'beta' - exclude_import_test: true - skip_vcr: true - vars: - start_time: '2025-01-01T00:00:00Z' - end_time: '2025-01-01T12:00:00Z' - test_env_vars: - chronicle_id: 'CHRONICLE_ID' - test_vars_overrides: - start_time: 'time.Now().Add(time.Hour * (-12)).Format(time.RFC3339)' - end_time: 'time.Now().Add(time.Hour * (-1)).Format(time.RFC3339)' - -async: - actions: [create] - type: OpAsync - operation: - full_url: 'https://{{location}}-chronicle.googleapis.com/v1beta/{{op_id}}' - timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 - result: - resource_inside_response: true -exclude_sweeper: true -parameters: - - name: location - type: String - description: The location of the resource. This is the geographical region where the Chronicle instance resides, such as "us" or "europe-west2". - url_param_only: true - required: true - - name: instance - type: String - description: The unique identifier for the Chronicle instance, which is the same as the customer ID. - url_param_only: true - required: true - - name: rule - type: String - description: The Rule ID of the rule. - url_param_only: true - required: true - - name: retrohunt - type: String - description: The retrohunt ID of the Retrohunt. A retrohunt is an execution of a Rule over a time range in the past. - default_from_api: true -properties: - - name: progressPercentage - type: Double - description: Output only. Percent progress of the retrohunt towards completion, from 0.00 to 100.00. - output: true - - name: name - type: String - description: |- - The resource name of the retrohunt. - Retrohunt is the child of a rule revision. {rule} in the format below is - structured as {rule_id@revision_id}. - Format: - projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt} - output: true - - name: processInterval - type: NestedObject - description: |- - Represents a time interval, encoded as a Timestamp start (inclusive) and a - Timestamp end (exclusive). - - The start must be less than or equal to the end. - When the start equals the end, the interval is empty (matches no time). - When both start and end are unspecified, the interval matches any time. - required: true - properties: - - name: startTime - type: String - required: true - description: |- - Inclusive start of the interval. - - name: endTime - type: String - required: true - description: |- - Exclusive end of the interval. - - name: executionInterval - type: NestedObject - description: |- - Represents a time interval, encoded as a Timestamp start (inclusive) and a - Timestamp end (exclusive). - - The start must be less than or equal to the end. - When the start equals the end, the interval is empty (matches no time). - When both start and end are unspecified, the interval matches any time. - output: true - properties: - - name: endTime - type: String - description: |- - Optional. Exclusive end of the interval. - - If specified, a Timestamp matching this interval will have to be before the - end. - - name: startTime - type: String - description: |- - Optional. Inclusive start of the interval. - - If specified, a Timestamp matching this interval will have to be the same - or after the start. - - name: state - type: String - description: |- - Output only. The state of the retrohunt. - Possible values: - RUNNING - DONE - CANCELLED - FAILED - output: true diff --git a/mmv1/products/chronicle/Rule.yaml b/mmv1/products/chronicle/Rule.yaml deleted file mode 100644 index d5817692b65c..000000000000 --- a/mmv1/products/chronicle/Rule.yaml +++ /dev/null @@ -1,273 +0,0 @@ -# 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. - ---- -name: Rule -description: The Rule resource represents a user-created rule. -min_version: beta -references: - guides: - 'Google SecOps Guides': 'https://cloud.google.com/chronicle/docs/secops/secops-overview' - api: 'https://cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances.rules' -base_url: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules -self_link: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule_id}} -create_url: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules -id_format: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule_id}} -import_format: - - projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule_id}} -update_verb: PATCH -update_mask: true -autogen_status: UnVsZQ== - -examples: - - name: 'chronicle_rule_basic' - primary_resource_id: example - min_version: 'beta' - test_env_vars: - chronicle_id: 'CHRONICLE_ID' - ignore_read_extra: - - 'deletion_policy' - exclude_import_test: true - - name: 'chronicle_rule_with_force_deletion' - primary_resource_id: example - min_version: 'beta' - test_env_vars: - chronicle_id: 'CHRONICLE_ID' - ignore_read_extra: - - 'deletion_policy' - exclude_import_test: true - - name: 'chronicle_rule_with_data_access_scope' - primary_resource_id: example - min_version: 'beta' - vars: - data_access_scope_id: scope-name - test_env_vars: - chronicle_id: 'CHRONICLE_ID' - exclude_import_test: true - -custom_code: - pre_delete: 'templates/terraform/pre_delete/chronicle_rule.go.tmpl' - post_create: 'templates/terraform/post_create/chronicle_rule_id.go.tmpl' - -virtual_fields: - - name: 'deletion_policy' - description: | - Policy to determine if the rule should be deleted forcefully. - If deletion_policy = "FORCE", any retrohunts and any detections associated with the rule - will also be deleted. If deletion_policy = "DEFAULT", the call will only succeed if the - rule has no associated retrohunts, including completed retrohunts, and no - associated detections. Regardless of this field's value, the rule - deployment associated with this rule will also be deleted. - Possible values: DEFAULT, FORCE - type: String - default_value: "DEFAULT" - -parameters: - - name: location - type: String - description: The location of the resource. This is the geographical region where the Chronicle instance resides, such as "us" or "europe-west2". - immutable: true - url_param_only: true - required: true - - name: instance - type: String - description: The unique identifier for the Chronicle instance, which is the same as the customer ID. - immutable: true - url_param_only: true - required: true -properties: - - name: name - type: String - output: true - description: |- - Full resource name for the rule. This unique identifier is generated using values provided for the URL parameters. - Format: - projects/{project}/locations/{location}/instances/{instance}/rules/{rule} - - name: ruleId - type: String - output: true - immutable: true - default_from_api: true - custom_flatten: 'templates/terraform/custom_flatten/id_from_name.tmpl' - description: |- - Rule Id is the ID of the Rule. - - name: text - type: String - description: |- - The YARA-L content of the rule. - Populated in FULL view. - - name: metadata - type: KeyValuePairs - description: |- - Output only. Additional metadata specified in the meta section of text. - Populated in FULL view. - output: true - - name: scope - type: String - diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress' - description: |- - Resource name of the DataAccessScope bound to this rule. - Populated in BASIC view and FULL view. - If reference lists are used in the rule, validations will be performed - against this scope to ensure that the reference lists are compatible with - both the user's and the rule's scopes. - The scope should be in the format: - "projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope}". - - name: nearRealTimeLiveRuleEligible - type: Boolean - description: |- - Output only. Indicate the rule can run in near real time live rule. - If this is true, the rule uses the near real time live rule when the run - frequency is set to LIVE. - output: true - - name: revisionId - type: String - description: |- - Output only. The revision ID of the rule. - A new revision is created whenever the rule text is changed in any way. - Format: v_{10 digits}_{9 digits} - Populated in REVISION_METADATA_ONLY view and FULL view. - output: true - - name: severity - type: NestedObject - description: Severity represents the severity level of the rule. - output: true - properties: - - name: displayName - type: String - description: |- - The display name of the severity level. Extracted from the meta section of - the rule text. - - name: revisionCreateTime - type: String - description: |- - Output only. The timestamp of when the rule revision was created. - Populated in FULL, REVISION_METADATA_ONLY views. - output: true - - name: compilationState - type: String - description: |- - Output only. The current compilation state of the rule. - Populated in FULL view. - Possible values: - COMPILATION_STATE_UNSPECIFIED - SUCCEEDED - FAILED - output: true - - name: type - type: String - output: true - description: |2- - - Possible values: - RULE_TYPE_UNSPECIFIED - SINGLE_EVENT - MULTI_EVENT - - name: referenceLists - type: Array - description: |- - Output only. Resource names of the reference lists used in this rule. - Populated in FULL view. - output: true - item_type: - type: String - - name: displayName - type: String - description: |- - Output only. Display name of the rule. - Populated in BASIC view and FULL view. - output: true - - name: createTime - type: String - description: |- - Output only. The timestamp of when the rule was created. - Populated in FULL view. - output: true - - name: author - type: String - description: |- - Output only. The author of the rule. Extracted from the meta section of text. - Populated in BASIC view and FULL view. - output: true - - name: allowedRunFrequencies - type: Array - description: |- - Output only. The run frequencies that are allowed for the rule. - Populated in BASIC view and FULL view. - output: true - item_type: - type: String - - name: etag - type: String - default_from_api: true - description: |- - The etag for this rule. - If this is provided on update, the request will succeed if and only if it - matches the server-computed value, and will fail with an ABORTED error - otherwise. - Populated in BASIC view and FULL view. - - name: compilationDiagnostics - type: Array - description: |- - Output only. A list of a rule's corresponding compilation diagnostic messages - such as compilation errors and compilation warnings. - Populated in FULL view. - output: true - item_type: - type: NestedObject - properties: - - name: message - type: String - description: Output only. The diagnostic message. - output: true - - name: position - type: NestedObject - description: |- - CompilationPosition represents the location of a compilation diagnostic in - rule text. - properties: - - name: startLine - type: Integer - description: Output only. Start line number, beginning at 1. - output: true - - name: startColumn - type: Integer - description: Output only. Start column number, beginning at 1. - output: true - - name: endLine - type: Integer - description: Output only. End line number, beginning at 1. - output: true - - name: endColumn - type: Integer - description: Output only. End column number, beginning at 1. - output: true - - name: severity - type: String - description: |- - Output only. The severity of a rule's compilation diagnostic. - Possible values: - SEVERITY_UNSPECIFIED - WARNING - ERROR - output: true - - name: uri - type: String - description: Output only. Link to documentation that describes a diagnostic in more detail. - output: true - - name: dataTables - type: Array - description: Output only. Resource names of the data tables used in this rule. - output: true - item_type: - type: String diff --git a/mmv1/products/chronicle/RuleDeployment.yaml b/mmv1/products/chronicle/RuleDeployment.yaml deleted file mode 100644 index 2be37f6334c4..000000000000 --- a/mmv1/products/chronicle/RuleDeployment.yaml +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright 2025 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. - ---- -name: RuleDeployment -description: The RuleDeployment resource represents the deployment state of a Rule. -min_version: 'beta' -references: - guides: - 'Google SecOps Guides': 'https://cloud.google.com/chronicle/docs/secops/secops-overview' - api: 'https://cloud.google.com/chronicle/docs/reference/rest/v1alpha/RuleDeployment' -base_url: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rules}}/deployments -self_link: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/deployment -create_url: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/deployment?updateMask=enabled,alerting,archived,runFrequency -id_format: projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/deployment -import_format: - - projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/deployment -create_verb: PATCH -update_verb: PATCH -update_mask: true -exclude_delete: true -autogen_status: UnVsZURlcGxveW1lbnQ= - -examples: - - name: 'chronicle_ruledeployment_basic' - primary_resource_id: 'example' - min_version: 'beta' - test_env_vars: - chronicle_id: 'CHRONICLE_ID' - -parameters: - - name: location - type: String - description: The location of the resource. This is the geographical region where the Chronicle instance resides, such as "us" or "europe-west2". - immutable: true - url_param_only: true - required: true - - name: instance - type: String - description: The unique identifier for the Chronicle instance, which is the same as the customer ID. - immutable: true - url_param_only: true - required: true - - name: rule - type: String - description: The Rule ID of the rule. - immutable: true - url_param_only: true - required: true -properties: - - name: name - type: String - description: |- - The resource name of the rule deployment. - Note that RuleDeployment is a child of the overall Rule, not any individual - revision, so the resource ID segment for the Rule resource must not - reference a specific revision. - Format: - projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment - output: true - - name: enabled - type: Boolean - description: Whether the rule is currently deployed continuously against incoming data. - - name: alerting - type: Boolean - description: |- - Whether detections resulting from this deployment should be considered - alerts. - - name: archived - type: Boolean - description: |- - The archive state of the rule deployment. - Cannot be set to true unless enabled is set to false. - If set to true, alerting will automatically be set to false. - If currently set to true, enabled, alerting, and run_frequency cannot be - updated. - - name: archiveTime - type: String - description: Output only. The timestamp when the rule deployment archive state was last set to true. - If the rule deployment's current archive state is not set to true, the field will be empty. - output: true - - name: runFrequency - type: String - description: |2- - - The run frequency of the rule deployment. - Possible values: - LIVE - HOURLY - DAILY - - name: executionState - type: String - description: |2- - - The execution state of the rule deployment. - Possible values: - DEFAULT - LIMITED - PAUSED - output: true - - name: producerRules - type: Array - description: |2- - Output only. The names of the associated/chained producer rules. Rules are considered - producers for this rule if this rule explicitly filters on their ruleid. - Format: - projects/{project}/locations/{location}/instances/{instance}/rules/{rule} - output: true - item_type: - type: String - - name: consumerRules - type: Array - description: |2- - Output only. The names of the associated/chained consumer rules. Rules are considered - consumers of this rule if their rule text explicitly filters on this rule's ruleid. - Format: - projects/{project}/locations/{location}/instances/{instance}/rules/{rule} - output: true - item_type: - type: String - - name: lastAlertStatusChangeTime - type: String - description: Output only. The timestamp when the rule deployment alert state was lastly changed. - This is filled regardless of the current alert state.E.g. if the current alert status is false, - this timestamp will be the timestamp when the alert status was changed to false. - output: true diff --git a/mmv1/products/chronicle/Watchlist.yaml b/mmv1/products/chronicle/Watchlist.yaml index b245c7851e9b..885522fbc5c3 100644 --- a/mmv1/products/chronicle/Watchlist.yaml +++ b/mmv1/products/chronicle/Watchlist.yaml @@ -27,7 +27,6 @@ import_format: - projects/{{project}}/locations/{{location}}/instances/{{instance}}/watchlists/{{watchlist_id}} update_verb: PATCH update_mask: true -autogen_status: V2F0Y2hsaXN0 custom_code: encoder: 'templates/terraform/encoders/chronicle_watchlist.go.tmpl' post_create: 'templates/terraform/post_create/chronicle_watchlist_id.go.tmpl' diff --git a/mmv1/products/cloudbuild/Trigger.yaml b/mmv1/products/cloudbuild/Trigger.yaml index f6fb90ebe4ad..68350ea563dd 100644 --- a/mmv1/products/cloudbuild/Trigger.yaml +++ b/mmv1/products/cloudbuild/Trigger.yaml @@ -46,10 +46,6 @@ custom_diff: - 'stepTimeoutCustomizeDiff' schema_version: 2 state_upgraders: true -sweeper: - url_substitutions: - - region: "us-central1" - - region: "global" examples: - name: 'cloudbuild_trigger_filename' primary_resource_id: 'filename-trigger' diff --git a/mmv1/products/cloudbuildv2/Connection.yaml b/mmv1/products/cloudbuildv2/Connection.yaml index 5c3193efbb2b..205195397bcf 100644 --- a/mmv1/products/cloudbuildv2/Connection.yaml +++ b/mmv1/products/cloudbuildv2/Connection.yaml @@ -49,10 +49,6 @@ iam_policy: custom_code: exclude_tgc: true legacy_long_form_project: true -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us-west1" examples: - name: 'cloudbuildv2_connection' primary_resource_id: 'my-connection' diff --git a/mmv1/products/cloudfunctions2/Function.yaml b/mmv1/products/cloudfunctions2/Function.yaml index 1fa62bbd41ec..966dfbba3520 100644 --- a/mmv1/products/cloudfunctions2/Function.yaml +++ b/mmv1/products/cloudfunctions2/Function.yaml @@ -56,11 +56,6 @@ custom_code: constants: 'templates/terraform/constants/cloudfunctions2_function.go.tmpl' encoder: 'templates/terraform/encoders/cloudfunctions2_runtime_update_policy.go.tmpl' taint_resource_on_failed_create: true -sweeper: - url_substitutions: - - region: "us-central1" - - region: "europe-west6" - - region: "us-west1" examples: - name: 'cloudfunctions2_basic' primary_resource_id: 'function' @@ -116,9 +111,6 @@ examples: exclude_test: true - name: 'cloudfunctions2_basic_gcs' primary_resource_id: 'function' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com" - role: "roles/cloudkms.cryptoKeyEncrypterDecrypter" vars: bucket_name_source: 'gcf-source-bucket' bucket_name_trigger: 'gcf-trigger-bucket' @@ -130,15 +122,13 @@ examples: test_vars_overrides: 'zip_path': '"./test-fixtures/function-source-eventarc-gcs.zip"' 'primary_resource_id': '"terraform-test"' + 'policyChanged': 'acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter")' # ignore these fields during import step ignore_read_extra: - 'build_config.0.source.0.storage_source.0.object' - 'build_config.0.source.0.storage_source.0.bucket' - name: 'cloudfunctions2_basic_auditlogs' primary_resource_id: 'function' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com" - role: "roles/cloudkms.cryptoKeyEncrypterDecrypter" vars: bucket_name_source: 'gcf-source-bucket' bucket_name_auditlogs: 'gcf-auditlog-bucket' @@ -150,6 +140,7 @@ examples: test_vars_overrides: 'zip_path': '"./test-fixtures/function-source-eventarc-gcs.zip"' 'primary_resource_id': '"terraform-test"' + 'policyChanged': 'acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter")' # ignore these fields during import step ignore_read_extra: - 'build_config.0.source.0.storage_source.0.object' @@ -174,9 +165,6 @@ examples: external_providers: ["random", "time"] - name: 'cloudfunctions2_secret_env' primary_resource_id: 'function' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com" - role: "roles/cloudkms.cryptoKeyEncrypterDecrypter" vars: function: 'function-secret' bucket_name: 'gcf-source' @@ -187,15 +175,13 @@ examples: test_vars_overrides: 'location': '"us-central1"' 'zip_path': '"./test-fixtures/function-source.zip"' + 'policyChanged': 'acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter")' # ignore these fields during import step ignore_read_extra: - 'build_config.0.source.0.storage_source.0.object' - 'build_config.0.source.0.storage_source.0.bucket' - name: 'cloudfunctions2_secret_volume' primary_resource_id: 'function' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com" - role: "roles/cloudkms.cryptoKeyEncrypterDecrypter" vars: function: 'function-secret' bucket_name: 'gcf-source' @@ -206,6 +192,7 @@ examples: test_vars_overrides: 'location': '"us-central1"' 'zip_path': '"./test-fixtures/function-source.zip"' + 'policyChanged': 'acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter")' # ignore these fields during import step ignore_read_extra: - 'build_config.0.source.0.storage_source.0.object' diff --git a/mmv1/products/cloudquotas/QuotaAdjusterSettings.yaml b/mmv1/products/cloudquotas/QuotaAdjusterSettings.yaml index 481fefd92bce..ece9c9891ed4 100644 --- a/mmv1/products/cloudquotas/QuotaAdjusterSettings.yaml +++ b/mmv1/products/cloudquotas/QuotaAdjusterSettings.yaml @@ -14,7 +14,7 @@ --- name: 'QuotaAdjusterSettings' description: | - QuotaAdjusterSettings resource represents your quota adjuster settings for a particular project. When enabled, the quota adjuster monitors your usage for the specified resources and issues quota adjustment requests when resource usage approaches its quota value. + QuotaAdjusterSettings represents the preferred quota configuration specified for a project, folder or organization. There is only one QuotaAdjusterSettings resource for a quota value targeting a unique set of dimensions. min_version: beta references: guides: @@ -49,11 +49,13 @@ examples: parameters: - name: 'parent' type: String - description: The parent of the quota preference. Allowed parent format is "projects/[project-id / number]". + description: The parent of the quota preference. Allowed parents are "projects/[project-id / number]" or "folders/[folder-id / number]" or "organizations/[org-id / number]". url_param_only: true required: true immutable: true default_from_api: true + validation: + regex: '^(projects|folders|organizations)/([^/]+)$' properties: - name: 'enablement' type: Enum @@ -66,14 +68,14 @@ properties: - name: 'effectiveContainer' type: String description: | - The resource container that determines if the quota adjuster is set for this project. - Expect this field to be empty currently. + Fields to capture the hierarchy enablement. + The container (org/folder/project) that determines if the quota adjuster is set for this project/folder/org. We use the nearest-ancestor to determine the effective container. + The nearest ancestor (including this container) with `enabled` set (either true or false) will be returned. output: true - name: 'effectiveEnablement' type: Enum description: | - Based on the effective container`s setting above, determines Whether this resource container has the quota adjuster enabled. - Expect this field to be empty currently. + Based on the effective container`s setting above, determines Whether this container has the quota adjuster enabled. output: true enum_values: - 'DEFAULT' diff --git a/mmv1/products/cloudrun/Service.yaml b/mmv1/products/cloudrun/Service.yaml index 1398038bc4ed..9e726b4a36d8 100644 --- a/mmv1/products/cloudrun/Service.yaml +++ b/mmv1/products/cloudrun/Service.yaml @@ -60,11 +60,6 @@ error_retry_predicates: schema_version: 2 state_upgrade_base_schema_version: 1 state_upgraders: true -sweeper: - url_substitutions: - - region: "us-central1" - - region: "europe-west1" - - region: "europe-north1" examples: - name: 'cloud_run_service_basic' primary_resource_id: 'default' @@ -475,8 +470,7 @@ properties: description: |- The name of the secret in Cloud Secret Manager. By default, the secret is assumed to be in the same project. If the secret is in another project, you must define an alias. - An alias definition has the form: - {alias}:projects/{project-id|project-number}/secrets/{secret-name}. + An alias definition has the form: :projects/{project-id|project-number}/secrets/. If multiple alias definitions are needed, they must be separated by commas. The alias definitions must be set on the run.googleapis.com/secrets annotation. required: true diff --git a/mmv1/products/cloudrunv2/Service.yaml b/mmv1/products/cloudrunv2/Service.yaml index 58c7393dd9c0..669f777f4d9b 100644 --- a/mmv1/products/cloudrunv2/Service.yaml +++ b/mmv1/products/cloudrunv2/Service.yaml @@ -161,18 +161,6 @@ examples: cloud_run_service_name: 'cloudrun-service' ignore_read_extra: - 'deletion_protection' - - name: 'cloudrunv2_service_function' - primary_resource_id: 'default' - primary_resource_name: 'fmt.Sprintf("tf-test-cloudrun-srv%s", context["random_suffix"])' - vars: - cloud_run_service_name: 'cloudrun-service' - bucket_name: 'gcf-source' - zip_path: 'function_source.zip' - sa_name: 'build-sa' - test_vars_overrides: - 'zip_path': '"./test-fixtures/function-source.zip"' - ignore_read_extra: - - 'deletion_protection' virtual_fields: - name: 'deletion_protection' description: | @@ -772,26 +760,6 @@ properties: Containers which should be started before this container. If specified the container will wait to start until all containers with the listed names are healthy. item_type: type: String - - name: 'baseImageUri' - type: String - description: |- - Base image for this container. If set, it indicates that the service is enrolled into automatic base image update. - - name: 'buildInfo' - type: NestedObject - description: |- - The build info of the container image. - output: true - properties: - - name: 'functionTarget' - type: String - description: |- - Entry point of the function when the image is a Cloud Run function. - output: true - - name: 'source_location' - type: String - description: |- - Source code location of the image. - output: true - name: 'volumes' type: Array description: |- @@ -1151,48 +1119,6 @@ properties: description: |- All URLs serving traffic for this Service. output: true - - name: 'buildConfig' - type: NestedObject - description: |- - Configuration for building a Cloud Run function. - properties: - - name: 'name' - type: String - description: |- - The Cloud Build name of the latest successful deployment of the function. - output: true - - name: 'sourceLocation' - type: String - description: |- - The Cloud Storage bucket URI where the function source code is located. - - name: 'functionTarget' - type: String - description: |- - The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix, if not specified. For backward compatibility, if function with given name is not found, then the system will try to use function named "function". - - name: 'imageUri' - type: String - description: |- - Artifact Registry URI to store the built image. - - name: 'baseImage' - type: String - description: |- - The base image used to build the function. - - name: 'enableAutomaticUpdates' - type: Boolean - description: |- - Sets whether the function will receive automatic base image updates. - - name: 'workerPool' - type: String - description: |- - Name of the Cloud Build Custom Worker Pool that should be used to build the Cloud Run function. The format of this field is `projects/{project}/locations/{region}/workerPools/{workerPool}` where {project} and {region} are the project id and region respectively where the worker pool is defined and {workerPool} is the short name of the worker pool. - - name: 'environmentVariables' - type: KeyValuePairs - description: |- - User-provided build-time environment variables for the function. - - name: 'serviceAccount' - type: String - description: |- - Service account to be used for building the container. The format of this field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. - name: 'reconciling' type: Boolean description: | diff --git a/mmv1/products/colab/NotebookExecution.yaml b/mmv1/products/colab/NotebookExecution.yaml deleted file mode 100644 index fa18713dd317..000000000000 --- a/mmv1/products/colab/NotebookExecution.yaml +++ /dev/null @@ -1,162 +0,0 @@ -# Copyright 2025 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. - ---- - -name: 'NotebookExecution' -api_resource_type_kind: NotebookExecutionJob -description: | - 'An instance of a notebook Execution' - -references: - guides: - 'Schedule a notebook run': 'https://cloud.google.com/colab/docs/schedule-notebook-run' - api: 'https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.notebookExecutionJobs' -base_url: 'projects/{{project}}/locations/{{location}}/notebookExecutionJobs' -self_link: 'projects/{{project}}/locations/{{location}}/notebookExecutionJobs/{{notebook_execution_job_id}}' -immutable: true -create_url: 'projects/{{project}}/locations/{{location}}/notebookExecutionJobs?notebook_execution_job_id={{notebook_execution_job_id}}' -async: - type: 'OpAsync' - operation: - full_url: 'https://{{location}}-aiplatform.googleapis.com/v1/{{op_id}}' -import_format: - - 'projects/{{project}}/locations/{{location}}/notebookExecutionJobs/{{notebook_execution_job_id}}' -custom_code: - post_create: 'templates/terraform/post_create/colab_notebook_execution.go.tmpl' -examples: - - name: 'colab_notebook_execution_basic' - primary_resource_id: 'notebook-execution' - vars: - runtime_template_name: 'runtime-template-name' - bucket: 'my_bucket' - test_env_vars: - project_id: 'PROJECT_NAME' - service_account: 'SERVICE_ACCT' - ignore_read_extra: - - direct_notebook_source.0.content - - name: 'colab_notebook_execution_full' - min_version: beta - primary_resource_id: 'notebook-execution' - vars: - notebook_execution_job_id: 'colab-notebook-execution' - runtime_template_name: 'runtime-template-name' - bucket: 'my_bucket' - test_env_vars: - project_id: 'PROJECT_NAME' - service_account: 'SERVICE_ACCT' - - name: 'colab_notebook_execution_dataform' - min_version: beta - primary_resource_id: 'notebook-execution' - primary_resource_name: 'fmt.Sprintf("tf-test-colab-notebook-execution%s", context["random_suffix"])' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-dataform.iam.gserviceaccount.com" - role: "roles/cloudkms.cryptoKeyEncrypterDecrypter" - vars: - secret: 'secret' - dataform_repository: 'dataform-repository' - runtime_template_name: 'runtime-template-name' - bucket: 'my_bucket' - key_name: 'my-crypto-key' - test_env_vars: - project_id: 'PROJECT_NAME' - service_account: 'SERVICE_ACCT' - test_vars_overrides: - key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' -parameters: - - name: 'location' - type: String - required: true - url_param_only: true - description: 'The location for the resource: https://cloud.google.com/colab/docs/locations' - - name: 'notebookExecutionJobId' - type: String - url_param_only: true - description: 'User specified ID for the Notebook Execution Job' - custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' - default_from_api: true -properties: - - name: 'displayName' - type: String - description: - Required. The display name of the Notebook Execution. - required: true - - name: 'dataformRepositorySource' - type: NestedObject - description: 'The Dataform Repository containing the input notebook.' - exactly_one_of: - - dataform_repository_source - - gcs_notebook_source - - direct_notebook_source - properties: - - name: 'dataformRepositoryResourceName' - type: String - required: true - description: 'The resource name of the Dataform Repository.' - diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths' - - name: 'commitSha' - type: String - description: 'The commit SHA to read repository with. If unset, the file will be read at HEAD.' - - name: 'gcsNotebookSource' - type: NestedObject - description: 'The Cloud Storage uri for the input notebook.' - exactly_one_of: - - dataform_repository_source - - gcs_notebook_source - - direct_notebook_source - properties: - - name: 'uri' - type: String - description: 'The Cloud Storage uri pointing to the ipynb file.' - required: true - - name: 'generation' - type: String - description: 'The version of the Cloud Storage object to read. If unset, the current version of the object is read. See https://cloud.google.com/storage/docs/metadata#generation-number.' - - name: 'directNotebookSource' - type: NestedObject - description: 'The content of the input notebook in ipynb format.' - ignore_read: true - exactly_one_of: - - dataform_repository_source - - gcs_notebook_source - - direct_notebook_source - properties: - - name: 'content' - type: String - required: true - description: 'The base64-encoded contents of the input notebook file.' - custom_flatten: 'templates/terraform/custom_flatten/colab_notebook_execution_direct_content.go.tmpl' - - name: executionTimeout - type: String - description: 'Max running time of the execution job in seconds (default 86400s / 24 hrs).' - - name: 'notebookRuntimeTemplateResourceName' - type: String - description: 'The NotebookRuntimeTemplate to source compute configuration from.' - exactly_one_of: - - notebook_runtime_template_resource_name - - name: 'gcsOutputUri' - required: true - type: String - description: 'The Cloud Storage location to upload the result to. Format:`gs://bucket-name`' - - name: 'executionUser' - type: String - exactly_one_of: - - execution_user - - service_account - description: 'The user email to run the execution as.' - - name: 'serviceAccount' - type: String - exactly_one_of: - - execution_user - - service_account - description: 'The service account to run the execution as.' diff --git a/mmv1/products/colab/Runtime.yaml b/mmv1/products/colab/Runtime.yaml deleted file mode 100644 index d363c0121b5b..000000000000 --- a/mmv1/products/colab/Runtime.yaml +++ /dev/null @@ -1,132 +0,0 @@ -# Copyright 2025 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. - ---- - -name: 'Runtime' -api_resource_type_kind: NotebookRuntime -description: | - 'A runtime is a Google-provisioned virtual machine (VM) that can run the code in your notebook (IPYNB file).' - -references: - guides: - 'Create a runtime': 'https://cloud.google.com/colab/docs/create-runtime' - api: 'https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.notebookRuntimes' -base_url: 'projects/{{project}}/locations/{{location}}/notebookRuntimes' -self_link: 'projects/{{project}}/locations/{{location}}/notebookRuntimes/{{name}}' -create_url: 'projects/{{project}}/locations/{{location}}/notebookRuntimes:assign?notebook_runtime_id={{name}}' -async: - type: 'OpAsync' - operation: - full_url: 'https://{{location}}-aiplatform.googleapis.com/v1/{{op_id}}' -custom_code: - encoder: 'templates/terraform/encoders/colab_runtime.go.tmpl' - post_create: 'templates/terraform/post_create/colab_runtime.go.tmpl' - custom_update: 'templates/terraform/custom_update/colab_runtime.go.tmpl' - constants: 'templates/terraform/constants/colab_runtime.go.tmpl' -examples: - - name: 'colab_runtime_basic' - primary_resource_id: 'runtime' - primary_resource_name: 'fmt.Sprintf("tf-test-colab-runtime%s", context["random_suffix"])' - region_override: 'us-central1' - vars: - runtime_name: 'colab-runtime' - - name: 'colab_runtime_stopped' - primary_resource_id: 'runtime' - primary_resource_name: 'fmt.Sprintf("tf-test-colab-runtime%s", context["random_suffix"])' - region_override: 'us-central1' - vars: - runtime_name: 'colab-runtime' - ignore_read_extra: - - 'desired_state' - - name: 'colab_runtime_full' - primary_resource_id: 'runtime' - primary_resource_name: 'fmt.Sprintf("tf-test-colab-runtime%s", context["random_suffix"])' - region_override: 'us-central1' - vars: - runtime_name: 'colab-runtime' - key_name: 'my-crypto-key' - test_vars_overrides: - key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' - ignore_read_extra: - - 'desired_state' - - 'auto_upgrade' -virtual_fields: - - name: 'desired_state' - description: | - Desired state of the Colab Runtime. Set this field to `RUNNING` to start the runtime, and `STOPPED` to stop it. - type: String - default_value: "RUNNING" - - name: 'auto_upgrade' - description: | - Triggers an upgrade anytime the runtime is started if it is upgradable. - type: Boolean -parameters: - - name: 'location' - type: String - required: true - url_param_only: true - description: 'The location for the resource: https://cloud.google.com/colab/docs/locations' - immutable: true - - name: 'name' - type: String - url_param_only: true - description: 'The resource name of the Runtime' - immutable: true -properties: - - name: notebookRuntimeTemplateRef - type: NestedObject - description: | - 'Runtime specific information used for NotebookRuntime creation.' - properties: - - name: 'notebookRuntimeTemplate' - type: String - immutable: true - required: true - description: 'The resource name of the NotebookRuntimeTemplate based on which a NotebookRuntime will be created.' - diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress' - - name: 'runtimeUser' - type: String - required: true - immutable: true - description: 'The user email of the NotebookRuntime.' - - name: 'displayName' - type: String - immutable: true - description: - Required. The display name of the Runtime. - required: true - - name: description - type: String - immutable: true - description: 'The description of the Runtime.' - - name: state - type: String - description: | - Output only. The state of the runtime. - output: true - - name: isUpgradable - type: Boolean - description: | - Output only. Checks if the NotebookRuntime is upgradable. - output: true - - name: expirationTime - type: String - description: | - Output only. Timestamp when this NotebookRuntime will be expired. - output: true - - name: notebookRuntimeType - type: String - description: | - Output only. The type of the notebook runtime. - output: true diff --git a/mmv1/products/colab/RuntimeTemplate.yaml b/mmv1/products/colab/RuntimeTemplate.yaml deleted file mode 100644 index f011641037d2..000000000000 --- a/mmv1/products/colab/RuntimeTemplate.yaml +++ /dev/null @@ -1,218 +0,0 @@ -# Copyright 2025 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. - ---- - -name: 'RuntimeTemplate' -api_resource_type_kind: NotebookRuntimeTemplate -description: | - 'A runtime template is a VM configuration that specifies a machine type and other characteristics of the VM, - as well as common settings such as the network and whether public internet access is enabled. When you create - a runtime, its VM is created according to the specifications of a runtime template.' - -references: - guides: - 'Create a runtime template': 'https://cloud.google.com/colab/docs/create-runtime-template' - api: 'https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.notebookRuntimeTemplates' -base_url: 'projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates' -self_link: 'projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates/{{name}}' -immutable: true -create_url: 'projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates?notebook_runtime_template_id={{name}}' -async: - type: 'OpAsync' - operation: - full_url: 'https://{{location}}-aiplatform.googleapis.com/v1/{{op_id}}' -iam_policy: - parent_resource_attribute: 'runtime_template' - method_name_separator: ':' - fetch_iam_policy_verb: 'POST' - example_config_body: 'templates/terraform/iam/example_config_body/colab_runtime_template.tf.tmpl' - import_format: - - 'projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates/{{runtime_template}}' - - '{{runtime_template}}' -custom_code: - post_create: 'templates/terraform/post_create/colab_runtime_template.go.tmpl' -examples: - - name: 'colab_runtime_template_basic' - primary_resource_id: 'runtime-template' - primary_resource_name: 'fmt.Sprintf("tf-test-colab-runtime-template%s", context["random_suffix"])' - vars: - runtime_template_name: 'colab-runtime-template' - - name: 'colab_runtime_template_no_name' - primary_resource_id: 'runtime-template' - exclude_import_test: true - - name: 'colab_runtime_template_full' - primary_resource_id: 'runtime-template' - primary_resource_name: 'fmt.Sprintf("tf-test-colab-runtime-template%s", context["random_suffix"])' - vars: - runtime_template_name: 'colab-runtime-template' - network_name: 'colab-test-default' - key_name: 'my-crypto-key' - test_vars_overrides: - key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' -parameters: - - name: 'location' - type: String - required: true - url_param_only: true - description: 'The location for the resource: https://cloud.google.com/colab/docs/locations' -properties: - - name: 'name' - type: String - default_from_api: true - custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' - description: 'The resource name of the Runtime Template' - - name: 'displayName' - type: String - description: - Required. The display name of the Runtime Template. - required: true - - name: description - type: String - description: 'The description of the Runtime Template.' - - name: machineSpec - type: NestedObject - default_from_api: true - description: | - 'The machine configuration of the runtime.' - properties: - - name: 'machineType' - type: string - default_from_api: true - description: | - The Compute Engine machine type selected for the runtime. - - name: 'acceleratorType' - type: enum - description: | - The type of hardware accelerator used by the runtime. If specified, acceleratorCount must also be specified. - enum_values: - - 'NVIDIA_TESLA_V100' - - 'NVIDIA_TESLA_T4' - - 'NVIDIA_TESLA_A100' - - 'NVIDIA_A100_80GB' - - 'NVIDIA_L4' - - name: 'acceleratorCount' - type: Integer - default_from_api: true - description: 'The number of accelerators used by the runtime.' - - name: dataPersistentDiskSpec - default_from_api: true - type: NestedObject - description: 'The configuration for the data disk of the runtime.' - properties: - - name: 'diskType' - type: enum - description: 'The type of the persistent disk.' - default_from_api: true - enum_values: - - 'pd-standard' - - 'pd-ssd' - - 'pd-balanced' - - 'pd-extreme' - - name: 'diskSizeGb' - type: int - default_from_api: true - description: | - The disk size of the runtime in GB. If specified, the diskType must also be specified. The minimum size is 10GB and the maximum is 65536GB. - - name: networkSpec - type: NestedObject - default_from_api: true - description: 'The network configuration for the runtime.' - properties: - - name: 'enableInternetAccess' - type: Boolean - description: Enable public internet access for the runtime. - - name: 'network' - default_from_api: true - type: String - description: 'The name of the VPC that this runtime is in.' - diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths' - - name: 'subnetwork' - type: String - description: 'The name of the subnetwork that this runtime is in.' - diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths' - - name: 'labels' - type: KeyValueLabels - description: 'Labels to identify and group the runtime template.' - - name: idleShutdownConfig - type: NestedObject - default_from_api: true - description: 'Notebook Idle Shutdown configuration for the runtime.' - properties: - - name: 'idleTimeout' - default_from_api: true - type: String - description: 'The duration after which the runtime is automatically shut down. An input of 0s disables the idle shutdown feature, and a valid range is [10m, 24h].' - - name: eucConfig - type: NestedObject - description: 'EUC configuration of the NotebookRuntimeTemplate.' - properties: - - name: 'eucDisabled' - type: Boolean - description: 'Disable end user credential access for the runtime.' - - name: shieldedVmConfig - type: NestedObject - description: 'Runtime Shielded VM spec.' - properties: - - name: 'enableSecureBoot' - type: Boolean - description: 'Enables secure boot for the runtime.' - - name: 'networkTags' - type: Array - item_type: - type: String - description: 'Applies the given Compute Engine tags to the runtime.' - - name: encryptionSpec - type: NestedObject - description: 'Customer-managed encryption key spec for the notebook runtime.' - properties: - - name: 'kmsKeyName' - type: String - description: 'The Cloud KMS encryption key (customer-managed encryption key) used to protect the runtime.' - - name: softwareConfig - type: NestedObject - description: 'The notebook software configuration of the notebook runtime.' - properties: - - name: 'env' - type: Array - description: 'Environment variables to be passed to the container.' - item_type: - type: NestedObject - properties: - - name: 'name' - type: String - description: 'Name of the environment variable. Must be a valid C identifier.' - - name: 'value' - type: String - description: 'Variables that reference a $(VAR_NAME) are expanded using the previous defined - environment variables in the container and any service environment variables. - If a variable cannot be resolved, the reference in the input string will be unchanged. - The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped - references will never be expanded, regardless of whether the variable exists or not.' - - name: 'postStartupScriptConfig' - type: NestedObject - description: 'Post startup script config.' - properties: - - name: 'postStartupScript' - type: String - description: 'Post startup script to run after runtime is started.' - - name: 'postStartupScriptUrl' - type: String - description: 'Post startup script url to download. Example: https://bucket/script.sh.' - - name: 'postStartupScriptBehavior' - type: Enum - description: 'Post startup script behavior that defines download and execution behavior.' - enum_values: - - 'RUN_ONCE' - - 'RUN_EVERY_START' - - 'DOWNLOAD_AND_RUN_EVERY_START' diff --git a/mmv1/products/colab/Schedule.yaml b/mmv1/products/colab/Schedule.yaml deleted file mode 100644 index 7bdd1b89322f..000000000000 --- a/mmv1/products/colab/Schedule.yaml +++ /dev/null @@ -1,211 +0,0 @@ -# Copyright 2025 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. - ---- - -name: 'Schedule' -description: | - 'Colab Enterprise Notebook Execution Schedules.' -references: - guides: - 'Schedule a notebook run': 'https://cloud.google.com/colab/docs/schedule-notebook-run' - api: 'https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.schedules' -base_url: 'projects/{{project}}/locations/{{location}}/schedules' -self_link: 'projects/{{project}}/locations/{{location}}/schedules/{{name}}' -create_url: 'projects/{{project}}/locations/{{location}}/schedules' -update_url: 'projects/{{project}}/locations/{{location}}/schedules/{{name}}' -update_mask: true -update_verb: 'PATCH' -async: - type: 'OpAsync' - actions: ['delete'] - operation: - full_url: 'https://{{location}}-aiplatform.googleapis.com/v1/{{op_id}}' -custom_code: - encoder: 'templates/terraform/encoders/colab_schedule.go.tmpl' - post_create: 'templates/terraform/post_create/colab_schedule.go.tmpl' - post_update: 'templates/terraform/post_update/colab_schedule.go.tmpl' - constants: 'templates/terraform/constants/colab_schedule.go.tmpl' -sweeper: - identifier_field: 'displayName' -examples: - - name: 'colab_schedule_basic' - primary_resource_id: 'schedule' - vars: - display_name: 'basic-schedule' - bucket: 'my_bucket' - runtime_template_name: 'runtime-template' - test_env_vars: - project_id: 'PROJECT_NAME' - location: 'REGION' - service_account: 'SERVICE_ACCT' - - name: 'colab_schedule_paused' - primary_resource_id: 'schedule' - vars: - display_name: 'paused-schedule' - bucket: 'my_bucket' - runtime_template_name: 'runtime-template' - test_env_vars: - project_id: 'PROJECT_NAME' - location: 'REGION' - service_account: 'SERVICE_ACCT' - ignore_read_extra: - - desired_state - - name: 'colab_schedule_full' - primary_resource_id: 'schedule' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-dataform.iam.gserviceaccount.com" - role: "roles/cloudkms.cryptoKeyEncrypterDecrypter" - vars: - display_name: 'full-schedule' - bucket: 'my_bucket' - network_name: 'colab-test-default' - runtime_template_name: 'runtime-template' - secret: 'secret' - dataform_repository: 'dataform-repository' - start_time: '2014-10-02T15:01:23Z' - end_time: '2014-10-10T15:01:23Z' - test_env_vars: - project_id: 'PROJECT_NAME' - location: 'REGION' - service_account: 'SERVICE_ACCT' - test_vars_overrides: - key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' - # Tests use a (relatively static) future date so that VCR cassettes can stay valid for a long time - start_time: 'time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 1).Format(time.RFC3339)' - end_time: 'time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 10).Format(time.RFC3339)' -virtual_fields: - - name: 'desired_state' - description: | - Desired state of the Colab Schedule. Set this field to `ACTIVE` to start/resume the schedule, and `PAUSED` to pause the schedule. - type: String - default_value: "ACTIVE" -parameters: - - name: 'location' - type: String - required: true - url_param_only: true - description: 'The location for the resource: https://cloud.google.com/colab/docs/locations' -properties: - - name: 'name' - type: String - description: 'The resource name of the Schedule' - custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' - output: true - - name: 'displayName' - type: String - description: - Required. The display name of the Schedule. - required: true - - name: 'startTime' - type: String - description: - The timestamp after which the first run can be scheduled. Defaults to the schedule creation time. Must be in the RFC 3339 (https://www.ietf.org/rfc/rfc3339.txt) format. - default_from_api: true - - name: 'endTime' - type: String - description: - Timestamp after which no new runs can be scheduled. If specified, the schedule will be completed when either end_time is reached or when scheduled_run_count >= max_run_count. Must be in the RFC 3339 (https://www.ietf.org/rfc/rfc3339.txt) format. - - name: 'maxRunCount' - type: int - description: - Maximum run count of the schedule. If specified, The schedule will be completed when either startedRunCount >= maxRunCount or when endTime is reached. If not specified, new runs will keep getting scheduled until this Schedule is paused or deleted. Already scheduled runs will be allowed to complete. Unset if not specified. - - name: 'cron' - type: string - description: | - Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled runs. - required: true - - name: 'maxConcurrentRunCount' - type: int - required: true - description: - Maximum number of runs that can be started concurrently for this Schedule. This is the limit for starting the scheduled requests and not the execution of the notebook execution jobs created by the requests. - - name: 'allowQueueing' - type: Boolean - send_empty_value: true - description: - Whether new scheduled runs can be queued when max_concurrent_runs limit is reached. If set to true, new runs will be queued instead of skipped. Default to false. - - name: 'state' - type: String - description: | - Output only. The state of the schedule. - output: true - - name: 'createNotebookExecutionJobRequest' - immutable: true - type: NestedObject - description: Request for google_colab_notebook_execution. - required: true - properties: - - name: 'notebookExecutionJob' - type: NestedObject - required: true - description: - The NotebookExecutionJob to create. - properties: - - name: 'displayName' - type: String - description: - Required. The display name of the Notebook Execution. - required: true - - name: 'dataformRepositorySource' - type: NestedObject - description: 'The Dataform Repository containing the input notebook.' - exactly_one_of: - - create_notebook_execution_job_request.0.notebook_execution_job.0.dataform_repository_source - - create_notebook_execution_job_request.0.notebook_execution_job.0.gcs_notebook_source - properties: - - name: 'dataformRepositoryResourceName' - type: String - required: true - description: 'The resource name of the Dataform Repository.' - diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths' - - name: 'commitSha' - type: String - description: 'The commit SHA to read repository with. If unset, the file will be read at HEAD.' - - name: 'gcsNotebookSource' - type: NestedObject - description: 'The Cloud Storage uri for the input notebook.' - exactly_one_of: - - create_notebook_execution_job_request.0.notebook_execution_job.0.dataform_repository_source - - create_notebook_execution_job_request.0.notebook_execution_job.0.gcs_notebook_source - properties: - - name: 'uri' - type: String - required: true - description: 'The Cloud Storage uri pointing to the ipynb file. Format: gs://bucket/notebook_file.ipynb' - - name: 'generation' - type: String - description: 'The version of the Cloud Storage object to read. If unset, the current version of the object is read. See https://cloud.google.com/storage/docs/metadata#generation-number.' - - name: executionTimeout - type: String - description: 'Max running time of the execution job in seconds (default 86400s / 24 hrs). A duration in seconds with up to nine fractional digits, ending with "s". Example: "3.5s".' - - name: 'notebookRuntimeTemplateResourceName' - type: String - description: 'The NotebookRuntimeTemplate to source compute configuration from.' - required: true - - name: 'gcsOutputUri' - required: true - type: String - description: 'The Cloud Storage location to upload the result to. Format:`gs://bucket-name`' - - name: 'executionUser' - type: String - exactly_one_of: - - create_notebook_execution_job_request.0.notebook_execution_job.0.execution_user - - create_notebook_execution_job_request.0.notebook_execution_job.0.service_account - description: 'The user email to run the execution as.' - - name: 'serviceAccount' - type: String - exactly_one_of: - - create_notebook_execution_job_request.0.notebook_execution_job.0.execution_user - - create_notebook_execution_job_request.0.notebook_execution_job.0.service_account - description: 'The service account to run the execution as.' diff --git a/mmv1/products/compute/Address.yaml b/mmv1/products/compute/Address.yaml index 37b751efcea7..a5df36000b4b 100644 --- a/mmv1/products/compute/Address.yaml +++ b/mmv1/products/compute/Address.yaml @@ -51,13 +51,6 @@ async: collection_url_key: 'items' custom_code: post_create: 'templates/terraform/post_create/labels.tmpl' -sweeper: - url_substitutions: - - region: "us-west2" - - region: "us-central1" - - region: "us-east1" - - region: "europe-west1" - - region: "us-west1" examples: - name: 'address_basic' primary_resource_id: 'ip_address' diff --git a/mmv1/products/compute/Autoscaler.yaml b/mmv1/products/compute/Autoscaler.yaml index 831c593b6315..cc2c3309eb00 100644 --- a/mmv1/products/compute/Autoscaler.yaml +++ b/mmv1/products/compute/Autoscaler.yaml @@ -41,10 +41,6 @@ async: resource_inside_response: false collection_url_key: 'items' custom_code: -sweeper: - url_substitutions: - - zone: "us-central1-a" - - zone: "us-central1-f" examples: - name: 'autoscaler_single_instance' primary_resource_id: 'default' diff --git a/mmv1/products/compute/Disk.yaml b/mmv1/products/compute/Disk.yaml index 09b4a5c48fb7..3472e11af504 100644 --- a/mmv1/products/compute/Disk.yaml +++ b/mmv1/products/compute/Disk.yaml @@ -294,8 +294,6 @@ properties: character, which cannot be a dash. required: true immutable: true - validation: - function: 'verify.ValidateGCEName' - name: 'size' type: Integer description: | diff --git a/mmv1/products/compute/FirewallPolicy.yaml b/mmv1/products/compute/FirewallPolicy.yaml deleted file mode 100644 index 96f488d6cbcb..000000000000 --- a/mmv1/products/compute/FirewallPolicy.yaml +++ /dev/null @@ -1,108 +0,0 @@ -# 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. - ---- -name: 'FirewallPolicy' -api_resource_type_kind: FirewallPolicy -description: | - Hierarchical firewall policy rules let you create and enforce a consistent firewall policy across your organization. Rules can explicitly allow or deny connections or delegate evaluation to lower level policies. Policies can be created within organizations or folders. - - This resource should be generally be used with `google_compute_firewall_policy_association` and `google_compute_firewall_policy_rule` - - For more information see the [official documentation](https://cloud.google.com/vpc/docs/firewall-policies) -min_version: 'beta' -references: - guides: - api: 'https://cloud.google.com/compute/docs/reference/rest/v1/firewallPolicies' -docs: -base_url: 'locations/global/firewallPolicies' -self_link: 'locations/global/firewallPolicies/{{name}}' -create_url: 'locations/global/firewallPolicies?parentId={{parent}}' -update_verb: 'PATCH' -timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 -import_format: - - 'locations/global/firewallPolicies/{{name}}' - - '{{name}}' -custom_code: - post_create: 'templates/terraform/post_create/compute_firewall_policy.go.tmpl' - post_delete: 'templates/terraform/constants/compute_firewall_policy_operation.go.tmpl' - post_update: 'templates/terraform/constants/compute_firewall_policy_operation.go.tmpl' -custom_diff: - - 'tpgresource.DefaultProviderProject' -examples: - - name: 'firewall_policy' - primary_resource_id: 'default' - vars: - policy_name: 'my-policy' - test_env_vars: - org_id: 'ORG_ID' -parameters: -properties: - - name: 'creationTimestamp' - type: String - description: | - Creation timestamp in RFC3339 text format. - output: true - - name: 'name' - type: String - description: | - Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy. - output: true - - name: 'firewallPolicyId' - type: String - api_name: 'id' - description: | - The unique identifier for the resource. This identifier is defined by the server. - output: true - - name: 'shortName' - type: String - description: | - User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created. - This field is not applicable to network firewall policies. This name must be set on creation and cannot be changed. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - required: true - immutable: true - - name: 'description' - type: String - description: | - An optional description of this resource. Provide this property when you create the resource. - - name: 'parent' - type: String - description: | - The parent of the firewall policy. - required: true - immutable: true - diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' - - name: 'fingerprint' - type: Fingerprint - description: | - Fingerprint of the resource. This field is used internally during updates of this resource. - output: true - - name: 'selfLink' - type: String - description: | - Server-defined URL for the resource. - output: true - - name: 'selfLinkWithId' - type: String - description: | - Server-defined URL for this resource with the resource id. - output: true - - name: 'ruleTupleCount' - type: Integer - description: | - Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples. - output: true diff --git a/mmv1/products/compute/FirewallPolicyRule.yaml b/mmv1/products/compute/FirewallPolicyRule.yaml index 4395443f3f18..bbe951b3e149 100644 --- a/mmv1/products/compute/FirewallPolicyRule.yaml +++ b/mmv1/products/compute/FirewallPolicyRule.yaml @@ -45,23 +45,14 @@ custom_code: post_update: 'templates/terraform/post_update/compute_firewall_policy_rule.go.tmpl' examples: - name: 'firewall_policy_rule' - primary_resource_id: 'primary' + primary_resource_id: 'policy_rule' vars: - address_group: 'address-group' + fw_policy: 'policy' + address: 'address' folder: 'folder' - fw_policy: 'fw-policy' test_env_vars: org_id: 'ORG_ID' - service_acct: 'SERVICE_ACCT' - - name: 'firewall_policy_rule_network_scope' - primary_resource_id: 'primary' - vars: - folder: 'folder' - fw_policy: 'fw-policy' - network: 'network' - test_env_vars: - org_id: 'ORG_ID' - min_version: beta + service_account: 'SERVICE_ACCT' parameters: - name: 'firewallPolicy' type: ResourceRef @@ -116,33 +107,6 @@ properties: CIDR IP address range. Maximum number of destination CIDR IP ranges allowed is 5000. item_type: type: String - - name: 'srcNetworkScope' - type: Enum - description: | - Network scope of the traffic source. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - - name: 'srcNetworks' - type: Array - description: | - Networks of the traffic source. It can be either a full or partial url. - min_version: beta - item_type: - type: String - - name: 'destNetworkScope' - type: Enum - description: | - Network scope of the traffic destination. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - name: 'layer4Configs' type: Array send_empty_value: true diff --git a/mmv1/products/compute/FirewallPolicyWithRules.yaml b/mmv1/products/compute/FirewallPolicyWithRules.yaml index ec241e0ae038..e9153e8a3bc7 100644 --- a/mmv1/products/compute/FirewallPolicyWithRules.yaml +++ b/mmv1/products/compute/FirewallPolicyWithRules.yaml @@ -40,13 +40,12 @@ custom_code: post_update: 'templates/terraform/post_update/resource_compute_firewall_policy_with_rules.go.tmpl' examples: - name: 'compute_firewall_policy_with_rules_full' - primary_resource_id: 'primary' + primary_resource_id: 'firewall-policy-with-rules' vars: - address_group: 'address-group' - fw_policy: 'fw-policy' - network: 'network' - security_profile: 'sp' - security_profile_group: 'spg' + policy_name: 'tf-fw-org-policy-with-rules' + address_group_name: 'tf-address-group' + security_profile_group_name: 'tf-security-profile-group' + security_profile_name: 'tf-security-profile' test_env_vars: org_id: 'ORG_ID' parameters: @@ -164,33 +163,6 @@ properties: min_version: 'beta' item_type: type: String - - name: 'srcNetworkScope' - type: Enum - description: | - Network scope of the traffic source. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - - name: 'srcNetworks' - type: Array - description: | - Networks of the traffic source. It can be either a full or partial url. - min_version: beta - item_type: - type: String - - name: 'destNetworkScope' - type: Enum - description: | - Network scope of the traffic destination. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - name: 'srcRegionCodes' type: Array description: | diff --git a/mmv1/products/compute/ForwardingRule.yaml b/mmv1/products/compute/ForwardingRule.yaml index 03649203c5c5..9d5f5e0325e9 100644 --- a/mmv1/products/compute/ForwardingRule.yaml +++ b/mmv1/products/compute/ForwardingRule.yaml @@ -47,13 +47,6 @@ custom_code: custom_diff: - 'forwardingRuleCustomizeDiff' legacy_long_form_project: true -sweeper: - url_substitutions: - - region: "us-west2" - - region: "us-central1" - - region: "europe-west4" - - region: "europe-west1" - - region: "us-west1" examples: - name: 'internal_http_lb_with_mig_backend' primary_resource_id: 'google_compute_forwarding_rule' @@ -99,19 +92,6 @@ examples: network_name: 'website-net' ignore_read_extra: - 'port_range' - - name: 'forwarding_rule_externallb_byoipv6' - primary_resource_id: 'default' - vars: - forwarding_rule_name: 'byoipv6-forwarding-rule' - backend_name: 'website-backend' - network_name: 'website-net' - ip_address: '"2600:1901:4457:1::/96"' - ip_collection_url: '"projects/tf-static-byoip/regions/us-central1/publicDelegatedPrefixes/tf-test-forwarding-rule-mode-pdp"' - test_vars_overrides: - ip_address: 'fmt.Sprintf("2600:1901:4457:1:%d:%d::/96", acctest.RandIntRange(t, 0, 9999), acctest.RandIntRange(t, 0, 9999))' - ip_collection_url: '"projects/tf-static-byoip/regions/us-central1/publicDelegatedPrefixes/tf-test-forwarding-rule-mode-pdp"' - ignore_read_extra: - - 'port_range' - name: 'forwarding_rule_global_internallb' primary_resource_id: 'default' vars: @@ -673,16 +653,3 @@ properties: enum_values: - 'IPV4' - 'IPV6' - - name: ipCollection - type: String - diff_suppress_func: 'IpCollectionDiffSuppress' - description: | - Resource reference of a PublicDelegatedPrefix. The PDP must be a sub-PDP - in EXTERNAL_IPV6_FORWARDING_RULE_CREATION mode. - Use one of the following formats to specify a sub-PDP when creating an - IPv6 NetLB forwarding rule using BYOIP: - Full resource URL, as in: - * `https://www.googleapis.com/compute/v1/projects/{{projectId}}/regions/{{region}}/publicDelegatedPrefixes/{{sub-pdp-name}}` - Partial URL, as in: - * `projects/{{projectId}}/regions/region/publicDelegatedPrefixes/{{sub-pdp-name}}` - * `regions/{{region}}/publicDelegatedPrefixes/{{sub-pdp-name}}` diff --git a/mmv1/products/compute/GlobalForwardingRule.yaml b/mmv1/products/compute/GlobalForwardingRule.yaml index a6b556d4c5a9..6f791325c80d 100644 --- a/mmv1/products/compute/GlobalForwardingRule.yaml +++ b/mmv1/products/compute/GlobalForwardingRule.yaml @@ -41,7 +41,6 @@ async: resource_inside_response: false collection_url_key: 'items' custom_code: - pre_create: 'templates/terraform/pre_create/compute_global_forwarding_rule.go.tmpl' post_create: 'templates/terraform/post_create/labels.tmpl' legacy_long_form_project: true examples: diff --git a/mmv1/products/compute/HaVpnGateway.yaml b/mmv1/products/compute/HaVpnGateway.yaml index a3b9e5f65f75..34e01079df17 100644 --- a/mmv1/products/compute/HaVpnGateway.yaml +++ b/mmv1/products/compute/HaVpnGateway.yaml @@ -169,21 +169,3 @@ properties: custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl' resource: 'InterconnectAttachment' imports: 'selfLink' - - name: 'labels' - type: KeyValueLabels - update_url: 'projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}/setLabels' - update_verb: 'POST' - description: | - Labels for this resource. These can only be added or modified by the setLabels method. - Each label key/value pair must comply with RFC1035. Label values may be empty. - - name: 'labelFingerprint' - type: Fingerprint - update_url: 'projects/{{project}}/regions/{{region}}/vpnGateways/{{name}}/setLabels' - update_verb: 'POST' - description: | - A fingerprint for the labels being applied to this VpnGateway, which is essentially a hash - of the labels set used for optimistic locking. The fingerprint is initially generated by - Compute Engine and changes after every request to modify or update labels. - You must always provide an up-to-date fingerprint hash in order to update or change labels, - otherwise the request will fail with error 412 conditionNotMet. - output: true diff --git a/mmv1/products/compute/InstanceTemplate.yaml b/mmv1/products/compute/InstanceTemplate.yaml deleted file mode 100644 index 9188c5b3f4f1..000000000000 --- a/mmv1/products/compute/InstanceTemplate.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: 'InstanceTemplate' -kind: 'compute#instanceTemplate' -description: | - Resource that enables a convenient way to save a virtual machine (VM) instance's configuration - that includes all of its properties and allows you to create a new instance from it. -base_url: 'projects/{{project}}/global/instanceTemplates' -has_self_link: true -exclude_resource: true -properties: - - name: 'name' - type: String - description: | - Name of the resource. - required: true - immutable: true -iam_policy: - parent_resource_attribute: 'name' - base_url: 'projects/{{project}}/global/instanceTemplates/{{name}}' - example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' - iam_conditions_request_type: 'QUERY_PARAM' - allowed_iam_role: 'roles/compute.instanceAdmin' -custom_code: -examples: - - name: 'instance_template_basic' - primary_resource_id: 'default' - primary_resource_name: 'fmt.Sprintf("tf-test-my-instance-template%s", context["random_suffix"])' - vars: - instance_name: 'my-instance-template' diff --git a/mmv1/products/compute/InterconnectAttachment.yaml b/mmv1/products/compute/InterconnectAttachment.yaml index 5c0404efeb12..a31185bfe08b 100644 --- a/mmv1/products/compute/InterconnectAttachment.yaml +++ b/mmv1/products/compute/InterconnectAttachment.yaml @@ -17,10 +17,6 @@ kind: 'compute#interconnectAttachment' description: | Represents an InterconnectAttachment (VLAN attachment) resource. For more information, see Creating VLAN Attachments. -references: - guides: - 'Create a Interconnect attachment': 'https://cloud.google.com/network-connectivity/docs/interconnect/how-to/dedicated/creating-vlan-attachments' - api: 'https://cloud.google.com/compute/docs/reference/rest/v1/interconnectAttachments' docs: base_url: 'projects/{{project}}/regions/{{region}}/interconnectAttachments' has_self_link: true @@ -134,7 +130,6 @@ properties: - 'BPS_10G' - 'BPS_20G' - 'BPS_50G' - - 'BPS_100G' - name: 'edgeAvailabilityDomain' type: String description: | @@ -336,21 +331,3 @@ properties: gives Google Cloud Support more debugging visibility. immutable: true ignore_read: true - - name: 'labels' - type: KeyValueLabels - update_url: 'projects/{{project}}/regions/{{region}}/interconnectAttachments/{{name}}/setLabels' - update_verb: 'POST' - description: | - Labels for this resource. These can only be added or modified by the setLabels - method. Each label key/value pair must comply with RFC1035. Label values may be empty. - - name: 'labelFingerprint' - type: Fingerprint - update_url: 'projects/{{project}}/regions/{{region}}/interconnectAttachments/{{name}}/setLabels' - update_verb: 'POST' - description: | - A fingerprint for the labels being applied to this Interconnect, which is essentially a hash - of the labels set used for optimistic locking. The fingerprint is initially generated by - Compute Engine and changes after every request to modify or update labels. - You must always provide an up-to-date fingerprint hash in order to update or change labels, - otherwise the request will fail with error 412 conditionNotMet. - output: true diff --git a/mmv1/products/compute/MachineImage.yaml b/mmv1/products/compute/MachineImage.yaml index 9e63a8482f9c..dab56f9c8e34 100644 --- a/mmv1/products/compute/MachineImage.yaml +++ b/mmv1/products/compute/MachineImage.yaml @@ -55,14 +55,13 @@ examples: - name: 'compute_machine_image_kms' primary_resource_id: 'image' primary_resource_name: 'fmt.Sprintf("tf-test-my-image%s", context["random_suffix"])' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com" - role: "roles/cloudkms.cryptoKeyEncrypterDecrypter" vars: vm_name: 'my-vm' image_name: 'my-image' key_name: 'key' keyring_name: 'keyring' + test_vars_overrides: + 'policyChanged': 'acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter")' parameters: properties: - name: 'name' diff --git a/mmv1/products/compute/Network.yaml b/mmv1/products/compute/Network.yaml index 2f9cf6e96b37..4e1032b0fbd8 100644 --- a/mmv1/products/compute/Network.yaml +++ b/mmv1/products/compute/Network.yaml @@ -60,18 +60,21 @@ examples: project: 'PROJECT_NAME' - name: 'network_bgp_best_path_selection_mode' primary_resource_id: 'vpc_network' + min_version: 'beta' vars: network_name: 'vpc-network' test_env_vars: project: 'PROJECT_NAME' - name: 'network_bgp_best_path_selection_mode_standard' primary_resource_id: 'vpc_network' + min_version: 'beta' vars: network_name: 'vpc-network' test_env_vars: project: 'PROJECT_NAME' - name: 'network_bgp_best_path_selection_mode_standard_custom_fields' primary_resource_id: 'vpc_network' + min_version: 'beta' vars: network_name: 'vpc-network' test_env_vars: @@ -165,6 +168,7 @@ properties: type: Enum description: | The BGP best selection algorithm to be employed. MODE can be LEGACY or STANDARD. + min_version: 'beta' default_from_api: true update_url: 'projects/{{project}}/global/networks/{{name}}' update_verb: 'PATCH' @@ -176,6 +180,7 @@ properties: description: | Enables/disables the comparison of MED across routes with different Neighbor ASNs. This value can only be set if the --bgp-best-path-selection-mode is STANDARD + min_version: 'beta' required: false default_from_api: true update_url: 'projects/{{project}}/global/networks/{{name}}' @@ -184,6 +189,7 @@ properties: type: Enum description: | Choice of the behavior of inter-regional cost and MED in the BPS algorithm. + min_version: 'beta' required: false default_from_api: true update_url: 'projects/{{project}}/global/networks/{{name}}' @@ -230,9 +236,10 @@ properties: - name: 'networkProfile' type: String immutable: true + min_version: 'beta' description: | A full or partial URL of the network profile to apply to this network. This field can be set only at resource creation time. For example, the following are valid URLs: - * https://www.googleapis.com/compute/v1/projects/{projectId}/global/networkProfiles/{network_profile_name} + * https://www.googleapis.com/compute/beta/projects/{projectId}/global/networkProfiles/{network_profile_name} * projects/{projectId}/global/networkProfiles/{network_profile_name} diff --git a/mmv1/products/compute/NetworkEndpointGroup.yaml b/mmv1/products/compute/NetworkEndpointGroup.yaml index 9ba059d1748f..0eabc08b86b1 100644 --- a/mmv1/products/compute/NetworkEndpointGroup.yaml +++ b/mmv1/products/compute/NetworkEndpointGroup.yaml @@ -51,9 +51,6 @@ async: collection_url_key: 'items' custom_code: constants: 'templates/terraform/constants/compute_network_endpoint_group.go.tmpl' -sweeper: - url_substitutions: - - zone: "us-central1-a" examples: - name: 'network_endpoint_group' primary_resource_id: 'neg' diff --git a/mmv1/products/compute/NetworkFirewallPolicyPacketMirroringRule.yaml b/mmv1/products/compute/NetworkFirewallPolicyPacketMirroringRule.yaml deleted file mode 100644 index 5631a6c00439..000000000000 --- a/mmv1/products/compute/NetworkFirewallPolicyPacketMirroringRule.yaml +++ /dev/null @@ -1,197 +0,0 @@ -# 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. - ---- -name: 'NetworkFirewallPolicyPacketMirroringRule' -api_resource_type_kind: FirewallPolicy -kind: 'compute#packetMirroringRule' -min_version: 'beta' -description: | - Represents a packet mirroring rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (mirror or do_not_mirror). -references: - guides: - api: 'https://cloud.google.com/compute/docs/reference/rest/beta/networkFirewallPolicies/addPacketMirroringRule' -docs: -id_format: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/packetMirroringRules/{{priority}}' -base_url: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}' -self_link: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/getPacketMirroringRule?priority={{priority}}' -create_url: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/addPacketMirroringRule' -update_url: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/patchPacketMirroringRule?priority={{priority}}' -update_verb: 'POST' -delete_url: 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/removePacketMirroringRule?priority={{priority}}' -delete_verb: 'POST' -legacy_long_form_project: true -import_format: - - 'projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/packetMirroringRules/{{priority}}' -timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 -async: - actions: ['create', 'delete', 'update'] - type: 'OpAsync' - operation: - base_url: '{{op_id}}' - result: - resource_inside_response: false -examples: - - name: 'compute_network_firewall_policy_packet_mirroring_rule' - primary_resource_id: 'primary' - vars: - fw_policy: 'fw-policy' - network_name: 'fw-network' - tag_key: 'tag-key' - tag_value: 'tag-value' - deployment_group_id: 'deployment-group' - endpoint_group_id: 'endpoint-group' - security_profile_name: 'sec-profile' - security_profile_group_name: 'sec-profile-group' - test_env_vars: - project_name: 'PROJECT_NAME' - org_id: 'ORG_ID' -parameters: - - name: 'firewallPolicy' - type: ResourceRef - description: | - The firewall policy of the resource. - url_param_only: true - required: true - immutable: true - diff_suppress_func: 'tpgresource.CompareResourceNames' - resource: 'NetworkFirewallPolicy' - imports: 'name' -properties: - - name: 'creationTimestamp' - type: String - description: | - Creation timestamp in RFC3339 text format. - output: true - - name: 'kind' - type: String - description: | - Type of the resource. Always `compute#packetMirroringRule` for firewall policy packet mirroring rules - output: true - - name: 'ruleName' - type: String - description: | - An optional name for the rule. This field is not a unique identifier and can be updated. - - name: 'description' - type: String - description: 'An optional description for this resource.' - - name: 'priority' - type: Integer - immutable: true - description: | - An integer indicating the priority of a rule in the list. - The priority must be a positive value between 0 and 2147483647. - Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. - required: true - - name: 'match' - type: NestedObject - description: | - A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. - required: true - properties: - - name: 'srcIpRanges' - type: Array - send_empty_value: true - description: | - CIDR IP address range. Maximum number of source CIDR IP ranges allowed is 5000. - item_type: - type: String - - name: 'destIpRanges' - type: Array - send_empty_value: true - description: | - CIDR IP address range. Maximum number of destination CIDR IP ranges allowed is 5000. - item_type: - type: String - - name: 'layer4Configs' - type: Array - send_empty_value: true - description: | - Pairs of IP protocols and ports that the rule should match. - required: true - item_type: - type: NestedObject - properties: - - name: 'ipProtocol' - type: String - description: | - The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. - This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. - required: true - - name: 'ports' - type: Array - description: | - An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. - Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. - item_type: - type: String - - name: 'action' - type: String - description: 'The Action to perform when the client connection triggers the rule. Valid actions are "mirror", "do_not_mirror", "goto_next".' - required: true - - name: 'securityProfileGroup' - type: String - description: | - A fully-qualified URL of a SecurityProfile resource instance. - Example: https://networksecurity.googleapis.com/v1/projects/{project}/locations/{location}/securityProfileGroups/my-security-profile-group - Must be specified if action = 'mirror' and cannot be specified for other actions. - - name: 'targetSecureTags' - type: Array - send_empty_value: true - description: | - A list of secure tags that controls which instances the firewall rule applies to. - If targetSecureTag are specified, then the firewall rule applies only to instances in the VPC network that have one of those EFFECTIVE secure tags, if all the targetSecureTag are in INEFFECTIVE state, then this rule will be ignored. - targetSecureTag may not be set at the same time as targetServiceAccounts. If neither targetServiceAccounts nor targetSecureTag are specified, the firewall rule applies to all instances on the specified network. Maximum number of target label tags allowed is 256. - item_type: - type: NestedObject - properties: - - name: 'name' - type: String - description: | - Name of the secure tag, created with TagManager's TagValue API. - diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' - - name: 'state' - type: Enum - description: | - State of the secure tag, either EFFECTIVE or INEFFECTIVE. A secure tag is INEFFECTIVE when it is deleted or its network is deleted. - output: true - enum_values: - - 'EFFECTIVE' - - 'INEFFECTIVE' - - name: 'tlsInspect' - type: Boolean - description: | - Boolean flag indicating if the traffic should be TLS decrypted. - Can be set only if action = 'mirror' and cannot be set for other actions. - - name: 'direction' - type: Enum - description: | - The direction in which this rule applies. - required: true - enum_values: - - 'INGRESS' - - 'EGRESS' - - name: 'ruleTupleCount' - type: Integer - description: | - Calculation of the complexity of a single firewall policy rule. - output: true - - name: 'disabled' - type: Boolean - description: | - Denotes whether the firewall policy rule is disabled. - When set to true, the firewall policy rule is not enforced and traffic behaves as if it did not exist. - If this is unspecified, the firewall policy rule will be enabled. diff --git a/mmv1/products/compute/NetworkFirewallPolicyRule.yaml b/mmv1/products/compute/NetworkFirewallPolicyRule.yaml index cc3e0f59ec74..9623c6bf980c 100644 --- a/mmv1/products/compute/NetworkFirewallPolicyRule.yaml +++ b/mmv1/products/compute/NetworkFirewallPolicyRule.yaml @@ -49,30 +49,14 @@ examples: - name: 'network_firewall_policy_rule' primary_resource_id: 'primary' vars: - address_group: 'address-group' - fw_policy: 'fw-policy' + tag_key: 'tagkey' network: 'network' - tag_key: 'tag-key' - tag_value: 'tag-value' + fw_policy: 'policy' + address: 'address' test_env_vars: - org_id: 'ORG_ID' project_name: 'PROJECT_NAME' + org_id: 'ORG_ID' service_acct: 'SERVICE_ACCT' - - name: 'network_firewall_policy_rule_network_scope_egress' - primary_resource_id: 'primary' - vars: - fw_policy: 'fw-policy' - test_env_vars: - project_name: 'PROJECT_NAME' - min_version: beta - - name: 'network_firewall_policy_rule_network_scope_ingress' - primary_resource_id: 'primary' - vars: - fw_policy: 'fw-policy' - network: 'network' - test_env_vars: - project_name: 'PROJECT_NAME' - min_version: beta parameters: - name: 'firewallPolicy' type: ResourceRef @@ -130,33 +114,6 @@ properties: CIDR IP address range. Maximum number of destination CIDR IP ranges allowed is 5000. item_type: type: String - - name: 'srcNetworkScope' - type: Enum - description: | - Network scope of the traffic source. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - - name: 'srcNetworks' - type: Array - description: | - Networks of the traffic source. It can be either a full or partial url. - min_version: beta - item_type: - type: String - - name: 'destNetworkScope' - type: Enum - description: | - Network scope of the traffic destination. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - name: 'layer4Configs' type: Array send_empty_value: true diff --git a/mmv1/products/compute/NetworkFirewallPolicyWithRules.yaml b/mmv1/products/compute/NetworkFirewallPolicyWithRules.yaml index 5e4f5a5b2c50..fd53efd404f6 100644 --- a/mmv1/products/compute/NetworkFirewallPolicyWithRules.yaml +++ b/mmv1/products/compute/NetworkFirewallPolicyWithRules.yaml @@ -41,15 +41,14 @@ custom_code: legacy_long_form_project: true examples: - name: 'compute_network_firewall_policy_with_rules_full' - primary_resource_id: 'primary' + primary_resource_id: 'network-firewall-policy-with-rules' vars: - address_group: 'address-group' - fw_policy: 'fw-policy' - network: 'network' - tag_key: 'tag-key' - tag_value: 'tag-value' - security_profile_group: 'spg' - security_profile: 'sp' + policy_name: 'tf-fw-policy-with-rules' + address_group_name: 'tf-address-group' + tag_key_name: 'tf-tag-key' + tag_value_name: 'tf-tag-value' + security_profile_group_name: 'tf-security-profile-group' + security_profile_name: 'tf-security-profile' test_env_vars: org_id: 'ORG_ID' parameters: @@ -185,33 +184,6 @@ properties: min_version: 'beta' item_type: type: String - - name: 'srcNetworkScope' - type: Enum - description: | - Network scope of the traffic source. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - - name: 'srcNetworks' - type: Array - description: | - Networks of the traffic source. It can be either a full or partial url. - min_version: beta - item_type: - type: String - - name: 'destNetworkScope' - type: Enum - description: | - Network scope of the traffic destination. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - name: 'srcThreatIntelligences' type: Array description: | diff --git a/mmv1/products/compute/NodeGroup.yaml b/mmv1/products/compute/NodeGroup.yaml index 326a1c13d986..46a52682e294 100644 --- a/mmv1/products/compute/NodeGroup.yaml +++ b/mmv1/products/compute/NodeGroup.yaml @@ -40,10 +40,6 @@ async: collection_url_key: 'items' custom_code: pre_create: 'templates/terraform/pre_create/compute_node_group_url_replace.go.tmpl' -sweeper: - url_substitutions: - - zone: "us-central1-f" - - zone: "us-central1-a" examples: - name: 'node_group_basic' primary_resource_id: 'nodes' diff --git a/mmv1/products/compute/PerInstanceConfig.yaml b/mmv1/products/compute/PerInstanceConfig.yaml index 19bcdeb2d348..f14ab742b838 100644 --- a/mmv1/products/compute/PerInstanceConfig.yaml +++ b/mmv1/products/compute/PerInstanceConfig.yaml @@ -31,7 +31,7 @@ update_verb: 'POST' read_verb: 'POST' delete_url: 'projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/deletePerInstanceConfigs' delete_verb: 'POST' -mutex: 'instanceGroupManager/{{project}}/{{zone}}/{{instance_group_manager}}/{{name}}' +mutex: 'instanceGroupManager/{{project}}/{{zone}}/{{instance_group_manager}}' timeouts: insert_minutes: 20 update_minutes: 20 diff --git a/mmv1/products/compute/PublicAdvertisedPrefix.yaml b/mmv1/products/compute/PublicAdvertisedPrefix.yaml index 7bb00b7ba536..e21d5e9dd786 100644 --- a/mmv1/products/compute/PublicAdvertisedPrefix.yaml +++ b/mmv1/products/compute/PublicAdvertisedPrefix.yaml @@ -45,15 +45,6 @@ examples: # PAPs have very low quota limits and a shared testing range so serialized tests exist in: # resource_compute_public_advertised_prefix_test.go exclude_test: true - - name: 'public_advertised_prefixes_pdp_scope' - primary_resource_id: 'prefixes' - vars: - prefixes_name: 'my-pap' - test_env_vars: - desc: 'PAP_DESCRIPTION' - # PAPs have very low quota limits and a shared testing range so serialized tests exist in: - # resource_compute_public_advertised_prefix_test.go - exclude_test: true parameters: properties: - name: 'description' @@ -76,21 +67,9 @@ properties: - name: 'ipCidrRange' type: String description: - The address range, in CIDR format, represented by this public advertised - prefix. + The IPv4 address range, in CIDR format, represented by this public + advertised prefix. required: true - - name: 'pdpScope' - type: Enum - description: | - Specifies how child public delegated prefix will be scoped. pdpScope - must be one of: GLOBAL, REGIONAL - * REGIONAL: The public delegated prefix is regional only. The - provisioning will take a few minutes. - * GLOBAL: The public delegated prefix is global only. The provisioning - will take ~4 weeks. - enum_values: - - 'GLOBAL' - - 'REGIONAL' - name: 'sharedSecret' type: String description: | diff --git a/mmv1/products/compute/PublicDelegatedPrefix.yaml b/mmv1/products/compute/PublicDelegatedPrefix.yaml index 4c1d518255b5..966f528f0cb6 100644 --- a/mmv1/products/compute/PublicDelegatedPrefix.yaml +++ b/mmv1/products/compute/PublicDelegatedPrefix.yaml @@ -35,10 +35,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us-west1" examples: - name: 'public_delegated_prefixes_basic' primary_resource_id: 'prefixes' @@ -49,16 +45,6 @@ examples: # PAPs have very low quota limits and a shared testing range so serialized tests exist in: # resource_compute_public_advertised_prefix_test.go exclude_test: true - - name: 'public_delegated_prefixes_ipv6' - vars: - pap_name: "ipv6-pap" - root_pdp_name: "ipv6-root-pdp" - sub_pdp_name: "ipv6-sub-pdp" - test_env_vars: - desc: 'PAP_DESCRIPTION' - # PAPs have very low quota limits and a shared testing range so serialized tests exist in: - # resource_compute_public_advertised_prefix_test.go - exclude_test: true parameters: properties: - name: 'region' @@ -89,23 +75,9 @@ properties: PublicDelegatedPrefix. required: true diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' - - name: 'mode' - type: Enum - description: | - Specifies the mode of this IPv6 PDP. MODE must be one of: DELEGATION, - EXTERNAL_IPV6_FORWARDING_RULE_CREATION. - enum_values: - - 'DELEGATION' - - 'EXTERNAL_IPV6_FORWARDING_RULE_CREATION' - - name: 'allocatablePrefixLength' - type: Integer - description: - The allocatable prefix length supported by this public delegated prefix. - This field is optional and cannot be set for prefixes in DELEGATION mode. - It cannot be set for IPv4 prefixes either, and it always defaults to 32. - name: 'ipCidrRange' type: String description: - The IP address range, in CIDR format, represented by this public - delegated prefix. + The IPv4 address range, in CIDR format, represented by this public + advertised prefix. required: true diff --git a/mmv1/products/compute/RegionBackendService.yaml b/mmv1/products/compute/RegionBackendService.yaml index d91c2e40feac..cfb7ba08c9d8 100644 --- a/mmv1/products/compute/RegionBackendService.yaml +++ b/mmv1/products/compute/RegionBackendService.yaml @@ -52,13 +52,6 @@ custom_diff: - 'customDiffRegionBackendService' schema_version: 1 migrate_state: 'tpgresource.MigrateStateNoop' -sweeper: - url_substitutions: - - region: "us-west2" - - region: "us-central1" - - region: "europe-west4" - - region: "europe-west1" - - region: "us-west1" examples: - name: 'region_backend_service_basic' primary_resource_id: 'default' diff --git a/mmv1/products/compute/RegionHealthCheck.yaml b/mmv1/products/compute/RegionHealthCheck.yaml index 4055dc74b083..ee4539a3f069 100644 --- a/mmv1/products/compute/RegionHealthCheck.yaml +++ b/mmv1/products/compute/RegionHealthCheck.yaml @@ -50,12 +50,6 @@ custom_code: encoder: 'templates/terraform/encoders/health_check_type.tmpl' custom_diff: - 'healthCheckCustomizeDiff' -sweeper: - url_substitutions: - - region: "us-central1" - - region: "europe-west4" - - region: "europe-west1" - - region: "us-west1" examples: - name: 'region_health_check_tcp' primary_resource_id: 'tcp-region-health-check' diff --git a/mmv1/products/compute/RegionNetworkEndpointGroup.yaml b/mmv1/products/compute/RegionNetworkEndpointGroup.yaml index 0c863c980b2a..cd8273905e6f 100644 --- a/mmv1/products/compute/RegionNetworkEndpointGroup.yaml +++ b/mmv1/products/compute/RegionNetworkEndpointGroup.yaml @@ -44,11 +44,6 @@ async: resource_inside_response: false collection_url_key: 'items' custom_code: -sweeper: - url_substitutions: - - region: "us-central1" - - region: "europe-west4" - - region: "asia-northeast3" examples: - name: 'region_network_endpoint_group_functions' primary_resource_id: 'function_neg' diff --git a/mmv1/products/compute/RegionNetworkFirewallPolicyRule.yaml b/mmv1/products/compute/RegionNetworkFirewallPolicyRule.yaml index 08c7290e7764..f093312f413e 100644 --- a/mmv1/products/compute/RegionNetworkFirewallPolicyRule.yaml +++ b/mmv1/products/compute/RegionNetworkFirewallPolicyRule.yaml @@ -52,35 +52,15 @@ examples: - name: 'region_network_firewall_policy_rule' primary_resource_id: 'primary' vars: - address_group: 'address-group' - fw_policy: 'fw-policy' + tag_key: 'tagkey' network: 'network' - tag_key: 'tag-key' - tag_value: 'tag-value' + fw_policy: 'policy' + address: 'address' test_env_vars: - org_id: 'ORG_ID' project_name: 'PROJECT_NAME' - region: 'REGION' - service_acct: 'SERVICE_ACCT' - - name: 'region_network_firewall_policy_rule_network_scope_egress' - primary_resource_id: 'primary' - vars: - fw_policy: 'fw-policy' - test_env_vars: org_id: 'ORG_ID' - project_name: 'PROJECT_NAME' region: 'REGION' - min_version: beta - - name: 'region_network_firewall_policy_rule_network_scope_ingress' - primary_resource_id: 'primary' - vars: - fw_policy: 'fw-policy' - network: 'network' - test_env_vars: - org_id: 'ORG_ID' - project_name: 'PROJECT_NAME' - region: 'REGION' - min_version: beta + service_acct: 'SERVICE_ACCT' parameters: - name: 'firewallPolicy' type: ResourceRef @@ -144,33 +124,6 @@ properties: CIDR IP address range. Maximum number of destination CIDR IP ranges allowed is 5000. item_type: type: String - - name: 'srcNetworkScope' - type: Enum - description: | - Network scope of the traffic source. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - - name: 'srcNetworks' - type: Array - description: | - Networks of the traffic source. It can be either a full or partial url. - min_version: beta - item_type: - type: String - - name: 'destNetworkScope' - type: Enum - description: | - Network scope of the traffic destination. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - name: 'layer4Configs' type: Array send_empty_value: true diff --git a/mmv1/products/compute/RegionNetworkFirewallPolicyWithRules.yaml b/mmv1/products/compute/RegionNetworkFirewallPolicyWithRules.yaml index 6dbaa6561153..e5c5957e0f4f 100644 --- a/mmv1/products/compute/RegionNetworkFirewallPolicyWithRules.yaml +++ b/mmv1/products/compute/RegionNetworkFirewallPolicyWithRules.yaml @@ -39,18 +39,14 @@ custom_code: decoder: 'templates/terraform/decoders/resource_compute_region_network_firewall_policy_with_rules.go.tmpl' post_create: 'templates/terraform/post_create/resource_compute_region_network_firewall_policy_with_rules.go.tmpl' legacy_long_form_project: true -sweeper: - url_substitutions: - - region: "us-west2" examples: - name: 'compute_region_network_firewall_policy_with_rules_full' - primary_resource_id: 'primary' + primary_resource_id: 'region-network-firewall-policy-with-rules' vars: - address_group: 'address-group' - network: 'network' - fw_policy: 'fw-policy' - tag_key: 'tag-key' - tag_value: 'tag-value' + policy_name: 'tf-region-fw-policy-with-rules' + address_group_name: 'tf-address-group' + tag_key_name: 'tf-tag-key' + tag_value_name: 'tf-tag-value' test_env_vars: org_id: 'ORG_ID' parameters: @@ -173,33 +169,6 @@ properties: min_version: 'beta' item_type: type: String - - name: 'srcNetworkScope' - type: Enum - description: | - Network scope of the traffic source. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - - name: 'srcNetworks' - type: Array - description: | - Networks of the traffic source. It can be either a full or partial url. - min_version: beta - item_type: - type: String - - name: 'destNetworkScope' - type: Enum - description: | - Network scope of the traffic destination. - min_version: beta - enum_values: - - 'INTERNET' - - 'INTRA_VPC' - - 'NON_INTERNET' - - 'VPC_NETWORKS' - name: 'srcRegionCodes' type: Array description: | diff --git a/mmv1/products/compute/RegionPerInstanceConfig.yaml b/mmv1/products/compute/RegionPerInstanceConfig.yaml index 0521361d6af3..ab079b507d70 100644 --- a/mmv1/products/compute/RegionPerInstanceConfig.yaml +++ b/mmv1/products/compute/RegionPerInstanceConfig.yaml @@ -32,7 +32,7 @@ update_verb: 'POST' read_verb: 'POST' delete_url: 'projects/{{project}}/regions/{{region}}/instanceGroupManagers/{{region_instance_group_manager}}/deletePerInstanceConfigs' delete_verb: 'POST' -mutex: 'instanceGroupManager/{{project}}/{{region}}/{{region_instance_group_manager}}/{{name}}' +mutex: 'instanceGroupManager/{{project}}/{{region}}/{{region_instance_group_manager}}' timeouts: insert_minutes: 20 update_minutes: 20 diff --git a/mmv1/products/compute/RegionResizeRequest.yaml b/mmv1/products/compute/RegionResizeRequest.yaml index 7772107026e8..cb3df249ab29 100644 --- a/mmv1/products/compute/RegionResizeRequest.yaml +++ b/mmv1/products/compute/RegionResizeRequest.yaml @@ -57,11 +57,9 @@ parameters: - name: 'region' type: ResourceRef description: | - The reference of the compute region scoping this request. If it is not provided, the provider region is used. - custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' - custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl' - default_from_api: true - required: false + The reference of the compute region scoping this request. + url_param_only: true + required: true resource: 'Region' imports: 'name' - name: 'instanceGroupManager' diff --git a/mmv1/products/compute/RegionSecurityPolicy.yaml b/mmv1/products/compute/RegionSecurityPolicy.yaml index a4ac918af585..f5dad0221dba 100644 --- a/mmv1/products/compute/RegionSecurityPolicy.yaml +++ b/mmv1/products/compute/RegionSecurityPolicy.yaml @@ -40,15 +40,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-south1" - - region: "us-west2" - - region: "us-west1" - - region: "asia-southeast1" - - region: "europe-west1" - - region: "southamerica-west1" - - region: "us-central1" examples: - name: 'region_security_policy_basic' primary_resource_id: 'region-sec-policy-basic' diff --git a/mmv1/products/compute/RegionTargetHttpProxy.yaml b/mmv1/products/compute/RegionTargetHttpProxy.yaml index 1464848adeb7..54164f8d6e4b 100644 --- a/mmv1/products/compute/RegionTargetHttpProxy.yaml +++ b/mmv1/products/compute/RegionTargetHttpProxy.yaml @@ -37,11 +37,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-central1" - - region: "europe-west1" - - region: "us-west1" examples: - name: 'region_target_http_proxy_basic' primary_resource_id: 'default' diff --git a/mmv1/products/compute/RegionTargetHttpsProxy.yaml b/mmv1/products/compute/RegionTargetHttpsProxy.yaml index 5b32d4d5d928..6c8325ddfc86 100644 --- a/mmv1/products/compute/RegionTargetHttpsProxy.yaml +++ b/mmv1/products/compute/RegionTargetHttpsProxy.yaml @@ -120,8 +120,8 @@ properties: # This field is present in the schema but as of 2019 Sep 23 attempting to set it fails with # a 400 "QUIC override is supported only with global TargetHttpsProxy". jamessynge@ said in an # email sent on 2019 Sep 20 that support for this "is probably far in the future." + # - !ruby/object:Api::Type::Enum # name: 'quicOverride' - # type: Enum # description: | # Specifies the QUIC override policy for this resource. This determines # whether the load balancer will attempt to negotiate QUIC with clients @@ -129,10 +129,10 @@ properties: # specified, uses the QUIC policy with no user overrides, which is # equivalent to DISABLE. Not specifying this field is equivalent to # specifying NONE. - # enum_values: - # - 'NONE' - # - 'ENABLE' - # - 'DISABLE' + # values: + # - :NONE + # - :ENABLE + # - :DISABLE # update_verb: :POST # update_url: # 'projects/{{project}}/regions/{{region}}/targetHttpsProxies/{{name}}/setQuicOverride' diff --git a/mmv1/products/compute/RegionTargetTcpProxy.yaml b/mmv1/products/compute/RegionTargetTcpProxy.yaml index 7ba50f7e8ebb..46917a6079f8 100644 --- a/mmv1/products/compute/RegionTargetTcpProxy.yaml +++ b/mmv1/products/compute/RegionTargetTcpProxy.yaml @@ -38,10 +38,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "europe-west4" - - region: "us-central1" examples: - name: 'region_target_tcp_proxy_basic' primary_resource_id: 'default' diff --git a/mmv1/products/compute/RegionUrlMap.yaml b/mmv1/products/compute/RegionUrlMap.yaml index 5d6689b7dc0c..1d8c982b4a28 100644 --- a/mmv1/products/compute/RegionUrlMap.yaml +++ b/mmv1/products/compute/RegionUrlMap.yaml @@ -34,11 +34,6 @@ async: resource_inside_response: false collection_url_key: 'items' custom_code: -sweeper: - url_substitutions: - - region: "us-central1" - - region: "europe-west1" - - region: "us-west1" examples: - name: 'region_url_map_basic' primary_resource_id: 'regionurlmap' diff --git a/mmv1/products/compute/Reservation.yaml b/mmv1/products/compute/Reservation.yaml index c21e08c7c7ac..4c2e3cc13b83 100644 --- a/mmv1/products/compute/Reservation.yaml +++ b/mmv1/products/compute/Reservation.yaml @@ -47,11 +47,6 @@ collection_url_key: 'items' custom_code: update_encoder: 'templates/terraform/update_encoder/reservation.go.tmpl' pre_update: 'templates/terraform/pre_update/shared_reservation_update.go.tmpl' -sweeper: - url_substitutions: - - zone: "us-central1-a" - - zone: "us-west1-a" - - zone: "us-central1-f" examples: - name: 'reservation_basic' primary_resource_id: 'gce_reservation' diff --git a/mmv1/products/compute/ResizeRequest.yaml b/mmv1/products/compute/ResizeRequest.yaml index 59f325b892c1..5699b79eb46b 100644 --- a/mmv1/products/compute/ResizeRequest.yaml +++ b/mmv1/products/compute/ResizeRequest.yaml @@ -63,11 +63,9 @@ parameters: - name: 'zone' type: ResourceRef description: | - The reference of the compute zone scoping this request. If it is not provided, the provider zone is used. - custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' - custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl' - default_from_api: true - required: false + The reference of the compute zone scoping this request. + url_param_only: true + required: true resource: 'Zone' imports: 'name' - name: 'instanceGroupManager' diff --git a/mmv1/products/compute/ResourcePolicy.yaml b/mmv1/products/compute/ResourcePolicy.yaml index dd6a7a12a085..b71acc2def9c 100644 --- a/mmv1/products/compute/ResourcePolicy.yaml +++ b/mmv1/products/compute/ResourcePolicy.yaml @@ -38,11 +38,6 @@ async: collection_url_key: 'items' custom_code: constants: 'templates/terraform/constants/compute_resource_policy.go.tmpl' -sweeper: - url_substitutions: - - region: "us-east4" - - region: "us-central1" - - region: "europe-west1" examples: - name: 'resource_policy_basic' primary_resource_id: 'foo' diff --git a/mmv1/products/compute/ResourcePolicyAttachment.yaml b/mmv1/products/compute/ResourcePolicyAttachment.yaml new file mode 100644 index 000000000000..e94b5762775b --- /dev/null +++ b/mmv1/products/compute/ResourcePolicyAttachment.yaml @@ -0,0 +1,93 @@ +# 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. + +--- +name: 'ResourcePolicyAttachment' +api_resource_type_kind: Instance +description: 'Attaches resource policies to compute instances' +id_format: '{{project}}/{{zone}}/{{instance}}/{{name}}' +base_url: 'projects/{{project}}/zones/{{zone}}/instances/{{instance}}' +self_link: 'projects/{{project}}/zones/{{zone}}/instances/{{instance}}' +create_url: 'projects/{{project}}/zones/{{zone}}/instances/{{instance}}/addResourcePolicies' +delete_url: 'projects/{{project}}/zones/{{zone}}/instances/{{instance}}/removeResourcePolicies' +delete_verb: 'POST' +immutable: true + +timeouts: + insert_minutes: 20 + delete_minutes: 20 + +async: + actions: ['create', 'delete'] + type: 'OpAsync' + operation: + base_url: '{{op_id}}' + result: + resource_inside_response: false + +identity: + - name + +nested_query: + keys: + - resourcePolicies + is_list_of_ids: true + modify_by_patch: false + +custom_code: + encoder: 'templates/terraform/encoders/compute_resource_policy_attachment.go.tmpl' + decoder: 'templates/terraform/decoders/compute_resource_policy_attachment.go.tmpl' + pre_delete: 'templates/terraform/pre_delete/compute_resource_policy_attachment.go.tmpl' + +parameters: + - name: 'instance' + type: ResourceRef + required: true + resource: 'Instance' + imports: 'name' + - name: 'zone' + type: ResourceRef + required: true + resource: 'Zone' + imports: 'name' + +properties: + - name: 'name' + type: String + required: true + immutable: true + +examples: + - name: "compute_resource_policy_attachment_basic" + primary_resource_id: "policy_attachment" + skip_vcr: true + vars: + instance_name: "test-attachment-instance" + policy_name: "test-attachment-policy" + zone: "us-central1-a" + test_vars_overrides: + instance_name: 'fmt.Sprintf("tf-test-attachment-%s", randString(t, 10))' + policy_name: 'fmt.Sprintf("tf-test-policy-%s", randString(t, 10))' + zone: 'getTestZoneFromEnv()' + - name: "compute_resource_policy_attachment_full" + primary_resource_id: "policy_attachment_full" + skip_vcr: true + min_version: beta + vars: + instance_name: "test-attachment-instance-full" + policy_name: "test-attachment-policy-full" + zone: "us-central1-a" + test_vars_overrides: + instance_name: 'fmt.Sprintf("tf-test-attachment-full-%s", acctest.RandString(t, 10))' + policy_name: 'fmt.Sprintf("tf-test-policy-full-%s", acctest.RandString(t, 10))' + zone: 'acctest.GetTestZoneFromEnv()' \ No newline at end of file diff --git a/mmv1/products/compute/Route.yaml b/mmv1/products/compute/Route.yaml index bce812547f4d..ebdd902e21e6 100644 --- a/mmv1/products/compute/Route.yaml +++ b/mmv1/products/compute/Route.yaml @@ -225,16 +225,19 @@ properties: type: String description: | Indicates the origin of the route. Can be IGP (Interior Gateway Protocol), EGP (Exterior Gateway Protocol), or INCOMPLETE. + min_version: 'beta' output: true - name: 'nextHopMed' type: String description: | Multi-Exit Discriminator, a BGP route metric that indicates the desirability of a particular route in a network. + min_version: 'beta' output: true - name: 'nextHopInterRegionCost' type: String description: | Internal fixed region-to-region cost that Google Cloud calculates based on factors such as network performance, distance, and available bandwidth between regions. + min_version: 'beta' output: true - name: 'nextHopIlb' type: String diff --git a/mmv1/products/compute/Router.yaml b/mmv1/products/compute/Router.yaml index df66548b15a6..1b231c1019d6 100644 --- a/mmv1/products/compute/Router.yaml +++ b/mmv1/products/compute/Router.yaml @@ -44,11 +44,6 @@ custom_code: constants: 'templates/terraform/constants/router.go.tmpl' custom_diff: - 'resourceComputeRouterCustomDiff' -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us-east1" - - region: "us-east4" examples: - name: 'router_basic' primary_resource_id: 'foobar' diff --git a/mmv1/products/compute/SecurityPolicyRule.yaml b/mmv1/products/compute/SecurityPolicyRule.yaml index af2d0ffde23a..07d958ec6aee 100644 --- a/mmv1/products/compute/SecurityPolicyRule.yaml +++ b/mmv1/products/compute/SecurityPolicyRule.yaml @@ -104,16 +104,16 @@ properties: Textual representation of an expression in Common Expression Language syntax. The application context of the containing message determines which well-known feature set of CEL is supported. required: true # >> These fields are not yet supported, following the global security policy resource. + # - !ruby/object:Api::Type::String # name: 'title' - # type: String # description: | # Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. + # - !ruby/object:Api::Type::String # name: 'description' - # type: String # description: | # Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. + # - !ruby/object:Api::Type::String # name: 'location' - # type: String # description: | # Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. - name: 'exprOptions' diff --git a/mmv1/products/compute/ServiceAttachment.yaml b/mmv1/products/compute/ServiceAttachment.yaml index 4813b6d0f765..f0e27bee6dec 100644 --- a/mmv1/products/compute/ServiceAttachment.yaml +++ b/mmv1/products/compute/ServiceAttachment.yaml @@ -38,12 +38,6 @@ async: custom_code: constants: 'templates/terraform/constants/compute_service_attachment.go.tmpl' update_encoder: 'templates/terraform/update_encoder/compute_service_attachment.go.tmpl' -sweeper: - url_substitutions: - - region: "us-west2" - - region: "us-central1" - - region: "europe-west4" - - region: "us-east1" examples: - name: 'service_attachment_basic' primary_resource_id: 'psc_ilb_service_attachment' diff --git a/mmv1/products/compute/Snapshot.yaml b/mmv1/products/compute/Snapshot.yaml index 663500f12608..a6447df32eee 100644 --- a/mmv1/products/compute/Snapshot.yaml +++ b/mmv1/products/compute/Snapshot.yaml @@ -60,9 +60,6 @@ iam_policy: custom_code: decoder: 'templates/terraform/decoders/snapshot.go.tmpl' pre_create: 'templates/terraform/pre_create/compute_snapshot_precreate_url.go.tmpl' -sweeper: - url_substitutions: - - zone: "us-central1-a" examples: - name: 'snapshot_basic' primary_resource_id: 'snapshot' diff --git a/mmv1/products/compute/Subnetwork.yaml b/mmv1/products/compute/Subnetwork.yaml index 3b48710ae7d3..6aa5959546ea 100644 --- a/mmv1/products/compute/Subnetwork.yaml +++ b/mmv1/products/compute/Subnetwork.yaml @@ -70,16 +70,6 @@ custom_code: custom_diff: - 'customdiff.ForceNewIfChange("ip_cidr_range", IsShrinkageIpCidr)' - 'sendSecondaryIpRangeIfEmptyDiff' -sweeper: - url_substitutions: - - region: "us-west2" - - region: "us-central1" - - region: "us-east1" - - region: "europe-west4" - - region: "europe-west1" - - region: "southamerica-west1" - - region: "us-west1" - - region: "us-south1" examples: - name: 'subnetwork_basic' primary_resource_id: 'network-with-private-secondary-ip-ranges' @@ -227,11 +217,10 @@ properties: - name: 'purpose' type: String description: | - The purpose of the resource. This field can be either `PRIVATE`, `REGIONAL_MANAGED_PROXY`, `GLOBAL_MANAGED_PROXY`, `PRIVATE_SERVICE_CONNECT`, `PEER_MIGRATION` or `PRIVATE_NAT`([Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)). + The purpose of the resource. This field can be either `PRIVATE`, `REGIONAL_MANAGED_PROXY`, `GLOBAL_MANAGED_PROXY`, `PRIVATE_SERVICE_CONNECT` or `PRIVATE_NAT`([Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)). A subnet with purpose set to `REGIONAL_MANAGED_PROXY` is a user-created subnetwork that is reserved for regional Envoy-based load balancers. A subnetwork in a given region with purpose set to `GLOBAL_MANAGED_PROXY` is a proxy-only subnet and is shared between all the cross-regional Envoy-based load balancers. A subnetwork with purpose set to `PRIVATE_SERVICE_CONNECT` reserves the subnet for hosting a Private Service Connect published service. - A subnetwork with purpose set to `PEER_MIGRATION` is a user created subnetwork that is reserved for migrating resources from one peered network to another. A subnetwork with purpose set to `PRIVATE_NAT` is used as source range for Private NAT gateways. Note that `REGIONAL_MANAGED_PROXY` is the preferred setting for all regional Envoy load balancers. If unspecified, the purpose defaults to `PRIVATE`. diff --git a/mmv1/products/compute/TargetInstance.yaml b/mmv1/products/compute/TargetInstance.yaml index 686d7298db73..a0370e569255 100644 --- a/mmv1/products/compute/TargetInstance.yaml +++ b/mmv1/products/compute/TargetInstance.yaml @@ -43,9 +43,6 @@ async: collection_url_key: 'items' custom_code: post_create: 'templates/terraform/post_create/compute_target_instance_security_policy.go.tmpl' -sweeper: - url_substitutions: - - zone: "southamerica-west1-a" examples: - name: 'target_instance_basic' primary_resource_id: 'default' diff --git a/mmv1/products/compute/UrlMap.yaml b/mmv1/products/compute/UrlMap.yaml index c1a3e5ca7111..36371f2de68d 100644 --- a/mmv1/products/compute/UrlMap.yaml +++ b/mmv1/products/compute/UrlMap.yaml @@ -19,7 +19,6 @@ description: | that you define for the host and path of an incoming URL. references: guides: - 'Official Documentation': 'https://cloud.google.com/load-balancing/docs/url-map-concepts' api: 'https://cloud.google.com/compute/docs/reference/rest/v1/urlMaps' docs: base_url: 'projects/{{project}}/global/urlMaps' diff --git a/mmv1/products/databasemigrationservice/MigrationJob.yaml b/mmv1/products/databasemigrationservice/MigrationJob.yaml index 20afc6228b9d..0dce9d4e2529 100644 --- a/mmv1/products/databasemigrationservice/MigrationJob.yaml +++ b/mmv1/products/databasemigrationservice/MigrationJob.yaml @@ -155,7 +155,6 @@ properties: description: | A list of messages that carry the error details. output: true - custom_flatten: 'templates/terraform/custom_flatten/dms_migration_job_error_details.tmpl' item_type: type: KeyValuePairs - name: 'type' diff --git a/mmv1/products/datacatalog/Taxonomy.yaml b/mmv1/products/datacatalog/Taxonomy.yaml index 775203f97a31..7c4d2ecff7e3 100644 --- a/mmv1/products/datacatalog/Taxonomy.yaml +++ b/mmv1/products/datacatalog/Taxonomy.yaml @@ -43,7 +43,7 @@ iam_policy: custom_code: custom_import: 'templates/terraform/custom_import/data_catalog_taxonomy.go.tmpl' sweeper: - identifier_field: displayName + sweepable_identifier_field: displayName examples: - name: 'data_catalog_taxonomy_basic' primary_resource_id: 'basic_taxonomy' diff --git a/mmv1/products/datacatalog/product.yaml b/mmv1/products/datacatalog/product.yaml index a72d1336c7f9..e6e305dad648 100644 --- a/mmv1/products/datacatalog/product.yaml +++ b/mmv1/products/datacatalog/product.yaml @@ -13,7 +13,7 @@ --- name: 'DataCatalog' -display_name: 'Data Catalog' +display_name: 'Data catalog' versions: - name: 'ga' base_url: 'https://datacatalog.googleapis.com/v1/' diff --git a/mmv1/products/datafusion/Instance.yaml b/mmv1/products/datafusion/Instance.yaml index 4d05edb96bc7..ee2006f4623f 100644 --- a/mmv1/products/datafusion/Instance.yaml +++ b/mmv1/products/datafusion/Instance.yaml @@ -45,11 +45,6 @@ iam_policy: custom_code: constants: 'templates/terraform/constants/data_fusion_instance_option.go.tmpl' pre_update: 'templates/terraform/pre_update/datafusion_instance_update.go.tmpl' -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us-central1" - zone: "us-central1-a" examples: - name: 'data_fusion_instance_basic' primary_resource_id: 'basic_instance' @@ -60,6 +55,7 @@ examples: test_vars_overrides: # Mark for testing to avoid service networking connection usage that is not cleaned up 'prober_test_run': '`options = { prober_test_run = "true" }`' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20574 - name: 'data_fusion_instance_full' primary_resource_id: 'extended_instance' vars: @@ -70,6 +66,7 @@ examples: test_vars_overrides: # Mark for testing to avoid service networking connection usage that is not cleaned up 'prober_test_run': '`options = { prober_test_run = "true" }`' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20574 - name: 'data_fusion_instance_psc' primary_resource_id: 'psc_instance' vars: @@ -81,10 +78,12 @@ examples: test_vars_overrides: # Mark for testing to avoid service networking connection usage that is not cleaned up 'prober_test_run': '`options = { prober_test_run = "true" }`' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20574 - name: 'data_fusion_instance_cmek' primary_resource_id: 'cmek' vars: instance_name: 'my-instance' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20574 - name: 'data_fusion_instance_enterprise' primary_resource_id: 'enterprise_instance' vars: @@ -101,6 +100,7 @@ examples: primary_resource_id: 'zone' vars: instance_name: 'my-instance' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20574 parameters: - name: 'region' type: String diff --git a/mmv1/products/dataprocgdc/ApplicationEnvironment.yaml b/mmv1/products/dataprocgdc/ApplicationEnvironment.yaml index de5481937321..23c9f14f2aac 100644 --- a/mmv1/products/dataprocgdc/ApplicationEnvironment.yaml +++ b/mmv1/products/dataprocgdc/ApplicationEnvironment.yaml @@ -62,7 +62,6 @@ examples: update_verb: PATCH update_mask: true autogen_async: false -autogen_status: QXBwbGljYXRpb25FbnZpcm9ubWVudA== properties: - name: name type: String diff --git a/mmv1/products/dataprocgdc/ServiceInstance.yaml b/mmv1/products/dataprocgdc/ServiceInstance.yaml index 5ae52c44c6b1..7f094fc42deb 100644 --- a/mmv1/products/dataprocgdc/ServiceInstance.yaml +++ b/mmv1/products/dataprocgdc/ServiceInstance.yaml @@ -25,10 +25,6 @@ id_format: projects/{{project}}/locations/{{location}}/serviceInstances/{{servic import_format: - projects/{{project}}/locations/{{location}}/serviceInstances/{{service_instance_id}} autogen_async: true -autogen_status: U2VydmljZUluc3RhbmNl -sweeper: - url_substitutions: - - region: "us-west2" parameters: - name: location type: String diff --git a/mmv1/products/dataprocgdc/SparkApplication.yaml b/mmv1/products/dataprocgdc/SparkApplication.yaml index 1e2e82c5a791..92d81def627c 100644 --- a/mmv1/products/dataprocgdc/SparkApplication.yaml +++ b/mmv1/products/dataprocgdc/SparkApplication.yaml @@ -100,7 +100,6 @@ id_format: projects/{{project}}/locations/{{location}}/serviceInstances/{{servic import_format: - projects/{{project}}/locations/{{location}}/serviceInstances/{{serviceinstance}}/sparkApplications/{{spark_application_id}} autogen_async: true -autogen_status: U3BhcmtBcHBsaWNhdGlvbg== properties: - name: pysparkApplicationConfig type: NestedObject diff --git a/mmv1/products/datastream/ConnectionProfile.yaml b/mmv1/products/datastream/ConnectionProfile.yaml index 2c50ab2dbcb1..bd6c77fe9326 100644 --- a/mmv1/products/datastream/ConnectionProfile.yaml +++ b/mmv1/products/datastream/ConnectionProfile.yaml @@ -51,12 +51,8 @@ examples: private_connection_id: 'my-connection' connection_profile_id: 'my-profile' network_name: 'my-network' - subnetwork_name: 'my-subnetwork' database_instance_name: 'my-instance' deletion_protection: 'true' - nat_vm_name: 'nat-vm' - nat_vm_ip_name: 'nat-vm-ip' - ingress_firewall_name: 'ingress-rule' test_vars_overrides: 'deletion_protection': 'false' oics_vars_overrides: @@ -64,8 +60,6 @@ examples: external_providers: ["random", "time"] # Random provider skip_vcr: true - ignore_read_extra: - - 'postgresql_profile.0.password' - name: 'datastream_connection_profile_full' primary_resource_id: 'default' vars: diff --git a/mmv1/products/developerconnect/Connection.yaml b/mmv1/products/developerconnect/Connection.yaml index 22eb883dcca8..b1c0047b149a 100644 --- a/mmv1/products/developerconnect/Connection.yaml +++ b/mmv1/products/developerconnect/Connection.yaml @@ -84,6 +84,7 @@ async: type: OpAsync result: resource_inside_response: true + error: {} include_project: false autogen_status: Q29ubmVjdGlvbg== parameters: diff --git a/mmv1/products/developerconnect/GitRepositoryLink.yaml b/mmv1/products/developerconnect/GitRepositoryLink.yaml index e2b80be2d989..1b69af6c1f7a 100644 --- a/mmv1/products/developerconnect/GitRepositoryLink.yaml +++ b/mmv1/products/developerconnect/GitRepositoryLink.yaml @@ -27,7 +27,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 autogen_async: true -autogen_status: R2l0UmVwb3NpdG9yeUxpbms= async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/dialogflowcx/SecuritySettings.yaml b/mmv1/products/dialogflowcx/SecuritySettings.yaml index 1dc22a343a54..006921fcffc5 100644 --- a/mmv1/products/dialogflowcx/SecuritySettings.yaml +++ b/mmv1/products/dialogflowcx/SecuritySettings.yaml @@ -34,9 +34,6 @@ timeouts: custom_code: post_create: 'templates/terraform/post_create/sleep.go.tmpl' post_update: 'templates/terraform/post_create/sleep.go.tmpl' -sweeper: - url_substitutions: - - region: "global" examples: - name: 'dialogflowcx_security_settings_basic' primary_resource_id: 'basic_security_settings' diff --git a/mmv1/products/discoveryengine/ChatEngine.yaml b/mmv1/products/discoveryengine/ChatEngine.yaml index 07a99db071ba..c10cd28ca71c 100644 --- a/mmv1/products/discoveryengine/ChatEngine.yaml +++ b/mmv1/products/discoveryengine/ChatEngine.yaml @@ -103,7 +103,7 @@ properties: - name: 'dataStoreIds' type: Array description: | - The data stores associated with this engine. Multiple DataStores in the same Collection can be associated here. All listed DataStores must be `SOLUTION_TYPE_CHAT`. + The data stores associated with this engine. Multiple DataStores in the same Collection can be associated here. All listed DataStores must be `SOLUTION_TYPE_CHAT`. Adding or removing data stores will force recreation. required: true item_type: type: String diff --git a/mmv1/products/discoveryengine/DataStore.yaml b/mmv1/products/discoveryengine/DataStore.yaml index e2f265d6285f..b0417fc909a9 100644 --- a/mmv1/products/discoveryengine/DataStore.yaml +++ b/mmv1/products/discoveryengine/DataStore.yaml @@ -43,10 +43,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "eu" - - region: "global" examples: - name: 'discoveryengine_datastore_basic' primary_resource_id: 'basic' @@ -70,11 +66,6 @@ examples: vars: data_store_id: 'data-store-id' exclude_docs: true - - name: 'discoveryengine_datastore_advanced_site_search_config' - primary_resource_id: 'advanced_site_search_config' - primary_resource_name: 'fmt.Sprintf("tf_test_data_store%s", context["random_suffix"])' - vars: - data_store_id: 'data-store-id' parameters: - name: 'location' type: String @@ -166,21 +157,6 @@ properties: - 'NO_CONTENT' - 'CONTENT_REQUIRED' - 'PUBLIC_WEBSITE' - - name: 'advancedSiteSearchConfig' - type: NestedObject - description: | - Configuration data for advance site search. - required: false - immutable: true - properties: - - name: 'disableInitialIndex' - type: Boolean - description: If set true, initial indexing is disabled for the DataStore. - required: false - - name: 'disableAutomaticRefresh' - type: Boolean - description: If set true, automatic refresh is disabled for the DataStore. - required: false - name: 'documentProcessingConfig' type: NestedObject description: | diff --git a/mmv1/products/dlp/product.yaml b/mmv1/products/dlp/product.yaml index 1675ca557574..c8713cb1b813 100644 --- a/mmv1/products/dlp/product.yaml +++ b/mmv1/products/dlp/product.yaml @@ -13,7 +13,7 @@ --- name: 'DataLossPrevention' -display_name: 'Data Loss Prevention' +display_name: 'Data loss prevention' versions: - name: 'ga' base_url: 'https://dlp.googleapis.com/v2/' diff --git a/mmv1/products/documentai/Processor.yaml b/mmv1/products/documentai/Processor.yaml index 0454000a6b76..052795afa540 100644 --- a/mmv1/products/documentai/Processor.yaml +++ b/mmv1/products/documentai/Processor.yaml @@ -27,10 +27,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 custom_code: -sweeper: - url_substitutions: - - region: "us" - - region: "eu" examples: - name: 'documentai_processor' primary_resource_id: 'processor' diff --git a/mmv1/products/edgenetwork/InterconnectAttachment.yaml b/mmv1/products/edgenetwork/InterconnectAttachment.yaml index 07fe09c6a486..20662e23e578 100644 --- a/mmv1/products/edgenetwork/InterconnectAttachment.yaml +++ b/mmv1/products/edgenetwork/InterconnectAttachment.yaml @@ -37,9 +37,14 @@ async: type: 'OpAsync' operation: base_url: '{{op_id}}' + path: 'name' + wait_ms: 1000 result: + path: 'response' resource_inside_response: false -exclude_sweeper: true + error: + path: 'error' + message: 'message' examples: - name: 'edgenetwork_interconnect_attachment' primary_resource_id: 'example_interconnect_attachment' diff --git a/mmv1/products/edgenetwork/Network.yaml b/mmv1/products/edgenetwork/Network.yaml index 54ad3729027e..fe3b4c849491 100644 --- a/mmv1/products/edgenetwork/Network.yaml +++ b/mmv1/products/edgenetwork/Network.yaml @@ -40,7 +40,6 @@ async: result: resource_inside_response: false custom_code: -exclude_sweeper: true examples: - name: 'edgenetwork_network' primary_resource_id: 'example_network' diff --git a/mmv1/products/edgenetwork/Subnet.yaml b/mmv1/products/edgenetwork/Subnet.yaml index e945e4736e68..962e6a3008fb 100644 --- a/mmv1/products/edgenetwork/Subnet.yaml +++ b/mmv1/products/edgenetwork/Subnet.yaml @@ -59,7 +59,6 @@ examples: location: 'REGION' zone: 'ZONE' exclude_test: true -exclude_sweeper: true parameters: - name: 'location' type: String diff --git a/mmv1/products/eventarc/Trigger.yaml b/mmv1/products/eventarc/Trigger.yaml deleted file mode 100644 index b9c44a5bcad8..000000000000 --- a/mmv1/products/eventarc/Trigger.yaml +++ /dev/null @@ -1,252 +0,0 @@ -# Copyright 2025 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. - ---- -name: Trigger -legacy_long_form_project: true -base_url: projects/{{project}}/locations/{{location}}/triggers -self_link: projects/{{project}}/locations/{{location}}/triggers/{{name}} -create_url: projects/{{project}}/locations/{{location}}/triggers?triggerId={{name}} -update_verb: PATCH -update_mask: true -references: - guides: - 'Official Documentation': 'https://cloud.google.com/eventarc/standard/docs/overview#eventarc-triggers' - api: https://cloud.google.com/eventarc/docs/reference/rest/v1/projects.locations.triggers -async: - actions: ['create', 'update', 'delete'] - type: OpAsync - operation: - base_url: '{{op_id}}' - result: - resource_inside_response: true -autogen_async: true -description: | - The Eventarc Trigger resource -sweeper: - url_substitutions: - - region: "us-central1" - - region: "europe-west1" -examples: - - name: eventarc_trigger_with_cloud_run_destination - primary_resource_id: primary - vars: - trigger_name: some-trigger - topic_name: some-topic - service_name: some-service - - name: eventarc_trigger_with_http_destination - primary_resource_id: primary - vars: - trigger_name: some-trigger - test_vars_overrides: - 'network_attachment_name': 'acctest.BootstrapNetworkAttachment(t, "tf-test-eventarc-trigger-na", acctest.BootstrapSubnet(t, "tf-test-eventarc-trigger-subnet", acctest.BootstrapSharedTestNetwork(t, "tf-test-eventarc-trigger-network")))' - test_env_vars: - project_id: 'PROJECT_NAME' - service_account: 'SERVICE_ACCT' - exclude_docs: true - - name: eventarc_trigger_with_channel_cmek - primary_resource_id: primary - vars: - trigger_name: some-trigger - service_name: some-service - channel_name: some-channel - key_name: some-key - test_env_vars: - project_id: 'PROJECT_NAME' - project_number: 'PROJECT_NUMBER' - service_account: 'SERVICE_ACCT' - test_vars_overrides: - 'key_name': 'acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-eventarc-trigger-key").CryptoKey.Name' - exclude_docs: true - - name: eventarc_trigger_with_workflow_destination - primary_resource_id: primary - vars: - trigger_name: some-trigger - workflow_name: some-workflow - test_env_vars: - service_account: 'SERVICE_ACCT' - exclude_docs: true - - name: eventarc_trigger_with_path_pattern_filter - primary_resource_id: primary - vars: - trigger_name: some-trigger - service_account_id: trigger-sa - service_name: some-service - exclude_docs: true -parameters: - - name: location - type: String - description: The location for the resource - url_param_only: true - required: true - immutable: true -properties: - - name: name - type: String - description: Required. The resource name of the trigger. Must be unique within the location on the project. - required: true - immutable: true - diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName - - name: uid - type: String - description: Output only. Server assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted. - output: true - - name: createTime - type: String - description: Output only. The creation time. - output: true - - name: updateTime - type: String - description: Output only. The last-modified time. - output: true - - name: matchingCriteria - type: Array - is_set: true - api_name: eventFilters - description: Required. null The list of filters that applies to event attributes. Only events that match all the provided filters will be sent to the destination. - required: true - item_type: - name: matchingCriterion - type: NestedObject - description: Required. null The list of filters that applies to event attributes. Only events that match all the provided filters will be sent to the destination. - properties: - - name: attribute - type: String - description: Required. The name of a CloudEvents attribute. Currently, only a subset of attributes are supported for filtering. All triggers MUST provide a filter for the 'type' attribute. - required: true - immutable: true - - name: value - type: String - description: Required. The value for the attribute. See https://cloud.google.com/eventarc/docs/creating-triggers#trigger-gcloud for available values. - required: true - immutable: true - - name: operator - type: String - description: Optional. The operator used for matching the events with the value of the filter. If not specified, only events that have an exact key-value pair specified in the filter are matched. The only allowed value is `match-path-pattern`. - - name: serviceAccount - type: String - diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName - description: Optional. The IAM service account email associated with the trigger. The service account represents the identity of the trigger. The principal who calls this API must have `iam.serviceAccounts.actAs` permission in the service account. See https://cloud.google.com/iam/docs/understanding-service-accounts#sa_common for more information. For Cloud Run destinations, this service account is used to generate identity tokens when invoking the service. See https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account for information on how to invoke authenticated Cloud Run services. In order to create Audit Log triggers, the service account should also have `roles/eventarc.eventReceiver` IAM role. - - name: destination - type: NestedObject - description: Required. Destination specifies where the events should be sent to. - required: true - properties: - - name: cloudRunService - api_name: cloudRun - type: NestedObject - description: Cloud Run fully-managed service that receives the events. The service should be running in the same project of the trigger. - properties: - - name: service - type: String - diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName - description: Required. The name of the Cloud Run service being addressed. See https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services. Only services located in the same project of the trigger object can be addressed. - required: true - - name: path - type: String - description: 'Optional. The relative path on the Cloud Run service the events should be sent to. The value must conform to the definition of URI path segment (section 3.3 of RFC2396). Examples: "/route", "route", "route/subroute".' - - name: region - type: String - description: Required. The region the Cloud Run service is deployed in. - default_from_api: true - - name: cloudFunction - type: String - description: 'The Cloud Function resource name. Only Cloud Functions V2 is supported. Format projects/{project}/locations/{location}/functions/{function} This is a read-only field. [WARNING] Creating Cloud Functions V2 triggers is only supported via the Cloud Functions product. An error will be returned if the user sets this value.' - output: true - - name: gke - type: NestedObject - description: A GKE service capable of receiving events. The service should be running in the same project as the trigger. - properties: - - name: cluster - type: String - diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName - description: Required. The name of the cluster the GKE service is running in. The cluster must be running in the same project as the trigger being created. - required: true - - name: location - type: String - description: Required. The name of the Google Compute Engine in which the cluster resides, which can either be compute zone (for example, us-central1-a) for the zonal clusters or region (for example, us-central1) for regional clusters. - required: true - - name: namespace - type: String - description: Required. The namespace the GKE service is running in. - required: true - - name: service - type: String - description: Required. Name of the GKE service. - required: true - - name: path - type: String - description: 'Optional. The relative path on the GKE service the events should be sent to. The value must conform to the definition of a URI path segment (section 3.3 of RFC2396). Examples: "/route", "route", "route/subroute".' - - name: workflow - type: String - diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName - custom_expand: templates/terraform/custom_expand/eventarc_trigger_destination_workflow.go.tmpl - description: 'The resource name of the Workflow whose Executions are triggered by the events. The Workflow resource should be deployed in the same project as the trigger. Format: `projects/{project}/locations/{location}/workflows/{workflow}`' - - name: httpEndpoint - type: NestedObject - description: An HTTP endpoint destination described by an URI. - properties: - - name: uri - type: String - description: 'Required. The URI of the HTTP enpdoint. The value must be a RFC2396 URI string. Examples: `http://10.10.10.8:80/route`, `http://svc.us-central1.p.local:8080/`. Only HTTP and HTTPS protocols are supported. The host can be either a static IP addressable from the VPC specified by the network config, or an internal DNS hostname of the service resolvable via Cloud DNS.' - required: true - - name: networkConfig - type: NestedObject - description: Optional. Network config is used to configure how Eventarc resolves and connect to a destination. This should only be used with HttpEndpoint destination type. - properties: - - name: networkAttachment - type: String - diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName - description: 'Required. Name of the NetworkAttachment that allows access to the destination VPC. Format: `projects/{PROJECT_ID}/regions/{REGION}/networkAttachments/{NETWORK_ATTACHMENT_NAME}`' - required: true - - name: transport - type: NestedObject - description: Optional. In order to deliver messages, Eventarc may use other GCP products as transport intermediary. This field contains a reference to that transport intermediary. This information can be used for debugging purposes. - immutable: true - default_from_api: true - properties: - - name: pubsub - type: NestedObject - description: The Pub/Sub topic and subscription used by Eventarc as delivery intermediary. - immutable: true - properties: - - name: topic - type: String - diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName - description: 'Optional. The name of the Pub/Sub topic created and managed by Eventarc system as a transport for the event delivery. Format: `projects/{PROJECT_ID}/topics/{TOPIC_NAME}. You may set an existing topic for triggers of the type google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide here will not be deleted by Eventarc at trigger deletion.' - immutable: true - custom_expand: templates/terraform/custom_expand/eventarc_trigger_transport_pubsub_topic.go.tmpl - - name: subscription - type: String - description: 'Output only. The name of the Pub/Sub subscription created and managed by Eventarc system as a transport for the event delivery. Format: `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.' - output: true - - name: labels - type: KeyValueLabels - description: Optional. User labels attached to the triggers that can be used to group resources. - - name: etag - type: String - description: Output only. This checksum is computed by the server based on the value of other fields, and may be sent only on create requests to ensure the client has an up-to-date value before proceeding. - output: true - - name: channel - type: String - diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName - description: Optional. The name of the channel associated with the trigger in `projects/{project}/locations/{location}/channels/{channel}` format. You must provide a channel to receive events from Eventarc SaaS partners. - immutable: true - - name: conditions - type: KeyValuePairs - description: Output only. The reason(s) why a trigger is in FAILED state. - output: true - - name: eventDataContentType - type: String - description: Optional. EventDataContentType specifies the type of payload in MIME format that is expected from the CloudEvent data field. This is set to `application/json` if the value is not defined. - default_from_api: true diff --git a/mmv1/products/filestore/Backup.yaml b/mmv1/products/filestore/Backup.yaml index b798a2170a00..dab4a22921d9 100644 --- a/mmv1/products/filestore/Backup.yaml +++ b/mmv1/products/filestore/Backup.yaml @@ -46,8 +46,8 @@ examples: - name: 'filestore_backup_basic' primary_resource_id: 'backup' vars: - backup_name: 'fs-bkup' - instance_name: 'fs-inst' + backup_name: 'tf-fs-bkup' + instance_name: 'tf-fs-inst' parameters: - name: 'location' type: String diff --git a/mmv1/products/filestore/Instance.yaml b/mmv1/products/filestore/Instance.yaml index a2139d6c22ee..b3b113d1ef9d 100644 --- a/mmv1/products/filestore/Instance.yaml +++ b/mmv1/products/filestore/Instance.yaml @@ -46,13 +46,6 @@ error_abort_predicates: - 'transport_tpg.Is429QuotaError' schema_version: 1 state_upgraders: true -sweeper: - url_substitutions: - - region: "us-central1-b" - - zone: "us-central1-b" - - region: "us-central1" - - region: "us-east1" - - region: "us-west1" examples: - name: 'filestore_instance_basic' primary_resource_id: 'instance' @@ -329,80 +322,3 @@ properties: description: | The number of IOPS to provision for the instance. max_iops must be in multiple of 1000. - - name: 'tags' - type: KeyValuePairs - description: | - A map of resource manager tags. Resource manager tag keys - and values have the same definition as resource manager - tags. Keys must be in the format tagKeys/{tag_key_id}, - and values are in the format tagValues/456. The field is - ignored when empty. The field is immutable and causes - resource replacement when mutated. This field is only set - at create time and modifying this field after creation - will trigger recreation. To apply tags to an existing - resource, see the `google_tags_tag_value` resource. - immutable: true - ignore_read: true - - name: 'initialReplication' - api_name: replication - type: NestedObject - description: | - Replication configuration, once set, this cannot be updated. - Addtionally this should be specified on the replica instance only, indicating the active as the peer_instance - url_param_only: true - immutable: true - properties: - - name: 'role' - type: Enum - description: | - The replication role. - default_value: "STANDBY" - enum_values: - - 'ROLE_UNSPECIFIED' - - 'ACTIVE' - - 'STANDBY' - - name: 'replicas' - type: Array - description: | - The replication role. - item_type: - type: NestedObject - properties: - - name: 'peerInstance' - type: String - description: | - The peer instance. - required: true - - name: 'effectiveReplication' - api_name: replication - type: NestedObject - output: true - description: | - Output only fields for replication configuration. - properties: - - name: 'replicas' - type: Array - description: | - The replication role. - item_type: - type: NestedObject - properties: - - name: 'state' - type: Enum - description: | - Output only. The replica state - output: true - - name: 'stateReasons' - type: Array - description: | - Output only. Additional information about the replication state, if available. - output: true - item_type: - type: Enum - - name: 'lastActiveSyncTime' - type: String - description: | - Output only. The timestamp of the latest replication snapshot taken on the active instance and is already replicated safely. - A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. - Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z" - output: true diff --git a/mmv1/products/firebasedataconnect/Service.yaml b/mmv1/products/firebasedataconnect/Service.yaml deleted file mode 100644 index 8f297cad01af..000000000000 --- a/mmv1/products/firebasedataconnect/Service.yaml +++ /dev/null @@ -1,129 +0,0 @@ -# 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. - ---- -name: Service -description: A Firebase Data Connect service. -references: - guides: - 'Official Documentation': 'https://firebase.google.com/docs/data-connect' - api: 'https://firebase.google.com/docs/reference/data-connect/rest' -base_url: projects/{{project}}/locations/{{location}}/services -update_mask: true -self_link: projects/{{project}}/locations/{{location}}/services/{{service_id}} -create_url: projects/{{project}}/locations/{{location}}/services?serviceId={{service_id}} -update_verb: PATCH -id_format: projects/{{project}}/locations/{{location}}/services/{{service_id}} -import_format: - - 'projects/{{project}}/locations/{{location}}/services/{{service_id}}' - - '{{project}}/{{location}}/{{service_id}}' - - '{{location}}/{{service_id}}' -examples: - - name: firebasedataconnect_service_basic - primary_resource_id: default - vars: - service_id: example-service - test_env_vars: - project_id: 'PROJECT_NAME' -autogen_async: true -async: - operation: - timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 - base_url: "{{op_id}}" - actions: - - create - - delete - - update - type: OpAsync - result: - resource_inside_response: true - include_project: false -autogen_status: U2VydmljZQ== -parameters: - - name: location - type: String - description: The region in which the service resides, e.g. "us-central1" or "asia-east1". - immutable: true - url_param_only: true - required: true - - name: serviceId - type: String - description: |- - Required. The ID to use for the service, which will become the final component of the - service's resource name. - immutable: true - url_param_only: true - required: true -properties: - - name: displayName - type: String - description: Optional. Mutable human-readable name. 63 character limit. - - name: annotations - type: KeyValueAnnotations - description: Optional. Stores small amounts of arbitrary data. - - name: reconciling - type: Boolean - description: |- - Output only. A field that if true, indicates that the system is working update the - service. - output: true - - name: etag - type: Fingerprint - description: |- - Output only. This checksum is computed by the server based on the value of other - fields, and may be sent on update and delete requests to ensure the - client has an up-to-date value before proceeding. - [AIP-154](https://google.aip.dev/154) - output: true - - name: name - type: String - description: |- - Identifier. The relative resource name of the Firebase Data Connect service, in the - format: - ``` - projects/{project}/locations/{location}/services/{service} - ``` - Note that the service ID is specific to Firebase Data Connect and does not - correspond to any of the instance IDs of the underlying data source - connections. - output: true - - name: createTime - type: String - description: Output only. [Output only] Create time stamp. - output: true - - name: updateTime - type: String - description: Output only. [Output only] Update time stamp. - output: true - - name: labels - type: KeyValueLabels - description: Optional. Labels as key value pairs. - - name: uid - type: String - description: Output only. System-assigned, unique identifier. - output: true -virtual_fields: - - name: deletion_policy - type: String - default_value: DEFAULT - description: |- - The deletion policy for the database. Setting the field to FORCE allows the - Service to be deleted even if a Schema or Connector is present. By default, - the Service deletion will only succeed when no Schema or Connectors are - present. - Possible values: DEFAULT, FORCE -custom_code: - pre_delete: templates/terraform/pre_delete/firebasedataconnect_service.go.tmpl diff --git a/mmv1/products/firestore/Field.yaml b/mmv1/products/firestore/Field.yaml index 6ab831c7feb3..2506e9448a79 100644 --- a/mmv1/products/firestore/Field.yaml +++ b/mmv1/products/firestore/Field.yaml @@ -86,15 +86,6 @@ examples: project_id: 'PROJECT_NAME' test_vars_overrides: 'delete_protection_state': '"DELETE_PROTECTION_DISABLED"' - - name: 'firestore_field_wildcard' - primary_resource_id: 'wildcard' - vars: - database_id: 'database-id' - delete_protection_state: 'DELETE_PROTECTION_ENABLED' - test_env_vars: - project_id: 'PROJECT_NAME' - test_vars_overrides: - 'delete_protection_state': '"DELETE_PROTECTION_DISABLED"' parameters: properties: - name: 'database' diff --git a/mmv1/products/gemini/CodeRepositoryIndex.yaml b/mmv1/products/gemini/CodeRepositoryIndex.yaml index 6391c6286028..62cb5236c845 100644 --- a/mmv1/products/gemini/CodeRepositoryIndex.yaml +++ b/mmv1/products/gemini/CodeRepositoryIndex.yaml @@ -14,10 +14,7 @@ --- name: CodeRepositoryIndex description: The resource for managing Code Repository Index for Gemini Code Assist. -references: - guides: - 'Gemini Code Assist overview': 'https://cloud.google.com/gemini/docs/codeassist/overview' - api: 'https://cloud.google.com/gemini/docs/api/reference/rest/v1/projects.locations.codeRepositoryIndexes' +min_version: 'beta' base_url: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes self_link: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{code_repository_index_id}} create_url: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes?codeRepositoryIndexId={{code_repository_index_id}} @@ -29,6 +26,7 @@ import_format: mutex: 'projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{code_repository_index_id}}' examples: - name: "gemini_code_repository_index_basic" + min_version: 'beta' primary_resource_id: "example" test_vars_overrides: cri_id: '"cri-example"' @@ -53,18 +51,9 @@ async: result: resource_inside_response: true include_project: false -custom_code: - pre_delete: templates/terraform/pre_delete/code_repository_index_force_delete.go.tmpl error_retry_predicates: - 'transport_tpg.IsCodeRepositoryIndexUnreadyError' - 'transport_tpg.IsRepositoryGroupQueueError' -virtual_fields: - - name: 'force_destroy' - description: - If set to true, will allow deletion of the CodeRepositoryIndex even if there are existing - RepositoryGroups for the resource. These RepositoryGroups will also be deleted. - type: Boolean - default_value: false parameters: - name: location type: String @@ -87,7 +76,12 @@ properties: type: String description: |- Output only. Code Repository Index instance State. - Possible values are: `STATE_UNSPECIFIED`, `CREATING`, `ACTIVE`, `DELETING`, `SUSPENDED`. + Possible values: + STATE_UNSPECIFIED + CREATING + ACTIVE + DELETING + SUSPENDED output: true - name: labels type: KeyValueLabels @@ -96,7 +90,7 @@ properties: type: String description: |- Optional. Immutable. Customer-managed encryption key name, in the format - `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + projects/*/locations/*/keyRings/*/cryptoKeys/*. immutable: true - name: name type: String diff --git a/mmv1/products/gemini/DataSharingWithGoogleSetting.yaml b/mmv1/products/gemini/DataSharingWithGoogleSetting.yaml deleted file mode 100644 index e9910e9f7bd4..000000000000 --- a/mmv1/products/gemini/DataSharingWithGoogleSetting.yaml +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright 2025 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. - ---- -name: DataSharingWithGoogleSetting -description: The resource for managing DataSharingWithGoogle settings for Admin Control. -min_version: 'beta' -base_url: projects/{{project}}/locations/{{location}}/dataSharingWithGoogleSettings -update_mask: true -self_link: projects/{{project}}/locations/{{location}}/dataSharingWithGoogleSettings/{{data_sharing_with_google_setting_id}} -create_url: projects/{{project}}/locations/{{location}}/dataSharingWithGoogleSettings?dataSharingWithGoogleSettingId={{data_sharing_with_google_setting_id}} -update_verb: PATCH -id_format: projects/{{project}}/locations/{{location}}/dataSharingWithGoogleSettings/{{data_sharing_with_google_setting_id}} -import_format: - - projects/{{project}}/locations/{{location}}/dataSharingWithGoogleSettings/{{data_sharing_with_google_setting_id}} -mutex: projects/{{project}}/locations/{{location}}/dataSharingWithGoogleSettings/{{data_sharing_with_google_setting_id}} -sweeper: - url_substitutions: - - region: "global" -examples: - - name: gemini_data_sharing_with_google_setting_basic - min_version: 'beta' - primary_resource_id: example - exclude_test: true - vars: - data_sharing_with_google_setting_id: ls1-tf -autogen_async: false -autogen_status: RGF0YVNoYXJpbmdXaXRoR29vZ2xlU2V0dGluZw== -parameters: - - name: location - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - - name: dataSharingWithGoogleSettingId - type: String - description: |- - Id of the Data Sharing With Google Setting. - immutable: true - url_param_only: true - required: true -properties: - - name: name - type: String - description: |- - Identifier. Name of the resource. - Format:projects/{project}/locations/{location}/dataSharingWithGoogleSettings/{dataSharingWithGoogleSetting} - output: true - - name: createTime - type: String - description: Create time stamp. - output: true - - name: updateTime - type: String - description: Update time stamp. - output: true - - name: labels - type: KeyValueLabels - description: Labels as key value pairs. - - name: enablePreviewDataSharing - type: Boolean - description: Whether preview data sharing should be enabled. diff --git a/mmv1/products/gemini/GeminiGcpEnablementSetting.yaml b/mmv1/products/gemini/GeminiGcpEnablementSetting.yaml deleted file mode 100644 index 5d1eec4e8c51..000000000000 --- a/mmv1/products/gemini/GeminiGcpEnablementSetting.yaml +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2025 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. - ---- -name: GeminiGcpEnablementSetting -description: The resource for managing GeminiGcpEnablement settings for Admin Control. -base_url: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings -update_mask: true -self_link: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}} -create_url: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings?geminiGcpEnablementSettingId={{gemini_gcp_enablement_setting_id}} -update_verb: PATCH -id_format: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}} -import_format: - - projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}} -mutex: projects/{{project}}/locations/{{location}}/geminiGcpEnablementSettings/{{gemini_gcp_enablement_setting_id}} -sweeper: - url_substitutions: - - region: "global" -examples: - - name: gemini_gemini_gcp_enablement_setting_basic - primary_resource_id: example - vars: - gemini_gcp_enablement_setting_id: ls1-tf -autogen_async: false -autogen_status: R2VtaW5pR2NwRW5hYmxlbWVudFNldHRpbmc= -parameters: - - name: location - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - required: true - - name: geminiGcpEnablementSettingId - type: String - description: |- - Id of the Gemini Gcp Enablement setting. - immutable: true - url_param_only: true - required: true -properties: - - name: name - type: String - description: |- - Identifier. Name of the resource. - Format:projects/{project}/locations/{location}/geminiGcpEnablementSettings/{geminiGcpEnablementSetting} - output: true - - name: createTime - type: String - description: Create time stamp. - output: true - - name: updateTime - type: String - description: Update time stamp. - output: true - - name: labels - type: KeyValueLabels - description: Labels as key value pairs. - - name: enableCustomerDataSharing - type: Boolean - description: Whether customer data sharing should be enabled. diff --git a/mmv1/products/gemini/LoggingSetting.yaml b/mmv1/products/gemini/LoggingSetting.yaml deleted file mode 100644 index cdbf798720b9..000000000000 --- a/mmv1/products/gemini/LoggingSetting.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright 2025 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. - ---- -name: LoggingSetting -description: The resource for managing Logging settings for Admin Control. -min_version: beta -base_url: projects/{{project}}/locations/{{location}}/loggingSettings -update_mask: true -self_link: projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}} -create_url: projects/{{project}}/locations/{{location}}/loggingSettings?loggingSettingId={{logging_setting_id}} -update_verb: PATCH -id_format: projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}} -import_format: - - projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}} -mutex: projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}} -sweeper: - url_substitutions: - - region: "global" -examples: - - name: gemini_logging_setting_basic - min_version: 'beta' - primary_resource_id: "example" - vars: - logging_setting_id: ls1-tf -autogen_async: false -timeouts: - insert_minutes: 90 - update_minutes: 90 - delete_minutes: 90 -autogen_status: TG9nZ2luZ1NldHRpbmc= -parameters: - - name: location - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - required: true - - name: loggingSettingId - type: String - description: |- - Id of the Logging Setting. - immutable: true - url_param_only: true - required: true -properties: - - name: name - type: String - description: |- - Identifier. Name of the resource. - Format:projects/{project}/locations/{location}/loggingsettings/{loggingsetting} - output: true - - name: createTime - type: String - description: Create time stamp. - output: true - - name: updateTime - type: String - description: Update time stamp. - output: true - - name: labels - type: KeyValueLabels - description: Labels as key value pairs. - - name: logPromptsAndResponses - type: Boolean - description: Whether to log prompts and responses. - - name: logMetadata - type: Boolean - description: Whether to log metadata. diff --git a/mmv1/products/gemini/LoggingSettingBinding.yaml b/mmv1/products/gemini/LoggingSettingBinding.yaml deleted file mode 100644 index a64901d990ea..000000000000 --- a/mmv1/products/gemini/LoggingSettingBinding.yaml +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright 2025 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. - ---- -name: LoggingSettingBinding -description: The resource for managing Logging setting bindings for Admin Control. -references: - guides: - 'Gemini Cloud Assist overview': 'https://cloud.google.com/gemini/docs/cloud-assist/overview' -min_version: 'beta' -base_url: projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}}/settingBindings -self_link: projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}}/settingBindings/{{setting_binding_id}} -create_url: projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}}/settingBindings?settingBindingId={{setting_binding_id}} -id_format: projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}}/settingBindings/{{setting_binding_id}} -update_verb: PATCH -update_mask: true -import_format: - - projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}}/settingBindings/{{setting_binding_id}} -mutex: projects/{{project}}/locations/{{location}}/loggingSettings/{{logging_setting_id}} -examples: - - name: gemini_logging_setting_binding_basic - min_version: 'beta' - primary_resource_id: example - exclude_test: true - vars: - logging_setting_id: ls-tf1 - setting_binding_id: ls-tf1b1 - target: projects/980109375338 -autogen_async: true -timeouts: - insert_minutes: 90 - update_minutes: 90 - delete_minutes: 90 -async: - operation: - timeouts: - insert_minutes: 90 - update_minutes: 90 - delete_minutes: 90 - base_url: '{{op_id}}' - actions: - - create - - delete - - update - type: OpAsync - result: - resource_inside_response: true - include_project: false -autogen_status: U2V0dGluZ0JpbmRpbmdCeVByb2plY3RBbmRMb2NhdGlvbkFuZExvZ2dpbmdzZXR0aW5n -parameters: - - name: location - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - - name: loggingSettingId - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - required: true - - name: settingBindingId - type: String - description: |- - Id of the setting binding. - immutable: true - url_param_only: true - required: true -properties: - - name: labels - type: KeyValueLabels - description: Labels as key value pairs. - - name: target - type: String - description: Target of the binding. - required: true - - name: product - type: Enum - description: |- - Product type of the setting binding. - enum_values: - - 'GEMINI_CLOUD_ASSIST' - - 'GEMINI_CODE_ASSIST' - - name: name - type: String - description: |- - Identifier. Name of the resource. - Format:projects/{project}/locations/{location}/loggingSettings/{setting}/settingBindings/{setting_binding} - output: true - - name: createTime - type: String - description: Create time stamp. - output: true - - name: updateTime - type: String - description: Update time stamp. - output: true diff --git a/mmv1/products/gemini/ReleaseChannelSetting.yaml b/mmv1/products/gemini/ReleaseChannelSetting.yaml deleted file mode 100644 index db03fe4c4e23..000000000000 --- a/mmv1/products/gemini/ReleaseChannelSetting.yaml +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2025 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. - ---- -name: ReleaseChannelSetting -description: The resource for managing ReleaseChannel settings for Admin Control. -min_version: 'beta' -base_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings -update_mask: true -self_link: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}} -create_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings?releaseChannelSettingId={{release_channel_setting_id}} -update_verb: PATCH -id_format: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}} -import_format: - - projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}} -mutex: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}} -sweeper: - url_substitutions: - - region: "global" -examples: - - name: gemini_release_channel_setting_basic - min_version: 'beta' - primary_resource_id: example - vars: - release_channel_setting_id: ls1-tf -autogen_async: false -autogen_status: UmVsZWFzZUNoYW5uZWxTZXR0aW5n -parameters: - - name: location - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - required: true - - name: releaseChannelSettingId - type: String - description: |- - Id of the Release Channel Setting. - immutable: true - url_param_only: true - required: true -properties: - - name: createTime - type: String - description: Create time stamp. - output: true - - name: updateTime - type: String - description: Update time stamp. - output: true - - name: labels - type: KeyValueLabels - description: Labels as key value pairs. - - name: releaseChannel - type: String - description: |- - Release channel to be used. - Possible values: - STABLE - EXPERIMENTAL - - name: name - type: String - description: |- - Identifier. Name of the resource. - Format:projects/{project}/locations/{location}/releaseChannelSettings/{releaseChannelSetting} - output: true diff --git a/mmv1/products/gemini/ReleaseChannelSettingBinding.yaml b/mmv1/products/gemini/ReleaseChannelSettingBinding.yaml deleted file mode 100644 index 856350779372..000000000000 --- a/mmv1/products/gemini/ReleaseChannelSettingBinding.yaml +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright 2025 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. - ---- -name: ReleaseChannelSettingBinding -description: The resource for managing ReleaseChannel setting bindings for Admin Control. -references: - guides: - 'Gemini Cloud Assist overview': 'https://cloud.google.com/gemini/docs/cloud-assist/overview' -min_version: 'beta' -base_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings -self_link: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}} -create_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings?settingBindingId={{setting_binding_id}} -id_format: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}} -update_verb: PATCH -update_mask: true -import_format: - - projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}} -mutex: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}} -examples: - - name: gemini_release_channel_setting_binding_basic - min_version: 'beta' - primary_resource_id: example - exclude_test: true - vars: - release_channel_setting_id: ls-tf1 - setting_binding_id: ls-tf1b1 - target: projects/980109375338 - test_env_vars: - org_id: "ORG_ID" - billing_account: "BILLING_ACCT" -autogen_async: true -async: - operation: - timeouts: - insert_minutes: 90 - update_minutes: 90 - delete_minutes: 90 - base_url: '{{op_id}}' - actions: - - create - - delete - - update - type: OpAsync - result: - resource_inside_response: true - include_project: false -autogen_status: U2V0dGluZ0JpbmRpbmdCeVByb2plY3RBbmRMb2NhdGlvbkFuZFJlbGVhc2VjaGFubmVsc2V0dGluZw== -parameters: - - name: location - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - - name: releaseChannelSettingId - type: String - description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - immutable: true - url_param_only: true - required: true - - name: settingBindingId - type: String - description: |- - Id of the setting binding. - immutable: true - url_param_only: true - required: true -properties: - - name: name - type: String - description: |- - Identifier. Name of the resource. - Format:projects/{project}/locations/{location}/releaseChannelSettings/{setting}/settingBindings/{setting_binding} - output: true - - name: createTime - type: String - description: Create time stamp. - output: true - - name: updateTime - type: String - description: Update time stamp. - output: true - - name: labels - type: KeyValueLabels - description: Labels as key value pairs. - - name: target - type: String - description: Target of the binding. - required: true - - name: product - type: Enum - description: |- - Product type of the setting binding. - enum_values: - - 'GEMINI_CLOUD_ASSIST' - - 'GEMINI_CODE_ASSIST' diff --git a/mmv1/products/gemini/RepositoryGroup.yaml b/mmv1/products/gemini/RepositoryGroup.yaml index 0fa7043ccfd1..e6c8e1513ec5 100644 --- a/mmv1/products/gemini/RepositoryGroup.yaml +++ b/mmv1/products/gemini/RepositoryGroup.yaml @@ -14,8 +14,7 @@ --- name: RepositoryGroup description: The resource for managing Repository Group for Gemini Code Assist. -references: - api: 'https://cloud.google.com/gemini/docs/api/reference/rest/v1/projects.locations.codeRepositoryIndexes.repositoryGroups' +min_version: 'beta' base_url: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{code_repository_index}}/repositoryGroups self_link: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{code_repository_index}}/repositoryGroups/{{repository_group_id}} create_url: projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{code_repository_index}}/repositoryGroups?repositoryGroupId={{repository_group_id}} @@ -27,17 +26,18 @@ import_format: mutex: 'projects/{{project}}/locations/{{location}}/codeRepositoryIndexes/{{code_repository_index}}' examples: - name: "gemini_repository_group_basic" + min_version: 'beta' primary_resource_id: "example" - primary_resource_name: 'acctest.BootstrapSharedCodeRepositoryIndex(t, "basic-rg-gen-example", "us-central1", "", map[string]string{"ccfe_debug_note":"terraform_e2e_do_not_delete"}), fmt.Sprintf("tf-test-gen-repository-group-%s", context["random_suffix"])' + primary_resource_name: 'acctest.BootstrapSharedCodeRepositoryIndex(t, "basic-rg-gen-example", "us-central1", "", map[string]string{}), fmt.Sprintf("tf-test-gen-repository-group-%s", context["random_suffix"])' vars: - repository_group_id: "example-repository-group" + repository_group_id: "gen-repository-group-" git_repository_link_id: 'example-git-repository-link-id' cri_id: "cri-example" repository_resource: "projects/example-project/locations/us-central1/connections/example-connection/gitRepositoryLinks/example-repo" connection_id: "example-connection-id" test_vars_overrides: git_repository_link_id: 'acctest.BootstrapGitRepository(t, "basic", "us-central1", "https://github.com/CC-R-github-robot/tf-test.git", acctest.BootstrapDeveloperConnection(t, "basic", "us-central1", "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648))' - cri_id: 'acctest.BootstrapSharedCodeRepositoryIndex(t, "basic-rg-gen-example", "us-central1", "", map[string]string{"ccfe_debug_note":"terraform_e2e_do_not_delete"})' + cri_id: 'acctest.BootstrapSharedCodeRepositoryIndex(t, "basic-rg-gen-example", "us-central1", "", map[string]string{})' repository_resource: '"projects/"+envvar.GetTestProjectFromEnv()+"/locations/us-central1/connections/"+acctest.BootstrapDeveloperConnection(t, "basic", "us-central1", "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648)+"/gitRepositoryLinks/"+acctest.BootstrapGitRepository(t, "basic", "us-central1", "https://github.com/CC-R-github-robot/tf-test.git", acctest.BootstrapDeveloperConnection(t, "basic", "us-central1", "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648))' connection_id: 'acctest.BootstrapDeveloperConnection(t, "basic", "us-central1", "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648)' exclude_test: true @@ -62,6 +62,7 @@ async: resource_inside_response: true include_project: false iam_policy: + min_version: 'beta' parent_resource_attribute: 'repository_group_id' method_name_separator: ':' fetch_iam_policy_verb: 'GET' @@ -95,7 +96,7 @@ parameters: properties: - name: repositories type: Array - description: Required. List of repositories to group. + description: Required. List of repositories to group required: true item_type: type: NestedObject @@ -114,17 +115,17 @@ properties: required: true - name: name type: String - description: Immutable. Identifier. Name of Repository Group. + description: Immutable. Identifier. name of resource output: true immutable: true - name: createTime type: String - description: Output only. Create time stamp. + description: Output only. Create time stamp output: true - name: updateTime type: String - description: Output only. Update time stamp. + description: Output only. Update time stamp output: true - name: labels type: KeyValueLabels - description: Optional. Labels as key value pairs. + description: Optional. Labels as key value pairs diff --git a/mmv1/products/gemini/product.yaml b/mmv1/products/gemini/product.yaml index 985e5e875cfe..e9b03fba5526 100644 --- a/mmv1/products/gemini/product.yaml +++ b/mmv1/products/gemini/product.yaml @@ -17,7 +17,5 @@ display_name: Gemini for Google Cloud scopes: - https://www.googleapis.com/auth/cloud-platform versions: - - base_url: https://cloudaicompanion.googleapis.com/v1/ - name: 'ga' - base_url: https://cloudaicompanion.googleapis.com/v1/ name: 'beta' diff --git a/mmv1/products/gkehub2/Feature.yaml b/mmv1/products/gkehub2/Feature.yaml index a868c3b63204..c2e20ba91f57 100644 --- a/mmv1/products/gkehub2/Feature.yaml +++ b/mmv1/products/gkehub2/Feature.yaml @@ -283,9 +283,6 @@ properties: - name: 'preventDrift' type: Boolean description: 'Set to true to enable the Config Sync admission webhook to prevent drifts. If set to `false`, disables the Config Sync admission webhook and does not prevent drifts.' - - name: 'metricsGcpServiceAccountEmail' - type: String - description: 'The Email of the Google Cloud Service Account (GSA) used for exporting Config Sync metrics to Cloud Monitoring. The GSA should have the Monitoring Metric Writer(roles/monitoring.metricWriter) IAM role. The Kubernetes ServiceAccount `default` in the namespace `config-management-monitoring` should be bound to the GSA.' - name: 'git' type: NestedObject description: 'Git repo configuration for the cluster' diff --git a/mmv1/products/gkeonprem/BareMetalCluster.yaml b/mmv1/products/gkeonprem/BareMetalCluster.yaml index ba188bc3a769..faaa150259f8 100644 --- a/mmv1/products/gkeonprem/BareMetalCluster.yaml +++ b/mmv1/products/gkeonprem/BareMetalCluster.yaml @@ -38,9 +38,6 @@ async: resource_inside_response: true custom_code: taint_resource_on_failed_create: true -sweeper: - url_substitutions: - - region: "us-west1" examples: - name: 'gkeonprem_bare_metal_cluster_basic' primary_resource_id: 'cluster-basic' diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index 42f5ae5d558e..e492d84fb9d6 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -24,7 +24,7 @@ description: "A Google VMware Admin Cluster." exclude_delete: true id_format: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" import_format: ["projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}"] -timeouts: +timeouts: !ruby/object:Api::Timeouts insert_minutes: 60 delete_minutes: 60 update_minutes: 60 @@ -33,8 +33,15 @@ async: type: 'OpAsync' operation: base_url: '{{op_id}}' + kind: 'gkeonprem#operation' + path: 'name' + wait_ms: 1000 result: + path: 'response' resource_inside_response: true + error: + path: 'error' + message: 'message' custom_code: taint_resource_on_failed_create: true examples: @@ -520,15 +527,20 @@ properties: description: | Human-readable message indicating details about last transition. output: true - - name: 'lastTransitionTime' - type: Time + - !ruby/object:Api::Type::Time + name: 'lastTransitionTime' description: | Last time the condition transit from one status to another. output: true - - name: 'state' - type: String + - !ruby/object:Api::Type::Enum + name: 'state' description: The lifecycle state of the condition. output: true + enum_values: + - STATE_UNSPECIFIED + - STATE_TRUE + - STATE_FALSE + - STATE_UNKNOWN - type: NestedObject name: status description: ResourceStatus representing detailed cluster state. @@ -567,24 +579,37 @@ properties: description: | Human-readable message indicating details about last transition. output: true - - name: 'lastTransitionTime' - type: Time + - !ruby/object:Api::Type::Time + name: 'lastTransitionTime' description: | Last time the condition transit from one status to another. output: true - - name: 'state' - type: String + - !ruby/object:Api::Type::Enum + name: 'state' description: The lifecycle state of the condition. output: true + enum_values: + - STATE_UNSPECIFIED + - STATE_TRUE + - STATE_FALSE + - STATE_UNKNOWN - type: String name: "uid" description: | The unique identifier of the VMware Admin Cluster. output: true - - name: "state" - type: String + - !ruby/object:Api::Type::Enum + name: "state" description: The lifecycle state of the VMware admin cluster. output: true + enum_values: + - STATE_UNSPECIFIED + - PROVISIONING + - RUNNING + - RECONCILING + - STOPPING + - ERROR + - DEGRADED - type: String name: "endpoint" description: | @@ -595,13 +620,13 @@ properties: description: | If set, there are currently changes in flight to the VMware admin cluster. output: true - - name: "createTime" - type: Time + - !ruby/object:Api::Type::Time + name: "createTime" description: | The time the cluster was created, in RFC3339 text format. output: true - - name: "updateTime" - type: Time + - !ruby/object:Api::Type::Time + name: "updateTime" description: | The time the cluster was last updated, in RFC3339 text format. output: true @@ -678,12 +703,17 @@ properties: description: | Human-readable message indicating details about last transition. output: true - - name: 'lastTransitionTime' - type: Time + - !ruby/object:Api::Type::Time + name: 'lastTransitionTime' description: | Last time the condition transit from one status to another. output: true - - name: 'state' - type: String + - !ruby/object:Api::Type::Enum + name: 'state' description: The lifecycle state of the condition. output: true + enum_values: + - STATE_UNSPECIFIED + - STATE_TRUE + - STATE_FALSE + - STATE_UNKNOWN diff --git a/mmv1/products/gkeonprem/VmwareCluster.yaml b/mmv1/products/gkeonprem/VmwareCluster.yaml index e3f725641e7d..b9a6c3564d22 100644 --- a/mmv1/products/gkeonprem/VmwareCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareCluster.yaml @@ -38,9 +38,6 @@ async: resource_inside_response: true custom_code: taint_resource_on_failed_create: true -sweeper: - url_substitutions: - - region: "us-west1" examples: - name: 'gkeonprem_vmware_cluster_basic' primary_resource_id: 'cluster-basic' diff --git a/mmv1/products/healthcare/DicomStore.yaml b/mmv1/products/healthcare/DicomStore.yaml index 2e2c9b448e33..c240642a96c2 100644 --- a/mmv1/products/healthcare/DicomStore.yaml +++ b/mmv1/products/healthcare/DicomStore.yaml @@ -53,11 +53,8 @@ examples: pubsub_topic: 'dicom-notifications' bq_dataset_name: 'dicom_bq_ds' bq_table_name: 'dicom_bq_tb' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-healthcare.iam.gserviceaccount.com" - role: "roles/bigquery.dataEditor" - - member: "serviceAccount:service-{project_number}@gcp-sa-healthcare.iam.gserviceaccount.com" - role: "roles/bigquery.jobUser" + test_vars_overrides: + 'policyChanged': ' acctest.BootstrapPSARoles(t, "service-", "gcp-sa-healthcare", []string{"roles/bigquery.dataEditor", "roles/bigquery.jobUser"})' parameters: - name: 'dataset' type: ResourceRef diff --git a/mmv1/products/healthcare/FhirStore.yaml b/mmv1/products/healthcare/FhirStore.yaml index 3dcaa8b5b31e..3498097004ea 100644 --- a/mmv1/products/healthcare/FhirStore.yaml +++ b/mmv1/products/healthcare/FhirStore.yaml @@ -51,11 +51,8 @@ examples: fhir_store_name: 'example-fhir-store' pubsub_topic: 'fhir-notifications' bq_dataset_name: 'bq_example_dataset' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-healthcare.iam.gserviceaccount.com" - role: "roles/bigquery.dataEditor" - - member: "serviceAccount:service-{project_number}@gcp-sa-healthcare.iam.gserviceaccount.com" - role: "roles/bigquery.jobUser" + test_vars_overrides: + 'policyChanged': ' acctest.BootstrapPSARoles(t, "service-", "gcp-sa-healthcare", []string{"roles/bigquery.dataEditor", "roles/bigquery.jobUser"})' - name: 'healthcare_fhir_store_notification_config' primary_resource_id: 'default' vars: diff --git a/mmv1/products/iamworkforcepool/WorkforcePool.yaml b/mmv1/products/iamworkforcepool/WorkforcePool.yaml index 639978779900..b34dcaa30b95 100644 --- a/mmv1/products/iamworkforcepool/WorkforcePool.yaml +++ b/mmv1/products/iamworkforcepool/WorkforcePool.yaml @@ -47,9 +47,6 @@ custom_code: constants: 'templates/terraform/constants/iam_workforce_pool.go.tmpl' decoder: 'templates/terraform/decoders/treat_deleted_state_as_gone.go.tmpl' test_check_destroy: 'templates/terraform/custom_check_destroy/iam_workforce_pool.go.tmpl' -sweeper: - url_substitutions: - - region: "global" examples: - name: 'iam_workforce_pool_basic' primary_resource_id: 'example' diff --git a/mmv1/products/integrations/AuthConfig.yaml b/mmv1/products/integrations/AuthConfig.yaml index 3c2e3f44801b..78e33c7ba293 100644 --- a/mmv1/products/integrations/AuthConfig.yaml +++ b/mmv1/products/integrations/AuthConfig.yaml @@ -38,18 +38,6 @@ custom_code: post_create: 'templates/terraform/post_create/set_computed_name.tmpl' pre_update: 'templates/terraform/pre_update/integrations_auth_config.go.tmpl' custom_import: 'templates/terraform/custom_import/self_link_as_name.tmpl' -sweeper: - url_substitutions: - - region: "asia-east1" - - region: "southamerica-west1" - - region: "asia-east2" - - region: "us-south1" - - region: "northamerica-northeast2" - - region: "us-west4" - - region: "us-west2" - - region: "us-west3" - - region: "southamerica-east1" - - region: "northamerica-northeast1" examples: - name: 'integrations_auth_config_basic' primary_resource_id: 'basic_example' diff --git a/mmv1/products/integrations/Client.yaml b/mmv1/products/integrations/Client.yaml index 2358a3044583..cd1162e21f5d 100644 --- a/mmv1/products/integrations/Client.yaml +++ b/mmv1/products/integrations/Client.yaml @@ -37,20 +37,6 @@ timeouts: custom_code: decoder: 'templates/terraform/decoders/integrations_client.go.tmpl' pre_create: 'templates/terraform/pre_create/integrations_client.go.tmpl' -sweeper: - url_substitutions: - - region: "asia-east1" - - region: "southamerica-west1" - - region: "asia-east2" - - region: "us-south1" - - region: "northamerica-northeast2" - - region: "us-central1" - - region: "us-west4" - - region: "us-west2" - - region: "us-west3" - - region: "southamerica-east1" - - region: "northamerica-northeast1" - - region: "us-east1" examples: - name: 'integrations_client_basic' primary_resource_id: 'example' diff --git a/mmv1/products/kms/KeyHandle.yaml b/mmv1/products/kms/KeyHandle.yaml index a65e9206c0b9..e4648a16f889 100644 --- a/mmv1/products/kms/KeyHandle.yaml +++ b/mmv1/products/kms/KeyHandle.yaml @@ -61,6 +61,9 @@ examples: org_id: 'ORG_ID' billing_account: 'BILLING_ACCT' external_providers: ["random", "time"] + # Need the time_sleep resource + # Currently failing + skip_vcr: true parameters: - name: 'location' type: String diff --git a/mmv1/products/managedkafka/Cluster.yaml b/mmv1/products/managedkafka/Cluster.yaml index 4f116feb8953..aa3d7bbd5dca 100644 --- a/mmv1/products/managedkafka/Cluster.yaml +++ b/mmv1/products/managedkafka/Cluster.yaml @@ -28,7 +28,6 @@ timeouts: update_minutes: 30 delete_minutes: 30 autogen_async: true -autogen_status: Q2x1c3Rlcg== async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/managedkafka/Topic.yaml b/mmv1/products/managedkafka/Topic.yaml index 668990a26bfe..0cfdbdd5b125 100644 --- a/mmv1/products/managedkafka/Topic.yaml +++ b/mmv1/products/managedkafka/Topic.yaml @@ -27,7 +27,6 @@ timeouts: insert_minutes: 20 update_minutes: 20 delete_minutes: 20 -autogen_status: VG9waWM= custom_code: post_create: 'templates/terraform/post_create/sleep.go.tmpl' post_update: 'templates/terraform/post_create/sleep.go.tmpl' diff --git a/mmv1/products/memorystore/Instance.yaml b/mmv1/products/memorystore/Instance.yaml index b4f3f54ea8a0..4d2d58368198 100644 --- a/mmv1/products/memorystore/Instance.yaml +++ b/mmv1/products/memorystore/Instance.yaml @@ -28,7 +28,6 @@ timeouts: update_minutes: 120 delete_minutes: 30 autogen_async: true -autogen_status: SW5zdGFuY2U= async: actions: ['create', 'delete', 'update'] type: 'OpAsync' @@ -302,77 +301,74 @@ properties: description: "Endpoints for the instance." output: true item_type: - type: NestedObject - properties: - - name: 'connections' - type: Array - description: "A group of PSC connections. They are created in the same VPC network, one for each service attachment in the cluster." - item_type: - type: NestedObject - properties: - - name: 'pscAutoConnection' - type: NestedObject - description: "Detailed information of a PSC connection that is created through service connectivity automation." - properties: - - name: 'pscConnectionId' - type: String - description: - "Output only. The PSC connection id of the forwarding rule connected - to the\nservice attachment. " - output: true - - name: 'ipAddress' - type: String - description: - "Output only. The IP allocated on the consumer network for the - PSC forwarding rule. " - output: true - - name: 'forwardingRule' - type: String - description: "Output only. The URI of the consumer side forwarding rule.\nFormat:\nprojects/{project}/regions/{region}/forwardingRules/{forwarding_rule} " - output: true - - name: 'projectId' - type: String - description: - "Output only. The consumer project_id where the forwarding rule is - created from. " - output: true - - name: 'network' - type: String - description: - "Output only. The consumer network where the IP address resides, in - the form of\nprojects/{project_id}/global/networks/{network_id}. " - output: true - - name: 'serviceAttachment' - type: String - description: - "Output only. The service attachment which is the target of the PSC connection, in the form of - projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}." - output: true - - name: 'connectionType' - type: Enum - description: - "Output Only. Type of a PSC Connection. - \n Possible values:\n CONNECTION_TYPE_DISCOVERY \n CONNECTION_TYPE_PRIMARY \n CONNECTION_TYPE_READER" - output: true - enum_values: - - 'CONNECTION_TYPE_READER' - - 'CONNECTION_TYPE_PRIMARY' - - 'CONNECTION_TYPE_DISCOVERY' - - name: 'port' - type: Integer - description: - "Output only. Ports of the exposed endpoint." - output: true + type: Array + description: "A group of PSC connections. They are created in the same VPC network, one for each service attachment in the cluster." + item_type: + type: NestedObject + properties: + - name: 'pscConnectionId' + type: String + description: + "Output only. The PSC connection id of the forwarding rule connected + to the\nservice attachment. " + output: true + - name: 'ipAddress' + type: String + description: + "Output only. The IP allocated on the consumer network for the + PSC forwarding rule. " + output: true + - name: 'forwardingRule' + type: String + description: "Output only. The URI of the consumer side forwarding rule.\nFormat:\nprojects/{project}/regions/{region}/forwardingRules/{forwarding_rule} " + output: true + - name: 'projectId' + type: String + description: + "Output only. The consumer project_id where the forwarding rule is + created from. " + output: true + - name: 'network' + type: String + description: + "Output only. The consumer network where the IP address resides, in + the form of\nprojects/{project_id}/global/networks/{network_id}. " + output: true + - name: 'serviceAttachment' + type: String + description: + "Output only. The service attachment which is the target of the PSC connection, in the form of + projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}." + output: true + - name: 'pscConnectionStatus' + type: Enum + description: + "Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists. + \n Possible values:\n ACTIVE \n NOT_FOUND" + output: true + enum_values: + - 'ACTIVE' + - 'NOT_FOUND' + - name: 'connectionType' + type: Enum + description: + "Output Only. Type of a PSC Connection. + \n Possible values:\n CONNECTION_TYPE_DISCOVERY \n CONNECTION_TYPE_PRIMARY \n CONNECTION_TYPE_READER" + output: true + enum_values: + - 'CONNECTION_TYPE_READER' + - 'CONNECTION_TYPE_PRIMARY' + - 'CONNECTION_TYPE_DISCOVERY' - name: 'mode' type: Enum description: - "Optional. cluster or cluster-disabled. - \n Possible values:\n CLUSTER\n CLUSTER_DISABLED" + "Optional. Standalone or cluster. + \n Possible values:\n CLUSTER\nSTANDALONE" default_from_api: true immutable: true enum_values: - 'CLUSTER' - - 'CLUSTER_DISABLED' + - 'STANDALONE' - name: 'pscAutoConnections' type: Array description: diff --git a/mmv1/products/metastore/Service.yaml b/mmv1/products/metastore/Service.yaml index e7476b55f330..c6354f62f92b 100644 --- a/mmv1/products/metastore/Service.yaml +++ b/mmv1/products/metastore/Service.yaml @@ -28,9 +28,9 @@ update_mask: true import_format: - 'projects/{{project}}/locations/{{location}}/services/{{service_id}}' timeouts: - insert_minutes: 75 - update_minutes: 75 - delete_minutes: 75 + insert_minutes: 60 + update_minutes: 60 + delete_minutes: 60 autogen_async: true async: actions: ['create', 'delete', 'update'] @@ -38,9 +38,9 @@ async: operation: base_url: '{{op_id}}' timeouts: - insert_minutes: 75 - update_minutes: 75 - delete_minutes: 75 + insert_minutes: 60 + update_minutes: 60 + delete_minutes: 60 result: resource_inside_response: false iam_policy: diff --git a/mmv1/products/metastore/product.yaml b/mmv1/products/metastore/product.yaml index e9b3f67f0725..80bf9dd9fe5e 100644 --- a/mmv1/products/metastore/product.yaml +++ b/mmv1/products/metastore/product.yaml @@ -13,7 +13,7 @@ --- name: 'DataprocMetastore' -display_name: 'Dataproc Metastore' +display_name: 'Dataproc metastore' versions: - name: 'beta' base_url: 'https://metastore.googleapis.com/v1beta/' diff --git a/mmv1/products/migrationcenter/Group.yaml b/mmv1/products/migrationcenter/Group.yaml index f6a24c6f1ac1..fabad8b101ed 100644 --- a/mmv1/products/migrationcenter/Group.yaml +++ b/mmv1/products/migrationcenter/Group.yaml @@ -30,7 +30,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 autogen_async: true -autogen_status: R3JvdXA= async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/migrationcenter/PreferenceSet.yaml b/mmv1/products/migrationcenter/PreferenceSet.yaml index bb71a4f961f9..705e70e123bb 100644 --- a/mmv1/products/migrationcenter/PreferenceSet.yaml +++ b/mmv1/products/migrationcenter/PreferenceSet.yaml @@ -32,7 +32,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 autogen_async: true -autogen_status: UHJlZmVyZW5jZVNldA== async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/monitoring/AlertPolicy.yaml b/mmv1/products/monitoring/AlertPolicy.yaml index f1598f6b2f65..62e914c205f4 100644 --- a/mmv1/products/monitoring/AlertPolicy.yaml +++ b/mmv1/products/monitoring/AlertPolicy.yaml @@ -885,10 +885,9 @@ properties: must be valid. Label values can be templatized by using variables. The only available - variable names are the names of the labels in the PromQL result, - although label names beginning with \_\_ (two "\_") are reserved for - internal use. "labels" may be empty. This field is intended to be used - for organizing and identifying the AlertPolicy. + variable names are the names of the labels in the PromQL result, including + "__name__" and "value". "labels" may be empty. This field is intended to be + used for organizing and identifying the AlertPolicy - name: 'ruleGroup' type: String description: | @@ -925,150 +924,6 @@ properties: Users with the `monitoring.alertPolicyViewer` role are able to see the name of the non-existent metric in the alerting policy condition. - - name: 'conditionSql' - type: NestedObject - description: | - A condition that allows alerting policies to be defined using GoogleSQL. - SQL conditions examine a sliding window of logs using GoogleSQL. - Alert policies with SQL conditions may incur additional billing. - properties: - - name: 'query' - type: String - description: | - The Log Analytics SQL query to run, as a string. The query must - conform to the required shape. Specifically, the query must not try to - filter the input by time. A filter will automatically be applied - to filter the input so that the query receives all rows received - since the last time the query was run. - required: true - - name: 'minutes' - type: NestedObject - description: | - Used to schedule the query to run every so many minutes. - properties: - - name: 'periodicity' - type: Integer - description: | - Number of minutes between runs. The interval must be greater than or - equal to 5 minutes and less than or equal to 1440 minutes. - required: true - exactly_one_of: - - 'minutes' - - 'hourly' - - 'daily' - - name: 'hourly' - type: NestedObject - description: | - Used to schedule the query to run every so many hours. - properties: - - name: 'periodicity' - type: Integer - description: | - Number of hours between runs. The interval must be greater than or - equal to 1 hour and less than or equal to 48 hours. - required: true - - name: 'minuteOffset' - type: Integer - description: | - The number of minutes after the hour (in UTC) to run the query. - Must be greater than or equal to 0 minutes and less than or equal to - 59 minutes. If left unspecified, then an arbitrary offset is used. - exactly_one_of: - - 'minutes' - - 'hourly' - - 'daily' - - name: 'daily' - type: NestedObject - description: | - Used to schedule the query to run every so many days. - properties: - - name: periodicity - type: Integer - description: | - The number of days between runs. Must be greater than or equal - to 1 day and less than or equal to 30 days. - required: true - - name: 'executionTime' - type: NestedObject - description: | - The time of day (in UTC) at which the query should run. If left - unspecified, the server picks an arbitrary time of day and runs - the query at the same time each day. - properties: - - name: 'hours' - type: Integer - description: | - Hours of a day in 24 hour format. Must be greater than or equal - to 0 and typically must be less than or equal to 23. An API may - choose to allow the value "24:00:00" for scenarios like business - closing time. - - name: 'minutes' - type: Integer - description: | - Minutes of an hour. Must be greater than or equal to 0 and - less than or equal to 59. - - name: 'seconds' - type: Integer - description: | - Seconds of a minute. Must be greater than or equal to 0 and - typically must be less than or equal to 59. An API may allow the - value 60 if it allows leap-seconds. - - name: 'nanos' - type: Integer - description: | - Fractions of seconds, in nanoseconds. Must be greater than or - equal to 0 and less than or equal to 999,999,999. - exactly_one_of: - - 'minutes' - - 'hourly' - - 'daily' - - name: 'rowCountTest' - type: NestedObject - description: | - Test the row count against a threshold. - properties: - - name: 'comparison' - type: Enum - description: | - The comparison to apply between the time - series (indicated by filter and aggregation) - and the threshold (indicated by - threshold_value). The comparison is applied - on each time series, with the time series on - the left-hand side and the threshold on the - right-hand side. Only COMPARISON_LT and - COMPARISON_GT are supported currently. - enum_values: - - 'COMPARISON_GT' - - 'COMPARISON_GE' - - 'COMPARISON_LT' - - 'COMPARISON_LE' - - 'COMPARISON_EQ' - - 'COMPARISON_NE' - required: true - - name: 'threshold' - type: Integer - description: | - Test the boolean value in the indicated column. - required: true - exactly_one_of: - - 'rowCountTest' - - 'booleanTest' - - name: 'booleanTest' - type: NestedObject - description: | - The start date and time of the query. If left unspecified, then the - query will start immediately. - properties: - - name: 'column' - type: String - description: | - The name of the column containing the boolean value. If the value - in a row is NULL, that row is ignored. - required: true - exactly_one_of: - - 'rowCountTest' - - 'booleanTest' - name: 'notificationChannels' type: Array # TODO chrisst - turn this into a resource ref diff --git a/mmv1/products/monitoring/MonitoredProject.yaml b/mmv1/products/monitoring/MonitoredProject.yaml index 1132bcae27f3..ca77c0017d02 100644 --- a/mmv1/products/monitoring/MonitoredProject.yaml +++ b/mmv1/products/monitoring/MonitoredProject.yaml @@ -37,10 +37,10 @@ custom_code: custom_import: 'templates/terraform/custom_import/monitoring_monitored_project.go.tmpl' test_check_destroy: 'templates/terraform/custom_check_destroy/monitoring_monitored_project.go.tmpl' error_retry_predicates: + - 'transport_tpg.IsMonitoringPermissionError' schema_version: 1 state_upgraders: true -exclude_sweeper: true examples: - name: 'monitoring_monitored_project_basic' primary_resource_id: 'primary' diff --git a/mmv1/products/netapp/StoragePool.yaml b/mmv1/products/netapp/StoragePool.yaml index 1ed8548994de..bf288ef502d8 100644 --- a/mmv1/products/netapp/StoragePool.yaml +++ b/mmv1/products/netapp/StoragePool.yaml @@ -160,7 +160,6 @@ properties: Specifies the active zone for regional Flex pools. `zone` and `replica_zone` values can be swapped to initiate a [zone switch](https://cloud.google.com/netapp/volumes/docs/configure-and-use/storage-pools/edit-or-delete-storage-pool#switch_active_and_replica_zones). If you want to create a zonal Flex pool, specify a zone name for `location` and omit `zone`. - default_from_api: true - name: 'replicaZone' type: String description: | diff --git a/mmv1/products/netapp/VolumeQuotaRule.yaml b/mmv1/products/netapp/VolumeQuotaRule.yaml deleted file mode 100644 index 930ef3c0e7eb..000000000000 --- a/mmv1/products/netapp/VolumeQuotaRule.yaml +++ /dev/null @@ -1,125 +0,0 @@ -# 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. - ---- -name: 'VolumeQuotaRule' -api_resource_type_kind: QuotaRule -description: | - QuotaRule specifies the maximum capacity a user or group can use within a volume. They can be used for creating default and individual quota rules. -references: - guides: - 'Documentation': https://cloud.google.com/netapp/volumes/docs/configure-and-use/volumes/overview#volume_user_and_group_quotas - api: https://cloud.google.com/netapp/volumes/docs/reference/rest/v1/projects.locations.volumes.quotaRules -docs: -base_url: 'projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/quotaRules' -self_link: 'projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/quotaRules/{{name}}' -create_url: 'projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/quotaRules?quotaRuleId={{name}}' -update_url: 'projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/quotaRules/{{name}}' -update_verb: 'PATCH' -update_mask: true -delete_url: 'projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/quotaRules/{{name}}' -timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 -autogen_async: true -async: - actions: ['create', 'delete', 'update'] - type: 'OpAsync' - operation: - base_url: '{{op_id}}' - result: - resource_inside_response: false -custom_code: -# Skipping the sweeper since we need to sweep multiple regions -exclude_sweeper: true -examples: - - name: 'netapp_volume_quota_rule_basic' - primary_resource_id: 'test_quota_rule' - vars: - volume_name: 'test-volume' - pool_name: 'test-pool' - network_name: 'test-network' - quota_rule_name: 'test-volume-quota-rule' - test_vars_overrides: - 'network_name': 'acctest.BootstrapSharedServiceNetworkingConnection(t, "gcnv-network-config-1", acctest.ServiceNetworkWithParentService("netapp.servicenetworking.goog"))' -parameters: - - name: 'location' - type: String - description: | - Loction of the quotaRule. QuotaRules are child resources of volumes and live in the same location. - url_param_only: true - immutable: true - - name: 'volume_name' - type: String - description: | - Name of the volume to create the quotaRule in. - url_param_only: true - required: true - immutable: true - - name: 'name' - type: String - description: - The resource name of the quotaRule. - url_param_only: true - required: true - immutable: true -properties: - - name: 'target' - type: String - description: | - The quota rule applies to the specified user or group. - Valid targets for volumes with NFS protocol enabled: - - UNIX UID for individual user quota - - UNIX GID for individual group quota - Valid targets for volumes with SMB protocol enabled: - - Windows SID for individual user quota - Leave empty for default quotas - - name: 'type' - type: Enum - description: | - Types of Quota Rule. - required: true - enum_values: - - 'INDIVIDUAL_USER_QUOTA' - - 'INDIVIDUAL_GROUP_QUOTA' - - 'DEFAULT_USER_QUOTA' - - 'DEFAULT_GROUP_QUOTA' - - name: 'diskLimitMib' - type: Integer - description: - The maximum allowed capacity in MiB. - required: true - - name: 'state' - type: String - description: | - The state of the quota rule. Possible Values : [STATE_UNSPECIFIED, CREATING, UPDATING, READY, DELETING, ERROR] - output: true - - name: 'stateDetails' - type: String - description: | - State details of the quota rule - output: true - - name: 'createTime' - type: String - description: | - Create time of the quota rule. A timestamp in RFC3339 UTC "Zulu" format. Examples: "2023-06-22T09:13:01.617Z". - output: true - - name: 'description' - type: String - description: | - Description for the quota rule. - - name: 'labels' - type: KeyValueLabels - description: | - Labels as key value pairs of the quota rule. Example: `{ "owner": "Bob", "department": "finance", "purpose": "testing" }`. diff --git a/mmv1/products/networkconnectivity/ServiceConnectionPolicy.yaml b/mmv1/products/networkconnectivity/ServiceConnectionPolicy.yaml index 2878c2554985..1ba54cabffbe 100644 --- a/mmv1/products/networkconnectivity/ServiceConnectionPolicy.yaml +++ b/mmv1/products/networkconnectivity/ServiceConnectionPolicy.yaml @@ -45,11 +45,6 @@ async: resource_inside_response: false custom_code: update_encoder: 'templates/terraform/encoders/service_connection_policy.go.tmpl' -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us-east1" - - region: "europe-west1" examples: - name: 'network_connectivity_policy_basic' primary_resource_id: 'default' diff --git a/mmv1/products/networkconnectivity/Spoke.yaml b/mmv1/products/networkconnectivity/Spoke.yaml index 4aa4b07e9d29..326f2c5782e2 100644 --- a/mmv1/products/networkconnectivity/Spoke.yaml +++ b/mmv1/products/networkconnectivity/Spoke.yaml @@ -37,10 +37,6 @@ async: resource_inside_response: false custom_code: legacy_long_form_project: true -sweeper: - url_substitutions: - - region: "us-central1" - - region: "global" examples: - name: 'network_connectivity_spoke_linked_vpc_network_basic' primary_resource_id: 'primary' @@ -104,12 +100,6 @@ examples: spoke_name: "vpc-spoke" auto_accept_project_1_name: "foo" auto_accept_project_2_name: "bar" - - name: 'network_connectivity_spoke_linked_vpc_network_ipv6_support' - primary_resource_id: 'primary' - vars: - network_name: 'net' - hub_name: 'hub1' - spoke_name: 'spoke1-ipv6' parameters: - name: 'location' type: String diff --git a/mmv1/products/networkmanagement/VpcFlowLogsConfig.yaml b/mmv1/products/networkmanagement/VpcFlowLogsConfig.yaml index f03e3ca43683..79f269ee11be 100644 --- a/mmv1/products/networkmanagement/VpcFlowLogsConfig.yaml +++ b/mmv1/products/networkmanagement/VpcFlowLogsConfig.yaml @@ -37,9 +37,6 @@ async: result: resource_inside_response: true custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'network_management_vpc_flow_logs_config_interconnect_full' primary_resource_id: 'interconnect-test' diff --git a/mmv1/products/networkmanagement/product.yaml b/mmv1/products/networkmanagement/product.yaml index 1d6bb32c1688..1a1672445a6c 100644 --- a/mmv1/products/networkmanagement/product.yaml +++ b/mmv1/products/networkmanagement/product.yaml @@ -13,7 +13,7 @@ --- name: 'NetworkManagement' -display_name: 'Network Management' +display_name: 'NetworkManagement' versions: - name: 'ga' base_url: 'https://networkmanagement.googleapis.com/v1/' diff --git a/mmv1/products/networksecurity/AuthzPolicy.yaml b/mmv1/products/networksecurity/AuthzPolicy.yaml index 8422b1ee0d1d..9267467ba128 100644 --- a/mmv1/products/networksecurity/AuthzPolicy.yaml +++ b/mmv1/products/networksecurity/AuthzPolicy.yaml @@ -44,9 +44,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-west1" examples: - name: 'network_services_authz_policy_advanced' primary_resource_id: 'default' @@ -61,9 +58,6 @@ examples: url_name: 'l7-ilb-map' target_proxy_name: 'l7-ilb-proxy' forwarding_rule_name: 'l7-ilb-forwarding-rule' - callouts_instance_name: 'l7-ilb-callouts-ins' - callouts_instance_group_name: 'l7-ilb-callouts-ins-group' - callouts_health_check_name: 'l7-ilb-callouts-healthcheck' backend_authz_name: 'authz-service' authz_extension_name: 'my-authz-ext' test_env_vars: diff --git a/mmv1/products/networksecurity/GatewaySecurityPolicy.yaml b/mmv1/products/networksecurity/GatewaySecurityPolicy.yaml index 2f0b309863b6..5675f2f0ad44 100644 --- a/mmv1/products/networksecurity/GatewaySecurityPolicy.yaml +++ b/mmv1/products/networksecurity/GatewaySecurityPolicy.yaml @@ -43,13 +43,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-east1" - - region: "us-central1" - - region: "us-west2" - - region: "us-west1" - - region: "us-south1" examples: - name: 'network_security_gateway_security_policy_basic' primary_resource_id: 'default' @@ -57,6 +50,7 @@ examples: resource_name: 'my-gateway-security-policy' - name: 'network_security_gateway_security_policy_tls_inspection_basic' primary_resource_id: 'default' + min_version: 'beta' vars: resource_name: 'my-gateway-security-policy' privateca_ca_tls_name: 'my-tls-inspection-policy' diff --git a/mmv1/products/networksecurity/InterceptDeployment.yaml b/mmv1/products/networksecurity/InterceptDeployment.yaml index 316d0b732ed3..d65c33a43353 100644 --- a/mmv1/products/networksecurity/InterceptDeployment.yaml +++ b/mmv1/products/networksecurity/InterceptDeployment.yaml @@ -34,12 +34,15 @@ async: type: 'OpAsync' operation: base_url: '{{op_id}}' + path: 'name' + wait_ms: 1000 result: + path: 'response' resource_inside_response: true + error: + path: 'error' + message: 'message' custom_code: -sweeper: - url_substitutions: - - region: "us-central1-a" examples: - name: 'network_security_intercept_deployment_basic' config_path: 'templates/terraform/examples/network_security_intercept_deployment_basic.tf.tmpl' diff --git a/mmv1/products/networksecurity/InterceptDeploymentGroup.yaml b/mmv1/products/networksecurity/InterceptDeploymentGroup.yaml index 4cd99be651dd..5ea32042f951 100644 --- a/mmv1/products/networksecurity/InterceptDeploymentGroup.yaml +++ b/mmv1/products/networksecurity/InterceptDeploymentGroup.yaml @@ -37,9 +37,6 @@ async: result: resource_inside_response: true custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'network_security_intercept_deployment_group_basic' config_path: 'templates/terraform/examples/network_security_intercept_deployment_group_basic.tf.tmpl' diff --git a/mmv1/products/networksecurity/InterceptEndpointGroup.yaml b/mmv1/products/networksecurity/InterceptEndpointGroup.yaml index f516b8df08a6..f15d3c3a7d62 100644 --- a/mmv1/products/networksecurity/InterceptEndpointGroup.yaml +++ b/mmv1/products/networksecurity/InterceptEndpointGroup.yaml @@ -34,12 +34,15 @@ async: type: 'OpAsync' operation: base_url: '{{op_id}}' + path: 'name' + wait_ms: 1000 result: + path: 'response' resource_inside_response: true + error: + path: 'error' + message: 'message' custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'network_security_intercept_endpoint_group_basic' config_path: 'templates/terraform/examples/network_security_intercept_endpoint_group_basic.tf.tmpl' diff --git a/mmv1/products/networksecurity/InterceptEndpointGroupAssociation.yaml b/mmv1/products/networksecurity/InterceptEndpointGroupAssociation.yaml index 90631c8dd28c..4c1da3f78e3e 100644 --- a/mmv1/products/networksecurity/InterceptEndpointGroupAssociation.yaml +++ b/mmv1/products/networksecurity/InterceptEndpointGroupAssociation.yaml @@ -34,12 +34,15 @@ async: type: 'OpAsync' operation: base_url: '{{op_id}}' + path: 'name' + wait_ms: 1000 result: + path: 'response' resource_inside_response: true + error: + path: 'error' + message: 'message' custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'network_security_intercept_endpoint_group_association_basic' config_path: 'templates/terraform/examples/network_security_intercept_endpoint_group_association_basic.tf.tmpl' diff --git a/mmv1/products/networksecurity/MirroringDeployment.yaml b/mmv1/products/networksecurity/MirroringDeployment.yaml index 7a177df46def..e8d90168d6ac 100644 --- a/mmv1/products/networksecurity/MirroringDeployment.yaml +++ b/mmv1/products/networksecurity/MirroringDeployment.yaml @@ -37,9 +37,6 @@ async: result: resource_inside_response: true custom_code: -sweeper: - url_substitutions: - - region: "us-central1-a" examples: - name: 'network_security_mirroring_deployment_basic' config_path: 'templates/terraform/examples/network_security_mirroring_deployment_basic.tf.tmpl' diff --git a/mmv1/products/networksecurity/MirroringDeploymentGroup.yaml b/mmv1/products/networksecurity/MirroringDeploymentGroup.yaml index ff9336ebb16f..f2dcfaffa10e 100644 --- a/mmv1/products/networksecurity/MirroringDeploymentGroup.yaml +++ b/mmv1/products/networksecurity/MirroringDeploymentGroup.yaml @@ -37,9 +37,6 @@ async: result: resource_inside_response: true custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'network_security_mirroring_deployment_group_basic' config_path: 'templates/terraform/examples/network_security_mirroring_deployment_group_basic.tf.tmpl' diff --git a/mmv1/products/networksecurity/MirroringEndpointGroup.yaml b/mmv1/products/networksecurity/MirroringEndpointGroup.yaml index cc242e61d2fb..5f77d9dc8dee 100644 --- a/mmv1/products/networksecurity/MirroringEndpointGroup.yaml +++ b/mmv1/products/networksecurity/MirroringEndpointGroup.yaml @@ -37,9 +37,6 @@ async: result: resource_inside_response: true custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'network_security_mirroring_endpoint_group_basic' config_path: 'templates/terraform/examples/network_security_mirroring_endpoint_group_basic.tf.tmpl' diff --git a/mmv1/products/networksecurity/MirroringEndpointGroupAssociation.yaml b/mmv1/products/networksecurity/MirroringEndpointGroupAssociation.yaml index 05e4a5fd35c8..3f4c4d3a4cc9 100644 --- a/mmv1/products/networksecurity/MirroringEndpointGroupAssociation.yaml +++ b/mmv1/products/networksecurity/MirroringEndpointGroupAssociation.yaml @@ -37,9 +37,6 @@ async: result: resource_inside_response: true custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'network_security_mirroring_endpoint_group_association_basic' config_path: 'templates/terraform/examples/network_security_mirroring_endpoint_group_association_basic.tf.tmpl' diff --git a/mmv1/products/networksecurity/SecurityProfile.yaml b/mmv1/products/networksecurity/SecurityProfile.yaml index fd01cfa5084e..3444d873bb9f 100644 --- a/mmv1/products/networksecurity/SecurityProfile.yaml +++ b/mmv1/products/networksecurity/SecurityProfile.yaml @@ -53,26 +53,6 @@ examples: resource_name: 'my-security-profile' test_env_vars: org_id: 'ORG_ID' - - name: 'network_security_security_profile_mirroring' - min_version: 'beta' - primary_resource_id: 'default' - vars: - resource_name: 'my-security-profile' - network_name: 'my-network' - deployment_group_id: 'my-dg' - endpoint_group_id: 'my-eg' - test_env_vars: - org_id: 'ORG_ID' - - name: 'network_security_security_profile_intercept' - min_version: 'beta' - primary_resource_id: 'default' - vars: - resource_name: 'my-security-profile' - network_name: 'my-network' - deployment_group_id: 'my-dg' - endpoint_group_id: 'my-eg' - test_env_vars: - org_id: 'ORG_ID' parameters: - name: 'name' type: String @@ -131,7 +111,6 @@ properties: properties: - name: 'severityOverrides' type: Array - is_set: true description: The configuration for overriding threats actions by severity match. item_type: type: NestedObject @@ -157,7 +136,6 @@ properties: - 'MEDIUM' - name: 'threatOverrides' type: Array - is_set: true description: | The configuration for overriding threats actions by threat id match. If a threat is matched both by configuration provided in severity overrides @@ -188,39 +166,6 @@ properties: - 'UNKNOWN' - 'VULNERABILITY' - 'SPYWARE' - conflicts: - - 'customMirroringProfile' - - 'customInterceptProfile' - - name: 'customMirroringProfile' - type: NestedObject - description: | - The configuration for defining the Mirroring Endpoint Group used to - mirror traffic to third-party collectors. - properties: - - name: mirroringEndpointGroup - type: String - description: | - The Mirroring Endpoint Group to which matching traffic should be mirrored. - Format: projects/{project_id}/locations/global/mirroringEndpointGroups/{endpoint_group_id} - required: true - conflicts: - - 'threatPreventionProfile' - - 'customInterceptProfile' - - name: 'customInterceptProfile' - type: NestedObject - description: | - The configuration for defining the Intercept Endpoint Group used to - intercept traffic to third-party firewall appliances. - properties: - - name: interceptEndpointGroup - type: String - description: | - The Intercept Endpoint Group to which matching traffic should be intercepted. - Format: projects/{project_id}/locations/global/interceptEndpointGroups/{endpoint_group_id} - required: true - conflicts: - - 'threatPreventionProfile' - - 'customMirroringProfile' - name: 'type' type: Enum description: The type of security profile. @@ -228,5 +173,3 @@ properties: immutable: true enum_values: - 'THREAT_PREVENTION' - - 'CUSTOM_MIRRORING' - - 'CUSTOM_INTERCEPT' diff --git a/mmv1/products/networksecurity/SecurityProfileGroup.yaml b/mmv1/products/networksecurity/SecurityProfileGroup.yaml index ba7d51a1ddc7..8ac8d609b722 100644 --- a/mmv1/products/networksecurity/SecurityProfileGroup.yaml +++ b/mmv1/products/networksecurity/SecurityProfileGroup.yaml @@ -49,28 +49,6 @@ examples: security_profile_name: 'sec-profile' test_env_vars: org_id: 'ORG_ID' - - name: 'network_security_security_profile_group_mirroring' - min_version: 'beta' - primary_resource_id: 'default' - vars: - network_name: 'network' - deployment_group_id: 'deployment-group' - endpoint_group_id: 'endpoint-group' - security_profile_name: 'sec-profile' - security_profile_group_name: 'sec-profile-group' - test_env_vars: - org_id: 'ORG_ID' - - name: 'network_security_security_profile_group_intercept' - min_version: 'beta' - primary_resource_id: 'default' - vars: - network_name: 'network' - deployment_group_id: 'deployment-group' - endpoint_group_id: 'endpoint-group' - security_profile_name: 'sec-profile' - security_profile_group_name: 'sec-profile-group' - test_env_vars: - org_id: 'ORG_ID' parameters: - name: 'name' type: String @@ -122,11 +100,3 @@ properties: type: String description: | Reference to a SecurityProfile with the threat prevention configuration for the SecurityProfileGroup. - - name: 'customMirroringProfile' - type: String - description: | - Reference to a SecurityProfile with the custom mirroring configuration for the SecurityProfileGroup. - - name: 'customInterceptProfile' - type: String - description: | - Reference to a SecurityProfile with the CustomIntercept configuration. diff --git a/mmv1/products/networksecurity/ServerTlsPolicy.yaml b/mmv1/products/networksecurity/ServerTlsPolicy.yaml index c0291f93a6e4..cd992c5e9dac 100644 --- a/mmv1/products/networksecurity/ServerTlsPolicy.yaml +++ b/mmv1/products/networksecurity/ServerTlsPolicy.yaml @@ -42,10 +42,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-central1" - - region: "global" examples: - name: 'network_security_server_tls_policy_basic' primary_resource_id: 'default' diff --git a/mmv1/products/networksecurity/product.yaml b/mmv1/products/networksecurity/product.yaml index 373437e500f8..928480f542f7 100644 --- a/mmv1/products/networksecurity/product.yaml +++ b/mmv1/products/networksecurity/product.yaml @@ -13,7 +13,7 @@ --- name: 'NetworkSecurity' -display_name: 'Network Security' +display_name: 'Network security' versions: - name: 'beta' base_url: 'https://networksecurity.googleapis.com/v1beta1/' diff --git a/mmv1/products/networkservices/AuthzExtension.yaml b/mmv1/products/networkservices/AuthzExtension.yaml index e5232b52ee82..3017001f2dfe 100644 --- a/mmv1/products/networkservices/AuthzExtension.yaml +++ b/mmv1/products/networkservices/AuthzExtension.yaml @@ -44,9 +44,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-west1" examples: - name: 'network_services_authz_extension_basic' primary_resource_id: 'default' @@ -142,8 +139,9 @@ properties: - name: 'wireFormat' type: Enum description: | - The format of communication supported by the callout extension. Will be set to EXT_PROC_GRPC by the backend if no value is set. - default_from_api: true + The format of communication supported by the callout extension. + default_value: "EXT_PROC_GRPC" + custom_flatten: 'templates/terraform/custom_flatten/default_if_empty.tmpl' enum_values: - 'WIRE_FORMAT_UNSPECIFIED' - 'EXT_PROC_GRPC' diff --git a/mmv1/products/networkservices/EdgeCacheService.yaml b/mmv1/products/networkservices/EdgeCacheService.yaml index 33ad8ba9c796..01a55cd39a83 100644 --- a/mmv1/products/networkservices/EdgeCacheService.yaml +++ b/mmv1/products/networkservices/EdgeCacheService.yaml @@ -329,24 +329,6 @@ properties: # TODO: (scottsuarez) conflicts also won't work for array path matchers yet, uncomment here once supported. # conflicts: # - Routing.PathMatcher.RouteRule.prefixMatch - - name: 'routeMethods' - type: NestedObject - description: | - Allow overriding the set of methods that are allowed for this route. - When not set, Media CDN allows only "GET", "HEAD", and "OPTIONS". - properties: - - name: 'allowedMethods' - type: Array - description: | - The non-empty set of HTTP methods that are allowed for this route. - - Any combination of "GET", "HEAD", "OPTIONS", "PUT", "POST", "DELETE", and "PATCH". - item_type: - type: String - min_size: 1 - max_size: 7 - item_validation: - regex: '^(?:GET|HEAD|OPTIONS|PUT|POST|DELETE|PATCH)$' - name: 'headerAction' type: NestedObject description: | @@ -836,15 +818,6 @@ properties: type: Boolean description: | If true, specifies the CORS policy is disabled. The default value is false, which indicates that the CORS policy is in effect. - - name: 'compressionMode' - type: Enum - description: | - Setting the compression mode to automatic enables dynamic compression for every eligible response. - - When dynamic compression is enabled, it is recommended to also set a cache policy to maximize efficiency. - enum_values: - - 'DISABLED' - - 'AUTOMATIC' - name: 'origin' type: String description: | diff --git a/mmv1/products/networkservices/Gateway.yaml b/mmv1/products/networkservices/Gateway.yaml index 725d48d30dfe..20b788a5cebf 100644 --- a/mmv1/products/networkservices/Gateway.yaml +++ b/mmv1/products/networkservices/Gateway.yaml @@ -48,7 +48,7 @@ async: custom_code: constants: 'templates/terraform/constants/network_services_gateway.go.tmpl' post_delete: 'templates/terraform/post_delete/network_services_gateway.go.tmpl' - update_encoder: 'templates/terraform/update_encoder/network_services_gateway.go.tmpl' + pre_update: 'templates/terraform/pre_update/network_services_gateway.go.tmpl' examples: - name: 'network_services_gateway_basic' primary_resource_id: 'default' @@ -147,6 +147,7 @@ properties: The proxy binds to the specified ports. Gateways of type 'SECURE_WEB_GATEWAY' are limited to 1 port. Gateways of type 'OPEN_MESH' listen on 0.0.0.0 and support multiple ports. required: true + immutable: true item_type: type: Integer - name: 'scope' diff --git a/mmv1/products/networkservices/LbRouteExtension.yaml b/mmv1/products/networkservices/LbRouteExtension.yaml index 85ddb1d2277d..b844b27b6d5d 100644 --- a/mmv1/products/networkservices/LbRouteExtension.yaml +++ b/mmv1/products/networkservices/LbRouteExtension.yaml @@ -38,9 +38,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-west1" examples: - name: 'network_services_lb_route_extension_basic' primary_resource_id: 'default' diff --git a/mmv1/products/networkservices/LbTrafficExtension.yaml b/mmv1/products/networkservices/LbTrafficExtension.yaml index 99070cde51b7..ca56b15edc87 100644 --- a/mmv1/products/networkservices/LbTrafficExtension.yaml +++ b/mmv1/products/networkservices/LbTrafficExtension.yaml @@ -38,9 +38,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-west1" examples: - name: 'network_services_lb_traffic_extension_basic' primary_resource_id: 'default' diff --git a/mmv1/products/networkservices/Mesh.yaml b/mmv1/products/networkservices/Mesh.yaml index 91143b4d0e86..a065b5d3227e 100644 --- a/mmv1/products/networkservices/Mesh.yaml +++ b/mmv1/products/networkservices/Mesh.yaml @@ -22,13 +22,13 @@ references: guides: api: 'https://cloud.google.com/traffic-director/docs/reference/network-services/rest/v1beta1/projects.locations.meshes' docs: -base_url: 'projects/{{project}}/locations/{{location}}/meshes' -self_link: 'projects/{{project}}/locations/{{location}}/meshes/{{name}}' -create_url: 'projects/{{project}}/locations/{{location}}/meshes?meshId={{name}}' +base_url: 'projects/{{project}}/locations/global/meshes' +self_link: 'projects/{{project}}/locations/global/meshes/{{name}}' +create_url: 'projects/{{project}}/locations/global/meshes?meshId={{name}}' update_verb: 'PATCH' update_mask: true import_format: - - 'projects/{{project}}/locations/{{location}}/meshes/{{name}}' + - 'projects/{{project}}/locations/global/meshes/{{name}}' timeouts: insert_minutes: 30 update_minutes: 30 @@ -46,8 +46,6 @@ async: result: resource_inside_response: false custom_code: -schema_version: 1 -state_upgraders: true examples: - name: 'network_services_mesh_basic' primary_resource_id: 'default' @@ -59,11 +57,6 @@ examples: min_version: 'beta' vars: resource_name: 'my-mesh-noport' - - name: 'network_services_mesh_location' - primary_resource_id: 'default' - min_version: 'beta' - vars: - resource_name: 'my-mesh' parameters: - name: 'name' type: String @@ -109,13 +102,3 @@ properties: '15001' is used as the interception port. This will is applicable only for sidecar proxy deployments. min_version: 'beta' - - name: 'location' - type: String - description: | - Location (region) of the Mesh resource to be created. Only the value 'global' is currently allowed; defaults to 'global' if omitted. - min_version: 'beta' - url_param_only: true - immutable: true - default_value: 'global' - validation: - regex: '^global$' diff --git a/mmv1/products/networkservices/ServiceLbPolicies.yaml b/mmv1/products/networkservices/ServiceLbPolicies.yaml index b7f4d7d0105b..79d4dd45cb97 100644 --- a/mmv1/products/networkservices/ServiceLbPolicies.yaml +++ b/mmv1/products/networkservices/ServiceLbPolicies.yaml @@ -46,9 +46,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'network_services_service_lb_policies_basic' primary_resource_id: 'default' diff --git a/mmv1/products/networkservices/product.yaml b/mmv1/products/networkservices/product.yaml index ac5fe7c36630..f3bceafaf1ce 100644 --- a/mmv1/products/networkservices/product.yaml +++ b/mmv1/products/networkservices/product.yaml @@ -13,7 +13,7 @@ --- name: 'NetworkServices' -display_name: 'Network Services' +display_name: 'Network services' versions: - name: 'beta' base_url: 'https://networkservices.googleapis.com/v1/' diff --git a/mmv1/products/notebooks/Environment.yaml b/mmv1/products/notebooks/Environment.yaml index 97443f8a9c0a..937e76426616 100644 --- a/mmv1/products/notebooks/Environment.yaml +++ b/mmv1/products/notebooks/Environment.yaml @@ -35,9 +35,6 @@ async: result: resource_inside_response: true custom_code: -sweeper: - url_substitutions: - - region: "us-west1-a" examples: - name: 'notebook_environment_basic' primary_resource_id: 'environment' diff --git a/mmv1/products/notebooks/Instance.yaml b/mmv1/products/notebooks/Instance.yaml index e5f82d4a64bb..1f4d6426311c 100644 --- a/mmv1/products/notebooks/Instance.yaml +++ b/mmv1/products/notebooks/Instance.yaml @@ -59,10 +59,6 @@ state_upgraders: true # This resource should not be removed until the 2025 major release or later. # Check instance availability first before fully removing. deprecation_message: '`google_notebook_instance` is deprecated and will be removed in a future major release. Use `google_workbench_instance` instead.' -sweeper: - url_substitutions: - - region: "us-central1-a" - - region: "us-west1-a" examples: - name: 'notebook_instance_basic' primary_resource_id: 'instance' diff --git a/mmv1/products/oracledatabase/AutonomousDatabase.yaml b/mmv1/products/oracledatabase/AutonomousDatabase.yaml index e3b225c4149a..efac72d3178f 100644 --- a/mmv1/products/oracledatabase/AutonomousDatabase.yaml +++ b/mmv1/products/oracledatabase/AutonomousDatabase.yaml @@ -30,7 +30,6 @@ timeouts: import_format: - 'projects/{{project}}/locations/{{location}}/autonomousDatabases/{{autonomous_database_id}}' autogen_async: true -autogen_status: QXV0b25vbW91c0RhdGFiYXNl async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/oracledatabase/CloudExadataInfrastructure.yaml b/mmv1/products/oracledatabase/CloudExadataInfrastructure.yaml index ac66ce05f378..85591aa84c1b 100644 --- a/mmv1/products/oracledatabase/CloudExadataInfrastructure.yaml +++ b/mmv1/products/oracledatabase/CloudExadataInfrastructure.yaml @@ -30,7 +30,6 @@ timeouts: update_minutes: 120 delete_minutes: 120 autogen_async: true -autogen_status: Q2xvdWRFeGFkYXRhSW5mcmFzdHJ1Y3R1cmU= async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/oracledatabase/CloudVmCluster.yaml b/mmv1/products/oracledatabase/CloudVmCluster.yaml index 34d8b6a7bb14..17bf222d0e87 100644 --- a/mmv1/products/oracledatabase/CloudVmCluster.yaml +++ b/mmv1/products/oracledatabase/CloudVmCluster.yaml @@ -32,7 +32,6 @@ timeouts: update_minutes: 60 delete_minutes: 60 autogen_async: true -autogen_status: Q2xvdWRWbUNsdXN0ZXI= async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/parallelstore/Instance.yaml b/mmv1/products/parallelstore/Instance.yaml index 59ae8a9cf935..0a8691591239 100644 --- a/mmv1/products/parallelstore/Instance.yaml +++ b/mmv1/products/parallelstore/Instance.yaml @@ -35,11 +35,7 @@ async: base_url: '{{op_id}}' result: resource_inside_response: true -autogen_status: SW5zdGFuY2U= custom_code: -sweeper: - url_substitutions: - - region: "us-central1-a" examples: - name: 'parallelstore_instance_basic_beta' primary_resource_id: 'instance' diff --git a/mmv1/products/parametermanager/Parameter.yaml b/mmv1/products/parametermanager/Parameter.yaml deleted file mode 100644 index 7851e09d4729..000000000000 --- a/mmv1/products/parametermanager/Parameter.yaml +++ /dev/null @@ -1,121 +0,0 @@ -# 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. - ---- -name: 'Parameter' -description: | - A Parameter resource is a logical parameter. -min_version: 'beta' -references: - guides: - api: 'https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters' -docs: -base_url: 'projects/{{project}}/locations/global/parameters' -self_link: 'projects/{{project}}/locations/global/parameters/{{parameter_id}}' -create_url: 'projects/{{project}}/locations/global/parameters?parameter_id={{parameter_id}}' -update_verb: 'PATCH' -update_mask: true -import_format: - - 'projects/{{project}}/locations/global/parameters/{{parameter_id}}' -timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 -examples: - - name: 'parameter_config_basic' - primary_resource_id: 'parameter-basic' - min_version: 'beta' - vars: - parameter_id: 'parameter' - - name: 'parameter_with_format' - primary_resource_id: 'parameter-with-format' - min_version: 'beta' - vars: - parameter_id: 'parameter' - - name: 'parameter_with_labels' - primary_resource_id: 'parameter-with-labels' - min_version: 'beta' - vars: - parameter_id: 'parameter' -parameters: - - name: 'parameterId' - type: String - description: | - This must be unique within the project. - url_param_only: true - required: true - immutable: true -properties: - - name: 'name' - type: String - description: | - The resource name of the Parameter. Format: - `projects/{{project}}/locations/global/parameters/{{parameter_id}}` - output: true - - name: 'createTime' - type: String - description: | - The time at which the Parameter was created. - output: true - - name: 'updateTime' - type: String - description: | - The time at which the Parameter was updated. - output: true - - name: 'policyMember' - type: NestedObject - description: | - Policy member strings of a Google Cloud resource. - output: true - properties: - - name: 'iamPolicyUidPrincipal' - type: String - description: | - IAM policy binding member referring to a Google Cloud resource by system-assigned unique identifier. - If a resource is deleted and recreated with the same name, the binding will not be applicable to the - new resource. Format: - `principal://parametermanager.googleapis.com/projects/{{project}}/uid/locations/global/parameters/{{uid}}` - output: true - - name: 'iamPolicyNamePrincipal' - type: String - description: | - IAM policy binding member referring to a Google Cloud resource by user-assigned name. If a - resource is deleted and recreated with the same name, the binding will be applicable to the - new resource. Format: - `principal://parametermanager.googleapis.com/projects/{{project}}/name/locations/global/parameters/{{parameter_id}}` - output: true - - name: 'labels' - type: KeyValueLabels - description: | - The labels assigned to this Parameter. - - Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, - and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62} - - Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, - and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} - - No more than 64 labels can be assigned to a given resource. - - An object containing a list of "key": value pairs. Example: - { "name": "wrench", "mass": "1.3kg", "count": "3" }. - - name: 'format' - type: Enum - description: | - The format type of the parameter resource. - default_value: 'UNFORMATTED' - immutable: true - enum_values: - - 'UNFORMATTED' - - 'YAML' - - 'JSON' diff --git a/mmv1/products/parametermanager/ParameterVersion.yaml b/mmv1/products/parametermanager/ParameterVersion.yaml deleted file mode 100644 index 893f66d6e2c4..000000000000 --- a/mmv1/products/parametermanager/ParameterVersion.yaml +++ /dev/null @@ -1,110 +0,0 @@ -# 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. - ---- -name: 'ParameterVersion' -description: | - A Parameter Version resource that stores the actual value of the parameter. -min_version: 'beta' -references: - guides: - api: 'https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters.versions' -docs: -base_url: '{{parameter}}/versions' -self_link: '{{parameter}}/versions/{{parameter_version_id}}' -create_url: '{{parameter}}/versions?parameter_version_id={{parameter_version_id}}' -update_verb: 'PATCH' -update_mask: true -import_format: - - 'projects/{{%project}}/locations/global/parameters/{{%parameter_id}}/versions/{{%parameter_version_id}}' -timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 -examples: - - name: 'parameter_version_basic' - primary_resource_id: 'parameter-version-basic' - min_version: 'beta' - vars: - parameter_id: 'parameter' - parameter_version_id: 'parameter_version' - - name: 'parameter_version_with_json_format' - primary_resource_id: 'parameter-version-with-json-format' - min_version: 'beta' - vars: - parameter_id: 'parameter' - parameter_version_id: 'parameter_version' - - name: 'parameter_version_with_yaml_format' - primary_resource_id: 'parameter-version-with-yaml-format' - min_version: 'beta' - vars: - parameter_id: 'parameter' - parameter_version_id: 'parameter_version' -custom_code: - custom_import: 'templates/terraform/custom_import/parameter_manager_parameter_version.go.tmpl' -parameters: - - name: 'parameter' - type: ResourceRef - description: | - Parameter Manager Parameter resource. - url_param_only: true - required: true - immutable: true - resource: 'Parameter' - imports: 'name' - - name: 'parameter_version_id' - type: String - description: | - Version ID of the Parameter Version Resource. This must be unique within the Parameter. - url_param_only: true - required: true - immutable: true -properties: - - name: 'name' - type: String - description: | - The resource name of the Parameter Version. Format: - `projects/{{project}}/locations/global/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` - output: true - - name: 'createTime' - type: String - description: | - The time at which the Parameter Version was created. - output: true - - name: 'updateTime' - type: String - description: | - The time at which the Parameter Version was updated. - output: true - - name: 'disabled' - type: Boolean - description: | - The current state of Parameter Version. This field is only applicable for updating Parameter Version. - - name: 'payload' - type: NestedObject - description: | - The payload content of a ParameterVersion resource. - flatten_object: true - required: true - immutable: true - custom_flatten: 'templates/terraform/custom_flatten/parameter_version_parameter_data.go.tmpl' - properties: - - name: 'parameter_data' - type: String - description: | - The Parameter data. - api_name: data - required: true - immutable: true - sensitive: true - custom_expand: 'templates/terraform/custom_expand/base64.go.tmpl' diff --git a/mmv1/products/parametermanagerregional/RegionalParameter.yaml b/mmv1/products/parametermanagerregional/RegionalParameter.yaml index d4036d040f90..8ad83bd80379 100644 --- a/mmv1/products/parametermanagerregional/RegionalParameter.yaml +++ b/mmv1/products/parametermanagerregional/RegionalParameter.yaml @@ -119,8 +119,8 @@ properties: - name: 'format' type: Enum description: | - The format type of the regional parameter. - default_value: 'UNFORMATTED' + The format type of the regional parameter. Default value is UNFORMATTED. + default_from_api: true immutable: true enum_values: - 'UNFORMATTED' diff --git a/mmv1/products/parametermanagerregional/RegionalParameterVersion.yaml b/mmv1/products/parametermanagerregional/RegionalParameterVersion.yaml deleted file mode 100644 index 61b69530b605..000000000000 --- a/mmv1/products/parametermanagerregional/RegionalParameterVersion.yaml +++ /dev/null @@ -1,118 +0,0 @@ -# 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. - ---- -name: 'RegionalParameterVersion' -api_resource_type_kind: ParameterVersion -description: | - A Regional Parameter Version resource that stores the actual value of the regional parameter. -min_version: 'beta' -references: - guides: - api: 'https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters.versions' -docs: -base_url: '{{parameter}}/versions' -self_link: '{{parameter}}/versions/{{parameter_version_id}}' -create_url: '{{parameter}}/versions?parameter_version_id={{parameter_version_id}}' -update_verb: 'PATCH' -update_mask: true -import_format: - - 'projects/{{%project}}/locations/{{%location}}/parameters/{{%parameter_id}}/versions/{{%parameter_version_id}}' -timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 -examples: - - name: 'regional_parameter_version_basic' - primary_resource_id: 'regional-parameter-version-basic' - min_version: 'beta' - vars: - parameter_id: 'regional_parameter' - parameter_version_id: 'regional_parameter_version' - - name: 'regional_parameter_version_with_json_format' - primary_resource_id: 'regional-parameter-version-with-json-format' - min_version: 'beta' - vars: - parameter_id: 'regional_parameter' - parameter_version_id: 'regional_parameter_version' - - name: 'regional_parameter_version_with_yaml_format' - primary_resource_id: 'regional-parameter-version-with-yaml-format' - min_version: 'beta' - vars: - parameter_id: 'regional_parameter' - parameter_version_id: 'regional_parameter_version' -custom_code: - pre_create: 'templates/terraform/pre_create/parameter_manager_regional_parameter_version.go.tmpl' - custom_import: 'templates/terraform/custom_import/parameter_manager_regional_parameter_version.go.tmpl' -parameters: - - name: 'parameter' - type: ResourceRef - description: | - Parameter Manager Regional Parameter resource. - url_param_only: true - required: true - immutable: true - resource: 'RegionalParameter' - imports: 'name' - - name: 'parameter_version_id' - type: String - description: | - Version ID of the Regional Parameter Version Resource. This must be unique within the Regional Parameter. - url_param_only: true - required: true - immutable: true - - name: 'location' - type: String - description: | - Location of Parameter Manager Regional parameter resource. - url_param_only: true - output: true -properties: - - name: 'name' - type: String - description: | - The resource name of the Regional Parameter Version. Format: - `projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` - output: true - - name: 'createTime' - type: String - description: | - The time at which the Regional Parameter Version was created. - output: true - - name: 'updateTime' - type: String - description: | - The time at which the Regional Parameter Version was updated. - output: true - - name: 'disabled' - type: Boolean - description: | - The current state of Regional Parameter Version. This field is only applicable for updating Regional Parameter Version. - - name: 'payload' - type: NestedObject - description: | - The parameter payload of the RegionalParameterVersion. - flatten_object: true - required: true - immutable: true - custom_flatten: 'templates/terraform/custom_flatten/parameter_version_parameter_data.go.tmpl' - properties: - - name: 'parameter_data' - type: String - description: | - The Regional Parameter data. - api_name: data - required: true - immutable: true - sensitive: true - custom_expand: 'templates/terraform/custom_expand/base64.go.tmpl' diff --git a/mmv1/products/privateca/CertificateAuthority.yaml b/mmv1/products/privateca/CertificateAuthority.yaml index c6a7e80aa27e..e0f585d01e89 100644 --- a/mmv1/products/privateca/CertificateAuthority.yaml +++ b/mmv1/products/privateca/CertificateAuthority.yaml @@ -105,7 +105,7 @@ examples: # Skip test because it depends on a beta resource, but PrivateCA does # not have a beta endpoint exclude_test: true - # Multiple IAM bindings on the same key cause non-determinism + # Multiple IAM bindings on the same key cause non-determinism skip_vcr: true - name: 'privateca_certificate_authority_custom_ski' primary_resource_id: 'default' @@ -126,19 +126,6 @@ examples: exclude_test: true # Multiple IAM bindings on the same key cause non-determinism skip_vcr: true - - name: 'privateca_certificate_authority_basic_with_custom_cdp_aia_urls' - primary_resource_id: 'default' - vars: - certificate_authority_id: 'my-certificate-authority' - pool_name: 'ca-pool' - pool_location: 'us-central1' - deletion_protection: 'true' - test_vars_overrides: - 'pool_name': 'acctest.BootstrapSharedCaPoolInLocation(t, "us-central1")' - 'pool_location': '"us-central1"' - 'deletion_protection': 'false' - ignore_read_extra: - - 'deletion_protection' virtual_fields: - name: 'deletion_protection' description: | @@ -651,7 +638,7 @@ properties: "notAfterTime" fields inside an X.509 certificate. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". immutable: true - # 10 years + # 10 years default_value: "315360000s" - name: 'keySpec' type: NestedObject @@ -798,21 +785,3 @@ properties: An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. - - name: 'userDefinedAccessUrls' - type: NestedObject - description: | - Custom URLs for accessing content published by this CA, such as the CA certificate and CRLs, - that can be specified by users. - properties: - - name: 'aiaIssuingCertificateUrls' - type: Array - description: | - A list of URLs where this CertificateAuthority's CA certificate is published that is specified by users. - item_type: - type: String - - name: 'crlAccessUrls' - type: Array - description: | - A list of URLs where this CertificateAuthority's CRLs are published that is specified by users. - item_type: - type: String diff --git a/mmv1/products/privilegedaccessmanager/Entitlement.yaml b/mmv1/products/privilegedaccessmanager/Entitlement.yaml index 773e45642bd6..f0256cc04075 100644 --- a/mmv1/products/privilegedaccessmanager/Entitlement.yaml +++ b/mmv1/products/privilegedaccessmanager/Entitlement.yaml @@ -15,11 +15,6 @@ name: 'Entitlement' description: | An Entitlement defines the eligibility of a set of users to obtain a predefined access for some time possibly after going through an approval workflow. -references: - guides: - 'Official Documentation': 'https://cloud.google.com/iam/docs/pam-overview' - 'How to create an Entitlement': 'https://cloud.google.com/iam/docs/pam-create-entitlements' - api: 'https://cloud.google.com/iam/docs/reference/pam/rest' docs: id_format: '{{parent}}/locations/{{location}}/entitlements/{{entitlement_id}}' base_url: '{{parent}}/locations/{{location}}/entitlements' diff --git a/mmv1/products/publicca/product.yaml b/mmv1/products/publicca/product.yaml index 475aba18755e..b774d7c18452 100644 --- a/mmv1/products/publicca/product.yaml +++ b/mmv1/products/publicca/product.yaml @@ -13,7 +13,7 @@ --- name: 'PublicCA' -display_name: 'Public CA' +display_name: 'Public ca' versions: - name: 'ga' base_url: 'https://publicca.googleapis.com/v1/' diff --git a/mmv1/products/pubsub/Subscription.yaml b/mmv1/products/pubsub/Subscription.yaml index 9b3e7064839b..10abe7e0220e 100644 --- a/mmv1/products/pubsub/Subscription.yaml +++ b/mmv1/products/pubsub/Subscription.yaml @@ -72,11 +72,8 @@ examples: subscription_name: 'example-subscription' dataset_id: 'example_dataset' table_id: 'example_table' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com" - role: "roles/bigquery.dataEditor" - - member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com" - role: "roles/bigquery.metadataViewer" + test_vars_overrides: + policy_changed: 'acctest.BootstrapPSARoles(t, "service-", "gcp-sa-pubsub", []string{"roles/bigquery.dataEditor", "roles/bigquery.metadataViewer"})' - name: 'pubsub_subscription_push_bq_table_schema' primary_resource_id: 'example' vars: @@ -84,11 +81,8 @@ examples: subscription_name: 'example-subscription' dataset_id: 'example_dataset' table_id: 'example_table' - bootstrap_iam: - - member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com" - role: "roles/bigquery.dataEditor" - - member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com" - role: "roles/bigquery.metadataViewer" + test_vars_overrides: + policy_changed: 'acctest.BootstrapPSARoles(t, "service-", "gcp-sa-pubsub", []string{"roles/bigquery.dataEditor", "roles/bigquery.metadataViewer"})' - name: 'pubsub_subscription_push_bq_service_account' primary_resource_id: 'example' vars: diff --git a/mmv1/products/pubsub/Topic.yaml b/mmv1/products/pubsub/Topic.yaml index 63cfaf7038c9..8b539c7edd93 100644 --- a/mmv1/products/pubsub/Topic.yaml +++ b/mmv1/products/pubsub/Topic.yaml @@ -87,18 +87,6 @@ examples: primary_resource_id: 'example' vars: topic_name: 'example-topic' - - name: 'pubsub_topic_ingestion_azure_event_hubs' - primary_resource_id: 'example' - vars: - topic_name: 'example-topic' - - name: 'pubsub_topic_ingestion_aws_msk' - primary_resource_id: 'example' - vars: - topic_name: 'example-topic' - - name: 'pubsub_topic_ingestion_confluent_cloud' - primary_resource_id: 'example' - vars: - topic_name: 'example-topic' parameters: properties: - name: 'name' @@ -141,14 +129,6 @@ properties: required: true item_type: type: String - - name: "enforceInTransit" - type: Boolean - description: | - If true, `allowedPersistenceRegions` is also used to enforce in-transit - guarantees for messages. That is, Pub/Sub will fail topics.publish - operations on this topic and subscribe operations on any subscription - attached to this topic in any region that is not in `allowedPersistenceRegions`. - required: false - name: 'schemaSettings' type: NestedObject description: | @@ -193,9 +173,6 @@ properties: conflicts: - 'aws_kinesis' - 'cloud_storage' - - 'azure_event_hubs' - - 'aws_msk' - - 'confluent_cloud' properties: - name: 'streamArn' type: String @@ -230,9 +207,6 @@ properties: conflicts: - 'aws_kinesis' - 'cloud_storage' - - 'azure_event_hubs' - - 'aws_msk' - - 'confluent_cloud' properties: - name: 'bucket' type: String @@ -324,116 +298,3 @@ properties: - 'INFO' - 'WARNING' - 'ERROR' - - name: 'azureEventHubs' - type: NestedObject - description: | - Settings for ingestion from Azure Event Hubs. - conflicts: - - 'aws_kinesis' - - 'cloud_storage' - - 'azure_event_hubs' - - 'aws_msk' - - 'confluent_cloud' - properties: - - name: 'resourceGroup' - type: String - description: | - The name of the resource group within an Azure subscription. - - name: 'namespace' - type: String - description: | - The Azure event hub namespace to ingest data from. - - name: 'eventHub' - type: String - description: | - The Azure event hub to ingest data from. - - name: 'clientId' - type: String - description: | - The Azure event hub client ID to use for ingestion. - - name: 'tenantId' - type: String - description: | - The Azure event hub tenant ID to use for ingestion. - - name: 'subscriptionId' - type: String - description: | - The Azure event hub subscription ID to use for ingestion. - - name: 'gcpServiceAccount' - type: String - description: | - The GCP service account to be used for Federated Identity authentication - with Azure (via a `AssumeRoleWithWebIdentity` call for the provided - role). - - name: 'awsMsk' - type: NestedObject - description: | - Settings for ingestion from Amazon Managed Streaming for Apache Kafka. - conflicts: - - 'aws_kinesis' - - 'cloud_storage' - - 'azure_event_hubs' - - 'aws_msk' - - 'confluent_cloud' - properties: - - name: 'clusterArn' - type: String - description: | - ARN that uniquely identifies the MSK cluster. - required: true - - name: 'topic' - type: String - description: | - The name of the MSK topic that Pub/Sub will import from. - required: true - - name: 'awsRoleArn' - type: String - description: | - AWS role ARN to be used for Federated Identity authentication with - MSK. Check the Pub/Sub docs for how to set up this role and the - required permissions that need to be attached to it. - required: true - - name: 'gcpServiceAccount' - type: String - description: | - The GCP service account to be used for Federated Identity authentication - with MSK (via a `AssumeRoleWithWebIdentity` call for the provided - role). The `awsRoleArn` must be set up with `accounts.google.com:sub` - equals to this service account number. - required: true - - name: 'confluentCloud' - type: NestedObject - description: | - Settings for ingestion from Confluent Cloud. - conflicts: - - 'aws_kinesis' - - 'cloud_storage' - - 'azure_event_hubs' - - 'aws_msk' - - 'confluent_cloud' - properties: - - name: 'bootstrapServer' - type: String - description: | - The Confluent Cloud bootstrap server. The format is url:port. - required: true - - name: 'clusterId' - type: String - description: | - The Confluent Cloud cluster ID. - - name: 'topic' - type: String - description: | - Name of the Confluent Cloud topic that Pub/Sub will import from. - required: true - - name: 'identityPoolId' - type: String - description: | - Identity pool ID to be used for Federated Identity authentication with Confluent Cloud. - required: true - - name: 'gcpServiceAccount' - type: String - description: | - The GCP service account to be used for Federated Identity authentication - with Confluent Cloud. - required: true diff --git a/mmv1/products/redis/Cluster.yaml b/mmv1/products/redis/Cluster.yaml index cc5d24855ba5..9a841e1ee0cf 100644 --- a/mmv1/products/redis/Cluster.yaml +++ b/mmv1/products/redis/Cluster.yaml @@ -21,10 +21,6 @@ references: api: 'https://cloud.google.com/memorystore/docs/cluster/reference/rest/v1/projects.locations.clusters' docs: note: | - For [Multiple VPC Networking](https://cloud.google.com/memorystore/docs/cluster/about-multiple-vpc-networking) if you want to use - [User-registered PSC Connections](https://cloud.google.com/memorystore/docs/cluster/about-multiple-vpc-networking#psc_connection_types), - then please use `google_redis_cluster_user_created_connections` resource. - For [Cross Region Replication](https://cloud.google.com/memorystore/docs/cluster/about-cross-region-replication), please follow the instructions below for performing certain update and failover (switchover and detach) operations **Cross Region Replication** @@ -116,11 +112,6 @@ async: result: resource_inside_response: false custom_code: -sweeper: - url_substitutions: - - region: "us-central1" - - region: "us-east1" - - region: "europe-west1" examples: - name: 'redis_cluster_ha' primary_resource_id: 'cluster-ha' @@ -272,7 +263,6 @@ properties: type: NestedObject description: Immutable. Zone distribution config for Memorystore Redis cluster. immutable: true - default_from_api: true properties: - name: 'mode' type: Enum @@ -293,6 +283,7 @@ properties: Required. Each PscConfig configures the consumer network where two network addresses will be designated to the cluster for client access. Currently, only one PscConfig is supported. + required: true ignore_read: true item_type: type: NestedObject @@ -696,25 +687,3 @@ properties: description: | The last time cross cluster replication config was updated. output: true - - name: 'pscServiceAttachments' - type: Array - description: Service attachment details to configure Psc connections. - output: true - item_type: - type: NestedObject - description: | - Configuration of a service attachment of the cluster, for creating PSC connections. - properties: - - name: 'serviceAttachment' - type: String - output: true - description: | - Service attachment URI which your self-created PscConnection should use as - - name: 'connectionType' - type: Enum - output: true - enum_values: - - 'CONNECTION_TYPE_READER' - - 'CONNECTION_TYPE_PRIMARY' - - 'CONNECTION_TYPE_DISCOVERY' - description: Type of a PSC connection targeting this service attachment. diff --git a/mmv1/products/redis/ClusterUserCreatedConnections.yaml b/mmv1/products/redis/ClusterUserCreatedConnections.yaml deleted file mode 100644 index 9811862f085d..000000000000 --- a/mmv1/products/redis/ClusterUserCreatedConnections.yaml +++ /dev/null @@ -1,167 +0,0 @@ -# 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. - ---- -name: 'ClusterUserCreatedConnections' -api_resource_type_kind: Cluster -description: | - Manages user created connections for Redis cluster -docs: - note: | - If you remove a connections item from the resource, the corresponding forwarding rule will no longer be functioning. - If the corresponding forwarding rule is represented in your terraform configuration it is recommended to delete that - `google_compute_forwarding_rule` resource at the same time. -references: - guides: - api: 'https://cloud.google.com/memorystore/docs/cluster/reference/rest/v1/projects.locations.clusters' -id_format: 'projects/{{project}}/locations/{{region}}/clusters/{{name}}' -base_url: 'projects/{{project}}/locations/{{region}}/clusters' -self_link: 'projects/{{project}}/locations/{{region}}/clusters/{{name}}' -create_url: 'projects/{{project}}/locations/{{region}}/clusters/{{name}}?updateMask=cluster_endpoints' -create_verb: PATCH -update_verb: 'PATCH' -update_url: 'projects/{{project}}/locations/{{region}}/clusters/{{name}}?updateMask=cluster_endpoints' -update_mask: true -custom_code: - custom_delete: 'templates/terraform/custom_delete/redis_cluster_user_created_connections.go.tmpl' -timeouts: - insert_minutes: 60 - update_minutes: 120 - delete_minutes: 30 -autogen_async: true -async: - actions: ['create', 'delete', 'update'] - type: 'OpAsync' - operation: - base_url: '{{op_id}}' - result: - resource_inside_response: false -examples: - - name: 'redis_cluster_user_created_connections' - primary_resource_id: 'cluster-user-conn' - vars: - cluster_name: 'cluster-user-conn' - network1_name: 'net1' - subnet_network1_name: 'subnet-net1' - ip1_network1_name: 'ip1-net1' - ip2_network1_name: 'ip2-net1' - forwarding_rule1_network1_name: 'fwd1-net1' - forwarding_rule2_network1_name: 'fwd2-net1' - network2_name: 'network2' - subnet_network2_name: 'subnet-net2' - ip1_network2_name: 'ip1-net2' - ip2_network2_name: 'ip2-net2' - forwarding_rule1_network2_name: 'fwd1-net2' - forwarding_rule2_network2_name: 'fwd2-net2' - - name: 'redis_cluster_user_and_auto_created_connections' - primary_resource_id: 'cluster-user-auto-conn' - vars: - cluster_name: 'cluster-user-auto-conn' - network1_name: 'net1' - subnet_network1_name: 'subnet-net1' - policy_name: 'scpolicy' - network2_name: 'network2' - subnet_network2_name: 'subnet-net2' - ip1_network2_name: 'ip1-net2' - ip2_network2_name: 'ip2-net2' - forwarding_rule1_network2_name: 'fwd1-net2' - forwarding_rule2_network2_name: 'fwd2-net2' -parameters: - - name: 'name' - type: String - description: | - The name of the Redis cluster these endpoints should be added to. - required: true - url_param_only: true - - name: 'region' - type: String - description: | - The name of the region of the Redis cluster these endpoints should be added to. - url_param_only: true - required: true -properties: - - name: 'clusterEndpoints' - type: Array - description: "A list of cluster endpoints" - item_type: - type: NestedObject - description: | - ClusterEndpoint consists of PSC connections that are created - as a group in each VPC network for accessing the cluster. In each group, - there shall be one connection for each service attachment in the cluster. - properties: - - name: connections - type: Array - item_type: - type: NestedObject - name: 'connections' - properties: - - name: 'pscConnection' - type: NestedObject - description: | - Detailed information of a PSC connection that is created by the customer - who owns the cluster. - properties: - - name: 'pscConnectionId' - type: String - description: - "The PSC connection id of the forwarding rule connected - to the\nservice attachment." - required: true - - name: 'address' - type: String - description: - "The IP allocated on the consumer network for the - PSC forwarding rule. " - required: true - - name: 'forwardingRule' - type: String - description: "The URI of the consumer side forwarding rule.\nFormat:\nprojects/{project}/regions/{region}/forwardingRules/{forwarding_rule} " - required: true - - name: 'projectId' - type: String - description: - "The consumer project_id where the forwarding rule is - created from. " - default_from_api: true - - name: 'network' - type: String - description: - "The consumer network where the IP address resides, in - the form of\nprojects/{project_id}/global/networks/{network_id}. " - required: true - - name: 'serviceAttachment' - type: String - description: - "The service attachment which is the target of the PSC connection, in the form of - projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}." - required: true - - name: 'pscConnectionStatus' - type: Enum - description: - "Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists. - \n Possible values:\n ACTIVE \n NOT_FOUND" - output: true - enum_values: - - 'ACTIVE' - - 'NOT_FOUND' - - name: 'connectionType' - type: Enum - description: - "Output Only. Type of a PSC Connection. - \n Possible values:\n CONNECTION_TYPE_DISCOVERY \n CONNECTION_TYPE_PRIMARY \n CONNECTION_TYPE_READER" - output: true - enum_values: - - 'CONNECTION_TYPE_READER' - - 'CONNECTION_TYPE_PRIMARY' - - 'CONNECTION_TYPE_DISCOVERY' diff --git a/mmv1/products/resourcemanager/Lien.yaml b/mmv1/products/resourcemanager/Lien.yaml index 8a1467851126..56e1406a3b67 100644 --- a/mmv1/products/resourcemanager/Lien.yaml +++ b/mmv1/products/resourcemanager/Lien.yaml @@ -16,10 +16,6 @@ name: 'Lien' description: A Lien represents an encumbrance on the actions that can be performed on a resource. -references: - guides: - 'Create a Lien': 'https://cloud.google.com/resource-manager/docs/project-liens' - api: 'https://cloud.google.com/resource-manager/reference/rest' docs: id_format: '{{name}}' base_url: 'liens' diff --git a/mmv1/products/secretmanager/Secret.yaml b/mmv1/products/secretmanager/Secret.yaml index 47540a8ea8b4..01314c063e31 100644 --- a/mmv1/products/secretmanager/Secret.yaml +++ b/mmv1/products/secretmanager/Secret.yaml @@ -17,7 +17,6 @@ description: | A Secret is a logical secret whose value and versions can be accessed. references: guides: - 'Create and deploy a Secret': 'https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets' api: 'https://cloud.google.com/secret-manager/docs/reference/rest/v1/projects.secrets' docs: base_url: 'projects/{{project}}/secrets' diff --git a/mmv1/products/secretmanager/SecretVersion.yaml b/mmv1/products/secretmanager/SecretVersion.yaml index e174f00f278c..8c64090f5acf 100644 --- a/mmv1/products/secretmanager/SecretVersion.yaml +++ b/mmv1/products/secretmanager/SecretVersion.yaml @@ -15,10 +15,6 @@ name: 'SecretVersion' description: | A secret version resource. -references: - guides: - 'Create and deploy a Secret Version': 'https://cloud.google.com/secret-manager/docs/add-secret-version' - api: 'https://cloud.google.com/secret-manager/docs/reference/rest/v1/projects.secrets.versions' docs: optional_properties: | * `is_secret_data_base64` - (Optional) If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is. diff --git a/mmv1/products/secretmanagerregional/RegionalSecret.yaml b/mmv1/products/secretmanagerregional/RegionalSecret.yaml index c767e53ec7df..bf86f615345d 100644 --- a/mmv1/products/secretmanagerregional/RegionalSecret.yaml +++ b/mmv1/products/secretmanagerregional/RegionalSecret.yaml @@ -18,7 +18,6 @@ description: | A Regional Secret is a logical secret whose value and versions can be created and accessed within a region only. references: guides: - 'Create and deploy a Regional Secret': 'https://cloud.google.com/secret-manager/regional-secrets/create-regional-secret' api: 'https://cloud.google.com/secret-manager/docs/reference/rest/v1/projects.locations.secrets' docs: base_url: 'projects/{{project}}/locations/{{location}}/secrets' diff --git a/mmv1/products/secretmanagerregional/RegionalSecretVersion.yaml b/mmv1/products/secretmanagerregional/RegionalSecretVersion.yaml index 27cc7f9c1f8d..d2b001b4e796 100644 --- a/mmv1/products/secretmanagerregional/RegionalSecretVersion.yaml +++ b/mmv1/products/secretmanagerregional/RegionalSecretVersion.yaml @@ -16,10 +16,6 @@ name: 'RegionalSecretVersion' api_resource_type_kind: SecretVersion description: | A regional secret version resource. -references: - guides: - 'Create and deploy a Regional Secret Version': 'https://cloud.google.com/secret-manager/regional-secrets/add-secret-version-rs' - api: 'https://cloud.google.com/secret-manager/docs/reference/rest/v1/projects.locations.secrets.versions' docs: optional_properties: | * `is_secret_data_base64` - (Optional) If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is. diff --git a/mmv1/products/securesourcemanager/BranchRule.yaml b/mmv1/products/securesourcemanager/BranchRule.yaml index 4462bae669e2..d2e9cb0aec64 100644 --- a/mmv1/products/securesourcemanager/BranchRule.yaml +++ b/mmv1/products/securesourcemanager/BranchRule.yaml @@ -17,7 +17,6 @@ description: 'BranchRule is the protection rule to enforce pre-defined rules on references: guides: 'Official Documentation': 'https://cloud.google.com/secure-source-manager/docs/overview' - api: 'https://cloud.google.com/secure-source-manager/docs/reference/rest/v1/projects.locations.repositories.branchRules' docs: id_format: 'projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/branchRules/{{branch_rule_id}}' base_url: 'projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/branchRules?branch_rule_id={{branch_rule_id}}' diff --git a/mmv1/products/securesourcemanager/Instance.yaml b/mmv1/products/securesourcemanager/Instance.yaml index 2d026d7883ba..0c10b7c89829 100644 --- a/mmv1/products/securesourcemanager/Instance.yaml +++ b/mmv1/products/securesourcemanager/Instance.yaml @@ -63,8 +63,6 @@ examples: 'prevent_destroy': 'false' oics_vars_overrides: 'prevent_destroy': 'false' - ignore_read_extra: - - 'update_time' - name: 'secure_source_manager_instance_cmek' primary_resource_id: 'default' primary_resource_name: 'fmt.Sprintf("tf-test-my-instance%s", context["random_suffix"])' @@ -77,8 +75,6 @@ examples: 'kms_key_name': 'acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-secure-source-manager-key1").CryptoKey.Name' oics_vars_overrides: 'prevent_destroy': 'false' - ignore_read_extra: - - 'update_time' - name: 'secure_source_manager_instance_private' primary_resource_id: 'default' primary_resource_name: 'fmt.Sprintf("tf-test-my-instance%s", context["random_suffix"])' @@ -92,8 +88,6 @@ examples: oics_vars_overrides: 'prevent_destroy': 'false' external_providers: ["time"] - ignore_read_extra: - - 'update_time' - name: 'secure_source_manager_instance_private_psc_backend' primary_resource_id: 'default' primary_resource_name: 'fmt.Sprintf("tf-test-my-instance%s", context["random_suffix"])' @@ -115,8 +109,6 @@ examples: oics_vars_overrides: 'prevent_destroy': 'false' external_providers: ["time"] - ignore_read_extra: - - 'update_time' - name: 'secure_source_manager_instance_private_psc_endpoint' primary_resource_id: 'default' primary_resource_name: 'fmt.Sprintf("tf-test-my-instance%s", context["random_suffix"])' @@ -135,8 +127,6 @@ examples: oics_vars_overrides: 'prevent_destroy': 'false' external_providers: ["time"] - ignore_read_extra: - - 'update_time' - name: 'secure_source_manager_instance_workforce_identity_federation' primary_resource_id: 'default' primary_resource_name: 'fmt.Sprintf("tf-test-my-instance%s", context["random_suffix"])' @@ -147,8 +137,6 @@ examples: 'prevent_destroy': 'false' oics_vars_overrides: 'prevent_destroy': 'false' - ignore_read_extra: - - 'update_time' parameters: - name: 'location' type: String diff --git a/mmv1/products/securesourcemanager/Repository.yaml b/mmv1/products/securesourcemanager/Repository.yaml index 599baf8e11d1..1957d651ff85 100644 --- a/mmv1/products/securesourcemanager/Repository.yaml +++ b/mmv1/products/securesourcemanager/Repository.yaml @@ -17,7 +17,6 @@ description: 'Repositories store source code. It supports all Git SCM client com references: guides: 'Official Documentation': 'https://cloud.google.com/secure-source-manager/docs/overview' - api: 'https://cloud.google.com/secure-source-manager/docs/reference/rest/v1/projects.locations.repositories' docs: base_url: 'projects/{{project}}/locations/{{location}}/repositories?repository_id={{repository_id}}' self_link: 'projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}' diff --git a/mmv1/products/securitycenter/MuteConfig.yaml b/mmv1/products/securitycenter/MuteConfig.yaml index 47dc2dbd5a65..2059cc3eba72 100644 --- a/mmv1/products/securitycenter/MuteConfig.yaml +++ b/mmv1/products/securitycenter/MuteConfig.yaml @@ -102,20 +102,3 @@ properties: field is set by the server and will be ignored if provided on config creation or update. output: true - - name: 'type' - type: Enum - description: | - The type of the mute config, which determines what type of mute state the config affects. - default_value: "DYNAMIC" - enum_values: - - 'MUTE_CONFIG_TYPE_UNSPECIFIED' - - 'STATIC' - - 'DYNAMIC' - - name: 'expiryTime' - type: String - description: | - Optional. The expiry of the mute config. Only applicable for dynamic configs. - If the expiry is set, when the config expires, it is removed from all findings. - - A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to - nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". diff --git a/mmv1/products/securitycenterv2/FolderNotificationConfig.yaml b/mmv1/products/securitycenterv2/FolderNotificationConfig.yaml index 0d3aaba0e14d..24757fa040ac 100644 --- a/mmv1/products/securitycenterv2/FolderNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/FolderNotificationConfig.yaml @@ -14,8 +14,14 @@ --- name: 'FolderNotificationConfig' api_resource_type_kind: NotificationConfig -description: - This is a continuous export that exports findings to a Pub/Sub topic. +description: | + A Cloud Security Command Center (Cloud SCC) notification configs. A + notification config is a Cloud SCC resource that contains the + configuration to send notifications for create/update events of + findings, assets and etc. + ~> **Note:** In order to use Cloud SCC resources, your organization must be enrolled + in [SCC Standard/Premium](https://cloud.google.com/security-command-center/docs/quickstart-security-command-center). + Without doing so, you may run into errors during resource creation. references: guides: 'Official Documentation': 'https://cloud.google.com/security-command-center/docs' diff --git a/mmv1/products/securitycenterv2/OrganizationNotificationConfig.yaml b/mmv1/products/securitycenterv2/OrganizationNotificationConfig.yaml index 32872e184b5c..82c0a5fe1c12 100644 --- a/mmv1/products/securitycenterv2/OrganizationNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/OrganizationNotificationConfig.yaml @@ -14,8 +14,14 @@ --- name: 'OrganizationNotificationConfig' api_resource_type_kind: NotificationConfig -description: - This is a continuous export that exports findings to a Pub/Sub topic. +description: | + A Cloud Security Command Center (Cloud SCC) notification configs. A + notification config is a Cloud SCC resource that contains the + configuration to send notifications for create/update events of + findings, assets and etc. + ~> **Note:** In order to use Cloud SCC resources, your organization must be enrolled + in [SCC Standard/Premium](https://cloud.google.com/security-command-center/docs/quickstart-security-command-center). + Without doing so, you may run into errors during resource creation. references: guides: 'Official Documentation': 'https://cloud.google.com/security-command-center/docs' diff --git a/mmv1/products/securitycenterv2/ProjectMuteConfig.yaml b/mmv1/products/securitycenterv2/ProjectMuteConfig.yaml index 3acc37088a19..4bd083286f5f 100644 --- a/mmv1/products/securitycenterv2/ProjectMuteConfig.yaml +++ b/mmv1/products/securitycenterv2/ProjectMuteConfig.yaml @@ -35,9 +35,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'scc_v2_project_mute_config_basic' primary_resource_id: 'default' diff --git a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml index 15bccda43d51..739b99758600 100644 --- a/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml +++ b/mmv1/products/securitycenterv2/ProjectNotificationConfig.yaml @@ -14,8 +14,14 @@ --- name: 'ProjectNotificationConfig' api_resource_type_kind: NotificationConfig -description: - This is a continuous export that exports findings to a Pub/Sub topic. +description: | + A Cloud Security Command Center (Cloud SCC) notification configs. A + notification config is a Cloud SCC resource that contains the + configuration to send notifications for create/update events of + findings, assets and etc. + ~> **Note:** In order to use Cloud SCC resources, your organization must be enrolled + in [SCC Standard/Premium](https://cloud.google.com/security-command-center/docs/quickstart-security-command-center). + Without doing so, you may run into errors during resource creation. references: guides: 'Official Documentation': 'https://cloud.google.com/security-command-center/docs' @@ -35,9 +41,6 @@ timeouts: custom_code: post_create: 'templates/terraform/post_create/set_computed_name.tmpl' custom_import: 'templates/terraform/custom_import/self_link_as_name_set_project.go.tmpl' -sweeper: - url_substitutions: - - region: "global" examples: - name: 'scc_v2_project_notification_config_basic' primary_resource_id: 'custom_notification_config' diff --git a/mmv1/products/securitycenterv2/ProjectSccBigQueryExport.yaml b/mmv1/products/securitycenterv2/ProjectSccBigQueryExport.yaml index dee6cb8b7ecb..3f577888b273 100644 --- a/mmv1/products/securitycenterv2/ProjectSccBigQueryExport.yaml +++ b/mmv1/products/securitycenterv2/ProjectSccBigQueryExport.yaml @@ -38,9 +38,6 @@ timeouts: update_minutes: 20 delete_minutes: 20 custom_code: -sweeper: - url_substitutions: - - region: "global" examples: - name: 'scc_v2_project_big_query_export_config_basic' primary_resource_id: 'custom_big_query_export_config' diff --git a/mmv1/products/securitycenterv2/product.yaml b/mmv1/products/securitycenterv2/product.yaml index 465bcb6ad86f..bbca82cff362 100644 --- a/mmv1/products/securitycenterv2/product.yaml +++ b/mmv1/products/securitycenterv2/product.yaml @@ -14,7 +14,7 @@ --- name: 'SecurityCenterV2' legacy_name: 'scc_v2' -display_name: 'Security Command Center (SCC) v2 API' +display_name: 'Security Command Center (SCC)v2 API' versions: - name: 'ga' base_url: 'https://securitycenter.googleapis.com/v2/' diff --git a/mmv1/products/securityposture/Posture.yaml b/mmv1/products/securityposture/Posture.yaml index 9d8ac7f77c0d..df4566818a29 100644 --- a/mmv1/products/securityposture/Posture.yaml +++ b/mmv1/products/securityposture/Posture.yaml @@ -21,7 +21,6 @@ description: | references: guides: 'Create and deploy a posture': 'https://cloud.google.com/security-command-center/docs/how-to-use-security-posture' - api: 'https://cloud.google.com/security-command-center/docs/reference/securityposture/rest/v1/Posture' docs: base_url: '{{parent}}/locations/{{location}}/postures' self_link: '{{parent}}/locations/{{location}}/postures/{{posture_id}}' diff --git a/mmv1/products/securityposture/PostureDeployment.yaml b/mmv1/products/securityposture/PostureDeployment.yaml index 66836dad7429..76a64bd366ac 100644 --- a/mmv1/products/securityposture/PostureDeployment.yaml +++ b/mmv1/products/securityposture/PostureDeployment.yaml @@ -22,7 +22,6 @@ description: | references: guides: 'Create and deploy a posture': 'https://cloud.google.com/security-command-center/docs/how-to-use-security-posture' - api: 'https://cloud.google.com/security-command-center/docs/reference/securityposture/rest/v1/organizations.locations.postureDeployments' docs: base_url: '{{parent}}/locations/{{location}}/postureDeployments' self_link: '{{parent}}/locations/{{location}}/postureDeployments/{{posture_deployment_id}}' diff --git a/mmv1/products/spanner/BackupSchedule.yaml b/mmv1/products/spanner/BackupSchedule.yaml index 67d5eb3112ee..334d0af087c6 100644 --- a/mmv1/products/spanner/BackupSchedule.yaml +++ b/mmv1/products/spanner/BackupSchedule.yaml @@ -154,26 +154,3 @@ properties: - 'incrementalBackupSpec' properties: [] - - name: 'encryptionConfig' - type: NestedObject - description: | - Configuration for the encryption of the backup schedule. - default_from_api: true - properties: - - name: 'encryptionType' - type: Enum - description: | - The encryption type of backups created by the backup schedule. - Possible values are USE_DATABASE_ENCRYPTION, GOOGLE_DEFAULT_ENCRYPTION, or CUSTOMER_MANAGED_ENCRYPTION. - If you use CUSTOMER_MANAGED_ENCRYPTION, you must specify a kmsKeyName. - If your backup type is incremental-backup, the encryption type must be GOOGLE_DEFAULT_ENCRYPTION. - enum_values: - - 'USE_DATABASE_ENCRYPTION' - - 'GOOGLE_DEFAULT_ENCRYPTION' - - 'CUSTOMER_MANAGED_ENCRYPTION' - required: true - - name: 'kmsKeyName' - type: String - description: | - The resource name of the Cloud KMS key to use for encryption. - Format: 'projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}' diff --git a/mmv1/products/spanner/Instance.yaml b/mmv1/products/spanner/Instance.yaml index 44ed39b8f221..3e1263b14dfc 100644 --- a/mmv1/products/spanner/Instance.yaml +++ b/mmv1/products/spanner/Instance.yaml @@ -57,6 +57,10 @@ examples: primary_resource_id: 'example' # Randomness skip_vcr: true + - name: 'spanner_instance_with_autoscaling' + primary_resource_id: 'example' + # Randomness + skip_vcr: true - name: 'spanner_instance_multi_regional' primary_resource_id: 'example' # Randomness diff --git a/mmv1/products/tpu/Node.yaml b/mmv1/products/tpu/Node.yaml index 6950ed83085a..a61d4a11e210 100644 --- a/mmv1/products/tpu/Node.yaml +++ b/mmv1/products/tpu/Node.yaml @@ -40,9 +40,6 @@ custom_code: constants: 'templates/terraform/constants/tpu_node.tmpl' custom_diff: - 'tpuNodeCustomizeDiff' -sweeper: - url_substitutions: - - zone: "us-central1-b" examples: - name: 'tpu_node_basic' primary_resource_id: 'tpu' diff --git a/mmv1/products/tpuv2/QueuedResource.yaml b/mmv1/products/tpuv2/QueuedResource.yaml index dce5be021136..4e409e6baedd 100644 --- a/mmv1/products/tpuv2/QueuedResource.yaml +++ b/mmv1/products/tpuv2/QueuedResource.yaml @@ -32,9 +32,6 @@ async: base_url: '{{op_id}}' result: resource_inside_response: true -sweeper: - url_substitutions: - - zone: "us-central1-c" examples: - name: 'tpu_v2_queued_resource_basic' primary_resource_id: 'qr' diff --git a/mmv1/products/tpuv2/Vm.yaml b/mmv1/products/tpuv2/Vm.yaml index d5e83756e130..983769860327 100644 --- a/mmv1/products/tpuv2/Vm.yaml +++ b/mmv1/products/tpuv2/Vm.yaml @@ -44,9 +44,6 @@ custom_code: constants: 'templates/terraform/constants/tpu_vm.go.tmpl' custom_diff: - 'acceleratorTypeCustomizeDiff' -sweeper: - url_substitutions: - - zone: "us-central1-c" examples: - name: 'tpu_v2_vm_basic' primary_resource_id: 'tpu' diff --git a/mmv1/products/tpuv2/product.yaml b/mmv1/products/tpuv2/product.yaml index 6d1de73b5380..b66943d3033c 100644 --- a/mmv1/products/tpuv2/product.yaml +++ b/mmv1/products/tpuv2/product.yaml @@ -16,8 +16,6 @@ name: 'TpuV2' display_name: 'Cloud TPU v2' versions: - name: 'beta' - # The v2alpha1 version of the Cloud TPU API is best suited for the google-beta Terraform provider. - # This more closely matches current Cloud TPU API usage and is recommended by the Cloud TPU team. - base_url: 'https://tpu.googleapis.com/v2alpha1/' + base_url: 'https://tpu.googleapis.com/v2/' scopes: - 'https://www.googleapis.com/auth/cloud-platform' diff --git a/mmv1/products/workbench/Instance.yaml b/mmv1/products/workbench/Instance.yaml index 7404204505a4..94d727e1e0e9 100644 --- a/mmv1/products/workbench/Instance.yaml +++ b/mmv1/products/workbench/Instance.yaml @@ -14,10 +14,6 @@ --- name: 'Instance' description: A Workbench instance. -references: - guides: - 'Official Documentation': 'https://cloud.google.com/vertex-ai/docs/workbench/instances/introduction' - api: 'https://cloud.google.com/vertex-ai/docs/workbench/reference/rest/v2/projects.locations.instances' docs: id_format: 'projects/{{project}}/locations/{{location}}/instances/{{name}}' base_url: 'projects/{{project}}/locations/{{location}}/instances' @@ -52,10 +48,6 @@ custom_code: post_create: 'templates/terraform/post_create/workbench_instance.go.tmpl' pre_update: 'templates/terraform/pre_update/workbench_instance.go.tmpl' post_update: 'templates/terraform/post_update/workbench_instance.go.tmpl' -sweeper: - url_substitutions: - - region: "us-central1-a" - - region: "us-west1-a" examples: - name: 'workbench_instance_basic' primary_resource_id: 'instance' @@ -551,8 +543,3 @@ properties: Optional. Labels to apply to this instance. These can be later modified by the UpdateInstance method. diff_suppress_func: 'WorkbenchInstanceLabelsDiffSuppress' - - name: 'enableThirdPartyIdentity' - type: Boolean - description: | - Flag that specifies that a notebook can be accessed with third party - identity provider. diff --git a/mmv1/products/workflows/Workflow.yaml b/mmv1/products/workflows/Workflow.yaml index cdac3b74a69d..0bb75a3642ed 100644 --- a/mmv1/products/workflows/Workflow.yaml +++ b/mmv1/products/workflows/Workflow.yaml @@ -57,16 +57,6 @@ examples: exclude_import_test: true ignore_read_extra: - 'deletion_protection' - - name: 'workflow_tags' - primary_resource_id: 'example' - vars: - name: 'workflow' - account_id: 'my-account' - tag_key: 'tag_key' - tag_value: 'tag_value' - exclude_import_test: true - ignore_read_extra: - - 'deletion_protection' virtual_fields: - name: 'deletion_protection' description: | @@ -156,11 +146,3 @@ properties: type: KeyValuePairs description: | User-defined environment variables associated with this workflow revision. This map has a maximum length of 20. Each string can take up to 4KiB. Keys cannot be empty strings and cannot start with “GOOGLE” or “WORKFLOWS". - - name: 'tags' - type: KeyValuePairs - description: | - A map of resource manager tags. Resource manager tag keys and values have the same definition - as resource manager tags. Keys must be in the format tagKeys/{tag_key_id}, and values are in - the format tagValues/456. The field is ignored (both PUT & PATCH) when empty. - immutable: true - ignore_read: true diff --git a/mmv1/products/workstations/WorkstationConfig.yaml b/mmv1/products/workstations/WorkstationConfig.yaml index 33371b537c7d..9ccd463add55 100644 --- a/mmv1/products/workstations/WorkstationConfig.yaml +++ b/mmv1/products/workstations/WorkstationConfig.yaml @@ -469,6 +469,7 @@ properties: description: | The type of the persistent disk for the home directory. Defaults to `pd-standard`. min_version: 'beta' + immutable: true default_from_api: true - name: 'sizeGb' type: Integer @@ -476,6 +477,7 @@ properties: The GB capacity of a persistent home directory for each workstation created with this configuration. Must be empty if `sourceSnapshot` is set. Valid values are `10`, `50`, `100`, `200`, `500`, or `1000`. Defaults to `200`. If less than `200` GB, the `diskType` must be `pd-balanced` or `pd-ssd`. min_version: 'beta' + immutable: true default_from_api: true - name: 'reclaimPolicy' type: Enum diff --git a/mmv1/provider/template_data.go b/mmv1/provider/template_data.go index 3fade8493471..50cc1bbb0e79 100644 --- a/mmv1/provider/template_data.go +++ b/mmv1/provider/template_data.go @@ -170,7 +170,7 @@ func (td *TemplateData) GenerateIamPolicyTestFile(filePath string, resource api. templates := []string{ templatePath, "templates/terraform/env_var_context.go.tmpl", - "templates/terraform/iam/iam_test_setup.go.tmpl", + "templates/terraform/iam/iam_context.go.tmpl", } td.GenerateFile(filePath, templatePath, resource, true, templates...) } diff --git a/mmv1/provider/terraform.go b/mmv1/provider/terraform.go index d8c58a65f1a2..89c7aeecd457 100644 --- a/mmv1/provider/terraform.go +++ b/mmv1/provider/terraform.go @@ -173,7 +173,7 @@ func (t *Terraform) GenerateResourceTests(object api.Resource, templateData Temp } func (t *Terraform) GenerateResourceSweeper(object api.Resource, templateData TemplateData, outputFolder string) { - if !object.ShouldGenerateSweepers() { + if object.ExcludeSweeper || object.CustomCode.CustomDelete != "" || object.CustomCode.PreDelete != "" || object.CustomCode.PostDelete != "" || object.ExcludeDelete { return } diff --git a/mmv1/provider/terraform_tgc.go b/mmv1/provider/terraform_tgc.go index 957200e864a2..392db06b21e2 100644 --- a/mmv1/provider/terraform_tgc.go +++ b/mmv1/provider/terraform_tgc.go @@ -394,7 +394,6 @@ func (tgc TerraformGoogleConversion) CopyCommonFiles(outputFolder string, genera "converters/google/resources/services/bigquery/iam_bigquery_dataset.go": "third_party/terraform/services/bigquery/iam_bigquery_dataset.go", "converters/google/resources/services/bigquery/bigquery_dataset_iam.go": "third_party/tgc/services/bigquery/bigquery_dataset_iam.go", "converters/google/resources/services/compute/compute_security_policy.go": "third_party/tgc/services/compute/compute_security_policy.go", - "converters/google/resources/services/eventarc/eventarc_utils.go": "third_party/terraform/services/eventarc/eventarc_utils.go", "converters/google/resources/services/kms/kms_key_ring_iam.go": "third_party/tgc/services/kms/kms_key_ring_iam.go", "converters/google/resources/services/kms/kms_crypto_key_iam.go": "third_party/tgc/services/kms/kms_crypto_key_iam.go", "converters/google/resources/services/resourcemanager/project_iam_custom_role.go": "third_party/tgc/services/resourcemanager/project_iam_custom_role.go", diff --git a/mmv1/products/apihub/product.yaml b/mmv1/spec/.rubocop.yml similarity index 73% rename from mmv1/products/apihub/product.yaml rename to mmv1/spec/.rubocop.yml index d2368a3e3439..049a7a0d0118 100644 --- a/mmv1/products/apihub/product.yaml +++ b/mmv1/spec/.rubocop.yml @@ -1,4 +1,4 @@ -# Copyright 2024 Google Inc. +# Copyright 2017 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 @@ -11,11 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- -name: Apihub -display_name: "API Hub" -scopes: - - https://www.googleapis.com/auth/cloud-platform -versions: - - base_url: https://apihub.googleapis.com/v1/ - name: ga +inherit_from: ../.rubocop.yml + +# Disable spec length as we bundle all tests in context blocks. +Metrics/BlockLength: + Enabled: false diff --git a/mmv1/products/parametermanager/product.yaml b/mmv1/spec/data/bad-property-reference-config.yaml similarity index 60% rename from mmv1/products/parametermanager/product.yaml rename to mmv1/spec/data/bad-property-reference-config.yaml index 4a0184ba77c7..fd1ac1f20606 100644 --- a/mmv1/products/parametermanager/product.yaml +++ b/mmv1/spec/data/bad-property-reference-config.yaml @@ -1,4 +1,4 @@ -# Copyright 2024 Google Inc. +# Copyright 2017 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 @@ -11,11 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- -name: 'ParameterManager' -display_name: 'Parameter Manager' -versions: - - name: 'beta' - base_url: 'https://parametermanager.googleapis.com/v1/' -scopes: - - 'https://www.googleapis.com/auth/cloud-platform' +--- !ruby/object:Provider::Terraform::Config +overrides: !ruby/object:Provider::ResourceOverrides + AnotherResource: !ruby/object:Provider::Terraform::ResourceOverride + description: '{{description}} bar' + properties: + property1.missing-property: !ruby/object:Provider::Terraform::PropertyOverride + description: 'foo' diff --git a/mmv1/spec/data/good-export-file.yaml b/mmv1/spec/data/good-export-file.yaml new file mode 100644 index 000000000000..179ab29b288f --- /dev/null +++ b/mmv1/spec/data/good-export-file.yaml @@ -0,0 +1,81 @@ +# Copyright 2017 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: MyProduct +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: http://myproduct.google.com/api +scopes: + - http://scope-to-my-api/ +objects: + - !ruby/object:Api::Resource + name: 'ReferencedResource' + kind: 'myproduct#referencedresource' + base_url: 'referencedresource' + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'name' + description: 'an explanation whats this about' + - !ruby/object:Api::Resource + name: 'MyResource' + kind: 'myproduct#myresource' + description: 'blah blah' + exclude: true + - !ruby/object:Api::Resource + name: 'AnotherResource' + kind: 'myproduct#anotherresource' + base_url: 'anotherResource' + description: 'blah blah' + parameters: + - !ruby/object:Api::Type::ResourceRef + resource: 'ReferencedResource' + name: 'property5' + imports: 'name' + description: 'an explanation whats this about' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. + - !ruby/object:Api::Type::String + name: 'superLongName' + description: 'A single line description' + - !ruby/object:Api::Type::String + name: 'name' + description: 'A name for create_before_data' + - !ruby/object:Api::Type::Array + item_type: Api::Type::String + name: 'property3' + description: 'A single line description' + - !ruby/object:Api::Type::Enum + name: 'property4' + description: | + A long description for a property. Whenever the property description + is too long it may be formatted appropriately by the provider to look + good at the final file. + values: + - :value1 + - 'value2' + - 3 + - !ruby/object:Api::Type::Enum + name: 'property6' + description: | + A long description for a property. Whenever the property description + is too long it may be formatted appropriately by the provider to look + good at the final file. + values: + - 'a long value that is long' diff --git a/mmv1/spec/data/good-file.yaml b/mmv1/spec/data/good-file.yaml new file mode 100644 index 000000000000..d434463c52cd --- /dev/null +++ b/mmv1/spec/data/good-file.yaml @@ -0,0 +1,169 @@ +# Copyright 2017 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: MyProduct +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: http://myproduct.google.com/api/ + - !ruby/object:Api::Product::Version + name: beta + base_url: http://myproduct.google.com/api/beta/ + - !ruby/object:Api::Product::Version + name: alpha + base_url: http://myproduct.google.com/api/alpha/ +scopes: + - http://scope-to-my-api/ +objects: + - !ruby/object:Api::Resource + name: 'ReferencedResource' + kind: 'myproduct#referencedresource' + base_url: 'referencedresource' + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'name' + description: 'an explanation whats this about' + - !ruby/object:Api::Resource + name: 'MyResource' + kind: 'myproduct#myresource' + description: 'blah blah' + exclude: true + - !ruby/object:Api::Resource + name: 'AnotherResource' + kind: 'myproduct#anotherresource' + base_url: 'anotherResource' + description: 'blah blah' + parameters: + - !ruby/object:Api::Type::ResourceRef + name: 'property5' + resource: 'ReferencedResource' + imports: 'name' + description: 'an explanation whats this about' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. + - !ruby/object:Api::Type::String + name: 'property2' + description: 'A single line description' + - !ruby/object:Api::Type::Array + item_type: Api::Type::String + name: 'property3' + description: 'A single line description' + - !ruby/object:Api::Type::Enum + name: 'property4' + description: | + A long description for a property. Whenever the property description + is too long it may be formatted appropriately by the provider to look + good at the final file. + values: + - :value1 + - 'value2' + - 3 + - !ruby/object:Api::Type::NestedObject + name: 'nested-property' + description: 'a nested object property' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: 'a nested property' + - !ruby/object:Api::Type::NestedObject + name: 'nested-property2' + description: 'a nested object property' + properties: + - !ruby/object:Api::Type::NestedObject + name: 'property1' + description: 'a nested property' + properties: + - !ruby/object:Api::Type::String + name: 'property1-nested' + description: 'a deeply nested property' + - !ruby/object:Api::Type::Array + name: 'array-property' + description: 'an array of nested object property' + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: 'a nested property' + - !ruby/object:Api::Type::String + name: 'beta-property' + description: 'A property that exists in the beta API' + min_version: 'beta' + - !ruby/object:Api::Type::Map + name: 'namevalue-property' + description: 'A property that maps Strings -> NestedObject' + key_name: 'key' + value_type: !ruby/object:Api::Type::NestedObject + name: 'namevalue-nested' + properties: + - !ruby/object:Api::Type::String + name: 'nv-prop1' + description: 'the first property in my namevalues' + - !ruby/object:Api::Resource + name: 'ThirdResource' + kind: 'myproduct#thirdresource' + base_url: 'thirdResource' + description: 'a description' + properties: + - !ruby/object:Api::Type::String + name: 'stringOne' + description: 'a string property (depth 0)' + - !ruby/object:Api::Type::String + name: 'stringRenamed' + description: 'a string property (depth 0)' + - !ruby/object:Api::Type::NestedObject + name: 'objectOne' + description: 'a NestedObject property (depth 0)' + properties: + - !ruby/object:Api::Type::String + name: 'objectOneString' + description: 'a string property (depth 1)' + - !ruby/object:Api::Type::NestedObject + name: 'objectOneFlattenedObject' + description: 'a nested NestedObject (depth 1)' + flatten_object: true + properties: + - !ruby/object:Api::Type::Integer + name: 'objectOneNestedNestedInteger' + description: 'a nested integer (depth 2)' + - !ruby/object:Api::Type::String + name: 'objectOneRenamed' + description: 'a string property (depth 1)' + - !ruby/object:Api::Type::NestedObject + name: 'objectTwoFlattened' + description: 'a NestedObject property that is flattened (depth 0)' + flatten_object: true + properties: + - !ruby/object:Api::Type::String + name: 'objectTwoString' + description: 'a nested string (depth 1)' + update_mask_fields: + - 'overrideFoo' + - 'nested.overrideBar' + - !ruby/object:Api::Type::NestedObject + name: 'objectTwoNestedObject' + description: 'a nested NestedObject (depth 1)' + properties: + - !ruby/object:Api::Type::String + name: 'objectTwoNestedNestedString' + description: 'a nested String (depth 2)' + - !ruby/object:Api::Resource + name: 'TerraformImportIdTest' + description: 'Used for spec/provider_terraform_import_spec' + base_url: "projects/{{project}}/regions/{{region}}/subnetworks" + properties: [] diff --git a/mmv1/spec/data/good-longuri.yaml b/mmv1/spec/data/good-longuri.yaml new file mode 100644 index 000000000000..be239639c7f7 --- /dev/null +++ b/mmv1/spec/data/good-longuri.yaml @@ -0,0 +1,33 @@ +# Copyright 2017 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: MyProduct +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: http://myproduct.google.com/myapi/v123 +scopes: + - http://scope-to-my-api/ +objects: + - !ruby/object:Api::Resource + name: 'MyResource' + kind: 'myproduct#myresource' + base_url: some/long/path/over/80chars + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. diff --git a/mmv1/spec/data/good-multi-file.yaml b/mmv1/spec/data/good-multi-file.yaml new file mode 100644 index 000000000000..cdf5691cc623 --- /dev/null +++ b/mmv1/spec/data/good-multi-file.yaml @@ -0,0 +1,76 @@ +# Copyright 2017 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: MyProduct +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: http://myproduct.google.com/api +scopes: + - http://scope-to-my-api/ +objects: + - !ruby/object:Api::Resource + name: 'ReferencedResource' + kind: 'myproduct#referencedresource' + base_url: 'referencedresource' + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'name' + description: 'an explanation whats this about' + - !ruby/object:Api::Resource + name: 'MyResource' + kind: 'multiproduct#myresource' + base_url: some/path/to/resources + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. + - !ruby/object:Api::Resource + name: 'AnotherResource' + kind: 'multiproduct#anotherresource' + base_url: some/path/to/anotherresources + description: 'blah blah' + parameters: + - !ruby/object:Api::Type::ResourceRef + resource: 'ReferencedResource' + name: 'property5' + imports: 'name' + description: 'hey, this is property number 5!' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. + - !ruby/object:Api::Type::String + name: 'property2' + description: 'A single line description' + - !ruby/object:Api::Type::Array + item_type: Api::Type::String + name: 'property3' + description: 'A single line description' + - !ruby/object:Api::Type::Enum + name: 'property4' + description: | + A long description for a property. Whenever the property description + is too long it may be formatted appropriately by the provider to look + good at the final file. + values: + - :value1 + - 'value2' + - 3 diff --git a/mmv1/spec/data/good-multi2-file.yaml b/mmv1/spec/data/good-multi2-file.yaml new file mode 100644 index 000000000000..51f455a061d8 --- /dev/null +++ b/mmv1/spec/data/good-multi2-file.yaml @@ -0,0 +1,85 @@ +# Copyright 2017 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: MyProduct +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: http://myproduct.google.com/api +scopes: + - http://scope-to-my-api/ +objects: + - !ruby/object:Api::Resource + name: 'ReferencedResource' + kind: 'myproduct#referencedresource' + base_url: 'referencedresource' + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'name' + description: 'an explanation whats this about' + - !ruby/object:Api::Resource + name: 'MyResource' + kind: 'multiproduct#resource' + base_url: some/path/to/resources + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. + - !ruby/object:Api::Resource + name: 'YetAnotherResource' + kind: 'multiproduct#yetanotherresource' + base_url: some/path/to/resources + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. + - !ruby/object:Api::Resource + name: 'AnotherResource' + kind: 'multiproduct#anotherresource' + base_url: some/path/to/anotherresources + description: 'blah blah' + parameters: + - !ruby/object:Api::Type::String + name: 'property5' + description: 'whats this is about' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. + - !ruby/object:Api::Type::String + name: 'property2' + description: 'A single line description' + - !ruby/object:Api::Type::Array + item_type: Api::Type::String + name: 'property3' + description: 'A single line description' + - !ruby/object:Api::Type::Enum + name: 'property4' + description: | + A long description for a property. Whenever the property description + is too long it may be formatted appropriately by the provider to look + good at the final file. + values: + - :value1 + - 'value2' + - 3 diff --git a/mmv1/products/eventarc/product.yaml b/mmv1/spec/data/good-resource.yaml similarity index 69% rename from mmv1/products/eventarc/product.yaml rename to mmv1/spec/data/good-resource.yaml index 7b1d78437732..1e91d46263db 100644 --- a/mmv1/products/eventarc/product.yaml +++ b/mmv1/spec/data/good-resource.yaml @@ -1,4 +1,4 @@ -# Copyright 2025 Google Inc. +# Copyright 2017 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 @@ -11,11 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- -name: Eventarc -display_name: Eventarc -scopes: - - https://www.googleapis.com/auth/cloud-platform -versions: - - base_url: https://eventarc.googleapis.com/v1/ - name: ga +!ruby/object:Api::Resource +name: 'MyResource' +kind: 'myproduct#myresource' +description: 'foo' +properties: + - !ruby/object:Api::Type::String + name: 'name' + description: 'an explanation whats this about' diff --git a/mmv1/products/colab/product.yaml b/mmv1/spec/data/good-single-file.yaml similarity index 51% rename from mmv1/products/colab/product.yaml rename to mmv1/spec/data/good-single-file.yaml index 0d588605b43d..3fb37ed94a68 100644 --- a/mmv1/products/colab/product.yaml +++ b/mmv1/spec/data/good-single-file.yaml @@ -1,4 +1,4 @@ -# Copyright 2025 Google Inc. +# Copyright 2017 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 @@ -11,15 +11,23 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- -name: 'Colab' -display_name: 'Colab Enterprise' +--- !ruby/object:Api::Product +name: MyProduct versions: - - name: 'ga' - base_url: 'https://{{region}}-aiplatform.googleapis.com/v1/' - cai_base_url: 'https://aiplatform.googleapis.com/v1/' - - name: 'beta' - base_url: 'https://{{region}}-aiplatform.googleapis.com/v1beta1/' - cai_base_url: 'https://aiplatform.googleapis.com/v1beta1/' + - !ruby/object:Api::Product::Version + name: ga + base_url: http://myproduct.google.com/api scopes: - - 'https://www.googleapis.com/auth/cloud-platform' + - http://scope-to-my-api/ +objects: + - !ruby/object:Api::Resource + name: 'MyResource' + kind: 'myproduct#myresource' + description: 'my resource description' + base_url: myresource + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. diff --git a/mmv1/spec/data/good-single-readonly-file.yaml b/mmv1/spec/data/good-single-readonly-file.yaml new file mode 100644 index 000000000000..0af811b8ea7b --- /dev/null +++ b/mmv1/spec/data/good-single-readonly-file.yaml @@ -0,0 +1,34 @@ +# Copyright 2017 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: MyProduct +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: http://myproduct.google.com/api +scopes: + - http://scope-to-my-api/ +objects: + - !ruby/object:Api::Resource + name: 'MyResource' + kind: 'myproduct#myresource' + description: 'my resource description' + base_url: myresource + readonly: true + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. diff --git a/mmv1/spec/data/resourceref-missingimports.yaml b/mmv1/spec/data/resourceref-missingimports.yaml new file mode 100644 index 000000000000..5639ccb6b29f --- /dev/null +++ b/mmv1/spec/data/resourceref-missingimports.yaml @@ -0,0 +1,48 @@ +# Copyright 2017 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: MyProduct +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: http://myproduct.google.com/api +scopes: + - http://scope-to-my-api/ +objects: + - !ruby/object:Api::Resource + name: 'ReferencedResource' + kind: 'myproduct#referencedresource' + base_url: 'referencedresource' + description: 'blah blah' + properties: + - !ruby/object:Api::Type::String + name: 'name' + description: 'an explanation whats this about' + - !ruby/object:Api::Resource + name: 'AnotherResource' + kind: 'myproduct#anotherresource' + base_url: 'anotherResource' + description: 'blah blah' + parameters: + - !ruby/object:Api::Type::ResourceRef + resource: 'ReferencedResource' + name: 'property5' + imports: 'missing' + description: 'an explanation whats this about' + properties: + - !ruby/object:Api::Type::String + name: 'property1' + description: | + Some multiline + description for the property. diff --git a/mmv1/spec/data/test-openapi-spec.json b/mmv1/spec/data/test-openapi-spec.json new file mode 100644 index 000000000000..a0418f97770f --- /dev/null +++ b/mmv1/spec/data/test-openapi-spec.json @@ -0,0 +1,1360 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "test API", + "description": "test API.", + "version": "v1alpha5" + }, + "servers": [ + { + "url": "https://test-example.googleapis.com" + } + ], + "paths": { + "/v1alpha5/projects/{projectsId}/locations/{locationsId}/posts": { + "get": { + "tags": ["resourceproviderblog_pa"], + "operationId": "ListPosts", + "description": "This is an example of providing customized documentation. All of the details about options and messages will be generated or updated, but the doc text will not replace what appears here.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `parent`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `parent`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "approvalNeeded", + "description": "This is an example of adding method-specific fields to a standard method. All other standard fields are added by generator, and this text documents the additional parameter.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "pageSize", + "description": "The maximum number of posts to send per page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "pageToken", + "description": "The page token: If the next_page_token from a previous response is provided, this request will send the subsequent page.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "filter", + "description": "Filter the list as specified in https://google.aip.dev/160.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "orderBy", + "description": "Order results as specified in https://google.aip.dev/132.", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListPostsResponse" + } + } + } + } + } + }, + "post": { + "tags": ["resourceproviderblog_pa"], + "operationId": "CreatePost", + "description": "Create a new post.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `parent`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `parent`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "postId", + "description": "Required. The ID value for the new post.", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Required. The desired state for the post.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Post" + } + } + } + }, + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Operation" + } + } + } + } + } + } + }, + "/v1alpha5/projects/{projectsId}/locations/{locationsId}/posts/{postsId}": { + "get": { + "tags": ["resourceproviderblog_pa"], + "operationId": "GetPost", + "description": "Retrieve a single post.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Post" + } + } + } + } + } + }, + "put": { + "tags": ["resourceproviderblog_pa"], + "operationId": "ApplyPost", + "description": "Create or update a single post.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "etag", + "description": "The etag known to the client for the expected state of the post. This is used with state-changing methods to prevent accidental overwrites when multiple user agents might be acting in parallel on the same resource. An etag wildcard provide optimistic concurrency based on the expected existence of the post. The Any wildcard (`*`) requires that the resource must already exists, and the Not Any wildcard (`!*`) requires that it must not.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Required. The desired state for the post.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Post" + } + } + } + }, + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Operation" + } + } + } + } + } + }, + "patch": { + "tags": ["resourceproviderblog_pa"], + "operationId": "UpdatePost", + "description": "Update a single post.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "etag", + "description": "The etag known to the client for the expected state of the post. This is used with state-changing methods to prevent accidental overwrites when multiple user agents might be acting in parallel on the same resource. An etag wildcard provide optimistic concurrency based on the expected existence of the post. The Any wildcard (`*`) requires that the resource must already exists, and the Not Any wildcard (`!*`) requires that it must not.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "updateMask", + "description": "Field mask is used to specify the fields to be overwritten in the Post resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields in the Post will be overwritten.", + "in": "query", + "schema": { + "type": "string", + "format": "google-fieldmask" + } + } + ], + "requestBody": { + "description": "Required. The desired state for the post.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Post" + } + } + } + }, + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Operation" + } + } + } + } + } + }, + "delete": { + "tags": ["resourceproviderblog_pa"], + "operationId": "DeletePost", + "description": "Delete a single post.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "etag", + "description": "The etag known to the client for the expected state of the post. This is used with state-changing methods to prevent accidental overwrites when multiple user agents might be acting in parallel on the same resource. An etag wildcard provide optimistic concurrency based on the expected existence of the post. The Any wildcard (`*`) requires that the resource must already exists, and the Not Any wildcard (`!*`) requires that it must not.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Operation" + } + } + } + } + } + } + }, + "/v1alpha5/projects/{projectsId}/locations/{locationsId}/posts/{postsId}:approvePostComments": { + "post": { + "tags": ["resourceproviderblog_pa"], + "operationId": "ApprovePostComments", + "description": "Calls the approvePostComments method on the post.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "etag", + "description": "The etag known to the client for the expected state of the post. This is used with state-changing methods to prevent accidental overwrites when multiple user agents might be acting in parallel on the same resource. An etag wildcard provide optimistic concurrency based on the expected existence of the post. The Any wildcard (`*`) requires that the resource must already exists, and the Not Any wildcard (`!*`) requires that it must not.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovePostCommentsBody" + } + } + } + }, + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovePostCommentsResponse" + } + } + } + } + } + } + }, + "/v1alpha5/projects/{projectsId}/locations/{locationsId}/posts/{postsId}/comments": { + "get": { + "tags": ["resourceproviderblog_pa"], + "operationId": "ListComments", + "description": "Retrieve a collection of comments.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `parent`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `parent`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `parent`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "pageSize", + "description": "The maximum number of comments to send per page.", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "pageToken", + "description": "The page token: If the next_page_token from a previous response is provided, this request will send the subsequent page.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "filter", + "description": "Filter the list as specified in https://google.aip.dev/160.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "orderBy", + "description": "Order results as specified in https://google.aip.dev/132.", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListCommentsResponse" + } + } + } + } + } + }, + "post": { + "tags": ["resourceproviderblog_pa"], + "operationId": "CreateComment", + "description": "Create a new comment.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `parent`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `parent`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `parent`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "commentId", + "description": "Required. The ID value for the new comment.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Required. The desired state for the comment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Comment" + } + } + } + }, + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Operation" + } + } + } + } + } + } + }, + "/v1alpha5/projects/{projectsId}/locations/{locationsId}/posts/{postsId}/comments/{commentsId}": { + "get": { + "tags": ["resourceproviderblog_pa"], + "operationId": "GetComment", + "description": "Retrieve a single comment.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "commentsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Comment" + } + } + } + } + } + }, + "put": { + "tags": ["resourceproviderblog_pa"], + "operationId": "ApplyComment", + "description": "Create or update a single comment.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "commentsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "etag", + "description": "The etag known to the client for the expected state of the comment. This is used with state-changing methods to prevent accidental overwrites when multiple user agents might be acting in parallel on the same resource. An etag wildcard provide optimistic concurrency based on the expected existence of the comment. The Any wildcard (`*`) requires that the resource must already exists, and the Not Any wildcard (`!*`) requires that it must not.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Required. The desired state for the comment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Comment" + } + } + } + }, + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Operation" + } + } + } + } + } + }, + "patch": { + "tags": ["resourceproviderblog_pa"], + "operationId": "UpdateComment", + "description": "Update a single comment.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "commentsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "etag", + "description": "The etag known to the client for the expected state of the comment. This is used with state-changing methods to prevent accidental overwrites when multiple user agents might be acting in parallel on the same resource. An etag wildcard provide optimistic concurrency based on the expected existence of the comment. The Any wildcard (`*`) requires that the resource must already exists, and the Not Any wildcard (`!*`) requires that it must not.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "updateMask", + "description": "Field mask is used to specify the fields to be overwritten in the Comment resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields in the Comment will be overwritten.", + "in": "query", + "schema": { + "type": "string", + "format": "google-fieldmask" + } + } + ], + "requestBody": { + "description": "Required. The desired state for the comment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Comment" + } + } + } + }, + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Operation" + } + } + } + } + } + }, + "delete": { + "tags": ["resourceproviderblog_pa"], + "operationId": "DeleteComment", + "description": "Delete a single comment.", + "parameters": [ + { + "name": "projectsId", + "description": "Part of `name`. ", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "locationsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "postsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "commentsId", + "description": "Part of `name`. See documentation of `projectsId`.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "etag", + "description": "The etag known to the client for the expected state of the comment. This is used with state-changing methods to prevent accidental overwrites when multiple user agents might be acting in parallel on the same resource. An etag wildcard provide optimistic concurrency based on the expected existence of the comment. The Any wildcard (`*`) requires that the resource must already exists, and the Not Any wildcard (`!*`) requires that it must not.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "validateOnly", + "description": "If mvalidate_onlym is set to true, the service will try to validate that this request would succeed, but will not actually make changes.", + "in": "query", + "schema": { + "type": "boolean" + } + }, + { + "name": "requestId", + "description": "An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Operation" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "ListPostsResponse": { + "description": "The response structure for the ListPosts method.", + "type": "object", + "properties": { + "items": { + "description": "The resulting posts.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Post" + } + }, + "nextPageToken": { + "description": "If present, the next page token can be provided to a subsequent ListPosts call to list the next page. If empty, there are no more pages.", + "type": "string" + }, + "unreachable": { + "description": "Locations that could not be reached.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Post": { + "type": "object", + "properties": { + "quota": { + "$ref": "#/components/schemas/AccessModelQuota" + }, + "paywall": { + "$ref": "#/components/schemas/AccessModelPaywall" + }, + "title": { + "description": "Required. Title of blog post.", + "type": "string" + }, + "abstract": { + "description": "Optional. Abstract summary of blog post.", + "type": "string" + }, + "destination": { + "description": "Immutable. Where the blog should be located", + "x-google-immutable": true, + "type": "string" + }, + "name": { + "description": "Output only.", + "readOnly": true, + "type": "string" + }, + "labels": { + "description": "The labels on the resource, which can be used for categorization. similar to Kubernetes resource labels.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "uid": { + "description": "Output only. The unique identifier of the resource. UID is unique in the time and space for this resource within the scope of the service. It is typically generated by the server on successful creation of a resource and must not be changed. UID is used to uniquely identify resources with resource name reuses. This should be a UUID4.", + "readOnly": true, + "type": "string" + }, + "etag": { + "description": "Output only. An opaque value that uniquely identifies a version or generation of a resource. It can be used to confirm that the client and server agree on the ordering of a resource being written.", + "readOnly": true, + "type": "string" + }, + "createTime": { + "description": "Output only. The timestamp when the resource was created.", + "readOnly": true, + "type": "string", + "format": "google-datetime" + }, + "updateTime": { + "description": "Output only. The timestamp when the resource was last updated. Any change to the resource made by users must refresh this value. Changes to a resource made by the service should refresh this value.", + "readOnly": true, + "type": "string", + "format": "google-datetime" + }, + "metadata": { + "description": "Output only. Holds standardized information about the post resource.", + "readOnly": true, + "$ref": "#/components/schemas/PostMetadata" + } + }, + "required": [ + "title" + ] + }, + "AccessModelQuota": { + "description": "Configuration for a quota-based access model", + "type": "object", + "properties": { + "bucketName": { + "description": "Non-empty default. BucketName is the internal quota name that a fetch request for the current user is counted against. Fetch requests are sent to the blog data plane (not implemented) and calls to GetPost are not counted. The default bucket, if not specified, is the well-known mtwenty_per_daym.", + "x-google-server-default": true, + "type": "string" + } + } + }, + "AccessModelPaywall": { + "description": "Configuration for a paywall-based access model", + "type": "object", + "properties": { + "productSkus": { + "description": "ProductSkus are the list of internal product codes that the current user is tested for in order to determine access.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "PostMetadata": { + "description": "PostMetadata holds standardized information about the post resource.", + "type": "object", + "properties": { + "fullName": { + "description": "Output only.", + "type": "string" + }, + "type": { + "description": "Output only.", + "type": "string" + }, + "collection": { + "description": "Output only.", + "type": "string" + }, + "version": { + "type": "string" + }, + "id": { + "type": "string" + }, + "project": { + "type": "string" + }, + "location": { + "description": "Output only. The location of the resource. The location encoding is specific to the service provider, and new encoding may be introduced as the service evolves. For Google Cloud products, the encoding is what is used by Google Cloud APIs, such as `us-east1`, `aws-us-east-1`, and `azure-eastus2`. The semantics of `location` is identical to the `cloud.googleapis.com/location` label used by some Google Cloud APIs.", + "type": "string" + } + } + }, + "Operation": { + "description": "This resource represents a long-running operation that is the result of a network API call.", + "type": "object", + "properties": { + "name": { + "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.", + "type": "string" + }, + "metadata": { + "description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.", + "type": "object", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL." + } + }, + "done": { + "description": "If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.", + "type": "boolean" + }, + "error": { + "description": "The error result of the operation in case of failure or cancellation.", + "$ref": "#/components/schemas/Status" + }, + "response": { + "description": "The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", + "type": "object", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL." + } + } + } + }, + "Status": { + "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).", + "type": "object", + "properties": { + "code": { + "description": "The status code, which should be an enum value of google.rpc.Code.", + "type": "integer", + "format": "int32" + }, + "message": { + "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.", + "type": "string" + }, + "details": { + "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL." + } + } + } + } + }, + "ApprovePostCommentsBody": { + "description": "ApprovePostCommentsRequest is the request body for ApprovePostComments", + "type": "object", + "properties": { + "comments": { + "description": "Comments to approve for the post.", + "type": "array", + "items": { + "type": "string" + } + }, + "isAutomated": { + "description": "True if the comment approval is being done by an automated system.", + "type": "boolean" + } + } + }, + "ApprovePostCommentsResponse": { + "description": "ApprovePostCommentsResponse is the LRO response field of ApprovePostComments method.", + "type": "object", + "properties": { + "trackingNumber": { + "description": "Some form of tracking number the caller can store in their records.", + "type": "string" + } + } + }, + "ListCommentsResponse": { + "description": "The response structure for the ListComments method.", + "type": "object", + "properties": { + "items": { + "description": "The resulting comments.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Comment" + } + }, + "nextPageToken": { + "description": "If present, the next page token can be provided to a subsequent ListComments call to list the next page. If empty, there are no more pages.", + "type": "string" + }, + "unreachable": { + "description": "Locations that could not be reached.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Comment": { + "description": "A Comment on a blog", + "type": "object", + "properties": { + "markdown": { + "description": "Markdown content from original commenter.", + "type": "string" + }, + "approved": { + "description": "Output only. Approved indicates that Post custom method ApproveComments has been called. This indicates either either automated or manual clearance of markdown text has taken place.", + "readOnly": true, + "type": "boolean" + }, + "name": { + "description": "Output only.", + "readOnly": true, + "type": "string" + }, + "labels": { + "description": "The labels on the resource, which can be used for categorization. similar to Kubernetes resource labels.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "uid": { + "description": "Output only. The unique identifier of the resource. UID is unique in the time and space for this resource within the scope of the service. It is typically generated by the server on successful creation of a resource and must not be changed. UID is used to uniquely identify resources with resource name reuses. This should be a UUID4.", + "readOnly": true, + "type": "string" + }, + "etag": { + "description": "Output only. An opaque value that uniquely identifies a version or generation of a resource. It can be used to confirm that the client and server agree on the ordering of a resource being written.", + "readOnly": true, + "type": "string" + }, + "createTime": { + "description": "Output only. The timestamp when the resource was created.", + "readOnly": true, + "type": "string", + "format": "google-datetime" + }, + "updateTime": { + "description": "Output only. The timestamp when the resource was last updated. Any change to the resource made by users must refresh this value. Changes to a resource made by the service should refresh this value.", + "readOnly": true, + "type": "string", + "format": "google-datetime" + }, + "metadata": { + "description": "Output only. Holds standardized information about the comment resource.", + "readOnly": true, + "$ref": "#/components/schemas/CommentMetadata" + } + } + }, + "CommentMetadata": { + "description": "CommentMetadata holds standardized information about the comment resource.", + "type": "object", + "properties": { + "fullName": { + "description": "Output only.", + "type": "string" + }, + "type": { + "description": "Output only.", + "type": "string" + }, + "collection": { + "description": "Output only.", + "type": "string" + }, + "version": { + "type": "string" + }, + "id": { + "type": "string" + }, + "project": { + "type": "string" + }, + "location": { + "description": "Output only. The location of the resource. The location encoding is specific to the service provider, and new encoding may be introduced as the service evolves. For Google Cloud products, the encoding is what is used by Google Cloud APIs, such as `us-east1`, `aws-us-east-1`, and `azure-eastus2`. The semantics of `location` is identical to the `cloud.googleapis.com/location` label used by some Google Cloud APIs.", + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/artifact_registry_repository.go.tmpl b/mmv1/templates/terraform/constants/artifact_registry_repository.go.tmpl index 4576d52266bd..46d3754d6602 100644 --- a/mmv1/templates/terraform/constants/artifact_registry_repository.go.tmpl +++ b/mmv1/templates/terraform/constants/artifact_registry_repository.go.tmpl @@ -11,106 +11,35 @@ limitations under the License. */ -}} func upstreamPoliciesDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - o, n := d.GetChange("virtual_repository_config.0.upstream_policies") - oldPolicies, ok := o.([]any) - if !ok { - return false - } - newPolicies, ok := n.([]any) - if !ok { - return false - } - - var oldHashes, newHashes []interface{} - for _, policy := range oldPolicies { - data, ok := policy.(map[string]any) - if !ok { - return false - } - hashStr := fmt.Sprintf("[id:%v priority:%v repository:%v]", data["id"], data["priority"], data["repository"]) - oldHashes = append(oldHashes, hashStr) - } - for _, policy := range newPolicies { - data, ok := policy.(map[string]any) - if !ok { - return false - } - hashStr := fmt.Sprintf("[id:%v priority:%v repository:%v]", data["id"], data["priority"], data["repository"]) - newHashes = append(newHashes, hashStr) - } - - oldSet := schema.NewSet(schema.HashString, oldHashes) - newSet := schema.NewSet(schema.HashString, newHashes) - return oldSet.Equal(newSet) -} - -func parseDurationAsSeconds(v string) (int, bool) { - if len(v) == 0 { - return 0, false - } - n, err := strconv.Atoi(v[:len(v)-1]) - if err != nil { - return 0, false - } - switch v[len(v)-1] { - case 's': - return n, true - case 'm': - return n * 60, true - case 'h': - return n * 3600, true - case 'd': - return n * 86400, true - default: - return 0, false - } -} - -// Like tpgresource.DurationDiffSuppress, but supports 'd' -func durationDiffSuppress(k, oldr, newr string, d *schema.ResourceData) bool { - o, n := d.GetChange(k) - old, ok := o.(string) - if !ok { - return false - } - new, ok := n.(string) - if !ok { - return false - } - if old == new { - return true - } - oldSeconds, ok := parseDurationAsSeconds(old) - if !ok { - return false - } - newSeconds, ok := parseDurationAsSeconds(new) - if !ok { - return false - } - return oldSeconds == newSeconds -} - -func mapHashID(v any) int { - obj := v.(map[string]any) - return schema.HashString(obj["id"]) -} - -func isDefaultEnum(val any) bool { - s, ok := val.(string) + o, n := d.GetChange("virtual_repository_config.0.upstream_policies") + oldPolicies, ok := o.([]any) if !ok { return false } - return s == "" || strings.HasSuffix(s, "_UNSPECIFIED") -} - -// emptyMavenConfigDiffSuppress generates a config from defaults if it or any -// properties are unset. Missing, empty and default configs are all equivalent. -func emptyMavenConfigDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - oSnap, nSnap := d.GetChange("maven_config.0.allow_snapshot_overwrites") - if oSnap.(bool) != nSnap.(bool) { + newPolicies, ok := n.([]any) + if !ok { return false } - oPolicy, nPolicy := d.GetChange("maven_config.0.version_policy") - return isDefaultEnum(oPolicy) && isDefaultEnum(nPolicy) + + var oldHashes, newHashes []interface{} + for _, policy := range oldPolicies { + data, ok := policy.(map[string]any) + if !ok { + return false + } + hashStr := fmt.Sprintf("[id:%v priority:%v repository:%v]", data["id"], data["priority"], data["repository"]) + oldHashes = append(oldHashes, hashStr) + } + for _, policy := range newPolicies { + data, ok := policy.(map[string]any) + if !ok { + return false + } + hashStr := fmt.Sprintf("[id:%v priority:%v repository:%v]", data["id"], data["priority"], data["repository"]) + newHashes = append(newHashes, hashStr) + } + + oldSet := schema.NewSet(schema.HashString, oldHashes) + newSet := schema.NewSet(schema.HashString, newHashes) + return oldSet.Equal(newSet) } diff --git a/mmv1/templates/terraform/constants/colab_runtime.go.tmpl b/mmv1/templates/terraform/constants/colab_runtime.go.tmpl deleted file mode 100644 index f9edbbb009cc..000000000000 --- a/mmv1/templates/terraform/constants/colab_runtime.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -func ModifyColabRuntimeOperation(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string, method string) (map[string]interface{}, error) { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ColabBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/notebookRuntimes/{{"{{"}}name{{"}}"}}:"+method) - if err != nil { - return nil, err - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return nil, fmt.Errorf("Unable to %q google_colab_runtime %q: %s", method, d.Id(), err) - } - return res, nil -} - -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -func waitForColabOperation(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string, response map[string]interface{}) error { - var opRes map[string]interface{} - err := ColabOperationWaitTimeWithResponse( - config, response, &opRes, project, "Waiting for Colab Runtime Operation", userAgent, - d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err - } - return nil -} - -func ModifyColabRuntime(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string, method string) error { - dRes, err := ModifyColabRuntimeOperation(config, d, project, billingProject, userAgent, method) - if err != nil { - return err - } - if err := waitForColabOperation(config, d, project, billingProject, userAgent, dRes); err != nil { - return fmt.Errorf("Error with Colab runtime method: %s", err) - } - return nil -} -{{- end }} diff --git a/mmv1/templates/terraform/constants/colab_schedule.go.tmpl b/mmv1/templates/terraform/constants/colab_schedule.go.tmpl deleted file mode 100644 index e8347bb74665..000000000000 --- a/mmv1/templates/terraform/constants/colab_schedule.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -func modifyScheduleState(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string, state string) (map[string]interface{}, error) { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ColabBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/schedules/{{"{{"}}name{{"}}"}}:"+state) - if err != nil { - return nil, err - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return nil, fmt.Errorf("Unable to %q google_colab_schedule %q: %s", state, d.Id(), err) - } - return res, nil -} diff --git a/mmv1/templates/terraform/constants/compute_firewall_policy_operation.go.tmpl b/mmv1/templates/terraform/constants/compute_firewall_policy_operation.go.tmpl deleted file mode 100644 index 9804927e8852..000000000000 --- a/mmv1/templates/terraform/constants/compute_firewall_policy_operation.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, d.Get("parent").(string), "FirewallPolicy operation", userAgent, - d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually create - return fmt.Errorf("Error waiting for FirewallPolicy operation: %s", err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/compute_forwarding_rule.go.tmpl b/mmv1/templates/terraform/constants/compute_forwarding_rule.go.tmpl index cef8664a7914..83c5a738e7f3 100644 --- a/mmv1/templates/terraform/constants/compute_forwarding_rule.go.tmpl +++ b/mmv1/templates/terraform/constants/compute_forwarding_rule.go.tmpl @@ -22,24 +22,6 @@ func PortRangeDiffSuppress(k, old, new string, d *schema.ResourceData) bool { return old == new+"-"+new } -// Compare only the relative path from 'regions' of two IP collection links -func IpCollectionDiffSuppress(_, old, new string, d *schema.ResourceData) bool { - oldStripped, err := GetRelativePathFromRegions(old) - if err != nil { - return false - } - - newStripped, err := GetRelativePathFromRegions(new) - if err != nil { - return false - } - - if oldStripped == newStripped { - return true - } - return false -} - // Suppresses diff for IPv4 and IPv6 different formats. // It also suppresses diffs if an IP is changing to a reference. func InternalIpDiffSuppress(_, old, new string, _ *schema.ResourceData) bool { @@ -83,12 +65,3 @@ func InternalIpDiffSuppress(_, old, new string, _ *schema.ResourceData) bool { return addr_equality && netmask_equality } - -func GetRelativePathFromRegions(resourceLink string) (string, error) { - stringParts := strings.SplitAfterN(resourceLink, "regions/", 2) - if len(stringParts) != 2 { - return "", fmt.Errorf("String is not a valid link: %s", resourceLink) - } - - return "regions/" + stringParts[1], nil -} diff --git a/mmv1/templates/terraform/constants/workbench_instance.go.tmpl b/mmv1/templates/terraform/constants/workbench_instance.go.tmpl index 046ce1e2cea4..b6cc9afc7db5 100644 --- a/mmv1/templates/terraform/constants/workbench_instance.go.tmpl +++ b/mmv1/templates/terraform/constants/workbench_instance.go.tmpl @@ -243,23 +243,23 @@ func resizeWorkbenchInstanceDisk(config *transport_tpg.Config, d *schema.Resourc return nil } -// mergeMaps takes two maps and returns a new map with the merged results. -// If a key exists in oldMap but not in newMap, it is added to the new map with an empty value. -func mergeMaps(oldMap, newMap map[string]interface{}) map[string]string { - modifiedMap := make(map[string]string) +// mergeLabels takes two maps of labels and returns a new map with the labels merged. +// If a key exists in old_labels but not in new_labels, it is added to the new map with an empty value. +func mergeLabels(oldLabels, newLabels map[string]interface{}) map[string]string { + modifiedLabels := make(map[string]string) - // Add all key-values from newMap to modifiedMap - for k, v := range newMap { - modifiedMap[k] = v.(string) + // Add all labels from newLabels to modifiedLabels + for k, v := range newLabels { + modifiedLabels[k] = v.(string) } - // Add any keys from oldMap that are not in newMap with an empty value - for k := range oldMap { - if _, ok := newMap[k]; !ok { - modifiedMap[k] = "" + // Add any keys from oldLabels that are not in newLabels with an empty value + for k := range oldLabels { + if _, ok := newLabels[k]; !ok { + modifiedLabels[k] = "" } } - return modifiedMap + return modifiedLabels } -{{- end }} +{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/firestore_field_delete.go.tmpl b/mmv1/templates/terraform/custom_delete/firestore_field_delete.go.tmpl index ec32ca32832f..fb893e9b7bf1 100644 --- a/mmv1/templates/terraform/custom_delete/firestore_field_delete.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/firestore_field_delete.go.tmpl @@ -15,16 +15,8 @@ if err != nil { return err } -// For wildcard fields, do not add ttlConfig to the update mask (unsupported) -updateMask := []string{"indexConfig"} -re := regexp.MustCompile("^projects/([^/]+)/databases/([^/]+)/collectionGroups/([^/]+)/fields/(.+)$") -match := re.FindStringSubmatch(d.Get("name").(string)) -if len(match) < 5 { - return fmt.Errorf("Error parsing field name for App") -} -if fieldName := match[4]; fieldName != "*" { - updateMask = append(updateMask, "ttlConfig") -} +updateMask := []string{"indexConfig", "ttlConfig"} + url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) if err != nil { return err diff --git a/mmv1/templates/terraform/custom_delete/per_instance_config.go.tmpl b/mmv1/templates/terraform/custom_delete/per_instance_config.go.tmpl index 3cb8533642aa..1063876a5063 100644 --- a/mmv1/templates/terraform/custom_delete/per_instance_config.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/per_instance_config.go.tmpl @@ -3,7 +3,7 @@ return err } - lockName, err := tpgresource.ReplaceVars(d, config, "instanceGroupManager/{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}instance_group_manager{{"}}"}}/{{"{{"}}name{{"}}"}}") + lockName, err := tpgresource.ReplaceVars(d, config, "instanceGroupManager/{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}instance_group_manager{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/redis_cluster_user_created_connections.go.tmpl b/mmv1/templates/terraform/custom_delete/redis_cluster_user_created_connections.go.tmpl deleted file mode 100644 index 94d42379e41f..000000000000 --- a/mmv1/templates/terraform/custom_delete/redis_cluster_user_created_connections.go.tmpl +++ /dev/null @@ -1,65 +0,0 @@ - billingProject := "" - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("Error fetching project for ClusterUserCreatedConnections: %s", err) - } - billingProject = project - - obj := make(map[string]interface{}) - // not setting clusterEndpoints in obj - - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}RedisBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/clusters/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - log.Printf("[DEBUG] Updating ClusterUserCreatedConnections %q: %#v", d.Id(), obj) - headers := make(http.Header) - - updateMask := []string{} - updateMask = append(updateMask, "clusterEndpoints") - // updateMask is a URL parameter but not present in the schema, so ReplaceVars - // won't set it - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) - if err != nil { - return err - } - - // err == nil indicates that the billing_project value was found - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - obj["async_cluster_endpoints_deletion_enabled"] = true - - // if updateMask is empty we are not updating anything so skip the post - if len(updateMask) > 0 { - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), - Headers: headers, - }) - - if err != nil { - return fmt.Errorf("Error updating ClusterUserCreatedConnections %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished updating ClusterUserCreatedConnections %q: %#v", d.Id(), res) - } - - err = RedisOperationWaitTime( - config, res, project, "Updating ClusterUserCreatedConnections", userAgent, - d.Timeout(schema.TimeoutUpdate)) - - if err != nil { - return err - } - } - - return resourceRedisClusterUserCreatedConnectionsRead(d, meta) \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/region_per_instance_config.go.tmpl b/mmv1/templates/terraform/custom_delete/region_per_instance_config.go.tmpl index d9db74ca9f57..57027d277ddb 100644 --- a/mmv1/templates/terraform/custom_delete/region_per_instance_config.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/region_per_instance_config.go.tmpl @@ -3,7 +3,7 @@ return err } - lockName, err := tpgresource.ReplaceVars(d, config, "instanceGroupManager/{{"{{"}}project{{"}}"}}/{{"{{"}}region{{"}}"}}/{{"{{"}}region_instance_group_manager{{"}}"}}/{{"{{"}}name{{"}}"}}") + lockName, err := tpgresource.ReplaceVars(d, config, "instanceGroupManager/{{"{{"}}project{{"}}"}}/{{"{{"}}region{{"}}"}}/{{"{{"}}region_instance_group_manager{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_expand/duration_to_seconds.go.tmpl b/mmv1/templates/terraform/custom_expand/duration_to_seconds.go.tmpl deleted file mode 100644 index 0006f1de0c79..000000000000 --- a/mmv1/templates/terraform/custom_expand/duration_to_seconds.go.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -{{/* - The license inside this block applies to this file - 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. -*/ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil { - return nil, nil - } - val, ok := v.(string) - if !ok { - return nil, fmt.Errorf("unexpected value is not string: %v", v) - } - if len(val) == 0 { - return nil, nil - } - n, err := strconv.Atoi(val[:len(val)-1]) - if err != nil { - return nil, fmt.Errorf("unexpected value is not duration: %v", v) - } - // time.ParseDuration does not support 'd' - var seconds int - switch val[len(val)-1] { - case 's': - seconds = n - case 'm': - seconds = n * 60 - case 'h': - seconds = n * 3600 - case 'd': - seconds = n * 86400 - default: - return nil, fmt.Errorf("unexpected duration has unknown unit: %c", val[len(val)-1]) - } - return fmt.Sprintf("%ds", seconds), nil -} diff --git a/mmv1/templates/terraform/custom_expand/eventarc_trigger_destination_workflow.go.tmpl b/mmv1/templates/terraform/custom_expand/eventarc_trigger_destination_workflow.go.tmpl deleted file mode 100644 index 931b39532917..000000000000 --- a/mmv1/templates/terraform/custom_expand/eventarc_trigger_destination_workflow.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -{{/* - The license inside this block applies to this file - Copyright 2025 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. -*/ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return expandToRegionalLongForm("projects/%s/locations/%s/workflows/%s", v, d, config) -} diff --git a/mmv1/templates/terraform/custom_expand/eventarc_trigger_transport_pubsub_topic.go.tmpl b/mmv1/templates/terraform/custom_expand/eventarc_trigger_transport_pubsub_topic.go.tmpl deleted file mode 100644 index 9fb934838e08..000000000000 --- a/mmv1/templates/terraform/custom_expand/eventarc_trigger_transport_pubsub_topic.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -{{/* - The license inside this block applies to this file - Copyright 2025 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. -*/ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return expandToLongForm("projects/%s/topics/%s", v, d, config) -} diff --git a/mmv1/templates/terraform/custom_expand/sd_full_url.tmpl b/mmv1/templates/terraform/custom_expand/sd_full_url.tmpl index d1e73f4d7a8d..3cb26b0eb83a 100644 --- a/mmv1/templates/terraform/custom_expand/sd_full_url.tmpl +++ b/mmv1/templates/terraform/custom_expand/sd_full_url.tmpl @@ -8,7 +8,5 @@ func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.T if err != nil { return "", err } - - // v1 is the only version in use, replace the first occurrence of v1beta with v1 in the URL - return strings.Replace(url, "/v1beta1/", "/v1/", 1), nil + return url, nil } diff --git a/mmv1/templates/terraform/custom_flatten/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl index 78ab86ab8387..231fc3f35c04 100644 --- a/mmv1/templates/terraform/custom_flatten/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl @@ -147,7 +147,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressP transformed.Add(map[string]interface{}{ "ingress_from": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFrom(original["ingressFrom"], d, config), "ingress_to": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressTo(original["ingressTo"], d, config), - "title": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesTitle(original["title"], d, config), }) } return transformed @@ -279,10 +278,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressP return v } -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesTitle(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v; -} - func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPolicies(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v @@ -298,7 +293,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPo transformed = append(transformed, map[string]interface{}{ "egress_from": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFrom(original["egressFrom"], d, config), "egress_to": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressTo(original["egressTo"], d, config), - "title": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesTitle(original["title"], d, config), }) } return transformed @@ -347,7 +341,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPo } transformed = append(transformed, map[string]interface{}{ "access_level": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSourcesAccessLevel(original["accessLevel"], d, config), - "resource": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSourcesResource(original["resource"], d, config), }) } return transformed @@ -356,10 +349,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPo return v } -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSourcesResource(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSourceRestriction(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } @@ -445,10 +434,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPo return v } -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesTitle(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v; -} - func flattenAccessContextManagerServicePerimetersServicePerimetersSpec(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil @@ -534,7 +519,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPol transformed = append(transformed, map[string]interface{}{ "ingress_from": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFrom(original["ingressFrom"], d, config), "ingress_to": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressTo(original["ingressTo"], d, config), - "title": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesTitle(original["title"], d, config), }) } return transformed @@ -666,10 +650,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPol return v } -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesTitle(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPolicies(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v @@ -685,7 +665,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoli transformed = append(transformed, map[string]interface{}{ "egress_from": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFrom(original["egressFrom"], d, config), "egress_to": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressTo(original["egressTo"], d, config), - "title": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesTitle(original["title"], d, config), }) } return transformed @@ -734,7 +713,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoli } transformed = append(transformed, map[string]interface{}{ "access_level": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSourcesAccessLevel(original["accessLevel"], d, config), - "resource": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSourcesResource(original["resource"], d, config), }) } return transformed @@ -743,10 +721,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoli return v } -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSourcesResource(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSourceRestriction(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } @@ -832,10 +806,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoli return v } -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesTitle(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenAccessContextManagerServicePerimetersServicePerimetersUseExplicitDryRunSpec(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } diff --git a/mmv1/templates/terraform/custom_flatten/colab_notebook_execution_direct_content.go.tmpl b/mmv1/templates/terraform/custom_flatten/colab_notebook_execution_direct_content.go.tmpl deleted file mode 100644 index 4cec461efb04..000000000000 --- a/mmv1/templates/terraform/custom_flatten/colab_notebook_execution_direct_content.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -{{/* - The license inside this block applies to this file - Copyright 2025 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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("direct_notebook_source.0.content") -} diff --git a/mmv1/templates/terraform/custom_flatten/dms_migration_job_error_details.tmpl b/mmv1/templates/terraform/custom_flatten/dms_migration_job_error_details.tmpl deleted file mode 100644 index 3f356f85b23b..000000000000 --- a/mmv1/templates/terraform/custom_flatten/dms_migration_job_error_details.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -{{/* - The license inside this block applies to this file - 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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - detailsArray := v.([]interface{}) - for i, raw := range detailsArray { - m := raw.(map[string]interface{}) - if len(m) < 1 { - // Do not include empty json objects coming back from the api - continue - } - for k, val := range m { - if _, ok := val.(string); !ok { - b, err := json.Marshal(v) - if err != nil { - return err - } - m[k] = string(b) - } - } - detailsArray[i] = m - } - return detailsArray -} diff --git a/mmv1/templates/terraform/custom_flatten/parameter_version_parameter_data.go.tmpl b/mmv1/templates/terraform/custom_flatten/parameter_version_parameter_data.go.tmpl deleted file mode 100644 index 4b4687cc41be..000000000000 --- a/mmv1/templates/terraform/custom_flatten/parameter_version_parameter_data.go.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -{{/* - The license inside this block applies to this file - 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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(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{}) - data, err := base64.StdEncoding.DecodeString(original["data"].(string)) - if err != nil { - return err - } - transformed["parameter_data"] = string(data) - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_egress_policy.go.tmpl b/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_egress_policy.go.tmpl index 9dc1d8dedb52..121f2ee42714 100644 --- a/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_egress_policy.go.tmpl +++ b/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_egress_policy.go.tmpl @@ -18,9 +18,6 @@ return nil, err } - if err := d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts["accessPolicy"])); err != nil { - return nil, fmt.Errorf("Error setting access_policy_id: %s", err) - } if err := d.Set("perimeter", fmt.Sprintf("accessPolicies/%s/servicePerimeters/%s", parts["accessPolicy"], parts["perimeter"])); err != nil { return nil, fmt.Errorf("Error setting perimeter: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_ingress_policy.go.tmpl b/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_ingress_policy.go.tmpl index 9dc1d8dedb52..121f2ee42714 100644 --- a/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_ingress_policy.go.tmpl +++ b/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_ingress_policy.go.tmpl @@ -18,9 +18,6 @@ return nil, err } - if err := d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts["accessPolicy"])); err != nil { - return nil, fmt.Errorf("Error setting access_policy_id: %s", err) - } if err := d.Set("perimeter", fmt.Sprintf("accessPolicies/%s/servicePerimeters/%s", parts["accessPolicy"], parts["perimeter"])); err != nil { return nil, fmt.Errorf("Error setting perimeter: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_resource.go.tmpl b/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_resource.go.tmpl index 075587c706a0..77b57820573e 100644 --- a/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_resource.go.tmpl +++ b/mmv1/templates/terraform/custom_import/access_context_manager_service_perimeter_resource.go.tmpl @@ -18,9 +18,6 @@ return nil, err } - if err := d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts["accessPolicy"])); err != nil { - return nil, fmt.Errorf("Error setting access_policy_id: %s", err) - } if err := d.Set("perimeter_name", fmt.Sprintf("accessPolicies/%s/servicePerimeters/%s", parts["accessPolicy"], parts["perimeter"])); err != nil { return nil, fmt.Errorf("Error setting perimeter_name: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apihub_api_hub_instance_set_id.go.tmpl b/mmv1/templates/terraform/custom_import/apihub_api_hub_instance_set_id.go.tmpl deleted file mode 100644 index a8b8df499291..000000000000 --- a/mmv1/templates/terraform/custom_import/apihub_api_hub_instance_set_id.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -config := meta.(*transport_tpg.Config) -if err := tpgresource.ParseImportId([]string{ - "^projects/(?P[^/]+)/locations/(?P[^/]+)/apiHubInstances/(?P[^/]+)$", - "^(?P[^/]+)/(?P[^/]+)/(?P[^/]+)$", - "^(?P[^/]+)/(?P[^/]+)$", -}, d, config); err != nil { - return nil, err -} - -// Set name based on the components -if err := d.Set("name", "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/apiHubInstances/{{"{{"}}api_hub_instance_id{{"}}"}}"); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, d.Get("name").(string)) -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/parameter_manager_parameter_version.go.tmpl b/mmv1/templates/terraform/custom_import/parameter_manager_parameter_version.go.tmpl deleted file mode 100644 index 6cba361bd650..000000000000 --- a/mmv1/templates/terraform/custom_import/parameter_manager_parameter_version.go.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -{{/* - The license inside this block applies to this file - 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. -*/ -}} - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value - if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err - } - - name := d.Get("name").(string) - parameterRegex := regexp.MustCompile("(projects/.+/locations/global/parameters/.+)/versions/.+$") - versionRegex := regexp.MustCompile("projects/(.+)/locations/global/parameters/(.+)/versions/(.+)$") - - parts := parameterRegex.FindStringSubmatch(name) - if len(parts) != 2 { - return nil, fmt.Errorf("Version name does not fit the format `projects/{{"{{"}}project{{"}}"}}/locations/global/parameters/{{"{{"}}parameter_id{{"}}"}}/versions/{{"{{"}}parameter_version_id{{"}}"}}`") - } - if err := d.Set("parameter", parts[1]); err != nil { - return nil, fmt.Errorf("Error setting parameter: %s", err) - } - - parts = versionRegex.FindStringSubmatch(name) - - if err := d.Set("parameter_version_id", parts[3]); err != nil { - return nil, fmt.Errorf("Error setting parameter_version_id: %s", err) - } - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/parameter_manager_regional_parameter_version.go.tmpl b/mmv1/templates/terraform/custom_import/parameter_manager_regional_parameter_version.go.tmpl deleted file mode 100644 index 8c83ee0be8b4..000000000000 --- a/mmv1/templates/terraform/custom_import/parameter_manager_regional_parameter_version.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -{{/* - The license inside this block applies to this file - 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. -*/ -}} - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value - if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err - } - - name := d.Get("name").(string) - parameterRegex := regexp.MustCompile("(projects/.+/locations/.+/parameters/.+)/versions/.+$") - versionRegex := regexp.MustCompile("projects/(.+)/locations/(.+)/parameters/(.+)/versions/(.+)$") - - parts := parameterRegex.FindStringSubmatch(name) - if len(parts) != 2 { - return nil, fmt.Errorf("Version name does not fit the format `projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/parameters/{{"{{"}}parameter_id{{"}}"}}/versions/{{"{{"}}parameter_version_id{{"}}"}}`") - } - if err := d.Set("parameter", parts[1]); err != nil { - return nil, fmt.Errorf("Error setting parameter: %s", err) - } - - parts = versionRegex.FindStringSubmatch(name) - - if err := d.Set("parameter_version_id", parts[4]); err != nil { - return nil, fmt.Errorf("Error setting parameter_version_id: %s", err) - } - - if err := d.Set("location", parts[2]); err != nil { - return nil, fmt.Errorf("Error setting location: %s", err) - } - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_update/colab_runtime.go.tmpl b/mmv1/templates/terraform/custom_update/colab_runtime.go.tmpl deleted file mode 100644 index 8cc234a988c9..000000000000 --- a/mmv1/templates/terraform/custom_update/colab_runtime.go.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -name := d.Get("name").(string) -state := d.Get("state").(string) -desired_state := d.Get("desired_state").(string) - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return err -} - -userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) -if err != nil { - return err -} - -billingProject := "" -if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp -} - -if desired_state != "" && state != desired_state { - var verb string - - switch desired_state { - case "STOPPED": - verb = "stop" - case "RUNNING": - verb = "start" - default: - return fmt.Errorf("desired_state has to be RUNNING or STOPPED") - } - - if err := ModifyColabRuntime(config, d, project, billingProject, userAgent, verb); err != nil { - return err - } - -} else { - log.Printf("[DEBUG] Colab runtime %q has state %q.", name, state) -} - -var upgrade_runtime bool -if d.Get("auto_upgrade").(bool) && d.Get("is_upgradable").(bool) { - upgrade_runtime = true -} - -expiration_time_string := d.Get("expiration_time").(string) -expiration_time, err := time.Parse(time.RFC3339Nano, expiration_time_string) -if err != nil { - return err -} - -if expiration_time.Before(time.Now()) && d.Get("notebook_runtime_type").(string) == "USER_DEFINED" { - upgrade_runtime = true -} - -if upgrade_runtime { - if err := ModifyColabRuntime(config, d, project, billingProject, userAgent, "upgrade"); err != nil { - return err - } -} - -return nil diff --git a/mmv1/templates/terraform/datasource_iam.html.markdown.tmpl b/mmv1/templates/terraform/datasource_iam.html.markdown.tmpl index f9fcd4484d89..ae92f0847a54 100644 --- a/mmv1/templates/terraform/datasource_iam.html.markdown.tmpl +++ b/mmv1/templates/terraform/datasource_iam.html.markdown.tmpl @@ -54,8 +54,7 @@ description: |- --- -# {{ $.IamTerraformName }}_policy - +# `{{ $.IamTerraformName }}_policy` Retrieves the current IAM policy data for {{ lower $.Name }} {{- if or (eq $.MinVersionObj.Name "beta") (eq $.IamPolicy.MinVersion "beta") }} ~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. @@ -63,8 +62,7 @@ See [Provider Versions](https://terraform.io/docs/providers/google/guides/provid {{- end }} -## Example Usage - +## example ```hcl data "{{ $.IamTerraformName }}_policy" "policy" { diff --git a/mmv1/templates/terraform/decoders/chronicle_retrohunt.go.tmpl b/mmv1/templates/terraform/decoders/chronicle_retrohunt.go.tmpl deleted file mode 100644 index f01cee652b68..000000000000 --- a/mmv1/templates/terraform/decoders/chronicle_retrohunt.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -{{/* - The license inside this block applies to this file - 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. -*/ -}} -name, ok := res["name"].(string) -if !ok { - log.Printf("[ERROR] 'name' not found in response") -} -parts := strings.Split(name, "/") -retrohunt_id := parts[len(parts)-1] - -log.Printf("[DEBUG] Setting retrohunt to %s", retrohunt_id) - -res["retrohunt"] = retrohunt_id - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/compute_resource_policy_attachment.go.tmpl b/mmv1/templates/terraform/decoders/compute_resource_policy_attachment.go.tmpl new file mode 100644 index 000000000000..1bd1b89168bc --- /dev/null +++ b/mmv1/templates/terraform/decoders/compute_resource_policy_attachment.go.tmpl @@ -0,0 +1,2 @@ +res["name"] = tpgresource.GetResourceNameFromSelfLink(res["name"].(string)) +return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/memorystore_instance.go.tmpl b/mmv1/templates/terraform/decoders/memorystore_instance.go.tmpl index f686ea6f675f..96061ee6d183 100644 --- a/mmv1/templates/terraform/decoders/memorystore_instance.go.tmpl +++ b/mmv1/templates/terraform/decoders/memorystore_instance.go.tmpl @@ -1,9 +1,6 @@ // Retrieve pscAutoConnections from API response v, ok := res["pscAutoConnections"] if !ok { - if _, endpointsFound := res["endpoints"]; endpointsFound { - return res, nil // For Cluster Disabled instances, we would have 'endpoints' instead of 'pscAutoConnections' - } return nil, fmt.Errorf("pscAutoConnections field not found in API response") } diff --git a/mmv1/templates/terraform/encoders/access_context_manager_access_level_condition.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_access_level_condition.go.tmpl deleted file mode 100644 index abeba5770582..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_access_level_condition.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the access_level parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("access_level").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/access_context_manager_egress_policy.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_egress_policy.go.tmpl deleted file mode 100644 index c4c691de71f6..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_egress_policy.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the egress_policy_name parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("egress_policy_name").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/access_context_manager_ingress_policy.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_ingress_policy.go.tmpl deleted file mode 100644 index 23836e9683f4..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_ingress_policy.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the ingress_policy_name parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("ingress_policy_name").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl deleted file mode 100644 index be0f6aff7aef..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the perimeter parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("perimeter").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl deleted file mode 100644 index be0f6aff7aef..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the perimeter parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("perimeter").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_resource.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_resource.go.tmpl deleted file mode 100644 index 0e38e7e9dcc1..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_dry_run_resource.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the perimeter_name parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("perimeter_name").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_egress_policy.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_egress_policy.go.tmpl deleted file mode 100644 index be0f6aff7aef..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_egress_policy.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the perimeter parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("perimeter").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_ingress_policy.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_ingress_policy.go.tmpl deleted file mode 100644 index be0f6aff7aef..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_ingress_policy.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the perimeter parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("perimeter").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_resource.go.tmpl b/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_resource.go.tmpl deleted file mode 100644 index 0e38e7e9dcc1..000000000000 --- a/mmv1/templates/terraform/encoders/access_context_manager_service_perimeter_resource.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Set the access_policy_id field from part of the perimeter_name parameter. - -// The is logic is inside the encoder since the access_policy_id field is part of -// the mutex lock and encoders run before the lock is set. -parts := strings.Split(d.Get("perimeter_name").(string), "/") -d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/colab_runtime.go.tmpl b/mmv1/templates/terraform/encoders/colab_runtime.go.tmpl deleted file mode 100644 index 566d092f1745..000000000000 --- a/mmv1/templates/terraform/encoders/colab_runtime.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -{{/* - The license inside this block applies to this file - Copyright 2025 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. -*/ -}} - - newObj := make(map[string]interface{}) - newObj["notebookRuntimeTemplate"], _ = d.GetOk("notebook_runtime_template_ref.0.notebook_runtime_template") - - delete(obj, "notebookRuntimeTemplateRef") - - newObj["notebookRuntime"] = obj - return newObj, nil diff --git a/mmv1/templates/terraform/encoders/colab_schedule.go.tmpl b/mmv1/templates/terraform/encoders/colab_schedule.go.tmpl deleted file mode 100644 index e1e20d751442..000000000000 --- a/mmv1/templates/terraform/encoders/colab_schedule.go.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -config := meta.(*transport_tpg.Config) -project, err := tpgresource.GetProject(d, config) -if err != nil { - return nil, err -} - -location, err := tpgresource.GetRegion(d, config) -if err != nil { - return nil, err -} - -// createNotebookExecutionJobRequest does not exist in update requests -if obj["createNotebookExecutionJobRequest"] == nil { - return obj, nil -} - -jobRequest, ok := obj["createNotebookExecutionJobRequest"].(map[string]interface{}) -if !ok { - return nil, fmt.Errorf("createNotebookExecutionJobRequest is not of type map[string]interface{} or is nil") -} -jobRequest["parent"] = fmt.Sprintf("projects/%s/locations/%s", project, location) - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/compute_resource_policy_attachment.go.tmpl b/mmv1/templates/terraform/encoders/compute_resource_policy_attachment.go.tmpl new file mode 100644 index 000000000000..e364ba166c06 --- /dev/null +++ b/mmv1/templates/terraform/encoders/compute_resource_policy_attachment.go.tmpl @@ -0,0 +1,22 @@ +config := meta.(*transport_tpg.Config) +project, err := tpgresource.GetProject(d, config) +if err != nil { + return nil, err +} + +zone, err := tpgresource.GetZone(d, config) +if err != nil { + return nil, err +} +if zone == "" { + return nil, fmt.Errorf("zone required") +} + +region := tpgresource.GetRegionFromZone(zone) +if region == "" { + return nil, fmt.Errorf("invalid zone %q", zone) +} + +obj["resourcePolicies"] = []interface{}{fmt.Sprintf("projects/%s/regions/%s/resourcePolicies/%s", project, region, obj["name"])} +delete(obj, "name") +return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_egress_policy.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_egress_policy.tf.tmpl index cde42d28d7a0..e1860ca73e44 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_egress_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_egress_policy.tf.tmpl @@ -12,7 +12,6 @@ resource "google_access_context_manager_service_perimeter" "storage-perimeter" { resource "google_access_context_manager_service_perimeter_dry_run_egress_policy" "egress_policy" { perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" - title = "{{index $.Vars "egress_policy_title"}}" egress_from { identity_type = "ANY_IDENTITY" } diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_ingress_policy.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_ingress_policy.tf.tmpl index d9436428dd9e..aa5170bf275b 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_ingress_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_ingress_policy.tf.tmpl @@ -12,7 +12,6 @@ resource "google_access_context_manager_service_perimeter" "storage-perimeter" { resource "google_access_context_manager_service_perimeter_dry_run_ingress_policy" "ingress_policy" { perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" - title = "{{index $.Vars "ingress_policy_title"}}" ingress_from { identity_type = "any_identity" sources { diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_egress_policy.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_egress_policy.tf.tmpl index 73eb082693f2..5ac06bed0fa6 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_egress_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_egress_policy.tf.tmpl @@ -12,7 +12,6 @@ resource "google_access_context_manager_service_perimeter" "storage-perimeter" { resource "google_access_context_manager_service_perimeter_egress_policy" "egress_policy" { perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" - title = "{{index $.Vars "egress_policy_title"}}" egress_from { identity_type = "ANY_IDENTITY" } diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_ingress_policy.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_ingress_policy.tf.tmpl index e2fad59b337d..4f8ec8b25328 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_ingress_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_ingress_policy.tf.tmpl @@ -12,7 +12,6 @@ resource "google_access_context_manager_service_perimeter" "storage-perimeter" { resource "google_access_context_manager_service_perimeter_ingress_policy" "ingress_policy" { perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" - title = "{{index $.Vars "ingress_policy_title"}}" ingress_from { identity_type = "any_identity" sources { diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_endpoint_attachment_test.go b/mmv1/templates/terraform/examples/apigee_endpoint_attachment_basic_test.tf.tmpl similarity index 64% rename from mmv1/third_party/terraform/services/apigee/resource_apigee_endpoint_attachment_test.go rename to mmv1/templates/terraform/examples/apigee_endpoint_attachment_basic_test.tf.tmpl index cbd4daf82507..613a4a98606f 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_endpoint_attachment_test.go +++ b/mmv1/templates/terraform/examples/apigee_endpoint_attachment_basic_test.tf.tmpl @@ -1,54 +1,8 @@ -package apigee_test - -import ( - "fmt" - "strings" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -func TestAccApigeeEndpointAttachment_apigeeEndpointAttachmentBasicTestExample(t *testing.T) { - acctest.SkipIfVcr(t) - t.Parallel() - - context := map[string]interface{}{ - "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "org_id": envvar.GetTestOrgFromEnv(t), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckApigeeEndpointAttachmentDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccApigeeEndpointAttachment_apigeeEndpointAttachmentBasicTestExample(context), - }, - { - ResourceName: "google_apigee_endpoint_attachment.apigee_endpoint_attachment", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"endpoint_attachment_id", "org_id"}, - }, - }, - }) -} - -func testAccApigeeEndpointAttachment_apigeeEndpointAttachmentBasicTestExample(context map[string]interface{}) string { - return acctest.Nprintf(` resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "%{org_id}" - billing_account = "%{billing_account}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -160,7 +114,7 @@ resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { region = "us-west2" network = google_compute_network.psc_ilb_network.id - ip_cidr_range = "10.0.1.0/24" + ip_cidr_range = "10.0.0.0/16" project = google_project.project.project_id } @@ -171,7 +125,7 @@ resource "google_compute_subnetwork" "psc_ilb_nat" { network = google_compute_network.psc_ilb_network.id purpose = "PRIVATE_SERVICE_CONNECT" - ip_cidr_range = "10.0.1.0/24" + ip_cidr_range = "10.1.0.0/16" project = google_project.project.project_id } @@ -199,50 +153,10 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_endpoint_attachment" "apigee_endpoint_attachment" { +resource "google_apigee_endpoint_attachment" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id endpoint_attachment_id = "test1" location = "us-west2" service_attachment = google_compute_service_attachment.psc_ilb_service_attachment.id } -`, context) -} - -func testAccCheckApigeeEndpointAttachmentDestroyProducer(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_apigee_endpoint_attachment" { - continue - } - if strings.HasPrefix(name, "data.") { - continue - } - - config := acctest.GoogleProviderConfig(t) - - url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ApigeeBasePath}}{{org_id}}/endpointAttachments/{{endpoint_attachment_id}}") - 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("ApigeeEndpointAttachment still exists at %s", url) - } - } - - return nil - } -} diff --git a/mmv1/templates/terraform/examples/apigee_environment_basic_properties_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_basic_properties_test.tf.tmpl deleted file mode 100644 index 3b8e210c2c39..000000000000 --- a/mmv1/templates/terraform/examples/apigee_environment_basic_properties_test.tf.tmpl +++ /dev/null @@ -1,75 +0,0 @@ -resource "google_project" "project" { - project_id = "tf-test%{random_suffix}" - name = "tf-test%{random_suffix}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "time_sleep" "wait_60_seconds" { - create_duration = "60s" - depends_on = [google_project.project] -} - -resource "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" - depends_on = [time_sleep.wait_60_seconds] -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" - depends_on = [google_project_service.apigee] -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" - depends_on = [google_project_service.servicenetworking] -} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_global_address" "apigee_range" { - name = "apigee-range" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 16 - network = google_compute_network.apigee_network.id - project = google_project.project.project_id -} - -resource "google_service_networking_connection" "apigee_vpc_connection" { - network = google_compute_network.apigee_network.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.apigee_range.name] - depends_on = [google_project_service.servicenetworking] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_project_service.apigee, - ] -} - -resource "google_apigee_environment" "{{$.PrimaryResourceId}}" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test%{random_suffix}" - description = "Apigee Environment" - display_name = "environment-1" - properties { - property { - name = "property-1-key" - value = "property-1-value" - } - } -} diff --git a/mmv1/templates/terraform/examples/apihub_api_hub_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/apihub_api_hub_instance_basic.tf.tmpl deleted file mode 100644 index d869d057029d..000000000000 --- a/mmv1/templates/terraform/examples/apihub_api_hub_instance_basic.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_apihub_api_hub_instance" "{{$.PrimaryResourceId}}"{ - location = "us-central1" - config { - disable_search = true - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/apihub_api_hub_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/apihub_api_hub_instance_full.tf.tmpl deleted file mode 100644 index b464a4a97aae..000000000000 --- a/mmv1/templates/terraform/examples/apihub_api_hub_instance_full.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_apihub_api_hub_instance" "{{$.PrimaryResourceId}}"{ - project = "my-project" - api_hub_instance_id = "{{index $.Vars "instance_id"}}" - description = "Test API hub instance" - location = "us-central1" - config { - encryption_type = "CMEK" - cmek_key_name = "projects/my-project/locations/us-central1/keyRings/apihub/cryptoKeys/apihub-key" - disable_search = false - vertex_location = "us" - } - labels = { - environment = "dev" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_cleanup.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_cleanup.tf.tmpl index c06f01b28d80..8853964941e1 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_cleanup.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_cleanup.tf.tmpl @@ -4,28 +4,13 @@ resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { description = "{{index $.Vars "desc"}}" format = "DOCKER" cleanup_policy_dry_run = false - cleanup_policies { - id = "delete-untagged" - action = "DELETE" - condition { - tag_state = "UNTAGGED" - } - } - cleanup_policies { - id = "keep-new-untagged" - action = "KEEP" - condition { - tag_state = "UNTAGGED" - newer_than = "7d" - } - } cleanup_policies { id = "delete-prerelease" action = "DELETE" condition { tag_state = "TAGGED" tag_prefixes = ["alpha", "v0"] - older_than = "30d" + older_than = "2592000s" } } cleanup_policies { diff --git a/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.tmpl b/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.tmpl index 769fd3824e09..78b1e8b847e8 100644 --- a/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.tmpl +++ b/mmv1/templates/terraform/examples/base_configs/iam_test_file.go.tmpl @@ -32,7 +32,7 @@ import ( {{ $example := $.FirstTestExample }} func TestAcc{{ $.ResourceName }}IamBindingGenerated(t *testing.T) { t.Parallel() -{{ template "IamTestSetup" $ }} +{{ template "IamContext" $ }} acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -78,7 +78,7 @@ func TestAcc{{ $.ResourceName }}IamBindingGenerated(t *testing.T) { func TestAcc{{ $.ResourceName }}IamMemberGenerated(t *testing.T) { t.Parallel() -{{ template "IamTestSetup" $ }} +{{ template "IamContext" $ }} acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -116,7 +116,7 @@ func TestAcc{{ $.ResourceName }}IamPolicyGenerated(t *testing.T) { {{ if $.IamPolicy.AdminIamRole }} // This may skip test, so do it first sa := envvar.GetTestServiceAccountFromEnv(t) -{{- end }}{{ template "IamTestSetup" $ }} +{{- end }}{{ template "IamContext" $ }} {{- if $.IamPolicy.AdminIamRole }} context["service_account"] = sa {{- end }} @@ -165,7 +165,7 @@ func TestAcc{{ $.ResourceName }}IamPolicyGenerated(t *testing.T) { {{ if $.IamPolicy.IamConditionsRequestType }} func TestAcc{{ $.ResourceName }}IamBindingGenerated_withCondition(t *testing.T) { t.Parallel() -{{ template "IamTestSetup" $ }} +{{ template "IamContext" $ }} acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -201,7 +201,7 @@ func TestAcc{{ $.ResourceName }}IamBindingGenerated_withAndWithoutCondition(t *t // Multiple fine-grained resources acctest.SkipIfVcr(t) t.Parallel() -{{ template "IamTestSetup" $ }} +{{ template "IamContext" $ }} acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -248,7 +248,7 @@ func TestAcc{{ $.ResourceName }}IamBindingGenerated_withAndWithoutCondition(t *t func TestAcc{{ $.ResourceName }}IamMemberGenerated_withCondition(t *testing.T) { t.Parallel() -{{ template "IamTestSetup" $ }} +{{ template "IamContext" $ }} acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -284,7 +284,7 @@ func TestAcc{{ $.ResourceName }}IamMemberGenerated_withAndWithoutCondition(t *te // Multiple fine-grained resources acctest.SkipIfVcr(t) t.Parallel() -{{ template "IamTestSetup" $ }} +{{ template "IamContext" $ }} acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -334,7 +334,7 @@ func TestAcc{{ $.ResourceName }}IamPolicyGenerated_withCondition(t *testing.T) { // This may skip test, so do it first sa := envvar.GetTestServiceAccountFromEnv(t) {{- end }} -{{- template "IamTestSetup" $ }} +{{- template "IamContext" $ }} {{- if $.IamPolicy.AdminIamRole }} context["service_account"] = sa {{- end }} diff --git a/mmv1/templates/terraform/examples/base_configs/test_file.go.tmpl b/mmv1/templates/terraform/examples/base_configs/test_file.go.tmpl index f69a3f8d222a..197407eb4bcc 100644 --- a/mmv1/templates/terraform/examples/base_configs/test_file.go.tmpl +++ b/mmv1/templates/terraform/examples/base_configs/test_file.go.tmpl @@ -47,17 +47,6 @@ func TestAcc{{ $e.TestSlug $.Res.ProductMetadata.Name $.Res.Name }}(t *testing.T {{- end }} t.Parallel() - {{- if $e.BootstrapIam }} - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - {{- range $iam := $e.BootstrapIam }} - { - Member: "{{$iam.Member}}", - Role: "{{$iam.Role}}", - }, - {{- end}} - }) - {{- end }} - context := map[string]interface{}{ {{- template "EnvVarContext" dict "TestEnvVars" $e.TestEnvVars "HasNewLine" false}} {{- range $varKey, $varVal := $e.TestVarsOverrides }} diff --git a/mmv1/templates/terraform/examples/beyondcorp_security_gateway_application_basic.tf.tmpl b/mmv1/templates/terraform/examples/beyondcorp_security_gateway_application_basic.tf.tmpl deleted file mode 100644 index 264aadfd924d..000000000000 --- a/mmv1/templates/terraform/examples/beyondcorp_security_gateway_application_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_beyondcorp_security_gateway" "default" { - security_gateway_id = "{{index $.Vars "security_gateway_name"}}" - display_name = "My Security Gateway resource" - hubs { region = "us-central1" } -} - -resource "google_beyondcorp_application" "{{$.PrimaryResourceId}}" { - security_gateways_id = google_beyondcorp_security_gateway.default.security_gateway_id - application_id = "{{index $.Vars "application_name"}}" - endpoint_matchers { - hostname = "google.com" - } -} diff --git a/mmv1/templates/terraform/examples/beyondcorp_security_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/beyondcorp_security_gateway_basic.tf.tmpl index 66a12bfeb24b..e6e150b71e65 100644 --- a/mmv1/templates/terraform/examples/beyondcorp_security_gateway_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/beyondcorp_security_gateway_basic.tf.tmpl @@ -1,5 +1,6 @@ resource "google_beyondcorp_security_gateway" "{{$.PrimaryResourceId}}" { security_gateway_id = "{{index $.Vars "security_gateway_name"}}" + location = "global" display_name = "My Security Gateway resource" hubs { region = "us-central1" } } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_subscription_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_subscription_basic.tf.tmpl deleted file mode 100644 index 752b377818ea..000000000000 --- a/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_subscription_basic.tf.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -resource "google_bigquery_analytics_hub_data_exchange" "{{$.PrimaryResourceId}}" { - location = "US" - data_exchange_id = "{{index $.Vars "data_exchange_id"}}" - display_name = "{{index $.Vars "data_exchange_id"}}" - description = "{{index $.Vars "desc"}}" -} - -resource "google_bigquery_analytics_hub_listing" "{{$.PrimaryResourceId}}" { - location = "US" - data_exchange_id = google_bigquery_analytics_hub_data_exchange.{{$.PrimaryResourceId}}.data_exchange_id - listing_id = "{{index $.Vars "listing_id"}}" - display_name = "{{index $.Vars "listing_id"}}" - description = "{{index $.Vars "desc"}}" - - bigquery_dataset { - dataset = google_bigquery_dataset.{{$.PrimaryResourceId}}.id - } -} - -resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { - dataset_id = "{{index $.Vars "listing_id"}}" - friendly_name = "{{index $.Vars "listing_id"}}" - description = "{{index $.Vars "desc"}}" - location = "US" -} - -resource "google_bigquery_analytics_hub_listing_subscription" "{{$.PrimaryResourceId}}" { - location = "US" - data_exchange_id = google_bigquery_analytics_hub_data_exchange.{{$.PrimaryResourceId}}.data_exchange_id - listing_id = google_bigquery_analytics_hub_listing.{{$.PrimaryResourceId}}.listing_id - destination_dataset { - description = "A test subscription" - friendly_name = "👋" - labels = { - testing = "123" - } - location = "US" - dataset_reference { - dataset_id = "{{index $.Vars "destination_dataset_id"}}" - project_id = google_bigquery_dataset.{{$.PrimaryResourceId}}.project - } - } -} diff --git a/mmv1/templates/terraform/examples/bigquery_connection_sql_with_cmek.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_sql_with_cmek.tf.tmpl index 4434c211742b..0a2045a22af9 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_sql_with_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_sql_with_cmek.tf.tmpl @@ -21,6 +21,14 @@ resource "google_sql_user" "user" { password = "tf-test-my-password%{random_suffix}" } +data "google_bigquery_default_service_account" "bq_sa" {} + +resource "google_kms_crypto_key_iam_member" "key_sa_user" { + crypto_key_id = "{{index $.Vars "kms_key_name"}}" + role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" + member = "serviceAccount:${data.google_bigquery_default_service_account.bq_sa.email}" +} + resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { friendly_name = "👋" description = "a riveting description" @@ -35,5 +43,7 @@ resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { password = google_sql_user.user.password } } + + depends_on = [google_kms_crypto_key_iam_member.key_sa_user] } diff --git a/mmv1/templates/terraform/examples/chronicle_referencelist_basic.tf.tmpl b/mmv1/templates/terraform/examples/chronicle_referencelist_basic.tf.tmpl deleted file mode 100644 index 5899e5a34ca5..000000000000 --- a/mmv1/templates/terraform/examples/chronicle_referencelist_basic.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_chronicle_reference_list" "{{$.PrimaryResourceId}}" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - reference_list_id = "{{index $.Vars "reference_list_id"}}" - description = "referencelist-description" - entries { - value = "referencelist-entry-value" - } - syntax_type = "REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING" -} diff --git a/mmv1/templates/terraform/examples/chronicle_retrohunt_basic.tf.tmpl b/mmv1/templates/terraform/examples/chronicle_retrohunt_basic.tf.tmpl deleted file mode 100644 index cfcaf2ae27f8..000000000000 --- a/mmv1/templates/terraform/examples/chronicle_retrohunt_basic.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_chronicle_rule" "my-rule" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - deletion_policy = "FORCE" - text = <<-EOT - rule test_rule { meta: events: $userid = $e.principal.user.userid match: $userid over 10m condition: $e } - EOT -} - -resource "google_chronicle_retrohunt" "{{$.PrimaryResourceId}}" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - rule = element(split("/", resource.google_chronicle_rule.my-rule.name), length(split("/", resource.google_chronicle_rule.my-rule.name)) - 1) - process_interval { - start_time = "{{index $.Vars "start_time"}}" - end_time = "{{index $.Vars "end_time"}}" - } -} diff --git a/mmv1/templates/terraform/examples/chronicle_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/chronicle_rule_basic.tf.tmpl deleted file mode 100644 index 7814670c927f..000000000000 --- a/mmv1/templates/terraform/examples/chronicle_rule_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_chronicle_rule" "{{$.PrimaryResourceId}}" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - deletion_policy = "DEFAULT" - text = <<-EOT - rule test_rule { meta: events: $userid = $e.principal.user.userid match: $userid over 10m condition: $e } - EOT -} diff --git a/mmv1/templates/terraform/examples/chronicle_rule_with_data_access_scope.tf.tmpl b/mmv1/templates/terraform/examples/chronicle_rule_with_data_access_scope.tf.tmpl deleted file mode 100644 index a42966e76357..000000000000 --- a/mmv1/templates/terraform/examples/chronicle_rule_with_data_access_scope.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_chronicle_data_access_scope" "data_access_scope_test" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - data_access_scope_id = "{{index $.Vars "data_access_scope_id"}}" - description = "scope-description" - allowed_data_access_labels { - log_type = "GCP_CLOUDAUDIT" - } -} - -resource "google_chronicle_rule" "{{$.PrimaryResourceId}}" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - scope = resource.google_chronicle_data_access_scope.data_access_scope_test.name - text = <<-EOT - rule test_rule { meta: events: $userid = $e.principal.user.userid match: $userid over 10m condition: $e } - EOT -} diff --git a/mmv1/templates/terraform/examples/chronicle_rule_with_force_deletion.tf.tmpl b/mmv1/templates/terraform/examples/chronicle_rule_with_force_deletion.tf.tmpl deleted file mode 100644 index 48561deec81d..000000000000 --- a/mmv1/templates/terraform/examples/chronicle_rule_with_force_deletion.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_chronicle_rule" "{{$.PrimaryResourceId}}" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - deletion_policy = "FORCE" - text = <<-EOT - rule test_rule { meta: events: $userid = $e.principal.user.userid match: $userid over 10m condition: $e } - EOT -} diff --git a/mmv1/templates/terraform/examples/chronicle_ruledeployment_basic.tf.tmpl b/mmv1/templates/terraform/examples/chronicle_ruledeployment_basic.tf.tmpl deleted file mode 100644 index 26e6a2e4dd93..000000000000 --- a/mmv1/templates/terraform/examples/chronicle_ruledeployment_basic.tf.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -resource "google_chronicle_rule" "my-rule" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - text = <<-EOT - rule test_rule { meta: events: $userid = $e.principal.user.userid match: $userid over 10m condition: $e } - EOT -} - -resource "google_chronicle_rule_deployment" "{{$.PrimaryResourceId}}" { - provider = "google-beta" - location = "us" - instance = "{{index $.TestEnvVars "chronicle_id"}}" - rule = element(split("/", resource.google_chronicle_rule.my-rule.name), length(split("/", resource.google_chronicle_rule.my-rule.name)) - 1) - enabled = true - alerting = true - archived = false - run_frequency = "DAILY" -} diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_function.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_function.tf.tmpl deleted file mode 100644 index 2792a67004a4..000000000000 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_function.tf.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "cloud_run_service_name"}}" - location = "us-central1" - deletion_protection = false - ingress = "INGRESS_TRAFFIC_ALL" - - template { - containers { - image = "us-docker.pkg.dev/cloudrun/container/hello" - base_image_uri = "us-central1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/nodejs22" - } - } - build_config { - source_location = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - function_target = "helloHttp" - image_uri = "us-docker.pkg.dev/cloudrun/container/hello" - base_image = "us-central1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/nodejs22" - enable_automatic_updates = true - worker_pool = "worker-pool" - environment_variables = { - FOO_KEY = "FOO_VALUE" - BAR_KEY = "BAR_VALUE" - } - service_account = google_service_account.cloudbuild_service_account.id - } - depends_on = [ - google_project_iam_member.act_as, - google_project_iam_member.logs_writer - ] -} - -data "google_project" "project" { -} - -resource "google_storage_bucket" "bucket" { - name = "${data.google_project.project.project_id}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique - location = "US" - uniform_bucket_level_access = true -} - -resource "google_storage_bucket_object" "object" { - name = "function-source.zip" - bucket = google_storage_bucket.bucket.name - source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code -} - -resource "google_service_account" "cloudbuild_service_account" { - account_id = "{{index $.Vars "sa_name"}}" -} - -resource "google_project_iam_member" "act_as" { - project = data.google_project.project.project_id - role = "roles/iam.serviceAccountUser" - member = "serviceAccount:${google_service_account.cloudbuild_service_account.email}" -} - -resource "google_project_iam_member" "logs_writer" { - project = data.google_project.project.project_id - role = "roles/logging.logWriter" - member = "serviceAccount:${google_service_account.cloudbuild_service_account.email}" -} diff --git a/mmv1/templates/terraform/examples/colab_notebook_execution_basic.tf.tmpl b/mmv1/templates/terraform/examples/colab_notebook_execution_basic.tf.tmpl deleted file mode 100644 index 8453c0f82a2b..000000000000 --- a/mmv1/templates/terraform/examples/colab_notebook_execution_basic.tf.tmpl +++ /dev/null @@ -1,77 +0,0 @@ -resource "google_colab_runtime_template" "my_runtime_template" { - name = "{{index $.Vars "runtime_template_name"}}" - display_name = "Runtime template" - location = "us-central1" - - machine_spec { - machine_type = "e2-standard-4" - } - - network_spec { - enable_internet_access = true - } -} - -resource "google_storage_bucket" "output_bucket" { - name = "{{index $.Vars "bucket"}}" - location = "US" - force_destroy = true - uniform_bucket_level_access = true -} - -resource "google_colab_notebook_execution" "{{$.PrimaryResourceId}}" { - display_name = "Notebook execution basic" - location = "us-central1" - - direct_notebook_source { - content = base64encode(< /proc/sys/net/ipv4/ip_forward -md_url_prefix="http://169.254.169.254/computeMetadata/v1/instance" -vm_nic_ip="$(curl -H "Metadata-Flavor: Google" $${md_url_prefix}/network-interfaces/0/ip)" -iptables -t nat -F -iptables -t nat -A PREROUTING \ - -p tcp --dport $DB_PORT \ - -j DNAT \ - --to-destination $DB_ADDR -iptables -t nat -A POSTROUTING \ - -p tcp --dport $DB_PORT \ - -j SNAT \ - --to-source $vm_nic_ip -iptables-save -EOT -} - -resource "google_compute_firewall" "rules" { - name = "{{index $.Vars "ingress_firewall_name"}}" - network = google_datastream_private_connection.private_connection.vpc_peering_config.0.vpc - description = "Allow traffic into NAT VM" - direction = "INGRESS" - - allow { - protocol = "tcp" - ports = ["5432"] - } - - source_ranges = [google_datastream_private_connection.private_connection.vpc_peering_config.0.subnet] -} - resource "google_datastream_connection_profile" "{{$.PrimaryResourceId}}" { - display_name = "Connection profile" - location = "us-central1" - connection_profile_id = "{{index $.Vars "connection_profile_id"}}" - - postgresql_profile { - hostname = google_compute_instance.nat_vm.network_interface.0.network_ip - username = google_sql_user.user.name - password = google_sql_user.user.password - database = google_sql_database.db.name - port = 5432 - } - - private_connectivity { - private_connection = google_datastream_private_connection.private_connection.id - } + display_name = "Connection profile" + location = "us-central1" + connection_profile_id = "{{index $.Vars "connection_profile_id"}}" + + postgresql_profile { + hostname = google_sql_database_instance.instance.public_ip_address + username = google_sql_user.user.name + password = google_sql_user.user.password + database = google_sql_database.db.name + } + + private_connectivity { + private_connection = google_datastream_private_connection.private_connection.id + } } diff --git a/mmv1/templates/terraform/examples/discoveryengine_datastore_advanced_site_search_config.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_datastore_advanced_site_search_config.tf.tmpl deleted file mode 100644 index 8b3715bc2e21..000000000000 --- a/mmv1/templates/terraform/examples/discoveryengine_datastore_advanced_site_search_config.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_discovery_engine_data_store" "advanced_site_search_config" { - location = "global" - data_store_id = "{{index $.Vars "data_store_id"}}" - display_name = "tf-test-advanced-site-search-config-datastore" - industry_vertical = "GENERIC" - content_config = "PUBLIC_WEBSITE" - solution_types = ["SOLUTION_TYPE_CHAT"] - create_advanced_site_search = true - skip_default_schema_creation = false - - advanced_site_search_config { - disable_initial_index = true - disable_automatic_refresh = true - } -} diff --git a/mmv1/templates/terraform/examples/eventarc_trigger_with_channel_cmek.tf.tmpl b/mmv1/templates/terraform/examples/eventarc_trigger_with_channel_cmek.tf.tmpl deleted file mode 100644 index 9b1233036e25..000000000000 --- a/mmv1/templates/terraform/examples/eventarc_trigger_with_channel_cmek.tf.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -resource "google_kms_crypto_key_iam_member" "key_member" { - crypto_key_id = "{{index $.Vars "key_name"}}" - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:service-{{index $.TestEnvVars "project_number"}}@gcp-sa-eventarc.iam.gserviceaccount.com" -} - -resource "google_eventarc_channel" "test_channel" { - location = "us-central1" - name = "{{index $.Vars "channel_name"}}" - crypto_key_name = "{{index $.Vars "key_name"}}" - third_party_provider = "projects/{{index $.TestEnvVars "project_id"}}/locations/us-central1/providers/datadog" - depends_on = [google_kms_crypto_key_iam_member.key_member] -} - -resource "google_cloud_run_service" "default" { - name = "{{index $.Vars "service_name"}}" - location = "us-central1" - - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - - traffic { - percent = 100 - latest_revision = true - } -} - -resource "google_eventarc_trigger" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "trigger_name"}}" - location = "us-central1" - matching_criteria { - attribute = "type" - value = "datadog.v1.alert" - } - destination { - cloud_run_service { - service = google_cloud_run_service.default.name - region = "us-central1" - } - } - service_account = "{{index $.TestEnvVars "service_account"}}" - channel = google_eventarc_channel.test_channel.id -} diff --git a/mmv1/templates/terraform/examples/eventarc_trigger_with_cloud_run_destination.tf.tmpl b/mmv1/templates/terraform/examples/eventarc_trigger_with_cloud_run_destination.tf.tmpl deleted file mode 100644 index 5b895eebc9df..000000000000 --- a/mmv1/templates/terraform/examples/eventarc_trigger_with_cloud_run_destination.tf.tmpl +++ /dev/null @@ -1,49 +0,0 @@ -resource "google_eventarc_trigger" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "trigger_name"}}" - location = "us-central1" - matching_criteria { - attribute = "type" - value = "google.cloud.pubsub.topic.v1.messagePublished" - } - destination { - cloud_run_service { - service = google_cloud_run_service.default.name - region = "us-central1" - } - } - labels = { - foo = "bar" - } - transport { - pubsub { - topic = google_pubsub_topic.foo.id - } - } -} - -resource "google_pubsub_topic" "foo" { - name = "{{index $.Vars "topic_name"}}" -} - -resource "google_cloud_run_service" "default" { - name = "{{index $.Vars "service_name"}}" - location = "us-central1" - - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - - traffic { - percent = 100 - latest_revision = true - } -} diff --git a/mmv1/templates/terraform/examples/eventarc_trigger_with_http_destination.tf.tmpl b/mmv1/templates/terraform/examples/eventarc_trigger_with_http_destination.tf.tmpl deleted file mode 100644 index dbb2a5a51e6a..000000000000 --- a/mmv1/templates/terraform/examples/eventarc_trigger_with_http_destination.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_eventarc_trigger" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "trigger_name"}}" - location = "us-central1" - matching_criteria { - attribute = "type" - value = "google.cloud.pubsub.topic.v1.messagePublished" - } - destination { - http_endpoint { - uri = "http://10.77.0.0:80/route" - } - network_config { - network_attachment = "projects/{{index $.TestEnvVars "project_id"}}/regions/us-central1/networkAttachments/{{index $.Vars "network_attachment_name"}}" - } - } - service_account = "{{index $.TestEnvVars "service_account"}}" -} diff --git a/mmv1/templates/terraform/examples/eventarc_trigger_with_path_pattern_filter.tf.tmpl b/mmv1/templates/terraform/examples/eventarc_trigger_with_path_pattern_filter.tf.tmpl deleted file mode 100644 index 2ced56b34e05..000000000000 --- a/mmv1/templates/terraform/examples/eventarc_trigger_with_path_pattern_filter.tf.tmpl +++ /dev/null @@ -1,58 +0,0 @@ -resource "google_eventarc_trigger" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "trigger_name"}}" - location = "us-central1" - matching_criteria { - attribute = "type" - value = "google.cloud.eventarc.trigger.v1.created" - } - matching_criteria { - attribute = "trigger" - operator = "match-path-pattern" - value = "trigger-with-wildcard-*" - } - destination { - cloud_run_service { - service = google_cloud_run_service.default.name - region = "us-central1" - } - } - labels = { - foo = "bar" - } - event_data_content_type = "application/protobuf" - service_account = google_service_account.trigger_service_account.email - depends_on = [google_project_iam_member.event_receiver] -} - -resource "google_service_account" "trigger_service_account" { - account_id = "{{index $.Vars "service_account_id"}}" -} - -resource "google_project_iam_member" "event_receiver" { - project = google_service_account.trigger_service_account.project - role = "roles/eventarc.eventReceiver" - member = "serviceAccount:${google_service_account.trigger_service_account.email}" -} - -resource "google_cloud_run_service" "default" { - name = "{{index $.Vars "service_name"}}" - location = "us-central1" - - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - - traffic { - percent = 100 - latest_revision = true - } -} diff --git a/mmv1/templates/terraform/examples/eventarc_trigger_with_workflow_destination.tf.tmpl b/mmv1/templates/terraform/examples/eventarc_trigger_with_workflow_destination.tf.tmpl deleted file mode 100644 index 926e149f8fdd..000000000000 --- a/mmv1/templates/terraform/examples/eventarc_trigger_with_workflow_destination.tf.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -resource "google_eventarc_trigger" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "trigger_name"}}" - location = "us-central1" - matching_criteria { - attribute = "type" - value = "google.cloud.pubsub.topic.v1.messagePublished" - } - destination { - workflow = google_workflows_workflow.workflow.id - } - service_account = "{{index $.TestEnvVars "service_account"}}" -} - -resource "google_workflows_workflow" "workflow" { - name = "{{index $.Vars "workflow_name"}}" - deletion_protection = false - region = "us-central1" - source_contents = <<-EOF - # This is a sample workflow, feel free to replace it with your source code - # - # This workflow does the following: - # - reads current time and date information from an external API and stores - # the response in CurrentDateTime variable - # - retrieves a list of Wikipedia articles related to the day of the week - # from CurrentDateTime - # - returns the list of articles as an output of the workflow - # FYI, In terraform you need to escape the $$ or it will cause errors. - - - getCurrentTime: - call: http.get - args: - url: $${sys.get_env("url")} - result: CurrentDateTime - - readWikipedia: - call: http.get - args: - url: https://en.wikipedia.org/w/api.php - query: - action: opensearch - search: $${CurrentDateTime.body.dayOfTheWeek} - result: WikiResult - - returnOutput: - return: $${WikiResult.body[1]} -EOF -} diff --git a/mmv1/templates/terraform/examples/firebasedataconnect_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebasedataconnect_service_basic.tf.tmpl deleted file mode 100644 index 6b1e2188dc08..000000000000 --- a/mmv1/templates/terraform/examples/firebasedataconnect_service_basic.tf.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -# Enable Firebase Data Connect API -resource "google_project_service" "fdc" { - project = "{{index $.TestEnvVars "project_id"}}" - service = "firebasedataconnect.googleapis.com" - disable_on_destroy = false -} - -# Create an FDC service -resource "google_firebase_data_connect_service" "default" { - project = "{{index $.TestEnvVars "project_id"}}" - location = "us-central1" - service_id = "{{index $.Vars "service_id"}}" - deletion_policy = "DEFAULT" - - labels = { - label = "my-label" - } - - annotations = { - key1 = "value1", - key2 = "value2", - } - - depends_on = [google_project_service.fdc] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/firestore_field_wildcard.tf.tmpl b/mmv1/templates/terraform/examples/firestore_field_wildcard.tf.tmpl deleted file mode 100644 index d4449750dd5c..000000000000 --- a/mmv1/templates/terraform/examples/firestore_field_wildcard.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_firestore_database" "database" { - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "database_id"}}" - location_id = "nam5" - type = "FIRESTORE_NATIVE" - - delete_protection_state = "{{index $.Vars "delete_protection_state"}}" - deletion_policy = "DELETE" - } - - resource "google_firestore_field" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - database = google_firestore_database.database.name - collection = "chatrooms_%{random_suffix}" - field = "*" - - index_config { - indexes { - order = "ASCENDING" - query_scope = "COLLECTION_GROUP" - } - indexes { - array_config = "CONTAINS" - } - } - } diff --git a/mmv1/templates/terraform/examples/firewall_policy.tf.tmpl b/mmv1/templates/terraform/examples/firewall_policy.tf.tmpl deleted file mode 100644 index b8eb2027adcd..000000000000 --- a/mmv1/templates/terraform/examples/firewall_policy.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_compute_firewall_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - short_name = "{{index $.Vars "policy_name"}}" - description = "Example Resource" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/firewall_policy_rule.tf.tmpl b/mmv1/templates/terraform/examples/firewall_policy_rule.tf.tmpl index 05332291a1fd..5a8b09187625 100644 --- a/mmv1/templates/terraform/examples/firewall_policy_rule.tf.tmpl +++ b/mmv1/templates/terraform/examples/firewall_policy_rule.tf.tmpl @@ -1,5 +1,5 @@ resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { - name = "{{index $.Vars "address_group"}}" + name = "{{index $.Vars "address"}}" parent = "organizations/{{index $.TestEnvVars "org_id"}}" description = "Sample global networksecurity_address_group" location = "global" @@ -21,31 +21,29 @@ resource "google_compute_firewall_policy" "default" { } resource "google_compute_firewall_policy_rule" "{{$.PrimaryResourceId}}" { - firewall_policy = google_compute_firewall_policy.default.name - description = "Resource created for Terraform acceptance testing" - priority = 9000 - enable_logging = true - action = "allow" - direction = "EGRESS" - disabled = false - target_service_accounts = ["{{index $.TestEnvVars "service_acct"}}"] + firewall_policy = google_compute_firewall_policy.default.name + description = "Resource created for Terraform acceptance testing" + priority = 9000 + enable_logging = true + action = "allow" + direction = "EGRESS" + disabled = false match { - dest_ip_ranges = ["11.100.0.1/32"] - dest_fqdns = [] - dest_region_codes = ["US"] - dest_threat_intelligences = ["iplist-known-malicious-ips"] - src_address_groups = [] - dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] - layer4_configs { ip_protocol = "tcp" - ports = [8080] + ports = [8080] } - layer4_configs { ip_protocol = "udp" - ports = [22] + ports = [22] } + dest_ip_ranges = ["11.100.0.1/32"] + dest_fqdns = [] + dest_region_codes = ["US"] + dest_threat_intelligences = ["iplist-known-malicious-ips"] + src_address_groups = [] + dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] } + target_service_accounts = ["{{index $.TestEnvVars "service_account"}}"] } diff --git a/mmv1/templates/terraform/examples/firewall_policy_rule_network_scope.tf.tmpl b/mmv1/templates/terraform/examples/firewall_policy_rule_network_scope.tf.tmpl deleted file mode 100644 index 2ddbd9f396b1..000000000000 --- a/mmv1/templates/terraform/examples/firewall_policy_rule_network_scope.tf.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -resource "google_folder" "folder" { - provider = google-beta - display_name = "{{index $.Vars "folder"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - deletion_protection = false -} - -resource "google_compute_firewall_policy" "default" { - provider = google-beta - parent = google_folder.folder.id - short_name = "{{index $.Vars "fw_policy"}}" - description = "Firewall policy" -} - -resource "google_compute_firewall_policy_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - firewall_policy = google_compute_firewall_policy.default.name - description = "Firewall policy rule with network scope" - priority = 9000 - action = "allow" - direction = "INGRESS" - disabled = false - - match { - src_ip_ranges = ["11.100.0.1/32"] - src_network_scope = "VPC_NETWORKS" - src_networks = [google_compute_network.network.id] - - layer4_configs { - ip_protocol = "tcp" - ports = [8080] - } - - layer4_configs { - ip_protocol = "udp" - ports = [22] - } - } -} - -resource "google_compute_network" "network" { - provider = google-beta - name = "{{index $.Vars "network"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/forwarding_rule_externallb_byoipv6.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_externallb_byoipv6.tf.tmpl deleted file mode 100644 index e0e63c13bb31..000000000000 --- a/mmv1/templates/terraform/examples/forwarding_rule_externallb_byoipv6.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -// Forwarding rule for External Network Load Balancing using Backend Services with IP Collection - -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - port_range = 80 - ip_protocol = "TCP" - ip_version = "IPV6" - load_balancing_scheme = "EXTERNAL" - ip_address = "{{index $.Vars "ip_address"}}" - network_tier = "PREMIUM" - backend_service = google_compute_region_backend_service.backend.id - ip_collection = "{{index $.Vars "ip_collection_url"}}" -} - -resource "google_compute_region_backend_service" "backend" { - name = "{{index $.Vars "backend_name"}}" - region = "us-central1" - load_balancing_scheme = "EXTERNAL" - health_checks = [google_compute_region_health_check.hc.id] -} - -resource "google_compute_region_health_check" "hc" { - name = "{{index $.Vars "backend_name"}}" - check_interval_sec = 1 - timeout_sec = 1 - region = "us-central1" - - tcp_health_check { - port = "80" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/gemini_code_repository_index_basic.tf.tmpl b/mmv1/templates/terraform/examples/gemini_code_repository_index_basic.tf.tmpl index 1ae5623fda72..27e8fa4f41e9 100644 --- a/mmv1/templates/terraform/examples/gemini_code_repository_index_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gemini_code_repository_index_basic.tf.tmpl @@ -1,5 +1,6 @@ resource "google_gemini_code_repository_index" "example" { + provider = google-beta location = "us-central1" - code_repository_index_id = "code-repository-index-example" + code_repository_index_id = "{{index $.Vars "cri_id"}}" kms_key = "projects/projectExample/locations/locationExample/keyRings/keyRingExample/cryptoKeys/cryptoKeyExample" } diff --git a/mmv1/templates/terraform/examples/gemini_data_sharing_with_google_setting_basic.tf.tmpl b/mmv1/templates/terraform/examples/gemini_data_sharing_with_google_setting_basic.tf.tmpl deleted file mode 100644 index babec9832d96..000000000000 --- a/mmv1/templates/terraform/examples/gemini_data_sharing_with_google_setting_basic.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_gemini_data_sharing_with_google_setting" "{{$.PrimaryResourceId}}" { - provider = google-beta - data_sharing_with_google_setting_id = "{{index $.Vars "data_sharing_with_google_setting_id"}}" - location = "global" - enable_preview_data_sharing = true -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/gemini_gemini_gcp_enablement_setting_basic.tf.tmpl b/mmv1/templates/terraform/examples/gemini_gemini_gcp_enablement_setting_basic.tf.tmpl deleted file mode 100644 index 72d9f80e5171..000000000000 --- a/mmv1/templates/terraform/examples/gemini_gemini_gcp_enablement_setting_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_gemini_gemini_gcp_enablement_setting" "{{$.PrimaryResourceId}}" { - gemini_gcp_enablement_setting_id = "{{index $.Vars "gemini_gcp_enablement_setting_id"}}" - location = "global" - enable_customer_data_sharing = true -} diff --git a/mmv1/templates/terraform/examples/gemini_logging_setting_basic.tf.tmpl b/mmv1/templates/terraform/examples/gemini_logging_setting_basic.tf.tmpl deleted file mode 100644 index bf33756e6d82..000000000000 --- a/mmv1/templates/terraform/examples/gemini_logging_setting_basic.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_gemini_logging_setting" "{{$.PrimaryResourceId}}" { - provider = google-beta - logging_setting_id = "{{index $.Vars "logging_setting_id"}}" - location = "global" - labels = {"my_key": "my_value"} - log_prompts_and_responses = true - log_metadata = true -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/gemini_logging_setting_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/gemini_logging_setting_binding_basic.tf.tmpl deleted file mode 100644 index 3081c6c528b0..000000000000 --- a/mmv1/templates/terraform/examples/gemini_logging_setting_binding_basic.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_gemini_logging_setting" "basic" { - provider = google-beta - logging_setting_id = "{{index $.Vars "logging_setting_id"}}" - location = "global" - labels = {"my_key": "my_value"} - log_prompts_and_responses = true -} - -resource "google_gemini_logging_setting_binding" "{{$.PrimaryResourceId}}" { - provider = google-beta - logging_setting_id = google_gemini_logging_setting.basic.logging_setting_id - setting_binding_id = "{{index $.Vars "setting_binding_id"}}" - location = "global" - target = "{{index $.Vars "target"}}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/gemini_release_channel_setting_basic.tf.tmpl b/mmv1/templates/terraform/examples/gemini_release_channel_setting_basic.tf.tmpl deleted file mode 100644 index e76be34c310c..000000000000 --- a/mmv1/templates/terraform/examples/gemini_release_channel_setting_basic.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_gemini_release_channel_setting" "{{$.PrimaryResourceId}}" { - provider = google-beta - release_channel_setting_id = "{{index $.Vars "release_channel_setting_id"}}" - location = "global" - labels = {"my_key": "my_value"} - release_channel = "EXPERIMENTAL" -} diff --git a/mmv1/templates/terraform/examples/gemini_release_channel_setting_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/gemini_release_channel_setting_binding_basic.tf.tmpl deleted file mode 100644 index f6ece2150b97..000000000000 --- a/mmv1/templates/terraform/examples/gemini_release_channel_setting_binding_basic.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_gemini_release_channel_setting" "basic" { - provider = google-beta - release_channel_setting_id = "{{index $.Vars "release_channel_setting_id"}}" - location = "global" - labels = {"my_key": "my_value"} - release_channel = "EXPERIMENTAL" -} - -resource "google_gemini_release_channel_setting_binding" "{{$.PrimaryResourceId}}" { - provider = google-beta - release_channel_setting_id = google_gemini_release_channel_setting.basic.release_channel_setting_id - setting_binding_id = "{{index $.Vars "setting_binding_id"}}" - location = "global" - target = "{{index $.Vars "target"}}" -} diff --git a/mmv1/templates/terraform/examples/gemini_repository_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/gemini_repository_group_basic.tf.tmpl index 242d868374ab..b5a043658356 100644 --- a/mmv1/templates/terraform/examples/gemini_repository_group_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gemini_repository_group_basic.tf.tmpl @@ -1,6 +1,7 @@ resource "google_gemini_repository_group" "example" { + provider = google-beta location = "us-central1" - code_repository_index = "example-cri" + code_repository_index = "%{cri_id}" repository_group_id = "{{index $.Vars "repository_group_id"}}" repositories { resource = "{{index $.Vars "repository_resource"}}" diff --git a/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl index 62ae72ec7fda..7c5efe0534d6 100644 --- a/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl +++ b/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl @@ -3,9 +3,6 @@ resource "google_compute_ha_vpn_gateway" "ha_gateway1" { name = "{{index $.Vars "ha_vpn_gateway1_name"}}" network = google_compute_network.network1.id stack_type = "IPV4_IPV6" - labels = { - mykey = "myvalue" - } } resource "google_compute_network" "network1" { diff --git a/mmv1/templates/terraform/examples/instance_template_basic.tf.tmpl b/mmv1/templates/terraform/examples/instance_template_basic.tf.tmpl deleted file mode 100644 index e1ff42773207..000000000000 --- a/mmv1/templates/terraform/examples/instance_template_basic.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_compute_instance_template" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - machine_type = "e2-medium" - - disk { - source_image = "debian-cloud/debian-11" - } - - network_interface { - network = "default" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/interconnect_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/interconnect_attachment_basic.tf.tmpl index 193d577ca810..fe85a23bc329 100644 --- a/mmv1/templates/terraform/examples/interconnect_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/interconnect_attachment_basic.tf.tmpl @@ -4,7 +4,6 @@ resource "google_compute_interconnect_attachment" "{{$.PrimaryResourceId}}" { type = "PARTNER" router = google_compute_router.foobar.id mtu = 1500 - labels = { mykey = "myvalue" } } resource "google_compute_router" "foobar" { diff --git a/mmv1/templates/terraform/examples/interconnect_attachment_dedicated.tf.tmpl b/mmv1/templates/terraform/examples/interconnect_attachment_dedicated.tf.tmpl index df7d6d2941ca..b30e6bcab8ba 100644 --- a/mmv1/templates/terraform/examples/interconnect_attachment_dedicated.tf.tmpl +++ b/mmv1/templates/terraform/examples/interconnect_attachment_dedicated.tf.tmpl @@ -6,7 +6,7 @@ resource "google_compute_interconnect" "foobar" { interconnect_type = "DEDICATED" link_type = "LINK_TYPE_ETHERNET_10G_LR" requested_link_count = 1 - location = "https://www.googleapis.com/compute/v1/projects/${data.google_project.project.name}/global/interconnectLocations/z2z-us-east4-zone1-nciadf-a" # Special location only available for Google testing. + location = "https://www.googleapis.com/compute/v1/projects/${data.google_project.project.name}/global/interconnectLocations/z2z-us-east4-zone1-lciadl-a" # Special location only available for Google testing. } resource "google_compute_interconnect_attachment" "{{$.PrimaryResourceId}}" { @@ -19,7 +19,6 @@ resource "google_compute_interconnect_attachment" "{{$.PrimaryResourceId}}" { vlan_tag8021q = 1000 region = "https://www.googleapis.com/compute/v1/projects/${data.google_project.project.name}/regions/us-east4" stack_type = "IPV4_ONLY" - labels = { mykey = "myvalue" } } resource "google_compute_router" "foobar" { diff --git a/mmv1/templates/terraform/examples/memorystore_instance_standalone_full.tf.tmpl b/mmv1/templates/terraform/examples/memorystore_instance_standalone_full.tf.tmpl index 8c5b5853e982..79d63e6c990f 100644 --- a/mmv1/templates/terraform/examples/memorystore_instance_standalone_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/memorystore_instance_standalone_full.tf.tmpl @@ -20,7 +20,7 @@ resource "google_memorystore_instance" "{{$.PrimaryResourceId}}" { } engine_version = "VALKEY_7_2" deletion_protection_enabled = false - mode = "CLUSTER_DISABLED" + mode = "STANDALONE" persistence_config { mode = "RDB" rdb_config { diff --git a/mmv1/templates/terraform/examples/netapp_volume_quota_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/netapp_volume_quota_rule_basic.tf.tmpl deleted file mode 100644 index 119b89dcd642..000000000000 --- a/mmv1/templates/terraform/examples/netapp_volume_quota_rule_basic.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_netapp_storage_pool" "default" { - name = "{{index $.Vars "pool_name"}}" - location = "us-west2" - service_level = "PREMIUM" - capacity_gib = 2048 - network = data.google_compute_network.default.id -} - -resource "google_netapp_volume" "default" { - location = google_netapp_storage_pool.default.location - name = "{{index $.Vars "volume_name"}}" - capacity_gib = 100 - share_name = "{{index $.Vars "volume_name"}}" - storage_pool = google_netapp_storage_pool.default.name - protocols = ["NFSV3"] -} - -resource "google_netapp_volume_quota_rule" "{{$.PrimaryResourceId}}" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - type = "DEFAULT_USER_QUOTA" - disk_limit_mib = 50 - name = "{{index $.Vars "quota_rule_name"}}" -} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode.tf.tmpl b/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode.tf.tmpl index 82fbd48493eb..d6ee72505e90 100644 --- a/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode.tf.tmpl @@ -1,4 +1,5 @@ resource "google_compute_network" "{{$.PrimaryResourceId}}" { + provider = google-beta project = "{{index $.TestEnvVars "project"}}" name = "{{index $.Vars "network_name"}}" routing_mode = "GLOBAL" diff --git a/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode_standard.tf.tmpl b/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode_standard.tf.tmpl index 94dde1154519..73b44219ef03 100644 --- a/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode_standard.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode_standard.tf.tmpl @@ -1,4 +1,5 @@ resource "google_compute_network" "{{$.PrimaryResourceId}}" { + provider = google-beta project = "{{index $.TestEnvVars "project"}}" name = "{{index $.Vars "network_name"}}" routing_mode = "GLOBAL" diff --git a/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode_standard_custom_fields.tf.tmpl b/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode_standard_custom_fields.tf.tmpl index 46ff2630c8c3..87810b6169b0 100644 --- a/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode_standard_custom_fields.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_bgp_best_path_selection_mode_standard_custom_fields.tf.tmpl @@ -1,4 +1,5 @@ resource "google_compute_network" "{{$.PrimaryResourceId}}" { + provider = google-beta project = "{{index $.TestEnvVars "project"}}" name = "{{index $.Vars "network_name"}}" routing_mode = "GLOBAL" diff --git a/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_ipv6_support.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_ipv6_support.tf.tmpl deleted file mode 100644 index 786c10ea96c9..000000000000 --- a/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_ipv6_support.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_compute_network" "network" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_network_connectivity_hub" "basic_hub" { - name = "{{index $.Vars "hub_name"}}" - description = "A sample hub" - labels = { - label-two = "value-one" - } -} - -resource "google_network_connectivity_spoke" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "spoke_name"}}" - location = "global" - description = "A sample spoke with a linked VPC that include export ranges of all IPv6" - labels = { - label-one = "value-one" - } - hub = google_network_connectivity_hub.basic_hub.id - linked_vpc_network { - include_export_ranges = [ - "ALL_IPV6_RANGES", - "ALL_PRIVATE_IPV4_RANGES" - ] - uri = google_compute_network.network.self_link - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/network_firewall_policy_rule.tf.tmpl b/mmv1/templates/terraform/examples/network_firewall_policy_rule.tf.tmpl index a777ac362783..f081e7f3ced3 100644 --- a/mmv1/templates/terraform/examples/network_firewall_policy_rule.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_firewall_policy_rule.tf.tmpl @@ -1,5 +1,5 @@ resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { - name = "{{index $.Vars "address_group"}}" + name = "{{index $.Vars "address"}}" parent = "projects/{{index $.TestEnvVars "project_name"}}" description = "Sample global networksecurity_address_group" location = "global" @@ -26,10 +26,9 @@ resource "google_compute_network_firewall_policy_rule" "{{$.PrimaryResourceId}}" target_service_accounts = ["{{index $.TestEnvVars "service_acct"}}"] match { - src_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] - src_ip_ranges = ["10.100.0.1/32"] - src_fqdns = ["google.com"] - src_region_codes = ["US"] + src_ip_ranges = ["10.100.0.1/32"] + src_fqdns = ["google.com"] + src_region_codes = ["US"] src_threat_intelligences = ["iplist-known-malicious-ips"] src_secure_tags { @@ -39,6 +38,8 @@ resource "google_compute_network_firewall_policy_rule" "{{$.PrimaryResourceId}}" layer4_configs { ip_protocol = "all" } + + src_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] } } @@ -51,7 +52,6 @@ resource "google_tags_tag_key" "basic_key" { parent = "organizations/{{index $.TestEnvVars "org_id"}}" purpose = "GCE_FIREWALL" short_name = "{{index $.Vars "tag_key"}}" - purpose_data = { network = "{{index $.TestEnvVars "project_name"}}/${google_compute_network.basic_network.name}" } @@ -60,5 +60,5 @@ resource "google_tags_tag_key" "basic_key" { resource "google_tags_tag_value" "basic_value" { description = "For valuename resources." parent = google_tags_tag_key.basic_key.id - short_name = "{{index $.Vars "tag_value"}}" + short_name = "tagvalue" } diff --git a/mmv1/templates/terraform/examples/network_firewall_policy_rule_network_scope_egress.tf.tmpl b/mmv1/templates/terraform/examples/network_firewall_policy_rule_network_scope_egress.tf.tmpl deleted file mode 100644 index 1b49e37008fe..000000000000 --- a/mmv1/templates/terraform/examples/network_firewall_policy_rule_network_scope_egress.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_compute_network_firewall_policy" "basic_network_firewall_policy" { - provider = google-beta - name = "{{index $.Vars "fw_policy"}}" - description = "Sample global network firewall policy" - project = "{{index $.TestEnvVars "project_name"}}" -} - -resource "google_compute_network_firewall_policy_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - action = "allow" - description = "This is a simple rule description" - direction = "EGRESS" - disabled = false - enable_logging = true - firewall_policy = google_compute_network_firewall_policy.basic_network_firewall_policy.name - priority = 1000 - rule_name = "test-rule" - - match { - dest_ip_ranges = ["10.100.0.1/32"] - dest_network_scope = "INTERNET" - - layer4_configs { - ip_protocol = "all" - } - } -} diff --git a/mmv1/templates/terraform/examples/network_firewall_policy_rule_network_scope_ingress.tf.tmpl b/mmv1/templates/terraform/examples/network_firewall_policy_rule_network_scope_ingress.tf.tmpl deleted file mode 100644 index 0a9e19367c24..000000000000 --- a/mmv1/templates/terraform/examples/network_firewall_policy_rule_network_scope_ingress.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -resource "google_compute_network_firewall_policy" "basic_network_firewall_policy" { - provider = google-beta - name = "{{index $.Vars "fw_policy"}}" - description = "Sample global network firewall policy" - project = "{{index $.TestEnvVars "project_name"}}" -} - -resource "google_compute_network_firewall_policy_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - action = "allow" - description = "This is a simple rule description" - direction = "INGRESS" - disabled = false - enable_logging = true - firewall_policy = google_compute_network_firewall_policy.basic_network_firewall_policy.name - priority = 1000 - rule_name = "test-rule" - - match { - src_ip_ranges = ["11.100.0.1/32"] - src_network_scope = "VPC_NETWORKS" - src_networks = [google_compute_network.network.id] - - layer4_configs { - ip_protocol = "all" - } - } -} - -resource "google_compute_network" "network" { - provider = google-beta - name = "{{index $.Vars "network"}}" -} diff --git a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_tls_inspection_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_tls_inspection_basic.tf.tmpl index 7f4ca533cd6c..439206f36845 100644 --- a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_tls_inspection_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_tls_inspection_basic.tf.tmpl @@ -1,4 +1,5 @@ resource "google_privateca_ca_pool" "default" { + provider = google-beta name = "{{index $.Vars "privateca_ca_pool_name"}}" location = "us-central1" tier = "DEVOPS" @@ -22,7 +23,9 @@ resource "google_privateca_ca_pool" "default" { } } + resource "google_privateca_certificate_authority" "default" { + provider = google-beta pool = google_privateca_ca_pool.default.name certificate_authority_id = "{{index $.Vars "privateca_certificate_authority_id"}}" location = "us-central1" @@ -59,15 +62,19 @@ resource "google_privateca_certificate_authority" "default" { } data "google_project" "project" { + provider = google-beta } resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" { + provider = google-beta + ca_pool = google_privateca_ca_pool.default.id role = "roles/privateca.certificateManager" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-networksecurity.iam.gserviceaccount.com" } resource "google_network_security_tls_inspection_policy" "default" { + provider = google-beta name = "{{index $.Vars "privateca_ca_tls_name"}}" location = "us-central1" ca_pool = google_privateca_ca_pool.default.id @@ -75,6 +82,7 @@ resource "google_network_security_tls_inspection_policy" "default" { } resource "google_network_security_gateway_security_policy" "{{$.PrimaryResourceId}}" { + provider = google-beta name = "{{index $.Vars "resource_name"}}" location = "us-central1" description = "my description" diff --git a/mmv1/templates/terraform/examples/network_security_security_profile_group_intercept.tf.tmpl b/mmv1/templates/terraform/examples/network_security_security_profile_group_intercept.tf.tmpl deleted file mode 100644 index 1011ff9b235a..000000000000 --- a/mmv1/templates/terraform/examples/network_security_security_profile_group_intercept.tf.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -resource "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_network_security_intercept_deployment_group" "default" { - provider = google-beta - intercept_deployment_group_id = "{{index $.Vars "deployment_group_id"}}" - location = "global" - network = google_compute_network.default.id -} - -resource "google_network_security_intercept_endpoint_group" "default" { - provider = google-beta - intercept_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}" - location = "global" - intercept_deployment_group = google_network_security_intercept_deployment_group.default.id -} - -resource "google_network_security_security_profile" "default" { - provider = google-beta - name = "{{index $.Vars "security_profile_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - type = "CUSTOM_INTERCEPT" - - custom_intercept_profile { - intercept_endpoint_group = google_network_security_intercept_endpoint_group.default.id - } -} - -resource "google_network_security_security_profile_group" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "security_profile_group_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - custom_intercept_profile = google_network_security_security_profile.default.id -} diff --git a/mmv1/templates/terraform/examples/network_security_security_profile_group_mirroring.tf.tmpl b/mmv1/templates/terraform/examples/network_security_security_profile_group_mirroring.tf.tmpl deleted file mode 100644 index f6236d522155..000000000000 --- a/mmv1/templates/terraform/examples/network_security_security_profile_group_mirroring.tf.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -resource "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_network_security_mirroring_deployment_group" "default" { - provider = google-beta - mirroring_deployment_group_id = "{{index $.Vars "deployment_group_id"}}" - location = "global" - network = google_compute_network.default.id -} - -resource "google_network_security_mirroring_endpoint_group" "default" { - provider = google-beta - mirroring_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}" - location = "global" - mirroring_deployment_group = google_network_security_mirroring_deployment_group.default.id -} - -resource "google_network_security_security_profile" "default" { - provider = google-beta - name = "{{index $.Vars "security_profile_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - type = "CUSTOM_MIRRORING" - - custom_mirroring_profile { - mirroring_endpoint_group = google_network_security_mirroring_endpoint_group.default.id - } -} - -resource "google_network_security_security_profile_group" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "security_profile_group_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - custom_mirroring_profile = google_network_security_security_profile.default.id -} diff --git a/mmv1/templates/terraform/examples/network_security_security_profile_intercept.tf.tmpl b/mmv1/templates/terraform/examples/network_security_security_profile_intercept.tf.tmpl deleted file mode 100644 index 71b195f711b4..000000000000 --- a/mmv1/templates/terraform/examples/network_security_security_profile_intercept.tf.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -resource "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_network_security_intercept_deployment_group" "default" { - provider = google-beta - intercept_deployment_group_id = "{{index $.Vars "deployment_group_id"}}" - location = "global" - network = google_compute_network.default.id -} - -resource "google_network_security_intercept_endpoint_group" "default" { - provider = google-beta - intercept_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}" - location = "global" - intercept_deployment_group = google_network_security_intercept_deployment_group.default.id -} - -resource "google_network_security_security_profile" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - type = "CUSTOM_INTERCEPT" - - custom_intercept_profile { - intercept_endpoint_group = google_network_security_intercept_endpoint_group.default.id - } -} diff --git a/mmv1/templates/terraform/examples/network_security_security_profile_mirroring.tf.tmpl b/mmv1/templates/terraform/examples/network_security_security_profile_mirroring.tf.tmpl deleted file mode 100644 index 64e088fa633e..000000000000 --- a/mmv1/templates/terraform/examples/network_security_security_profile_mirroring.tf.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -resource "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_network_security_mirroring_deployment_group" "default" { - provider = google-beta - mirroring_deployment_group_id = "{{index $.Vars "deployment_group_id"}}" - location = "global" - network = google_compute_network.default.id -} - -resource "google_network_security_mirroring_endpoint_group" "default" { - provider = google-beta - mirroring_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}" - location = "global" - mirroring_deployment_group = google_network_security_mirroring_deployment_group.default.id -} - -resource "google_network_security_security_profile" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - type = "CUSTOM_MIRRORING" - - custom_mirroring_profile { - mirroring_endpoint_group = google_network_security_mirroring_endpoint_group.default.id - } -} diff --git a/mmv1/templates/terraform/examples/network_services_authz_policy_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_services_authz_policy_advanced.tf.tmpl index a04d051ef18d..e8905548cc37 100644 --- a/mmv1/templates/terraform/examples/network_services_authz_policy_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_authz_policy_advanced.tf.tmpl @@ -22,78 +22,6 @@ resource "google_compute_subnetwork" "proxy_only" { network = google_compute_network.default.id } -resource "google_compute_instance" "callouts_instance" { - name = "{{index $.Vars "callouts_instance_name"}}" - zone = "us-west1-a" - machine_type = "e2-small" - tags = ["allow-ssh","load-balanced-backend"] - deletion_protection = false - - labels = { - "container-vm" = "cos-stable-109-17800-147-54" - } - - network_interface { - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - access_config { - # add external ip to fetch packages - } - - } - - boot_disk { - auto_delete = true - initialize_params { - type = "pd-standard" - size = 10 - image = "https://www.googleapis.com/compute/v1/projects/cos-cloud/global/images/cos-stable-109-17800-147-54" - } - } - - metadata = { - gce-container-declaration = "# DISCLAIMER:\n# This container declaration format is not a public API and may change without\n# notice. Please use gcloud command-line tool or Google Cloud Console to run\n# Containers on Google Compute Engine.\n\nspec:\n containers:\n - image: us-docker.pkg.dev/service-extensions-samples/callouts/python-example-basic:main\n name: callouts-vm\n securityContext:\n privileged: false\n stdin: false\n tty: false\n volumeMounts: []\n restartPolicy: Always\n volumes: []\n" - google-logging-enabled = "true" - } - - lifecycle { - create_before_destroy = true - } -} - -resource "google_compute_instance_group" "callouts_instance_group" { - name = "{{index $.Vars "callouts_instance_group_name"}}" - description = "Terraform test instance group" - zone = "us-west1-a" - - instances = [ - google_compute_instance.callouts_instance.id, - ] - - named_port { - name = "http" - port = "80" - } - - named_port { - name = "grpc" - port = "443" - } -} - -resource "google_compute_region_health_check" "callouts_health_check" { - name = "{{index $.Vars "callouts_health_check_name"}}" - region = "us-west1" - - http_health_check { - port = 80 - } - - depends_on = [ - google_compute_region_health_check.default - ] -} - resource "google_compute_address" "default" { name = "{{index $.Vars "address_name"}}" project = "{{index $.TestEnvVars "project"}}" @@ -159,13 +87,6 @@ resource "google_compute_region_backend_service" "authz_extension" { protocol = "HTTP2" load_balancing_scheme = "INTERNAL_MANAGED" port_name = "grpc" - - health_checks = [google_compute_region_health_check.callouts_health_check.id] - backend { - group = google_compute_instance_group.callouts_instance_group.id - balancing_mode = "UTILIZATION" - capacity_scaler = 1.0 - } } resource "google_network_services_authz_extension" "default" { @@ -199,27 +120,4 @@ resource "google_network_security_authz_policy" "{{$.PrimaryResourceId}}" { resources = [ google_network_services_authz_extension.default.id ] } } - - http_rules { - from { - not_sources { - principals { - exact = "dummy-principal" - } - } - } - to { - operations { - header_set { - headers { - name = "test-header" - value { - exact = "test-value" - ignore_case = true - } - } - } - } - } - } -} +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/network_services_lb_traffic_extension_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_lb_traffic_extension_basic.tf.tmpl index 5d7fce26a5c2..9943d494b2f1 100644 --- a/mmv1/templates/terraform/examples/network_services_lb_traffic_extension_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_lb_traffic_extension_basic.tf.tmpl @@ -262,7 +262,7 @@ resource "google_compute_instance" "callouts_instance" { # Initialize an Envoy's Ext Proc gRPC API based on a docker container metadata = { - gce-container-declaration = "# DISCLAIMER:\n# This container declaration format is not a public API and may change without\n# notice. Please use gcloud command-line tool or Google Cloud Console to run\n# Containers on Google Compute Engine.\n\nspec:\n containers:\n - image: us-docker.pkg.dev/service-extensions-samples/callouts/python-example-basic:main\n name: callouts-vm\n securityContext:\n privileged: false\n stdin: false\n tty: false\n volumeMounts: []\n restartPolicy: Always\n volumes: []\n" + gce-container-declaration = "# DISCLAIMER:\n# This container declaration format is not a public API and may change without\n# notice. Please use gcloud command-line tool or Google Cloud Console to run\n# Containers on Google Compute Engine.\n\nspec:\n containers:\n - image: us-docker.pkg.dev/service-extensions/ext-proc/service-callout-basic-example-python:latest\n name: callouts-vm\n securityContext:\n privileged: false\n stdin: false\n tty: false\n volumeMounts: []\n restartPolicy: Always\n volumes: []\n" google-logging-enabled = "true" } diff --git a/mmv1/templates/terraform/examples/network_services_mesh_location.tf.tmpl b/mmv1/templates/terraform/examples/network_services_mesh_location.tf.tmpl deleted file mode 100644 index cd8ca745dac0..000000000000 --- a/mmv1/templates/terraform/examples/network_services_mesh_location.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - location = "global" -} diff --git a/mmv1/templates/terraform/examples/parameter_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/parameter_config_basic.tf.tmpl deleted file mode 100644 index b31380eee821..000000000000 --- a/mmv1/templates/terraform/examples/parameter_config_basic.tf.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -resource "google_parameter_manager_parameter" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" -} diff --git a/mmv1/templates/terraform/examples/parameter_version_basic.tf.tmpl b/mmv1/templates/terraform/examples/parameter_version_basic.tf.tmpl deleted file mode 100644 index ba691b46152c..000000000000 --- a/mmv1/templates/terraform/examples/parameter_version_basic.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" -} - -resource "google_parameter_manager_parameter_version" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "{{index $.Vars "parameter_version_id"}}" - parameter_data = "app-parameter-version-data" -} diff --git a/mmv1/templates/terraform/examples/parameter_version_with_json_format.tf.tmpl b/mmv1/templates/terraform/examples/parameter_version_with_json_format.tf.tmpl deleted file mode 100644 index c7e0bc7a2997..000000000000 --- a/mmv1/templates/terraform/examples/parameter_version_with_json_format.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" - format = "JSON" -} - -resource "google_parameter_manager_parameter_version" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "{{index $.Vars "parameter_version_id"}}" - parameter_data = jsonencode({ - "key1": "val1", - "key2": "val2" - }) -} diff --git a/mmv1/templates/terraform/examples/parameter_version_with_yaml_format.tf.tmpl b/mmv1/templates/terraform/examples/parameter_version_with_yaml_format.tf.tmpl deleted file mode 100644 index ea2f63bcd282..000000000000 --- a/mmv1/templates/terraform/examples/parameter_version_with_yaml_format.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" - format = "YAML" -} - -resource "google_parameter_manager_parameter_version" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "{{index $.Vars "parameter_version_id"}}" - parameter_data = yamlencode({ - "key1": "val1", - "key2": "val2" - }) -} diff --git a/mmv1/templates/terraform/examples/parameter_with_format.tf.tmpl b/mmv1/templates/terraform/examples/parameter_with_format.tf.tmpl deleted file mode 100644 index dd78230835a4..000000000000 --- a/mmv1/templates/terraform/examples/parameter_with_format.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_parameter_manager_parameter" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" - format = "JSON" -} diff --git a/mmv1/templates/terraform/examples/parameter_with_labels.tf.tmpl b/mmv1/templates/terraform/examples/parameter_with_labels.tf.tmpl deleted file mode 100644 index 8d990cd7a1a3..000000000000 --- a/mmv1/templates/terraform/examples/parameter_with_labels.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_parameter_manager_parameter" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" - - labels = { - key1 = "val1" - key2 = "val2" - key3 = "val3" - key4 = "val4" - key5 = "val5" - } -} diff --git a/mmv1/templates/terraform/examples/privateca_certificate_authority_basic_with_custom_cdp_aia_urls.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_authority_basic_with_custom_cdp_aia_urls.tf.tmpl deleted file mode 100644 index c052e45aa9c5..000000000000 --- a/mmv1/templates/terraform/examples/privateca_certificate_authority_basic_with_custom_cdp_aia_urls.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -resource "google_privateca_certificate_authority" "{{$.PrimaryResourceId}}" { - // This example assumes this pool already exists. - // Pools cannot be deleted in normal test circumstances, so we depend on static pools - pool = "{{index $.Vars "pool_name"}}" - certificate_authority_id = "{{index $.Vars "certificate_authority_id"}}" - location = "{{index $.Vars "pool_location"}}" - deletion_protection = {{index $.Vars "deletion_protection"}} - config { - subject_config { - subject { - organization = "ACME" - common_name = "my-certificate-authority" - } - } - x509_config { - ca_options { - # is_ca *MUST* be true for certificate authorities - is_ca = true - } - key_usage { - base_key_usage { - # cert_sign and crl_sign *MUST* be true for certificate authorities - cert_sign = true - crl_sign = true - } - extended_key_usage { - } - } - } - } - # valid for 10 years - lifetime = "${10 * 365 * 24 * 3600}s" - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - user_defined_access_urls { - aia_issuing_certificate_urls = ["http://example.com/ca.crt", "http://example.com/anotherca.crt"] - crl_access_urls = ["http://example.com/crl1.crt", "http://example.com/crl2.crt"] - } -} diff --git a/mmv1/templates/terraform/examples/public_advertised_prefixes_pdp_scope.tf.tmpl b/mmv1/templates/terraform/examples/public_advertised_prefixes_pdp_scope.tf.tmpl deleted file mode 100644 index 660c57024051..000000000000 --- a/mmv1/templates/terraform/examples/public_advertised_prefixes_pdp_scope.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_compute_public_advertised_prefix" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "prefixes_name"}}" - description = "{{index $.TestEnvVars "desc"}}" - dns_verification_ip = "127.127.0.0" - ip_cidr_range = "127.127.0.0/16" - pdp_scope = "REGIONAL" -} diff --git a/mmv1/templates/terraform/examples/public_delegated_prefixes_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/public_delegated_prefixes_ipv6.tf.tmpl deleted file mode 100644 index bef58fafba8d..000000000000 --- a/mmv1/templates/terraform/examples/public_delegated_prefixes_ipv6.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_compute_public_advertised_prefix" "advertised" { - name = "{{index $.Vars "pap_name"}}" - description = "{{index $.TestEnvVars "desc"}}" - dns_verification_ip = "2001:db8::" - ip_cidr_range = "2001:db8::/32" - pdp_scope = "REGIONAL" -} - -resource "google_compute_public_delegated_prefix" "prefix" { - name = "{{index $.Vars "root_pdp_name"}}" - description = "test-delegation-mode-pdp" - region = "us-west1" - ip_cidr_range = "2001:db8::/40" - parent_prefix = google_compute_public_advertised_prefix.advertised.id - mode = "DELEGATION" -} - -resource "google_compute_public_delegated_prefix" "subprefix" { - name = "{{index $.Vars "sub_pdp_name"}}" - description = "test-forwarding-rule-mode-pdp" - region = "us-west1" - ip_cidr_range = "2001:db8::/48" - parent_prefix = google_compute_public_delegated_prefix.prefix.id - allocatable_prefix_length = 64 - mode = "EXTERNAL_IPV6_FORWARDING_RULE_CREATION" -} diff --git a/mmv1/templates/terraform/examples/pubsub_topic_geo_restricted.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_topic_geo_restricted.tf.tmpl index ba1a5e35b97a..48934419f82b 100644 --- a/mmv1/templates/terraform/examples/pubsub_topic_geo_restricted.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_topic_geo_restricted.tf.tmpl @@ -5,6 +5,5 @@ resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { allowed_persistence_regions = [ "europe-west3", ] - enforce_in_transit = true } } diff --git a/mmv1/templates/terraform/examples/pubsub_topic_ingestion_aws_msk.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_topic_ingestion_aws_msk.tf.tmpl deleted file mode 100644 index 6f7e5d476bbc..000000000000 --- a/mmv1/templates/terraform/examples/pubsub_topic_ingestion_aws_msk.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "topic_name"}}" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual AWS resources for the test to pass. - ingestion_data_source_settings { - aws_msk { - cluster_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name" - topic = "test-topic" - aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name" - gcp_service_account = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com" - } - } -} diff --git a/mmv1/templates/terraform/examples/pubsub_topic_ingestion_azure_event_hubs.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_topic_ingestion_azure_event_hubs.tf.tmpl deleted file mode 100644 index 7a850692afc5..000000000000 --- a/mmv1/templates/terraform/examples/pubsub_topic_ingestion_azure_event_hubs.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "topic_name"}}" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual Azure resources for the test to pass. - ingestion_data_source_settings { - azure_event_hubs { - resource_group = "azure-ingestion-resource-group" - namespace = "azure-ingestion-namespace" - event_hub = "azure-ingestion-event-hub" - client_id = "aZZZZZZZ-YYYY-HHHH-GGGG-abcdef569123" - tenant_id = "0XXXXXXX-YYYY-HHHH-GGGG-123456789123" - subscription_id = "bXXXXXXX-YYYY-HHHH-GGGG-123456789123" - gcp_service_account = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com" - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/pubsub_topic_ingestion_confluent_cloud.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_topic_ingestion_confluent_cloud.tf.tmpl deleted file mode 100644 index 94bc0efa14ba..000000000000 --- a/mmv1/templates/terraform/examples/pubsub_topic_ingestion_confluent_cloud.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "topic_name"}}" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual Confluent Cloud resources for the test to pass. - ingestion_data_source_settings { - confluent_cloud { - bootstrap_server = "test.us-west2.gcp.confluent.cloud:1111" - cluster_id = "1234" - topic = "test-topic" - identity_pool_id = "test-identity-pool-id" - gcp_service_account = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com" - } - } -} diff --git a/mmv1/templates/terraform/examples/redis_cluster_user_and_auto_created_connections.tf.tmpl b/mmv1/templates/terraform/examples/redis_cluster_user_and_auto_created_connections.tf.tmpl deleted file mode 100644 index d45de4bcce46..000000000000 --- a/mmv1/templates/terraform/examples/redis_cluster_user_and_auto_created_connections.tf.tmpl +++ /dev/null @@ -1,108 +0,0 @@ -resource "google_redis_cluster_user_created_connections" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "cluster_name"}}" - region = "us-central1" - cluster_endpoints { - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule1_network2.psc_connection_id - address = google_compute_address.ip1_network2.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule1_network2.id - network = google_compute_network.network2.id - service_attachment = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[0].service_attachment - } - } - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule2_network2.psc_connection_id - address = google_compute_address.ip2_network2.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule2_network2.id - network = google_compute_network.network2.id - service_attachment = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[1].service_attachment - } - } - } -} - -resource "google_compute_forwarding_rule" "forwarding_rule1_network2" { - name = "{{index $.Vars "forwarding_rule1_network2_name"}}" - region = "us-central1" - ip_address = google_compute_address.ip1_network2.id - load_balancing_scheme = "" - network = google_compute_network.network2.id - target = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[0].service_attachment -} - -resource "google_compute_forwarding_rule" "forwarding_rule2_network2" { - name = "{{index $.Vars "forwarding_rule2_network2_name"}}" - region = "us-central1" - ip_address = google_compute_address.ip2_network2.id - load_balancing_scheme = "" - network = google_compute_network.network2.id - target = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[1].service_attachment -} - -resource "google_compute_address" "ip1_network2" { - name = "{{index $.Vars "ip1_network2_name"}}" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network2.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" -} - -resource "google_compute_address" "ip2_network2" { - name = "{{index $.Vars "ip2_network2_name"}}" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network2.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" -} - -resource "google_compute_subnetwork" "subnet_network2" { - name = "{{index $.Vars "subnet_network2_name"}}" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.network2.id -} - -resource "google_compute_network" "network2" { - name = "{{index $.Vars "network2_name"}}" - auto_create_subnetworks = false -} - -// redis cluster without endpoint -resource "google_redis_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "cluster_name"}}" - shard_count = 3 - region = "us-central1" - replica_count = 0 - deletion_protection_enabled = false - psc_configs { - network = google_compute_network.network1.id - } - depends_on = [ - google_network_connectivity_service_connection_policy.default - ] -} - -resource "google_network_connectivity_service_connection_policy" "default" { - name = "{{index $.Vars "policy_name"}}" - location = "us-central1" - service_class = "gcp-memorystore-redis" - description = "my basic service connection policy" - network = google_compute_network.network1.id - psc_config { - subnetworks = [google_compute_subnetwork.subnet_network1.id] - } -} - -resource "google_compute_subnetwork" "subnet_network1" { - name = "{{index $.Vars "subnet_network1_name"}}" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.network1.id -} - -resource "google_compute_network" "network1" { - name = "{{index $.Vars "network1_name"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/redis_cluster_user_created_connections.tf.tmpl b/mmv1/templates/terraform/examples/redis_cluster_user_created_connections.tf.tmpl deleted file mode 100644 index 5230e12604db..000000000000 --- a/mmv1/templates/terraform/examples/redis_cluster_user_created_connections.tf.tmpl +++ /dev/null @@ -1,149 +0,0 @@ -resource "google_redis_cluster_user_created_connections" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "cluster_name"}}" - region = "us-central1" - cluster_endpoints { - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule1_network1.psc_connection_id - address = google_compute_address.ip1_network1.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule1_network1.id - network = google_compute_network.network1.id - project_id = data.google_project.project.project_id - service_attachment = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[0].service_attachment - } - } - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule2_network1.psc_connection_id - address = google_compute_address.ip2_network1.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule2_network1.id - network = google_compute_network.network1.id - service_attachment = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[1].service_attachment - } - } - } - cluster_endpoints { - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule1_network2.psc_connection_id - address = google_compute_address.ip1_network2.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule1_network2.id - network = google_compute_network.network2.id - service_attachment = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[0].service_attachment - } - } - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule2_network2.psc_connection_id - address = google_compute_address.ip2_network2.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule2_network2.id - network = google_compute_network.network2.id - service_attachment = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[1].service_attachment - } - } - } -} - -resource "google_compute_forwarding_rule" "forwarding_rule1_network1" { - name = "{{index $.Vars "forwarding_rule1_network1_name"}}" - region = "us-central1" - ip_address = google_compute_address.ip1_network1.id - load_balancing_scheme = "" - network = google_compute_network.network1.id - target = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[0].service_attachment -} - -resource "google_compute_forwarding_rule" "forwarding_rule2_network1" { - name = "{{index $.Vars "forwarding_rule2_network1_name"}}" - region = "us-central1" - ip_address = google_compute_address.ip2_network1.id - load_balancing_scheme = "" - network = google_compute_network.network1.id - target = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[1].service_attachment -} - -resource "google_compute_address" "ip1_network1" { - name = "{{index $.Vars "ip1_network1_name"}}" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network1.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" -} - -resource "google_compute_address" "ip2_network1" { - name = "{{index $.Vars "ip2_network1_name"}}" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network1.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" -} - -resource "google_compute_subnetwork" "subnet_network1" { - name = "{{index $.Vars "subnet_network1_name"}}" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.network1.id -} - -resource "google_compute_network" "network1" { - name = "{{index $.Vars "network1_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_forwarding_rule" "forwarding_rule1_network2" { - name = "{{index $.Vars "forwarding_rule1_network2_name"}}" - region = "us-central1" - ip_address = google_compute_address.ip1_network2.id - load_balancing_scheme = "" - network = google_compute_network.network2.id - target = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[0].service_attachment -} - -resource "google_compute_forwarding_rule" "forwarding_rule2_network2" { - name = "{{index $.Vars "forwarding_rule2_network2_name"}}" - region = "us-central1" - ip_address = google_compute_address.ip2_network2.id - load_balancing_scheme = "" - network = google_compute_network.network2.id - target = google_redis_cluster.{{$.PrimaryResourceId}}.psc_service_attachments[1].service_attachment -} - -resource "google_compute_address" "ip1_network2" { - name = "{{index $.Vars "ip1_network2_name"}}" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network2.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" -} - -resource "google_compute_address" "ip2_network2" { - name = "{{index $.Vars "ip2_network2_name"}}" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network2.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" -} - -resource "google_compute_subnetwork" "subnet_network2" { - name = "{{index $.Vars "subnet_network2_name"}}" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.network2.id -} - -resource "google_compute_network" "network2" { - name = "{{index $.Vars "network2_name"}}" - auto_create_subnetworks = false -} - -// redis cluster without endpoint -resource "google_redis_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "cluster_name"}}" - shard_count = 3 - region = "us-central1" - replica_count = 0 - deletion_protection_enabled = false -} - -data "google_project" "project" { -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_network_firewall_policy_rule.tf.tmpl b/mmv1/templates/terraform/examples/region_network_firewall_policy_rule.tf.tmpl index 7c4dc656c656..cdef09bc9c1d 100644 --- a/mmv1/templates/terraform/examples/region_network_firewall_policy_rule.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_firewall_policy_rule.tf.tmpl @@ -1,5 +1,5 @@ resource "google_network_security_address_group" "basic_regional_networksecurity_address_group" { - name = "{{index $.Vars "address_group"}}" + name = "{{index $.Vars "address"}}" parent = "projects/{{index $.TestEnvVars "project_name"}}" description = "Sample regional networksecurity_address_group" location = "{{index $.TestEnvVars "region"}}" @@ -28,10 +28,9 @@ resource "google_compute_region_network_firewall_policy_rule" "{{$.PrimaryResour target_service_accounts = ["{{index $.TestEnvVars "service_acct"}}"] match { - src_address_groups = [google_network_security_address_group.basic_regional_networksecurity_address_group.id] - src_ip_ranges = ["10.100.0.1/32"] - src_fqdns = ["example.com"] - src_region_codes = ["US"] + src_ip_ranges = ["10.100.0.1/32"] + src_fqdns = ["example.com"] + src_region_codes = ["US"] src_threat_intelligences = ["iplist-known-malicious-ips"] layer4_configs { @@ -41,6 +40,8 @@ resource "google_compute_region_network_firewall_policy_rule" "{{$.PrimaryResour src_secure_tags { name = google_tags_tag_value.basic_value.id } + + src_address_groups = [google_network_security_address_group.basic_regional_networksecurity_address_group.id] } } @@ -62,5 +63,5 @@ resource "google_tags_tag_key" "basic_key" { resource "google_tags_tag_value" "basic_value" { description = "For valuename resources." parent = google_tags_tag_key.basic_key.id - short_name = "{{index $.Vars "tag_value"}}" + short_name = "tagvalue" } diff --git a/mmv1/templates/terraform/examples/region_network_firewall_policy_rule_network_scope_egress.tf.tmpl b/mmv1/templates/terraform/examples/region_network_firewall_policy_rule_network_scope_egress.tf.tmpl deleted file mode 100644 index ce51ffe1568b..000000000000 --- a/mmv1/templates/terraform/examples/region_network_firewall_policy_rule_network_scope_egress.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_compute_region_network_firewall_policy" "basic_regional_network_firewall_policy" { - provider = google-beta - name = "{{index $.Vars "fw_policy"}}" - description = "Sample regional network firewall policy" - project = "{{index $.TestEnvVars "project_name"}}" - region = "{{index $.TestEnvVars "region"}}" -} - -resource "google_compute_region_network_firewall_policy_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - action = "allow" - description = "This is a simple rule description" - direction = "EGRESS" - disabled = false - enable_logging = true - firewall_policy = google_compute_region_network_firewall_policy.basic_regional_network_firewall_policy.name - priority = 1000 - region = "{{index $.TestEnvVars "region"}}" - rule_name = "test-rule" - - match { - dest_ip_ranges = ["10.100.0.1/32"] - dest_network_scope = "INTERNET" - - layer4_configs { - ip_protocol = "all" - } - } -} diff --git a/mmv1/templates/terraform/examples/region_network_firewall_policy_rule_network_scope_ingress.tf.tmpl b/mmv1/templates/terraform/examples/region_network_firewall_policy_rule_network_scope_ingress.tf.tmpl deleted file mode 100644 index 7269d2f5cfa6..000000000000 --- a/mmv1/templates/terraform/examples/region_network_firewall_policy_rule_network_scope_ingress.tf.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -resource "google_compute_region_network_firewall_policy" "basic_regional_network_firewall_policy" { - provider = google-beta - name = "{{index $.Vars "fw_policy"}}" - description = "Sample regional network firewall policy" - project = "{{index $.TestEnvVars "project_name"}}" - region = "{{index $.TestEnvVars "region"}}" -} - -resource "google_compute_region_network_firewall_policy_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - action = "allow" - description = "This is a simple rule description" - direction = "INGRESS" - disabled = false - enable_logging = true - firewall_policy = google_compute_region_network_firewall_policy.basic_regional_network_firewall_policy.name - priority = 1000 - region = "{{index $.TestEnvVars "region"}}" - rule_name = "test-rule" - - match { - src_ip_ranges = ["10.100.0.1/32"] - src_network_scope = "VPC_NETWORKS" - src_networks = [google_compute_network.network.id] - - layer4_configs { - ip_protocol = "all" - } - } -} - -resource "google_compute_network" "network" { - provider = google-beta - name = "{{index $.Vars "network"}}" -} diff --git a/mmv1/templates/terraform/examples/regional_parameter_version_basic.tf.tmpl b/mmv1/templates/terraform/examples/regional_parameter_version_basic.tf.tmpl deleted file mode 100644 index b649cc0d6dfd..000000000000 --- a/mmv1/templates/terraform/examples/regional_parameter_version_basic.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" - location = "us-central1" -} - -resource "google_parameter_manager_regional_parameter_version" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "{{index $.Vars "parameter_version_id"}}" - parameter_data = "regional-parameter-version-data" -} diff --git a/mmv1/templates/terraform/examples/regional_parameter_version_with_json_format.tf.tmpl b/mmv1/templates/terraform/examples/regional_parameter_version_with_json_format.tf.tmpl deleted file mode 100644 index d4499f46885e..000000000000 --- a/mmv1/templates/terraform/examples/regional_parameter_version_with_json_format.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" - format = "JSON" - location = "us-central1" -} - -resource "google_parameter_manager_regional_parameter_version" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "{{index $.Vars "parameter_version_id"}}" - parameter_data = jsonencode({ - "key1": "val1", - "key2": "val2" - }) -} diff --git a/mmv1/templates/terraform/examples/regional_parameter_version_with_yaml_format.tf.tmpl b/mmv1/templates/terraform/examples/regional_parameter_version_with_yaml_format.tf.tmpl deleted file mode 100644 index 41b781bffc0f..000000000000 --- a/mmv1/templates/terraform/examples/regional_parameter_version_with_yaml_format.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "{{index $.Vars "parameter_id"}}" - format = "YAML" - location = "us-central1" -} - -resource "google_parameter_manager_regional_parameter_version" "{{$.PrimaryResourceId}}" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "{{index $.Vars "parameter_version_id"}}" - parameter_data = yamlencode({ - "key1": "val1", - "key2": "val2" - }) -} diff --git a/mmv1/templates/terraform/examples/resource_policy_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_attachment_basic.tf.tmpl new file mode 100644 index 000000000000..d556cdea9090 --- /dev/null +++ b/mmv1/templates/terraform/examples/resource_policy_attachment_basic.tf.tmpl @@ -0,0 +1,36 @@ +resource "google_compute_resource_policy" "policy" { + name = var.policy_name + region = "us-central1" + + instance_schedule_policy { + vm_start_schedule { + schedule = "0 8 * * *" + } + vm_stop_schedule { + schedule = "0 20 * * *" + } + time_zone = "US/Central" + } +} + +resource "google_compute_instance" "instance" { + name = var.instance_name + machine_type = "e2-micro" + zone = var.zone + + boot_disk { + initialize_params { + image = "debian-cloud/debian-11" + } + } + + network_interface { + network = "default" + } +} + +resource "google_compute_resource_policy_attachment" "attachment" { + name = google_compute_resource_policy.policy.name + instance = google_compute_instance.instance.name + zone = var.zone +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/scc_mute_config.tf.tmpl b/mmv1/templates/terraform/examples/scc_mute_config.tf.tmpl index 4359e84f1080..c1656175b8c7 100644 --- a/mmv1/templates/terraform/examples/scc_mute_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_mute_config.tf.tmpl @@ -3,6 +3,4 @@ resource "google_scc_mute_config" "{{$.PrimaryResourceId}}" { parent = "organizations/{{index $.TestEnvVars "org_id"}}" filter = "category: \"OS_VULNERABILITY\"" description = "My Mute Config" - type = "DYNAMIC" - expiry_time = "2215-02-03T15:01:23Z" } diff --git a/mmv1/templates/terraform/examples/spanner_backup_schedule_daily_full.tf.tmpl b/mmv1/templates/terraform/examples/spanner_backup_schedule_daily_full.tf.tmpl index 3853d48fb793..703d9684e189 100644 --- a/mmv1/templates/terraform/examples/spanner_backup_schedule_daily_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/spanner_backup_schedule_daily_full.tf.tmpl @@ -37,8 +37,4 @@ resource "google_spanner_backup_schedule" "{{$.PrimaryResourceId}}" { } // The schedule creates only full backups. full_backup_spec {} - - encryption_config { - encryption_type = "USE_DATABASE_ENCRYPTION" - } } diff --git a/mmv1/templates/terraform/examples/spanner_backup_schedule_daily_incremental.tf.tmpl b/mmv1/templates/terraform/examples/spanner_backup_schedule_daily_incremental.tf.tmpl index bad04319bf76..a1ecb691fb5c 100644 --- a/mmv1/templates/terraform/examples/spanner_backup_schedule_daily_incremental.tf.tmpl +++ b/mmv1/templates/terraform/examples/spanner_backup_schedule_daily_incremental.tf.tmpl @@ -38,8 +38,4 @@ resource "google_spanner_backup_schedule" "{{$.PrimaryResourceId}}" { } // The schedule creates incremental backup chains. incremental_backup_spec {} - - encryption_config { - encryption_type = "GOOGLE_DEFAULT_ENCRYPTION" - } } diff --git a/mmv1/templates/terraform/examples/workbench_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/workbench_instance_full.tf.tmpl index 97f8ee97306e..2252af59b8e1 100644 --- a/mmv1/templates/terraform/examples/workbench_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/workbench_instance_full.tf.tmpl @@ -88,6 +88,4 @@ resource "google_workbench_instance" "{{$.PrimaryResourceId}}" { desired_state = "ACTIVE" - enable_third_party_identity = "true" - } diff --git a/mmv1/templates/terraform/examples/workflow_tags.tf.tmpl b/mmv1/templates/terraform/examples/workflow_tags.tf.tmpl deleted file mode 100644 index 6588d1431122..000000000000 --- a/mmv1/templates/terraform/examples/workflow_tags.tf.tmpl +++ /dev/null @@ -1,56 +0,0 @@ -data "google_project" "project" { -} - -resource "google_tags_tag_key" "tag_key" { - parent = "projects/${data.google_project.project.number}" - short_name = "{{index $.Vars "tag_key"}}" -} - -resource "google_tags_tag_value" "tag_value" { - parent = "tagKeys/${google_tags_tag_key.tag_key.name}" - short_name = "{{index $.Vars "tag_value"}}" -} - -resource "google_service_account" "test_account" { - account_id = "{{index $.Vars "account_id"}}" - display_name = "Test Service Account" -} - -resource "google_workflows_workflow" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - region = "us-central1" - description = "Magic" - service_account = google_service_account.test_account.id - deletion_protection = false - tags = { - "${data.google_project.project.project_id}/${google_tags_tag_key.tag_key.short_name}" = "${google_tags_tag_value.tag_value.short_name}" - } - source_contents = <<-EOF - # This is a sample workflow. You can replace it with your source code. - # - # This workflow does the following: - # - reads current time and date information from an external API and stores - # the response in currentTime variable - # - retrieves a list of Wikipedia articles related to the day of the week - # from currentTime - # - returns the list of articles as an output of the workflow - # - # Note: In Terraform you need to escape the $$ or it will cause errors. - - - getCurrentTime: - call: http.get - args: - url: $${sys.get_env("url")} - result: currentTime - - readWikipedia: - call: http.get - args: - url: https://en.wikipedia.org/w/api.php - query: - action: opensearch - search: $${currentTime.body.dayOfWeek} - result: wikiResult - - returnOutput: - return: $${wikiResult.body[1]} -EOF -} diff --git a/mmv1/templates/terraform/iam/example_config_body/colab_runtime_template.tf.tmpl b/mmv1/templates/terraform/iam/example_config_body/colab_runtime_template.tf.tmpl deleted file mode 100644 index 87f2de1d25c3..000000000000 --- a/mmv1/templates/terraform/iam/example_config_body/colab_runtime_template.tf.tmpl +++ /dev/null @@ -1,4 +0,0 @@ - - project = google_colab_runtime_template.runtime-template.project - location = google_colab_runtime_template.runtime-template.location - runtime_template = google_colab_runtime_template.runtime-template.name diff --git a/mmv1/templates/terraform/iam/iam_test_setup.go.tmpl b/mmv1/templates/terraform/iam/iam_context.go.tmpl similarity index 79% rename from mmv1/templates/terraform/iam/iam_test_setup.go.tmpl rename to mmv1/templates/terraform/iam/iam_context.go.tmpl index f23475337407..61df201660dd 100644 --- a/mmv1/templates/terraform/iam/iam_test_setup.go.tmpl +++ b/mmv1/templates/terraform/iam/iam_context.go.tmpl @@ -1,14 +1,4 @@ -{{- define "IamTestSetup" }} -{{- if $.FirstTestExample.BootstrapIam }} - acctest.BootstrapIamMembers(t, []acctest.IamMember{ -{{- range $iam := $.FirstTestExample.BootstrapIam }} - { - Member: "{{$iam.Member}}", - Role: "{{$iam.Role}}", - }, -{{- end}} - }) -{{- end }} +{{- define "IamContext" }} context := map[string]interface{}{ "random_suffix": acctest.RandString(t, 10), "role": "{{ $.IamPolicy.AllowedIamRole }}", diff --git a/mmv1/templates/terraform/metadata.yaml.tmpl b/mmv1/templates/terraform/metadata.yaml.tmpl index 2fb1b87ae05a..ffac5599d054 100644 --- a/mmv1/templates/terraform/metadata.yaml.tmpl +++ b/mmv1/templates/terraform/metadata.yaml.tmpl @@ -1,19 +1,5 @@ resource: '{{ $.TerraformName }}' generation_type: 'mmv1' -source_file: '{{ $.SourceYamlFile }}' api_service_name: '{{ $.ProductMetadata.ServiceName }}' api_version: '{{ or $.ProductMetadata.ServiceVersion $.ServiceVersion }}' api_resource_type_kind: '{{ or $.ApiResourceTypeKind $.Name }}' -{{- if $.AutogenStatus }} -autogen_status: true -{{- end }} -fields: -{{- range $p := $.LeafProperties }} - - field: '{{ $p.MetadataLineage }}' - {{- if and (ne $p.MetadataLineage $p.MetadataApiLineage) (not $p.ProviderOnly) }} - api_field: '{{ $p.MetadataApiLineage }}' - {{- end }} - {{- if $p.ProviderOnly }} - provider_only: true - {{- end }} -{{- end }} diff --git a/mmv1/templates/terraform/post_create/analytics_hub_subscription.go.tmpl b/mmv1/templates/terraform/post_create/analytics_hub_subscription.go.tmpl deleted file mode 100644 index 808fd5657fa2..000000000000 --- a/mmv1/templates/terraform/post_create/analytics_hub_subscription.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -subscription, ok := res["subscription"] -if ok { - name, nok := subscription.(map[string]interface{})["name"] - if nok { - parts := strings.Split(name.(string), "/") - d.SetId(name.(string)) - d.Set("name", name.(string)) - d.Set("subscription_id", parts[5]) - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/chronicle_retrohunt_id.go.tmpl b/mmv1/templates/terraform/post_create/chronicle_retrohunt_id.go.tmpl deleted file mode 100644 index 92cd2f00239f..000000000000 --- a/mmv1/templates/terraform/post_create/chronicle_retrohunt_id.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -metadata := res["metadata"].(map[string]interface{}) -retrohunt := metadata["retrohunt"].(string) -parts := strings.Split(retrohunt, "/") -retrohunt_id := parts[len(parts)-1] - -log.Printf("[DEBUG] Setting retrohunt id to %s", retrohunt_id) - -// retrohunt value is set by API response and required to GET the connection -// it is set by extracting id from the "retrohunt" field in the response metadata rather than a field in the response -if err := d.Set("retrohunt", retrohunt_id); err != nil { - return fmt.Errorf("Error reading Retrohunt ID: %s", err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/chronicle_rule_id.go.tmpl b/mmv1/templates/terraform/post_create/chronicle_rule_id.go.tmpl deleted file mode 100644 index 2eca96b0ce5e..000000000000 --- a/mmv1/templates/terraform/post_create/chronicle_rule_id.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -// Rule id is set by API and required to GET the connection -// it is set by reading the "name" field rather than a field in the response -if err := d.Set("rule_id", flattenChronicleRuleRuleId("", d, config)); err != nil { - return fmt.Errorf("Error reading Rule ID: %s", err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/colab_notebook_execution.go.tmpl b/mmv1/templates/terraform/post_create/colab_notebook_execution.go.tmpl deleted file mode 100644 index ce20d5ed80f0..000000000000 --- a/mmv1/templates/terraform/post_create/colab_notebook_execution.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -// The operation for this resource contains the generated name that we need -// in order to perform a READ. - -operationName, _ := res["name"].(string) -parts := strings.Split(operationName, "/") -parts[1] = project -longName := strings.Join(parts[:len(parts)-2], "/") -shortId := tpgresource.GetResourceNameFromSelfLink(longName) - -log.Printf("[DEBUG] Setting notebook execution job id to %s", shortId) -if err := d.Set("notebook_execution_job_id", shortId); err != nil { - return fmt.Errorf("Error setting id: %s", err) -} - -log.Printf("[DEBUG] Setting resource id to %s", longName) -d.SetId(longName) diff --git a/mmv1/templates/terraform/post_create/colab_runtime.go.tmpl b/mmv1/templates/terraform/post_create/colab_runtime.go.tmpl deleted file mode 100644 index d6675db2b3ef..000000000000 --- a/mmv1/templates/terraform/post_create/colab_runtime.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -if p, ok := d.GetOk("desired_state"); ok && p.(string) == "STOPPED" { - if err := ModifyColabRuntime(config, d, project, billingProject, userAgent, "stop"); err != nil { - return err - } -} diff --git a/mmv1/templates/terraform/post_create/colab_runtime_template.go.tmpl b/mmv1/templates/terraform/post_create/colab_runtime_template.go.tmpl deleted file mode 100644 index 322c8de2d4eb..000000000000 --- a/mmv1/templates/terraform/post_create/colab_runtime_template.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -// The operation for this resource contains the generated name that we need -// in order to perform a READ. We need to access the object inside of it as -// a map[string]interface, so let's do that. - -resp := res["response"].(map[string]interface{}) -name := tpgresource.GetResourceNameFromSelfLink(resp["name"].(string)) -log.Printf("[DEBUG] Setting resource name to %s", name) -if err := d.Set("name", name); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} diff --git a/mmv1/templates/terraform/post_create/colab_schedule.go.tmpl b/mmv1/templates/terraform/post_create/colab_schedule.go.tmpl deleted file mode 100644 index a7b6748b995e..000000000000 --- a/mmv1/templates/terraform/post_create/colab_schedule.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -// The response for create request contains the generated name generated name that we need -// in order to perform a READ. We need to access the object inside of it as -// a map[string]interface, so let's do that. - -longName := res["name"].(string) -name := tpgresource.GetResourceNameFromSelfLink(longName) -log.Printf("[DEBUG] Setting resource name to %s", name) -if err := d.Set("name", name); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} - -parts := strings.Split(longName, "/") -parts[1] = project -updatedLongName := strings.Join(parts, "/") -d.SetId(updatedLongName) - -if p, ok := d.GetOk("desired_state"); ok && p.(string) == "PAUSED" { - _, err := modifyScheduleState(config, d, project, billingProject, userAgent, "pause") - if err != nil { - return err - } -} diff --git a/mmv1/templates/terraform/post_create/compute_firewall_policy.go.tmpl b/mmv1/templates/terraform/post_create/compute_firewall_policy.go.tmpl deleted file mode 100644 index c1e28eed2fd1..000000000000 --- a/mmv1/templates/terraform/post_create/compute_firewall_policy.go.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, d.Get("parent").(string), "FirewallPolicy operation", userAgent, - d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually create - d.SetId("") - return fmt.Errorf("Error waiting to create FirewallPolicy: %s", err) -} - -firewallPolicyId, ok := opRes["targetId"] -if !ok { - return fmt.Errorf("Create response didn't contain targetId. Create may not have succeeded.") -} -if err := d.Set("name", firewallPolicyId.(string)); err != nil { - return fmt.Errorf(`Error setting computed identity field "name": %s`, err) -} - -// Store the ID now -id, err = tpgresource.ReplaceVars(d, config, "locations/global/firewallPolicies/{{"{{"}}name{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) diff --git a/mmv1/templates/terraform/post_create/interconnect_attachment.go.tmpl b/mmv1/templates/terraform/post_create/interconnect_attachment.go.tmpl index 6b3b0459d63c..03e41d0e5da3 100644 --- a/mmv1/templates/terraform/post_create/interconnect_attachment.go.tmpl +++ b/mmv1/templates/terraform/post_create/interconnect_attachment.go.tmpl @@ -1,72 +1,3 @@ - -{{- if $.HasLabelsField }} -if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) { - labels := d.Get("labels") - terraformLables := d.Get("terraform_labels") - - // Labels cannot be set in a create. We'll have to set them here. - err = resource{{$.ResourceName}}Read(d, meta) - if err != nil { - return err - } - - obj := make(map[string]interface{}) - // d.Get("effective_labels") will have been overridden by the Read call. - labelsProp, err := expand{{$.ResourceName}}EffectiveLabels(v, d, config) - if err != nil { - return err - } - obj["labels"] = labelsProp - labelFingerprintProp := d.Get("label_fingerprint") - obj["labelFingerprint"] = labelFingerprintProp - - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.SelfLinkUri}}/setLabels") - if err != nil { - return err - } - res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - {{- if $.ErrorRetryPredicates }} - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorRetryPredicates "," -}} }, - {{- end }} - {{- if $.ErrorAbortPredicates }} - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorAbortPredicates "," -}} }, - {{- end }} - }) - if err != nil { - return fmt.Errorf("Error adding labels to {{$.ResourceName}} %q: %s", d.Id(), err) - } - - err = ComputeOperationWaitTime( - config, res, project, "Updating {{$.ResourceName}} Labels", userAgent, - d.Timeout(schema.TimeoutUpdate)) - - if err != nil { - return err - } - - // Set back the labels field, as it is needed to decide the value of "labels" in the state in the read function. - if err := d.Set("labels", labels); err != nil { - return fmt.Errorf("Error setting back labels: %s", err) - } - - // Set back the terraform_labels field, as it is needed to decide the value of "terraform_labels" in the state in the read function. - if err := d.Set("terraform_labels", terraformLables); err != nil { - return fmt.Errorf("Error setting back terraform_labels: %s", err) - } - - // Set back the effective_labels field, as it is needed to decide the value of "effective_labels" in the state in the read function. - if err := d.Set("effective_labels", v); err != nil { - return fmt.Errorf("Error setting back effective_labels: %s", err) - } -} -{{- end }} - if err := waitForAttachmentToBeProvisioned(d, config, d.Timeout(schema.TimeoutCreate)); err != nil { return fmt.Errorf("Error waiting for InterconnectAttachment %q to be provisioned: %q", d.Get("name").(string), err) -} \ No newline at end of file +} diff --git a/mmv1/templates/terraform/post_import/analytics_hub_subscription.go.tmpl b/mmv1/templates/terraform/post_import/analytics_hub_subscription.go.tmpl deleted file mode 100644 index 9df619a5f5e9..000000000000 --- a/mmv1/templates/terraform/post_import/analytics_hub_subscription.go.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) -if err != nil { - return nil, err -} - -projectNumber := d.Get("project").(string) -resourceManager := config.NewResourceManagerV3Client(userAgent) -projectData, err := resourceManager.Projects.Get("projects/" + d.Get("project").(string)).Do() -if err != nil { - return nil, err -} - -d.Set("project", projectData.ProjectId) - -id = fmt.Sprintf("projects/%s/locations/%s/subscriptions/%s", - projectNumber, - d.Get("location"), - d.Get("subscription_id")) - -d.SetId(id) -d.Set("name", id) \ No newline at end of file diff --git a/mmv1/templates/terraform/post_read/access_context_manager_service_perimeter_dry_run_resource.go.tmpl b/mmv1/templates/terraform/post_read/access_context_manager_service_perimeter_dry_run_resource.go.tmpl deleted file mode 100644 index 604943035925..000000000000 --- a/mmv1/templates/terraform/post_read/access_context_manager_service_perimeter_dry_run_resource.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := d.Set("etag", res["etag"]); err != nil { - log.Printf("[ERROR] Unable to set etag: %s", err) -} diff --git a/mmv1/templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl b/mmv1/templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl index 604943035925..435627a95a32 100644 --- a/mmv1/templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl +++ b/mmv1/templates/terraform/post_read/access_context_manager_service_perimeter_resource.go.tmpl @@ -1,3 +1,4 @@ -if err := d.Set("etag", res["etag"]); err != nil { - log.Printf("[ERROR] Unable to set etag: %s", err) -} +// post_read template for access_context_manager_service_perimeter_resource + +// this is a placeholder for now but in the future we can use this to access +// the etag from the read response \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/colab_schedule.go.tmpl b/mmv1/templates/terraform/post_update/colab_schedule.go.tmpl deleted file mode 100644 index 87a2d361234f..000000000000 --- a/mmv1/templates/terraform/post_update/colab_schedule.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -name := d.Get("name").(string) -state := d.Get("state").(string) -desired_state := d.Get("desired_state").(string) - -if desired_state != "" && state != desired_state { - var verb string - - switch desired_state { - case "PAUSED": - verb = "pause" - case "ACTIVE": - verb = "resume" - default: - return fmt.Errorf("desired_state has to be ACTIVE or PAUSED") - } - - _, err := modifyScheduleState(config, d, project, billingProject, userAgent, verb) - if err != nil { - return err - } - -} else { - log.Printf("[DEBUG] Colab Schedule %q has state %q.", name, state) -} diff --git a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl b/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl deleted file mode 100644 index 3e0f41e3b155..000000000000 --- a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -obj["use_explicit_dry_run_spec"] = true - -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"spec.egressPolicies", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl b/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl deleted file mode 100644 index faa53f2ce2c0..000000000000 --- a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -obj["use_explicit_dry_run_spec"] = true - -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"spec.ingressPolicies", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl b/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl index 27a13230c8d3..7e9f036c027b 100644 --- a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl +++ b/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl @@ -1,17 +1 @@ obj["use_explicit_dry_run_spec"] = true - -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"spec.resources", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_egress_policy.go.tmpl b/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_egress_policy.go.tmpl deleted file mode 100644 index b52b832985d0..000000000000 --- a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_egress_policy.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"status.egressPolicies", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_ingress_policy.go.tmpl b/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_ingress_policy.go.tmpl deleted file mode 100644 index ae815f575dac..000000000000 --- a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_ingress_policy.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"status.ingressPolicies", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_resource.go.tmpl b/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_resource.go.tmpl deleted file mode 100644 index cf2573f91792..000000000000 --- a/mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_resource.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"status.resources", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/bigquery_analyticshub_subscription.tmpl b/mmv1/templates/terraform/pre_create/bigquery_analyticshub_subscription.tmpl deleted file mode 100644 index de25e06d902c..000000000000 --- a/mmv1/templates/terraform/pre_create/bigquery_analyticshub_subscription.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -// check if this is a listing subscription instead of a data exchange subscription -if _, ok := d.GetOk("listing_id"); ok { - url, err = tpgresource.ReplaceVars(d, config, "{{BigqueryAnalyticsHubBasePath}}projects/{{project}}/locations/{{location}}/dataExchanges/{{data_exchange_id}}/listings/{{listing_id}}:subscribe") - if err != nil { - return err - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/compute_global_forwarding_rule.go.tmpl b/mmv1/templates/terraform/pre_create/compute_global_forwarding_rule.go.tmpl deleted file mode 100644 index 9ec43f36becd..000000000000 --- a/mmv1/templates/terraform/pre_create/compute_global_forwarding_rule.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Labels cannot be set in a create for PSC forwarding rules, so remove it from the CREATE request. -if strings.Contains(targetProp.(string), "/serviceAttachments/") || - targetProp.(string) == "all-apis" || - targetProp.(string) == "vpc-sc" { - if _, ok := obj["labels"]; ok { - delete(obj, "labels") - } -} diff --git a/mmv1/templates/terraform/pre_create/parameter_manager_regional_parameter_version.go.tmpl b/mmv1/templates/terraform/pre_create/parameter_manager_regional_parameter_version.go.tmpl deleted file mode 100644 index 953eb8e55f06..000000000000 --- a/mmv1/templates/terraform/pre_create/parameter_manager_regional_parameter_version.go.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -{{/* - The license inside this block applies to this file - 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. -*/ -}} -parameter := d.Get("parameter").(string) -parameterRegex := regexp.MustCompile("projects/(.+)/locations/(.+)/parameters/(.+)$") - -parts := parameterRegex.FindStringSubmatch(parameter) -if len(parts) != 4 { - return fmt.Errorf("parameter does not fit the format `projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/parameters/{{"{{"}}parameter{{"}}"}}`") -} - -if err := d.Set("location", parts[2]); err!=nil { - return fmt.Errorf("Error setting location: %s", err) -} - -// Override the url after setting the location -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ParameterManagerRegionalBasePath{{"}}"}}{{"{{"}}parameter{{"}}"}}/versions?parameter_version_id={{"{{"}}parameter_version_id{{"}}"}}") -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl deleted file mode 100644 index 3e0f41e3b155..000000000000 --- a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -obj["use_explicit_dry_run_spec"] = true - -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"spec.egressPolicies", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl deleted file mode 100644 index faa53f2ce2c0..000000000000 --- a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -obj["use_explicit_dry_run_spec"] = true - -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"spec.ingressPolicies", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_egress_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_egress_policy.go.tmpl deleted file mode 100644 index b52b832985d0..000000000000 --- a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_egress_policy.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"status.egressPolicies", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_ingress_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_ingress_policy.go.tmpl deleted file mode 100644 index ae815f575dac..000000000000 --- a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_ingress_policy.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"status.ingressPolicies", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_resource.go.tmpl b/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_resource.go.tmpl deleted file mode 100644 index cf2573f91792..000000000000 --- a/mmv1/templates/terraform/pre_delete/access_context_manager_service_perimeter_resource.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -etag := d.Get("etag").(string) - -if etag == "" { - log.Printf("[ERROR] Unable to get etag: %s", err) - return nil -} -obj["etag"] = etag - -// updateMask is a URL parameter but not present in the schema, so ReplaceVars -// won't set it -updateMask := []string{"status.resources", "etag"} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/chronicle_rule.go.tmpl b/mmv1/templates/terraform/pre_delete/chronicle_rule.go.tmpl deleted file mode 100644 index 9b99b3132a51..000000000000 --- a/mmv1/templates/terraform/pre_delete/chronicle_rule.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// Forcefully delete any retrohunts and any detections associated with the rule. -if deletionPolicy := d.Get("deletion_policy"); deletionPolicy == "FORCE" { - url = url + "?force=true" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/code_repository_index_force_delete.go.tmpl b/mmv1/templates/terraform/pre_delete/code_repository_index_force_delete.go.tmpl deleted file mode 100644 index 86a1aa3742dd..000000000000 --- a/mmv1/templates/terraform/pre_delete/code_repository_index_force_delete.go.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -obj = make(map[string]interface{}) -if v, ok := d.GetOk("force_destroy"); ok { - if v == true { - obj["force"] = true - } -} diff --git a/mmv1/templates/terraform/pre_delete/compute_resource_policy_attachment.go.tmpl b/mmv1/templates/terraform/pre_delete/compute_resource_policy_attachment.go.tmpl new file mode 100644 index 000000000000..abde916b9a4a --- /dev/null +++ b/mmv1/templates/terraform/pre_delete/compute_resource_policy_attachment.go.tmpl @@ -0,0 +1,21 @@ +obj = make(map[string]interface{}) + +zone, err := tpgresource.GetZone(d, config) +if err != nil { + return err +} + +region := tpgresource.GetRegionFromZone(zone) +if region == "" { + return fmt.Errorf("invalid zone %q", zone) +} + +name, err := expandNestedComputeDiskResourcePolicyAttachmentName(d.Get("name"), d, config) +if err != nil { + return err +} + +obj["resourcePolicies"] = []interface{}{ + fmt.Sprintf("projects/%s/regions/%s/resourcePolicies/%s", project, region, name), +} +return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/firebasedataconnect_service.go.tmpl b/mmv1/templates/terraform/pre_delete/firebasedataconnect_service.go.tmpl deleted file mode 100644 index 4a01836a8765..000000000000 --- a/mmv1/templates/terraform/pre_delete/firebasedataconnect_service.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// Forcefully delete Schema and Connectors associated with the Service. -if deletionPolicy := d.Get("deletion_policy"); deletionPolicy == "FORCE" { - url = url + "?force=true" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/spanner_instance.go.tmpl b/mmv1/templates/terraform/pre_delete/spanner_instance.go.tmpl index 05f79d06927a..c4319d1d2ad8 100644 --- a/mmv1/templates/terraform/pre_delete/spanner_instance.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/spanner_instance.go.tmpl @@ -17,8 +17,8 @@ if d.Get("force_destroy").(bool) { return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("SpannerInstance %q", d.Id())) } - err = deleteSpannerBackups(d, config, resp, userAgent, billingProject) + err = deleteSpannerBackups(d, config, resp, billingProject, userAgent) if err != nil { return err } -} +} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/alloydb_cluster.go.tmpl b/mmv1/templates/terraform/pre_update/alloydb_cluster.go.tmpl index 64265f6ce6e7..dcbd075fb019 100644 --- a/mmv1/templates/terraform/pre_update/alloydb_cluster.go.tmpl +++ b/mmv1/templates/terraform/pre_update/alloydb_cluster.go.tmpl @@ -1,66 +1,3 @@ -//{{- if ne $.TargetVersionName "ga" }} - -// Implementation for cluster upgrade -if d.HasChange("database_version") && !tpgresource.IsEmptyValue(reflect.ValueOf(d.Get("database_version"))) { - upgradeUrl := strings.Split(url, "?updateMask")[0] + ":upgrade" - patchObj := make(map[string]interface{}) - patchObj["version"] = obj["databaseVersion"] - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - upgradeClusterTimeout := 58 * time.Hour - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: billingProject, - RawURL: upgradeUrl, - UserAgent: userAgent, - Body: patchObj, - Timeout: upgradeClusterTimeout, - }) - if err != nil { - return fmt.Errorf("Error upgrading cluster: %v", err) - } - log.Printf("[DEBUG] Started upgrading cluster %q: %#v", d.Id(), res) - // Remove databaseVersion from the object so that it is not considered again for updating the cluster - delete(obj, "databaseVersion") - - index := 0 - for _, label := range updateMask { - if label != "databaseVersion" { - updateMask[index] = label - index++ - } - } - updateMask = updateMask[:index] - - // Update url with the new updateMask - url := strings.Split(url, "?updateMask=")[0] - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) - if err != nil { - return err - } - - if d.Get("skip_await_major_version_upgrade") == false { - err = AlloydbOperationWaitTime( - config, res, project, "Upgrading cluster", userAgent, - upgradeClusterTimeout) - - if err != nil { - return fmt.Errorf("Error waiting to upgrade cluster: %s", err) - } - - log.Printf("[DEBUG] Finished upgrading cluster %q: %#v", d.Id(), res) - } -} - -//{{- end }} - - - - - // Restrict setting secondary_config if cluster_type is PRIMARY if d.Get("cluster_type") == "PRIMARY" && !tpgresource.IsEmptyValue(reflect.ValueOf(d.Get("secondary_config"))) { return fmt.Errorf("Can not set secondary config for primary cluster.") diff --git a/mmv1/templates/terraform/pre_update/network_services_gateway.go.tmpl b/mmv1/templates/terraform/pre_update/network_services_gateway.go.tmpl new file mode 100644 index 000000000000..3f976f267b19 --- /dev/null +++ b/mmv1/templates/terraform/pre_update/network_services_gateway.go.tmpl @@ -0,0 +1,5 @@ +if d.Get("type") == "SECURE_WEB_GATEWAY" { + obj["name"] = d.Get("name") + obj["type"] = d.Get("type") + obj["routingMode"] = d.Get("routingMode") +} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/workbench_instance.go.tmpl b/mmv1/templates/terraform/pre_update/workbench_instance.go.tmpl index 4209b13b9853..f33e2afefa96 100644 --- a/mmv1/templates/terraform/pre_update/workbench_instance.go.tmpl +++ b/mmv1/templates/terraform/pre_update/workbench_instance.go.tmpl @@ -27,10 +27,6 @@ if d.HasChange("gce_setup.0.metadata") { if d.HasChange("effective_labels") { newUpdateMask = append(newUpdateMask, "labels") } -if d.HasChange("gce_setup.0.container_image") { - newUpdateMask = append(newUpdateMask, "gce_setup.container_image") - stopInstance = true -} updateMask = newUpdateMask // Overwrite the previously set mask. url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(newUpdateMask, ",")}) @@ -42,19 +38,7 @@ if d.HasChange("effective_labels") { old_labels_interface, new_labels_interface := d.GetChange("effective_labels") old_labels := old_labels_interface.(map[string]interface{}) new_labels := new_labels_interface.(map[string]interface{}) - obj["labels"] = mergeMaps(old_labels,new_labels) -} - -if d.HasChange("gce_setup.0.metadata") { - old_metadata_interface, new_metadata_interface := d.GetChange("gce_setup.0.metadata") - old_metadata := old_metadata_interface.(map[string]interface{}) - new_metadata := new_metadata_interface.(map[string]interface{}) - - gceSetup, exists := obj["gceSetup"] - if !exists { - return fmt.Errorf("gceSetup cannot be empty") - } - gceSetup.(map[string]interface{})["metadata"] = mergeMaps(old_metadata,new_metadata) + obj["labels"] = mergeLabels(old_labels,new_labels) } name := d.Get("name").(string) diff --git a/mmv1/templates/terraform/resource.go.tmpl b/mmv1/templates/terraform/resource.go.tmpl index 7751309e81d4..73c2d18e467a 100644 --- a/mmv1/templates/terraform/resource.go.tmpl +++ b/mmv1/templates/terraform/resource.go.tmpl @@ -314,8 +314,8 @@ func resource{{ $.ResourceName -}}Create(d *schema.ResourceData, meta interface{ d.SetId(id) {{if and $.GetAsync ($.GetAsync.Allow "Create") -}} -{{ if ($.GetAsync.IsA "OpAsync") -}} -{{ if and $.GetAsync.Result.ResourceInsideResponse $.GetIdentity -}} +{{if ($.GetAsync.IsA "OpAsync") -}} +{{if and $.GetAsync.Result.ResourceInsideResponse $.GetIdentity -}} // Use the resource in the operation response to populate // identity fields and d.Id() before read var opRes map[string]interface{} @@ -330,7 +330,7 @@ func resource{{ $.ResourceName -}}Create(d *schema.ResourceData, meta interface{ // The resource didn't actually create d.SetId("") -{{ end -}} +{{ end -}} return fmt.Errorf("Error waiting to create {{ $.Name -}}: %s", err) } @@ -390,8 +390,8 @@ func resource{{ $.ResourceName -}}Create(d *schema.ResourceData, meta interface{ } {{ end -}} -{{ end -}}{{/*if ($.GetAsync.IsA "OpAsync")*/}} -{{ end -}}{{/*if and $.GetAsync ($.GetAsync.Allow "Create")*/}} +{{ end -}} +{{ end -}} {{if $.CustomCode.PostCreate -}} {{- $.CustomTemplate $.CustomCode.PostCreate false -}} {{- end}} diff --git a/mmv1/templates/terraform/resource_iam.html.markdown.erb b/mmv1/templates/terraform/resource_iam.html.markdown.erb new file mode 100644 index 000000000000..4671f132bea2 --- /dev/null +++ b/mmv1/templates/terraform/resource_iam.html.markdown.erb @@ -0,0 +1,324 @@ +<%- # the license inside this block applies to this file +# Copyright 2017 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. +-%> +<%# NOTE NOTE NOTE + The newlines in this file are *load bearing*. This file outputs + Markdown, which is extremely sensitive to newlines. You have got + to have a newline after every attribute and property, because + otherwise MD will think the next element is part of the previous + property's bullet point. You cannot have any double newlines in the + middle of a property or attribute, because MD will think that the + empty line ends the bullet point and the indentation will be off. + You must have a newline before and after all --- document indicators, + and you must have a newline before and after all - - - hlines. + You cannot have more than one blank line between properties. + The --- document indicator must be the first line of the file. + As long as you only use `build_property_documentation`, it all works + fine - but when you need to add custom docs (notes, etc), you need + to remember these things. + + Know also that the `lines` function in heavy use in MagicModules will + strip exactly one trailing newline - unless that's what you've designed + your docstring for, it's easier to insert newlines where you need them + manually. That's why, in this file, we use `lines` on anything which + is generated from a ruby function, but skip it on anything that is + directly inserted from YAML. +-%> +<% + tf_product = (object.__product.legacy_name || object.__product.name ).underscore + product_ns_display = (object.__product.legacy_name || object.__product.name ).camelize + tf_subcategory = (object.__product.display_name) + resource_ns = object.legacy_name || "google_#{tf_product}_#{object.name.underscore}" + resource_ns_iam = "#{resource_ns}_iam" + properties = object.all_user_properties + + # In order of preference, use TF override, + # general defined timeouts, or default Timeouts + timeouts = object.timeouts + timeouts ||= object&.async&.operation&.timeouts + timeouts ||= Api::Timeouts.new +-%> +--- +<%= lines(autogen_notice(:yaml, pwd)) -%> +subcategory: "<%= tf_subcategory -%>" +description: |- + Collection of resources to manage IAM policy for <%= product.display_name -%> <%= object.name %> +--- + +# IAM policy for <%= product.display_name -%> <%= object.name %> +Three different resources help you manage your IAM policy for <%= product.display_name -%> <%= object.name -%>. Each of these resources serves a different use case: + +* `<%= resource_ns_iam -%>_policy`: Authoritative. Sets the IAM policy for the <%= object.name.downcase -%> and replaces any existing policy already attached. +* `<%= resource_ns_iam -%>_binding`: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the <%= object.name.downcase -%> are preserved. +* `<%= resource_ns_iam -%>_member`: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the <%= object.name.downcase -%> are preserved. + +A data source can be used to retrieve policy data in advent you do not need creation + +* `<%= resource_ns_iam -%>_policy`: Retrieves the IAM policy for the <%= object.name.downcase %> + +~> **Note:** `<%= resource_ns_iam -%>_policy` **cannot** be used in conjunction with `<%= resource_ns_iam -%>_binding` and `<%= resource_ns_iam -%>_member` or they will fight over what your policy should be. + +~> **Note:** `<%= resource_ns_iam -%>_binding` resources **can be** used in conjunction with `<%= resource_ns_iam -%>_member` resources **only if** they do not grant privilege to the same role. + +<% unless object.iam_policy.iam_conditions_request_type.nil? -%> +~> **Note:** This resource supports IAM Conditions but they have some known limitations which can be found [here](https://cloud.google.com/iam/docs/conditions-overview#limitations). Please review this article if you are having issues with IAM Conditions. +<% end -%> + +<% if object.min_version.name == 'beta' || object.iam_policy&.min_version == 'beta' -%> +~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. +See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. +<% end -%> + +<% params = extract_identifiers(object.iam_policy.self_link || object.self_link_url) -%> +<% +url_properties = object.all_user_properties.select do + |param| params.include?(param.name) +end +-%> +## <%= resource_ns_iam -%>_policy + +```hcl +data "google_iam_policy" "admin" { +<% if object.min_version.name == 'beta' -%> + provider = google-beta +<% end -%> + binding { + role = "<%= object.iam_policy.admin_iam_role || object.iam_policy.allowed_iam_role -%>" + members = [ + "user:jane@example.com", + ] + } +} + +resource "<%= resource_ns_iam -%>_policy" "policy" { +<% if object.min_version.name == 'beta' -%> + provider = google-beta +<% end -%> +<%= lines(compile(pwd + '/' + object.iam_policy.example_config_body)) -%> + policy_data = data.google_iam_policy.admin.policy_data +} +``` + +<% unless object.iam_policy.iam_conditions_request_type.nil? -%> +With IAM Conditions: + +```hcl +data "google_iam_policy" "admin" { +<% if object.min_version.name == 'beta' -%> + provider = google-beta +<% end -%> + binding { + role = "<%= object.iam_policy.admin_iam_role || object.iam_policy.allowed_iam_role -%>" + members = [ + "user:jane@example.com", + ] + + condition { + title = "expires_after_2019_12_31" + description = "Expiring at midnight of 2019-12-31" + expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")" + } + } +} + +resource "<%= resource_ns_iam -%>_policy" "policy" { +<% if object.min_version.name == 'beta' -%> + provider = google-beta +<% end -%> +<%= lines(compile(pwd + '/' + object.iam_policy.example_config_body)) -%> + policy_data = data.google_iam_policy.admin.policy_data +} +``` +<% end -%> +## <%= resource_ns_iam -%>_binding + +```hcl +resource "<%= resource_ns_iam -%>_binding" "binding" { +<% if object.min_version.name == 'beta' -%> + provider = google-beta +<% end -%> +<%= lines(compile(pwd + '/' + object.iam_policy.example_config_body)) -%> + role = "<%= object.iam_policy.admin_iam_role || object.iam_policy.allowed_iam_role -%>" + members = [ + "user:jane@example.com", + ] +} +``` + +<% unless object.iam_policy.iam_conditions_request_type.nil? -%> +With IAM Conditions: + +```hcl +resource "<%= resource_ns_iam -%>_binding" "binding" { +<% if object.min_version.name == 'beta' -%> + provider = google-beta +<% end -%> +<%= lines(compile(pwd + '/' + object.iam_policy.example_config_body)) -%> + role = "<%= object.iam_policy.admin_iam_role || object.iam_policy.allowed_iam_role -%>" + members = [ + "user:jane@example.com", + ] + + condition { + title = "expires_after_2019_12_31" + description = "Expiring at midnight of 2019-12-31" + expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")" + } +} +``` +<% end -%> +## <%= resource_ns_iam -%>_member + +```hcl +resource "<%= resource_ns_iam -%>_member" "member" { +<% if object.min_version.name == 'beta' -%> + provider = google-beta +<% end -%> +<%= lines(compile(pwd + '/' + object.iam_policy.example_config_body)) -%> + role = "<%= object.iam_policy.admin_iam_role || object.iam_policy.allowed_iam_role -%>" + member = "user:jane@example.com" +} +``` + +<% unless object.iam_policy.iam_conditions_request_type.nil? -%> +With IAM Conditions: + +```hcl +resource "<%= resource_ns_iam -%>_member" "member" { +<% if object.min_version.name == 'beta' -%> + provider = google-beta +<% end -%> +<%= lines(compile(pwd + '/' + object.iam_policy.example_config_body)) -%> + role = "<%= object.iam_policy.admin_iam_role || object.iam_policy.allowed_iam_role -%>" + member = "user:jane@example.com" + + condition { + title = "expires_after_2019_12_31" + description = "Expiring at midnight of 2019-12-31" + expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")" + } +} +``` +<% end -%> + +## Argument Reference + +The following arguments are supported: + +<% url_properties.each do |param| -%> +<% if param.name == "name" -%> +* `<%= object.iam_policy.parent_resource_attribute || object.name.underscore -%>` - (Required) Used to find the parent resource to bind the IAM policy to +<% elsif ["location", "region", "zone"].include?(param.name.underscore) -%> +* `<%= param.name.underscore -%>` - (Optional) <%= param.description -%> Used to find the parent resource to bind the IAM policy to. If not specified, + the value will be parsed from the identifier of the parent resource. If no <%= param.name.underscore -%> is provided in the parent identifier and no + <%= param.name.underscore -%> is specified, it is taken from the provider configuration. +<% else -%> +* `<%= param.name.underscore -%>` - (Required) <%= param.description -%> Used to find the parent resource to bind the IAM policy to +<% end -%> +<% end -%> +<% if !object.iam_policy.base_url.nil? -%> +<% if object.iam_policy.base_url.include?("{{project}}") -%> +<%# The following new line allow for project to be bullet-formatted properly. -%> + +* `project` - (Optional) The ID of the project in which the resource belongs. + If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used. +<% end -%> +<% elsif object.base_url.include?("{{project}}")-%> +<%# The following new line allow for project to be bullet-formatted properly. -%> + +* `project` - (Optional) The ID of the project in which the resource belongs. + If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used. +<% end -%> + +* `member/members` - (Required) Identities that will be granted the privilege in `role`. + Each entry can have one of the following values: + * **allUsers**: A special identifier that represents anyone who is on the internet; with or without a Google account. + * **allAuthenticatedUsers**: A special identifier that represents anyone who is authenticated with a Google account or a service account. + * **user:{emailid}**: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com. + * **serviceAccount:{emailid}**: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com. + * **group:{emailid}**: An email address that represents a Google group. For example, admins@example.com. + * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com. + * **projectOwner:projectid**: Owners of the given project. For example, "projectOwner:my-example-project" + * **projectEditor:projectid**: Editors of the given project. For example, "projectEditor:my-example-project" + * **projectViewer:projectid**: Viewers of the given project. For example, "projectViewer:my-example-project" + +* `role` - (Required) The role that should be applied. Only one + `<%= resource_ns_iam -%>_binding` can be used per role. Note that custom roles must be of the format + `[projects|organizations]/{parent-name}/roles/{role-name}`. + +* `policy_data` - (Required only by `<%= resource_ns_iam -%>_policy`) The policy data generated by + a `google_iam_policy` data source. + +<% unless object.iam_policy.iam_conditions_request_type.nil? -%> +* `condition` - (Optional) An [IAM Condition](https://cloud.google.com/iam/docs/conditions-overview) for a given binding. + Structure is documented below. + +--- + +The `condition` block supports: + +* `expression` - (Required) Textual representation of an expression in Common Expression Language syntax. + +* `title` - (Required) A title for the expression, i.e. a short string describing its purpose. + +* `description` - (Optional) An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. + +~> **Warning:** Terraform considers the `role` and condition contents (`title`+`description`+`expression`) as the + identifier for the binding. This means that if any part of the condition is changed out-of-band, Terraform will + consider it to be an entirely different resource and will treat it as such. +<% end -%> +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are +exported: + +* `etag` - (Computed) The etag of the IAM policy. + +## Import + +For all import syntaxes, the "resource in question" can take any of the following forms: +<% import_format = object.iam_policy.import_format || object.import_format -%> +<% all_formats = import_id_formats(import_format, object.identity, object.base_url).map{ |id| id.gsub('%', '') } -%> + +<% all_formats.each do |id_format| -%> +* <%= id_format %> +<% end -%> + +Any variables not passed in the import command will be taken from the provider configuration. + +<%= product.display_name -%> <%= object.name.downcase -%> IAM resources can be imported using the resource identifiers, role, and member. + +IAM member imports use space-delimited identifiers: the resource in question, the role, and the member identity, e.g. +``` +$ terraform import <%= resource_ns_iam -%>_member.editor "<%= all_formats.first.gsub('{{name}}', "{{#{object.name.underscore}}}") -%> <%= object.iam_policy.allowed_iam_role -%> user:jane@example.com" +``` + +IAM binding imports use space-delimited identifiers: the resource in question and the role, e.g. +``` +$ terraform import <%= resource_ns_iam -%>_binding.editor "<%= all_formats.first.gsub('{{name}}', "{{#{object.name.underscore}}}") -%> <%= object.iam_policy.allowed_iam_role -%>" +``` + +IAM policy imports use the identifier of the resource in question, e.g. +``` +$ terraform import <%= resource_ns_iam -%>_policy.editor <%= all_formats.first.gsub('{{name}}', "{{#{object.name.underscore}}}") %> +``` + +-> **Custom Roles** If you're importing a IAM resource with a custom role, make sure to use the + full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`. + +<% if object.base_url.include?("{{project}}")-%> +## User Project Overrides + +This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). +<% end -%> diff --git a/mmv1/templates/terraform/state_migrations/network_services_mesh.go.tmpl b/mmv1/templates/terraform/state_migrations/network_services_mesh.go.tmpl deleted file mode 100644 index 263ac1e26c22..000000000000 --- a/mmv1/templates/terraform/state_migrations/network_services_mesh.go.tmpl +++ /dev/null @@ -1,98 +0,0 @@ -func resourceNetworkServicesMeshResourceV0() *schema.Resource { - return &schema.Resource{ - Create: resourceNetworkServicesMeshCreate, - Read: resourceNetworkServicesMeshRead, - Update: resourceNetworkServicesMeshUpdate, - Delete: resourceNetworkServicesMeshDelete, - - Importer: &schema.ResourceImporter{ - State: resourceNetworkServicesMeshImport, - }, - - Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(30 * time.Minute), - Update: schema.DefaultTimeout(30 * time.Minute), - Delete: schema.DefaultTimeout(30 * time.Minute), - }, - - CustomizeDiff: customdiff.All( - tpgresource.SetLabelsDiff, - tpgresource.DefaultProviderProject, - ), - - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: `Short name of the Mesh resource to be created.`, - }, - "description": { - Type: schema.TypeString, - Optional: true, - Description: `A free-text description of the resource. Max length 1024 characters.`, - }, - "interception_port": { - Type: schema.TypeInt, - Optional: true, - Description: `Optional. If set to a valid TCP port (1-65535), instructs the SIDECAR proxy to listen on the -specified port of localhost (127.0.0.1) address. The SIDECAR proxy will expect all traffic to -be redirected to this port regardless of its actual ip:port destination. If unset, a port -'15001' is used as the interception port. This will is applicable only for sidecar proxy -deployments.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - Description: `Set of label tags associated with the Mesh resource. - -**Note**: This field is non-authoritative, and will only manage the labels present in your configuration. -Please refer to the field 'effective_labels' for all of the labels present on the resource.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - Description: `Time the Mesh was created in UTC.`, - }, - "effective_labels": { - Type: schema.TypeMap, - Computed: true, - Description: `All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "self_link": { - Type: schema.TypeString, - Computed: true, - Description: `Server-defined URL of this resource.`, - }, - "terraform_labels": { - Type: schema.TypeMap, - Computed: true, - Description: `The combination of labels configured directly on the resource - and default labels configured on the provider.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "update_time": { - Type: schema.TypeString, - Computed: true, - Description: `Time the Mesh was updated in UTC.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceNetworkServicesMeshUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error){ - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - if _, ok := rawState["location"]; !ok { - rawState["location"] = "global" - } - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/sweeper_file.go.tmpl b/mmv1/templates/terraform/sweeper_file.go.tmpl index d6b237bd0be7..1dce3b881e2f 100644 --- a/mmv1/templates/terraform/sweeper_file.go.tmpl +++ b/mmv1/templates/terraform/sweeper_file.go.tmpl @@ -20,9 +20,6 @@ package {{ lower $.ProductMetadata.Name }} import ( "context" - {{- if not (or $.Sweeper.IdentifierField (contains $.DeleteUrlTemplate "_id")) }} - "fmt" - {{- end }} "log" "strings" "testing" @@ -37,210 +34,148 @@ func init() { sweeper.AddTestSweepers("{{ $.ResourceName }}", testSweep{{ $.ResourceName }}) } -func testSweep{{ $.ResourceName }}(_ string) error { - var deletionerror error +// At the time of writing, the CI only passes us-central1 as the region +func testSweep{{ $.ResourceName }}(region string) error { resourceName := "{{ $.ResourceName }}" log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s", resourceName) - {{- if $.Sweeper.URLSubstitutions }} - // Using URL substitutions for region/zone pairs - substitutions := []struct { - region string - zone string - }{ - {{- range $sub := $.Sweeper.URLSubstitutions }} - {region: "{{ $sub.Region }}", zone: "{{ $sub.Zone }}"}, - {{- end }} + config, err := sweeper.SharedConfigForRegion(region) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) + return err } - {{- else if $.Sweeper.Regions }} - // Falling back to regions since no URL substitutions are defined - regions := []string{ - {{- range $region := $.Sweeper.Regions }} - "{{ $region }}", - {{- end }} + + err = config.LoadAndValidate(context.Background()) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error loading: %s", err) + return err } - substitutions := make([]struct { - region string - zone string - }, len(regions)) - for i, region := range regions { - substitutions[i] = struct { - region string - zone string - }{ - region: region, - } + + t := &testing.T{} + billingId := envvar.GetTestBillingAccountFromEnv(t) + + // Setup variables to replace in list template + d := &tpgresource.ResourceDataMock{ + FieldsInSchema: map[string]interface{}{ + "project": config.Project, + "region": region, + "location": region, + "zone": "-", + "billing_account": billingId, + }, } - {{- else }} - // Using default region since neither URL substitutions nor regions are defined - substitutions := []struct { - region string - zone string - }{ - {region: "us-central1"}, + + listTemplate := strings.Split("{{ $.ListUrlTemplate }}", "?")[0] + listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err) + return nil } - {{- end }} - // Iterate through each substitution - for _, sub := range substitutions { - config, err := sweeper.SharedConfigForRegion(sub.region) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) - return err - } + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: config.Project, + RawURL: listUrl, + UserAgent: config.UserAgent, + }) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err) + return nil + } - err = config.LoadAndValidate(context.Background()) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] error loading: %s", err) - return err + resourceList, ok := res["{{ $.ResourceListKey }}"] + if !ok { + log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.") + return nil + } + {{- if contains $.ListUrlTemplate "/aggregated/" }} + var rl []interface{} + zones := resourceList.(map[string]interface{}) + // Loop through every zone in the list response + for _, zonesValue := range zones { + zone := zonesValue.(map[string]interface{}) + for k, v := range zone { + // Zone map either has resources or a warning stating there were no resources found in the zone + if k != "warning" { + resourcesInZone := v.([]interface{}) + rl = append(rl, resourcesInZone...) + } } - - t := &testing.T{} - billingId := envvar.GetTestBillingAccountFromEnv(t) - - // Set fallback values for empty region/zone - if sub.region == "" { - log.Printf("[INFO][SWEEPER_LOG] Empty region provided, falling back to us-central1") - sub.region = "us-central1" + } + {{- else }} + + rl := resourceList.([]interface{}) + {{- end }} + + log.Printf("[INFO][SWEEPER_LOG] Found %d items in %s list response.", len(rl), resourceName) + // Keep count of items that aren't sweepable for logging. + nonPrefixCount := 0 + for _, ri := range rl { + obj := ri.(map[string]interface{}) + {{- if contains $.DeleteUrlTemplate "_id" }} + var name string + // Id detected in the delete URL, attempt to use id. + if obj["id"] != nil { + name = tpgresource.GetResourceNameFromSelfLink(obj["id"].(string)) + } else if obj["name"] != nil { + name = tpgresource.GetResourceNameFromSelfLink(obj["name"].(string)) + } else { + log.Printf("[INFO][SWEEPER_LOG] %s resource name and id were nil", resourceName) + return nil } - if sub.zone == "" { - log.Printf("[INFO][SWEEPER_LOG] Empty zone provided, falling back to us-central1-a") - sub.zone = "us-central1-a" + {{- else }} + if obj["name"] == nil { + log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName) + return nil } - // Setup variables to replace in list template - d := &tpgresource.ResourceDataMock{ - FieldsInSchema: map[string]interface{}{ - "project": config.Project, - "region": sub.region, - "location": sub.region, - "zone": sub.zone, - "billing_account": billingId, - }, + name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string)) + {{- end }} + // Skip resources that shouldn't be sweeped + {{- if $.Sweeper.SweepableIdentifierField }} + if !sweeper.IsSweepableTestResource(obj["{{ $.Sweeper.SweepableIdentifierField }}"].(string)) { + {{- else }} + if !sweeper.IsSweepableTestResource(name) { + {{- end }} + nonPrefixCount++ + continue } - listTemplate := strings.Split("{{ $.ListUrlTemplate }}", "?")[0] - listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate) + deleteTemplate := "{{ $.DeleteUrlTemplate }}" + {{- if contains $.ListUrlTemplate "/aggregated/" }} + if obj["zone"] == nil { + log.Printf("[INFO][SWEEPER_LOG] %s resource zone was nil", resourceName) + return nil + } + zone := tpgresource.GetResourceNameFromSelfLink(obj["zone"].(string)) + deleteTemplate = strings.Replace(deleteTemplate, "{{"{{zone}}"}}", zone, -1) +{{ end }} + deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate) if err != nil { - log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err) - return err + log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err) + return nil } + deleteUrl = deleteUrl + name - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + // Don't wait on operations as we may have a lot to delete + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ Config: config, - Method: "GET", + Method: "DELETE", Project: config.Project, - RawURL: listUrl, + RawURL: deleteUrl, UserAgent: config.UserAgent, }) if err != nil { - log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err) - return err - } - - resourceList, ok := res["{{ $.ResourceListKey }}"] - if !ok { - log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.") - continue - } - - {{- if contains $.ListUrlTemplate "/aggregated/" }} - var rl []interface{} - zones := resourceList.(map[string]interface{}) - // Loop through every zone in the list response - for _, zonesValue := range zones { - zone := zonesValue.(map[string]interface{}) - for k, v := range zone { - // Zone map either has resources or a warning stating there were no resources found in the zone - if k != "warning" { - resourcesInZone := v.([]interface{}) - rl = append(rl, resourcesInZone...) - } - } - } - {{- else }} - rl := resourceList.([]interface{}) - {{- end }} - - log.Printf("[INFO][SWEEPER_LOG] Found %d items in %s list response.", len(rl), resourceName) - // Keep count of items that aren't sweepable for logging. - nonPrefixCount := 0 - for _, ri := range rl { - obj := ri.(map[string]interface{}) - {{- if $.Sweeper.IdentifierField }} - name := obj["{{ $.Sweeper.IdentifierField }}"].(string) - {{- else if contains $.DeleteUrlTemplate "_id" }} - var name string - // Id detected in the delete URL, attempt to use id. - if obj["id"] != nil { - name = tpgresource.GetResourceNameFromSelfLink(obj["id"].(string)) - } else if obj["name"] != nil { - name = tpgresource.GetResourceNameFromSelfLink(obj["name"].(string)) - } else { - log.Printf("[INFO][SWEEPER_LOG] %s resource name and id were nil", resourceName) - return err - } - {{- else }} - if obj["name"] == nil { - log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName) - return fmt.Errorf("%s resource name was nil", resourceName) - } - - name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string)) - {{- end }} - - // Skip resources that shouldn't be sweeped - {{- if $.Sweeper.Prefixes }} - prefixes := []string{ - {{- range $prefix := $.Sweeper.Prefixes }} - "{{ $prefix }}", - {{- end }} - } - if !sweeper.IsSweepableTestResource(name) && !hasAnyPrefix(name, prefixes) { - {{- else }} - if !sweeper.IsSweepableTestResource(name) { - {{- end }} - nonPrefixCount++ - continue - } - - deleteTemplate := "{{ $.DeleteUrlTemplate }}" - {{- if contains $.ListUrlTemplate "/aggregated/" }} - if obj["zone"] == nil { - log.Printf("[INFO][SWEEPER_LOG] %s resource zone was nil", resourceName) - return err - } - zone := tpgresource.GetResourceNameFromSelfLink(obj["zone"].(string)) - deleteTemplate = strings.Replace(deleteTemplate, "{{"{{zone}}"}}", zone, -1) - {{- end }} - - deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err) - deletionerror = err - } - deleteUrl = deleteUrl + name - - // Don't wait on operations as we may have a lot to delete - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: config.Project, - RawURL: deleteUrl, - UserAgent: config.UserAgent, - }) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] Error deleting for url %s : %s", deleteUrl, err) - deletionerror = err - } else { - log.Printf("[INFO][SWEEPER_LOG] Sent delete request for %s resource: %s", resourceName, name) - } + log.Printf("[INFO][SWEEPER_LOG] Error deleting for url %s : %s", deleteUrl, err) + } else { + log.Printf("[INFO][SWEEPER_LOG] Sent delete request for %s resource: %s", resourceName, name) } + } - if nonPrefixCount > 0 { - log.Printf("[INFO][SWEEPER_LOG] %d items were non-sweepable and skipped.", nonPrefixCount) - } + if nonPrefixCount > 0 { + log.Printf("[INFO][SWEEPER_LOG] %d items were non-sweepable and skipped.", nonPrefixCount) } - return deletionerror + return nil } diff --git a/mmv1/templates/terraform/update_encoder/network_services_gateway.go.tmpl b/mmv1/templates/terraform/update_encoder/network_services_gateway.go.tmpl deleted file mode 100644 index b867343f9c33..000000000000 --- a/mmv1/templates/terraform/update_encoder/network_services_gateway.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Always force-send some attributes even if they were not modified. This works around extra API-side requirements. -obj["scope"] = d.Get("scope") -if d.Get("type") == "SECURE_WEB_GATEWAY" { - obj["name"] = d.Get("name") - obj["type"] = d.Get("type") - obj["routingMode"] = d.Get("routingMode") -} -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/tgc_v6/cai2hcl/resource_converters.go.tmpl b/mmv1/templates/tgc_v6/cai2hcl/resource_converters.go.tmpl index 72acfe3809ae..51b0ef39230a 100644 --- a/mmv1/templates/tgc_v6/cai2hcl/resource_converters.go.tmpl +++ b/mmv1/templates/tgc_v6/cai2hcl/resource_converters.go.tmpl @@ -29,7 +29,6 @@ package converters import ( "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/pkg/cai2hcl/models" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/pkg/cai2hcl/converters/services/compute" "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/pkg/cai2hcl/converters/services/resourcemanager" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -41,5 +40,4 @@ var provider *schema.Provider = tpg_provider.Provider() // ConverterMap is a collection of converters instances, indexed by cai asset type. var ConverterMap = map[string]models.Converter{ resourcemanager.ProjectAssetType: resourcemanager.NewProjectConverter(provider), - compute.ComputeInstanceAssetType: compute.NewComputeInstanceConverter(provider), } 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 c1ff480e9a45..17c81477f036 100644 --- a/mmv1/third_party/terraform/.teamcity/USE_CONFIG_WITH_TEAMCITY.md +++ b/mmv1/third_party/terraform/.teamcity/USE_CONFIG_WITH_TEAMCITY.md @@ -95,12 +95,6 @@ The next step is provide some input values that the configuration needs to fully | org2Ga | Used to set the [GOOGLE_ORG_2](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L73-L75) environment variable in acceptance tests - GA specific | | org2Beta | Used to set the [GOOGLE_ORG_2](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L73-L75) environment variable in acceptance tests - Beta specific | | org2Vcr | Used to set the [GOOGLE_ORG_2](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L73-L75) environment variable in acceptance tests - VCR specific | -| chronicleInstanceIdGa | Used to set the [GOOGLE_CHRONICLE_INSTANCE_ID](https://github.com/GoogleCloudPlatform/magic-modules/blob/03a313d13c5d31f8e8fc71cb32d06157bc260f78/mmv1/third_party/terraform/envvar/envvar_utils.go#L107-L112) environment variable in acceptance tests - GA specific | -| chronicleInstanceIdBeta | Used to set the [GOOGLE_CHRONICLE_INSTANCE_ID](https://github.com/GoogleCloudPlatform/magic-modules/blob/03a313d13c5d31f8e8fc71cb32d06157bc260f78/mmv1/third_party/terraform/envvar/envvar_utils.go#L107-L112) environment variable in acceptance tests - Beta specific | -| chronicleInstanceIdVcr | Used to set the [GOOGLE_CHRONICLE_INSTANCE_ID](https://github.com/GoogleCloudPlatform/magic-modules/blob/03a313d13c5d31f8e8fc71cb32d06157bc260f78/mmv1/third_party/terraform/envvar/envvar_utils.go#L107-L112) environment variable in acceptance tests - VCR specific | -| vmwareengineProjectGa | Used to set the [GOOGLE_VMWAREENGINE_PROJECT](https://github.com/GoogleCloudPlatform/magic-modules/blob/415b35bae8e1e92e6949d472b987105f369be650/mmv1/third_party/terraform/envvar/envvar_utils.go#L118-L122) environment variable in acceptance tests - GA specific | -| vmwareengineProjectBeta | Used to set the [GOOGLE_VMWAREENGINE_PROJECT](https://github.com/GoogleCloudPlatform/magic-modules/blob/415b35bae8e1e92e6949d472b987105f369be650/mmv1/third_party/terraform/envvar/envvar_utils.go#L118-L122) environment variable in acceptance tests - Beta specific | -| vmwareengineProjectVcr | Used to set the [GOOGLE_VMWAREENGINE_PROJECT](https://github.com/GoogleCloudPlatform/magic-modules/blob/415b35bae8e1e92e6949d472b987105f369be650/mmv1/third_party/terraform/envvar/envvar_utils.go#L118-L122) environment variable in acceptance tests - VCR specific | | billingAccount | Used to set the [GOOGLE_BILLING_ACCOUNT](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L81-L85) ALL environment variable in acceptance tests | | billingAccount2 | Used to set the [GOOGLE_BILLING_ACCOUNT_2](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_test.go#L78-L79) environment variable in ALL acceptance tests | | custId | Used to set the [GOOGLE_CUST_ID](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L52-L56) environment variable in ALL acceptance tests | 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 275cb9fb86b5..16aff7acecdb 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 @@ -10,7 +10,6 @@ package builds import ArtifactRules import DefaultBuildTimeoutDuration import DefaultParallelism -import jetbrains.buildServer.configs.kotlin.buildFeatures.GolangFeature import jetbrains.buildServer.configs.kotlin.BuildType import jetbrains.buildServer.configs.kotlin.failureConditions.BuildFailureOnText import jetbrains.buildServer.configs.kotlin.failureConditions.failOnText @@ -82,9 +81,7 @@ class SweeperDetails(private val sweeperName: String, private val parentProjectN } features { - feature(GolangFeature { - testFormat = "json" - }) + golang() if (sharedResources.isNotEmpty()) { sharedResources { // When the build runs, it locks the value(s) below 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 c615d74128fa..f0f7d3c62e74 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt @@ -79,7 +79,7 @@ fun BuildSteps.downloadTerraformBinary() { fun BuildSteps.runSweepers(sweeperStepName: String) { step(ScriptBuildStep{ name = sweeperStepName - scriptContent = "go test -v \"%PACKAGE_PATH%\" -run=\"%TEST_PREFIX%\" -sweep=\"%SWEEPER_REGIONS%\" -sweep-allow-failures -sweep-run=\"%SWEEP_RUN%\" -timeout 30m -json" + scriptContent = "go test -v \"%PACKAGE_PATH%\" -sweep=\"%SWEEPER_REGIONS%\" -sweep-allow-failures -sweep-run=\"%SWEEP_RUN%\" -timeout 30m" }) } 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 26f4aac41e5e..554dc1891df6 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt @@ -46,11 +46,6 @@ var ServicesListBeta = mapOf( "displayName" to "Apigee", "path" to "./google-beta/services/apigee" ), - "apihub" to mapOf( - "name" to "apihub", - "displayName" to "Apihub", - "path" to "./google-beta/services/apihub" - ), "apikeys" to mapOf( "name" to "apikeys", "displayName" to "Apikeys", @@ -221,11 +216,6 @@ var ServicesListBeta = mapOf( "displayName" to "Cloudtasks", "path" to "./google-beta/services/cloudtasks" ), - "colab" to mapOf( - "name" to "colab", - "displayName" to "Colab", - "path" to "./google-beta/services/colab" - ), "composer" to mapOf( "name" to "composer", "displayName" to "Composer", @@ -406,11 +396,6 @@ var ServicesListBeta = mapOf( "displayName" to "Firebasedatabase", "path" to "./google-beta/services/firebasedatabase" ), - "firebasedataconnect" to mapOf( - "name" to "firebasedataconnect", - "displayName" to "Firebasedataconnect", - "path" to "./google-beta/services/firebasedataconnect" - ), "firebaseextensions" to mapOf( "name" to "firebaseextensions", "displayName" to "Firebaseextensions", @@ -606,11 +591,6 @@ var ServicesListBeta = mapOf( "displayName" to "Parallelstore", "path" to "./google/services/parallelstore" ), - "parametermanager" to mapOf( - "name" to "parametermanager", - "displayName" to "Parametermanager", - "path" to "./google-beta/services/parametermanager" - ), "parametermanagerregional" to mapOf( "name" to "parametermanagerregional", "displayName" to "Parametermanagerregional", 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 e49a10340d40..e2310c4749d8 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt @@ -46,11 +46,6 @@ var ServicesListGa = mapOf( "displayName" to "Apigee", "path" to "./google/services/apigee" ), - "apihub" to mapOf( - "name" to "apihub", - "displayName" to "Apihub", - "path" to "./google/services/apihub" - ), "apikeys" to mapOf( "name" to "apikeys", "displayName" to "Apikeys", @@ -221,11 +216,6 @@ var ServicesListGa = mapOf( "displayName" to "Cloudtasks", "path" to "./google/services/cloudtasks" ), - "colab" to mapOf( - "name" to "colab", - "displayName" to "Colab", - "path" to "./google/services/colab" - ), "composer" to mapOf( "name" to "composer", "displayName" to "Composer", @@ -406,11 +396,6 @@ var ServicesListGa = mapOf( "displayName" to "Firebasedatabase", "path" to "./google/services/firebasedatabase" ), - "firebasedataconnect" to mapOf( - "name" to "firebasedataconnect", - "displayName" to "Firebasedataconnect", - "path" to "./google/services/firebasedataconnect" - ), "firebaseextensions" to mapOf( "name" to "firebaseextensions", "displayName" to "Firebaseextensions", @@ -601,11 +586,6 @@ var ServicesListGa = mapOf( "displayName" to "Parallelstore", "path" to "./google/services/parallelstore" ), - "parametermanager" to mapOf( - "name" to "parametermanager", - "displayName" to "Parametermanager", - "path" to "./google/services/parametermanager" - ), "parametermanagerregional" to mapOf( "name" to "parametermanagerregional", "displayName" to "Parametermanagerregional", diff --git a/mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go b/mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go index 6a8b17953200..4590c56384eb 100644 --- a/mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go +++ b/mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go @@ -1,30 +1,26 @@ package acctest import ( - "strconv" - "strings" + "fmt" + "log" "testing" - "time" "github.com/hashicorp/terraform-provider-google/google/envvar" "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" ) -type IamMember struct { - Member, Role string -} - -// BootstrapIamMembers ensures that a given set of member/role pairs exist in the default -// test project. This should be used to avoid race conditions that can happen on the -// default project due to parallel tests managing the same member/role pairings. Members -// will have `{project_number}` replaced with the default test project's project number. -func BootstrapIamMembers(t *testing.T, members []IamMember) { +// BootstrapAllPSARoles ensures that the given project's IAM +// policy grants the given service agents the given roles. +// prefix is usually "service-" and indicates the service agent should have the +// given prefix before the project number. +// This is important to bootstrap because using iam policy resources means that +// deleting them removes permissions for concurrent tests. +// Return whether the bindings changed. +func BootstrapAllPSARoles(t *testing.T, prefix string, agentNames, roles []string) bool { config := BootstrapConfig(t) if config == nil { - t.Fatal("Could not bootstrap a config for BootstrapIamMembers.") + t.Fatal("Could not bootstrap a config for BootstrapAllPSARoles.") } client := config.NewResourceManagerClient(config.UserAgent) @@ -34,52 +30,65 @@ func BootstrapIamMembers(t *testing.T, members []IamMember) { t.Fatalf("Error getting project with id %q: %s", project.ProjectId, err) } + getPolicyRequest := &cloudresourcemanager.GetIamPolicyRequest{} + policy, err := client.Projects.GetIamPolicy(project.ProjectId, getPolicyRequest).Do() + if err != nil { + t.Fatalf("Error getting project iam policy: %v", err) + } + + members := make([]string, len(agentNames)) + for i, agentName := range agentNames { + members[i] = fmt.Sprintf("serviceAccount:%s%d@%s.iam.gserviceaccount.com", prefix, project.ProjectNumber, agentName) + } + // Create the bindings we need to add to the policy. var newBindings []*cloudresourcemanager.Binding - for _, member := range members { + for _, role := range roles { newBindings = append(newBindings, &cloudresourcemanager.Binding{ - Role: member.Role, - Members: []string{strings.ReplaceAll(member.Member, "{project_number}", strconv.FormatInt(project.ProjectNumber, 10))}, + Role: role, + Members: members, }) } - // Retry bootstrapping with exponential backoff for concurrent writes - backoff := time.Second - for { - getPolicyRequest := &cloudresourcemanager.GetIamPolicyRequest{} - policy, err := client.Projects.GetIamPolicy(project.ProjectId, getPolicyRequest).Do() - if transport_tpg.IsGoogleApiErrorWithCode(err, 429) { - t.Logf("[DEBUG] 429 while attempting to read policy for project %s, waiting %v before attempting again", project.ProjectId, backoff) - time.Sleep(backoff) - continue - } else if err != nil { - t.Fatalf("Error getting iam policy for project %s: %v\n", project.ProjectId, err) - } + mergedBindings := tpgiamresource.MergeBindings(append(policy.Bindings, newBindings...)) - mergedBindings := tpgiamresource.MergeBindings(append(policy.Bindings, newBindings...)) - - if tpgiamresource.CompareBindings(policy.Bindings, mergedBindings) { - t.Logf("[DEBUG] All bindings already present for project %s", project.ProjectId) - break + if !tpgiamresource.CompareBindings(policy.Bindings, mergedBindings) { + addedBindings := tpgiamresource.MissingBindings(policy.Bindings, mergedBindings) + for _, missingBinding := range addedBindings { + log.Printf("[DEBUG] Adding binding: %+v", missingBinding) } // The policy must change. policy.Bindings = mergedBindings setPolicyRequest := &cloudresourcemanager.SetIamPolicyRequest{Policy: policy} policy, err = client.Projects.SetIamPolicy(project.ProjectId, setPolicyRequest).Do() - if err == nil { - t.Logf("[DEBUG] Waiting for IAM bootstrapping to propagate for project %s.", project.ProjectId) - time.Sleep(3 * time.Minute) - break + if err != nil { + t.Fatalf("Error setting project iam policy: %v", err) } - if tpgresource.IsConflictError(err) { - t.Logf("[DEBUG]: Concurrent policy changes, restarting read-modify-write after %s", backoff) - time.Sleep(backoff) - backoff = backoff * 2 - if backoff > 30*time.Second { - t.Fatalf("Error applying IAM policy to %s: Too many conflicts. Latest error: %s", project.ProjectId, err) - } - continue + msg := "Added the following bindings to the test project's IAM policy:\n" + for _, binding := range addedBindings { + msg += fmt.Sprintf("Members: %q, Role: %q\n", binding.Members, binding.Role) } - t.Fatalf("Error setting project iam policy: %v", err) + msg += "Retry the test in a few minutes." + t.Error(msg) + return true } + return false +} + +// BootstrapAllPSARole is a version of BootstrapAllPSARoles for granting a +// single role to multiple service agents. +func BootstrapAllPSARole(t *testing.T, prefix string, agentNames []string, role string) bool { + return BootstrapAllPSARoles(t, prefix, agentNames, []string{role}) +} + +// BootstrapPSARoles is a version of BootstrapAllPSARoles for granting roles to +// a single service agent. +func BootstrapPSARoles(t *testing.T, prefix, agentName string, roles []string) bool { + return BootstrapAllPSARoles(t, prefix, []string{agentName}, roles) +} + +// BootstrapPSARole is a simplified version of BootstrapPSARoles for granting a +// single role to a single service agent. +func BootstrapPSARole(t *testing.T, prefix, agentName, role string) bool { + return BootstrapPSARoles(t, prefix, agentName, []string{role}) } diff --git a/mmv1/third_party/terraform/acctest/bootstrap_test_utils.go.tmpl b/mmv1/third_party/terraform/acctest/bootstrap_test_utils.go.tmpl index cfa1fe3245c8..d94e2f5c8cfe 100644 --- a/mmv1/third_party/terraform/acctest/bootstrap_test_utils.go.tmpl +++ b/mmv1/third_party/terraform/acctest/bootstrap_test_utils.go.tmpl @@ -9,13 +9,13 @@ import ( "strings" "testing" "time" - "net/http" - {{ if ne $.TargetVersionName `ga` -}} // For beta tests only + "net/http" resourceManagerV3 "google.golang.org/api/cloudresourcemanager/v3" tpgservicusage "github.com/hashicorp/terraform-provider-google/google/services/serviceusage" "github.com/hashicorp/terraform-provider-google/google/services/kms" + {{- end }} "github.com/hashicorp/terraform-provider-google/google/envvar" @@ -1747,6 +1747,7 @@ func SetupProjectsAndGetAccessToken(org, billing, pid, service string, config *t return accessToken, nil } +{{ if ne $.TargetVersionName `ga` -}} // For bootstrapping Developer Connect git repository link const SharedGitRepositoryLinkIdPrefix = "tf-bootstrap-git-repository-" @@ -2057,6 +2058,8 @@ func BootstrapSharedCodeRepositoryIndex(t *testing.T, codeRepositoryIndexId, loc return codeRepositoryIndexId } +{{- end }} + const sharedTagKeyPrefix = "tf-bootstrap-tagkey" func BootstrapSharedTestTagKey(t *testing.T, testId string) string { diff --git a/mmv1/third_party/terraform/acctest/resource_test_utils.go b/mmv1/third_party/terraform/acctest/resource_test_utils.go index 76d14ad32359..dba6be890954 100644 --- a/mmv1/third_party/terraform/acctest/resource_test_utils.go +++ b/mmv1/third_party/terraform/acctest/resource_test_utils.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "os" "slices" "testing" "time" @@ -91,10 +90,6 @@ func SkipIfVcr(t *testing.T) { func SleepInSecondsForTest(t int) resource.TestCheckFunc { return func(s *terraform.State) error { - // Assume we never want to sleep when we're in replaying mode. - if IsVcrEnabled() && os.Getenv("VCR_MODE") == "REPLAYING" { - return nil - } time.Sleep(time.Duration(t) * time.Second) return nil } diff --git a/mmv1/third_party/terraform/acctest/test_utils.go.tmpl b/mmv1/third_party/terraform/acctest/test_utils.go.tmpl index 947ee3518c6b..0a11711382b8 100644 --- a/mmv1/third_party/terraform/acctest/test_utils.go.tmpl +++ b/mmv1/third_party/terraform/acctest/test_utils.go.tmpl @@ -135,21 +135,6 @@ func RandInt(t *testing.T) int { return rand.New(s.source).Int() } -func RandIntRange(t *testing.T, minInt int, maxInt int) int { - if !IsVcrEnabled() { - return acctest.RandIntRange(minInt, maxInt) - } - envPath := os.Getenv("VCR_PATH") - vcrMode := os.Getenv("VCR_MODE") - s, err := vcrSource(t, envPath, vcrMode) - if err != nil { - // At this point we haven't created any resources, so fail fast - t.Fatal(err) - } - - return rand.New(s.source).Intn(maxInt-minInt) + minInt -} - // ProtoV5ProviderFactories returns a muxed ProviderServer that uses the provider code from this repo (SDK and plugin-framework). // Used to set ProtoV5ProviderFactories in a resource.TestStep within an acceptance test. func ProtoV5ProviderFactories(t *testing.T) map[string]func() (tfprotov5.ProviderServer, error) { diff --git a/mmv1/third_party/terraform/fwmodels/provider_model.go.tmpl b/mmv1/third_party/terraform/fwmodels/provider_model.go.tmpl index b1be290d5140..61bc8d3fe57e 100644 --- a/mmv1/third_party/terraform/fwmodels/provider_model.go.tmpl +++ b/mmv1/third_party/terraform/fwmodels/provider_model.go.tmpl @@ -53,6 +53,7 @@ type ProviderModel struct { AssuredWorkloadsCustomEndpoint types.String `tfsdk:"assured_workloads_custom_endpoint"` CloudBuildWorkerPoolCustomEndpoint types.String `tfsdk:"cloud_build_worker_pool_custom_endpoint"` CloudResourceManagerCustomEndpoint types.String `tfsdk:"cloud_resource_manager_custom_endpoint"` + EventarcCustomEndpoint types.String `tfsdk:"eventarc_custom_endpoint"` FirebaserulesCustomEndpoint types.String `tfsdk:"firebaserules_custom_endpoint"` RecaptchaEnterpriseCustomEndpoint types.String `tfsdk:"recaptcha_enterprise_custom_endpoint"` diff --git a/mmv1/third_party/terraform/go.mod b/mmv1/third_party/terraform/go.mod index 7f54f950fe39..877171386f7f 100644 --- a/mmv1/third_party/terraform/go.mod +++ b/mmv1/third_party/terraform/go.mod @@ -4,7 +4,7 @@ go 1.23 require ( cloud.google.com/go/bigtable v1.33.0 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.77.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.76.0 github.com/apparentlymart/go-cidr v1.1.0 github.com/davecgh/go-spew v1.1.1 github.com/dnaeon/go-vcr v1.0.1 @@ -27,23 +27,23 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/hashstructure v1.1.0 github.com/sirupsen/logrus v1.8.1 - github.com/stretchr/testify v1.10.0 + github.com/stretchr/testify v1.9.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 - golang.org/x/net v0.34.0 - golang.org/x/oauth2 v0.25.0 - google.golang.org/api v0.220.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 - google.golang.org/grpc v1.70.0 - google.golang.org/protobuf v1.36.4 + golang.org/x/net v0.33.0 + golang.org/x/oauth2 v0.24.0 + google.golang.org/api v0.214.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 + google.golang.org/grpc v1.67.1 + google.golang.org/protobuf v1.35.2 ) require ( bitbucket.org/creachadair/stringset v0.0.8 // indirect - cel.dev/expr v0.19.0 // indirect + cel.dev/expr v0.16.0 // indirect cloud.google.com/go v0.116.0 // indirect - cloud.google.com/go/auth v0.14.1 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.7 // indirect + cloud.google.com/go/auth v0.13.0 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect cloud.google.com/go/compute/metadata v0.6.0 // indirect cloud.google.com/go/iam v1.2.2 // indirect cloud.google.com/go/longrunning v0.6.2 // indirect @@ -55,22 +55,22 @@ require ( github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cloudflare/circl v1.3.7 // indirect - github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect - github.com/envoyproxy/go-control-plane v0.13.1 // indirect + github.com/cncf/xds/go v0.0.0-20240822171458-6449f94b4d59 // indirect + github.com/envoyproxy/go-control-plane v0.13.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/glog v1.2.4 // indirect + github.com/golang/glog v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932 // indirect - github.com/google/s2a-go v0.1.9 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect - github.com/googleapis/gax-go/v2 v2.14.1 // indirect + github.com/googleapis/gax-go/v2 v2.14.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-plugin v1.6.2 // indirect @@ -93,29 +93,29 @@ require ( github.com/oklog/run v1.0.0 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.14.4 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect - go.opentelemetry.io/otel v1.34.0 // indirect - go.opentelemetry.io/otel/metric v1.34.0 // indirect - go.opentelemetry.io/otel/sdk v1.34.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect - go.opentelemetry.io/otel/trace v1.34.0 // indirect - golang.org/x/crypto v0.32.0 // indirect - golang.org/x/mod v0.18.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect + go.opentelemetry.io/otel v1.29.0 // indirect + go.opentelemetry.io/otel/metric v1.29.0 // indirect + go.opentelemetry.io/otel/sdk v1.29.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect + go.opentelemetry.io/otel/trace v1.29.0 // indirect + golang.org/x/crypto v0.31.0 // indirect + golang.org/x/mod v0.17.0 // indirect golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.29.0 // indirect + golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect - golang.org/x/time v0.9.0 // indirect - golang.org/x/tools v0.22.0 // indirect + golang.org/x/time v0.8.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index 4b3eac3264bc..bdb87cb55b78 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -1,14 +1,14 @@ bitbucket.org/creachadair/stringset v0.0.8 h1:gQqe4vs8XWgMyijfyKE6K8o4TcyGGrRXe0JvHgx5H+M= bitbucket.org/creachadair/stringset v0.0.8/go.mod h1:AgthVMyMxC/6FK1KBJ2ALdqkZObGN8hOetgpwXyMn34= -cel.dev/expr v0.19.0 h1:lXuo+nDhpyJSpWxpPVi5cPUwzKb+dsdOiw6IreM5yt0= -cel.dev/expr v0.19.0/go.mod h1:MrpN08Q+lEBs+bGYdLxxHkZoUSsCp0nSKTs0nTymJgw= +cel.dev/expr v0.16.0 h1:yloc84fytn4zmJX2GU3TkXGsaieaV7dQ057Qs4sIG2Y= +cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE= cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U= -cloud.google.com/go/auth v0.14.1 h1:AwoJbzUdxA/whv1qj3TLKwh3XX5sikny2fc40wUl+h0= -cloud.google.com/go/auth v0.14.1/go.mod h1:4JHUxlGXisL0AW8kXPtUF6ztuOksyfUQNFjfsOCXkPM= -cloud.google.com/go/auth/oauth2adapt v0.2.7 h1:/Lc7xODdqcEw8IrZ9SvwnlLX6j9FHQM74z6cBk9Rw6M= -cloud.google.com/go/auth/oauth2adapt v0.2.7/go.mod h1:NTbTTzfvPl1Y3V1nPpOgl2w6d/FjO7NNUQaWSox6ZMc= +cloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs= +cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q= +cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU= +cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= cloud.google.com/go/bigtable v1.33.0 h1:2BDaWLRAwXO14DJL/u8crbV2oUbMZkIa2eGq8Yao1bk= cloud.google.com/go/bigtable v1.33.0/go.mod h1:HtpnH4g25VT1pejHRtInlFPnN5sjTxbQlsYBjh9t5l0= cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= @@ -22,8 +22,8 @@ cloud.google.com/go/monitoring v1.21.2/go.mod h1:hS3pXvaG8KgWTSz+dAdyzPrGUYmi2Q+ 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.77.0 h1:fCJw7h8lc8oVQAhoMABdsWAGWF8E6+4A5HvDHe5OsVM= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.77.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.76.0 h1:VH/j8GmTsvPds/NkGfo4OYr9C7R8ysikaqq4rcDUT0s= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.76.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 v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg= @@ -48,8 +48,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 h1:QVw89YDxXxEe+l8gU8ETbOasdwEV+avkR75ZzsVV9WI= -github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20240822171458-6449f94b4d59 h1:fLZ97KE86ELjEYJCEUVzmbhfzDxHHGwBrDVMd4XL6Bs= +github.com/cncf/xds/go v0.0.0-20240822171458-6449f94b4d59/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= 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= @@ -63,8 +63,8 @@ github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FM 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.13.1 h1:vPfJZCkob6yTMEgS+0TwfTUfbHjfy/6vOJ8hUWX/uXE= -github.com/envoyproxy/go-control-plane v0.13.1/go.mod h1:X45hY0mufo6Fd0KW3rqsGvQMw58jvjymeCzBU3mWyHw= +github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= +github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= @@ -96,8 +96,8 @@ github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3a 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= -github.com/golang/glog v1.2.4 h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc= -github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= +github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -130,15 +130,15 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/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/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= -github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= -github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q= -github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA= +github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o= +github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk= 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/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= @@ -205,9 +205,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 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 v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -244,8 +243,8 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1 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/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= -github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -263,8 +262,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ 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= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 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= @@ -283,22 +282,20 @@ github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY3 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/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 h1:PS8wXpbyaDJQ2VDHHncMe9Vct0Zn1fEjpsjrLxGJoSc= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0/go.mod h1:HDBUsEjOuRC0EzKZ1bSaRGZWUBAzo+MhAcUUORSr4D0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 h1:yd02MEjBdJkG3uabWP9apV+OuWRIXGDuJEUJbOHmCFU= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0/go.mod h1:umTcuxiv1n/s/S6/c2AT/g2CQ7u5C59sHDNmfSwgz7Q= -go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= -go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= -go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= -go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= -go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= -go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= -go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= -go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= -go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= -go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= +go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= +go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= +go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= +go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= +go.opentelemetry.io/otel/sdk/metric v1.29.0 h1:K2CfmJohnRgvZ9UAj2/FhIf/okdWcNdBwe1m8xFXiSY= +go.opentelemetry.io/otel/sdk/metric v1.29.0/go.mod h1:6zZLdCl2fkauYoZIOn/soQIDSWFmNSRcICarHfuhNJQ= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= 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= @@ -308,8 +305,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc= golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= @@ -319,8 +316,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl 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/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= -golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/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-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -332,11 +329,11 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= -golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= 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-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -362,12 +359,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= 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= @@ -375,8 +372,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= -golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= 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= @@ -386,14 +383,14 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn 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/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= -golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= 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= -google.golang.org/api v0.220.0 h1:3oMI4gdBgB72WFVwE1nerDD8W3HUOS4kypK6rRLbGns= -google.golang.org/api v0.220.0/go.mod h1:26ZAlY6aN/8WgpCzjPNy18QpYaz7Zgg1h0qe1GkZEmY= +google.golang.org/api v0.214.0 h1:h2Gkq07OYi6kusGOaT/9rnNljuXmqPnaig7WGPmKbwA= +google.golang.org/api v0.214.0/go.mod h1:bYPpLG8AyeMWwDU6NXoB00xC0DFkikVvd5MfwoxjLqE= 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.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= @@ -404,18 +401,18 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 h1:KJjNNclfpIkVqrZlTWcgOOaVQ00LdBnoEaRfkUx760s= google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:mt9/MofW7AWQ+Gy179ChOnvmJatV8YHUmrcedo9CIFI= -google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q= -google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 h1:J1H9f+LEdWAfHcez/4cvaVBox7cOYT+IU6rgqj5x++8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= 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.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ= -google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= 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= @@ -427,8 +424,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD 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.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= -google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 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-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl index 02fb2ee14ee3..2da43b4a3a8e 100644 --- a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl +++ b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl @@ -24,7 +24,6 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_active_folder": resourcemanager.DataSourceGoogleActiveFolder(), "google_alloydb_locations": alloydb.DataSourceAlloydbLocations(), "google_alloydb_supported_database_flags": alloydb.DataSourceAlloydbSupportedDatabaseFlags(), - "google_alloydb_instance": alloydb.DataSourceAlloydbDatabaseInstance(), "google_artifact_registry_docker_image": artifactregistry.DataSourceArtifactRegistryDockerImage(), "google_artifact_registry_locations": artifactregistry.DataSourceGoogleArtifactRegistryLocations(), "google_artifact_registry_repository": artifactregistry.DataSourceArtifactRegistryRepository(), @@ -151,7 +150,6 @@ var handwrittenDatasources = map[string]*schema.Resource{ {{- if ne $.TargetVersionName "ga" }} "google_kms_key_handle": kms.DataSourceGoogleKmsKeyHandle(), "google_kms_autokey_config": kms.DataSourceGoogleKmsAutokeyConfig(), - "google_kms_key_handles": kms.DataSourceGoogleKmsKeyHandles(), {{- end }} "google_kms_secret": kms.DataSourceGoogleKmsSecret(), "google_kms_secret_ciphertext": kms.DataSourceGoogleKmsSecretCiphertext(), @@ -186,17 +184,6 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_oracle_database_cloud_vm_clusters": oracledatabase.DataSourceOracleDatabaseCloudVmClusters(), "google_oracle_database_cloud_vm_cluster": oracledatabase.DataSourceOracleDatabaseCloudVmCluster(), "google_organization": resourcemanager.DataSourceGoogleOrganization(), - "google_organizations": resourcemanager.DataSourceGoogleOrganizations(), - {{- if ne $.TargetVersionName "ga" }} - "google_parameter_manager_parameter": parametermanager.DataSourceParameterManagerParameter(), - "google_parameter_manager_parameters": parametermanager.DataSourceParameterManagerParameters(), - "google_parameter_manager_parameter_version": parametermanager.DataSourceParameterManagerParameterVersion(), - "google_parameter_manager_parameter_version_render":parametermanager.DataSourceParameterManagerParameterVersionRender(), - "google_parameter_manager_regional_parameter": parametermanagerregional.DataSourceParameterManagerRegionalRegionalParameter(), - "google_parameter_manager_regional_parameters": parametermanagerregional.DataSourceParameterManagerRegionalRegionalParameters(), - "google_parameter_manager_regional_parameter_version": parametermanagerregional.DataSourceParameterManagerRegionalRegionalParameterVersion(), - "google_parameter_manager_regional_parameter_version_render":parametermanagerregional.DataSourceParameterManagerRegionalRegionalParameterVersionRender(), - {{- end }} "google_privateca_certificate_authority": privateca.DataSourcePrivatecaCertificateAuthority(), "google_privileged_access_manager_entitlement": privilegedaccessmanager.DataSourceGooglePrivilegedAccessManagerEntitlement(), "google_project": resourcemanager.DataSourceGoogleProject(), diff --git a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_dry_run_egress_policy_test.go b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_dry_run_egress_policy_test.go index ad505828c5af..e41c2f333a67 100644 --- a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_dry_run_egress_policy_test.go +++ b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_dry_run_egress_policy_test.go @@ -20,14 +20,13 @@ func testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_basicTest(t * //projects := acctest.BootstrapServicePerimeterProjects(t, 1) policyTitle := acctest.RandString(t, 10) perimeterTitle := "perimeter" - projectNumber := envvar.GetTestProjectNumberFromEnv() acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_basic(org, policyTitle, perimeterTitle, projectNumber), + Config: testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_basic(org, policyTitle, perimeterTitle), }, { Config: testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_destroy(org, policyTitle, perimeterTitle), @@ -84,7 +83,7 @@ func testAccCheckAccessContextManagerServicePerimeterDryRunEgressPolicyDestroyPr } } -func testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_basic(org, policyTitle, perimeterTitleName, projectNumber string) string { +func testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_basic(org, policyTitle, perimeterTitleName string) string { return fmt.Sprintf(` %s @@ -103,7 +102,6 @@ resource "google_access_context_manager_access_level" "test-access" { resource "google_access_context_manager_service_perimeter_dry_run_egress_policy" "test-access1" { perimeter = google_access_context_manager_service_perimeter.test-access.name - title = "egress policy title 1" egress_from { identity_type = "ANY_USER_ACCOUNT" } @@ -119,7 +117,6 @@ resource "google_access_context_manager_service_perimeter_dry_run_egress_policy" resource "google_access_context_manager_service_perimeter_dry_run_egress_policy" "test-access2" { perimeter = google_access_context_manager_service_perimeter.test-access.name - title = "egress policy title 2" egress_from { identity_type = "ANY_USER_ACCOUNT" sources { @@ -130,17 +127,7 @@ resource "google_access_context_manager_service_perimeter_dry_run_egress_policy" depends_on = [google_access_context_manager_service_perimeter_dry_run_egress_policy.test-access1] } -resource "google_access_context_manager_service_perimeter_dry_run_egress_policy" "test-access3" { - perimeter = google_access_context_manager_service_perimeter.test-access.name - egress_from { - sources { - resource = "projects/%s" - } - source_restriction = "SOURCE_RESTRICTION_ENABLED" - } -} - -`, testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_destroy(org, policyTitle, perimeterTitleName), projectNumber) +`, testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_destroy(org, policyTitle, perimeterTitleName)) } func testAccAccessContextManagerServicePerimeterDryRunEgressPolicy_destroy(org, policyTitle, perimeterTitleName string) string { diff --git a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_dry_run_ingress_policy_test.go b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_dry_run_ingress_policy_test.go index cac20b8eabfb..b2b69231b1c3 100644 --- a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_dry_run_ingress_policy_test.go +++ b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_dry_run_ingress_policy_test.go @@ -102,7 +102,6 @@ resource "google_access_context_manager_access_level" "test-access" { resource "google_access_context_manager_service_perimeter_dry_run_ingress_policy" "test-access1" { perimeter = google_access_context_manager_service_perimeter.test-access.name - title = "ingress policy title" ingress_from { identity_type = "ANY_USER_ACCOUNT" sources { diff --git a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_egress_policy_test.go b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_egress_policy_test.go index 714275c1f21b..e04e313fc3ef 100644 --- a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_egress_policy_test.go +++ b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_egress_policy_test.go @@ -22,14 +22,13 @@ func testAccAccessContextManagerServicePerimeterEgressPolicy_basicTest(t *testin //projects := acctest.BootstrapServicePerimeterProjects(t, 1) policyTitle := acctest.RandString(t, 10) perimeterTitle := "perimeter" - projectNumber := envvar.GetTestProjectNumberFromEnv() acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccAccessContextManagerServicePerimeterEgressPolicy_basic(org, policyTitle, perimeterTitle, projectNumber), + Config: testAccAccessContextManagerServicePerimeterEgressPolicy_basic(org, policyTitle, perimeterTitle), }, { Config: testAccAccessContextManagerServicePerimeterEgressPolicy_destroy(org, policyTitle, perimeterTitle), @@ -86,13 +85,12 @@ func testAccCheckAccessContextManagerServicePerimeterEgressPolicyDestroyProducer } } -func testAccAccessContextManagerServicePerimeterEgressPolicy_basic(org, policyTitle, perimeterTitleName, projectNumber string) string { +func testAccAccessContextManagerServicePerimeterEgressPolicy_basic(org, policyTitle, perimeterTitleName string) string { return fmt.Sprintf(` %s resource "google_access_context_manager_service_perimeter_egress_policy" "test-access1" { perimeter = google_access_context_manager_service_perimeter.test-access.name - title = "egress policy title" egress_from { identity_type = "ANY_USER_ACCOUNT" } @@ -131,17 +129,7 @@ resource "google_access_context_manager_service_perimeter_egress_policy" "test-a } } -resource "google_access_context_manager_service_perimeter_egress_policy" "test-access3" { - perimeter = google_access_context_manager_service_perimeter.test-access.name - egress_from { - sources { - resource = "projects/%s" - } - source_restriction = "SOURCE_RESTRICTION_ENABLED" - } -} - -`, testAccAccessContextManagerServicePerimeterEgressPolicy_destroy(org, policyTitle, perimeterTitleName), projectNumber) +`, testAccAccessContextManagerServicePerimeterEgressPolicy_destroy(org, policyTitle, perimeterTitleName)) } func testAccAccessContextManagerServicePerimeterEgressPolicy_destroy(org, policyTitle, perimeterTitleName string) string { diff --git a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_ingress_policy_test.go b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_ingress_policy_test.go index 2e1c2a824a38..cf8a4000ecbe 100644 --- a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_ingress_policy_test.go +++ b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_ingress_policy_test.go @@ -91,7 +91,6 @@ func testAccAccessContextManagerServicePerimeterIngressPolicy_basic(org, policyT resource "google_access_context_manager_service_perimeter_ingress_policy" "test-access1" { perimeter = google_access_context_manager_service_perimeter.test-access.name - title = "ingress policy title" ingress_from { identity_type = "ANY_IDENTITY" } diff --git a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go.tmpl b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go.tmpl index 246f7a23b409..754f2479e154 100644 --- a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go.tmpl +++ b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go.tmpl @@ -38,7 +38,6 @@ func testAccAccessContextManagerServicePerimeter_basicTest(t *testing.T) { func testAccAccessContextManagerServicePerimeter_updateTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - projectNumber := envvar.GetTestProjectNumberFromEnv() acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -62,7 +61,7 @@ func testAccAccessContextManagerServicePerimeter_updateTest(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAccessContextManagerServicePerimeter_updateAllowed(org, "my policy", "level", "perimeter", projectNumber), + Config: testAccAccessContextManagerServicePerimeter_updateAllowed(org, "my policy", "level", "perimeter"), }, { ResourceName: "google_access_context_manager_service_perimeter.test-access", @@ -78,7 +77,7 @@ func testAccAccessContextManagerServicePerimeter_updateTest(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAccessContextManagerServicePerimeter_updateAllowed(org, "my policy", "level", "perimeter", projectNumber), + Config: testAccAccessContextManagerServicePerimeter_updateAllowed(org, "my policy", "level", "perimeter"), }, { ResourceName: "google_access_context_manager_service_perimeter.test-access", @@ -183,7 +182,7 @@ resource "google_access_context_manager_service_perimeter" "test-access" { `, org, policyTitle, levelTitleName, levelTitleName, perimeterTitleName, perimeterTitleName) } -func testAccAccessContextManagerServicePerimeter_updateAllowed(org, policyTitle, levelTitleName, perimeterTitleName, projectNumber string) string { +func testAccAccessContextManagerServicePerimeter_updateAllowed(org, policyTitle, levelTitleName, perimeterTitleName string) string { return fmt.Sprintf(` resource "google_access_context_manager_access_policy" "test-access" { parent = "organizations/%s" @@ -219,8 +218,6 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } ingress_policies { - title = "ingress policy 1" - ingress_from { sources { access_level = google_access_context_manager_access_level.test-access.name @@ -256,7 +253,6 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } } ingress_policies { - title = "ingress policy 2" ingress_from { identities = ["user:test@google.com"] } @@ -266,17 +262,11 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } egress_policies { - title = "egress policy 1" egress_from { identity_type = "ANY_USER_ACCOUNT" sources { access_level = google_access_context_manager_access_level.test-access.name } - - sources { - resource = "projects/%s" - } - source_restriction = "SOURCE_RESTRICTION_ENABLED" } egress_to { @@ -290,7 +280,6 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } } egress_policies { - title = "egress policy 2" egress_from { identities = ["user:test@google.com"] } @@ -309,8 +298,6 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } ingress_policies { - title = "ingress policy 1" - ingress_from { sources { access_level = google_access_context_manager_access_level.test-access.name @@ -346,7 +333,6 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } } ingress_policies { - title = "ingress policy 2" ingress_from { identities = ["user:test@google.com"] } @@ -356,17 +342,11 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } egress_policies { - title = "egress policy 1" egress_from { identity_type = "ANY_USER_ACCOUNT" sources { access_level = google_access_context_manager_access_level.test-access.name } - - sources { - resource = "projects/%s" - } - source_restriction = "SOURCE_RESTRICTION_ENABLED" } egress_to { @@ -380,7 +360,6 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } } egress_policies { - title = "egress policy 2" egress_from { identities = ["user:test@google.com"] } @@ -390,7 +369,7 @@ resource "google_access_context_manager_service_perimeter" "test-access" { } } } -`, org, policyTitle, levelTitleName, levelTitleName, perimeterTitleName, perimeterTitleName, projectNumber, projectNumber) +`, org, policyTitle, levelTitleName, levelTitleName, perimeterTitleName, perimeterTitleName) } func testAccAccessContextManagerServicePerimeter_updateDryrun(org, policyTitle, levelTitleName, perimeterTitleName string) string { diff --git a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_services_perimeters_test.go b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_services_perimeters_test.go index 44f062bd7bdc..b62aa5b65bc4 100644 --- a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_services_perimeters_test.go +++ b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_services_perimeters_test.go @@ -16,7 +16,6 @@ import ( // can exist, they need to be run serially. See AccessPolicy for the test runner. func testAccAccessContextManagerServicePerimeters_basicTest(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) - projectNumber := envvar.GetTestProjectNumberFromEnv() acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -33,7 +32,7 @@ func testAccAccessContextManagerServicePerimeters_basicTest(t *testing.T) { ImportStateVerifyIgnore: []string{"service_perimeters"}, }, { - Config: testAccAccessContextManagerServicePerimeters_update(org, "my policy", "level", "storage_perimeter", "bigquery_perimeter", "bigtable_perimeter", "bigquery_omni_perimeter", projectNumber), + Config: testAccAccessContextManagerServicePerimeters_update(org, "my policy", "level", "storage_perimeter", "bigquery_perimeter", "bigtable_perimeter", "bigquery_omni_perimeter"), }, { ResourceName: "google_access_context_manager_service_perimeters.test-access", @@ -131,7 +130,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { status { restricted_services = ["bigquery.googleapis.com"] egress_policies { - title = "egress policy title" egress_to { external_resources = ["s3://bucket1"] operations { @@ -155,7 +153,7 @@ resource "google_access_context_manager_service_perimeters" "test-access" { `, org, policyTitle, levelTitleName, levelTitleName, perimeterTitleName1, perimeterTitleName1, perimeterTitleName2, perimeterTitleName2, perimeterTitleName3, perimeterTitleName3) } -func testAccAccessContextManagerServicePerimeters_update(org, policyTitle, levelTitleName, perimeterTitleName1, perimeterTitleName2, perimeterTitleName3, perimeterTitleName4, projectNumber string) string { +func testAccAccessContextManagerServicePerimeters_update(org, policyTitle, levelTitleName, perimeterTitleName1, perimeterTitleName2, perimeterTitleName3, perimeterTitleName4 string) string { return fmt.Sprintf(` resource "google_access_context_manager_access_policy" "test-access" { parent = "organizations/%s" @@ -222,7 +220,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { } ingress_policies { - title = "ingress policy title 1" ingress_from { sources { access_level = google_access_context_manager_access_level.test-access.name @@ -258,7 +255,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { } } ingress_policies { - title = "ingress policy title 2" ingress_from { identities = ["user:test@google.com"] } @@ -268,7 +264,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { } egress_policies { - title = "egress policy title 1" egress_from { identity_type = "ANY_USER_ACCOUNT" } @@ -283,7 +278,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { } } egress_policies { - title = "egress policy title 2" egress_from { identities = ["user:test@google.com"] } @@ -291,14 +285,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { resources = ["*"] } } - egress_policies { - egress_from { - sources { - resource = "projects/%s" - } - source_restriction = "SOURCE_RESTRICTION_ENABLED" - } - } } status { restricted_services = ["bigquery.googleapis.com", "storage.googleapis.com"] @@ -310,7 +296,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { } ingress_policies { - title = "ingress policy title 1" ingress_from { sources { access_level = google_access_context_manager_access_level.test-access.name @@ -346,7 +331,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { } } ingress_policies { - title = "ingress policy title 2" ingress_from { identities = ["user:test@google.com"] } @@ -356,7 +340,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { } egress_policies { - title = "egress policy title 1" egress_from { identity_type = "ANY_USER_ACCOUNT" } @@ -371,7 +354,6 @@ resource "google_access_context_manager_service_perimeters" "test-access" { } } egress_policies { - title = "egress policy title 2" egress_from { identities = ["user:test@google.com"] } @@ -379,18 +361,10 @@ resource "google_access_context_manager_service_perimeters" "test-access" { resources = ["*"] } } - egress_policies { - egress_from { - sources { - resource = "projects/%s" - } - source_restriction = "SOURCE_RESTRICTION_ENABLED" - } - } } } } -`, org, policyTitle, levelTitleName, levelTitleName, perimeterTitleName1, perimeterTitleName1, perimeterTitleName2, perimeterTitleName2, perimeterTitleName3, perimeterTitleName3, perimeterTitleName4, perimeterTitleName4, projectNumber, projectNumber) +`, org, policyTitle, levelTitleName, levelTitleName, perimeterTitleName1, perimeterTitleName1, perimeterTitleName2, perimeterTitleName2, perimeterTitleName3, perimeterTitleName3, perimeterTitleName4, perimeterTitleName4) } func testAccAccessContextManagerServicePerimeters_empty(org, policyTitle, levelTitleName string) string { diff --git a/mmv1/third_party/terraform/services/alloydb/data_source_alloydb_database_instance.go b/mmv1/third_party/terraform/services/alloydb/data_source_alloydb_database_instance.go deleted file mode 100644 index 6ea6e0146c07..000000000000 --- a/mmv1/third_party/terraform/services/alloydb/data_source_alloydb_database_instance.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package alloydb - -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 DataSourceAlloydbDatabaseInstance() *schema.Resource { - // Generate datasource schema from resource - dsSchema := tpgresource.DatasourceSchemaFromResourceSchema(ResourceAlloydbInstance().Schema) - // Set custom fields - dsScema_cluster_id := map[string]*schema.Schema{ - "cluster_id": { - Type: schema.TypeString, - Required: true, - Description: `The ID of the alloydb cluster that the instance belongs to.'alloydb_cluster_id'`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Description: `Project ID of the project.`, - }, - "location": { - Type: schema.TypeString, - Optional: true, - Description: `The canonical ID for the location. For example: "us-east1".`, - }, - } - tpgresource.AddRequiredFieldsToSchema(dsSchema, "instance_id") - - // Set 'Required' schema elements - dsSchema_m := tpgresource.MergeSchemas(dsScema_cluster_id, dsSchema) - - return &schema.Resource{ - Read: dataSourceAlloydbDatabaseInstanceRead, - Schema: dsSchema_m, - } -} - -func dataSourceAlloydbDatabaseInstanceRead(d *schema.ResourceData, meta interface{}) error { - config := meta.(*transport_tpg.Config) - - // Get feilds for setting cluster field in resource - cluster_id := d.Get("cluster_id").(string) - - location, err := tpgresource.GetLocation(d, config) - if err != nil { - return err - } - project, err := tpgresource.GetProject(d, config) - if err != nil { - return err - } - // Store the ID now - id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}/instances/{{instance_id}}") - if err != nil { - return fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - // Setting cluster field as this is set as a required field in instance resource - d.Set("cluster", fmt.Sprintf("projects/%s/locations/%s/clusters/%s", project, location, cluster_id)) - - err = resourceAlloydbInstanceRead(d, meta) - if err != nil { - return err - } - - if err := tpgresource.SetDataSourceLabels(d); err != nil { - return err - } - - if d.Id() == "" { - return fmt.Errorf("%s not found", id) - } - return nil -} diff --git a/mmv1/third_party/terraform/services/alloydb/data_source_alloydb_database_instance_test.go b/mmv1/third_party/terraform/services/alloydb/data_source_alloydb_database_instance_test.go deleted file mode 100644 index cb1a5c799452..000000000000 --- a/mmv1/third_party/terraform/services/alloydb/data_source_alloydb_database_instance_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package alloydb_test - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccAlloydbDatabaseInstanceDatasourceConfig(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - "network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "alloydb-instance-mandatory-1"), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckAlloydbInstanceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccAlloydbDatabaseInstanceDatasourceConfig(context), - }, - }, - }) -} - -func testAccAlloydbDatabaseInstanceDatasourceConfig(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_alloydb_instance" "default" { - cluster = google_alloydb_cluster.default.name - instance_id = "tf-test-alloydb-instance%{random_suffix}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } -} - -resource "google_alloydb_cluster" "default" { - cluster_id = "tf-test-alloydb-cluster%{random_suffix}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } - initial_user { - password = "tf-test-alloydb-cluster%{random_suffix}" - } -} - -data "google_compute_network" "default" { - name = "%{network_name}" -} - -data "google_alloydb_instance" "default" { - cluster_id = google_alloydb_cluster.default.cluster_id - instance_id = google_alloydb_instance.default.instance_id - location = "us-central1" -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/alloydb/resource_alloydb_cluster_test.go b/mmv1/third_party/terraform/services/alloydb/resource_alloydb_cluster_test.go index c89303052039..4b93f39356c3 100644 --- a/mmv1/third_party/terraform/services/alloydb/resource_alloydb_cluster_test.go +++ b/mmv1/third_party/terraform/services/alloydb/resource_alloydb_cluster_test.go @@ -56,104 +56,21 @@ resource "google_alloydb_cluster" "default" { network_config { network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.default.name}" } -} -data "google_project" "project" { -} - -resource "google_compute_network" "default" { - name = "tf-test-alloydb-cluster%{random_suffix}" -} -`, context) -} - -func TestAccAlloydbCluster_upgrade(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "alloydb-instance-upgrade-1"), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccAlloydbCluster_beforeUpgrade(context), - }, - { - ResourceName: "google_alloydb_cluster.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"initial_user", "cluster_id", "location", "labels", "terraform_labels", "skip_await_major_version_upgrade"}, - }, - { - Config: testAccAlloydbCluster_afterUpgrade(context), - }, - { - ResourceName: "google_alloydb_cluster.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"initial_user", "cluster_id", "location", "labels", "terraform_labels", "skip_await_major_version_upgrade"}, - }, - }, - }) -} - -func testAccAlloydbCluster_beforeUpgrade(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_alloydb_cluster" "default" { - skip_await_major_version_upgrade = false - cluster_id = "tf-test-alloydb-cluster%{random_suffix}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } - database_version = "POSTGRES_14" -} - -resource "google_alloydb_instance" "default" { - cluster = google_alloydb_cluster.default.name - instance_id = "tf-test-alloydb-instance%{random_suffix}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 8 + labels = { + foo = "bar" } -} -data "google_compute_network" "default" { - name = "%{network_name}" -} -`, context) -} - -func testAccAlloydbCluster_afterUpgrade(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_alloydb_cluster" "default" { - skip_await_major_version_upgrade = false - cluster_id = "tf-test-alloydb-cluster%{random_suffix}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id + lifecycle { + prevent_destroy = true } - database_version = "POSTGRES_15" } -resource "google_alloydb_instance" "default" { - cluster = google_alloydb_cluster.default.name - instance_id = "tf-test-alloydb-instance%{random_suffix}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 8 - } +data "google_project" "project" { } -data "google_compute_network" "default" { - name = "%{network_name}" +resource "google_compute_network" "default" { + name = "tf-test-alloydb-cluster%{random_suffix}" } `, context) } diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_api_meta.yaml b/mmv1/third_party/terraform/services/apigee/resource_apigee_api_meta.yaml index fa531edb62ee..b1cb30b5e4cd 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_api_meta.yaml +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_api_meta.yaml @@ -3,14 +3,3 @@ generation_type: 'handwritten' api_service_name: 'apigee.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Proxy' -fields: - - field: 'config_bundle' - - field: 'detect_md5hash' - - field: 'latest_revision_id' - - field: 'md5hash' - - field: 'meta_data.created_at' - - field: 'meta_data.last_modified_at' - - field: 'meta_data.sub_type' - - field: 'name' - - field: 'org_id' - - field: 'revision' diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_environment_update_test.go b/mmv1/third_party/terraform/services/apigee/resource_apigee_environment_update_test.go index 12f0e47d6de2..6ceb7d1510ba 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_environment_update_test.go +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_environment_update_test.go @@ -118,12 +118,6 @@ resource "google_apigee_environment" "apigee_environment" { name = "tf-test%{random_suffix}" description = "Updated Apigee Environment Description" display_name = "environment-1-updated" - properties { - property { - name = "property-1-key" - value = "property-1-value" - } - } } `, context) } diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_flowhook_meta.yaml b/mmv1/third_party/terraform/services/apigee/resource_apigee_flowhook_meta.yaml index e29167ef3fd4..8bab9a5ed71b 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_flowhook_meta.yaml +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_flowhook_meta.yaml @@ -3,10 +3,3 @@ generation_type: 'handwritten' api_service_name: 'apigee.googleapis.com' api_version: 'v1' api_resource_type_kind: 'FlowHook' -fields: - - field: 'continue_on_error' - - field: 'description' - - field: 'environment' - - field: 'flow_hook_point' - - field: 'org_id' - - field: 'sharedflow' diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_key_cert_file_meta.yaml b/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_key_cert_file_meta.yaml index 2887642e4674..2a1e2005d34a 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_key_cert_file_meta.yaml +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_key_cert_file_meta.yaml @@ -3,23 +3,3 @@ generation_type: 'handwritten' api_service_name: 'apigee.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Alias' -fields: - - field: 'alias' - - field: 'cert' - - field: 'certs_info.cert_info.basic_constraints' - - field: 'certs_info.cert_info.expiry_date' - - field: 'certs_info.cert_info.is_valid' - - field: 'certs_info.cert_info.issuer' - - field: 'certs_info.cert_info.public_key' - - field: 'certs_info.cert_info.serial_number' - - field: 'certs_info.cert_info.sig_alg_name' - - field: 'certs_info.cert_info.subject' - - field: 'certs_info.cert_info.subject_alternative_names' - - field: 'certs_info.cert_info.valid_from' - - field: 'certs_info.cert_info.version' - - field: 'environment' - - field: 'key' - - field: 'keystore' - - field: 'org_id' - - field: 'password' - - field: 'type' diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12_meta.yaml b/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12_meta.yaml index b7a779b70ba2..e169d7bb94d8 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12_meta.yaml +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12_meta.yaml @@ -3,23 +3,3 @@ generation_type: 'handwritten' api_service_name: 'apigee.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Alias' -fields: - - field: 'alias' - - field: 'certs_info.cert_info.basic_constraints' - - field: 'certs_info.cert_info.expiry_date' - - field: 'certs_info.cert_info.is_valid' - - field: 'certs_info.cert_info.issuer' - - field: 'certs_info.cert_info.public_key' - - field: 'certs_info.cert_info.serial_number' - - field: 'certs_info.cert_info.sig_alg_name' - - field: 'certs_info.cert_info.subject' - - field: 'certs_info.cert_info.subject_alternative_names' - - field: 'certs_info.cert_info.valid_from' - - field: 'certs_info.cert_info.version' - - field: 'environment' - - field: 'file' - - field: 'filehash' - - field: 'keystore' - - field: 'org_id' - - field: 'password' - - field: 'type' diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow_deployment_meta.yaml b/mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow_deployment_meta.yaml index c6e0104e4fb0..f6cff2c6bccd 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow_deployment_meta.yaml +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow_deployment_meta.yaml @@ -3,9 +3,3 @@ generation_type: 'handwritten' api_service_name: 'apigee.googleapis.com' api_version: 'v1' api_resource_type_kind: 'SharedFlow' -fields: - - field: 'environment' - - field: 'org_id' - - field: 'revision' - - field: 'service_account' - - field: 'sharedflow_id' diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow_meta.yaml b/mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow_meta.yaml index d62d97b769df..56f345484391 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow_meta.yaml +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow_meta.yaml @@ -3,14 +3,3 @@ generation_type: 'handwritten' api_service_name: 'apigee.googleapis.com' api_version: 'v1' api_resource_type_kind: 'SharedFlow' -fields: - - field: 'config_bundle' - - field: 'detect_md5hash' - - field: 'latest_revision_id' - - field: 'md5hash' - - field: 'meta_data.created_at' - - field: 'meta_data.last_modified_at' - - field: 'meta_data.sub_type' - - field: 'name' - - field: 'org_id' - - field: 'revision' diff --git a/mmv1/third_party/terraform/services/apikeys/resource_apikeys_key_meta.yaml b/mmv1/third_party/terraform/services/apikeys/resource_apikeys_key_meta.yaml index b9f78570f568..1470e1ae3812 100644 --- a/mmv1/third_party/terraform/services/apikeys/resource_apikeys_key_meta.yaml +++ b/mmv1/third_party/terraform/services/apikeys/resource_apikeys_key_meta.yaml @@ -3,16 +3,3 @@ generation_type: 'dcl' api_service_name: 'apikeys.googleapis.com' api_version: 'v2' api_resource_type_kind: 'Key' -fields: - - field: 'display_name' - - field: 'key_string' - - field: 'name' - - field: 'project' - - field: 'restrictions.android_key_restrictions.allowed_applications.package_name' - - field: 'restrictions.android_key_restrictions.allowed_applications.sha1_fingerprint' - - field: 'restrictions.api_targets.methods' - - field: 'restrictions.api_targets.service' - - field: 'restrictions.browser_key_restrictions.allowed_referrers' - - field: 'restrictions.ios_key_restrictions.allowed_bundle_ids' - - field: 'restrictions.server_key_restrictions.allowed_ips' - - field: 'uid' diff --git a/mmv1/third_party/terraform/services/appengine/resource_app_engine_application_meta.yaml.tmpl b/mmv1/third_party/terraform/services/appengine/resource_app_engine_application_meta.yaml.tmpl index bf01caf0798c..b9ca88e7ccaa 100644 --- a/mmv1/third_party/terraform/services/appengine/resource_app_engine_application_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/appengine/resource_app_engine_application_meta.yaml.tmpl @@ -7,23 +7,3 @@ api_version: 'v1beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Application' -fields: - - field: 'app_id' - - field: 'auth_domain' - - field: 'code_bucket' - - field: 'database_type' - - field: 'default_bucket' - - field: 'default_hostname' - - field: 'feature_settings.split_health_checks' - - field: 'gcr_domain' - - field: 'iap.enabled' - - field: 'iap.oauth2_client_id' - - field: 'iap.oauth2_client_secret' - - field: 'iap.oauth2_client_secret_sha256' - - field: 'location_id' - - field: 'name' - - field: 'project' - - field: 'serving_status' - - field: 'url_dispatch_rule.domain' - - field: 'url_dispatch_rule.path' - - field: 'url_dispatch_rule.service' diff --git a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image.go b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image.go index 40276cffc5e6..f5dbc9d23e33 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image.go +++ b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image.go @@ -132,8 +132,7 @@ func DataSourceArtifactRegistryDockerImageRead(d *schema.ResourceData, meta inte return fmt.Errorf("Error setting api endpoint") } - // to reduce the number of pages we need to fetch, we set the pageSize to 1000(max) - urlRequest, err = transport_tpg.AddQueryParams(urlRequest, map[string]string{"orderBy": "update_time desc", "pageSize": "1000"}) + urlRequest, err = transport_tpg.AddQueryParams(urlRequest, map[string]string{"orderBy": "update_time desc"}) if err != nil { return err } diff --git a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl index 8da32e1976f7..11dcb645a795 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl +++ b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl @@ -84,38 +84,6 @@ func TestAccArtifactRegistryRepository_createMvnRelease(t *testing.T) { }) } -func TestAccArtifactRegistryRepository_updateEmptyMvn(t *testing.T) { - t.Parallel() - - repositoryID := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccArtifactRegistryRepository_createMvnEmpty1(repositoryID), - }, - { - ResourceName: "google_artifact_registry_repository.test", - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccArtifactRegistryRepository_createMvnEmpty2(repositoryID), - PlanOnly: true, - ExpectNonEmptyPlan: false, - }, - { - Config: testAccArtifactRegistryRepository_createMvnEmpty3(repositoryID), - PlanOnly: true, - ExpectNonEmptyPlan: false, - }, - }, - }) -} - func TestAccArtifactRegistryRepository_kfp(t *testing.T) { t.Parallel() @@ -184,43 +152,6 @@ resource "google_artifact_registry_repository" "test" { `, repositoryID, versionPolicy) } -func testAccArtifactRegistryRepository_createMvnEmpty1(repositoryID string) string { - return fmt.Sprintf(` -resource "google_artifact_registry_repository" "test" { - repository_id = "%s" - location = "us-central1" - description = "maven repository with empty maven_config" - format = "MAVEN" -} -`, repositoryID) -} - -func testAccArtifactRegistryRepository_createMvnEmpty2(repositoryID string) string { - return fmt.Sprintf(` -resource "google_artifact_registry_repository" "test" { - repository_id = "%s" - location = "us-central1" - description = "maven repository with empty maven_config" - format = "MAVEN" - maven_config { } -} -`, repositoryID) -} - -func testAccArtifactRegistryRepository_createMvnEmpty3(repositoryID string) string { - return fmt.Sprintf(` -resource "google_artifact_registry_repository" "test" { - repository_id = "%s" - location = "us-central1" - description = "maven repository with empty maven_config" - format = "MAVEN" - maven_config { - allow_snapshot_overwrites = false - } -} -`, repositoryID) -} - func testAccArtifactRegistryRepository_kfp(repositoryID string) string { return fmt.Sprintf(` resource "google_artifact_registry_repository" "test" { diff --git a/mmv1/third_party/terraform/services/assuredworkloads/resource_assured_workloads_workload_meta.yaml.tmpl b/mmv1/third_party/terraform/services/assuredworkloads/resource_assured_workloads_workload_meta.yaml.tmpl index ca50a2975bdd..03d3b64eecc2 100644 --- a/mmv1/third_party/terraform/services/assuredworkloads/resource_assured_workloads_workload_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/assuredworkloads/resource_assured_workloads_workload_meta.yaml.tmpl @@ -7,41 +7,3 @@ api_version: 'v1beta1' api_version: 'v1' {{- end }} api_resource_type_kind: 'Workload' -fields: - - field: 'billing_account' - - field: 'compliance_regime' - - field: 'compliance_status.acknowledged_violation_count' - - field: 'compliance_status.active_violation_count' - - field: 'compliant_but_disallowed_services' - - field: 'create_time' - - field: 'display_name' - - field: 'effective_labels' - provider_only: true - - field: 'ekm_provisioning_response.ekm_provisioning_error_domain' - - field: 'ekm_provisioning_response.ekm_provisioning_error_mapping' - - field: 'ekm_provisioning_response.ekm_provisioning_state' - - field: 'enable_sovereign_controls' - - field: 'kaj_enrollment_state' - - field: 'kms_settings.next_rotation_time' - - field: 'kms_settings.rotation_period' - - field: 'labels' - - field: 'location' - - field: 'name' - - field: 'organization' - - field: 'partner' - - field: 'partner_permissions.assured_workloads_monitoring' - - field: 'partner_permissions.data_logs_viewer' - - field: 'partner_permissions.service_access_approver' - - field: 'partner_services_billing_account' - - field: 'provisioned_resources_parent' - - field: 'resource_settings.display_name' - - field: 'resource_settings.resource_id' - - field: 'resource_settings.resource_type' - - field: 'resources.resource_id' - - field: 'resources.resource_type' - - field: 'saa_enrollment_response.setup_errors' - - field: 'saa_enrollment_response.setup_status' - - field: 'terraform_labels' - provider_only: true - - field: 'violation_notifications_enabled' - - field: 'workload_options.kaj_enrollment_type' diff --git a/mmv1/third_party/terraform/services/beyondcorp/resource_beyondcorp_application_test.go b/mmv1/third_party/terraform/services/beyondcorp/resource_beyondcorp_application_test.go deleted file mode 100644 index 28086bc32df4..000000000000 --- a/mmv1/third_party/terraform/services/beyondcorp/resource_beyondcorp_application_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package beyondcorp_test - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccBeyondcorpApplication_beyondcorpSecurityGatewayApplicationBasicExample_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccBeyondcorpApplication_beyondcorpSecurityGatewayApplicationBasicExample_basic(context), - }, - { - ResourceName: "google_beyondcorp_application.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"application_id", "security_gateways_id"}, - }, - { - Config: testAccBeyondcorpApplication_beyondcorpSecurityGatewayApplicationBasicExample_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_beyondcorp_application.example", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_beyondcorp_application.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"application_id", "security_gateways_id"}, - }, - }, - }) -} - -func testAccBeyondcorpApplication_beyondcorpSecurityGatewayApplicationBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_beyondcorp_security_gateway" "default" { - security_gateway_id = "default%{random_suffix}" - display_name = "My Security Gateway resource" - hubs { region = "us-central1" } -} - -resource "google_beyondcorp_application" "example" { - security_gateways_id = google_beyondcorp_security_gateway.default.security_gateway_id - application_id = "google%{random_suffix}" - endpoint_matchers { - hostname = "google.com" - } -} -`, context) -} - -func testAccBeyondcorpApplication_beyondcorpSecurityGatewayApplicationBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_beyondcorp_security_gateway" "default" { - security_gateway_id = "default%{random_suffix}" - display_name = "My Security Gateway resource" - hubs { region = "us-central1" } -} - -resource "google_beyondcorp_application" "example" { - security_gateways_id = google_beyondcorp_security_gateway.default.security_gateway_id - display_name = "Updated Name" - application_id = "google%{random_suffix}" - endpoint_matchers { - hostname = "google.com" - } -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/beyondcorp/resource_beyondcorp_security_gateway_test.go b/mmv1/third_party/terraform/services/beyondcorp/resource_beyondcorp_security_gateway_test.go index 1501a793dec5..11e0166fa443 100644 --- a/mmv1/third_party/terraform/services/beyondcorp/resource_beyondcorp_security_gateway_test.go +++ b/mmv1/third_party/terraform/services/beyondcorp/resource_beyondcorp_security_gateway_test.go @@ -27,7 +27,7 @@ func TestAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_upda ResourceName: "google_beyondcorp_security_gateway.example", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"security_gateway_id"}, + ImportStateVerifyIgnore: []string{"location", "security_gateway_id"}, }, { Config: testAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_update(context), @@ -41,7 +41,7 @@ func TestAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_upda ResourceName: "google_beyondcorp_security_gateway.example", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"security_gateway_id"}, + ImportStateVerifyIgnore: []string{"location", "security_gateway_id"}, }, }, }) @@ -51,6 +51,7 @@ func testAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_basi return acctest.Nprintf(` resource "google_beyondcorp_security_gateway" "example" { security_gateway_id = "default%{random_suffix}" + location = "global" display_name = "My Security Gateway resource" hubs { region = "us-central1" } } @@ -61,6 +62,7 @@ func testAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_upda return acctest.Nprintf(` resource "google_beyondcorp_security_gateway" "example" { security_gateway_id = "default%{random_suffix}" + location = "global" display_name = "My Security Gateway resource" hubs { region = "us-east1" } } diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl index 9b8861f32e99..95589e22b57b 100644 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl @@ -96,14 +96,6 @@ func jsonCompareWithMapKeyOverride(key string, a, b interface{}, compareMapKeyVa unionOfKeys[subKey] = true } - {{- if ne $.TargetVersionName "ga" }} - // Disregard "type" and "fields" if "foreignTypeDefinition" is present since they may have been modified by the server. - if _, ok := unionOfKeys["foreignTypeDefinition"]; ok { - delete(unionOfKeys, "type") - delete(unionOfKeys, "fields") - } - - {{- end }} for subKey := range unionOfKeys { eq := compareMapKeyVal(subKey, objectA, objectB) if !eq { @@ -331,15 +323,6 @@ func resourceBigQueryTableSchemaIsChangeable(old, new interface{}, isExternalTab for key := range objectNew { unionOfKeys[key] = true } - - {{- if ne $.TargetVersionName "ga" }} - // Disregard "type" and "fields" if "foreignTypeDefinition" is present since they may have been modified by the server. - if _, ok := unionOfKeys["foreignTypeDefinition"]; ok { - delete(unionOfKeys, "type") - delete(unionOfKeys, "fields") - } - - {{- end }} for key := range unionOfKeys { valOld := objectOld[key] valNew := objectNew[key] @@ -1009,26 +992,6 @@ func ResourceBigQueryTable() *schema.Resource { DiffSuppressFunc: bigQueryTableSchemaDiffSuppress, Description: `A JSON schema for the table.`, }, - {{- if ne $.TargetVersionName "ga" }} - // SchemaForeignTypeInfo: [Optional] Specifies metadata of the foreign data type definition in field schema. - "schema_foreign_type_info": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - MaxItems: 1, - Description: "Specifies metadata of the foreign data type definition in field schema.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - // TypeSystem: [Required] Specifies the system which defines the foreign data type. - "type_system": { - Type: schema.TypeString, - Required: true, - Description: `Specifies the system which defines the foreign data type.`, - }, - }, - }, - }, - {{- end }} // View: [Optional] If specified, configures this table as a view. "view": { Type: schema.TypeList, @@ -1664,14 +1627,6 @@ func resourceTable(d *schema.ResourceData, meta interface{}) (*bigquery.Table, e table.Schema = schema } - {{- if ne $.TargetVersionName "ga" }} - if v, ok := d.GetOk("schema_foreign_type_info"); ok { - if table.Schema != nil { - table.Schema.ForeignTypeInfo = expandForeignTypeInfo(v) - } - } - - {{- end }} if v, ok := d.GetOk("time_partitioning"); ok { table.TimePartitioning = expandTimePartitioning(v) } @@ -1975,14 +1930,6 @@ func resourceBigQueryTableRead(d *schema.ResourceData, meta interface{}) error { if err := d.Set("schema", schema); err != nil { return fmt.Errorf("Error setting schema: %s", err) } - {{- if ne $.TargetVersionName "ga" }} - if res.Schema.ForeignTypeInfo != nil { - foreignTypeInfo := flattenForeignTypeInfo(res.Schema.ForeignTypeInfo) - if err := d.Set("schema_foreign_type_info", foreignTypeInfo); err != nil { - return fmt.Errorf("Error setting schema_foreign_type_info: %s", err) - } - } - {{- end }} } if res.View != nil { @@ -2786,32 +2733,6 @@ func schemaHasRequiredFields(schema *bigquery.TableSchema) bool { return false } -{{- if ne $.TargetVersionName "ga" }} -func expandForeignTypeInfo(configured interface{}) *bigquery.ForeignTypeInfo { - if len(configured.([]interface{})) == 0 { - return nil - } - - raw := configured.([]interface{})[0].(map[string]interface{}) - fti := &bigquery.ForeignTypeInfo{} - - if v, ok := raw["type_system"]; ok { - fti.TypeSystem = v.(string) - } - - return fti -} - -func flattenForeignTypeInfo(fti *bigquery.ForeignTypeInfo) []map[string]interface{} { - if fti == nil { - return nil - } - - result := map[string]interface{}{"type_system": fti.TypeSystem} - return []map[string]interface{}{result} -} - -{{- end }} func expandTimePartitioning(configured interface{}) *bigquery.TimePartitioning { raw := configured.([]interface{})[0].(map[string]interface{}) tp := &bigquery.TimePartitioning{Type: raw["type"].(string)} diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_internal_test.go.tmpl b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_internal_test.go similarity index 95% rename from mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_internal_test.go.tmpl rename to mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_internal_test.go index 0771224f6cfc..b8747ac327e4 100644 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_internal_test.go.tmpl +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_internal_test.go @@ -366,13 +366,6 @@ func TestBigQueryTableSchemaDiffSuppress(t *testing.T) { ]`, ExpectDiffSuppress: true, }, - {{- if ne $.TargetVersionName "ga" }} - "foreignTypeDefinition from generated schema -> original schema": { - Old: "[{\"name\": \"someValue\", \"type\": \"RECORD\", \"foreignTypeDefinition\" : \"STRUCT\", \"fields\": [{\"name\": \"id\", \"type\": \"STRING\"}, {\"name\": \"name\", \"type\": \"STRING\"}]}]", - New: "[{\"name\": \"someValue\", \"type\": \"FOREIGN\", \"foreignTypeDefinition\" : \"STRUCT\"}]", - ExpectDiffSuppress: true, - }, - {{- end }} } for tn, tc := range cases { @@ -383,10 +376,10 @@ func TestBigQueryTableSchemaDiffSuppress(t *testing.T) { var a, b interface{} if err := json.Unmarshal([]byte(tc.Old), &a); err != nil { - t.Fatalf("%v", fmt.Sprintf("unable to unmarshal old json - %v", err)) + t.Fatalf(fmt.Sprintf("unable to unmarshal old json - %v", err)) } if err := json.Unmarshal([]byte(tc.New), &b); err != nil { - t.Fatalf("%v", fmt.Sprintf("unable to unmarshal new json - %v", err)) + t.Fatalf(fmt.Sprintf("unable to unmarshal new json - %v", err)) } if bigQueryTableSchemaDiffSuppress("schema", tc.Old, tc.New, nil) != tc.ExpectDiffSuppress { t.Fatalf("bad: %s, %q => %q expect DiffSuppress to return %t", tn, tc.Old, tc.New, tc.ExpectDiffSuppress) @@ -584,14 +577,6 @@ var testUnitBigQueryDataTableIsChangeableTestCases = []testUnitBigQueryDataTable ]`, changeable: true, }, - {{- if ne $.TargetVersionName "ga" }} - { - name: "foreignTypeDefinition", - jsonOld: "[{\"name\": \"someValue\", \"type\" : \"FOREIGN\", \"foreignTypeDefinition\" : \"INTEGER\" }]", - jsonNew: "[{\"name\": \"someValue\", \"type\" : \"FOREIGN\", \"foreignTypeDefinition\" : \"STRING\" }]", - changeable: true, - }, - {{- end }} } func TestUnitBigQueryDataTable_schemaIsChangeable(t *testing.T) { diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_meta.yaml b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_meta.yaml new file mode 100644 index 000000000000..a6f25b3dd093 --- /dev/null +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_bigquery_table' +generation_type: 'handwritten' +api_service_name: 'bigquery.googleapis.com' +api_version: 'v2' +api_resource_type_kind: 'Table' diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_meta.yaml.tmpl b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_meta.yaml.tmpl deleted file mode 100644 index 720a051337e3..000000000000 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_meta.yaml.tmpl +++ /dev/null @@ -1,131 +0,0 @@ -resource: 'google_bigquery_table' -generation_type: 'handwritten' -api_service_name: 'bigquery.googleapis.com' -api_version: 'v2' -api_resource_type_kind: 'Table' -fields: - - field: 'biglake_configuration.connection_id' - - field: 'biglake_configuration.file_format' - - field: 'biglake_configuration.storage_uri' - - field: 'biglake_configuration.table_format' - - field: 'clustering' - - field: 'creation_time' - - field: 'dataset_id' - - field: 'deletion_protection' - - field: 'description' - - field: 'effective_labels' - provider_only: true - - field: 'encryption_configuration.kms_key_name' - - field: 'encryption_configuration.kms_key_version' - - field: 'etag' - - field: 'expiration_time' -{{- if ne $.TargetVersionName "ga" }} - - field: 'external_catalog_table_options.connection_id' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'external_catalog_table_options.parameters' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'external_catalog_table_options.storage_descriptor.input_format' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'external_catalog_table_options.storage_descriptor.location_uri' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'external_catalog_table_options.storage_descriptor.output_format' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'external_catalog_table_options.storage_descriptor.serde_info.name' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'external_catalog_table_options.storage_descriptor.serde_info.parameters' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'external_catalog_table_options.storage_descriptor.serde_info.serialization_library' -{{- end }} - - field: 'external_data_configuration.autodetect' - - field: 'external_data_configuration.avro_options.use_avro_logical_types' - - field: 'external_data_configuration.bigtable_options.column_family.column.encoding' - - field: 'external_data_configuration.bigtable_options.column_family.column.field_name' - - field: 'external_data_configuration.bigtable_options.column_family.column.only_read_latest' - - field: 'external_data_configuration.bigtable_options.column_family.column.qualifier_encoded' - - field: 'external_data_configuration.bigtable_options.column_family.column.qualifier_string' - - field: 'external_data_configuration.bigtable_options.column_family.column.type' - - field: 'external_data_configuration.bigtable_options.column_family.encoding' - - field: 'external_data_configuration.bigtable_options.column_family.family_id' - - field: 'external_data_configuration.bigtable_options.column_family.only_read_latest' - - field: 'external_data_configuration.bigtable_options.column_family.type' - - field: 'external_data_configuration.bigtable_options.ignore_unspecified_column_families' - - field: 'external_data_configuration.bigtable_options.output_column_families_as_json' - - field: 'external_data_configuration.bigtable_options.read_rowkey_as_string' - - field: 'external_data_configuration.compression' - - field: 'external_data_configuration.connection_id' - - field: 'external_data_configuration.csv_options.allow_jagged_rows' - - field: 'external_data_configuration.csv_options.allow_quoted_newlines' - - field: 'external_data_configuration.csv_options.encoding' - - field: 'external_data_configuration.csv_options.field_delimiter' - - field: 'external_data_configuration.csv_options.quote' - - field: 'external_data_configuration.csv_options.skip_leading_rows' - - field: 'external_data_configuration.file_set_spec_type' - - field: 'external_data_configuration.google_sheets_options.range' - - field: 'external_data_configuration.google_sheets_options.skip_leading_rows' - - field: 'external_data_configuration.hive_partitioning_options.mode' - - field: 'external_data_configuration.hive_partitioning_options.require_partition_filter' - - field: 'external_data_configuration.hive_partitioning_options.source_uri_prefix' - - field: 'external_data_configuration.ignore_unknown_values' - - field: 'external_data_configuration.json_extension' - - field: 'external_data_configuration.json_options.encoding' - - field: 'external_data_configuration.max_bad_records' - - field: 'external_data_configuration.metadata_cache_mode' - - field: 'external_data_configuration.object_metadata' - - field: 'external_data_configuration.parquet_options.enable_list_inference' - - field: 'external_data_configuration.parquet_options.enum_as_string' - - field: 'external_data_configuration.reference_file_schema_uri' - - field: 'external_data_configuration.schema' - - field: 'external_data_configuration.source_format' - - field: 'external_data_configuration.source_uris' - - field: 'friendly_name' - - field: 'labels' - - field: 'last_modified_time' - - field: 'location' - - field: 'materialized_view.allow_non_incremental_definition' - - field: 'materialized_view.enable_refresh' - - field: 'materialized_view.query' - - field: 'materialized_view.refresh_interval_ms' - - field: 'max_staleness' - - field: 'num_bytes' - - field: 'num_long_term_bytes' - - field: 'num_rows' - - field: 'project' - - field: 'range_partitioning.field' - - field: 'range_partitioning.range.end' - - field: 'range_partitioning.range.interval' - - field: 'range_partitioning.range.start' - - field: 'require_partition_filter' - - field: 'resource_tags' - - field: 'schema' -{{- if ne $.TargetVersionName "ga" }} - - field: 'schema_foreign_type_info.type_system' -{{- end }} - - field: 'self_link' - - field: 'table_constraints.foreign_keys.column_references.referenced_column' - - field: 'table_constraints.foreign_keys.column_references.referencing_column' - - field: 'table_constraints.foreign_keys.name' - - field: 'table_constraints.foreign_keys.referenced_table.dataset_id' - - field: 'table_constraints.foreign_keys.referenced_table.project_id' - - field: 'table_constraints.foreign_keys.referenced_table.table_id' - - field: 'table_constraints.primary_key.columns' - - field: 'table_id' - - field: 'table_replication_info.replication_interval_ms' - - field: 'table_replication_info.source_dataset_id' - - field: 'table_replication_info.source_project_id' - - field: 'table_replication_info.source_table_id' - - field: 'terraform_labels' - provider_only: true - - field: 'time_partitioning.expiration_ms' - - field: 'time_partitioning.field' - - field: 'time_partitioning.require_partition_filter' - - field: 'time_partitioning.type' - - field: 'type' - - field: 'view.query' - - field: 'view.use_legacy_sql' diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go.tmpl b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go.tmpl index a52a5df2ab02..bd6a2c706fc5 100644 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go.tmpl +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go.tmpl @@ -1852,33 +1852,6 @@ func TestAccBigQueryTable_externalCatalogTableOptions(t *testing.T) { }) } -func TestAccBigQueryTable_foreignTypeInfo(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "project_id": envvar.GetTestProjectFromEnv(), - "dataset_id": fmt.Sprintf("tf_test_dataset_%s", acctest.RandString(t, 10)), - "table_id": fmt.Sprintf("tf_test_table_%s", acctest.RandString(t, 10)), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckBigQueryTableDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccBigQueryTable_foreignTypeInfo_basic(context), - }, - { - ResourceName: "google_bigquery_table.test", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - }, - }) -} - {{- end }} func testAccCheckBigQueryExtData(t *testing.T, expectedQuoteChar string) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -4697,39 +4670,6 @@ EOF `, context) } -func testAccBigQueryTable_foreignTypeInfo_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_bigquery_dataset" "test" { - provider = google-beta - - dataset_id = "%{dataset_id}" - location = "EU" -} - -resource "google_bigquery_table" "test" { - provider = google-beta - - deletion_protection = false - dataset_id = "${google_bigquery_dataset.test.dataset_id}" - table_id = "%{table_id}" - - schema = <" - } -] -EOF - - schema_foreign_type_info { - type_system = "HIVE" - } -} -`, context) -} - {{- end }} var TEST_CSV = `lifelock,LifeLock,,web,Tempe,AZ,1-May-07,6850000,USD,b lifelock,LifeLock,,web,Tempe,AZ,1-Oct-06,6000000,USD,a diff --git a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_authorized_view_meta.yaml b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_authorized_view_meta.yaml index 2ef61014c936..2c112e2efd99 100644 --- a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_authorized_view_meta.yaml +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_authorized_view_meta.yaml @@ -3,13 +3,3 @@ generation_type: 'handwritten' api_service_name: 'bigtableadmin.googleapis.com' api_version: 'v2' api_resource_type_kind: 'AuthorizedView' -fields: - - field: 'deletion_protection' - - field: 'instance_name' - - field: 'name' - - field: 'project' - - field: 'subset_view.family_subsets.family_name' - - field: 'subset_view.family_subsets.qualifier_prefixes' - - field: 'subset_view.family_subsets.qualifiers' - - field: 'subset_view.row_prefixes' - - field: 'table_name' diff --git a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy_meta.yaml b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy_meta.yaml index e2f3144c6ae5..8cf03dfc6636 100644 --- a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy_meta.yaml +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy_meta.yaml @@ -3,15 +3,3 @@ generation_type: 'handwritten' api_service_name: 'bigtableadmin.googleapis.com' api_version: 'v2' api_resource_type_kind: 'Table' -fields: - - field: 'column_family' - - field: 'deletion_policy' - - field: 'gc_rules' - - field: 'ignore_warnings' - - field: 'instance_name' - - field: 'max_age.days' - - field: 'max_age.duration' - - field: 'max_version.number' - - field: 'mode' - - field: 'project' - - field: 'table' diff --git a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_meta.yaml b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_meta.yaml index f5425fb245a8..138640008a7e 100644 --- a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_meta.yaml +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_meta.yaml @@ -3,25 +3,3 @@ generation_type: 'handwritten' api_service_name: 'bigtableadmin.googleapis.com' api_version: 'v2' api_resource_type_kind: 'Instance' -fields: - - field: 'cluster.autoscaling_config.cpu_target' - - field: 'cluster.autoscaling_config.max_nodes' - - field: 'cluster.autoscaling_config.min_nodes' - - field: 'cluster.autoscaling_config.storage_target' - - field: 'cluster.cluster_id' - - field: 'cluster.kms_key_name' - - field: 'cluster.num_nodes' - - field: 'cluster.state' - - field: 'cluster.storage_type' - - field: 'cluster.zone' - - field: 'deletion_protection' - - field: 'display_name' - - field: 'effective_labels' - provider_only: true - - field: 'force_destroy' - - field: 'instance_type' - - field: 'labels' - - field: 'name' - - field: 'project' - - field: 'terraform_labels' - provider_only: true diff --git a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_meta.yaml b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_meta.yaml index 18341ecb1a02..48df86e47168 100644 --- a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_meta.yaml +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table_meta.yaml @@ -3,14 +3,3 @@ generation_type: 'handwritten' api_service_name: 'bigtableadmin.googleapis.com' api_version: 'v2' api_resource_type_kind: 'Table' -fields: - - field: 'automated_backup_policy.frequency' - - field: 'automated_backup_policy.retention_period' - - field: 'change_stream_retention' - - field: 'column_family.family' - - field: 'column_family.type' - - field: 'deletion_protection' - - field: 'instance_name' - - field: 'name' - - field: 'project' - - field: 'split_keys' diff --git a/mmv1/third_party/terraform/services/chronicle/chronicle_operation.go b/mmv1/third_party/terraform/services/chronicle/chronicle_operation.go deleted file mode 100644 index 5878d0a90e3f..000000000000 --- a/mmv1/third_party/terraform/services/chronicle/chronicle_operation.go +++ /dev/null @@ -1,72 +0,0 @@ -package chronicle - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -type ChronicleOperationWaiter struct { - Config *transport_tpg.Config - UserAgent string - Project string - tpgresource.CommonOperationWaiter -} - -func (w *ChronicleOperationWaiter) QueryOp() (interface{}, error) { - if w == nil { - return nil, fmt.Errorf("Cannot query operation, it's unset or nil.") - } - - region := tpgresource.GetRegionFromRegionalSelfLink(w.CommonOperationWaiter.Op.Name) - - // Returns the proper get. - url := fmt.Sprintf("https://%s-chronicle.googleapis.com/v1beta/%s", region, w.CommonOperationWaiter.Op.Name) - - return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: w.Config, - Method: "GET", - Project: w.Project, - RawURL: url, - UserAgent: w.UserAgent, - }) -} - -func createChronicleWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*ChronicleOperationWaiter, error) { - w := &ChronicleOperationWaiter{ - Config: config, - UserAgent: userAgent, - Project: project, - } - if err := w.CommonOperationWaiter.SetOp(op); err != nil { - return nil, err - } - return w, nil -} - -func ChronicleOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - w, err := createChronicleWaiter(config, op, project, activity, userAgent) - if err != nil { - return err - } - if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil { - return err - } - return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response) -} - -func ChronicleOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - if val, ok := op["name"]; !ok || val == "" { - // This was a synchronous call - there is no operation to wait for. - return nil - } - w, err := createChronicleWaiter(config, op, project, activity, userAgent) - if err != nil { - // If w is nil, the op was synchronous. - return err - } - return tpgresource.OperationWait(w, activity, timeout, config.PollInterval) -} diff --git a/mmv1/third_party/terraform/services/chronicle/resource_chronicle_reference_list_test.go.tmpl b/mmv1/third_party/terraform/services/chronicle/resource_chronicle_reference_list_test.go.tmpl deleted file mode 100644 index c3896d61594e..000000000000 --- a/mmv1/third_party/terraform/services/chronicle/resource_chronicle_reference_list_test.go.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -package chronicle_test - -{{- if ne $.TargetVersionName "ga" }} - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" -) - -func TestAccChronicleReferenceList_chronicleReferencelistBasicExample_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "chronicle_id": envvar.GetTestChronicleInstanceIdFromEnv(t), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccChronicleReferenceList_chronicleReferencelistBasicExample_basic(context), - }, - { - ResourceName: "google_chronicle_reference_list.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"instance", "location", "reference_list_id"}, - }, - { - Config: testAccChronicleReferenceList_chronicleReferencelistBasicExample_update(context), - }, - { - ResourceName: "google_chronicle_reference_list.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"instance", "location", "reference_list_id"}, - }, - }, - }) -} - -func testAccChronicleReferenceList_chronicleReferencelistBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_chronicle_reference_list" "example" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - reference_list_id = "tf_test_reference_list_id%{random_suffix}" - description = "referencelist-description" - entries { - value = "referencelist-entry-value" - } - syntax_type = "REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING" -} -`, context) -} - -func testAccChronicleReferenceList_chronicleReferencelistBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_chronicle_reference_list" "example" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - reference_list_id = "tf_test_reference_list_id%{random_suffix}" - description = "referencelist-description-updated" - entries { - value = "referencelist-entry-value-updated" - } - syntax_type = "REFERENCE_LIST_SYNTAX_TYPE_REGEX" -} -`, context) -} -{{- end }} diff --git a/mmv1/third_party/terraform/services/chronicle/resource_chronicle_rule_deployment_test.go.tmpl b/mmv1/third_party/terraform/services/chronicle/resource_chronicle_rule_deployment_test.go.tmpl deleted file mode 100644 index f2dd8cb1d059..000000000000 --- a/mmv1/third_party/terraform/services/chronicle/resource_chronicle_rule_deployment_test.go.tmpl +++ /dev/null @@ -1,95 +0,0 @@ -package chronicle_test - -{{- if ne $.TargetVersionName "ga" }} - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" -) - -func TestAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "chronicle_id": envvar.GetTestChronicleInstanceIdFromEnv(t), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample_basic(context), - }, - { - ResourceName: "google_chronicle_rule_deployment.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"instance", "location", "rule"}, - }, - { - Config: testAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample_update(context), - }, - { - ResourceName: "google_chronicle_rule_deployment.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"instance", "location", "rule"}, - }, - }, - }) -} - -func testAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_chronicle_rule" "my-rule" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - text = <<-EOT - rule test_rule { meta: events: $userid = $e.principal.user.userid match: $userid over 10m condition: $e } - EOT -} - -resource "google_chronicle_rule_deployment" "example" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - rule = element(split("/", resource.google_chronicle_rule.my-rule.name), length(split("/", resource.google_chronicle_rule.my-rule.name)) - 1) - enabled = true - alerting = true - archived = false - run_frequency = "DAILY" -} -`, context) -} - -func testAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_chronicle_rule" "my-rule" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - text = <<-EOT - rule test_rule { meta: events: $userid = $e.principal.user.userid match: $userid over 10m condition: $e } - EOT -} - -resource "google_chronicle_rule_deployment" "example" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - rule = element(split("/", resource.google_chronicle_rule.my-rule.name), length(split("/", resource.google_chronicle_rule.my-rule.name)) - 1) - enabled = false - alerting = false - archived = false - run_frequency = "HOURLY" -} -`, context) -} -{{- end }} diff --git a/mmv1/third_party/terraform/services/chronicle/resource_chronicle_rule_test.go.tmpl b/mmv1/third_party/terraform/services/chronicle/resource_chronicle_rule_test.go.tmpl deleted file mode 100644 index 887037a60273..000000000000 --- a/mmv1/third_party/terraform/services/chronicle/resource_chronicle_rule_test.go.tmpl +++ /dev/null @@ -1,85 +0,0 @@ -package chronicle_test - -{{- if ne $.TargetVersionName "ga" }} - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" -) - -func TestAccChronicleRule_chronicleRuleBasicExample_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "chronicle_id": envvar.GetTestChronicleInstanceIdFromEnv(t), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckChronicleRuleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccChronicleRule_chronicleRuleBasicExample_basic(context), - }, - { - Config: testAccChronicleRule_chronicleRuleBasicExample_update(context), - }, - }, - }) -} - -func testAccChronicleRule_chronicleRuleBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_chronicle_data_access_scope" "data_access_scope_test" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - data_access_scope_id = "tf-test-scope-name%{random_suffix}" - description = "scope-description" - allowed_data_access_labels { - log_type = "GCP_CLOUDAUDIT" - } -} - -resource "google_chronicle_rule" "example" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - scope = resource.google_chronicle_data_access_scope.data_access_scope_test.name - text = <<-EOT - rule test_rule { meta: events: $userid = $e.principal.user.userid match: $userid over 10m condition: $e } - EOT -} -`, context) -} - -func testAccChronicleRule_chronicleRuleBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_chronicle_data_access_scope" "data_access_scope_test" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - data_access_scope_id = "tf-test-scope-name%{random_suffix}" - description = "scope-description" - allowed_data_access_labels { - log_type = "GCP_CLOUDAUDIT" - } -} - -resource "google_chronicle_rule" "example" { - provider = "google-beta" - location = "us" - instance = "%{chronicle_id}" - text = <<-EOT - rule test_rule { meta: events: $updated_userid = $e.principal.user.userid match: $updated_userid over 10m condition: $e } - EOT -} -`, context) -} -{{- end }} diff --git a/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_meta.yaml b/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_meta.yaml index 4c40858289f7..8229c42375a4 100644 --- a/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_meta.yaml +++ b/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_meta.yaml @@ -3,23 +3,3 @@ generation_type: 'dcl' api_service_name: 'cloudbuild.googleapis.com' api_version: 'v1' api_resource_type_kind: 'WorkerPool' -fields: - - field: 'annotations' - - field: 'create_time' - - field: 'delete_time' - - field: 'display_name' - - field: 'effective_annotations' - provider_only: true - - field: 'location' - - field: 'name' - - field: 'network_config.peered_network' - - field: 'network_config.peered_network_ip_range' - - field: 'private_service_connect.network_attachment' - - field: 'private_service_connect.route_all_traffic' - - field: 'project' - - field: 'state' - - field: 'uid' - - field: 'update_time' - - field: 'worker_config.disk_size_gb' - - field: 'worker_config.machine_type' - - field: 'worker_config.no_external_ip' diff --git a/mmv1/third_party/terraform/services/cloudbuildv2/resource_cloudbuildv2_connection_test.go b/mmv1/third_party/terraform/services/cloudbuildv2/resource_cloudbuildv2_connection_test.go index e0426e6d4292..5ac1ba961f1e 100644 --- a/mmv1/third_party/terraform/services/cloudbuildv2/resource_cloudbuildv2_connection_test.go +++ b/mmv1/third_party/terraform/services/cloudbuildv2/resource_cloudbuildv2_connection_test.go @@ -800,11 +800,11 @@ resource "google_cloudbuildv2_connection" "primary" { bitbucket_data_center_config { authorizer_credential { - user_token_secret_version = "projects/407304063574/secrets/private-bbdc-api-token/versions/latest" + user_token_secret_version = "projects/407304063574/secrets/private-bbdc-api-token/versions/1" } read_authorizer_credential { - user_token_secret_version = "projects/407304063574/secrets/private-bbdc-read-token/versions/latest" + user_token_secret_version = "projects/407304063574/secrets/private-bbdc-read-token/versions/1" } webhook_secret_secret_version = "projects/407304063574/secrets/bbdc-webhook-secret/versions/latest" @@ -814,7 +814,7 @@ resource "google_cloudbuildv2_connection" "primary" { service = "projects/407304063574/locations/us-west1/namespaces/private-conn/services/private-bitbucket" } - ssl_ca = "-----BEGIN CERTIFICATE-----\nMIIEWDCCA0CgAwIBAgIUPHTFNv00au9lCZnZIbpDZOVNz8swDQYJKoZIhvcNAQEL\nBQAwgaIxCzAJBgNVBAYTAkNBMRAwDgYDVQQIDAdPbnRhcmlvMRAwDgYDVQQHDAdU\nb3JvbnRvMQ8wDQYDVQQKDAZHb29nbGUxDDAKBgNVBAsMA0dDUDErMCkGA1UEAwwi\ncHJpdmF0ZS1iaXRidWNrZXQucHJvY3Rvci10ZXN0LmNvbTEjMCEGCSqGSIb3DQEJ\nARYUbW9uaWNhbGl1QGdvb2dsZS5jb20wHhcNMjUwMTEzMjIyODU5WhcNMzUwMTEx\nMjIyODU5WjCBojELMAkGA1UEBhMCQ0ExEDAOBgNVBAgMB09udGFyaW8xEDAOBgNV\nBAcMB1Rvcm9udG8xDzANBgNVBAoMBkdvb2dsZTEMMAoGA1UECwwDR0NQMSswKQYD\nVQQDDCJwcml2YXRlLWJpdGJ1Y2tldC5wcm9jdG9yLXRlc3QuY29tMSMwIQYJKoZI\nhvcNAQkBFhRtb25pY2FsaXVAZ29vZ2xlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQAD\nggEPADCCAQoCggEBAKNbLKjUD04cq5S9Z0HIdPjOSNsswegSDy4+DCN/tWYU+CiB\nKFFHVT+WUa5IGWCzUh2qXtJAls3zpsEP/EwiF2gnIR2nerLv5ppQdd5ejo57jo/u\nPqm7NVnjWEnruCt9UXyVbvCocj/FBcubBDkRzNsEx7e/aPk/deaj3YjJBbdKbNJu\nXmU5bOfnHjAqsiAsAj09W9f/ZifMZnQdGCpopbaJA+0Rr8ZcxMPsBauI5MClIy2R\n2hNWtiOLJpp4hplnIy1M2npn/sjT8FBTrClzpaDDicI4EiBVZPQTOwERd1Gdk3Us\nXBxUIi3Jje9utZeVQTEPuiUnOqIQ7GHn9ynRW3kCAwEAAaOBgzCBgDAdBgNVHQ4E\nFgQUpAZEKba/ZJUJGJ0+4q9kCCfEOv4wHwYDVR0jBBgwFoAUpAZEKba/ZJUJGJ0+\n4q9kCCfEOv4wDwYDVR0TAQH/BAUwAwEB/zAtBgNVHREEJjAkgiJwcml2YXRlLWJp\ndGJ1Y2tldC5wcm9jdG9yLXRlc3QuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQA8TqtB\nQGF+ibVmcwQZeI295w8Xfy7hBiKPrl6h+ReB1zJKyspCfvSLzfFyvBWIzbVCaGIh\nRbeDPh9divTKI4w1jhNhUbL7pLVnpvX4kAvnZzbAljQwzvHfwyuMsZNtfp0c7Rc/\nbowtxNce5Mgqver477od2zwLlQjyeKWaolILKGGL0NfRIx2VeZzpXblo0pksKpLb\n3Ncw41hFYI552FTQ3eqjbCYNNWn2nzBg+FqEL8eYRHIUGCj9bcm8dvBGp1fffuNp\nlFQt8ifUATTRqUt8q3/ukN9IYCJSKc5TGrWu34/QVyReOnZ6EBL0JFSd9u+/ckXn\ntOIt3W2yI+EOFLUJ\n-----END CERTIFICATE-----" + ssl_ca = "-----BEGIN CERTIFICATE-----\nMIIDjDCCAnSgAwIBAgIUBh5+3oeT1vmUSS5rSNaFfy6igSAwDQYJKoZIhvcNAQEL\nBQAwVzELMAkGA1UEBhMCVVMxGzAZBgNVBAoMEkdvb2dsZSBDbG91ZCBCdWlsZDEr\nMCkGA1UEAwwicHJpdmF0ZS1iaXRidWNrZXQucHJvY3Rvci10ZXN0LmNvbTAeFw0y\nMzEyMTIyMzI5NTlaFw0yNDEyMTEyMzI5NTlaMFcxCzAJBgNVBAYTAlVTMRswGQYD\nVQQKDBJHb29nbGUgQ2xvdWQgQnVpbGQxKzApBgNVBAMMInByaXZhdGUtYml0YnVj\na2V0LnByb2N0b3ItdGVzdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\nAoIBAQCNfMx4ImGD4imZR64RbmRtpUNmypDokx2/S9kgobmyNvBWeSgRVhOGHGbU\nUgyvENcEg803K8unwF2jF6sdGrocRnIdPpr2tUoViOM2Ss6ds+TD8a2kqBA6+hmQ\nOMJiEIirpGT3Mw1pYTpuLisfIeeuuYssoS5k18kFLZ+Mk6MUSAHCgC8EowUZLGBZ\nagh9OhrjpMSXyidv+2d7FKTh/k3BWffVkDXehjvWjcr47hSvQwqW5m773ewCq0uD\nwxUgO6MAAAxLJz15cjhfvk4ishgSqcp49IZrx+xsNCLbHjPVyGkrL2OhgFaGsQS/\nq6GkXYfJ1sJYrf5Xm1EXbZlQZzJPAgMBAAGjUDBOMC0GA1UdEQQmMCSCInByaXZh\ndGUtYml0YnVja2V0LnByb2N0b3ItdGVzdC5jb20wHQYDVR0OBBYEFISmuuTpHKMB\n+m1h62gEqg1ovC86MA0GCSqGSIb3DQEBCwUAA4IBAQAwIwR6pIum9EZyLtC438Q1\nEgH3SKqbdyMFCkFSBvr4WfFU6ja1pn5ZxzJWt5TRFlI9GMy7BupQrxJGebOiFuUC\noNJpc4QDt9a0/GKh48DGF7uKo9XK33p0v1ahq3ewNT/CUnHewQNX7aXXP1/rL+br\nZPA20XWURUTviMik7DdhaXKQv76K9coI3H74heeBUp+OHKgUkqA3D1QIGNRGOKos\n4z6MyBWVpMUIeJQGtIQBd9CY1hBN231iG1+hdOlOMwgyNVK2GS738r+HbngFo9v4\nh2I1HMUHVcHiPQLqwZ2/OTmTmF1aWCUbhnAvoisu20rHVcGnVIOqMrHYFzdGr3ZQ\n-----END CERTIFICATE-----\n" } project = "%{project_name}" diff --git a/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_delivery_pipeline_meta.yaml b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_delivery_pipeline_meta.yaml index 6f71216b4c85..825fbe8df525 100644 --- a/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_delivery_pipeline_meta.yaml +++ b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_delivery_pipeline_meta.yaml @@ -3,61 +3,3 @@ generation_type: 'dcl' api_service_name: 'clouddeploy.googleapis.com' api_version: 'v1' api_resource_type_kind: 'DeliveryPipeline' -fields: - - field: 'annotations' - - field: 'condition.pipeline_ready_condition.status' - - field: 'condition.pipeline_ready_condition.update_time' - - field: 'condition.targets_present_condition.missing_targets' - - field: 'condition.targets_present_condition.status' - - field: 'condition.targets_present_condition.update_time' - - field: 'condition.targets_type_condition.error_details' - - field: 'condition.targets_type_condition.status' - - field: 'create_time' - - field: 'description' - - field: 'effective_annotations' - provider_only: true - - field: 'effective_labels' - provider_only: true - - field: 'etag' - - field: 'labels' - - field: 'location' - - field: 'name' - - field: 'project' - - field: 'serial_pipeline.stages.deploy_parameters.match_target_labels' - - field: 'serial_pipeline.stages.deploy_parameters.values' - - field: 'serial_pipeline.stages.profiles' - - field: 'serial_pipeline.stages.strategy.canary.canary_deployment.percentages' - - field: 'serial_pipeline.stages.strategy.canary.canary_deployment.postdeploy.actions' - - field: 'serial_pipeline.stages.strategy.canary.canary_deployment.predeploy.actions' - - field: 'serial_pipeline.stages.strategy.canary.canary_deployment.verify' - - field: 'serial_pipeline.stages.strategy.canary.custom_canary_deployment.phase_configs.percentage' - - field: 'serial_pipeline.stages.strategy.canary.custom_canary_deployment.phase_configs.phase_id' - - field: 'serial_pipeline.stages.strategy.canary.custom_canary_deployment.phase_configs.postdeploy.actions' - - field: 'serial_pipeline.stages.strategy.canary.custom_canary_deployment.phase_configs.predeploy.actions' - - field: 'serial_pipeline.stages.strategy.canary.custom_canary_deployment.phase_configs.profiles' - - field: 'serial_pipeline.stages.strategy.canary.custom_canary_deployment.phase_configs.verify' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.cloud_run.automatic_traffic_control' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.cloud_run.canary_revision_tags' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.cloud_run.prior_revision_tags' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.cloud_run.stable_revision_tags' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.gateway_service_mesh.deployment' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.gateway_service_mesh.http_route' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.gateway_service_mesh.pod_selector_label' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.gateway_service_mesh.route_destinations.destination_ids' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.gateway_service_mesh.route_destinations.propagate_service' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.gateway_service_mesh.route_update_wait_time' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.gateway_service_mesh.service' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.gateway_service_mesh.stable_cutback_duration' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.service_networking.deployment' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.service_networking.disable_pod_overprovisioning' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.service_networking.pod_selector_label' - - field: 'serial_pipeline.stages.strategy.canary.runtime_config.kubernetes.service_networking.service' - - field: 'serial_pipeline.stages.strategy.standard.postdeploy.actions' - - field: 'serial_pipeline.stages.strategy.standard.predeploy.actions' - - field: 'serial_pipeline.stages.strategy.standard.verify' - - field: 'serial_pipeline.stages.target_id' - - field: 'suspended' - - field: 'terraform_labels' - provider_only: true - - field: 'uid' - - field: 'update_time' diff --git a/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_meta.yaml b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_meta.yaml index f275b6f7f752..9283431289bf 100644 --- a/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_meta.yaml +++ b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_meta.yaml @@ -3,41 +3,3 @@ generation_type: 'dcl' api_service_name: 'clouddeploy.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Target' -fields: - - field: 'annotations' - - field: 'anthos_cluster.membership' - - field: 'associated_entities.anthos_clusters.membership' - - field: 'associated_entities.entity_id' - - field: 'associated_entities.gke_clusters.cluster' - - field: 'associated_entities.gke_clusters.internal_ip' - - field: 'associated_entities.gke_clusters.proxy_url' - - field: 'create_time' - - field: 'custom_target.custom_target_type' - - field: 'deploy_parameters' - - field: 'description' - - field: 'effective_annotations' - provider_only: true - - field: 'effective_labels' - provider_only: true - - field: 'etag' - - field: 'execution_configs.artifact_storage' - - field: 'execution_configs.execution_timeout' - - field: 'execution_configs.service_account' - - field: 'execution_configs.usages' - - field: 'execution_configs.verbose' - - field: 'execution_configs.worker_pool' - - field: 'gke.cluster' - - field: 'gke.internal_ip' - - field: 'gke.proxy_url' - - field: 'labels' - - field: 'location' - - field: 'multi_target.target_ids' - - field: 'name' - - field: 'project' - - field: 'require_approval' - - field: 'run.location' - - field: 'target_id' - - field: 'terraform_labels' - provider_only: true - - field: 'uid' - - field: 'update_time' diff --git a/mmv1/third_party/terraform/services/cloudfunctions/resource_cloudfunctions_function_meta.yaml b/mmv1/third_party/terraform/services/cloudfunctions/resource_cloudfunctions_function_meta.yaml index c0a8e21b27b8..e243f9e9cb1d 100644 --- a/mmv1/third_party/terraform/services/cloudfunctions/resource_cloudfunctions_function_meta.yaml +++ b/mmv1/third_party/terraform/services/cloudfunctions/resource_cloudfunctions_function_meta.yaml @@ -3,51 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudfunctions.googleapis.com' api_version: 'v1' api_resource_type_kind: 'CloudFunction' -fields: - - field: 'available_memory_mb' - - field: 'build_environment_variables' - - field: 'build_service_account' - - field: 'build_worker_pool' - - field: 'description' - - field: 'docker_registry' - - field: 'docker_repository' - - field: 'effective_labels' - provider_only: true - - field: 'entry_point' - - field: 'environment_variables' - - field: 'event_trigger.event_type' - - field: 'event_trigger.failure_policy.retry' - - field: 'event_trigger.resource' - - field: 'https_trigger_security_level' - - field: 'https_trigger_url' - - field: 'ingress_settings' - - field: 'kms_key_name' - - field: 'labels' - - field: 'max_instances' - - field: 'min_instances' - - field: 'name' - - field: 'project' - - field: 'region' - - field: 'runtime' - - field: 'secret_environment_variables.key' - - field: 'secret_environment_variables.project_id' - - field: 'secret_environment_variables.secret' - - field: 'secret_environment_variables.version' - - field: 'secret_volumes.mount_path' - - field: 'secret_volumes.project_id' - - field: 'secret_volumes.secret' - - field: 'secret_volumes.versions.path' - - field: 'secret_volumes.versions.version' - - field: 'service_account_email' - - field: 'source_archive_bucket' - - field: 'source_archive_object' - - field: 'source_repository.deployed_url' - - field: 'source_repository.url' - - field: 'status' - - field: 'terraform_labels' - provider_only: true - - field: 'timeout' - - field: 'trigger_http' - - field: 'version_id' - - field: 'vpc_connector' - - field: 'vpc_connector_egress_settings' diff --git a/mmv1/third_party/terraform/services/cloudfunctions/resource_cloudfunctions_function_test.go.tmpl b/mmv1/third_party/terraform/services/cloudfunctions/resource_cloudfunctions_function_test.go.tmpl index 302eb5b455ab..6c8b5f76e133 100644 --- a/mmv1/third_party/terraform/services/cloudfunctions/resource_cloudfunctions_function_test.go.tmpl +++ b/mmv1/third_party/terraform/services/cloudfunctions/resource_cloudfunctions_function_test.go.tmpl @@ -25,15 +25,6 @@ const testFirestoreTriggerPath = "./test-fixtures/firestore_trigger.js" const testSecretEnvVarFunctionPath = "./test-fixtures/secret_environment_variables.js" const testSecretVolumesMountFunctionPath = "./test-fixtures/secret_volumes_mount.js" -func bootstrapGcfAdminAgents(t *testing.T) { - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com", - Role: "roles/vpcaccess.admin", - }, - }) -} - func TestAccCloudFunctionsFunction_basic(t *testing.T) { t.Parallel() @@ -428,16 +419,16 @@ func TestAccCloudFunctionsFunction_vpcConnector(t *testing.T) { networkName := fmt.Sprintf("tf-test-net-%d", acctest.RandInt(t)) vpcConnectorName := fmt.Sprintf("tf-test-conn-%s", acctest.RandString(t, 5)) zipFilePath := acctest.CreateZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) + projectNumber := os.Getenv("GOOGLE_PROJECT_NUMBER") defer os.Remove(zipFilePath) // clean up - bootstrapGcfAdminAgents(t) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccCloudFunctionsFunction_vpcConnector(networkName, functionName, bucketName, zipFilePath, "10.10.0.0/28", vpcConnectorName), + Config: testAccCloudFunctionsFunction_vpcConnector(projectNumber, networkName, functionName, bucketName, zipFilePath, "10.10.0.0/28", vpcConnectorName), }, { ResourceName: funcResourceName, @@ -446,7 +437,7 @@ func TestAccCloudFunctionsFunction_vpcConnector(t *testing.T) { ImportStateVerifyIgnore: []string{"build_environment_variables", "labels", "terraform_labels"}, }, { - Config: testAccCloudFunctionsFunction_vpcConnector(networkName, functionName, bucketName, zipFilePath, "10.20.0.0/28", vpcConnectorName+"-update"), + Config: testAccCloudFunctionsFunction_vpcConnector(projectNumber, networkName, functionName, bucketName, zipFilePath, "10.20.0.0/28", vpcConnectorName+"-update"), }, { ResourceName: funcResourceName, @@ -467,16 +458,16 @@ func TestAccCloudFunctionsFunction_vpcConnectorEgressSettings(t *testing.T) { networkName := fmt.Sprintf("tf-test-net-%d", acctest.RandInt(t)) vpcConnectorName := fmt.Sprintf("tf-test-conn-%s", acctest.RandString(t, 5)) zipFilePath := acctest.CreateZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath) + projectNumber := os.Getenv("GOOGLE_PROJECT_NUMBER") defer os.Remove(zipFilePath) // clean up - bootstrapGcfAdminAgents(t) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckCloudFunctionsFunctionDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccCloudFunctionsFunction_vpcConnectorEgressSettings(networkName, functionName, bucketName, zipFilePath, "10.10.0.0/28", vpcConnectorName, "PRIVATE_RANGES_ONLY"), + Config: testAccCloudFunctionsFunction_vpcConnectorEgressSettings(projectNumber, networkName, functionName, bucketName, zipFilePath, "10.10.0.0/28", vpcConnectorName, "PRIVATE_RANGES_ONLY"), }, { ResourceName: funcResourceName, @@ -485,7 +476,7 @@ func TestAccCloudFunctionsFunction_vpcConnectorEgressSettings(t *testing.T) { ImportStateVerifyIgnore: []string{"build_environment_variables", "labels", "terraform_labels"}, }, { - Config: testAccCloudFunctionsFunction_vpcConnectorEgressSettings(networkName, functionName, bucketName, zipFilePath, "10.20.0.0/28", vpcConnectorName+"-update", "ALL_TRAFFIC"), + Config: testAccCloudFunctionsFunction_vpcConnectorEgressSettings(projectNumber, networkName, functionName, bucketName, zipFilePath, "10.20.0.0/28", vpcConnectorName+"-update", "ALL_TRAFFIC"), }, { ResourceName: funcResourceName, @@ -1062,10 +1053,16 @@ resource "google_cloudfunctions_function" "function" { `, bucketName, zipFilePath, functionName) } -func testAccCloudFunctionsFunction_vpcConnector(networkName, functionName, bucketName, zipFilePath, vpcIp, vpcConnectorName string) string { +func testAccCloudFunctionsFunction_vpcConnector(projectNumber, networkName, functionName, bucketName, zipFilePath, vpcIp, vpcConnectorName string) string { return fmt.Sprintf(` data "google_project" "project" {} +resource "google_project_iam_member" "gcfadmin" { + project = data.google_project.project.project_id + role = "roles/editor" + member = "serviceAccount:service-%s@gcf-admin-robot.iam.gserviceaccount.com" +} + resource "google_compute_network" "vpc" { name = "%s" auto_create_subnetworks = false @@ -1113,15 +1110,23 @@ resource "google_cloudfunctions_function" "function" { min_instances = 3 vpc_connector = google_vpc_access_connector.%s.self_link vpc_connector_egress_settings = "PRIVATE_RANGES_ONLY" + + depends_on = [google_project_iam_member.gcfadmin] } -`, networkName, vpcConnectorName, vpcConnectorName, vpcIp, bucketName, zipFilePath, functionName, vpcConnectorName) +`, projectNumber, networkName, vpcConnectorName, vpcConnectorName, vpcIp, bucketName, zipFilePath, functionName, vpcConnectorName) } -func testAccCloudFunctionsFunction_vpcConnectorEgressSettings(networkName, functionName, bucketName, zipFilePath, vpcIp, vpcConnectorName, vpcConnectorEgressSettings string) string { +func testAccCloudFunctionsFunction_vpcConnectorEgressSettings(projectNumber, networkName, functionName, bucketName, zipFilePath, vpcIp, vpcConnectorName, vpcConnectorEgressSettings string) string { return fmt.Sprintf(` data "google_project" "project" {} +resource "google_project_iam_member" "gcfadmin" { + project = data.google_project.project.project_id + role = "roles/editor" + member = "serviceAccount:service-%s@gcf-admin-robot.iam.gserviceaccount.com" +} + resource "google_compute_network" "vpc" { name = "%s" auto_create_subnetworks = false @@ -1169,8 +1174,10 @@ resource "google_cloudfunctions_function" "function" { min_instances = 3 vpc_connector = google_vpc_access_connector.%s.self_link vpc_connector_egress_settings = "%s" + + depends_on = [google_project_iam_member.gcfadmin] } -`, networkName, vpcConnectorName, vpcConnectorName, vpcIp, bucketName, zipFilePath, functionName, vpcConnectorName, vpcConnectorEgressSettings) +`, projectNumber, networkName, vpcConnectorName, vpcConnectorName, vpcIp, bucketName, zipFilePath, functionName, vpcConnectorName, vpcConnectorEgressSettings) } {{ if ne $.TargetVersionName `ga` -}} diff --git a/mmv1/third_party/terraform/services/cloudfunctions2/resource_cloudfunctions2_function_test.go b/mmv1/third_party/terraform/services/cloudfunctions2/resource_cloudfunctions2_function_test.go index 59cf477e8ada..55a33fe9bc37 100644 --- a/mmv1/third_party/terraform/services/cloudfunctions2/resource_cloudfunctions2_function_test.go +++ b/mmv1/third_party/terraform/services/cloudfunctions2/resource_cloudfunctions2_function_test.go @@ -190,12 +190,9 @@ func TestAccCloudFunctions2Function_fullUpdate(t *testing.T) { "random_suffix": acctest.RandString(t, 10), } - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a binding was added.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/services/cloudquotas/resource_cloud_quotas_quota_adjuster_settings_test.go.tmpl b/mmv1/third_party/terraform/services/cloudquotas/resource_cloud_quotas_quota_adjuster_settings_test.go.tmpl index 4fe98efd9643..addffa717ee6 100644 --- a/mmv1/third_party/terraform/services/cloudquotas/resource_cloud_quotas_quota_adjuster_settings_test.go.tmpl +++ b/mmv1/third_party/terraform/services/cloudquotas/resource_cloud_quotas_quota_adjuster_settings_test.go.tmpl @@ -55,10 +55,17 @@ func testAccCloudQuotasQuotaAdjusterSettings_basic(context map[string]interface{ provider = google-beta } + resource "google_project_service" "cloudquotas" { + provider = google-beta + project = data.google_project.project.project_id + service = "cloudquotas.googleapis.com" + } + resource "google_cloud_quotas_quota_adjuster_settings" "adjuster_settings" { provider = google-beta parent = "projects/${data.google_project.project.number}" enablement = "%{enablement}" + depends_on = [google_project_service.cloudquotas] } `, context) } @@ -69,10 +76,17 @@ func testAccCloudQuotasQuotaAdjusterSettings_updateEnabelement(context map[strin provider = google-beta } + resource "google_project_service" "cloudquotas" { + provider = google-beta + project = data.google_project.project.project_id + service = "cloudquotas.googleapis.com" + } + resource "google_cloud_quotas_quota_adjuster_settings" "adjuster_settings" { provider = google-beta parent = "projects/${data.google_project.project.number}" enablement = "%{updated_enablement}" + depends_on = [google_project_service.cloudquotas] } `, context) } diff --git a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.tmpl b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.tmpl index df1a98012b37..1885e6e675d3 100644 --- a/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.tmpl +++ b/mmv1/third_party/terraform/services/cloudrunv2/resource_cloud_run_v2_service_test.go.tmpl @@ -7,7 +7,6 @@ import ( "time" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" "github.com/hashicorp/terraform-provider-google/google/services/cloudrunv2" @@ -1387,175 +1386,3 @@ resource "google_cloud_run_v2_service" "default" { `, context) } {{- end }} - -func TestAccCloudRunV2Service_cloudrunv2ServiceFunctionExample_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "zip_path": "./test-fixtures/function-source.zip", - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccCloudRunV2Service_cloudrunv2ServiceFunctionExample_full(context), - }, - { - ResourceName: "google_cloud_run_v2_service.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"annotations", "deletion_protection", "labels", "location", "name", "terraform_labels"}, - }, - { - Config: testAccCloudRunV2Service_cloudrunv2ServiceFunctionExample_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_cloud_run_v2_service.default", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_cloud_run_v2_service.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"annotations", "deletion_protection", "labels", "location", "name", "terraform_labels"}, - }, - }, - }) -} - -func testAccCloudRunV2Service_cloudrunv2ServiceFunctionExample_full(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_cloud_run_v2_service" "default" { - name = "tf-test-cloudrun-service%{random_suffix}" - location = "us-central1" - deletion_protection = false - ingress = "INGRESS_TRAFFIC_ALL" - - template { - containers { - image = "us-docker.pkg.dev/cloudrun/container/hello" - base_image_uri = "us-central1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/nodejs22" - } - } - build_config { - source_location = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - function_target = "helloHttp" - image_uri = "us-docker.pkg.dev/cloudrun/container/hello" - base_image = "us-central1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/nodejs22" - enable_automatic_updates = true - worker_pool = "worker-pool" - environment_variables = { - FOO_KEY = "FOO_VALUE" - BAR_KEY = "BAR_VALUE" - } - service_account = google_service_account.cloudbuild_service_account.id - } - depends_on = [ - google_project_iam_member.act_as, - google_project_iam_member.logs_writer - ] -} - -data "google_project" "project" { -} - -resource "google_storage_bucket" "bucket" { - name = "${data.google_project.project.project_id}-tf-test-gcf-source%{random_suffix}" # Every bucket name must be globally unique - location = "US" - uniform_bucket_level_access = true -} - -resource "google_storage_bucket_object" "object" { - name = "function-source.zip" - bucket = google_storage_bucket.bucket.name - source = "%{zip_path}" # Add path to the zipped function source code -} - -resource "google_service_account" "cloudbuild_service_account" { - account_id = "tf-test-build-sa%{random_suffix}" -} - -resource "google_project_iam_member" "act_as" { - project = data.google_project.project.project_id - role = "roles/iam.serviceAccountUser" - member = "serviceAccount:${google_service_account.cloudbuild_service_account.email}" -} - -resource "google_project_iam_member" "logs_writer" { - project = data.google_project.project.project_id - role = "roles/logging.logWriter" - member = "serviceAccount:${google_service_account.cloudbuild_service_account.email}" -} -`, context) -} - -func testAccCloudRunV2Service_cloudrunv2ServiceFunctionExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_cloud_run_v2_service" "default" { - name = "tf-test-cloudrun-service%{random_suffix}" - location = "us-central1" - deletion_protection = false - ingress = "INGRESS_TRAFFIC_ALL" - - template { - containers { - image = "us-docker.pkg.dev/cloudrun/container/hello" - base_image_uri = "us-central1-docker.pkg.dev/serverless-runtimes/google-22/runtimes/nodejs22" - } - } - build_config { - source_location = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - function_target = "helloHttp" - image_uri = "gcr.io/cloudrun/hello:latest" - base_image = "us-central1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/nodejs20" - enable_automatic_updates = false - worker_pool = "worker-pool-2" - environment_variables = { - FOO_KEY_FOO = "FOO_VALUE_FOO" - BAR_KEY_BAR = "BAR_VALUE_BAR" - } - service_account = google_service_account.cloudbuild_service_account.id - } - depends_on = [ - google_project_iam_member.act_as, - google_project_iam_member.logs_writer - ] -} - -data "google_project" "project" { -} - -resource "google_storage_bucket" "bucket" { - name = "${data.google_project.project.project_id}-tf-test-gcf-source%{random_suffix}" # Every bucket name must be globally unique - location = "US" - uniform_bucket_level_access = true -} - -resource "google_storage_bucket_object" "object" { - name = "function-source-updated.zip" - bucket = google_storage_bucket.bucket.name - source = "%{zip_path}" # Add path to the zipped function source code -} - -resource "google_service_account" "cloudbuild_service_account" { - account_id = "tf-test-build-sa-2-%{random_suffix}" -} - -resource "google_project_iam_member" "act_as" { - project = data.google_project.project.project_id - role = "roles/iam.serviceAccountUser" - member = "serviceAccount:${google_service_account.cloudbuild_service_account.email}" -} - -resource "google_project_iam_member" "logs_writer" { - project = data.google_project.project.project_id - role = "roles/logging.logWriter" - member = "serviceAccount:${google_service_account.cloudbuild_service_account.email}" -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/cloudrunv2/test-fixtures/function-source.zip b/mmv1/third_party/terraform/services/cloudrunv2/test-fixtures/function-source.zip deleted file mode 100644 index 1cb571888ef5..000000000000 Binary files a/mmv1/third_party/terraform/services/cloudrunv2/test-fixtures/function-source.zip and /dev/null differ diff --git a/mmv1/third_party/terraform/services/colab/colab_operation.go b/mmv1/third_party/terraform/services/colab/colab_operation.go deleted file mode 100644 index d39dc3263289..000000000000 --- a/mmv1/third_party/terraform/services/colab/colab_operation.go +++ /dev/null @@ -1,78 +0,0 @@ -package colab - -import ( - "encoding/json" - "errors" - "fmt" - "time" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -type ColabOperationWaiter struct { - Config *transport_tpg.Config - UserAgent string - Project string - tpgresource.CommonOperationWaiter -} - -func (w *ColabOperationWaiter) QueryOp() (interface{}, error) { - if w == nil { - return nil, fmt.Errorf("Cannot query operation, it's unset or nil.") - } - - region := tpgresource.GetRegionFromRegionalSelfLink(w.CommonOperationWaiter.Op.Name) - - // Returns the proper get. - url := fmt.Sprintf("https://%s-aiplatform.googleapis.com/v1/%s", region, w.CommonOperationWaiter.Op.Name) - - return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: w.Config, - Method: "GET", - Project: w.Project, - RawURL: url, - UserAgent: w.UserAgent, - }) -} - -func createColabWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*ColabOperationWaiter, error) { - w := &ColabOperationWaiter{ - Config: config, - UserAgent: userAgent, - Project: project, - } - if err := w.CommonOperationWaiter.SetOp(op); err != nil { - return nil, err - } - return w, nil -} - -// nolint: deadcode,unused -func ColabOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - w, err := createColabWaiter(config, op, project, activity, userAgent) - if err != nil { - return err - } - if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil { - return err - } - rawResponse := []byte(w.CommonOperationWaiter.Op.Response) - if len(rawResponse) == 0 { - return errors.New("`resource` not set in operation response") - } - return json.Unmarshal(rawResponse, response) -} - -func ColabOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - if val, ok := op["name"]; !ok || val == "" { - // This was a synchronous call - there is no operation to wait for. - return nil - } - w, err := createColabWaiter(config, op, project, activity, userAgent) - if err != nil { - // If w is nil, the op was synchronous. - return err - } - return tpgresource.OperationWait(w, activity, timeout, config.PollInterval) -} diff --git a/mmv1/third_party/terraform/services/colab/resource_colab_runtime_test.go b/mmv1/third_party/terraform/services/colab/resource_colab_runtime_test.go deleted file mode 100644 index 50a2c0a2c7fc..000000000000 --- a/mmv1/third_party/terraform/services/colab/resource_colab_runtime_test.go +++ /dev/null @@ -1,271 +0,0 @@ -package colab_test - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccColabRuntime_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "key_name": acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name, - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckColabRuntimeDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccColabRuntime_full(context), - }, - { - ResourceName: "google_colab_runtime.runtime", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"desired_state", "location", "name", "auto_upgrade"}, - }, - { - Config: testAccColabRuntime_no_state(context), - }, - { - ResourceName: "google_colab_runtime.runtime", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"desired_state", "location", "name", "auto_upgrade"}, - }, - { - Config: testAccColabRuntime_stopped(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_colab_runtime.runtime", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_colab_runtime.runtime", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"desired_state", "location", "name", "auto_upgrade"}, - }, - { - Config: testAccColabRuntime_full(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_colab_runtime.runtime", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_colab_runtime.runtime", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"desired_state", "location", "name", "auto_upgrade"}, - }, - }, - }) -} - -func testAccColabRuntime_full(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_colab_runtime_template" "my_template" { - name = "tf-test-colab-runtime%{random_suffix}" - display_name = "Runtime template full" - location = "us-central1" - description = "Full runtime template" - machine_spec { - machine_type = "n1-standard-2" - accelerator_type = "NVIDIA_TESLA_T4" - accelerator_count = "1" - } - - data_persistent_disk_spec { - disk_type = "pd-standard" - disk_size_gb = 200 - } - - network_spec { - enable_internet_access = true - } - - labels = { - k = "val" - } - - idle_shutdown_config { - idle_timeout = "3600s" - } - - euc_config { - euc_disabled = true - } - - shielded_vm_config { - enable_secure_boot = true - } - - network_tags = ["abc", "def"] - - encryption_spec { - kms_key_name = "%{key_name}" - } -} - -resource "google_colab_runtime" "runtime" { - name = "tf-test-colab-runtime%{random_suffix}" - location = "us-central1" - - notebook_runtime_template_ref { - notebook_runtime_template = google_colab_runtime_template.my_template.id - } - - display_name = "Runtime full" - runtime_user = "gterraformtestuser@gmail.com" - description = "Full runtime" - - desired_state = "RUNNING" - - auto_upgrade = true - - depends_on = [ - google_colab_runtime_template.my_template - ] -} -`, context) -} - -func testAccColabRuntime_stopped(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_colab_runtime_template" "my_template" { - name = "tf-test-colab-runtime%{random_suffix}" - display_name = "Runtime template full" - location = "us-central1" - description = "Full runtime template" - machine_spec { - machine_type = "n1-standard-2" - accelerator_type = "NVIDIA_TESLA_T4" - accelerator_count = "1" - } - - data_persistent_disk_spec { - disk_type = "pd-standard" - disk_size_gb = 200 - } - - network_spec { - enable_internet_access = true - } - - labels = { - k = "val" - } - - idle_shutdown_config { - idle_timeout = "3600s" - } - - euc_config { - euc_disabled = true - } - - shielded_vm_config { - enable_secure_boot = true - } - - network_tags = ["abc", "def"] - - encryption_spec { - kms_key_name = "%{key_name}" - } -} - -resource "google_colab_runtime" "runtime" { - name = "tf-test-colab-runtime%{random_suffix}" - location = "us-central1" - - notebook_runtime_template_ref { - notebook_runtime_template = google_colab_runtime_template.my_template.id - } - - display_name = "Runtime full" - runtime_user = "gterraformtestuser@gmail.com" - description = "Full runtime" - - desired_state = "STOPPED" - - depends_on = [ - google_colab_runtime_template.my_template - ] -} -`, context) -} - -func testAccColabRuntime_no_state(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_colab_runtime_template" "my_template" { - name = "tf-test-colab-runtime%{random_suffix}" - display_name = "Runtime template full" - location = "us-central1" - description = "Full runtime template" - machine_spec { - machine_type = "n1-standard-2" - accelerator_type = "NVIDIA_TESLA_T4" - accelerator_count = "1" - } - - data_persistent_disk_spec { - disk_type = "pd-standard" - disk_size_gb = 200 - } - - network_spec { - enable_internet_access = true - } - - labels = { - k = "val" - } - - idle_shutdown_config { - idle_timeout = "3600s" - } - - euc_config { - euc_disabled = true - } - - shielded_vm_config { - enable_secure_boot = true - } - - network_tags = ["abc", "def"] - - encryption_spec { - kms_key_name = "%{key_name}" - } -} - -resource "google_colab_runtime" "runtime" { - name = "tf-test-colab-runtime%{random_suffix}" - location = "us-central1" - - notebook_runtime_template_ref { - notebook_runtime_template = google_colab_runtime_template.my_template.id - } - - display_name = "Runtime full" - runtime_user = "gterraformtestuser@gmail.com" - description = "Full runtime" - - depends_on = [ - google_colab_runtime_template.my_template - ] -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/colab/resource_colab_schedule_test.go b/mmv1/third_party/terraform/services/colab/resource_colab_schedule_test.go deleted file mode 100644 index a4eab875fe7d..000000000000 --- a/mmv1/third_party/terraform/services/colab/resource_colab_schedule_test.go +++ /dev/null @@ -1,566 +0,0 @@ -package colab_test - -import ( - "testing" - "time" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" -) - -func TestAccColabSchedule_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "location": envvar.GetTestRegionFromEnv(), - "project_id": envvar.GetTestProjectFromEnv(), - "service_account": envvar.GetTestServiceAccountFromEnv(t), - "end_time": time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 10).Format(time.RFC3339), - "start_time": time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 1).Format(time.RFC3339), - "random_suffix": acctest.RandString(t, 10), - "updated_start_time": time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 2).Format(time.RFC3339), - "updated_end_time": time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 5).Format(time.RFC3339), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckColabScheduleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccColabSchedule_full(context), - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location"}, - }, - { - Config: testAccColabSchedule_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_colab_schedule.schedule", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location"}, - }, - }, - }) -} - -func TestAccColabSchedule_update_state(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "location": envvar.GetTestRegionFromEnv(), - "project_id": envvar.GetTestProjectFromEnv(), - "service_account": envvar.GetTestServiceAccountFromEnv(t), - "end_time": time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 10).Format(time.RFC3339), - "start_time": time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 1).Format(time.RFC3339), - "random_suffix": acctest.RandString(t, 10), - "updated_start_time": time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 2).Format(time.RFC3339), - "updated_end_time": time.Date(time.Now().Year(), 12, 31, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 0, 5).Format(time.RFC3339), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckColabScheduleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccColabSchedule_full(context), - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "desired_state"}, - }, - { - Config: testAccColabSchedule_active(context), - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "desired_state"}, - }, - { - Config: testAccColabSchedule_paused(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_colab_schedule.schedule", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "desired_state"}, - }, - { - Config: testAccColabSchedule_active(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_colab_schedule.schedule", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "desired_state"}, - }, - { - Config: testAccColabSchedule_full(context), - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "desired_state"}, - }, - { - Config: testAccColabSchedule_paused(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_colab_schedule.schedule", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "desired_state"}, - }, - { - Config: testAccColabSchedule_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_colab_schedule.schedule", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "desired_state"}, - }, - { - Config: testAccColabSchedule_active(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_colab_schedule.schedule", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_colab_schedule.schedule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "desired_state"}, - }, - }, - }) -} - -func testAccColabSchedule_full(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_colab_runtime_template" "my_runtime_template" { - name = "tf-test-runtime-template%{random_suffix}" - display_name = "Runtime template" - location = "us-central1" - - machine_spec { - machine_type = "e2-standard-4" - } - - network_spec { - enable_internet_access = true - } -} - -resource "google_storage_bucket" "output_bucket" { - name = "tf_test_my_bucket%{random_suffix}" - location = "US" - force_destroy = true - uniform_bucket_level_access = true -} - -resource "google_storage_bucket_object" "notebook" { - name = "hello_world.ipynb" - bucket = google_storage_bucket.output_bucket.name - content = < 0 && oldMaxDuration[0] != nil { - oldMaxDurationMap = oldMaxDuration[0].(map[string]interface{}) - } else { - oldMaxDurationMap = nil - } - - if len(newMaxDuration) > 0 && newMaxDuration[0] != nil { - newMaxDurationMap = newMaxDuration[0].(map[string]interface{}) - } else { - newMaxDurationMap = nil - } - - if oldGrShut["enabled"] != newGrShut["enabled"] { - return true - } - if oldMaxDurationMap["seconds"] != newMaxDurationMap["seconds"] { - return true - } - if oldMaxDurationMap["nanos"] != newMaxDurationMap["nanos"] { - return true - } - - return false -} -{{- end }} - func hasMaxRunDurationChanged(oScheduling, nScheduling map[string]interface{}) bool { oMrd := oScheduling["max_run_duration"].([]interface{}) nMrd := nScheduling["max_run_duration"].([]interface{}) - + if (len(oMrd) == 0 || oMrd[0] == nil) && (len(nMrd) == 0 || nMrd[0] == nil) { return false } diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl index 0800230929f7..c3d9b9645f12 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl @@ -46,10 +46,12 @@ func DataSourceGoogleComputeNetwork() *schema.Resource { Computed: true, }, + {{- if ne $.TargetVersionName "ga" }} "network_profile": { Type: schema.TypeString, Optional: true, }, + {{- end }} "self_link": { Type: schema.TypeString, @@ -95,9 +97,11 @@ func dataSourceGoogleComputeNetworkRead(d *schema.ResourceData, meta interface{} if err := d.Set("internal_ipv6_range", network.InternalIpv6Range); err != nil { return fmt.Errorf("Error setting internal_ipv6_range: %s", err) } + {{- if ne $.TargetVersionName "ga" }} if err := d.Set("network_profile", network.NetworkProfile); err != nil { return fmt.Errorf("Error setting network_profile: %s", err) } + {{- end }} if err := d.Set("self_link", network.SelfLink); err != nil { return fmt.Errorf("Error setting self_link: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_attached_disk_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_attached_disk_meta.yaml.tmpl index 84b56087f7b1..44e33adea27b 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_attached_disk_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_attached_disk_meta.yaml.tmpl @@ -7,11 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Instance' -fields: - - field: 'device_name' - - field: 'disk' - - field: 'instance' - - field: 'interface' - - field: 'mode' - - field: 'project' - - field: 'zone' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication_meta.yaml.tmpl index f85303999b6b..cdf1e3eeea2b 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_disk_async_replication_meta.yaml.tmpl @@ -7,7 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Disk' -fields: - - field: 'primary_disk' - - field: 'secondary_disk.disk' - - field: 'secondary_disk.state' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.tmpl index 7798872843a5..b3bc5a8b267d 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_disk_test.go.tmpl @@ -588,12 +588,9 @@ func TestAccComputeDisk_encryptionKMS(t *testing.T) { importID := fmt.Sprintf("%s/%s/%s", pid, "us-central1-a", diskName) var disk compute.Disk - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_meta.yaml.tmpl new file mode 100644 index 000000000000..e93899f2abda --- /dev/null +++ b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_meta.yaml.tmpl @@ -0,0 +1,9 @@ +resource: 'google_compute_firewall_policy' +generation_type: 'dcl' +api_service_name: 'compute.googleapis.com' +{{- if ne $.TargetVersionName "ga" }} +api_version: 'beta' +{{- else }} +api_version: 'v1' +{{- end }} +api_resource_type_kind: 'FirewallPolicy' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_rule_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_rule_test.go.tmpl index 3ee224c40dec..3a5a15de7f7a 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_rule_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_rule_test.go.tmpl @@ -628,7 +628,7 @@ resource "google_folder" "folder" { resource "google_compute_firewall_policy" "fw_policy" { parent = google_folder.folder.id short_name = "tf-test-policy-%{random_suffix}" - description = "Resource created for Terraform acceptance testing" + description = "Description Update" } resource "google_network_security_address_group" "address_group" { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.tmpl index fd8366e75dee..565f88130f62 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.tmpl @@ -87,6 +87,7 @@ func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) { }) } +{{ if ne $.TargetVersionName `ga` -}} func TestAccComputeGlobalForwardingRule_labels(t *testing.T) { t.Parallel() @@ -122,72 +123,7 @@ func TestAccComputeGlobalForwardingRule_labels(t *testing.T) { }, }) } - -func TestAccComputeGlobalForwardingRule_allApisLabels(t *testing.T) { - t.Parallel() - - fr := fmt.Sprintf("frtest%s", acctest.RandString(t, 10)) - address := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputeGlobalForwardingRule_allApisLabels(fr, address), - }, - { - ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"port_range", "target", "labels", "terraform_labels"}, - }, - { - Config: testAccComputeGlobalForwardingRule_allApisLabelsUpdated(fr, address), - }, - { - ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"port_range", "target", "labels", "terraform_labels"}, - }, - }, - }) -} - -func TestAccComputeGlobalForwardingRule_vpcscLabels(t *testing.T) { - t.Parallel() - - fr := fmt.Sprintf("frtest%s", acctest.RandString(t, 10)) - address := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputeGlobalForwardingRule_vpcscLabels(fr, address), - }, - { - ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"port_range", "target", "labels", "terraform_labels"}, - }, - { - Config: testAccComputeGlobalForwardingRule_vpcscLabelsUpdated(fr, address), - }, - { - ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"port_range", "labels", "terraform_labels"}, - }, - }, - }) -} +{{- end }} {{ if ne $.TargetVersionName `ga` -}} func TestAccComputeGlobalForwardingRule_internalLoadBalancing(t *testing.T) { @@ -425,6 +361,7 @@ resource "google_compute_url_map" "url_map" { `, fr, targetProxy, proxy, proxy2, backend, hc, urlmap) } +{{ if ne $.TargetVersionName `ga` -}} func testAccComputeGlobalForwardingRule_labels(fr, proxy, backend, hc, urlmap string) string { return fmt.Sprintf(` resource "google_compute_global_forwarding_rule" "forwarding_rule" { @@ -479,7 +416,9 @@ resource "google_compute_url_map" "urlmap" { } `, fr, proxy, backend, hc, urlmap) } +{{- end }} +{{ if ne $.TargetVersionName `ga` -}} func testAccComputeGlobalForwardingRule_labelsUpdated(fr, proxy, backend, hc, urlmap string) string { return fmt.Sprintf(` resource "google_compute_global_forwarding_rule" "forwarding_rule" { @@ -534,106 +473,7 @@ resource "google_compute_url_map" "urlmap" { } `, fr, proxy, backend, hc, urlmap) } - -func testAccComputeGlobalForwardingRule_allApisLabels(fr, address string) string { - return fmt.Sprintf(` -resource "google_compute_global_forwarding_rule" "forwarding_rule" { - name = "%s" - network = "default" - target = "all-apis" - ip_address = google_compute_global_address.default.id - load_balancing_scheme = "" - labels = { - my-label = "a-value" - a-different-label = "my-second-label-value" - } -} - -resource "google_compute_global_address" "default" { - name = "%s" - address_type = "INTERNAL" - purpose = "PRIVATE_SERVICE_CONNECT" - network = "default" - address = "100.100.100.105" -} - -`, fr, address) -} - -func testAccComputeGlobalForwardingRule_allApisLabelsUpdated(fr, address string) string { - return fmt.Sprintf(` -resource "google_compute_global_forwarding_rule" "forwarding_rule" { - name = "%s" - network = "default" - target = "all-apis" - ip_address = google_compute_global_address.default.id - load_balancing_scheme = "" - labels = { - my-label = "a-value" - a-different-label = "my-third-label-value" - } -} - -resource "google_compute_global_address" "default" { - name = "%s" - address_type = "INTERNAL" - purpose = "PRIVATE_SERVICE_CONNECT" - network = "default" - address = "100.100.100.105" -} - -`, fr, address) -} - -func testAccComputeGlobalForwardingRule_vpcscLabels(fr, address string) string { - return fmt.Sprintf(` -resource "google_compute_global_forwarding_rule" "forwarding_rule" { - name = "%s" - network = "default" - target = "vpc-sc" - ip_address = google_compute_global_address.default.id - load_balancing_scheme = "" - labels = { - my-label = "a-value" - a-different-label = "my-second-label-value" - } -} - -resource "google_compute_global_address" "default" { - name = "%s" - address_type = "INTERNAL" - purpose = "PRIVATE_SERVICE_CONNECT" - network = "default" - address = "100.100.100.106" -} - -`, fr, address) -} - -func testAccComputeGlobalForwardingRule_vpcscLabelsUpdated(fr, address string) string { - return fmt.Sprintf(` -resource "google_compute_global_forwarding_rule" "forwarding_rule" { - name = "%s" - network = "default" - target = "vpc-sc" - ip_address = google_compute_global_address.default.id - load_balancing_scheme = "" - labels = { - my-label = "a-value" - a-different-label = "my-third-label-value" - } -} - -resource "google_compute_global_address" "default" { - name = "%s" - address_type = "INTERNAL" - purpose = "PRIVATE_SERVICE_CONNECT" - network = "default" - address = "100.100.100.106" -} - -`, fr, address) -} +{{- end }} func testAccComputeGlobalForwardingRule_ipv6(fr, proxy, backend, hc, urlmap string) string { return fmt.Sprintf(` diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl index 0d2fda15bac6..158e7fccaba6 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl @@ -100,7 +100,6 @@ var ( {{- if ne $.TargetVersionName "ga" }} "scheduling.0.maintenance_interval", "scheduling.0.host_error_timeout_seconds", - "scheduling.0.graceful_shutdown", {{- end }} "scheduling.0.local_ssd_recovery_timeout", } @@ -468,8 +467,13 @@ func ResourceComputeInstance() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, + {{- if eq $.TargetVersionName `ga` }} + ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "IDPF"}, false), + Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, IDPF`, + {{- else }} ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "IDPF", "MRDMA", "IRDMA"}, false), Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, IDPF, MRDMA, and IRDMA`, + {{- end }} }, "access_config": { Type: schema.TypeList, @@ -993,49 +997,6 @@ be from 0 to 999,999,999 inclusive.`, }, }, }, - {{ if ne $.TargetVersionName `ga` -}} - "graceful_shutdown": { - Type: schema.TypeList, - Optional: true, - Description: `Settings for the instance to perform a graceful shutdown.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "enabled": { - Type: schema.TypeBool, - Required: true, - Description: `Opts-in for graceful shutdown.`, - }, - "max_duration": { - Type: schema.TypeList, - Optional: true, - Description: `The time allotted for the instance to gracefully shut down. - If the graceful shutdown isn't complete after this time, then the instance - transitions to the STOPPING state.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "seconds": { - Type: schema.TypeInt, - Required: true, - Description: `Span of time at a resolution of a second. - The value must be between 1 and 3600, which is 3,600 seconds (one hour).`, - }, - "nanos": { - Type: schema.TypeInt, - Optional: true, - Description: `Span of time that's a fraction of a second at nanosecond - resolution. Durations less than one second are represented - with a 0 seconds field and a positive nanos field. Must - be from 0 to 999,999,999 inclusive.`, - }, - }, - }, - }, - }, - }, - }, - {{- end }} }, }, }, @@ -1907,28 +1868,9 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("scratch_disk", scratchDisks); err != nil { return fmt.Errorf("Error setting scratch_disk: %s", err) } - -{{ if eq $.TargetVersionName `ga` -}} if err := d.Set("scheduling", flattenScheduling(instance.Scheduling)); err != nil { return fmt.Errorf("Error setting scheduling: %s", err) } -{{ else -}} - // Workaroud: API doesn't update the scheduling.graceful_shutdown.max_duration.nanos field. - // To avoid diff, we need to set the value from the state not from API response. - scheduling := flattenScheduling(instance.Scheduling) - if nanos, ok := d.GetOk("scheduling.0.graceful_shutdown.0.max_duration.0.nanos"); ok { - graceful_shutdown := scheduling[0]["graceful_shutdown"].([]interface{})[0].(map[string]interface{}) - max_duration := graceful_shutdown["max_duration"].([]interface{})[0].(map[string]interface{}) - max_duration["nanos"] = int64(nanos.(int)) - - graceful_shutdown["max_duration"] = []interface{}{max_duration} - scheduling[0]["graceful_shutdown"] = []interface{}{graceful_shutdown} - } - if err := d.Set("scheduling", scheduling); err != nil { - return fmt.Errorf("Error setting scheduling: %s", err) - } -{{- end }} - if err := d.Set("guest_accelerator", flattenGuestAccelerators(instance.GuestAccelerators)); err != nil { return fmt.Errorf("Error setting guest_accelerator: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_from_machine_image_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_from_machine_image_meta.yaml.tmpl index 31ea7a782a42..3d78830f6860 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_from_machine_image_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_from_machine_image_meta.yaml.tmpl @@ -4,126 +4,4 @@ generation_type: 'handwritten' api_service_name: 'compute.googleapis.com' api_version: 'beta' api_resource_type_kind: 'Instance' -fields: - - field: 'advanced_machine_features.enable_nested_virtualization' - - field: 'advanced_machine_features.enable_uefi_networking' - - field: 'advanced_machine_features.performance_monitoring_unit' - - field: 'advanced_machine_features.threads_per_core' - - field: 'advanced_machine_features.turbo_mode' - - field: 'advanced_machine_features.visible_core_count' - - field: 'allow_stopping_for_update' - - field: 'attached_disk.device_name' - - field: 'attached_disk.disk_encryption_key_raw' - - field: 'attached_disk.disk_encryption_key_sha256' - - field: 'attached_disk.kms_key_self_link' - - field: 'attached_disk.mode' - - field: 'attached_disk.source' - - field: 'boot_disk.auto_delete' - - field: 'boot_disk.device_name' - - field: 'boot_disk.disk_encryption_key_raw' - - field: 'boot_disk.disk_encryption_key_sha256' - - field: 'boot_disk.initialize_params.enable_confidential_compute' - - field: 'boot_disk.initialize_params.image' - - field: 'boot_disk.initialize_params.labels' - - field: 'boot_disk.initialize_params.provisioned_iops' - - field: 'boot_disk.initialize_params.provisioned_throughput' - - field: 'boot_disk.initialize_params.resource_manager_tags' - - field: 'boot_disk.initialize_params.resource_policies' - - field: 'boot_disk.initialize_params.size' - - field: 'boot_disk.initialize_params.storage_pool' - - field: 'boot_disk.initialize_params.type' - - field: 'boot_disk.interface' - - field: 'boot_disk.kms_key_self_link' - - field: 'boot_disk.mode' - - field: 'boot_disk.source' - - field: 'can_ip_forward' - - field: 'confidential_instance_config.confidential_instance_type' - - field: 'confidential_instance_config.enable_confidential_compute' - - field: 'cpu_platform' - - field: 'creation_timestamp' - - field: 'current_status' - - field: 'deletion_protection' - - field: 'description' - - field: 'desired_status' - - field: 'effective_labels' - provider_only: true - - field: 'enable_display' - - field: 'guest_accelerator.count' - - field: 'guest_accelerator.type' - - field: 'hostname' - - field: 'instance_id' - - field: 'key_revocation_action_type' - - field: 'label_fingerprint' - - field: 'labels' - - field: 'machine_type' - - field: 'metadata' - - field: 'metadata_fingerprint' - - field: 'metadata_startup_script' - - field: 'min_cpu_platform' - - field: 'name' - - field: 'network_interface.access_config.nat_ip' - - field: 'network_interface.access_config.network_tier' - - field: 'network_interface.access_config.public_ptr_domain_name' - - field: 'network_interface.access_config.security_policy' - - field: 'network_interface.alias_ip_range.ip_cidr_range' - - field: 'network_interface.alias_ip_range.subnetwork_range_name' - - field: 'network_interface.internal_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.external_ipv6' - - field: 'network_interface.ipv6_access_config.external_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.name' - - field: 'network_interface.ipv6_access_config.network_tier' - - field: 'network_interface.ipv6_access_config.public_ptr_domain_name' - - field: 'network_interface.ipv6_access_config.security_policy' - - field: 'network_interface.ipv6_access_type' - - field: 'network_interface.ipv6_address' - - field: 'network_interface.name' - - field: 'network_interface.network' - - field: 'network_interface.network_attachment' - - field: 'network_interface.network_ip' - - field: 'network_interface.nic_type' - - field: 'network_interface.queue_count' - - field: 'network_interface.security_policy' - - field: 'network_interface.stack_type' - - field: 'network_interface.subnetwork' - - field: 'network_interface.subnetwork_project' - - field: 'network_performance_config.total_egress_bandwidth_tier' - - field: 'params.resource_manager_tags' - - field: 'partner_metadata' - - field: 'project' - - field: 'reservation_affinity.specific_reservation.key' - - field: 'reservation_affinity.specific_reservation.values' - - field: 'reservation_affinity.type' - - field: 'resource_policies' - - field: 'scheduling.automatic_restart' - - field: 'scheduling.availability_domain' - - field: 'scheduling.host_error_timeout_seconds' - - field: 'scheduling.instance_termination_action' - - field: 'scheduling.local_ssd_recovery_timeout.nanos' - - field: 'scheduling.local_ssd_recovery_timeout.seconds' - - field: 'scheduling.maintenance_interval' - - field: 'scheduling.max_run_duration.nanos' - - field: 'scheduling.max_run_duration.seconds' - - field: 'scheduling.min_node_cpus' - - field: 'scheduling.node_affinities.key' - - field: 'scheduling.node_affinities.operator' - - field: 'scheduling.node_affinities.values' - - field: 'scheduling.on_host_maintenance' - - field: 'scheduling.on_instance_stop_action.discard_local_ssd' - - field: 'scheduling.preemptible' - - field: 'scheduling.provisioning_model' - - field: 'scratch_disk.device_name' - - field: 'scratch_disk.interface' - - field: 'scratch_disk.size' - - field: 'self_link' - - field: 'service_account.email' - - field: 'service_account.scopes' - - field: 'shielded_instance_config.enable_integrity_monitoring' - - field: 'shielded_instance_config.enable_secure_boot' - - field: 'shielded_instance_config.enable_vtpm' - - field: 'source_machine_image' - - field: 'tags' - - field: 'tags_fingerprint' - - field: 'terraform_labels' - provider_only: true - - field: 'zone' {{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_from_template_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_from_template_meta.yaml.tmpl index 228f05fc6304..9318469eea6c 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_from_template_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_from_template_meta.yaml.tmpl @@ -7,139 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Instance' -fields: - - field: 'advanced_machine_features.enable_nested_virtualization' - - field: 'advanced_machine_features.enable_uefi_networking' - - field: 'advanced_machine_features.performance_monitoring_unit' - - field: 'advanced_machine_features.threads_per_core' - - field: 'advanced_machine_features.turbo_mode' - - field: 'advanced_machine_features.visible_core_count' - - field: 'allow_stopping_for_update' - - field: 'attached_disk.device_name' - - field: 'attached_disk.disk_encryption_key_raw' - - field: 'attached_disk.disk_encryption_key_sha256' - - field: 'attached_disk.kms_key_self_link' - - field: 'attached_disk.mode' - - field: 'attached_disk.source' - - field: 'boot_disk.auto_delete' - - field: 'boot_disk.device_name' - - field: 'boot_disk.disk_encryption_key_raw' - - field: 'boot_disk.disk_encryption_key_sha256' - - field: 'boot_disk.initialize_params.enable_confidential_compute' - - field: 'boot_disk.initialize_params.image' - - field: 'boot_disk.initialize_params.labels' - - field: 'boot_disk.initialize_params.provisioned_iops' - - field: 'boot_disk.initialize_params.provisioned_throughput' - - field: 'boot_disk.initialize_params.resource_manager_tags' - - field: 'boot_disk.initialize_params.resource_policies' - - field: 'boot_disk.initialize_params.size' - - field: 'boot_disk.initialize_params.storage_pool' - - field: 'boot_disk.initialize_params.type' - - field: 'boot_disk.interface' - - field: 'boot_disk.kms_key_self_link' - - field: 'boot_disk.mode' - - field: 'boot_disk.source' - - field: 'can_ip_forward' - - field: 'confidential_instance_config.confidential_instance_type' - - field: 'confidential_instance_config.enable_confidential_compute' - - field: 'cpu_platform' - - field: 'creation_timestamp' - - field: 'current_status' - - field: 'deletion_protection' - - field: 'description' - - field: 'desired_status' - - field: 'effective_labels' - provider_only: true - - field: 'enable_display' - - field: 'guest_accelerator.count' - - field: 'guest_accelerator.type' - - field: 'hostname' - - field: 'instance_id' - - field: 'key_revocation_action_type' - - field: 'label_fingerprint' - - field: 'labels' - - field: 'machine_type' - - field: 'metadata' - - field: 'metadata_fingerprint' - - field: 'metadata_startup_script' - - field: 'min_cpu_platform' - - field: 'name' - - field: 'network_interface.access_config.nat_ip' - - field: 'network_interface.access_config.network_tier' - - field: 'network_interface.access_config.public_ptr_domain_name' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.access_config.security_policy' -{{- end }} - - field: 'network_interface.alias_ip_range.ip_cidr_range' - - field: 'network_interface.alias_ip_range.subnetwork_range_name' - - field: 'network_interface.internal_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.external_ipv6' - - field: 'network_interface.ipv6_access_config.external_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.name' - - field: 'network_interface.ipv6_access_config.network_tier' - - field: 'network_interface.ipv6_access_config.public_ptr_domain_name' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.ipv6_access_config.security_policy' -{{- end }} - - field: 'network_interface.ipv6_access_type' - - field: 'network_interface.ipv6_address' - - field: 'network_interface.name' - - field: 'network_interface.network' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.network_attachment' -{{- end }} - - field: 'network_interface.network_ip' - - field: 'network_interface.nic_type' - - field: 'network_interface.queue_count' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.security_policy' -{{- end }} - - field: 'network_interface.stack_type' - - field: 'network_interface.subnetwork' - - field: 'network_interface.subnetwork_project' - - field: 'network_performance_config.total_egress_bandwidth_tier' - - field: 'params.resource_manager_tags' -{{- if ne $.TargetVersionName "ga" }} - - field: 'partner_metadata' -{{- end }} - - field: 'project' - - field: 'reservation_affinity.specific_reservation.key' - - field: 'reservation_affinity.specific_reservation.values' - - field: 'reservation_affinity.type' - - field: 'resource_policies' - - field: 'scheduling.automatic_restart' - - field: 'scheduling.availability_domain' -{{- if ne $.TargetVersionName "ga" }} - - field: 'scheduling.host_error_timeout_seconds' -{{- end }} - - field: 'scheduling.instance_termination_action' - - field: 'scheduling.local_ssd_recovery_timeout.nanos' - - field: 'scheduling.local_ssd_recovery_timeout.seconds' -{{- if ne $.TargetVersionName "ga" }} - - field: 'scheduling.maintenance_interval' -{{- end }} - - field: 'scheduling.max_run_duration.nanos' - - field: 'scheduling.max_run_duration.seconds' - - field: 'scheduling.min_node_cpus' - - field: 'scheduling.node_affinities.key' - - field: 'scheduling.node_affinities.operator' - - field: 'scheduling.node_affinities.values' - - field: 'scheduling.on_host_maintenance' - - field: 'scheduling.on_instance_stop_action.discard_local_ssd' - - field: 'scheduling.preemptible' - - field: 'scheduling.provisioning_model' - - field: 'scratch_disk.device_name' - - field: 'scratch_disk.interface' - - field: 'scratch_disk.size' - - field: 'self_link' - - field: 'service_account.email' - - field: 'service_account.scopes' - - field: 'shielded_instance_config.enable_integrity_monitoring' - - field: 'shielded_instance_config.enable_secure_boot' - - field: 'shielded_instance_config.enable_vtpm' - - field: 'source_instance_template' - - field: 'tags' - - field: 'tags_fingerprint' - - field: 'terraform_labels' - provider_only: true - - field: 'zone' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_meta.yaml.tmpl index bae6b7540adc..7160be228f93 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_meta.yaml.tmpl @@ -7,62 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'InstanceGroupManager' -fields: - - field: 'all_instances_config.labels' - - field: 'all_instances_config.metadata' - - field: 'auto_healing_policies.health_check' - - field: 'auto_healing_policies.initial_delay_sec' - - field: 'base_instance_name' - - field: 'creation_timestamp' - - field: 'description' - - field: 'fingerprint' - - field: 'instance_group' - - field: 'instance_group_manager_id' - - field: 'instance_lifecycle_policy.default_action_on_failure' - - field: 'instance_lifecycle_policy.force_update_on_repair' - - field: 'list_managed_instances_results' - - field: 'name' - - field: 'named_port.name' - - field: 'named_port.port' - - field: 'operation' -{{- if ne $.TargetVersionName "ga" }} - - field: 'params.resource_manager_tags' -{{- end }} - - field: 'project' - - field: 'self_link' - - field: 'standby_policy.initial_delay_sec' - - field: 'standby_policy.mode' - - field: 'stateful_disk.delete_rule' - - field: 'stateful_disk.device_name' - - field: 'stateful_external_ip.delete_rule' - - field: 'stateful_external_ip.interface_name' - - field: 'stateful_internal_ip.delete_rule' - - field: 'stateful_internal_ip.interface_name' - - field: 'status.all_instances_config.current_revision' - - field: 'status.all_instances_config.effective' - - field: 'status.is_stable' - - field: 'status.stateful.has_stateful_config' - - field: 'status.stateful.per_instance_configs.all_effective' - - field: 'status.version_target.is_reached' - - field: 'target_pools' - - field: 'target_size' - - field: 'target_stopped_size' - - field: 'target_suspended_size' - - field: 'update_policy.max_surge_fixed' - - field: 'update_policy.max_surge_percent' - - field: 'update_policy.max_unavailable_fixed' - - field: 'update_policy.max_unavailable_percent' -{{- if ne $.TargetVersionName "ga" }} - - field: 'update_policy.min_ready_sec' -{{- end }} - - field: 'update_policy.minimal_action' - - field: 'update_policy.most_disruptive_allowed_action' - - field: 'update_policy.replacement_method' - - field: 'update_policy.type' - - field: 'version.instance_template' - - field: 'version.name' - - field: 'version.target_size.fixed' - - field: 'version.target_size.percent' - - field: 'wait_for_instances' - - field: 'wait_for_instances_status' - - field: 'zone' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_meta.yaml.tmpl index 2959d7b63429..855829b72300 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_meta.yaml.tmpl @@ -7,14 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'InstanceGroup' -fields: - - field: 'description' - - field: 'instances' - - field: 'name' - - field: 'named_port.name' - - field: 'named_port.port' - - field: 'network' - - field: 'project' - - field: 'self_link' - - field: 'size' - - field: 'zone' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_meta.yaml.tmpl index d5ec7b3eba88..6d3c8772c774 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_meta.yaml.tmpl @@ -7,138 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Instance' -fields: - - field: 'advanced_machine_features.enable_nested_virtualization' - - field: 'advanced_machine_features.enable_uefi_networking' - - field: 'advanced_machine_features.performance_monitoring_unit' - - field: 'advanced_machine_features.threads_per_core' - - field: 'advanced_machine_features.turbo_mode' - - field: 'advanced_machine_features.visible_core_count' - - field: 'allow_stopping_for_update' - - field: 'attached_disk.device_name' - - field: 'attached_disk.disk_encryption_key_raw' - - field: 'attached_disk.disk_encryption_key_sha256' - - field: 'attached_disk.kms_key_self_link' - - field: 'attached_disk.mode' - - field: 'attached_disk.source' - - field: 'boot_disk.auto_delete' - - field: 'boot_disk.device_name' - - field: 'boot_disk.disk_encryption_key_raw' - - field: 'boot_disk.disk_encryption_key_sha256' - - field: 'boot_disk.initialize_params.enable_confidential_compute' - - field: 'boot_disk.initialize_params.image' - - field: 'boot_disk.initialize_params.labels' - - field: 'boot_disk.initialize_params.provisioned_iops' - - field: 'boot_disk.initialize_params.provisioned_throughput' - - field: 'boot_disk.initialize_params.resource_manager_tags' - - field: 'boot_disk.initialize_params.resource_policies' - - field: 'boot_disk.initialize_params.size' - - field: 'boot_disk.initialize_params.storage_pool' - - field: 'boot_disk.initialize_params.type' - - field: 'boot_disk.interface' - - field: 'boot_disk.kms_key_self_link' - - field: 'boot_disk.mode' - - field: 'boot_disk.source' - - field: 'can_ip_forward' - - field: 'confidential_instance_config.confidential_instance_type' - - field: 'confidential_instance_config.enable_confidential_compute' - - field: 'cpu_platform' - - field: 'creation_timestamp' - - field: 'current_status' - - field: 'deletion_protection' - - field: 'description' - - field: 'desired_status' - - field: 'effective_labels' - provider_only: true - - field: 'enable_display' - - field: 'guest_accelerator.count' - - field: 'guest_accelerator.type' - - field: 'hostname' - - field: 'instance_id' - - field: 'key_revocation_action_type' - - field: 'label_fingerprint' - - field: 'labels' - - field: 'machine_type' - - field: 'metadata' - - field: 'metadata_fingerprint' - - field: 'metadata_startup_script' - - field: 'min_cpu_platform' - - field: 'name' - - field: 'network_interface.access_config.nat_ip' - - field: 'network_interface.access_config.network_tier' - - field: 'network_interface.access_config.public_ptr_domain_name' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.access_config.security_policy' -{{- end }} - - field: 'network_interface.alias_ip_range.ip_cidr_range' - - field: 'network_interface.alias_ip_range.subnetwork_range_name' - - field: 'network_interface.internal_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.external_ipv6' - - field: 'network_interface.ipv6_access_config.external_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.name' - - field: 'network_interface.ipv6_access_config.network_tier' - - field: 'network_interface.ipv6_access_config.public_ptr_domain_name' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.ipv6_access_config.security_policy' -{{- end }} - - field: 'network_interface.ipv6_access_type' - - field: 'network_interface.ipv6_address' - - field: 'network_interface.name' - - field: 'network_interface.network' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.network_attachment' -{{- end }} - - field: 'network_interface.network_ip' - - field: 'network_interface.nic_type' - - field: 'network_interface.queue_count' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.security_policy' -{{- end }} - - field: 'network_interface.stack_type' - - field: 'network_interface.subnetwork' - - field: 'network_interface.subnetwork_project' - - field: 'network_performance_config.total_egress_bandwidth_tier' - - field: 'params.resource_manager_tags' -{{- if ne $.TargetVersionName "ga" }} - - field: 'partner_metadata' -{{- end }} - - field: 'project' - - field: 'reservation_affinity.specific_reservation.key' - - field: 'reservation_affinity.specific_reservation.values' - - field: 'reservation_affinity.type' - - field: 'resource_policies' - - field: 'scheduling.automatic_restart' - - field: 'scheduling.availability_domain' -{{- if ne $.TargetVersionName "ga" }} - - field: 'scheduling.host_error_timeout_seconds' -{{- end }} - - field: 'scheduling.instance_termination_action' - - field: 'scheduling.local_ssd_recovery_timeout.nanos' - - field: 'scheduling.local_ssd_recovery_timeout.seconds' -{{- if ne $.TargetVersionName "ga" }} - - field: 'scheduling.maintenance_interval' -{{- end }} - - field: 'scheduling.max_run_duration.nanos' - - field: 'scheduling.max_run_duration.seconds' - - field: 'scheduling.min_node_cpus' - - field: 'scheduling.node_affinities.key' - - field: 'scheduling.node_affinities.operator' - - field: 'scheduling.node_affinities.values' - - field: 'scheduling.on_host_maintenance' - - field: 'scheduling.on_instance_stop_action.discard_local_ssd' - - field: 'scheduling.preemptible' - - field: 'scheduling.provisioning_model' - - field: 'scratch_disk.device_name' - - field: 'scratch_disk.interface' - - field: 'scratch_disk.size' - - field: 'self_link' - - field: 'service_account.email' - - field: 'service_account.scopes' - - field: 'shielded_instance_config.enable_integrity_monitoring' - - field: 'shielded_instance_config.enable_secure_boot' - - field: 'shielded_instance_config.enable_vtpm' - - field: 'tags' - - field: 'tags_fingerprint' - - field: 'terraform_labels' - provider_only: true - - field: 'zone' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl index 87a2b568705c..6484ebc19eb1 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl @@ -40,7 +40,6 @@ var ( {{- if ne $.TargetVersionName "ga" }} "scheduling.0.maintenance_interval", "scheduling.0.host_error_timeout_seconds", - "scheduling.0.graceful_shutdown", {{- end }} "scheduling.0.local_ssd_recovery_timeout", } @@ -488,8 +487,13 @@ Google Cloud KMS.`, Type: schema.TypeString, Optional: true, ForceNew: true, + {{- if eq $.TargetVersionName `ga` }} + ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET"}, false), + Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET`, + {{- else }} ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA"}, false), Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, MRDMA, and IRDMA`, + {{- end }} }, "access_config": { Type: schema.TypeList, @@ -822,53 +826,6 @@ be from 0 to 999,999,999 inclusive.`, }, }, }, -{{ if ne $.TargetVersionName `ga` }} - "graceful_shutdown": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Settings for the instance to perform a graceful shutdown.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "enabled": { - Type: schema.TypeBool, - Required: true, - ForceNew: true, - Description: `Opts-in for graceful shutdown.`, - }, - "max_duration": { - Type: schema.TypeList, - Optional: true, - Description: `The time allotted for the instance to gracefully shut down. - If the graceful shutdown isn't complete after this time, then the instance - transitions to the STOPPING state.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "seconds": { - Type: schema.TypeInt, - Required: true, - ForceNew: true, - Description: `Span of time at a resolution of a second. - The value must be between 1 and 3600, which is 3,600 seconds (one hour).`, - }, - "nanos": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: `Span of time that's a fraction of a second at nanosecond - resolution. Durations less than one second are represented - with a 0 seconds field and a positive nanos field. Must - be from 0 to 999,999,999 inclusive.`, - }, - }, - }, - }, - }, - }, - }, -{{- end }} }, }, }, @@ -1968,18 +1925,6 @@ func resourceComputeInstanceTemplateRead(d *schema.ResourceData, meta interface{ } if instanceTemplate.Properties.Scheduling != nil { scheduling := flattenScheduling(instanceTemplate.Properties.Scheduling) -{{ if ne $.TargetVersionName `ga` }} - // Workaroud: API doesn't update the scheduling.graceful_shutdown.max_duration.nanos field. - // To avoid diff, we need to set the value from the state not from API response. - if nanos, ok := d.GetOk("scheduling.0.graceful_shutdown.0.max_duration.0.nanos"); ok { - graceful_shutdown := scheduling[0]["graceful_shutdown"].([]interface{})[0].(map[string]interface{}) - max_duration := graceful_shutdown["max_duration"].([]interface{})[0].(map[string]interface{}) - max_duration["nanos"] = int64(nanos.(int)) - - graceful_shutdown["max_duration"] = []interface{}{max_duration} - scheduling[0]["graceful_shutdown"] = []interface{}{graceful_shutdown} - } -{{- end }} if err = d.Set("scheduling", scheduling); err != nil { return fmt.Errorf("Error setting scheduling: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_meta.yaml.tmpl index 8b81fedb09b5..cd87c8db0e30 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_meta.yaml.tmpl @@ -7,121 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'InstanceTemplate' -fields: - - field: 'advanced_machine_features.enable_nested_virtualization' - - field: 'advanced_machine_features.enable_uefi_networking' - - field: 'advanced_machine_features.performance_monitoring_unit' - - field: 'advanced_machine_features.threads_per_core' - - field: 'advanced_machine_features.turbo_mode' - - field: 'advanced_machine_features.visible_core_count' - - field: 'can_ip_forward' - - field: 'confidential_instance_config.confidential_instance_type' - - field: 'confidential_instance_config.enable_confidential_compute' - - field: 'creation_timestamp' - - field: 'description' - - field: 'disk.auto_delete' - - field: 'disk.boot' - - field: 'disk.device_name' - - field: 'disk.disk_encryption_key.kms_key_self_link' - - field: 'disk.disk_name' - - field: 'disk.disk_size_gb' - - field: 'disk.disk_type' - - field: 'disk.interface' - - field: 'disk.labels' - - field: 'disk.mode' - - field: 'disk.provisioned_iops' - - field: 'disk.provisioned_throughput' - - field: 'disk.resource_manager_tags' - - field: 'disk.resource_policies' - - field: 'disk.source' - - field: 'disk.source_image' - - field: 'disk.source_image_encryption_key.kms_key_self_link' - - field: 'disk.source_image_encryption_key.kms_key_service_account' - - field: 'disk.source_snapshot' - - field: 'disk.source_snapshot_encryption_key.kms_key_self_link' - - field: 'disk.source_snapshot_encryption_key.kms_key_service_account' - - field: 'disk.type' - - field: 'effective_labels' - provider_only: true -{{- if ne $.TargetVersionName "ga" }} - - field: 'enable_display' -{{- end }} - - field: 'guest_accelerator.count' - - field: 'guest_accelerator.type' - - field: 'instance_description' - - field: 'key_revocation_action_type' - - field: 'labels' - - field: 'machine_type' - - field: 'metadata' - - field: 'metadata_fingerprint' - - field: 'metadata_startup_script' - - field: 'min_cpu_platform' - - field: 'name' - - field: 'name_prefix' - - field: 'network_interface.access_config.nat_ip' - - field: 'network_interface.access_config.network_tier' - - field: 'network_interface.access_config.public_ptr_domain_name' - - field: 'network_interface.alias_ip_range.ip_cidr_range' - - field: 'network_interface.alias_ip_range.subnetwork_range_name' - - field: 'network_interface.internal_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.external_ipv6' - - field: 'network_interface.ipv6_access_config.external_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.name' - - field: 'network_interface.ipv6_access_config.network_tier' - - field: 'network_interface.ipv6_access_config.public_ptr_domain_name' - - field: 'network_interface.ipv6_access_type' - - field: 'network_interface.ipv6_address' - - field: 'network_interface.name' - - field: 'network_interface.network' -{{- if ne $.TargetVersionName "ga" }} - - field: 'network_interface.network_attachment' -{{- end }} - - field: 'network_interface.network_ip' - - field: 'network_interface.nic_type' - - field: 'network_interface.queue_count' - - field: 'network_interface.stack_type' - - field: 'network_interface.subnetwork' - - field: 'network_interface.subnetwork_project' - - field: 'network_performance_config.total_egress_bandwidth_tier' -{{- if ne $.TargetVersionName "ga" }} - - field: 'partner_metadata' -{{- end }} - - field: 'project' - - field: 'region' - - field: 'reservation_affinity.specific_reservation.key' - - field: 'reservation_affinity.specific_reservation.values' - - field: 'reservation_affinity.type' - - field: 'resource_manager_tags' - - field: 'resource_policies' - - field: 'scheduling.automatic_restart' - - field: 'scheduling.availability_domain' -{{- if ne $.TargetVersionName "ga" }} - - field: 'scheduling.host_error_timeout_seconds' -{{- end }} - - field: 'scheduling.instance_termination_action' - - field: 'scheduling.local_ssd_recovery_timeout.nanos' - - field: 'scheduling.local_ssd_recovery_timeout.seconds' -{{- if ne $.TargetVersionName "ga" }} - - field: 'scheduling.maintenance_interval' -{{- end }} - - field: 'scheduling.max_run_duration.nanos' - - field: 'scheduling.max_run_duration.seconds' - - field: 'scheduling.min_node_cpus' - - field: 'scheduling.node_affinities.key' - - field: 'scheduling.node_affinities.operator' - - field: 'scheduling.node_affinities.values' - - field: 'scheduling.on_host_maintenance' - - field: 'scheduling.on_instance_stop_action.discard_local_ssd' - - field: 'scheduling.preemptible' - - field: 'scheduling.provisioning_model' - - field: 'self_link' - - field: 'self_link_unique' - - field: 'service_account.email' - - field: 'service_account.scopes' - - field: 'shielded_instance_config.enable_integrity_monitoring' - - field: 'shielded_instance_config.enable_secure_boot' - - field: 'shielded_instance_config.enable_vtpm' - - field: 'tags' - - field: 'tags_fingerprint' - - field: 'terraform_labels' - provider_only: true diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl index a05433a1004b..f1ff6bceeba2 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl @@ -1822,82 +1822,6 @@ func TestAccComputeInstanceTemplate_keyRevocationActionType(t *testing.T) { }) } -{{ if ne $.TargetVersionName `ga` -}} -func TestAccComputeInstanceTemplate_gracefulShutdown(t *testing.T) { - t.Parallel() - - var instanceTemplate compute.InstanceTemplate - instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(t, 10)) - - acceptableByApi_1 := map[string]interface{}{ - "instance_name": instanceName, - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 1), - "nanos": fmt.Sprintf("nanos = %d", 1000000), - } - invalid_1 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": "", - "nanos": "", - } - invalid_2 := map[string]interface{}{ - "instance_name": instanceName, - "enabled": "", - "seconds": "", - "nanos": "", - } - invalid_3 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 3601), - "nanos": fmt.Sprintf("nanos = %d", 1000000), - } - invalid_4 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 0), - "nanos": fmt.Sprintf("nanos = %d", 1000000000), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputeInstanceTemplate_gracefulShutdown(invalid_1), - ExpectError: regexp.MustCompile("The argument \"seconds\" is required, but no definition was found."), - }, - { - Config: testAccComputeInstanceTemplate_gracefulShutdown(invalid_2), - ExpectError: regexp.MustCompile("The argument \"enabled\" is required, but no definition was found."), - }, - { - Config: testAccComputeInstanceTemplate_gracefulShutdown(invalid_3), - ExpectError: regexp.MustCompile("must be more than 1 second in the future and less than 1 hour., invalid"), - }, - { - Config: testAccComputeInstanceTemplate_gracefulShutdown(invalid_4), - ExpectError: regexp.MustCompile("Must be less than or equal to 999999999, invalid"), - }, - { - Config: testAccComputeInstanceTemplate_gracefulShutdown(acceptableByApi_1), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), - resource.TestCheckResourceAttr("google_compute_instance_template.foobar", "scheduling.0.graceful_shutdown.0.enabled", "true"), - resource.TestCheckResourceAttr("google_compute_instance_template.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.seconds", "1"), - resource.TestCheckResourceAttr("google_compute_instance_template.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.nanos", "1000000"), - ), - }, - }, - }) -} -{{- end }} - func TestUnitComputeInstanceTemplate_IpCidrRangeDiffSuppress(t *testing.T) { cases := map[string]struct { Old, New string @@ -4819,55 +4743,6 @@ resource "google_compute_instance_template" "foobar" { } `, context) } - -func testAccComputeInstanceTemplate_gracefulShutdown(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_compute_image" "my_image" { - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_instance_template" "foobar" { - name = "%{instance_name}" - machine_type = "e2-medium" - can_ip_forward = false - tags = ["foo", "bar"] - - disk { - source_image = data.google_compute_image.my_image.self_link - auto_delete = true - boot = true - } - - network_interface { - network = "default" - } - - scheduling { - graceful_shutdown { - %{enabled} - max_duration { - %{seconds} - %{nanos} - } - } - } - - metadata = { - foo = "bar" - } - - service_account { - scopes = ["userinfo-email", "compute-ro", "storage-ro"] - } - - labels = { - my_label = "foobar" - } -} -`, context) -} - {{- end }} func testAccComputeInstanceTemplate_keyRevocationActionType(context map[string]interface{}) string { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl index 0bc0f7aca777..47177c210383 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl @@ -743,12 +743,9 @@ func TestAccComputeInstance_kmsDiskEncryption(t *testing.T) { }, } - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -3851,193 +3848,6 @@ func TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy(t *testing.T) { } } -func TestAccComputeInstance_GracefulShutdownWithResetUpdate(t *testing.T) { - t.Parallel() - - var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - acceptableByApi_1 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": fmt.Sprintf("allow_stopping_for_update = %t", true), - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 1), - "nanos": "", - } - acceptableByApi_2 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": fmt.Sprintf("allow_stopping_for_update = %t", true), - "enabled": fmt.Sprintf("enabled = %t", false), - "seconds": fmt.Sprintf("seconds = %d", 1), - "nanos": fmt.Sprintf("nanos = %d", 1000), - } - acceptableByApi_3 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": fmt.Sprintf("allow_stopping_for_update = %t", true), - "enabled": fmt.Sprintf("enabled = %t", false), - "seconds": fmt.Sprintf("seconds = %d", 100), - "nanos": "", - } - ivalid_1 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": fmt.Sprintf("allow_stopping_for_update = %t", true), - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 3601), - "nanos": "", - } - ivalid_2 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": fmt.Sprintf("allow_stopping_for_update = %t", true), - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 0), - "nanos": fmt.Sprintf("nanos = %d", 1000000000), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputeInstance_GracefulShutdownUpdate(acceptableByApi_1), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeInstanceExists(t, "google_compute_instance.foobar", &instance), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "allow_stopping_for_update", "true"), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.enabled", "true"), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.seconds", "1"), - ), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(acceptableByApi_2), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeInstanceExists(t, "google_compute_instance.foobar", &instance), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "allow_stopping_for_update", "true"), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.enabled", "false"), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.nanos", "1000"), - ), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(acceptableByApi_3), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeInstanceExists(t, "google_compute_instance.foobar", &instance), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "allow_stopping_for_update", "true"), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.seconds", "100"), - ), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(ivalid_1), - ExpectError: regexp.MustCompile("must be more than 1 second in the future and less than 1 hour., invalid"), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(ivalid_2), - ExpectError: regexp.MustCompile("Must be less than or equal to 999999999, invalid"), - }, - }, - }) -} - -func TestAccComputeInstance_GracefulShutdownWithoutResetUpdate(t *testing.T) { - t.Parallel() - - var instance compute.Instance - instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - acceptableByApi_1 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 1), - "nanos": "", - } - acceptableByApi_2 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", false), - "seconds": fmt.Sprintf("seconds = %d", 1), - "nanos": fmt.Sprintf("nanos = %d", 1000), - } - acceptableByApi_3 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", false), - "seconds": fmt.Sprintf("seconds = %d", 100), - "nanos": "", - } - ivalid_1 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": "", - "nanos": "", - } - ivalid_2 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": "", - "seconds": "", - "nanos": "", - } - ivalid_3 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 3601), - "nanos": "", - } - ivalid_4 := map[string]interface{}{ - "instance_name": instanceName, - "allow_stopping_for_update": "", - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 0), - "nanos": fmt.Sprintf("nanos = %d", 1000000000), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputeInstance_GracefulShutdownUpdate(ivalid_1), - ExpectError: regexp.MustCompile("The argument \"seconds\" is required, but no definition was found."), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(ivalid_2), - ExpectError: regexp.MustCompile("The argument \"enabled\" is required, but no definition was found."), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(acceptableByApi_1), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeInstanceExists(t, "google_compute_instance.foobar", &instance), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.enabled", "true"), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.seconds", "1"), - ), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(acceptableByApi_2), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeInstanceExists(t, "google_compute_instance.foobar", &instance), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.enabled", "false"), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.nanos", "1000"), - ), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(acceptableByApi_3), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeInstanceExists(t, "google_compute_instance.foobar", &instance), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.seconds", "100"), - ), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(ivalid_3), - ExpectError: regexp.MustCompile("must be more than 1 second in the future and less than 1 hour., invalid"), - }, - { - Config: testAccComputeInstance_GracefulShutdownUpdate(ivalid_4), - ExpectError: regexp.MustCompile("Must be less than or equal to 999999999, invalid"), - }, - }, - }) -} - func testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigs(t *testing.T) { var instance compute.Instance var instanceName = fmt.Sprintf("tf-test-instance-%s", acctest.RandString(t, 10)) @@ -4336,42 +4146,6 @@ func testAccComputeInstance_nic_securityPolicyCreateWithoutAccessConfig(t *testi }) } -func testAccComputeInstance_GracefulShutdownUpdate(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_compute_image" "my_image" { - family = "debian-11" - project = "debian-cloud" -} -resource "google_compute_instance" "foobar" { - name = "%{instance_name}" - machine_type = "e2-medium" - zone = "us-central1-a" - %{allow_stopping_for_update} - - boot_disk { - initialize_params { - image = data.google_compute_image.my_image.self_link - } - } - - network_interface { - network = "default" - access_config {} - } - - scheduling { - graceful_shutdown { - %{enabled} - max_duration { - %{seconds} - %{nanos} - } - } - } -} -`, context) -} - {{ end }} func testAccCheckComputeInstanceUpdateMachineType(t *testing.T, n string) resource.TestCheckFunc { @@ -11499,10 +11273,10 @@ func TestAccComputeInstance_bootAndAttachedDisk_interface(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccComputeInstance_bootAndAttachedDisk_interface(instanceName1, diskName1, envvar.GetTestZoneFromEnv(), "c3-standard-22", "NVME", false), + Config: testAccComputeInstance_bootAndAttachedDisk_interface(instanceName1, diskName1, envvar.GetTestZoneFromEnv(), "h3-standard-88", "NVME", false), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("google_compute_instance.foobar", "boot_disk.0.interface", "NVME"), - resource.TestCheckResourceAttr("google_compute_instance.foobar", "machine_type", "c3-standard-22"), + resource.TestCheckResourceAttr("google_compute_instance.foobar", "machine_type", "h3-standard-88"), ), }, //computeInstanceImportStep("us-central1-a", instanceName1, []string{"desired_status","allow_stopping_for_update"}), diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_interconnect_macsec_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_interconnect_macsec_test.go index 28393d99432a..9de56540ec3f 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_interconnect_macsec_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_interconnect_macsec_test.go @@ -51,7 +51,7 @@ resource "google_compute_interconnect" "example-interconnect" { customer_name = "internal_customer" # Special customer only available for Google testing. interconnect_type = "DEDICATED" link_type = "LINK_TYPE_ETHERNET_100G_LR" - location = "https://www.googleapis.com/compute/v1/projects/${data.google_project.project.name}/global/interconnectLocations/z2z-us-east4-zone1-lciadl-z" # Special location only available for Google testing. + location = "https://www.googleapis.com/compute/v1/projects/${data.google_project.project.name}/global/interconnectLocations/z2z-us-east4-zone1-lciadl-a" # Special location only available for Google testing. requested_link_count = 1 admin_enabled = true description = "example description" @@ -74,7 +74,7 @@ resource "google_compute_interconnect" "example-interconnect" { customer_name = "internal_customer" # Special customer only available for Google testing. interconnect_type = "DEDICATED" link_type = "LINK_TYPE_ETHERNET_100G_LR" - location = "https://www.googleapis.com/compute/v1/projects/${data.google_project.project.name}/global/interconnectLocations/z2z-us-east4-zone1-lciadl-z" # Special location only available for Google testing. + location = "https://www.googleapis.com/compute/v1/projects/${data.google_project.project.name}/global/interconnectLocations/z2z-us-east4-zone1-lciadl-a" # Special location only available for Google testing. requested_link_count = 1 admin_enabled = true description = "example description" diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_network_firewall_policy_packet_mirroring_rule_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_network_firewall_policy_packet_mirroring_rule_test.go.tmpl deleted file mode 100644 index 6dcb837d7e29..000000000000 --- a/mmv1/third_party/terraform/services/compute/resource_compute_network_firewall_policy_packet_mirroring_rule_test.go.tmpl +++ /dev/null @@ -1,188 +0,0 @@ -package compute_test -{{- if ne $.TargetVersionName "ga" }} -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" -) - -func TestAccComputeNetworkFirewallPolicyPacketMirroringRule_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "org_id": envvar.GetTestOrgFromEnv(t), - "project_name": envvar.GetTestProjectFromEnv(), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckComputeNetworkFirewallPolicyPacketMirroringRuleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputeNetworkFirewallPolicyPacketMirroringRule_basic(context), - }, - { - ResourceName: "google_compute_network_firewall_policy_packet_mirroring_rule.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"firewall_policy"}, - }, - { - Config: testAccComputeNetworkFirewallPolicyPacketMirroringRule_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_compute_network_firewall_policy_packet_mirroring_rule.primary", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_compute_network_firewall_policy_packet_mirroring_rule.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"firewall_policy"}, - }, - }, - }) -} - -func testAccComputeNetworkFirewallPolicyPacketMirroringRule_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_project" "project" { - provider = google-beta -} - -resource "google_compute_network" "default" { - provider = google-beta - name = "network%{random_suffix}" - auto_create_subnetworks = false -} - -resource "google_compute_network_firewall_policy" "basic_network_firewall_policy" { - provider = google-beta - name = "tf-test-fw-policy%{random_suffix}" - description = "Sample global network firewall policy" - project = "%{project_name}" -} - -resource "google_compute_network_firewall_policy_packet_mirroring_rule" "primary" { - provider = google-beta - action = "do_not_mirror" - direction = "INGRESS" - firewall_policy = google_compute_network_firewall_policy.basic_network_firewall_policy.name - priority = 1000 - - match { - src_ip_ranges = ["10.100.0.1/32"] - layer4_configs { - ip_protocol = "all" - } - } -} - -`, context) -} - -func testAccComputeNetworkFirewallPolicyPacketMirroringRule_update(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_project" "project" { - provider = google-beta -} - -resource "google_compute_network" "default" { - provider = google-beta - name = "network%{random_suffix}" - auto_create_subnetworks = false -} - -resource "google_compute_network_firewall_policy" "basic_network_firewall_policy" { - provider = google-beta - name = "tf-test-fw-policy%{random_suffix}" - description = "Sample global network firewall policy" - project = "%{project_name}" -} - -resource "google_compute_network_firewall_policy_packet_mirroring_rule" "primary" { - provider = google-beta - action = "mirror" - description = "This is a simple packet mirroring rule description" - direction = "INGRESS" - disabled = true - firewall_policy = google_compute_network_firewall_policy.basic_network_firewall_policy.name - priority = 1000 - rule_name = "test-rule" - - match { - src_ip_ranges = ["192.168.0.1/32"] - layer4_configs { - ip_protocol = "tcp" - } - } - - security_profile_group = "//networksecurity.googleapis.com/${google_network_security_security_profile_group.security_profile_group_1.id}" - - target_secure_tags { - name = "tagValues/${google_tags_tag_value.secure_tag_value_1.name}" - } - -} - -resource "google_network_security_mirroring_deployment_group" "default" { - provider = google-beta - mirroring_deployment_group_id = "tf-test-deployment-group%{random_suffix}" - location = "global" - network = google_compute_network.default.id -} - -resource "google_network_security_mirroring_endpoint_group" "default" { - provider = google-beta - mirroring_endpoint_group_id = "tf-test-endpoint-group%{random_suffix}" - location = "global" - mirroring_deployment_group = google_network_security_mirroring_deployment_group.default.id -} - -resource "google_network_security_security_profile" "default" { - provider = google-beta - name = "tf-test-sec-profile%{random_suffix}" - parent = "organizations/%{org_id}" - description = "my description" - type = "CUSTOM_MIRRORING" - - custom_mirroring_profile { - mirroring_endpoint_group = google_network_security_mirroring_endpoint_group.default.id - } -} - -resource "google_network_security_security_profile_group" "security_profile_group_1" { - provider = google-beta - name = "tf-test-sec-profile-group%{random_suffix}" - parent = "organizations/%{org_id}" - description = "my description" - custom_mirroring_profile = google_network_security_security_profile.default.id -} - -resource "google_tags_tag_key" "secure_tag_key_1" { - provider = google-beta - description = "Test tag key description" - parent = "organizations/%{org_id}" - purpose = "GCE_FIREWALL" - short_name = "tf-test-tag-key%{random_suffix}" - purpose_data = { - network = "%{project_name}/${google_compute_network.default.name}" - } -} - -resource "google_tags_tag_value" "secure_tag_value_1" { - provider = google-beta - description = "Test tag value description." - parent = google_tags_tag_key.secure_tag_key_1.id - short_name = "tf-test-tag-value%{random_suffix}" -} -`, context) -} -{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_network_peering_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_network_peering_meta.yaml.tmpl index 9086fe1c2abe..dca2d8500dce 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_network_peering_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_network_peering_meta.yaml.tmpl @@ -7,14 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Network' -fields: - - field: 'export_custom_routes' - - field: 'export_subnet_routes_with_public_ip' - - field: 'import_custom_routes' - - field: 'import_subnet_routes_with_public_ip' - - field: 'name' - - field: 'network' - - field: 'peer_network' - - field: 'stack_type' - - field: 'state' - - field: 'state_details' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl index 3632c5a084ce..6fe55a31bfae 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl @@ -6,7 +6,6 @@ import ( "testing" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -113,6 +112,7 @@ func TestAccComputeNetwork_routingModeAndUpdate(t *testing.T) { }) } +{{ if ne $.TargetVersionName `ga` -}} func TestAccComputeNetwork_bgpBestPathSelectionModeAndUpdate(t *testing.T) { t.Parallel() @@ -122,7 +122,7 @@ func TestAccComputeNetwork_bgpBestPathSelectionModeAndUpdate(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -130,7 +130,7 @@ func TestAccComputeNetwork_bgpBestPathSelectionModeAndUpdate(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.acc_network_bgp_best_path_selection_mode", &network), - resource.TestCheckResourceAttr("google_compute_network.acc_network_bgp_best_path_selection_mode", "bgp_best_path_selection_mode", "LEGACY"), + testAccCheckComputeNetworkHasBgpBestPathSelectionMode(t, "google_compute_network.acc_network_bgp_best_path_selection_mode", &network, "LEGACY"), ), }, // Test updating the best bgp path selection field (only updatable field). @@ -139,7 +139,7 @@ func TestAccComputeNetwork_bgpBestPathSelectionModeAndUpdate(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.acc_network_bgp_best_path_selection_mode", &network), - resource.TestCheckResourceAttr("google_compute_network.acc_network_bgp_best_path_selection_mode", "bgp_best_path_selection_mode", "STANDARD"), + testAccCheckComputeNetworkHasBgpBestPathSelectionMode(t, "google_compute_network.acc_network_bgp_best_path_selection_mode", &network, "STANDARD"), ), }, }, @@ -157,7 +157,7 @@ func TestAccComputeNetwork_bgpAlwaysCompareMedAndUpdate(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -165,7 +165,8 @@ func TestAccComputeNetwork_bgpAlwaysCompareMedAndUpdate(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.acc_network_bgp_always_compare_med", &network), - resource.TestCheckResourceAttr("google_compute_network.acc_network_bgp_always_compare_med", "bgp_always_compare_med", "false"), + testAccCheckComputeNetworkHasBgpAlwaysCompareMed( + t, "google_compute_network.acc_network_bgp_always_compare_med", &network, false), ), }, // Test updating the bgpAlwaysCompareMed field (only updatable field). @@ -174,7 +175,8 @@ func TestAccComputeNetwork_bgpAlwaysCompareMedAndUpdate(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.acc_network_bgp_always_compare_med", &network), - resource.TestCheckResourceAttr("google_compute_network.acc_network_bgp_always_compare_med", "bgp_always_compare_med", "true"), + testAccCheckComputeNetworkHasBgpAlwaysCompareMed( + t, "google_compute_network.acc_network_bgp_always_compare_med", &network, true), ), }, }, @@ -191,7 +193,7 @@ func TestAccComputeNetwork_bgpInterRegionCostAndUpdate(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -199,7 +201,8 @@ func TestAccComputeNetwork_bgpInterRegionCostAndUpdate(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.acc_network_bgp_inter_region_cost", &network), - resource.TestCheckResourceAttr("google_compute_network.acc_network_bgp_inter_region_cost", "bgp_inter_region_cost", "DEFAULT"), + testAccCheckComputeNetworkHasBgpInterRegionCost( + t, "google_compute_network.acc_network_bgp_inter_region_cost", &network, "DEFAULT"), ), }, // Test updating the bgpInterRegionCost field (only updatable field). @@ -208,7 +211,8 @@ func TestAccComputeNetwork_bgpInterRegionCostAndUpdate(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.acc_network_bgp_inter_region_cost", &network), - resource.TestCheckResourceAttr("google_compute_network.acc_network_bgp_inter_region_cost", "bgp_inter_region_cost", "ADD_COST_TO_MED"), + testAccCheckComputeNetworkHasBgpInterRegionCost( + t, "google_compute_network.acc_network_bgp_inter_region_cost", &network, "ADD_COST_TO_MED"), ), }, }, @@ -222,15 +226,11 @@ func TestAccComputeNetwork_networkProfile(t *testing.T) { suffixName := acctest.RandString(t, 10) networkName := fmt.Sprintf("tf-test-network-profile-%s", suffixName) projectId := envvar.GetTestProjectFromEnv() - {{ if eq $.TargetVersionName `ga` }} - profileURL := fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/networkProfiles/europe-west1-b-vpc-roce", projectId) - {{- else }} profileURL := fmt.Sprintf("https://www.googleapis.com/compute/beta/projects/%s/global/networkProfiles/europe-west1-b-vpc-roce", projectId) - {{- end }} acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -245,6 +245,7 @@ func TestAccComputeNetwork_networkProfile(t *testing.T) { }, }) } +{{- end }} func TestAccComputeNetwork_numericId(t *testing.T) { t.Parallel() @@ -302,6 +303,7 @@ func TestAccComputeNetwork_default_routing_mode(t *testing.T) { }) } +{{ if ne $.TargetVersionName `ga` -}} func TestAccComputeNetwork_default_bgp_best_path_selection_mode(t *testing.T) { t.Parallel() @@ -313,21 +315,22 @@ func TestAccComputeNetwork_default_bgp_best_path_selection_mode(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccComputeNetwork_basic(networkName), + Config: testAccComputeBetaNetwork_basic(networkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.bar", &network), - resource.TestCheckResourceAttr("google_compute_network.bar", "bgp_best_path_selection_mode", expectedBgpBestPathSelection), + testAccCheckComputeNetworkHasBgpBestPathSelectionMode(t, "google_compute_network.bar", &network, expectedBgpBestPathSelection), ), }, }, }) } + func TestAccComputeNetwork_default_bgp_always_compare_med(t *testing.T) { t.Parallel() @@ -335,11 +338,11 @@ func TestAccComputeNetwork_default_bgp_always_compare_med(t *testing.T) { suffixName := acctest.RandString(t, 10) networkName := fmt.Sprintf("tf-test-bgp-always-compare-med-default-routes-%s", suffixName) - expectedBgpAlwaysCompareMed := "false" + expectedBgpAlwaysCompareMed := false acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), Steps: []resource.TestStep{ { @@ -347,12 +350,14 @@ func TestAccComputeNetwork_default_bgp_always_compare_med(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckComputeNetworkExists( t, "google_compute_network.acc_network_bgp_best_path_selection_mode", &network), - resource.TestCheckResourceAttr("google_compute_network.acc_network_bgp_best_path_selection_mode", "bgp_always_compare_med", expectedBgpAlwaysCompareMed), + testAccCheckComputeNetworkHasBgpAlwaysCompareMed( + t, "google_compute_network.acc_network_bgp_best_path_selection_mode", &network, expectedBgpAlwaysCompareMed), ), }, }, }) } +{{- end }} func TestAccComputeNetwork_networkDeleteDefaultRoute(t *testing.T) { t.Parallel() @@ -559,6 +564,94 @@ func testAccCheckComputeNetworkHasRoutingMode(t *testing.T, n string, network *c } } +{{ if ne $.TargetVersionName `ga` -}} +func testAccCheckComputeNetworkHasBgpBestPathSelectionMode(t *testing.T, n string, network *compute.Network, bgpBestPathSelectionMode string) resource.TestCheckFunc { + return func(s *terraform.State) error { + config := acctest.GoogleProviderConfig(t) + + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.Attributes["bgp_always_compare_med"] == "" { + return fmt.Errorf("BGP always compare med not found on resource") + } + + found, err := config.NewComputeClient(config.UserAgent).Networks.Get( + config.Project, network.Name).Do() + if err != nil { + return err + } + + foundBgpBestPathSelectionMode := found.RoutingConfig.BgpBestPathSelectionMode + + if bgpBestPathSelectionMode != foundBgpBestPathSelectionMode { + return fmt.Errorf("Expected BGP always compare med %s to match actual BGP always compare med %s", bgpBestPathSelectionMode, foundBgpBestPathSelectionMode) + } + + return nil + } +} + +func testAccCheckComputeNetworkHasBgpAlwaysCompareMed(t *testing.T, n string, network *compute.Network, bgpAlwaysCompareMed bool) resource.TestCheckFunc { + return func(s *terraform.State) error { + config := acctest.GoogleProviderConfig(t) + + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.Attributes["bgp_always_compare_med"] == "" { + return fmt.Errorf("BGP always compare med not found on resource") + } + + found, err := config.NewComputeClient(config.UserAgent).Networks.Get( + config.Project, network.Name).Do() + if err != nil { + return err + } + + foundBgpAlwaysCompareMed := found.RoutingConfig.BgpAlwaysCompareMed + + if foundBgpAlwaysCompareMed != bgpAlwaysCompareMed { + return fmt.Errorf("Expected BGP always compare med %t to match actual BGP always compare med %t", bgpAlwaysCompareMed, foundBgpAlwaysCompareMed) + } + + return nil + } +} + +func testAccCheckComputeNetworkHasBgpInterRegionCost(t *testing.T, n string, network *compute.Network, bgpInterRegionCost string) resource.TestCheckFunc { + return func(s *terraform.State) error { + config := acctest.GoogleProviderConfig(t) + + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.Attributes["bgp_inter_region_cost"] == "" { + return fmt.Errorf("BGP inter region cost not found on resource") + } + + found, err := config.NewComputeClient(config.UserAgent).Networks.Get( + config.Project, network.Name).Do() + if err != nil { + return err + } + + foundBgpInterRegionCost := found.RoutingConfig.BgpInterRegionCost + + if foundBgpInterRegionCost != bgpInterRegionCost { + return fmt.Errorf("Expected BGP always compare med %s to match actual BGP always compare med %s", bgpInterRegionCost, foundBgpInterRegionCost) + } + + return nil + } +} + func testAccCheckComputeNetworkHasNetworkProfile(t *testing.T, n string, network *compute.Network, networkProfile string) resource.TestCheckFunc { return func(s *terraform.State) error { config := acctest.GoogleProviderConfig(t) @@ -580,13 +673,14 @@ func testAccCheckComputeNetworkHasNetworkProfile(t *testing.T, n string, network foundNetworkProfile := found.NetworkProfile - if tpgresource.CompareSelfLinkOrResourceName("", foundNetworkProfile, networkProfile, nil) != true { + if foundNetworkProfile != networkProfile { return fmt.Errorf("Expected Network Profile always compare med %s to match actual Network Profile always compare med %s", networkProfile, foundNetworkProfile) } return nil } } +{{- end }} func testAccCheckComputeNetworkHasNetworkFirewallPolicyEnforcementOrder(t *testing.T, n string, network *compute.Network, order string) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -653,10 +747,21 @@ resource "google_compute_network" "acc_network_routing_mode" { `, networkName, routingMode) } +{{ if ne $.TargetVersionName `ga` -}} +func testAccComputeBetaNetwork_basic(networkName string) string { + return fmt.Sprintf(` +resource "google_compute_network" "bar" { + provider = google-beta + name = "%s" + auto_create_subnetworks = true +} +`, networkName) +} func testAccComputeNetwork_best_bgp_path_selection_mode(networkName, bgpBestPathSelection string) string { return fmt.Sprintf(` resource "google_compute_network" "acc_network_bgp_best_path_selection_mode" { + provider = google-beta name = "%s" routing_mode = "GLOBAL" bgp_best_path_selection_mode = "%s" @@ -667,6 +772,7 @@ resource "google_compute_network" "acc_network_bgp_best_path_selection_mode" { func testAccComputeNetwork_bgp_always_compare_med(networkName string, bgpAlwaysCompareMed bool) string { return fmt.Sprintf(` resource "google_compute_network" "acc_network_bgp_always_compare_med" { + provider = google-beta name = "%s" routing_mode = "GLOBAL" bgp_best_path_selection_mode = "STANDARD" @@ -678,6 +784,7 @@ resource "google_compute_network" "acc_network_bgp_always_compare_med" { func testAccComputeNetwork_bgp_inter_region_cost(networkName, bgpInterRegionCost string) string { return fmt.Sprintf(` resource "google_compute_network" "acc_network_bgp_inter_region_cost" { + provider = google-beta name = "%s" routing_mode = "GLOBAL" bgp_best_path_selection_mode = "STANDARD" @@ -689,6 +796,7 @@ resource "google_compute_network" "acc_network_bgp_inter_region_cost" { func testAccComputeNetwork_network_profile(networkName, networkProfile string) string { return fmt.Sprintf(` resource "google_compute_network" "acc_network_network_profile" { + provider = google-beta name = "%s" routing_mode = "REGIONAL" network_profile = "%s" @@ -696,6 +804,7 @@ resource "google_compute_network" "acc_network_network_profile" { } `, networkName, networkProfile) } +{{- end }} func testAccComputeNetwork_deleteDefaultRoute(networkName string) string { return fmt.Sprintf(` diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_project_default_network_tier_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_project_default_network_tier_meta.yaml.tmpl index 922a87e4a509..a124585f80c9 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_project_default_network_tier_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_project_default_network_tier_meta.yaml.tmpl @@ -7,6 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Project' -fields: - - field: 'network_tier' - - field: 'project' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_item_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_item_meta.yaml.tmpl index 1418dc18744c..40102da22a06 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_item_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_item_meta.yaml.tmpl @@ -7,7 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Project' -fields: - - field: 'key' - - field: 'project' - - field: 'value' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_meta.yaml.tmpl index fd4edffa48de..0687901d10e5 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_project_metadata_meta.yaml.tmpl @@ -7,6 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Project' -fields: - - field: 'metadata' - - field: 'project' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go b/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go index 09bcdedb82d9..da65db1de128 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go +++ b/mmv1/third_party/terraform/services/compute/resource_compute_public_advertised_prefix_test.go @@ -16,10 +16,8 @@ import ( // Since we only have access to one test prefix range we cannot run tests in parallel func TestAccComputePublicPrefixes(t *testing.T) { testCases := map[string]func(t *testing.T){ - "delegated_prefix": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest, - "advertised_prefix": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest, - "public_delegated_prefixes_ipv6": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Test, - "public_advertised_prefixes_pdp_scope": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeTest, + "delegated_prefix": testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesBasicTest, + "advertised_prefix": testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest, } for name, tc := range testCases { @@ -34,41 +32,6 @@ func TestAccComputePublicPrefixes(t *testing.T) { } } -func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeTest(t *testing.T) { - context := map[string]interface{}{ - "description": envvar.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputePublicAdvertisedPrefixDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeExample(context), - }, - { - ResourceName: "google_compute_public_advertised_prefix.prefix", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesPdpScopeExample(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_compute_public_advertised_prefix" "prefix" { - name = "tf-test-my-prefix%{random_suffix}" - description = "%{description}" - dns_verification_ip = "127.127.0.0" - ip_cidr_range = "127.127.0.0/16" - pdp_scope = "REGIONAL" -} -`, context) -} - func testAccComputePublicAdvertisedPrefix_publicAdvertisedPrefixesBasicTest(t *testing.T) { t.Parallel() @@ -156,61 +119,6 @@ resource "google_compute_public_delegated_prefix" "subprefix" { `, context) } -func testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Test(t *testing.T) { - context := map[string]interface{}{ - "description": envvar.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputePublicDelegatedPrefixDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Example(context), - }, - { - ResourceName: "google_compute_public_delegated_prefix.prefix", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"region"}, - }, - }, - }) -} - -func testAccComputePublicDelegatedPrefix_publicDelegatedPrefixesIpv6Example(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_compute_public_advertised_prefix" "advertised" { - name = "tf-test-ipv6-pap%{random_suffix}" - description = "%{description}" - dns_verification_ip = "2001:db8::" - ip_cidr_range = "2001:db8::/32" - pdp_scope = "REGIONAL" -} - -resource "google_compute_public_delegated_prefix" "prefix" { - name = "tf-test-root-pdp%{random_suffix}" - description = "test-delegation-mode-pdp" - region = "us-west1" - ip_cidr_range = "2001:db8::/40" - parent_prefix = google_compute_public_advertised_prefix.advertised.id - mode = "DELEGATION" -} - -resource "google_compute_public_delegated_prefix" "subprefix" { - name = "tf-test-sub-pdp%{random_suffix}" - description = "test-forwarding-rule-mode-pdp" - region = "us-west1" - ip_cidr_range = "2001:db8::/48" - parent_prefix = google_compute_public_delegated_prefix.prefix.id - allocatable_prefix_length = 64 - mode = "EXTERNAL_IPV6_FORWARDING_RULE_CREATION" -} -`, context) -} - func testAccCheckComputePublicDelegatedPrefixDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { for name, rs := range s.RootModule().Resources { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_meta.yaml.tmpl index 04c52c0d8dac..adc27b750221 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_meta.yaml.tmpl @@ -7,67 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'InstanceGroupManager' -fields: - - field: 'all_instances_config.labels' - - field: 'all_instances_config.metadata' - - field: 'auto_healing_policies.health_check' - - field: 'auto_healing_policies.initial_delay_sec' - - field: 'base_instance_name' - - field: 'creation_timestamp' - - field: 'description' - - field: 'distribution_policy_target_shape' - - field: 'distribution_policy_zones' - - field: 'fingerprint' - - field: 'instance_flexibility_policy.instance_selections.machine_types' - - field: 'instance_flexibility_policy.instance_selections.name' - - field: 'instance_flexibility_policy.instance_selections.rank' - - field: 'instance_group' - - field: 'instance_group_manager_id' - - field: 'instance_lifecycle_policy.default_action_on_failure' - - field: 'instance_lifecycle_policy.force_update_on_repair' - - field: 'list_managed_instances_results' - - field: 'name' - - field: 'named_port.name' - - field: 'named_port.port' -{{- if ne $.TargetVersionName "ga" }} - - field: 'params.resource_manager_tags' -{{- end }} - - field: 'project' - - field: 'region' - - field: 'self_link' - - field: 'standby_policy.initial_delay_sec' - - field: 'standby_policy.mode' - - field: 'stateful_disk.delete_rule' - - field: 'stateful_disk.device_name' - - field: 'stateful_external_ip.delete_rule' - - field: 'stateful_external_ip.interface_name' - - field: 'stateful_internal_ip.delete_rule' - - field: 'stateful_internal_ip.interface_name' - - field: 'status.all_instances_config.current_revision' - - field: 'status.all_instances_config.effective' - - field: 'status.is_stable' - - field: 'status.stateful.has_stateful_config' - - field: 'status.stateful.per_instance_configs.all_effective' - - field: 'status.version_target.is_reached' - - field: 'target_pools' - - field: 'target_size' - - field: 'target_stopped_size' - - field: 'target_suspended_size' - - field: 'update_policy.instance_redistribution_type' - - field: 'update_policy.max_surge_fixed' - - field: 'update_policy.max_surge_percent' - - field: 'update_policy.max_unavailable_fixed' - - field: 'update_policy.max_unavailable_percent' -{{- if ne $.TargetVersionName "ga" }} - - field: 'update_policy.min_ready_sec' -{{- end }} - - field: 'update_policy.minimal_action' - - field: 'update_policy.most_disruptive_allowed_action' - - field: 'update_policy.replacement_method' - - field: 'update_policy.type' - - field: 'version.instance_template' - - field: 'version.name' - - field: 'version.target_size.fixed' - - field: 'version.target_size.percent' - - field: 'wait_for_instances' - - field: 'wait_for_instances_status' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl index 96c4d8e70114..12f5927881ce 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl @@ -455,8 +455,13 @@ Google Cloud KMS.`, Type: schema.TypeString, Optional: true, ForceNew: true, + {{- if eq $.TargetVersionName `ga` }} + ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET"}, false), + Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET`, + {{- else }} ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA"}, false), Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, MRDMA, and IRDMA`, + {{- end }} }, "access_config": { Type: schema.TypeList, @@ -780,53 +785,6 @@ be from 0 to 999,999,999 inclusive.`, }, }, }, -{{ if ne $.TargetVersionName `ga` }} - "graceful_shutdown": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Settings for the instance to perform a graceful shutdown.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "enabled": { - Type: schema.TypeBool, - Required: true, - ForceNew: true, - Description: `Opts-in for graceful shutdown.`, - }, - "max_duration": { - Type: schema.TypeList, - Optional: true, - Description: `The time allotted for the instance to gracefully shut down. - If the graceful shutdown isn't complete after this time, then the instance - transitions to the STOPPING state.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "seconds": { - Type: schema.TypeInt, - Required: true, - ForceNew: true, - Description: `Span of time at a resolution of a second. - The value must be between 1 and 3600, which is 3,600 seconds (one hour).`, - }, - "nanos": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: `Span of time that's a fraction of a second at nanosecond - resolution. Durations less than one second are represented - with a 0 seconds field and a positive nanos field. Must - be from 0 to 999,999,999 inclusive.`, - }, - }, - }, - }, - }, - }, - }, -{{- end }} }, }, }, @@ -1454,18 +1412,6 @@ func resourceComputeRegionInstanceTemplateRead(d *schema.ResourceData, meta inte } if instanceProperties.Scheduling != nil { scheduling := flattenScheduling(instanceProperties.Scheduling) -{{ if ne $.TargetVersionName `ga` }} - // Workaroud: API doesn't update the scheduling.graceful_shutdown.max_duration.nanos field. - // To avoid diff, we need to set the value from the state not from API response. - if nanos, ok := d.GetOk("scheduling.0.graceful_shutdown.0.max_duration.0.nanos"); ok { - graceful_shutdown := scheduling[0]["graceful_shutdown"].([]interface{})[0].(map[string]interface{}) - max_duration := graceful_shutdown["max_duration"].([]interface{})[0].(map[string]interface{}) - max_duration["nanos"] = int64(nanos.(int)) - - graceful_shutdown["max_duration"] = []interface{}{max_duration} - scheduling[0]["graceful_shutdown"] = []interface{}{graceful_shutdown} - } -{{- end }} if err = d.Set("scheduling", scheduling); err != nil { return fmt.Errorf("Error setting scheduling: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_meta.yaml.tmpl index 034aa8e544de..8449a311f57f 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_meta.yaml.tmpl @@ -7,117 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'InstanceTemplate' -fields: - - field: 'advanced_machine_features.enable_nested_virtualization' - - field: 'advanced_machine_features.enable_uefi_networking' - - field: 'advanced_machine_features.performance_monitoring_unit' - - field: 'advanced_machine_features.threads_per_core' - - field: 'advanced_machine_features.turbo_mode' - - field: 'advanced_machine_features.visible_core_count' - - field: 'can_ip_forward' - - field: 'confidential_instance_config.confidential_instance_type' - - field: 'confidential_instance_config.enable_confidential_compute' - - field: 'creation_timestamp' - - field: 'description' - - field: 'disk.auto_delete' - - field: 'disk.boot' - - field: 'disk.device_name' - - field: 'disk.disk_encryption_key.kms_key_self_link' - - field: 'disk.disk_name' - - field: 'disk.disk_size_gb' - - field: 'disk.disk_type' - - field: 'disk.interface' - - field: 'disk.labels' - - field: 'disk.mode' - - field: 'disk.provisioned_iops' - - field: 'disk.provisioned_throughput' - - field: 'disk.resource_manager_tags' - - field: 'disk.resource_policies' - - field: 'disk.source' - - field: 'disk.source_image' - - field: 'disk.source_image_encryption_key.kms_key_self_link' - - field: 'disk.source_image_encryption_key.kms_key_service_account' - - field: 'disk.source_snapshot' - - field: 'disk.source_snapshot_encryption_key.kms_key_self_link' - - field: 'disk.source_snapshot_encryption_key.kms_key_service_account' - - field: 'disk.type' - - field: 'effective_labels' - provider_only: true -{{- if ne $.TargetVersionName "ga" }} - - field: 'enable_display' -{{- end }} - - field: 'guest_accelerator.count' - - field: 'guest_accelerator.type' - - field: 'instance_description' - - field: 'key_revocation_action_type' - - field: 'labels' - - field: 'machine_type' - - field: 'metadata' - - field: 'metadata_fingerprint' - - field: 'metadata_startup_script' - - field: 'min_cpu_platform' - - field: 'name' - - field: 'name_prefix' - - field: 'network_interface.access_config.nat_ip' - - field: 'network_interface.access_config.network_tier' - - field: 'network_interface.access_config.public_ptr_domain_name' - - field: 'network_interface.alias_ip_range.ip_cidr_range' - - field: 'network_interface.alias_ip_range.subnetwork_range_name' - - field: 'network_interface.internal_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.external_ipv6' - - field: 'network_interface.ipv6_access_config.external_ipv6_prefix_length' - - field: 'network_interface.ipv6_access_config.name' - - field: 'network_interface.ipv6_access_config.network_tier' - - field: 'network_interface.ipv6_access_config.public_ptr_domain_name' - - field: 'network_interface.ipv6_access_type' - - field: 'network_interface.ipv6_address' - - field: 'network_interface.name' - - field: 'network_interface.network' - - field: 'network_interface.network_ip' - - field: 'network_interface.nic_type' - - field: 'network_interface.queue_count' - - field: 'network_interface.stack_type' - - field: 'network_interface.subnetwork' - - field: 'network_interface.subnetwork_project' - - field: 'network_performance_config.total_egress_bandwidth_tier' -{{- if ne $.TargetVersionName "ga" }} - - field: 'partner_metadata' -{{- end }} - - field: 'project' - - field: 'region' - - field: 'reservation_affinity.specific_reservation.key' - - field: 'reservation_affinity.specific_reservation.values' - - field: 'reservation_affinity.type' - - field: 'resource_manager_tags' - - field: 'resource_policies' - - field: 'scheduling.automatic_restart' - - field: 'scheduling.availability_domain' -{{- if ne $.TargetVersionName "ga" }} - - field: 'scheduling.host_error_timeout_seconds' -{{- end }} - - field: 'scheduling.instance_termination_action' - - field: 'scheduling.local_ssd_recovery_timeout.nanos' - - field: 'scheduling.local_ssd_recovery_timeout.seconds' -{{- if ne $.TargetVersionName "ga" }} - - field: 'scheduling.maintenance_interval' -{{- end }} - - field: 'scheduling.max_run_duration.nanos' - - field: 'scheduling.max_run_duration.seconds' - - field: 'scheduling.min_node_cpus' - - field: 'scheduling.node_affinities.key' - - field: 'scheduling.node_affinities.operator' - - field: 'scheduling.node_affinities.values' - - field: 'scheduling.on_host_maintenance' - - field: 'scheduling.on_instance_stop_action.discard_local_ssd' - - field: 'scheduling.preemptible' - - field: 'scheduling.provisioning_model' - - field: 'self_link' - - field: 'service_account.email' - - field: 'service_account.scopes' - - field: 'shielded_instance_config.enable_integrity_monitoring' - - field: 'shielded_instance_config.enable_secure_boot' - - field: 'shielded_instance_config.enable_vtpm' - - field: 'tags' - - field: 'tags_fingerprint' - - field: 'terraform_labels' - provider_only: true diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl index 1a4c3d3cc6bc..dadedbb8f3bd 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl @@ -1471,79 +1471,6 @@ func TestAccComputeRegionInstanceTemplate_keyRevocationActionType(t *testing.T) }) } -{{ if ne $.TargetVersionName `ga` -}} -func TestAccComputeRegionInstanceTemplate_gracefulShutdown(t *testing.T) { - t.Parallel() - - var instanceTemplate compute.InstanceTemplate - instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(t, 10)) - - acceptableByApi_1 := map[string]interface{}{ - "instance_name": instanceName, - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 1), - "nanos": fmt.Sprintf("nanos = %d", 1000000), - } - invalid_1 := map[string]interface{}{ - "instance_name": instanceName, - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": "", - "nanos": "", - } - invalid_2 := map[string]interface{}{ - "instance_name": instanceName, - "enabled": "", - "seconds": "", - "nanos": "", - } - invalid_3 := map[string]interface{}{ - "instance_name": instanceName, - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 3601), - "nanos": fmt.Sprintf("nanos = %d", 1000000), - } - invalid_4 := map[string]interface{}{ - "instance_name": instanceName, - "enabled": fmt.Sprintf("enabled = %t", true), - "seconds": fmt.Sprintf("seconds = %d", 0), - "nanos": fmt.Sprintf("nanos = %d", 1000000000), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeRegionInstanceTemplateDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputeRegionInstanceTemplate_gracefulShutdown(invalid_1), - ExpectError: regexp.MustCompile("The argument \"seconds\" is required, but no definition was found."), - }, - { - Config: testAccComputeRegionInstanceTemplate_gracefulShutdown(invalid_2), - ExpectError: regexp.MustCompile("The argument \"enabled\" is required, but no definition was found."), - }, - { - Config: testAccComputeRegionInstanceTemplate_gracefulShutdown(invalid_3), - ExpectError: regexp.MustCompile("must be more than 1 second in the future and less than 1 hour., invalid"), - }, - { - Config: testAccComputeRegionInstanceTemplate_gracefulShutdown(invalid_4), - ExpectError: regexp.MustCompile("Must be less than or equal to 999999999, invalid"), - }, - { - Config: testAccComputeRegionInstanceTemplate_gracefulShutdown(acceptableByApi_1), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), - resource.TestCheckResourceAttr("google_compute_region_instance_template.foobar", "scheduling.0.graceful_shutdown.0.enabled", "true"), - resource.TestCheckResourceAttr("google_compute_region_instance_template.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.seconds", "1"), - resource.TestCheckResourceAttr("google_compute_region_instance_template.foobar", "scheduling.0.graceful_shutdown.0.max_duration.0.nanos", "1000000"), - ), - }, - }, - }) -} -{{- end }} - func testAccCheckComputeRegionInstanceTemplateDestroyProducer(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { config := acctest.GoogleProviderConfig(t) @@ -4214,44 +4141,3 @@ resource "google_compute_region_instance_template" "foobar" { } `, context) } - -{{ if ne $.TargetVersionName `ga` -}} -func testAccComputeRegionInstanceTemplate_gracefulShutdown(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_compute_image" "my_image" { - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_region_instance_template" "foobar" { - name = "%{instance_name}" - machine_type = "e2-medium" - region = "us-central1" - - disk { - source_image = data.google_compute_image.my_image.self_link - auto_delete = true - boot = true - } - - network_interface { - network = "default" - } - - scheduling { - automatic_restart = true - preemptible = false - - graceful_shutdown { - %{enabled} - - max_duration { - %{seconds} - %{nanos} - } - } - } -} -`, context) -} -{{- end }} diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_router_bgp_peer_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_router_bgp_peer_test.go.tmpl index ea6f3ef32c2f..6f6185ce2e14 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_router_bgp_peer_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_bgp_peer_test.go.tmpl @@ -2,9 +2,7 @@ package compute_test import ( "fmt" - "regexp" "testing" - "regexp" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -26,11 +24,9 @@ func TestAccComputeRouterPeer_basic(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, - + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerKeepRouter(routerName), @@ -56,10 +52,9 @@ func TestAccComputeRouterPeer_advertiseMode(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zero_custom_learned_route_priority","is_custom_learned_priority_set"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerAdvertiseModeUpdate(routerName), @@ -67,10 +62,9 @@ func TestAccComputeRouterPeer_advertiseMode(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zero_custom_learned_route_priority","is_custom_learned_priority_set"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -91,10 +85,9 @@ func TestAccComputeRouterPeer_enable(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerEnable(routerName, false), @@ -102,10 +95,9 @@ func TestAccComputeRouterPeer_enable(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerEnable(routerName, true), @@ -113,10 +105,9 @@ func TestAccComputeRouterPeer_enable(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -137,10 +128,9 @@ func TestAccComputeRouterPeer_bfd(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerBfd(routerName, "DISABLED"), @@ -148,10 +138,9 @@ func TestAccComputeRouterPeer_bfd(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerBasic(routerName), @@ -159,10 +148,9 @@ func TestAccComputeRouterPeer_bfd(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -183,10 +171,9 @@ func TestAccComputeRouterPeer_routerApplianceInstance(t *testing.T) { t, "google_compute_router_peer.foobar"), }, { - ResourceName: "google_compute_router_peer.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zero_custom_learned_route_priority"}, + ResourceName: "google_compute_router_peer.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -211,19 +198,18 @@ func TestAccComputeRouterPeer_Ipv6Basic(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, }, }) } func TestAccComputeRouterPeer_Ipv4BasicCreateUpdate(t *testing.T) { - t.Parallel() + t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) + routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) resourceName := "google_compute_router_peer.foobar" acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -239,10 +225,9 @@ func TestAccComputeRouterPeer_Ipv4BasicCreateUpdate(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerUpdateIpv4Address(routerName), @@ -250,69 +235,14 @@ func TestAccComputeRouterPeer_Ipv4BasicCreateUpdate(t *testing.T) { testAccCheckComputeRouterPeerExists( t, resourceName), resource.TestCheckResourceAttr(resourceName, "enable_ipv4", "true"), - resource.TestCheckResourceAttr(resourceName, "ipv4_nexthop_address", "169.254.1.2"), - resource.TestCheckResourceAttr(resourceName, "peer_ipv4_nexthop_address", "169.254.1.1"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, - }, - }, - }) -} - -func TestAccComputeRouterPeer_UpdateRouterCustomLearnedRoutePriority(t *testing.T) { - t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) - resourceName := "google_compute_router_peer.peer" - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccComputeRouterPeerCustomLearnedRoutePriority(routerName, 100, false), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, "custom_learned_route_priority", "100"), // Check for one element in the list - ), - }, { - Config: testAccComputeRouterPeerCustomLearnedRoutePriority(routerName, 0, false), - ExpectError: regexp.MustCompile(`Error: Invalid custom_learned_route_priority value: When zero_custom_learned_route_priority is set to 'false', the custom_learned_route_priority field cannot be 0. Please provide a non-zero value.`), // Expect the specific error message - }, { - Config: testAccComputeRouterPeerCustomLearnedRoutePriority(routerName, 0, true), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, "custom_learned_route_priority", "0"), + resource.TestCheckResourceAttr(resourceName, "ipv4_nexthop_address", "169.254.1.2"), + resource.TestCheckResourceAttr(resourceName, "peer_ipv4_nexthop_address", "169.254.1.1"), ), }, - }, - }) -} - -func TestAccComputeRouterPeer_UpdateRouterAdvertisedRoutePriority(t *testing.T) { - t.Parallel() - routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10)) - resourceName := "google_compute_router_peer.peer" - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t), - Steps: []resource.TestStep{ { - Config: testAccComputeRouterPeerAdvertisedRoutePriority(routerName, 100, false), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, "advertised_route_priority", "100"), // Check for one element in the list - ), - }, { - Config: testAccComputeRouterPeerAdvertisedRoutePriority(routerName, 0, false), - ExpectError: regexp.MustCompile(`Error: Invalid advertised_route_priority value: When zero_advertised_route_priority is set to 'false', the advertised_route_priority field cannot be 0. Please provide a non-zero value.`), // Expect the specific error message - }, { - Config: testAccComputeRouterPeerAdvertisedRoutePriority(routerName, 0, true), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, "advertised_route_priority", "0"), - ), + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -337,10 +267,9 @@ func TestAccComputeRouterPeer_UpdateIpv6Address(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerUpdateIpv6Address(routerName, true), @@ -351,10 +280,9 @@ func TestAccComputeRouterPeer_UpdateIpv6Address(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -379,10 +307,9 @@ func TestAccComputeRouterPeer_EnableDisableIpv6(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerIpv6(routerName, true), @@ -393,10 +320,9 @@ func TestAccComputeRouterPeer_EnableDisableIpv6(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, { Config: testAccComputeRouterPeerIpv6(routerName, false), @@ -407,10 +333,9 @@ func TestAccComputeRouterPeer_EnableDisableIpv6(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"is_advertised_route_priority_set","zero_custom_learned_route_priority"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -1076,77 +1001,6 @@ func testAccComputeRouterPeerWithMd5AuthKeyUpdate(routerName string) string { routerName, routerName) } -func testAccComputeRouterPeerAdvertisedRoutePriority(routerName string, advertisedRoutePriority int, zeroAdvertisedRoutePriority bool) string { - return fmt.Sprintf(` -resource "google_compute_network" "network" { - name = "%s-net" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "subnetwork" { - name = "%s-sub" - network = google_compute_network.network.self_link - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" -} - -resource "google_compute_router" "router" { - name = "%s-router" - region = google_compute_subnetwork.subnetwork.region - network = google_compute_network.network.self_link - bgp { - asn = 64514 - } -} - -resource "google_compute_router_peer" "peer" { - name = "%s-router-peer" - router = google_compute_router.router.name - region = google_compute_router.router.region - interface = "interface-1" - peer_asn = 65513 - advertised_route_priority = %d - zero_advertised_route_priority = %t -} - `, routerName, routerName, routerName, routerName, advertisedRoutePriority, zeroAdvertisedRoutePriority) - -} - -func testAccComputeRouterPeerCustomLearnedRoutePriority(routerName string, customLearnedRoutePriority int, zeroCustomLearnedRoutePriority bool) string { - return fmt.Sprintf(` -resource "google_compute_network" "network" { - name = "%s-net" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "subnetwork" { - name = "%s-sub" - network = google_compute_network.network.self_link - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" -} - -resource "google_compute_router" "router" { - name = "%s-router" - region = google_compute_subnetwork.subnetwork.region - network = google_compute_network.network.self_link - bgp { - asn = 64514 - } -} - -resource "google_compute_router_peer" "peer" { - name = "%s-router-peer" - router = google_compute_router.router.name - region = google_compute_router.router.region - interface = "interface-1" - peer_asn = 65513 - custom_learned_route_priority = %d - zero_custom_learned_route_priority = %t -} - `, routerName, routerName, routerName, routerName, customLearnedRoutePriority, zeroCustomLearnedRoutePriority) -} - func testAccComputeRouterPeerKeepRouter(routerName string) string { return fmt.Sprintf(` resource "google_compute_network" "foobar" { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_router_interface_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_router_interface_meta.yaml.tmpl index 14bde7483e68..4f93e86714e8 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_router_interface_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_interface_meta.yaml.tmpl @@ -7,15 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Router' -fields: - - field: 'interconnect_attachment' - - field: 'ip_range' - - field: 'ip_version' - - field: 'name' - - field: 'private_ip_address' - - field: 'project' - - field: 'redundant_interface' - - field: 'region' - - field: 'router' - - field: 'subnetwork' - - field: 'vpn_tunnel' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_router_peer.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_router_peer.go.tmpl index 5df0cfbff9f6..63d8577baca8 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_router_peer.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_peer.go.tmpl @@ -142,16 +142,6 @@ CIDR-formatted string.`, Where there is more than one matching route of maximum length, the routes with the lowest priority value win.`, }, - "zero_advertised_route_priority": { - Type: schema.TypeBool, - Optional: true, - Description: `Force the advertised_route_priority to be 0.`, - }, - "is_advertised_route_priority_set": { - Type: schema.TypeBool, - Computed: true, // This field is computed by the provider - Description: "An internal boolean field for provider use for zero_advertised_route_priority.", - }, "custom_learned_ip_ranges": { Type: schema.TypeList, Optional: true, @@ -175,17 +165,7 @@ CIDR-formatted string.`, This value is applied to all custom learned route ranges for the session. You can choose a value from 0 to 65335. If you don't provide a value, Google Cloud assigns a priority of 100 to the ranges.`, }, - "zero_custom_learned_route_priority": { - Type: schema.TypeBool, - Optional: true, - Default: false, - Description: `Force the custom_learned_route_priority to be 0.`, - }, - "is_custom_learned_priority_set": { - Type: schema.TypeBool, - Computed: true, // This field is computed by the provider - Description: "An internal boolean field for provider use.", - }, + "bfd": { Type: schema.TypeList, Computed: true, @@ -439,21 +419,9 @@ func resourceComputeRouterBgpPeerCreate(d *schema.ResourceData, meta interface{} advertisedRoutePriorityProp, err := expandNestedComputeRouterBgpPeerAdvertisedRoutePriority(d.Get("advertised_route_priority"), d, config) if err != nil { return err - } else if v, ok := d.GetOkExists("advertised_route_priority"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) { - if !d.Get("zero_advertised_route_priority").(bool) && advertisedRoutePriorityProp == 0 { - // Add the condition to check the present value - if !d.Get("is_advertised_route_priority_set").(bool) { - log.Printf("[WARN] advertised_route_priority can't be 0 unless zero_advertised_route_priority set to true") - } else { - return fmt.Errorf("Invalid advertised_route_priority value: When zero_advertised_route_priority is set to 'false', the advertised_route_priority field cannot be 0. Please provide a non-zero value.") - } - } else if d.Get("zero_advertised_route_priority").(bool) && advertisedRoutePriorityProp != 0 { - return fmt.Errorf("[ERROR] advertised_route_priority cannot be set to value other than zero unless zero_advertised_route_priority is false") - } else { - obj["advertisedRoutePriority"] =advertisedRoutePriorityProp - d.Set("is_advertised_route_priority_set", true) - } - } + } else if v, ok := d.GetOk("advertised_route_priority"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) { + obj["advertisedRoutePriority"] = advertisedRoutePriorityProp + } advertiseModeProp, err := expandNestedComputeRouterBgpPeerAdvertiseMode(d.Get("advertise_mode"), d, config) if err != nil { return err @@ -482,19 +450,7 @@ func resourceComputeRouterBgpPeerCreate(d *schema.ResourceData, meta interface{} if err != nil { return err } else if v, ok := d.GetOkExists("custom_learned_route_priority"); ok || !reflect.DeepEqual(v, customLearnedRoutePriorityProp) { - if !d.Get("zero_custom_learned_route_priority").(bool) && customLearnedRoutePriorityProp == 0 { - // Add the condition to check the present value - if !d.Get("is_custom_learned_priority_set").(bool) { - log.Printf("[WARN] custom_learned_route_priority can't be 0 unless zero_custom_learned_route_priority set to true") - } else { - return fmt.Errorf("Invalid custom_learned_route_priority value: When zero_custom_learned_route_priority is set to 'false', the custom_learned_route_priority field cannot be 0. Please provide a non-zero value.") - } - } else if d.Get("zero_custom_learned_route_priority").(bool) && customLearnedRoutePriorityProp != 0 { - return fmt.Errorf("[ERROR] custom_learned_route_priority cannot be set to value other than zero unless zero_custom_learned_route_priority is false") - } else { - obj["customLearnedRoutePriority"] =customLearnedRoutePriorityProp - d.Set("is_custom_learned_priority_set", true) - } + obj["customLearnedRoutePriority"] =customLearnedRoutePriorityProp } bfdProp, err := expandNestedComputeRouterBgpPeerBfd(d.Get("bfd"), d, config) if err != nil { @@ -816,20 +772,8 @@ func resourceComputeRouterBgpPeerUpdate(d *schema.ResourceData, meta interface{} advertisedRoutePriorityProp, err := expandNestedComputeRouterBgpPeerAdvertisedRoutePriority(d.Get("advertised_route_priority"), d, config) if err != nil { return err - } else if v, ok := d.GetOkExists("advertised_route_priority"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) { - if !d.Get("zero_advertised_route_priority").(bool) && advertisedRoutePriorityProp == 0 { - // Add the condition to check the present value - if !d.Get("is_advertised_route_priority_set").(bool) { - log.Printf("[WARN] advertised_route_priority can't be 0 unless zero_advertised_route_priority set to true") - } else { - return fmt.Errorf("Invalid advertised_route_priority value: When zero_advertised_route_priority is set to 'false', the advertised_route_priority field cannot be 0. Please provide a non-zero value.") - } - } else if d.Get("zero_advertised_route_priority").(bool) && advertisedRoutePriorityProp != 0 { - return fmt.Errorf("[ERROR] advertised_route_priority cannot be set to value other than zero unless zero_advertised_route_priority is false") - } else { - obj["advertisedRoutePriority"] =advertisedRoutePriorityProp - d.Set("is_advertised_route_priority_set", true) - } + } else if v, ok := d.GetOk("advertised_route_priority"); ok || !reflect.DeepEqual(v, advertisedRoutePriorityProp) { + obj["advertisedRoutePriority"] = advertisedRoutePriorityProp } advertiseModeProp, err := expandNestedComputeRouterBgpPeerAdvertiseMode(d.Get("advertise_mode"), d, config) if err != nil { @@ -859,19 +803,7 @@ func resourceComputeRouterBgpPeerUpdate(d *schema.ResourceData, meta interface{} if err != nil { return err } else if v, ok := d.GetOkExists("custom_learned_route_priority"); ok || !reflect.DeepEqual(v, customLearnedRoutePriorityProp) { - if !d.Get("zero_custom_learned_route_priority").(bool) && customLearnedRoutePriorityProp == 0 { - // Add the condition to check the present value - if !d.Get("is_custom_learned_priority_set").(bool) { - log.Printf("[WARN] custom_learned_route_priority can't be 0 unless zero_custom_learned_route_priority set to true") - } else { - return fmt.Errorf("Invalid custom_learned_route_priority value: When zero_custom_learned_route_priority is set to 'false', the custom_learned_route_priority field cannot be 0. Please provide a non-zero value.") - } - } else if d.Get("zero_custom_learned_route_priority").(bool) && customLearnedRoutePriorityProp != 0 { - return fmt.Errorf("[ERROR] custom_learned_route_priority cannot be set to value other than zero unless zero_custom_learned_route_priority is false") - } else { - obj["customLearnedRoutePriority"] = customLearnedRoutePriorityProp - d.Set("is_custom_learned_priority_set", true) - } + obj["customLearnedRoutePriority"] = customLearnedRoutePriorityProp } bfdProp, err := expandNestedComputeRouterBgpPeerBfd(d.Get("bfd"), d, config) if err != nil { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_router_peer_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_router_peer_meta.yaml.tmpl index 641edccada1e..75f9ce2aa769 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_router_peer_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_peer_meta.yaml.tmpl @@ -7,44 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Router' -fields: - - field: 'advertise_mode' - - field: 'advertised_groups' - - field: 'advertised_ip_ranges.description' - - field: 'advertised_ip_ranges.range' - - field: 'advertised_route_priority' - - field: 'bfd.min_receive_interval' - - field: 'bfd.min_transmit_interval' - - field: 'bfd.multiplier' - - field: 'bfd.session_initialization_mode' - - field: 'custom_learned_ip_ranges.range' - - field: 'custom_learned_route_priority' - - field: 'enable' - - field: 'enable_ipv4' - - field: 'enable_ipv6' -{{- if ne $.TargetVersionName "ga" }} - - field: 'export_policies' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'import_policies' -{{- end }} - - field: 'interface' - - field: 'ip_address' - - field: 'ipv4_nexthop_address' - - field: 'ipv6_nexthop_address' - - field: 'is_advertised_route_priority_set' - - field: 'is_custom_learned_priority_set' - - field: 'management_type' - - field: 'md5_authentication_key.key' - - field: 'md5_authentication_key.name' - - field: 'name' - - field: 'peer_asn' - - field: 'peer_ip_address' - - field: 'peer_ipv4_nexthop_address' - - field: 'peer_ipv6_nexthop_address' - - field: 'project' - - field: 'region' - - field: 'router' - - field: 'router_appliance_instance' - - field: 'zero_advertised_route_priority' - - field: 'zero_custom_learned_route_priority' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_router_peer_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_router_peer_test.go.tmpl index 2860dccf781a..57f322f6ca05 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_router_peer_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_router_peer_test.go.tmpl @@ -32,7 +32,7 @@ func TestAccComputeRouterBgpPeer_routerPeerRouterAppliance(t *testing.T) { ResourceName: "google_compute_router_peer.peer", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"router_appliance_instance", "router", "region","zero_custom_learned_route_priority"}, + ImportStateVerifyIgnore: []string{"router_appliance_instance", "router", "region"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_security_policy_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_security_policy_meta.yaml.tmpl index 04afbebdf2d0..9aa75826ed25 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_security_policy_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_security_policy_meta.yaml.tmpl @@ -7,76 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'SecurityPolicy' -fields: -{{- if ne $.TargetVersionName "ga" }} - - field: 'adaptive_protection_config.auto_deploy_config.confidence_threshold' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'adaptive_protection_config.auto_deploy_config.expiration_sec' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'adaptive_protection_config.auto_deploy_config.impacted_baseline_threshold' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'adaptive_protection_config.auto_deploy_config.load_threshold' -{{- end }} - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.enable' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.rule_visibility' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.auto_deploy_confidence_threshold' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.auto_deploy_expiration_sec' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.auto_deploy_impacted_baseline_threshold' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.auto_deploy_load_threshold' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.detection_absolute_qps' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.detection_load_threshold' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.detection_relative_to_baseline_qps' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.name' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.traffic_granularity_configs.enable_each_unique_value' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.traffic_granularity_configs.type' - - field: 'adaptive_protection_config.layer_7_ddos_defense_config.threshold_configs.traffic_granularity_configs.value' - - field: 'advanced_options_config.json_custom_config.content_types' - - field: 'advanced_options_config.json_parsing' - - field: 'advanced_options_config.log_level' - - field: 'advanced_options_config.user_ip_request_headers' - - field: 'description' - - field: 'fingerprint' - - field: 'name' - - field: 'project' - - field: 'recaptcha_options_config.redirect_site_key' - - field: 'rule.action' - - field: 'rule.description' - - field: 'rule.header_action.request_headers_to_adds.header_name' - - field: 'rule.header_action.request_headers_to_adds.header_value' - - field: 'rule.match.config.src_ip_ranges' - - field: 'rule.match.expr.expression' - - field: 'rule.match.expr_options.recaptcha_options.action_token_site_keys' - - field: 'rule.match.expr_options.recaptcha_options.session_token_site_keys' - - field: 'rule.match.versioned_expr' - - field: 'rule.preconfigured_waf_config.exclusion.request_cookie.operator' - - field: 'rule.preconfigured_waf_config.exclusion.request_cookie.value' - - field: 'rule.preconfigured_waf_config.exclusion.request_header.operator' - - field: 'rule.preconfigured_waf_config.exclusion.request_header.value' - - field: 'rule.preconfigured_waf_config.exclusion.request_query_param.operator' - - field: 'rule.preconfigured_waf_config.exclusion.request_query_param.value' - - field: 'rule.preconfigured_waf_config.exclusion.request_uri.operator' - - field: 'rule.preconfigured_waf_config.exclusion.request_uri.value' - - field: 'rule.preconfigured_waf_config.exclusion.target_rule_ids' - - field: 'rule.preconfigured_waf_config.exclusion.target_rule_set' - - field: 'rule.preview' - - field: 'rule.priority' - - field: 'rule.rate_limit_options.ban_duration_sec' - - field: 'rule.rate_limit_options.ban_threshold.count' - - field: 'rule.rate_limit_options.ban_threshold.interval_sec' - - field: 'rule.rate_limit_options.conform_action' - - field: 'rule.rate_limit_options.enforce_on_key' - - field: 'rule.rate_limit_options.enforce_on_key_configs.enforce_on_key_name' - - field: 'rule.rate_limit_options.enforce_on_key_configs.enforce_on_key_type' - - field: 'rule.rate_limit_options.enforce_on_key_name' - - field: 'rule.rate_limit_options.exceed_action' - - field: 'rule.rate_limit_options.exceed_redirect_options.target' - - field: 'rule.rate_limit_options.exceed_redirect_options.type' - - field: 'rule.rate_limit_options.rate_limit_threshold.count' - - field: 'rule.rate_limit_options.rate_limit_threshold.interval_sec' - - field: 'rule.redirect_options.target' - - field: 'rule.redirect_options.type' - - field: 'self_link' - - field: 'type' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_host_project_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_host_project_meta.yaml.tmpl index a5a2ad7ab3be..d398b3b4bde1 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_host_project_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_host_project_meta.yaml.tmpl @@ -7,5 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Project' -fields: - - field: 'project' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_service_project_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_service_project_meta.yaml.tmpl index 58496c7d212b..67589d7833cb 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_service_project_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_shared_vpc_service_project_meta.yaml.tmpl @@ -7,7 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Project' -fields: - - field: 'deletion_policy' - - field: 'host_project' - - field: 'service_project' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_target_pool_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_target_pool_meta.yaml.tmpl index cfaa7bd68d5a..dabb9e79d2eb 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_target_pool_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_target_pool_meta.yaml.tmpl @@ -7,17 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'TargetPool' -fields: - - field: 'backup_pool' - - field: 'description' - - field: 'failover_ratio' - - field: 'health_checks' - - field: 'instances' - - field: 'name' - - field: 'project' - - field: 'region' -{{- if ne $.TargetVersionName "ga" }} - - field: 'security_policy' -{{- end }} - - field: 'self_link' - - field: 'session_affinity' diff --git a/mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket_meta.yaml.tmpl index 95a4ee6c6549..8fe2affd5861 100644 --- a/mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket_meta.yaml.tmpl @@ -7,7 +7,3 @@ api_version: 'beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Project' -fields: - - field: 'bucket_name' - - field: 'prefix' - - field: 'project' diff --git a/mmv1/third_party/terraform/services/container/node_config.go.tmpl b/mmv1/third_party/terraform/services/container/node_config.go.tmpl index 88277e10f57b..1b38a8643bcb 100644 --- a/mmv1/third_party/terraform/services/container/node_config.go.tmpl +++ b/mmv1/third_party/terraform/services/container/node_config.go.tmpl @@ -2,7 +2,9 @@ package container import ( "log" +{{- if ne $.TargetVersionName "ga" }} "strings" +{{- end }} "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -239,11 +241,10 @@ func schemaNodeConfig() *schema.Schema { }, "resource_labels": { - Type: schema.TypeMap, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - DiffSuppressFunc: containerNodePoolResourceLabelsDiffSuppress, - Description: `The GCE resource labels (a map of key/value pairs) to be applied to the node pool.`, + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: `The GCE resource labels (a map of key/value pairs) to be applied to the node pool.`, }, "local_ssd_count": { @@ -624,45 +625,10 @@ func schemaNodeConfig() *schema.Schema { Optional: true, Description: `Controls the maximum number of processes allowed to run in a pod.`, }, - "container_log_max_size": { - Type: schema.TypeString, - Optional: true, - Description: `Defines the maximum size of the container log file before it is rotated.`, - }, - "container_log_max_files": { - Type: schema.TypeInt, - Optional: true, - Description: `Defines the maximum number of container log files that can be present for a container.`, - }, - "image_gc_low_threshold_percent": { - Type: schema.TypeInt, - Optional: true, - Description: `Defines the percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to.`, - }, - "image_gc_high_threshold_percent": { - Type: schema.TypeInt, - Optional: true, - Description: `Defines the percent of disk usage after which image garbage collection is always run.`, - }, - "image_minimum_gc_age": { - Type: schema.TypeString, - Optional: true, - Description: `Defines the minimum age for an unused image before it is garbage collected.`, - }, - "image_maximum_gc_age": { - Type: schema.TypeString, - Optional: true, - Description: `Defines the maximum age an image can be unused before it is garbage collected.`, - }, - "allowed_unsafe_sysctls": { - Type: schema.TypeList, - Optional: true, - Description: `Defines a comma-separated allowlist of unsafe sysctls or sysctl patterns which can be set on the Pods.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, }, }, }, + "linux_node_config": { Type: schema.TypeList, Optional: true, @@ -847,12 +813,6 @@ func schemaNodeConfig() *schema.Schema { ValidateFunc: validation.StringInSlice([]string{"STANDARD_ENCRYPTION", "EPHEMERAL_KEY_ENCRYPTION"}, false), Description: `LocalSsdEncryptionMode specified the method used for encrypting the local SSDs attached to the node.`, }, - "max_run_duration" : { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The runtime of each node in the node pool in seconds, terminated by 's'. Example: "3600s".`, - }, }, }, } @@ -910,7 +870,6 @@ func expandNodeConfigDefaults(configured interface{}) *container.NodeConfigDefau if v, ok := config["insecure_kubelet_readonly_port_enabled"]; ok { nodeConfigDefaults.NodeKubeletConfig = &container.NodeKubeletConfig{ InsecureKubeletReadonlyPortEnabled: expandInsecureKubeletReadonlyPortEnabled(v), - ForceSendFields: []string{"InsecureKubeletReadonlyPortEnabled"}, } } if variant, ok := config["logging_variant"]; ok { @@ -1235,10 +1194,6 @@ func expandNodeConfig(v interface{}) *container.NodeConfig { nc.LocalSsdEncryptionMode = v.(string) } - if v,ok := nodeConfig["max_run_duration"]; ok { - nc.MaxRunDuration = v.(string) - } - {{ if ne $.TargetVersionName `ga` -}} if v, ok := nodeConfig["host_maintenance_policy"]; ok { nc.HostMaintenancePolicy = expandHostMaintenancePolicy(v) @@ -1322,31 +1277,6 @@ func expandKubeletConfig(v interface{}) *container.NodeKubeletConfig { if podPidsLimit, ok := cfg["pod_pids_limit"]; ok { kConfig.PodPidsLimit = int64(podPidsLimit.(int)) } - if containerLogMaxSize, ok := cfg["container_log_max_size"]; ok { - kConfig.ContainerLogMaxSize = containerLogMaxSize.(string) - } - if containerLogMaxFiles, ok := cfg["container_log_max_files"]; ok { - kConfig.ContainerLogMaxFiles = int64(containerLogMaxFiles.(int)) - } - if imageGcLowThresholdPercent, ok := cfg["image_gc_low_threshold_percent"]; ok { - kConfig.ImageGcLowThresholdPercent = int64(imageGcLowThresholdPercent.(int)) - } - if imageGcHighThresholdPercent, ok := cfg["image_gc_high_threshold_percent"]; ok { - kConfig.ImageGcHighThresholdPercent = int64(imageGcHighThresholdPercent.(int)) - } - if imageMinimumGcAge, ok := cfg["image_minimum_gc_age"]; ok { - kConfig.ImageMinimumGcAge = imageMinimumGcAge.(string) - } - if imageMaximumGcAge, ok := cfg["image_maximum_gc_age"]; ok { - kConfig.ImageMaximumGcAge = imageMaximumGcAge.(string) - } - if allowedUnsafeSysctls, ok := cfg["allowed_unsafe_sysctls"]; ok { - sysctls := allowedUnsafeSysctls.([]interface{}) - kConfig.AllowedUnsafeSysctls = make([]string, len(sysctls)) - for i, s := range sysctls { - kConfig.AllowedUnsafeSysctls[i] = s.(string) - } - } return kConfig } @@ -1650,7 +1580,6 @@ func flattenNodeConfig(c *container.NodeConfig, v interface{}) []map[string]inte "linux_node_config": flattenLinuxNodeConfig(c.LinuxNodeConfig), "node_group": c.NodeGroup, "advanced_machine_features": flattenAdvancedMachineFeaturesConfig(c.AdvancedMachineFeatures), - "max_run_duration": c.MaxRunDuration, "sole_tenant_config": flattenSoleTenantConfig(c.SoleTenantConfig), "fast_socket": flattenFastSocket(c.FastSocket), "resource_manager_tags": flattenResourceManagerTags(c.ResourceManagerTags), @@ -1928,21 +1857,6 @@ func containerNodePoolLabelsSuppress(k, old, new string, d *schema.ResourceData) } {{- end }} -func containerNodePoolResourceLabelsDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for server-specified labels prefixed with "goog-gke" - if strings.Contains(k, "resource_labels.goog-gke") && new == "" { - return true - } - - // Let diff be determined by resource_labels (above) - if strings.Contains(k, "resource_labels.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} - func flattenKubeletConfig(c *container.NodeKubeletConfig) []map[string]interface{} { result := []map[string]interface{}{} if c != nil { @@ -1952,13 +1866,6 @@ func flattenKubeletConfig(c *container.NodeKubeletConfig) []map[string]interface "cpu_manager_policy": c.CpuManagerPolicy, "insecure_kubelet_readonly_port_enabled": flattenInsecureKubeletReadonlyPortEnabled(c), "pod_pids_limit": c.PodPidsLimit, - "container_log_max_size": c.ContainerLogMaxSize, - "container_log_max_files": c.ContainerLogMaxFiles, - "image_gc_low_threshold_percent": c.ImageGcLowThresholdPercent, - "image_gc_high_threshold_percent": c.ImageGcHighThresholdPercent, - "image_minimum_gc_age": c.ImageMinimumGcAge, - "image_maximum_gc_age": c.ImageMaximumGcAge, - "allowed_unsafe_sysctls": c.AllowedUnsafeSysctls, }) } return result @@ -2120,10 +2027,14 @@ func flattenHostMaintenancePolicy(c *container.HostMaintenancePolicy) []map[stri // node pool updates in `resource_container_cluster` func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Config, nodePoolInfo *NodePoolInformation, prefix, name string, timeout time.Duration) error { - // Nodepool write-lock will be acquired when update function is called. + // Cluster write-lock will be acquired when createOpF is called to make operation creations sequential within + // the cluster, and read-lock will be acquired when waitOpF is called to allow concurrent operation. + // This is to resolve the bottleneck of large number of operations being created at the same time. + clusterLockKey := nodePoolInfo.clusterLockKey() + // Nodepool write-lock will be acquired when calling creaetOpF and waitOpF. npLockKey := nodePoolInfo.nodePoolLockKey(name) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) if err != nil { return err } @@ -2142,17 +2053,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf }, } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2160,8 +2069,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated logging_variant for node pool %s", name) @@ -2171,24 +2080,22 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf if d.HasChange(prefix + "node_config.0.containerd_config") { if _, ok := d.GetOk(prefix + "node_config.0.containerd_config"); ok { req := &container.UpdateNodePoolRequest{ - Name: name, + Name: name, ContainerdConfig: expandContainerdConfig(d.Get(prefix + "node_config.0.containerd_config")), } if req.ContainerdConfig == nil { req.ContainerdConfig = &container.ContainerdConfig{} req.ForceSendFields = []string{"ContainerdConfig"} } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2196,8 +2103,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated containerd_config for node pool %s", name) @@ -2225,17 +2132,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf req.StoragePools = storagePools } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2243,7 +2148,7 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { return err } log.Printf("[INFO] Updated disk disk_size_gb/disk_type/machine_type/storage_pools for Node Pool %s", d.Id()) @@ -2281,17 +2186,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf req.Taints = ntaints } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2299,8 +2202,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated taints for Node Pool %s", d.Id()) } @@ -2333,17 +2236,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf req.Tags = ntags } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2351,8 +2252,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated tags for node pool %s", name) } @@ -2375,17 +2276,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf req.ResourceManagerTags = rmTags } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2393,7 +2292,7 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { return err } log.Printf("[INFO] Updated resource manager tags for node pool %s", name) @@ -2411,17 +2310,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf } } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2430,8 +2327,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf } // Call update serially. - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated resource labels for node pool %s", name) @@ -2449,17 +2346,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf } } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2468,8 +2363,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf } // Call update serially. - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated labels for node pool %s", name) @@ -2483,25 +2378,23 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf }, } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.Update(nodePoolInfo.parent(), req) if config.UserProjectOverride { clusterUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterUpdateCall.Do() - if err != nil { - return err - } + return clusterUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, "updating GKE node pool", userAgent, timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated image type in Node Pool %s", d.Id()) } @@ -2516,18 +2409,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf req.WorkloadMetadataConfig = &container.WorkloadMetadataConfig{} req.ForceSendFields = []string{"WorkloadMetadataConfig"} } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2535,8 +2425,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated workload_metadata_config for node pool %s", name) } @@ -2549,17 +2439,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf Enabled: gcfsEnabled, }, } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2567,8 +2455,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated gcfs_config for node pool %s", name) @@ -2584,17 +2472,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf req.KubeletConfig = &container.NodeKubeletConfig{} req.ForceSendFields = []string{"KubeletConfig"} } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2602,8 +2488,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated kubelet_config for node pool %s", name) @@ -2618,17 +2504,15 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf req.LinuxNodeConfig = &container.LinuxNodeConfig{} req.ForceSendFields = []string{"LinuxNodeConfig"} } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2636,8 +2520,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated linux_node_config for node pool %s", name) @@ -2649,21 +2533,19 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf } if v, ok := d.GetOk(prefix + "node_config.0.fast_socket"); ok { fastSocket := v.([]interface{})[0].(map[string]interface{}) - req.FastSocket = &container.FastSocket{ + req.FastSocket = &container.FastSocket{ Enabled: fastSocket["enabled"].(bool), } } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -2671,8 +2553,8 @@ func nodePoolNodeConfigUpdate(d *schema.ResourceData, config *transport_tpg.Conf timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated fast_socket for node pool %s", name) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl index 8eb75a45a6a2..ab045da4f80b 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl @@ -113,14 +113,6 @@ var ( suppressDiffForAutopilot = schema.SchemaDiffSuppressFunc(func(k, oldValue, newValue string, d *schema.ResourceData) bool { if v, _ := d.Get("enable_autopilot").(bool); v { - if k == "dns_config.0.additive_vpc_scope_dns_domain" { - return false - } - if k == "dns_config.#" { - if avpcDomain, _ := d.Get("dns_config.0.additive_vpc_scope_dns_domain").(string); avpcDomain != "" || d.HasChange("dns_config.0.additive_vpc_scope_dns_domain") { - return false - } - } return true } return false @@ -628,10 +620,9 @@ func ResourceContainerCluster() *schema.Resource { Description: `Minimum amount of the resource in the cluster.`, }, "maximum": { - Type: schema.TypeInt, - Description: `Maximum amount of the resource in the cluster.`, - Required: true, - ValidateFunc: validation.IntAtLeast(1), + Type: schema.TypeInt, + Optional: true, + Description: `Maximum amount of the resource in the cluster.`, }, }, }, @@ -1282,25 +1273,6 @@ func ResourceContainerCluster() *schema.Resource { Required: true, Description: `Whether or not the managed collection is enabled.`, }, - {{- if ne $.TargetVersionName "ga" }} - "auto_monitoring_config": { - Type: schema.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - Description: `Configuration for GKE Workload Auto-Monitoring.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "scope": { - Type: schema.TypeString, - Required: true, - Description: `The scope of auto-monitoring.`, - ValidateFunc: validation.StringInSlice([]string{"ALL", "NONE"}, false), - }, - }, - }, - }, - {{- end }} }, }, }, @@ -5922,20 +5894,6 @@ func expandMonitoringConfig(configured interface{}) *container.MonitoringConfig mc.ManagedPrometheusConfig = &container.ManagedPrometheusConfig{ Enabled: managed_prometheus["enabled"].(bool), } - {{- if ne $.TargetVersionName "ga" }} - if autoMonitoring, ok := managed_prometheus["auto_monitoring_config"]; ok { - if autoMonitoringList, ok := autoMonitoring.([]interface{}); ok { - if len(autoMonitoringList) > 0 { - autoMonitoringConfig := autoMonitoringList[0].(map[string]interface{}) - if scope, ok := autoMonitoringConfig["scope"].(string); ok && scope != "" { - mc.ManagedPrometheusConfig.AutoMonitoringConfig = &container.AutoMonitoringConfig{ - Scope: scope, - } - } - } - } - } - {{- end }} } if v, ok := config["advanced_datapath_observability_config"]; ok && len(v.([]interface{})) > 0 { @@ -6913,26 +6871,11 @@ func flattenAdvancedDatapathObservabilityConfig(c *container.AdvancedDatapathObs } func flattenManagedPrometheusConfig(c *container.ManagedPrometheusConfig) []map[string]interface{} { - if c == nil { - return nil - } - - result := make(map[string]interface{}) - result["enabled"] = c.Enabled - - {{- if ne $.TargetVersionName "ga" }} - autoMonitoringList := []map[string]interface{}{} - if c.AutoMonitoringConfig != nil && c.AutoMonitoringConfig.Scope != "" { - autoMonitoringMap := map[string]interface{}{ - "scope": c.AutoMonitoringConfig.Scope, - } - autoMonitoringList = append(autoMonitoringList, autoMonitoringMap) - } - - result["auto_monitoring_config"] = autoMonitoringList - {{- end }} - - return []map[string]interface{}{result} + return []map[string]interface{}{ + { + "enabled": c != nil && c.Enabled, + }, + } } func flattenNodePoolAutoConfig(c *container.NodePoolAutoConfig) []map[string]interface{} { @@ -7131,9 +7074,6 @@ func containerClusterAutopilotCustomizeDiff(_ context.Context, d *schema.Resourc return err } } - if d.Get("enable_autopilot").(bool) && d.HasChange("dns_config.0.additive_vpc_scope_dns_domain") { - return d.ForceNew("dns_config.0.additive_vpc_scope_dns_domain") - } return nil } diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_meta.yaml.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_meta.yaml.tmpl index e0ee0d874e6d..80b6faea32eb 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_meta.yaml.tmpl @@ -7,398 +7,3 @@ api_version: 'v1beta1' api_version: 'v1' {{- end }} api_resource_type_kind: 'Cluster' -fields: - - field: 'addons_config.cloudrun_config.disabled' - - field: 'addons_config.cloudrun_config.load_balancer_type' - - field: 'addons_config.config_connector_config.enabled' - - field: 'addons_config.dns_cache_config.enabled' - - field: 'addons_config.gce_persistent_disk_csi_driver_config.enabled' - - field: 'addons_config.gcp_filestore_csi_driver_config.enabled' - - field: 'addons_config.gcs_fuse_csi_driver_config.enabled' - - field: 'addons_config.gke_backup_agent_config.enabled' - - field: 'addons_config.horizontal_pod_autoscaling.disabled' - - field: 'addons_config.http_load_balancing.disabled' -{{- if ne $.TargetVersionName "ga" }} - - field: 'addons_config.istio_config.auth' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'addons_config.istio_config.disabled' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'addons_config.kalm_config.enabled' -{{- end }} - - field: 'addons_config.network_policy_config.disabled' - - field: 'addons_config.parallelstore_csi_driver_config.enabled' - - field: 'addons_config.ray_operator_config.enabled' - - field: 'addons_config.ray_operator_config.ray_cluster_logging_config.enabled' - - field: 'addons_config.ray_operator_config.ray_cluster_monitoring_config.enabled' - - field: 'addons_config.stateful_ha_config.enabled' - - field: 'allow_net_admin' - - field: 'authenticator_groups_config.security_group' - - field: 'binary_authorization.enabled' - - field: 'binary_authorization.evaluation_mode' - - field: 'cluster_autoscaling.auto_provisioning_defaults.boot_disk_kms_key' - - field: 'cluster_autoscaling.auto_provisioning_defaults.disk_size' - - field: 'cluster_autoscaling.auto_provisioning_defaults.disk_type' - - field: 'cluster_autoscaling.auto_provisioning_defaults.image_type' - - field: 'cluster_autoscaling.auto_provisioning_defaults.management.auto_repair' - - field: 'cluster_autoscaling.auto_provisioning_defaults.management.auto_upgrade' - - field: 'cluster_autoscaling.auto_provisioning_defaults.management.upgrade_options.auto_upgrade_start_time' - - field: 'cluster_autoscaling.auto_provisioning_defaults.management.upgrade_options.description' - - field: 'cluster_autoscaling.auto_provisioning_defaults.min_cpu_platform' - - field: 'cluster_autoscaling.auto_provisioning_defaults.oauth_scopes' - - field: 'cluster_autoscaling.auto_provisioning_defaults.service_account' - - field: 'cluster_autoscaling.auto_provisioning_defaults.shielded_instance_config.enable_integrity_monitoring' - - field: 'cluster_autoscaling.auto_provisioning_defaults.shielded_instance_config.enable_secure_boot' - - field: 'cluster_autoscaling.auto_provisioning_defaults.upgrade_settings.blue_green_settings.node_pool_soak_duration' - - field: 'cluster_autoscaling.auto_provisioning_defaults.upgrade_settings.blue_green_settings.standard_rollout_policy.batch_node_count' - - field: 'cluster_autoscaling.auto_provisioning_defaults.upgrade_settings.blue_green_settings.standard_rollout_policy.batch_percentage' - - field: 'cluster_autoscaling.auto_provisioning_defaults.upgrade_settings.blue_green_settings.standard_rollout_policy.batch_soak_duration' - - field: 'cluster_autoscaling.auto_provisioning_defaults.upgrade_settings.max_surge' - - field: 'cluster_autoscaling.auto_provisioning_defaults.upgrade_settings.max_unavailable' - - field: 'cluster_autoscaling.auto_provisioning_defaults.upgrade_settings.strategy' - - field: 'cluster_autoscaling.auto_provisioning_locations' - - field: 'cluster_autoscaling.autoscaling_profile' - - field: 'cluster_autoscaling.enabled' - - field: 'cluster_autoscaling.resource_limits.maximum' - - field: 'cluster_autoscaling.resource_limits.minimum' - - field: 'cluster_autoscaling.resource_limits.resource_type' - - field: 'cluster_ipv4_cidr' -{{- if ne $.TargetVersionName "ga" }} - - field: 'cluster_telemetry.type' -{{- end }} - - field: 'confidential_nodes.enabled' - - field: 'control_plane_endpoints_config.dns_endpoint_config.allow_external_traffic' - - field: 'control_plane_endpoints_config.dns_endpoint_config.endpoint' - - field: 'cost_management_config.enabled' - - field: 'database_encryption.key_name' - - field: 'database_encryption.state' - - field: 'datapath_provider' - - field: 'default_max_pods_per_node' - - field: 'default_snat_status.disabled' - - field: 'deletion_protection' - - field: 'description' - - field: 'dns_config.additive_vpc_scope_dns_domain' - - field: 'dns_config.cluster_dns' - - field: 'dns_config.cluster_dns_domain' - - field: 'dns_config.cluster_dns_scope' - - field: 'effective_labels' - provider_only: true - - field: 'enable_autopilot' - - field: 'enable_cilium_clusterwide_network_policy' - - field: 'enable_fqdn_network_policy' - - field: 'enable_intranode_visibility' - - field: 'enable_k8s_beta_apis.enabled_apis' - - field: 'enable_kubernetes_alpha' - - field: 'enable_l4_ilb_subsetting' - - field: 'enable_legacy_abac' - - field: 'enable_multi_networking' - - field: 'enable_shielded_nodes' - - field: 'enable_tpu' - - field: 'endpoint' - - field: 'enterprise_config.cluster_tier' - - field: 'enterprise_config.desired_tier' - - field: 'fleet.membership' - - field: 'fleet.membership_id' - - field: 'fleet.membership_location' - - field: 'fleet.pre_registered' - - field: 'fleet.project' - - field: 'gateway_api_config.channel' - - field: 'identity_service_config.enabled' - - field: 'initial_node_count' - - field: 'ip_allocation_policy.additional_pod_ranges_config.pod_range_names' - - field: 'ip_allocation_policy.cluster_ipv4_cidr_block' - - field: 'ip_allocation_policy.cluster_secondary_range_name' - - field: 'ip_allocation_policy.pod_cidr_overprovision_config.disabled' - - field: 'ip_allocation_policy.services_ipv4_cidr_block' - - field: 'ip_allocation_policy.services_secondary_range_name' - - field: 'ip_allocation_policy.stack_type' - - field: 'label_fingerprint' - - field: 'location' - - field: 'logging_config.enable_components' - - field: 'logging_service' - - field: 'maintenance_policy.daily_maintenance_window.duration' - - field: 'maintenance_policy.daily_maintenance_window.start_time' - - field: 'maintenance_policy.maintenance_exclusion.end_time' - - field: 'maintenance_policy.maintenance_exclusion.exclusion_name' - - field: 'maintenance_policy.maintenance_exclusion.exclusion_options.scope' - - field: 'maintenance_policy.maintenance_exclusion.start_time' - - field: 'maintenance_policy.recurring_window.end_time' - - field: 'maintenance_policy.recurring_window.recurrence' - - field: 'maintenance_policy.recurring_window.start_time' - - field: 'master_auth.client_certificate' - - field: 'master_auth.client_certificate_config.issue_client_certificate' - - field: 'master_auth.client_key' - - field: 'master_auth.cluster_ca_certificate' - - field: 'master_authorized_networks_config.cidr_blocks.cidr_block' - - field: 'master_authorized_networks_config.cidr_blocks.display_name' - - field: 'master_authorized_networks_config.gcp_public_cidrs_access_enabled' - - field: 'master_authorized_networks_config.private_endpoint_enforcement_enabled' - - field: 'master_version' - - field: 'mesh_certificates.enable_certificates' - - field: 'min_master_version' - - field: 'monitoring_config.advanced_datapath_observability_config.enable_metrics' - - field: 'monitoring_config.advanced_datapath_observability_config.enable_relay' - - field: 'monitoring_config.enable_components' - - field: 'monitoring_config.managed_prometheus.enabled' - - field: 'monitoring_service' - - field: 'name' - - field: 'network' - - field: 'network_policy.enabled' - - field: 'network_policy.provider' - - field: 'networking_mode' - - field: 'node_config.advanced_machine_features.enable_nested_virtualization' - - field: 'node_config.advanced_machine_features.threads_per_core' - - field: 'node_config.boot_disk_kms_key' - - field: 'node_config.confidential_nodes.enabled' - - field: 'node_config.containerd_config.private_registry_access_config.certificate_authority_domain_config.fqdns' - - field: 'node_config.containerd_config.private_registry_access_config.certificate_authority_domain_config.gcp_secret_manager_certificate_config.secret_uri' - - field: 'node_config.containerd_config.private_registry_access_config.enabled' - - field: 'node_config.disk_size_gb' - - field: 'node_config.disk_type' - - field: 'node_config.effective_taints.effect' - - field: 'node_config.effective_taints.key' - - field: 'node_config.effective_taints.value' - - field: 'node_config.enable_confidential_storage' -{{- if ne $.TargetVersionName "ga" }} - - field: 'node_config.ephemeral_storage_config.local_ssd_count' -{{- end }} - - field: 'node_config.ephemeral_storage_local_ssd_config.local_ssd_count' - - field: 'node_config.fast_socket.enabled' - - field: 'node_config.gcfs_config.enabled' - - field: 'node_config.guest_accelerator.count' - - field: 'node_config.guest_accelerator.gpu_driver_installation_config.gpu_driver_version' - - field: 'node_config.guest_accelerator.gpu_partition_size' - - field: 'node_config.guest_accelerator.gpu_sharing_config.gpu_sharing_strategy' - - field: 'node_config.guest_accelerator.gpu_sharing_config.max_shared_clients_per_gpu' - - field: 'node_config.guest_accelerator.type' - - field: 'node_config.gvnic.enabled' - - field: 'node_config.host_maintenance_policy.maintenance_interval' - - field: 'node_config.image_type' - - field: 'node_config.kubelet_config.cpu_cfs_quota' - - field: 'node_config.kubelet_config.cpu_cfs_quota_period' - - field: 'node_config.kubelet_config.cpu_manager_policy' - - field: 'node_config.kubelet_config.insecure_kubelet_readonly_port_enabled' - - field: 'node_config.kubelet_config.pod_pids_limit' - - field: 'node_config.labels' - - field: 'node_config.linux_node_config.cgroup_mode' - - field: 'node_config.linux_node_config.hugepages_config.hugepage_size_1g' - - field: 'node_config.linux_node_config.hugepages_config.hugepage_size_2m' - - field: 'node_config.linux_node_config.sysctls' - - field: 'node_config.local_nvme_ssd_block_config.local_ssd_count' - - field: 'node_config.local_ssd_count' - - field: 'node_config.local_ssd_encryption_mode' - - field: 'node_config.logging_variant' - - field: 'node_config.machine_type' - - field: 'node_config.max_run_duration' - - field: 'node_config.metadata' - - field: 'node_config.min_cpu_platform' - - field: 'node_config.node_group' - - field: 'node_config.oauth_scopes' - - field: 'node_config.preemptible' - - field: 'node_config.reservation_affinity.consume_reservation_type' - - field: 'node_config.reservation_affinity.key' - - field: 'node_config.reservation_affinity.values' - - field: 'node_config.resource_labels' - - field: 'node_config.resource_manager_tags' -{{- if ne $.TargetVersionName "ga" }} - - field: 'node_config.sandbox_config.sandbox_type' -{{- end }} - - field: 'node_config.secondary_boot_disks.disk_image' - - field: 'node_config.secondary_boot_disks.mode' - - field: 'node_config.service_account' - - field: 'node_config.shielded_instance_config.enable_integrity_monitoring' - - field: 'node_config.shielded_instance_config.enable_secure_boot' - - field: 'node_config.sole_tenant_config.node_affinity.key' - - field: 'node_config.sole_tenant_config.node_affinity.operator' - - field: 'node_config.sole_tenant_config.node_affinity.values' - - field: 'node_config.spot' - - field: 'node_config.storage_pools' - - field: 'node_config.tags' - - field: 'node_config.taint.effect' - - field: 'node_config.taint.key' - - field: 'node_config.taint.value' - - field: 'node_config.workload_metadata_config.mode' - - field: 'node_locations' - - field: 'node_pool.autoscaling.location_policy' - - field: 'node_pool.autoscaling.max_node_count' - - field: 'node_pool.autoscaling.min_node_count' - - field: 'node_pool.autoscaling.total_max_node_count' - - field: 'node_pool.autoscaling.total_min_node_count' - - field: 'node_pool.initial_node_count' - - field: 'node_pool.instance_group_urls' - - field: 'node_pool.managed_instance_group_urls' - - field: 'node_pool.management.auto_repair' - - field: 'node_pool.management.auto_upgrade' - - field: 'node_pool.max_pods_per_node' - - field: 'node_pool.name' - - field: 'node_pool.name_prefix' - - field: 'node_pool.network_config.additional_node_network_configs.network' - - field: 'node_pool.network_config.additional_node_network_configs.subnetwork' - - field: 'node_pool.network_config.additional_pod_network_configs.max_pods_per_node' - - field: 'node_pool.network_config.additional_pod_network_configs.secondary_pod_range' - - field: 'node_pool.network_config.additional_pod_network_configs.subnetwork' - - field: 'node_pool.network_config.create_pod_range' - - field: 'node_pool.network_config.enable_private_nodes' - - field: 'node_pool.network_config.network_performance_config.total_egress_bandwidth_tier' - - field: 'node_pool.network_config.pod_cidr_overprovision_config.disabled' - - field: 'node_pool.network_config.pod_ipv4_cidr_block' - - field: 'node_pool.network_config.pod_range' - - field: 'node_pool.node_config.advanced_machine_features.enable_nested_virtualization' - - field: 'node_pool.node_config.advanced_machine_features.threads_per_core' - - field: 'node_pool.node_config.boot_disk_kms_key' - - field: 'node_pool.node_config.confidential_nodes.enabled' - - field: 'node_pool.node_config.containerd_config.private_registry_access_config.certificate_authority_domain_config.fqdns' - - field: 'node_pool.node_config.containerd_config.private_registry_access_config.certificate_authority_domain_config.gcp_secret_manager_certificate_config.secret_uri' - - field: 'node_pool.node_config.containerd_config.private_registry_access_config.enabled' - - field: 'node_pool.node_config.disk_size_gb' - - field: 'node_pool.node_config.disk_type' - - field: 'node_pool.node_config.effective_taints.effect' - - field: 'node_pool.node_config.effective_taints.key' - - field: 'node_pool.node_config.effective_taints.value' - - field: 'node_pool.node_config.enable_confidential_storage' -{{- if ne $.TargetVersionName "ga" }} - - field: 'node_pool.node_config.ephemeral_storage_config.local_ssd_count' -{{- end }} - - field: 'node_pool.node_config.ephemeral_storage_local_ssd_config.local_ssd_count' - - field: 'node_pool.node_config.fast_socket.enabled' - - field: 'node_pool.node_config.gcfs_config.enabled' - - field: 'node_pool.node_config.guest_accelerator.count' - - field: 'node_pool.node_config.guest_accelerator.gpu_driver_installation_config.gpu_driver_version' - - field: 'node_pool.node_config.guest_accelerator.gpu_partition_size' - - field: 'node_pool.node_config.guest_accelerator.gpu_sharing_config.gpu_sharing_strategy' - - field: 'node_pool.node_config.guest_accelerator.gpu_sharing_config.max_shared_clients_per_gpu' - - field: 'node_pool.node_config.guest_accelerator.type' - - field: 'node_pool.node_config.gvnic.enabled' - - field: 'node_pool.node_config.host_maintenance_policy.maintenance_interval' - - field: 'node_pool.node_config.image_type' - - field: 'node_pool.node_config.kubelet_config.cpu_cfs_quota' - - field: 'node_pool.node_config.kubelet_config.cpu_cfs_quota_period' - - field: 'node_pool.node_config.kubelet_config.cpu_manager_policy' - - field: 'node_pool.node_config.kubelet_config.insecure_kubelet_readonly_port_enabled' - - field: 'node_pool.node_config.kubelet_config.pod_pids_limit' - - field: 'node_pool.node_config.labels' - - field: 'node_pool.node_config.linux_node_config.cgroup_mode' - - field: 'node_pool.node_config.linux_node_config.hugepages_config.hugepage_size_1g' - - field: 'node_pool.node_config.linux_node_config.hugepages_config.hugepage_size_2m' - - field: 'node_pool.node_config.linux_node_config.sysctls' - - field: 'node_pool.node_config.local_nvme_ssd_block_config.local_ssd_count' - - field: 'node_pool.node_config.local_ssd_count' - - field: 'node_pool.node_config.local_ssd_encryption_mode' - - field: 'node_pool.node_config.logging_variant' - - field: 'node_pool.node_config.machine_type' - - field: 'node_pool.node_config.max_run_duration' - - field: 'node_pool.node_config.metadata' - - field: 'node_pool.node_config.min_cpu_platform' - - field: 'node_pool.node_config.node_group' - - field: 'node_pool.node_config.oauth_scopes' - - field: 'node_pool.node_config.preemptible' - - field: 'node_pool.node_config.reservation_affinity.consume_reservation_type' - - field: 'node_pool.node_config.reservation_affinity.key' - - field: 'node_pool.node_config.reservation_affinity.values' - - field: 'node_pool.node_config.resource_labels' - - field: 'node_pool.node_config.resource_manager_tags' -{{- if ne $.TargetVersionName "ga" }} - - field: 'node_pool.node_config.sandbox_config.sandbox_type' -{{- end }} - - field: 'node_pool.node_config.secondary_boot_disks.disk_image' - - field: 'node_pool.node_config.secondary_boot_disks.mode' - - field: 'node_pool.node_config.service_account' - - field: 'node_pool.node_config.shielded_instance_config.enable_integrity_monitoring' - - field: 'node_pool.node_config.shielded_instance_config.enable_secure_boot' - - field: 'node_pool.node_config.sole_tenant_config.node_affinity.key' - - field: 'node_pool.node_config.sole_tenant_config.node_affinity.operator' - - field: 'node_pool.node_config.sole_tenant_config.node_affinity.values' - - field: 'node_pool.node_config.spot' - - field: 'node_pool.node_config.storage_pools' - - field: 'node_pool.node_config.tags' - - field: 'node_pool.node_config.taint.effect' - - field: 'node_pool.node_config.taint.key' - - field: 'node_pool.node_config.taint.value' - - field: 'node_pool.node_config.workload_metadata_config.mode' - - field: 'node_pool.node_count' - - field: 'node_pool.node_locations' - - field: 'node_pool.placement_policy.policy_name' - - field: 'node_pool.placement_policy.tpu_topology' - - field: 'node_pool.placement_policy.type' - - field: 'node_pool.queued_provisioning.enabled' - - field: 'node_pool.upgrade_settings.blue_green_settings.node_pool_soak_duration' - - field: 'node_pool.upgrade_settings.blue_green_settings.standard_rollout_policy.batch_node_count' - - field: 'node_pool.upgrade_settings.blue_green_settings.standard_rollout_policy.batch_percentage' - - field: 'node_pool.upgrade_settings.blue_green_settings.standard_rollout_policy.batch_soak_duration' - - field: 'node_pool.upgrade_settings.max_surge' - - field: 'node_pool.upgrade_settings.max_unavailable' - - field: 'node_pool.upgrade_settings.strategy' - - field: 'node_pool.version' - - field: 'node_pool_auto_config.linux_node_config.cgroup_mode' - - field: 'node_pool_auto_config.network_tags.tags' - - field: 'node_pool_auto_config.node_kubelet_config.insecure_kubelet_readonly_port_enabled' - - field: 'node_pool_auto_config.resource_manager_tags' - - field: 'node_pool_defaults.node_config_defaults.containerd_config.private_registry_access_config.certificate_authority_domain_config.fqdns' - - field: 'node_pool_defaults.node_config_defaults.containerd_config.private_registry_access_config.certificate_authority_domain_config.gcp_secret_manager_certificate_config.secret_uri' - - field: 'node_pool_defaults.node_config_defaults.containerd_config.private_registry_access_config.enabled' - - field: 'node_pool_defaults.node_config_defaults.gcfs_config.enabled' - - field: 'node_pool_defaults.node_config_defaults.insecure_kubelet_readonly_port_enabled' - - field: 'node_pool_defaults.node_config_defaults.logging_variant' - - field: 'node_version' - - field: 'notification_config.pubsub.enabled' - - field: 'notification_config.pubsub.filter.event_type' - - field: 'notification_config.pubsub.topic' - - field: 'operation' -{{- if ne $.TargetVersionName "ga" }} - - field: 'pod_security_policy_config.enabled' -{{- end }} - - field: 'private_cluster_config.enable_private_endpoint' - - field: 'private_cluster_config.enable_private_nodes' - - field: 'private_cluster_config.master_global_access_config.enabled' - - field: 'private_cluster_config.master_ipv4_cidr_block' - - field: 'private_cluster_config.peering_name' - - field: 'private_cluster_config.private_endpoint' - - field: 'private_cluster_config.private_endpoint_subnetwork' - - field: 'private_cluster_config.public_endpoint' - - field: 'private_ipv6_google_access' - - field: 'project' -{{- if ne $.TargetVersionName "ga" }} - - field: 'protect_config.workload_config.audit_mode' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'protect_config.workload_vulnerability_mode' -{{- end }} - - field: 'release_channel.channel' - - field: 'remove_default_node_pool' - - field: 'resource_labels' - - field: 'resource_usage_export_config.bigquery_destination.dataset_id' - - field: 'resource_usage_export_config.enable_network_egress_metering' - - field: 'resource_usage_export_config.enable_resource_consumption_metering' - - field: 'secret_manager_config.enabled' - - field: 'security_posture_config.mode' - - field: 'security_posture_config.vulnerability_mode' - - field: 'self_link' - - field: 'service_external_ips_config.enabled' - - field: 'services_ipv4_cidr' - - field: 'subnetwork' - - field: 'terraform_labels' - provider_only: true -{{- if ne $.TargetVersionName "ga" }} - - field: 'tpu_config.enabled' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'tpu_config.ipv4_cidr_block' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'tpu_config.use_service_networking' -{{- end }} - - field: 'tpu_ipv4_cidr_block' - - field: 'user_managed_keys_config.aggregation_ca' - - field: 'user_managed_keys_config.cluster_ca' - - field: 'user_managed_keys_config.control_plane_disk_encryption_key' - - field: 'user_managed_keys_config.etcd_api_ca' - - field: 'user_managed_keys_config.etcd_peer_ca' - - field: 'user_managed_keys_config.gkeops_etcd_backup_encryption_key' - - field: 'user_managed_keys_config.service_account_signing_keys' - - field: 'user_managed_keys_config.service_account_verification_keys' - - field: 'vertical_pod_autoscaling.enabled' -{{- if ne $.TargetVersionName "ga" }} - - field: 'workload_alts_config.enable_alts' -{{- end }} - - field: 'workload_identity_config.workload_pool' diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl index 4fb8f3313bed..ef6ca08968ca 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl @@ -15,27 +15,6 @@ import ( cloudkms "google.golang.org/api/cloudkms/v1" ) -func bootstrapGkeTagManagerServiceAgents(t *testing.T) { - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com", - Role: "roles/resourcemanager.tagAdmin", - }, - { - Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com", - Role: "roles/resourcemanager.tagHoldAdmin", - }, - { - Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com", - Role: "roles/resourcemanager.tagUser", - }, - { - Member: "serviceAccount:{project_number}@cloudservices.gserviceaccount.com", - Role: "roles/resourcemanager.tagUser", - }, - }) -} - func TestAccContainerCluster_basic(t *testing.T) { t.Parallel() @@ -89,8 +68,11 @@ func TestAccContainerCluster_resourceManagerTags(t *testing.T) { networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - - bootstrapGkeTagManagerServiceAgents(t) + + if acctest.BootstrapPSARole(t, "service-", "container-engine-robot", "roles/resourcemanager.tagHoldAdmin") { + t.Fatal("Stopping the test because a role was added to the policy.") + } + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), @@ -459,50 +441,6 @@ func TestAccContainerCluster_withLocalSsdEncryptionMode(t *testing.T) { }) } -func TestAccContainerCluster_withMaxRunDuration(t *testing.T) { - t.Parallel() - - clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") - subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - npName := fmt.Sprintf("tf-test-node-pool-%s", acctest.RandString(t, 10)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccContainerCluster_withMaxRunDuration(clusterName, npName, networkName, subnetworkName, "3600s"), - }, - { - ResourceName: "google_container_cluster.max_run_duration", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_withMaxRunDuration(clusterName, npName, networkName, subnetworkName, "1800s"), - }, - { - ResourceName: "google_container_cluster.max_run_duration", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_disableMaxRunDuration(clusterName, npName, networkName, subnetworkName), - }, - { - ResourceName: "google_container_cluster.max_run_duration", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - }, - }) -} - func TestAccContainerCluster_withILBSubsetting(t *testing.T) { t.Parallel() @@ -1923,7 +1861,6 @@ func TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledInNodePool(t }) } - // This is for `node_pool_defaults.node_config_defaults` - the default settings // for newly created nodepools func TestAccContainerCluster_withInsecureKubeletReadonlyPortEnabledDefaultsUpdates(t *testing.T) { @@ -2411,12 +2348,9 @@ func TestAccContainerCluster_withBootDiskKmsKey(t *testing.T) { networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -3640,10 +3574,7 @@ func TestAccContainerCluster_withAutopilotKubeletConfig(t *testing.T) { }) } -// func TestAccContainerCluster_withAutopilot_withNodePoolDefaults(t *testing.T) { -// nodePoolDefaults is not allowed on GKE Autopilot clusters, error from GKE is: -// `Setting node_pool_defaults.node_config_defaults.node_kubelet_config is not allowed on GKE Autopilot clusters.` -func TestAccContainerCluster_withAutopilot_withNodePoolAutoConfig(t *testing.T) { +func TestAccContainerCluster_withAutopilot_withNodePoolDefaults(t *testing.T) { t.Parallel() randomSuffix := acctest.RandString(t, 10) @@ -3657,7 +3588,7 @@ func TestAccContainerCluster_withAutopilot_withNodePoolAutoConfig(t *testing.T) CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccContainerCluster_withAutopilot_withNodePoolAutoConfig(clusterName, networkName, subnetworkName, "FALSE"), + Config: testAccContainerCluster_withAutopilot_withNodePoolDefaults(clusterName, networkName, subnetworkName), }, { ResourceName: "google_container_cluster.primary", @@ -3669,33 +3600,6 @@ func TestAccContainerCluster_withAutopilot_withNodePoolAutoConfig(t *testing.T) }) } -func TestAccContainerCluster_withStandard_withNodePoolDefaults(t *testing.T) { - t.Parallel() - - randomSuffix := acctest.RandString(t, 10) - clusterName := fmt.Sprintf("tf-test-cluster-%s", randomSuffix) - networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") - subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccContainerCluster_withStandard_withNodePoolDefaults(clusterName, networkName, subnetworkName, "FALSE"), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - }, - }) -} - - func TestAccContainerCluster_withAutopilotResourceManagerTags(t *testing.T) { t.Parallel() @@ -3707,8 +3611,6 @@ func TestAccContainerCluster_withAutopilotResourceManagerTags(t *testing.T) { clusterNetName := fmt.Sprintf("tf-test-container-net-%s", randomSuffix) clusterSubnetName := fmt.Sprintf("tf-test-container-subnet-%s", randomSuffix) - bootstrapGkeTagManagerServiceAgents(t) - acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), @@ -3733,10 +3635,6 @@ func TestAccContainerCluster_withAutopilotResourceManagerTags(t *testing.T) { { Config: testAccContainerCluster_withAutopilotResourceManagerTagsUpdate1(pid, clusterName, clusterNetName, clusterSubnetName, randomSuffix), Check: resource.ComposeTestCheckFunc( - // Small sleep, to avoid case where cluster is ready but underlying GCE - // resources apparently aren't. - // b/390456348 - acctest.SleepInSecondsForTest(30), resource.TestCheckResourceAttrSet("google_container_cluster.with_autopilot", "node_pool_auto_config.0.resource_manager_tags.%"), ), }, @@ -4068,32 +3966,6 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"}, }, - {{- if ne $.TargetVersionName "ga" }} - { - Config: testAccContainerCluster_withMonitoringConfigScopeAll(clusterName, networkName, subnetworkName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "monitoring_config.0.managed_prometheus.0.auto_monitoring_config.0.scope", "ALL"), - ), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"}, - }, - { - Config: testAccContainerCluster_withMonitoringConfigScopeNone(clusterName, networkName, subnetworkName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "monitoring_config.0.managed_prometheus.0.auto_monitoring_config.0.scope", "NONE"), - ), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"}, - }, - {{- end }} // Back to basic settings to test setting Prometheus on its own { Config: testAccContainerCluster_basic(clusterName, networkName, subnetworkName), @@ -4487,12 +4359,9 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey(t *testi networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -4554,7 +4423,7 @@ func TestAccContainerCluster_autoprovisioningDefaultsManagement(t *testing.T) { CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccContainerCluster_autoprovisioningDefaultsManagement(clusterName, networkName, subnetworkName, true, false), + Config: testAccContainerCluster_autoprovisioningDefaultsManagement(clusterName, networkName, subnetworkName, false, false), }, { ResourceName: "google_container_cluster.with_autoprovisioning_management", @@ -5620,24 +5489,14 @@ func TestAccContainerCluster_WithCPAFeatures(t *testing.T) { // *ALL* Cloud KMS keys in the project. A more realistic usage would be to // grant the service agent the necessary roles only on the individual keys // we have created. - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com", - Role: "roles/container.cloudKmsKeyUser", - }, - { - Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com", - Role: "roles/privateca.certificateManager", - }, - { - Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - { - Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypterViaDelegation", - }, - }) + roles := []string{ + "roles/container.cloudKmsKeyUser", + "roles/privateca.certificateManager", + "roles/cloudkms.cryptoKeyEncrypterDecrypter", + } + if acctest.BootstrapPSARoles(t, "service-", "container-engine-robot", roles) { + t.Fatal("Stopping the test because a role was added to the policy.") + } // Find an active cryptoKeyVersion on the signing key. var signingCryptoKeyVersion *cloudkms.CryptoKeyVersion @@ -5912,10 +5771,6 @@ resource "google_container_cluster" "with_cpa_features" { google_privateca_ca_pool.etcd_api_ca, google_privateca_ca_pool.etcd_peer_ca, google_privateca_ca_pool.aggregation_ca, - google_privateca_certificate_authority.cluster_ca, - google_privateca_certificate_authority.etcd_api_ca, - google_privateca_certificate_authority.etcd_peer_ca, - google_privateca_certificate_authority.aggregation_ca, ] } `, context) @@ -5943,169 +5798,6 @@ func TestAccContainerCluster_autopilot_minimal(t *testing.T) { }) } -func TestAccContainerCluster_autopilot_withDNSConfig(t *testing.T) { - t.Parallel() - - clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, false, false, ""), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, true, false, ""), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, false, true, ""), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, true, true, ""), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - }, - }) -} - -func TestAccContainerCluster_autopilot_withAdditiveVPC(t *testing.T) { - t.Parallel() - - domain := "additive.autopilot.example" - clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, false, false, domain), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "dns_config.0.additive_vpc_scope_dns_domain", domain), - ), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, true, false, domain), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "dns_config.0.additive_vpc_scope_dns_domain", domain), - ), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, false, true, domain), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "dns_config.0.additive_vpc_scope_dns_domain", domain), - ), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, true, true, domain), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "dns_config.0.additive_vpc_scope_dns_domain", domain), - ), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - }, - }) -} - -func TestAccContainerCluster_autopilot_withAdditiveVPCMutation(t *testing.T) { - t.Parallel() - - domain := "additive-mutating.autopilot.example" - clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, false, false, ""), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "dns_config.0.additive_vpc_scope_dns_domain", ""), - ), - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, false, false, domain), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "dns_config.0.additive_vpc_scope_dns_domain", domain), - ), - ConfigPlanChecks: resource.ConfigPlanChecks{PreApply: []plancheck.PlanCheck{plancheck.ExpectResourceAction("google_container_cluster.primary", plancheck.ResourceActionReplace)}}, - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - { - Config: testAccContainerCluster_autopilot_withDNSConfig(clusterName, true, false, false, ""), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("google_container_cluster.primary", "dns_config.0.additive_vpc_scope_dns_domain", ""), - ), - ConfigPlanChecks: resource.ConfigPlanChecks{PreApply: []plancheck.PlanCheck{plancheck.ExpectResourceAction("google_container_cluster.primary", plancheck.ResourceActionReplace)}}, - }, - { - ResourceName: "google_container_cluster.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection"}, - }, - }, - }) -} - func TestAccContainerCluster_autopilot_net_admin(t *testing.T) { t.Parallel() @@ -6817,55 +6509,6 @@ resource "google_container_cluster" "local_ssd_encryption_mode" { `, clusterName, npName, mode, networkName, subnetworkName) } -func testAccContainerCluster_disableMaxRunDuration(clusterName, npName, networkName, subnetworkName string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "max_run_duration" { - name = "%s" - location = "us-central1-a" - release_channel { - channel = "RAPID" - } - - node_pool { - name = "%s" - initial_node_count = 1 - node_config { - machine_type = "n1-standard-2" - } - } - - deletion_protection = false - network = "%s" - subnetwork = "%s" -} -`, clusterName, npName, networkName, subnetworkName) -} - -func testAccContainerCluster_withMaxRunDuration(clusterName, npName, networkName, subnetworkName, duration string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "max_run_duration" { - name = "%s" - location = "us-central1-a" - release_channel { - channel = "RAPID" - } - - node_pool { - name = "%s" - initial_node_count = 1 - node_config { - machine_type = "n1-standard-2" - max_run_duration = "%s" - } - } - - deletion_protection = false - network = "%s" - subnetwork = "%s" -} -`, clusterName, npName, duration, networkName, subnetworkName) -} - func testAccContainerCluster_withILBSubSetting(clusterName, npName, networkName, subnetworkName string) string { return fmt.Sprintf(` resource "google_container_cluster" "confidential_nodes" { @@ -11143,50 +10786,6 @@ resource "google_container_cluster" "primary" { `, name, networkName, subnetworkName) } -{{- if ne $.TargetVersionName "ga" }} -func testAccContainerCluster_withMonitoringConfigScopeAll(name, networkName, subnetworkName string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "primary" { - name = "%s" - location = "us-central1-a" - initial_node_count = 1 - monitoring_config { - managed_prometheus { - enabled = true - auto_monitoring_config { - scope = "ALL" - } - } - } - deletion_protection = false - network = "%s" - subnetwork = "%s" -} -`, name, networkName, subnetworkName) -} - -func testAccContainerCluster_withMonitoringConfigScopeNone(name, networkName, subnetworkName string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "primary" { - name = "%s" - location = "us-central1-a" - initial_node_count = 1 - monitoring_config { - managed_prometheus { - enabled = true - auto_monitoring_config { - scope = "NONE" - } - } - } - deletion_protection = false - network = "%s" - subnetwork = "%s" -} -`, name, networkName, subnetworkName) -} -{{- end }} - func testAccContainerCluster_withMonitoringConfigAdvancedDatapathObservabilityConfigEnabled(name string) string { return fmt.Sprintf(` resource "google_compute_network" "container_network" { @@ -11436,42 +11035,6 @@ resource "google_container_cluster" "primary" { }`, name) } -func testAccContainerCluster_autopilot_withDNSConfig(name string, dnsConfigSectionPresent, clusterDnsPresent, clusterDnsScopePresent bool, additiveVpcDnsDomain string) string { - config := fmt.Sprintf(` -resource "google_container_cluster" "primary" { - name = "%s" - location = "us-central1" - enable_autopilot = true - deletion_protection = false -`, name) - if dnsConfigSectionPresent { - config += ` - dns_config { -` - if clusterDnsPresent { - config += ` - cluster_dns = "CLOUD_DNS" -` - } - if clusterDnsScopePresent { - config += ` - cluster_dns_scope = "CLUSTER_SCOPE" -` - } - if additiveVpcDnsDomain != "" { - config += fmt.Sprintf(` - additive_vpc_scope_dns_domain = "%s" -`, additiveVpcDnsDomain) - } - config += ` - } -` - } - config += ` -}` - return config -} - func testAccContainerCluster_autopilot_net_admin(name, networkName, subnetworkName string, enabled bool) string { return fmt.Sprintf(` resource "google_container_cluster" "primary" { @@ -11647,12 +11210,9 @@ func TestAccContainerCluster_withConfidentialBootDisk(t *testing.T) { networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -11713,12 +11273,9 @@ func TestAccContainerCluster_withConfidentialBootDiskNodeConfig(t *testing.T) { networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -11923,8 +11480,8 @@ resource "google_container_cluster" "primary" { location = "us-central1" enable_autopilot = true - node_pool_defaults { - node_kubelet_config { + node_pool_defaults { + node_config_defaults { } } @@ -11935,51 +11492,42 @@ resource "google_container_cluster" "primary" { `, name, networkName, subnetworkName) } +func testAccContainerCluster_resourceManagerTags(projectID, clusterName, networkName, subnetworkName, randomSuffix string, tagResourceNumber int) string { + return fmt.Sprintf(` +data "google_project" "project" { + project_id = "%[1]s" +} -func testAccContainerCluster_withAutopilot_withNodePoolAutoConfig(name, networkName, subnetworkName string, insecureKubeletReadonlyPortEnabled string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "primary" { - name = "%s" - location = "us-central1" - enable_autopilot = true +resource "google_project_iam_member" "tagHoldAdmin" { + project = "%[1]s" + role = "roles/resourcemanager.tagHoldAdmin" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" +} - node_pool_auto_config { - node_kubelet_config { - insecure_kubelet_readonly_port_enabled = "%s" - } - } +resource "google_project_iam_member" "tagUser1" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" - deletion_protection = false - network = "%s" - subnetwork = "%s" -} -`, name, insecureKubeletReadonlyPortEnabled, networkName, subnetworkName) + depends_on = [google_project_iam_member.tagHoldAdmin] } -func testAccContainerCluster_withStandard_withNodePoolDefaults(name, networkName, subnetworkName string, insecureKubeletReadonlyPortEnabled string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "primary" { - name = "%s" - location = "us-central1-a" - initial_node_count = 1 - - node_pool_defaults { - node_config_defaults { - insecure_kubelet_readonly_port_enabled = "%s" - } - } +resource "google_project_iam_member" "tagUser2" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:${data.google_project.project.number}@cloudservices.gserviceaccount.com" - deletion_protection = false - network = "%s" - subnetwork = "%s" -} -`, name, insecureKubeletReadonlyPortEnabled, networkName, subnetworkName) + depends_on = [google_project_iam_member.tagHoldAdmin] } -func testAccContainerCluster_resourceManagerTags(projectID, clusterName, networkName, subnetworkName, randomSuffix string, tagResourceNumber int) string { - return fmt.Sprintf(` -data "google_project" "project" { - project_id = "%[1]s" +resource "time_sleep" "wait_120_seconds" { + create_duration = "120s" + + depends_on = [ + google_project_iam_member.tagHoldAdmin, + google_project_iam_member.tagUser1, + google_project_iam_member.tagUser2, + ] } resource "google_tags_tag_key" "key1" { @@ -12036,6 +11584,8 @@ resource "google_container_cluster" "primary" { deletion_protection = false network = "%[4]s" subnetwork = "%[5]s" + + depends_on = [time_sleep.wait_120_seconds] } `, projectID, randomSuffix, clusterName, networkName, subnetworkName, tagResourceNumber) } @@ -12046,6 +11596,38 @@ data "google_project" "project" { project_id = "%[1]s" } +resource "google_project_iam_member" "tagHoldAdmin" { + project = "%[1]s" + role = "roles/resourcemanager.tagHoldAdmin" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" +} + +resource "google_project_iam_member" "tagUser1" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "google_project_iam_member" "tagUser2" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:${data.google_project.project.number}@cloudservices.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "time_sleep" "wait_120_seconds" { + create_duration = "120s" + + depends_on = [ + google_project_iam_member.tagHoldAdmin, + google_project_iam_member.tagUser1, + google_project_iam_member.tagUser2, + ] +} + resource "google_tags_tag_key" "key1" { parent = "projects/%[1]s" short_name = "foobarbaz1-%[2]s" @@ -12140,6 +11722,8 @@ resource "google_container_cluster" "with_autopilot" { vertical_pod_autoscaling { enabled = true } + + depends_on = [time_sleep.wait_120_seconds] } `, projectID, randomSuffix, clusterName, networkName, subnetworkName) } @@ -12150,6 +11734,38 @@ data "google_project" "project" { project_id = "%[1]s" } +resource "google_project_iam_member" "tagHoldAdmin" { + project = "%[1]s" + role = "roles/resourcemanager.tagHoldAdmin" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" +} + +resource "google_project_iam_member" "tagUser1" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "google_project_iam_member" "tagUser2" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:${data.google_project.project.number}@cloudservices.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "time_sleep" "wait_120_seconds" { + create_duration = "120s" + + depends_on = [ + google_project_iam_member.tagHoldAdmin, + google_project_iam_member.tagUser1, + google_project_iam_member.tagUser2, + ] +} + resource "google_tags_tag_key" "key1" { parent = "projects/%[1]s" short_name = "foobarbaz1-%[2]s" @@ -12245,6 +11861,8 @@ resource "google_container_cluster" "with_autopilot" { vertical_pod_autoscaling { enabled = true } + + depends_on = [time_sleep.wait_120_seconds] } `, projectID, randomSuffix, clusterName, networkName, subnetworkName) } @@ -12255,6 +11873,38 @@ data "google_project" "project" { project_id = "%[1]s" } +resource "google_project_iam_member" "tagHoldAdmin" { + project = "%[1]s" + role = "roles/resourcemanager.tagHoldAdmin" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" +} + +resource "google_project_iam_member" "tagUser1" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "google_project_iam_member" "tagUser2" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:${data.google_project.project.number}@cloudservices.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "time_sleep" "wait_120_seconds" { + create_duration = "120s" + + depends_on = [ + google_project_iam_member.tagHoldAdmin, + google_project_iam_member.tagUser1, + google_project_iam_member.tagUser2, + ] +} + resource "google_tags_tag_key" "key1" { parent = "projects/%[1]s" short_name = "foobarbaz1-%[2]s" @@ -12343,6 +11993,8 @@ resource "google_container_cluster" "with_autopilot" { vertical_pod_autoscaling { enabled = true } + + depends_on = [time_sleep.wait_120_seconds] } `, projectID, randomSuffix, clusterName, networkName, subnetworkName) } @@ -13228,4 +12880,5 @@ resource "google_container_cluster" "with_enterprise_config" { deletion_protection = false } `, projectID, clusterName, networkName, subnetworkName) -} +} + diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.tmpl index ccda8717798e..dd2cd3a64db1 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.tmpl @@ -568,11 +568,6 @@ func resourceContainerNodePoolCreate(d *schema.ResourceData, meta interface{}) e return err } - // Acquire read-lock on cluster. - clusterLockKey := nodePoolInfo.clusterLockKey() - transport_tpg.MutexStore.RLock(clusterLockKey) - defer transport_tpg.MutexStore.RUnlock(clusterLockKey) - // Acquire write-lock on nodepool. npLockKey := nodePoolInfo.nodePoolLockKey(nodePool.Name) transport_tpg.MutexStore.Lock(npLockKey) @@ -585,6 +580,9 @@ func resourceContainerNodePoolCreate(d *schema.ResourceData, meta interface{}) e timeout := d.Timeout(schema.TimeoutCreate) startTime := time.Now() + clusterLockKey := nodePoolInfo.clusterLockKey() + transport_tpg.MutexStore.RLock(clusterLockKey) + // we attempt to prefetch the node pool to make sure it doesn't exist before creation var id = fmt.Sprintf("projects/%s/locations/%s/clusters/%s/nodePools/%s", nodePoolInfo.project, nodePoolInfo.location, nodePoolInfo.cluster, nodePool.Name) name := getNodePoolName(id) @@ -599,11 +597,16 @@ func resourceContainerNodePoolCreate(d *schema.ResourceData, meta interface{}) e // refreshed on the next call to apply. d.SetId(id) } else if err == nil { + transport_tpg.MutexStore.RUnlock(clusterLockKey) return fmt.Errorf("resource - %s - already exists", id) } + transport_tpg.MutexStore.RUnlock(clusterLockKey) var operation *container.Operation err = retry.Retry(timeout, func() *retry.RetryError { + transport_tpg.MutexStore.Lock(clusterLockKey) + defer transport_tpg.MutexStore.Unlock(clusterLockKey) + clusterNodePoolsCreateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Create(nodePoolInfo.parent(), req) if config.UserProjectOverride { clusterNodePoolsCreateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) @@ -622,6 +625,8 @@ func resourceContainerNodePoolCreate(d *schema.ResourceData, meta interface{}) e } return nil }) + transport_tpg.MutexStore.RLock(clusterLockKey) + defer transport_tpg.MutexStore.RUnlock(clusterLockKey) if err != nil { return fmt.Errorf("error creating NodePool: %s", err) } @@ -796,10 +801,7 @@ func resourceContainerNodePoolDelete(d *schema.ResourceData, meta interface{}) e } } - // Acquire read-lock on cluster. clusterLockKey := nodePoolInfo.clusterLockKey() - transport_tpg.MutexStore.RLock(clusterLockKey) - defer transport_tpg.MutexStore.RUnlock(clusterLockKey) // Acquire write-lock on nodepool. npLockKey := nodePoolInfo.nodePoolLockKey(name) @@ -811,6 +813,8 @@ func resourceContainerNodePoolDelete(d *schema.ResourceData, meta interface{}) e var operation *container.Operation err = retry.Retry(timeout, func() *retry.RetryError { + transport_tpg.MutexStore.Lock(clusterLockKey) + defer transport_tpg.MutexStore.Unlock(clusterLockKey) clusterNodePoolsDeleteCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Delete(nodePoolInfo.fullyQualifiedName(name)) if config.UserProjectOverride { clusterNodePoolsDeleteCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) @@ -830,6 +834,8 @@ func resourceContainerNodePoolDelete(d *schema.ResourceData, meta interface{}) e return nil }) + transport_tpg.MutexStore.RLock(clusterLockKey) + defer transport_tpg.MutexStore.RUnlock(clusterLockKey) if err != nil { return fmt.Errorf("Error deleting NodePool: %s", err) @@ -1346,22 +1352,20 @@ func expandNodeNetworkConfig(v interface{}) *container.NodeNetworkConfig { return nnc } - func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *NodePoolInformation, prefix string, timeout time.Duration) error { config := meta.(*transport_tpg.Config) name := d.Get(prefix + "name").(string) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) if err != nil { return err } - // Acquire read-lock on cluster. + // Cluster write-lock will be acquired when createOpF is called, and read-lock will be acquired when waitOpF is + // called. clusterLockKey := nodePoolInfo.clusterLockKey() - transport_tpg.MutexStore.RLock(clusterLockKey) - defer transport_tpg.MutexStore.RUnlock(clusterLockKey) - // Nodepool write-lock will be acquired when update function is called. + // Nodepool write-lock will be acquired when calling createOpF and waitOpF. npLockKey := nodePoolInfo.nodePoolLockKey(name) if d.HasChange(prefix + "autoscaling") { @@ -1389,25 +1393,23 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node Update: update, } - updateF := func() error { + createOpF := func() (*container.Operation, error) { clusterUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.Update(nodePoolInfo.parent(), req) if config.UserProjectOverride { clusterUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterUpdateCall.Do() - if err != nil { - return err - } + return clusterUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, "updating GKE node pool", userAgent, timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated autoscaling in Node Pool %s", d.Id()) } @@ -1421,25 +1423,22 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node req := &container.SetNodePoolSizeRequest{ NodeCount: newSize, } - updateF := func() error { - clusterNodePoolsSetSizeCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.SetSize(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsSetSizeCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.SetSize(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsSetSizeCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsSetSizeCall.Do() - - if err != nil { - return err - } + return clusterNodePoolsSetSizeCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, "updating GKE node pool size", userAgent, timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] GKE node pool %s size has been updated to %d", name, newSize) } @@ -1456,25 +1455,22 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node Management: management, } - updateF := func() error { - clusterNodePoolsSetManagementCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.SetManagement(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsSetManagementCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.SetManagement(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsSetManagementCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsSetManagementCall.Do() - - if err != nil { - return err - } + return clusterNodePoolsSetManagementCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, "updating GKE node pool management", userAgent, timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated management in Node Pool %s", name) } @@ -1484,24 +1480,21 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node NodePoolId: name, NodeVersion: d.Get(prefix + "version").(string), } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, "updating GKE node pool version", userAgent, timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated version in Node Pool %s", name) } @@ -1510,23 +1503,20 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node req := &container.UpdateNodePoolRequest{ Locations: tpgresource.ConvertStringSet(d.Get(prefix + "node_locations").(*schema.Set)), } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, "updating GKE node pool node locations", userAgent, timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated node locations in Node Pool %s", name) } @@ -1574,7 +1564,7 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node if v, ok := blueGreenSettingsConfig["standard_rollout_policy"]; ok && len(v.([]interface{})) > 0 { standardRolloutPolicy := &container.StandardRolloutPolicy{} - if standardRolloutPolicyConfig, ok := v.([]interface{})[0].(map[string]interface{}); ok { + if standardRolloutPolicyConfig, ok := v.([]interface{})[0].(map[string]interface{}); ok { standardRolloutPolicy.BatchSoakDuration = standardRolloutPolicyConfig["batch_soak_duration"].(string) if v, ok := standardRolloutPolicyConfig["batch_node_count"]; ok { standardRolloutPolicy.BatchNodeCount = int64(v.(int)) @@ -1591,44 +1581,38 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node req := &container.UpdateNodePoolRequest{ UpgradeSettings: upgradeSettings, } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, "updating GKE node pool upgrade settings", userAgent, timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated upgrade settings in Node Pool %s", name) } if d.HasChange(prefix + "network_config") { - if d.HasChange(prefix + "network_config.0.enable_private_nodes") || d.HasChange(prefix + "network_config.0.network_performance_config") { + if d.HasChange(prefix+"network_config.0.enable_private_nodes") || d.HasChange(prefix+"network_config.0.network_performance_config") { req := &container.UpdateNodePoolRequest{ - NodePoolId: name, + NodePoolId: name, NodeNetworkConfig: expandNodeNetworkConfig(d.Get(prefix + "network_config")), } - updateF := func() error { - clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name),req) + createOpF := func() (*container.Operation, error) { + clusterNodePoolsUpdateCall := config.NewContainerClient(userAgent).Projects.Locations.Clusters.NodePools.Update(nodePoolInfo.fullyQualifiedName(name), req) if config.UserProjectOverride { clusterNodePoolsUpdateCall.Header().Add("X-Goog-User-Project", nodePoolInfo.project) } - op, err := clusterNodePoolsUpdateCall.Do() - - if err != nil { - return err - } + return clusterNodePoolsUpdateCall.Do() + } - // Wait until it's updated + waitOpF := func(op *container.Operation) error { return ContainerOperationWait(config, op, nodePoolInfo.project, nodePoolInfo.location, @@ -1636,8 +1620,8 @@ func nodePoolUpdate(d *schema.ResourceData, meta interface{}, nodePoolInfo *Node timeout) } - if err := retryWhileIncompatibleOperation(timeout, npLockKey, updateF); err != nil { - return err + if err := retryWhileIncompatibleOperation(timeout, npLockKey, clusterLockKey, createOpF, waitOpF); err != nil { + return err } log.Printf("[INFO] Updated network_config for node pool %s", name) @@ -1688,15 +1672,27 @@ func containerNodePoolAwaitRestingState(config *transport_tpg.Config, name, proj return state, err } -// Retries an operation while the canonical error code is FAILED_PRECONDTION -// or RESOURCE_EXHAUSTED which indicates there is an incompatible operation -// already running on the cluster or there are the number of allowed -// concurrent operations running on the cluster. These errors can be safely -// retried until the incompatible operation completes, and the newly -// requested operation can begin. -func retryWhileIncompatibleOperation(timeout time.Duration, lockKey string, f func() error) error { +// Retries an operation while the canonical error code is FAILED_PRECONDTION or RESOURCE_EXHAUSTED which indicates +// there is an incompatible operation already running on the cluster or there are the number of allowed concurrent +// operations running on the cluster. These errors can be safely retried until the incompatible operation completes, +// and the newly requested operation can begin. +// The npLockKey is held throughout createOpFunc and waitOpFunc. +// The clusterLockKey write-lock is held during createOpFunc to make operation creations sequential within the cluster, +// and clusterLockKey read-lock is held during waitOpFunc to allow concurrency on a cluster. +func retryWhileIncompatibleOperation(timeout time.Duration, npLockKey string, clusterLockKey string, createOpFunc func() (*container.Operation, error), waitOpFunc func(*container.Operation) error) error { + f := func() error { + transport_tpg.MutexStore.Lock(clusterLockKey) + op, err := createOpFunc() + transport_tpg.MutexStore.Unlock(clusterLockKey) + if err != nil { + return err + } + transport_tpg.MutexStore.RLock(clusterLockKey) + defer transport_tpg.MutexStore.RUnlock(clusterLockKey) + return waitOpFunc(op) + } return retry.Retry(timeout, func() *retry.RetryError { - if err := transport_tpg.LockedCall(lockKey, f); err != nil { + if err := transport_tpg.LockedCall(npLockKey, f); err != nil { if tpgresource.IsFailedPreconditionError(err) || tpgresource.IsQuotaError(err) { return retry.RetryableError(err) } diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_meta.yaml.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool_meta.yaml.tmpl index 8af5437f2ea7..75848a869743 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_meta.yaml.tmpl @@ -7,118 +7,3 @@ api_version: 'v1beta1' api_version: 'v1' {{- end }} api_resource_type_kind: 'NodePool' -fields: - - field: 'autoscaling.location_policy' - - field: 'autoscaling.max_node_count' - - field: 'autoscaling.min_node_count' - - field: 'autoscaling.total_max_node_count' - - field: 'autoscaling.total_min_node_count' - - field: 'cluster' - - field: 'initial_node_count' - - field: 'instance_group_urls' - - field: 'location' - - field: 'managed_instance_group_urls' - - field: 'management.auto_repair' - - field: 'management.auto_upgrade' - - field: 'max_pods_per_node' - - field: 'name' - - field: 'name_prefix' - - field: 'network_config.additional_node_network_configs.network' - - field: 'network_config.additional_node_network_configs.subnetwork' - - field: 'network_config.additional_pod_network_configs.max_pods_per_node' - - field: 'network_config.additional_pod_network_configs.secondary_pod_range' - - field: 'network_config.additional_pod_network_configs.subnetwork' - - field: 'network_config.create_pod_range' - - field: 'network_config.enable_private_nodes' - - field: 'network_config.network_performance_config.total_egress_bandwidth_tier' - - field: 'network_config.pod_cidr_overprovision_config.disabled' - - field: 'network_config.pod_ipv4_cidr_block' - - field: 'network_config.pod_range' - - field: 'node_config.advanced_machine_features.enable_nested_virtualization' - - field: 'node_config.advanced_machine_features.threads_per_core' - - field: 'node_config.boot_disk_kms_key' - - field: 'node_config.confidential_nodes.enabled' - - field: 'node_config.containerd_config.private_registry_access_config.certificate_authority_domain_config.fqdns' - - field: 'node_config.containerd_config.private_registry_access_config.certificate_authority_domain_config.gcp_secret_manager_certificate_config.secret_uri' - - field: 'node_config.containerd_config.private_registry_access_config.enabled' - - field: 'node_config.disk_size_gb' - - field: 'node_config.disk_type' - - field: 'node_config.effective_taints.effect' - - field: 'node_config.effective_taints.key' - - field: 'node_config.effective_taints.value' - - field: 'node_config.enable_confidential_storage' -{{- if ne $.TargetVersionName "ga" }} - - field: 'node_config.ephemeral_storage_config.local_ssd_count' -{{- end }} - - field: 'node_config.ephemeral_storage_local_ssd_config.local_ssd_count' - - field: 'node_config.fast_socket.enabled' - - field: 'node_config.gcfs_config.enabled' - - field: 'node_config.guest_accelerator.count' - - field: 'node_config.guest_accelerator.gpu_driver_installation_config.gpu_driver_version' - - field: 'node_config.guest_accelerator.gpu_partition_size' - - field: 'node_config.guest_accelerator.gpu_sharing_config.gpu_sharing_strategy' - - field: 'node_config.guest_accelerator.gpu_sharing_config.max_shared_clients_per_gpu' - - field: 'node_config.guest_accelerator.type' - - field: 'node_config.gvnic.enabled' - - field: 'node_config.host_maintenance_policy.maintenance_interval' - - field: 'node_config.image_type' - - field: 'node_config.kubelet_config.cpu_cfs_quota' - - field: 'node_config.kubelet_config.cpu_cfs_quota_period' - - field: 'node_config.kubelet_config.cpu_manager_policy' - - field: 'node_config.kubelet_config.insecure_kubelet_readonly_port_enabled' - - field: 'node_config.kubelet_config.pod_pids_limit' - - field: 'node_config.labels' - - field: 'node_config.linux_node_config.cgroup_mode' - - field: 'node_config.linux_node_config.hugepages_config.hugepage_size_1g' - - field: 'node_config.linux_node_config.hugepages_config.hugepage_size_2m' - - field: 'node_config.linux_node_config.sysctls' - - field: 'node_config.local_nvme_ssd_block_config.local_ssd_count' - - field: 'node_config.local_ssd_count' - - field: 'node_config.local_ssd_encryption_mode' - - field: 'node_config.logging_variant' - - field: 'node_config.machine_type' - - field: 'node_config.max_run_duration' - - field: 'node_config.metadata' - - field: 'node_config.min_cpu_platform' - - field: 'node_config.node_group' - - field: 'node_config.oauth_scopes' - - field: 'node_config.preemptible' - - field: 'node_config.reservation_affinity.consume_reservation_type' - - field: 'node_config.reservation_affinity.key' - - field: 'node_config.reservation_affinity.values' - - field: 'node_config.resource_labels' - - field: 'node_config.resource_manager_tags' -{{- if ne $.TargetVersionName "ga" }} - - field: 'node_config.sandbox_config.sandbox_type' -{{- end }} - - field: 'node_config.secondary_boot_disks.disk_image' - - field: 'node_config.secondary_boot_disks.mode' - - field: 'node_config.service_account' - - field: 'node_config.shielded_instance_config.enable_integrity_monitoring' - - field: 'node_config.shielded_instance_config.enable_secure_boot' - - field: 'node_config.sole_tenant_config.node_affinity.key' - - field: 'node_config.sole_tenant_config.node_affinity.operator' - - field: 'node_config.sole_tenant_config.node_affinity.values' - - field: 'node_config.spot' - - field: 'node_config.storage_pools' - - field: 'node_config.tags' - - field: 'node_config.taint.effect' - - field: 'node_config.taint.key' - - field: 'node_config.taint.value' - - field: 'node_config.workload_metadata_config.mode' - - field: 'node_count' - - field: 'node_locations' - - field: 'operation' - - field: 'placement_policy.policy_name' - - field: 'placement_policy.tpu_topology' - - field: 'placement_policy.type' - - field: 'project' - - field: 'queued_provisioning.enabled' - - field: 'upgrade_settings.blue_green_settings.node_pool_soak_duration' - - field: 'upgrade_settings.blue_green_settings.standard_rollout_policy.batch_node_count' - - field: 'upgrade_settings.blue_green_settings.standard_rollout_policy.batch_percentage' - - field: 'upgrade_settings.blue_green_settings.standard_rollout_policy.batch_soak_duration' - - field: 'upgrade_settings.max_surge' - - field: 'upgrade_settings.max_unavailable' - - field: 'upgrade_settings.strategy' - - field: 'version' diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl index 73f6e354a341..fe36360a2a68 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl @@ -47,8 +47,6 @@ func TestAccContainerNodePool_resourceManagerTags(t *testing.T) { networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - bootstrapGkeTagManagerServiceAgents(t) - acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), @@ -529,7 +527,7 @@ func TestAccContainerNodePool_withKubeletConfig(t *testing.T) { CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccContainerNodePool_withKubeletConfig(cluster, np, "static", "100ms", networkName, subnetworkName, "TRUE", "100Mi", "1m", "10m", true, 2048, 10, 10, 85), + Config: testAccContainerNodePool_withKubeletConfig(cluster, np, "static", "100ms", networkName, subnetworkName, "TRUE", true, 2048), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ acctest.ExpectNoDelete(), @@ -542,20 +540,6 @@ func TestAccContainerNodePool_withKubeletConfig(t *testing.T) { "node_config.0.kubelet_config.0.insecure_kubelet_readonly_port_enabled", "TRUE"), resource.TestCheckResourceAttr("google_container_node_pool.with_kubelet_config", "node_config.0.kubelet_config.0.pod_pids_limit", "2048"), - resource.TestCheckResourceAttr("google_container_node_pool.with_kubelet_config", - "node_config.0.kubelet_config.0.container_log_max_size", "100Mi"), - resource.TestCheckResourceAttr("google_container_node_pool.with_kubelet_config", - "node_config.0.kubelet_config.0.container_log_max_files", "10"), - resource.TestCheckResourceAttr("google_container_node_pool.with_kubelet_config", - "node_config.0.kubelet_config.0.image_gc_low_threshold_percent", "10"), - resource.TestCheckResourceAttr("google_container_node_pool.with_kubelet_config", - "node_config.0.kubelet_config.0.image_gc_high_threshold_percent", "85"), - resource.TestCheckResourceAttr("google_container_node_pool.with_kubelet_config", - "node_config.0.kubelet_config.0.image_minimum_gc_age", "1m"), - resource.TestCheckResourceAttr("google_container_node_pool.with_kubelet_config", - "node_config.0.kubelet_config.0.image_maximum_gc_age", "10m"), - // resource.TestCheckResourceAttr("google_container_node_pool.with_kubelet_config", - // "node_config.0.kubelet_config.0.allowed_unsafe_sysctls.0", "kernel.shm*"), ), }, { @@ -564,7 +548,7 @@ func TestAccContainerNodePool_withKubeletConfig(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccContainerNodePool_withKubeletConfig(cluster, np, "", "", networkName, subnetworkName, "FALSE", "200Mi", "30s", "", false, 1024, 5, 50, 80), + Config: testAccContainerNodePool_withKubeletConfig(cluster, np, "", "", networkName, subnetworkName, "FALSE", false, 1024), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ acctest.ExpectNoDelete(), @@ -602,7 +586,7 @@ func TestAccContainerNodePool_withInvalidKubeletCpuManagerPolicy(t *testing.T) { CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccContainerNodePool_withKubeletConfig(cluster, np, "dontexist", "100us", networkName, subnetworkName,"TRUE", "", "", "", false, 1024, 2, 70, 75), + Config: testAccContainerNodePool_withKubeletConfig(cluster, np, "dontexist", "100us", networkName, subnetworkName,"TRUE", false, 1024), ExpectError: regexp.MustCompile(`.*to be one of \["?static"? "?none"? "?"?\].*`), }, }, @@ -895,12 +879,9 @@ func TestAccContainerNodePool_withBootDiskKmsKey(t *testing.T) { networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -3181,8 +3162,7 @@ resource "google_container_node_pool" "with_sandbox_config" { } {{- end }} -// TODO: add allowed_unsafe_sysctls in the test after GKE version 1.32.0-gke.1448000 is default version in regular channel and used in Terraform test. -func testAccContainerNodePool_withKubeletConfig(cluster, np, policy, period, networkName, subnetworkName, insecureKubeletReadonlyPortEnabled, containerLogMaxSize, imageMinimumGcAge, imageMaximumGcAge string, quota bool, podPidsLimit, containerLogMaxFiles, imageGcLowThresholdPercent, imageGcHighThresholdPercent int) string { +func testAccContainerNodePool_withKubeletConfig(cluster, np, policy, period, networkName, subnetworkName, insecureKubeletReadonlyPortEnabled string, quota bool, podPidsLimit int) string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { location = "us-central1-a" @@ -3213,13 +3193,6 @@ resource "google_container_node_pool" "with_kubelet_config" { cpu_cfs_quota_period = %q insecure_kubelet_readonly_port_enabled = "%s" pod_pids_limit = %d - container_log_max_size = %q - container_log_max_files = %d - image_gc_low_threshold_percent = %d - image_gc_high_threshold_percent = %d - image_minimum_gc_age = %q - image_maximum_gc_age = %q - # allowed_unsafe_sysctls = ["kernel.shm*", "kernel.msg*", "kernel.sem", "fs.mqueue.*", "net.*"] } oauth_scopes = [ "https://www.googleapis.com/auth/logging.write", @@ -3228,7 +3201,7 @@ resource "google_container_node_pool" "with_kubelet_config" { logging_variant = "DEFAULT" } } -`, cluster, networkName, subnetworkName, np, policy, quota, period, insecureKubeletReadonlyPortEnabled, podPidsLimit, containerLogMaxSize, containerLogMaxFiles, imageGcLowThresholdPercent, imageGcHighThresholdPercent, imageMinimumGcAge, imageMaximumGcAge) +`, cluster, networkName, subnetworkName, np, policy, quota, period, insecureKubeletReadonlyPortEnabled, podPidsLimit) } func testAccContainerNodePool_withLinuxNodeConfig(cluster, np, tcpMem, networkName, subnetworkName string) string { @@ -3250,7 +3223,6 @@ func testAccContainerNodePool_withLinuxNodeConfig(cluster, np, tcpMem, networkNa "net.ipv4.tcp_rmem" = "%s" "net.ipv4.tcp_wmem" = "%s" "net.ipv4.tcp_tw_reuse" = 1 - "kernel.shmmni" = 8192 } } `, tcpMem, tcpMem) @@ -3981,7 +3953,6 @@ resource "google_container_cluster" "cluster" { deletion_protection = false network = "%s" subnetwork = "%s" - min_master_version = "1.32.0-gke.1448000" } resource "google_container_node_pool" "np1" { @@ -3989,8 +3960,6 @@ resource "google_container_node_pool" "np1" { location = "us-central1-a" cluster = google_container_cluster.cluster.name initial_node_count = 2 - // 2025-02-03: current default cluster version is 1.31.5-gke.1023000. This will change over time. - // Reference: https://cloud.google.com/kubernetes-engine/docs/release-notes#current_versions } resource "google_container_node_pool" "np2" { @@ -3998,8 +3967,6 @@ resource "google_container_node_pool" "np2" { location = "us-central1-a" cluster = google_container_cluster.cluster.name initial_node_count = 2 - // 2025-02-03: current default cluster version is 1.31.5-gke.1023000. This will change over time. - // Reference: https://cloud.google.com/kubernetes-engine/docs/release-notes#current_versions } `, cluster, networkName, subnetworkName, np1, np2) } @@ -4007,13 +3974,12 @@ resource "google_container_node_pool" "np2" { func testAccContainerNodePool_concurrentUpdate(cluster, np1, np2, networkName, subnetworkName string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - location = "us-central1-a" - initial_node_count = 3 + name = "%s" + location = "us-central1-a" + initial_node_count = 3 deletion_protection = false - network = "%s" - subnetwork = "%s" - min_master_version = "1.32.0-gke.1448000" + network = "%s" + subnetwork = "%s" } resource "google_container_node_pool" "np1" { @@ -4021,11 +3987,7 @@ resource "google_container_node_pool" "np1" { location = "us-central1-a" cluster = google_container_cluster.cluster.name initial_node_count = 2 - version = "1.32.0-gke.1448000" - // The node version must remain within one minor version of the cluster ("master") version, and it must not exceed the cluster ("master") version - // Cross-ref: https://github.com/hashicorp/terraform-provider-google/issues/21116 - // Cross-ref: https://github.com/GoogleCloudPlatform/magic-modules/pull/11115 - // Reference: https://cloud.google.com/kubernetes-engine/docs/release-notes#current_versions + version = "1.29.4-gke.1043002" } resource "google_container_node_pool" "np2" { @@ -4033,11 +3995,7 @@ resource "google_container_node_pool" "np2" { location = "us-central1-a" cluster = google_container_cluster.cluster.name initial_node_count = 2 - version = "1.32.0-gke.1448000" - // The node version must remain within one minor version of the cluster ("master") version, and it must not exceed the cluster ("master") version - // Cross-ref: https://github.com/hashicorp/terraform-provider-google/issues/21116 - // Cross-ref: https://github.com/GoogleCloudPlatform/magic-modules/pull/11115 - // Reference: https://cloud.google.com/kubernetes-engine/docs/release-notes#current_versions + version = "1.29.4-gke.1043002" } `, cluster, networkName, subnetworkName, np1, np2) } @@ -4258,101 +4216,6 @@ resource "google_container_node_pool" "np" { `, clusterName, mode, networkName, subnetworkName, np, mode) } -func TestAccContainerNodePool_withMaxRunDuration(t *testing.T) { - t.Parallel() - - clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) - np := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) - networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") - subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccContainerNodePool_withMaxRunDuration(clusterName, np, networkName, subnetworkName, "3600s"), - }, - { - ResourceName: "google_container_node_pool.np", - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccContainerNodePool_withMaxRunDuration(clusterName, np, networkName, subnetworkName, "1800s"), - }, - { - ResourceName: "google_container_node_pool.np", - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccContainerNodePool_disableMaxRunDuration(clusterName, np, networkName, subnetworkName), - }, - { - ResourceName: "google_container_node_pool.np", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccContainerNodePool_withMaxRunDuration(clusterName, np, networkName, subnetworkName, duration string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "cluster" { - name = "%s" - location = "us-central1-a" - initial_node_count = 1 - node_config { - max_run_duration = "%s" - machine_type = "n1-standard-1" - } - deletion_protection = false - network = "%s" - subnetwork = "%s" -} - -resource "google_container_node_pool" "np" { - name = "%s" - location = "us-central1-a" - cluster = google_container_cluster.cluster.name - initial_node_count = 1 - node_config { - machine_type = "n1-standard-1" - max_run_duration = "%s" - } -} -`, clusterName, duration, networkName, subnetworkName, np, duration) -} - -func testAccContainerNodePool_disableMaxRunDuration(clusterName, np, networkName, subnetworkName string) string { - return fmt.Sprintf(` -resource "google_container_cluster" "cluster" { - name = "%s" - location = "us-central1-a" - initial_node_count = 1 - node_config { - machine_type = "n1-standard-1" - } - deletion_protection = false - network = "%s" - subnetwork = "%s" -} - -resource "google_container_node_pool" "np" { - name = "%s" - location = "us-central1-a" - cluster = google_container_cluster.cluster.name - initial_node_count = 1 - node_config { - machine_type = "n1-standard-1" - } -} -`, clusterName, networkName, subnetworkName, np) -} - func TestAccContainerNodePool_tpuTopology(t *testing.T) { t.Parallel() t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/15254#issuecomment-1646277473") @@ -4490,12 +4353,9 @@ func TestAccContainerNodePool_withConfidentialBootDisk(t *testing.T) { networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -4619,6 +4479,38 @@ data "google_project" "project" { project_id = "%[1]s" } +resource "google_project_iam_member" "tagHoldAdmin" { + project = "%[1]s" + role = "roles/resourcemanager.tagHoldAdmin" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" +} + +resource "google_project_iam_member" "tagUser1" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "google_project_iam_member" "tagUser2" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:${data.google_project.project.number}@cloudservices.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "time_sleep" "wait_120_seconds" { + create_duration = "120s" + + depends_on = [ + google_project_iam_member.tagHoldAdmin, + google_project_iam_member.tagUser1, + google_project_iam_member.tagUser2, + ] +} + resource "google_tags_tag_key" "key1" { parent = "projects/%[1]s" short_name = "foobarbaz1-%[2]s" @@ -4676,6 +4568,8 @@ resource "google_container_cluster" "primary" { create = "30m" update = "40m" } + + depends_on = [time_sleep.wait_120_seconds] } # Separately Managed Node Pool @@ -4705,6 +4599,38 @@ data "google_project" "project" { project_id = "%[1]s" } +resource "google_project_iam_member" "tagHoldAdmin" { + project = "%[1]s" + role = "roles/resourcemanager.tagHoldAdmin" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" +} + +resource "google_project_iam_member" "tagUser1" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "google_project_iam_member" "tagUser2" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:${data.google_project.project.number}@cloudservices.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "time_sleep" "wait_120_seconds" { + create_duration = "120s" + + depends_on = [ + google_project_iam_member.tagHoldAdmin, + google_project_iam_member.tagUser1, + google_project_iam_member.tagUser2, + ] +} + resource "google_tags_tag_key" "key1" { parent = "projects/%[1]s" short_name = "foobarbaz1-%[2]s" @@ -4762,6 +4688,8 @@ resource "google_container_cluster" "primary" { create = "30m" update = "40m" } + + depends_on = [time_sleep.wait_120_seconds] } # Separately Managed Node Pool @@ -4792,6 +4720,38 @@ data "google_project" "project" { project_id = "%[1]s" } +resource "google_project_iam_member" "tagHoldAdmin" { + project = "%[1]s" + role = "roles/resourcemanager.tagHoldAdmin" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" +} + +resource "google_project_iam_member" "tagUser1" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:service-${data.google_project.project.number}@container-engine-robot.iam.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "google_project_iam_member" "tagUser2" { + project = "%[1]s" + role = "roles/resourcemanager.tagUser" + member = "serviceAccount:${data.google_project.project.number}@cloudservices.gserviceaccount.com" + + depends_on = [google_project_iam_member.tagHoldAdmin] +} + +resource "time_sleep" "wait_120_seconds" { + create_duration = "120s" + + depends_on = [ + google_project_iam_member.tagHoldAdmin, + google_project_iam_member.tagUser1, + google_project_iam_member.tagUser2, + ] +} + resource "google_tags_tag_key" "key1" { parent = "projects/%[1]s" short_name = "foobarbaz1-%[2]s" @@ -4849,6 +4809,8 @@ resource "google_container_cluster" "primary" { create = "30m" update = "40m" } + + depends_on = [time_sleep.wait_120_seconds] } # Separately Managed Node Pool @@ -5065,6 +5027,7 @@ resource "google_container_node_pool" "np" { } func TestAccContainerNodePool_defaultDriverInstallation(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() cluster := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) @@ -5110,6 +5073,7 @@ resource "google_container_node_pool" "np" { location = "us-central1-a" cluster = google_container_cluster.cluster.name initial_node_count = 2 + version = "1.30.1-gke.1329003" node_config { service_account = "default" diff --git a/mmv1/third_party/terraform/services/containeranalysis/resource_container_registry_meta.yaml b/mmv1/third_party/terraform/services/containeranalysis/resource_container_registry_meta.yaml deleted file mode 100644 index 4a8f7c95de69..000000000000 --- a/mmv1/third_party/terraform/services/containeranalysis/resource_container_registry_meta.yaml +++ /dev/null @@ -1,2 +0,0 @@ -resource: 'google_container_registry' -generation_type: 'handwritten' diff --git a/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml new file mode 100644 index 000000000000..136d7b70c07e --- /dev/null +++ b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_aws_cluster' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AwsCluster' diff --git a/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml.tmpl b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml.tmpl deleted file mode 100644 index c1a86b363f0b..000000000000 --- a/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml.tmpl +++ /dev/null @@ -1,62 +0,0 @@ -resource: 'google_container_aws_cluster' -generation_type: 'dcl' -api_service_name: 'gkemulticloud.googleapis.com' -api_version: 'v1' -api_resource_type_kind: 'AwsCluster' -fields: - - field: 'annotations' - - field: 'authorization.admin_groups.group' - - field: 'authorization.admin_users.username' - - field: 'aws_region' - - field: 'binary_authorization.evaluation_mode' - - field: 'control_plane.aws_services_authentication.role_arn' - - field: 'control_plane.aws_services_authentication.role_session_name' - - field: 'control_plane.config_encryption.kms_key_arn' - - field: 'control_plane.database_encryption.kms_key_arn' - - field: 'control_plane.iam_instance_profile' -{{- if ne $.TargetVersionName "ga" }} - - field: 'control_plane.instance_placement.tenancy' -{{- end }} - - field: 'control_plane.instance_type' - - field: 'control_plane.main_volume.iops' - - field: 'control_plane.main_volume.kms_key_arn' - - field: 'control_plane.main_volume.size_gib' - - field: 'control_plane.main_volume.throughput' - - field: 'control_plane.main_volume.volume_type' - - field: 'control_plane.proxy_config.secret_arn' - - field: 'control_plane.proxy_config.secret_version' - - field: 'control_plane.root_volume.iops' - - field: 'control_plane.root_volume.kms_key_arn' - - field: 'control_plane.root_volume.size_gib' - - field: 'control_plane.root_volume.throughput' - - field: 'control_plane.root_volume.volume_type' - - field: 'control_plane.security_group_ids' - - field: 'control_plane.ssh_config.ec2_key_pair' - - field: 'control_plane.subnet_ids' - - field: 'control_plane.tags' - - field: 'control_plane.version' - - field: 'create_time' - - field: 'description' - - field: 'effective_annotations' - provider_only: true - - field: 'endpoint' - - field: 'etag' - - field: 'fleet.membership' - - field: 'fleet.project' - - field: 'location' -{{- if ne $.TargetVersionName "ga" }} - - field: 'logging_config.component_config.enable_components' -{{- end }} - - field: 'name' - - field: 'networking.per_node_pool_sg_rules_disabled' - - field: 'networking.pod_address_cidr_blocks' - - field: 'networking.service_address_cidr_blocks' - - field: 'networking.vpc_id' - - field: 'project' - - field: 'reconciling' - - field: 'state' - - field: 'uid' - - field: 'update_time' - - field: 'workload_identity_config.identity_provider' - - field: 'workload_identity_config.issuer_uri' - - field: 'workload_identity_config.workload_pool' diff --git a/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml new file mode 100644 index 000000000000..d56ecfa56e4b --- /dev/null +++ b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_aws_node_pool' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AwsNodePool' diff --git a/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml.tmpl b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml.tmpl deleted file mode 100644 index 8894c3e2ccec..000000000000 --- a/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml.tmpl +++ /dev/null @@ -1,59 +0,0 @@ -resource: 'google_container_aws_node_pool' -generation_type: 'dcl' -api_service_name: 'gkemulticloud.googleapis.com' -api_version: 'v1' -api_resource_type_kind: 'AwsNodePool' -fields: - - field: 'annotations' - - field: 'autoscaling.max_node_count' - - field: 'autoscaling.min_node_count' - - field: 'cluster' - - field: 'config.autoscaling_metrics_collection.granularity' - - field: 'config.autoscaling_metrics_collection.metrics' - - field: 'config.config_encryption.kms_key_arn' - - field: 'config.iam_instance_profile' -{{- if ne $.TargetVersionName "ga" }} - - field: 'config.image_type' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'config.instance_placement.tenancy' -{{- end }} - - field: 'config.instance_type' - - field: 'config.labels' - - field: 'config.proxy_config.secret_arn' - - field: 'config.proxy_config.secret_version' - - field: 'config.root_volume.iops' - - field: 'config.root_volume.kms_key_arn' - - field: 'config.root_volume.size_gib' - - field: 'config.root_volume.throughput' - - field: 'config.root_volume.volume_type' - - field: 'config.security_group_ids' -{{- if ne $.TargetVersionName "ga" }} - - field: 'config.spot_config.instance_types' -{{- end }} - - field: 'config.ssh_config.ec2_key_pair' - - field: 'config.tags' - - field: 'config.taints.effect' - - field: 'config.taints.key' - - field: 'config.taints.value' - - field: 'create_time' - - field: 'effective_annotations' - provider_only: true - - field: 'etag' - - field: 'kubelet_config.cpu_cfs_quota' - - field: 'kubelet_config.cpu_cfs_quota_period' - - field: 'kubelet_config.cpu_manager_policy' - - field: 'kubelet_config.pod_pids_limit' - - field: 'location' - - field: 'management.auto_repair' - - field: 'max_pods_constraint.max_pods_per_node' - - field: 'name' - - field: 'project' - - field: 'reconciling' - - field: 'state' - - field: 'subnet_id' - - field: 'uid' - - field: 'update_settings.surge_settings.max_surge' - - field: 'update_settings.surge_settings.max_unavailable' - - field: 'update_time' - - field: 'version' diff --git a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_client_meta.yaml b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_client_meta.yaml index 9a3f42d01270..64767424a28c 100644 --- a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_client_meta.yaml +++ b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_client_meta.yaml @@ -3,12 +3,3 @@ generation_type: 'dcl' api_service_name: 'gkemulticloud.googleapis.com' api_version: 'v1' api_resource_type_kind: 'AzureClient' -fields: - - field: 'application_id' - - field: 'certificate' - - field: 'create_time' - - field: 'location' - - field: 'name' - - field: 'project' - - field: 'tenant_id' - - field: 'uid' diff --git a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml new file mode 100644 index 000000000000..b6203a779c8b --- /dev/null +++ b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_azure_cluster' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AzureCluster' diff --git a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml.tmpl b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml.tmpl deleted file mode 100644 index 9744117bbb5c..000000000000 --- a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml.tmpl +++ /dev/null @@ -1,50 +0,0 @@ -resource: 'google_container_azure_cluster' -generation_type: 'dcl' -api_service_name: 'gkemulticloud.googleapis.com' -api_version: 'v1' -api_resource_type_kind: 'AzureCluster' -fields: - - field: 'annotations' - - field: 'authorization.admin_groups.group' - - field: 'authorization.admin_users.username' - - field: 'azure_region' - - field: 'azure_services_authentication.application_id' - - field: 'azure_services_authentication.tenant_id' - - field: 'client' - - field: 'control_plane.database_encryption.key_id' - - field: 'control_plane.main_volume.size_gib' - - field: 'control_plane.proxy_config.resource_group_id' - - field: 'control_plane.proxy_config.secret_id' - - field: 'control_plane.replica_placements.azure_availability_zone' - - field: 'control_plane.replica_placements.subnet_id' - - field: 'control_plane.root_volume.size_gib' - - field: 'control_plane.ssh_config.authorized_key' - - field: 'control_plane.subnet_id' - - field: 'control_plane.tags' - - field: 'control_plane.version' - - field: 'control_plane.vm_size' - - field: 'create_time' - - field: 'description' - - field: 'effective_annotations' - provider_only: true - - field: 'endpoint' - - field: 'etag' - - field: 'fleet.membership' - - field: 'fleet.project' - - field: 'location' -{{- if ne $.TargetVersionName "ga" }} - - field: 'logging_config.component_config.enable_components' -{{- end }} - - field: 'name' - - field: 'networking.pod_address_cidr_blocks' - - field: 'networking.service_address_cidr_blocks' - - field: 'networking.virtual_network_id' - - field: 'project' - - field: 'reconciling' - - field: 'resource_group_id' - - field: 'state' - - field: 'uid' - - field: 'update_time' - - field: 'workload_identity_config.identity_provider' - - field: 'workload_identity_config.issuer_uri' - - field: 'workload_identity_config.workload_pool' diff --git a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml new file mode 100644 index 000000000000..050efdd73bfb --- /dev/null +++ b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_azure_node_pool' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AzureNodePool' diff --git a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml.tmpl b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml.tmpl deleted file mode 100644 index 32d0e124ed3b..000000000000 --- a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -resource: 'google_container_azure_node_pool' -generation_type: 'dcl' -api_service_name: 'gkemulticloud.googleapis.com' -api_version: 'v1' -api_resource_type_kind: 'AzureNodePool' -fields: - - field: 'annotations' - - field: 'autoscaling.max_node_count' - - field: 'autoscaling.min_node_count' - - field: 'azure_availability_zone' - - field: 'cluster' -{{- if ne $.TargetVersionName "ga" }} - - field: 'config.image_type' -{{- end }} - - field: 'config.labels' - - field: 'config.proxy_config.resource_group_id' - - field: 'config.proxy_config.secret_id' - - field: 'config.root_volume.size_gib' - - field: 'config.ssh_config.authorized_key' - - field: 'config.tags' - - field: 'config.vm_size' - - field: 'create_time' - - field: 'effective_annotations' - provider_only: true - - field: 'etag' - - field: 'location' - - field: 'management.auto_repair' - - field: 'max_pods_constraint.max_pods_per_node' - - field: 'name' - - field: 'project' - - field: 'reconciling' - - field: 'state' - - field: 'subnet_id' - - field: 'uid' - - field: 'update_time' - - field: 'version' diff --git a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_meta.yaml.tmpl b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_meta.yaml.tmpl index 36f330554bf6..64b7b7494a29 100644 --- a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_meta.yaml.tmpl @@ -4,36 +4,4 @@ generation_type: 'handwritten' api_service_name: 'dataflow.googleapis.com' api_version: 'v1b3' api_resource_type_kind: 'Job' -fields: - - field: 'additional_experiments' - - field: 'autoscaling_algorithm' - - field: 'container_spec_gcs_path' - - field: 'effective_labels' - provider_only: true - - field: 'enable_streaming_engine' - - field: 'ip_configuration' - - field: 'job_id' - - field: 'kms_key_name' - - field: 'labels' - - field: 'launcher_machine_type' - - field: 'machine_type' - - field: 'max_workers' - - field: 'name' - - field: 'network' - - field: 'num_workers' - - field: 'on_delete' - - field: 'parameters' - - field: 'project' - - field: 'region' - - field: 'sdk_container_image' - - field: 'service_account_email' - - field: 'skip_wait_on_job_termination' - - field: 'staging_location' - - field: 'state' - - field: 'subnetwork' - - field: 'temp_location' - - field: 'terraform_labels' - provider_only: true - - field: 'transform_name_mapping' - - field: 'type' {{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.tmpl b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.tmpl index aec6c6971afd..917f1b8a674d 100644 --- a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.tmpl @@ -306,16 +306,13 @@ func TestAccDataflowFlexTemplateJob_withKmsKey(t *testing.T) { bucket := "tf-test-dataflow-bucket-" + randStr topic := "tf-test-topic" + randStr - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - { - Member: "serviceAccount:service-{project_number}@dataflow-service-producer-prod.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } + + if acctest.BootstrapPSARole(t, "service-", "dataflow-service-producer-prod", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_meta.yaml b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_meta.yaml index f59db2c8cef4..d276c962797a 100644 --- a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_meta.yaml +++ b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_meta.yaml @@ -3,31 +3,3 @@ generation_type: 'handwritten' api_service_name: 'dataflow.googleapis.com' api_version: 'v1b3' api_resource_type_kind: 'Job' -fields: - - field: 'additional_experiments' - - field: 'effective_labels' - provider_only: true - - field: 'enable_streaming_engine' - - field: 'ip_configuration' - - field: 'job_id' - - field: 'kms_key_name' - - field: 'labels' - - field: 'machine_type' - - field: 'max_workers' - - field: 'name' - - field: 'network' - - field: 'on_delete' - - field: 'parameters' - - field: 'project' - - field: 'region' - - field: 'service_account_email' - - field: 'skip_wait_on_job_termination' - - field: 'state' - - field: 'subnetwork' - - field: 'temp_gcs_location' - - field: 'template_gcs_path' - - field: 'terraform_labels' - provider_only: true - - field: 'transform_name_mapping' - - field: 'type' - - field: 'zone' diff --git a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_test.go.tmpl b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_test.go.tmpl index a11cd05f4c1c..98024bfd061a 100644 --- a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_job_test.go.tmpl @@ -1,18 +1,15 @@ package dataflow_test import ( - "context" "fmt" - "path" - "strconv" + "strconv" "strings" "testing" "time" + "github.com/hashicorp/terraform-provider-google/google/services/dataflow" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-provider-google/google/services/dataflow" - dataflowapi "google.golang.org/api/dataflow/v1b3" "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/tpgresource" @@ -28,7 +25,6 @@ const ( testDataflowJobTemplateWordCountUrl = "gs://dataflow-templates/latest/Word_Count" testDataflowJobSampleFileUrl = "gs://dataflow-samples/shakespeare/various.txt" testDataflowJobTemplateTextToPubsub = "gs://dataflow-templates/latest/Stream_GCS_Text_to_Cloud_PubSub" - testDataflowJobRegion = "us-central1" ) func TestAccDataflowJob_basic(t *testing.T) { @@ -40,6 +36,7 @@ func TestAccDataflowJob_basic(t *testing.T) { randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr + zone := "us-east5-b" acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -47,7 +44,7 @@ func TestAccDataflowJob_basic(t *testing.T) { CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccDataflowJob(bucket, job, testDataflowJobRegion), + Config: testAccDataflowJob_zone(bucket, job, zone), Check: resource.ComposeTestCheckFunc( testAccDataflowJobExists(t, "google_dataflow_job.big_data"), ), @@ -56,7 +53,7 @@ func TestAccDataflowJob_basic(t *testing.T) { ResourceName: "google_dataflow_job.big_data", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "region", "state"}, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "zone", "state"}, }, }, }) @@ -71,6 +68,7 @@ func TestAccDataflowJobSkipWait_basic(t *testing.T) { randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr + zone := "us-east5-b" acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -78,11 +76,42 @@ func TestAccDataflowJobSkipWait_basic(t *testing.T) { CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccDataflowJobSkipWait(bucket, job, testDataflowJobRegion), + Config: testAccDataflowJobSkipWait_zone(bucket, job, zone), Check: resource.ComposeTestCheckFunc( testAccDataflowJobExists(t, "google_dataflow_job.big_data"), ), }, + { + ResourceName: "google_dataflow_job.big_data", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "zone", "state"}, + }, + }, + }) +} + +func TestAccDataflowJob_withRegion(t *testing.T) { + // Dataflow responses include serialized java classes and bash commands + // This makes body comparison infeasible + acctest.SkipIfVcr(t) + t.Parallel() + + randStr := acctest.RandString(t, 10) + bucket := "tf-test-dataflow-gcs-" + randStr + job := "tf-test-dataflow-job-" + randStr + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckDataflowJobRegionDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccDataflowJob_region(bucket, job), + Check: resource.ComposeTestCheckFunc( + testAccRegionalDataflowJobExists(t, "google_dataflow_job.big_data", "us-central1"), + ), + }, { ResourceName: "google_dataflow_job.big_data", ImportState: true, @@ -120,7 +149,7 @@ func TestAccDataflowJob_withServiceAccount(t *testing.T) { ResourceName: "google_dataflow_job.big_data", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "region", "state"}, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "state"}, }, }, }) @@ -153,7 +182,7 @@ func TestAccDataflowJob_withNetwork(t *testing.T) { ResourceName: "google_dataflow_job.big_data", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "region", "state"}, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "state"}, }, }, }) @@ -187,7 +216,7 @@ func TestAccDataflowJob_withSubnetwork(t *testing.T) { ResourceName: "google_dataflow_job.big_data", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "subnetwork", "region", "state"}, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "subnetwork", "state"}, }, }, }) @@ -236,6 +265,7 @@ func TestAccDataflowJob_withProviderDefaultLabels(t *testing.T) { randStr := acctest.RandString(t, 10) bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr + zone := "us-east5-b" acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -258,10 +288,10 @@ func TestAccDataflowJob_withProviderDefaultLabels(t *testing.T) { ), }, { - ResourceName: "google_dataflow_job.big_data", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "state", "region", "labels", "terraform_labels"}, + ResourceName: "google_dataflow_job.big_data", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "state", "labels", "terraform_labels"}, }, { Config: testAccDataflowJob_resourceLabelsOverridesProviderDefaultLabels(bucket, job), @@ -303,9 +333,9 @@ func TestAccDataflowJob_withProviderDefaultLabels(t *testing.T) { ), }, { - ResourceName: "google_dataflow_job.big_data", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_dataflow_job.big_data", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "state", "labels", "terraform_labels"}, }, { @@ -325,13 +355,13 @@ func TestAccDataflowJob_withProviderDefaultLabels(t *testing.T) { ), }, { - ResourceName: "google_dataflow_job.big_data", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_dataflow_job.big_data", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "state", "labels", "terraform_labels"}, }, { - Config: testAccDataflowJob(bucket, job, testDataflowJobRegion), + Config: testAccDataflowJob_zone(bucket, job, zone), Check: resource.ComposeTestCheckFunc( resource.TestCheckNoResourceAttr("google_dataflow_job.big_data", "labels.%"), // goog-terraform-provisioned: true is added @@ -339,10 +369,10 @@ func TestAccDataflowJob_withProviderDefaultLabels(t *testing.T) { ), }, { - ResourceName: "google_dataflow_job.big_data", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "region", "state"}, + ResourceName: "google_dataflow_job.big_data", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "zone", "state"}, }, }, }) @@ -390,17 +420,15 @@ func TestAccDataflowJob_withKmsKey(t *testing.T) { crypto_key := "tf-test-dataflow-kms-key-" + randStr bucket := "tf-test-dataflow-gcs-" + randStr job := "tf-test-dataflow-job-" + randStr + zone := "us-east5-b" - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - { - Member: "serviceAccount:service-{project_number}@dataflow-service-producer-prod.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } + + if acctest.BootstrapPSARole(t, "service-", "dataflow-service-producer-prod", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -408,7 +436,7 @@ func TestAccDataflowJob_withKmsKey(t *testing.T) { CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccDataflowJob_kms(key_ring, crypto_key, bucket, job, testDataflowJobRegion), + Config: testAccDataflowJob_kms(key_ring, crypto_key, bucket, job, zone), Check: resource.ComposeTestCheckFunc( testAccDataflowJobExists(t, "google_dataflow_job.big_data"), ), @@ -417,7 +445,7 @@ func TestAccDataflowJob_withKmsKey(t *testing.T) { ResourceName: "google_dataflow_job.big_data", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "region", "state"}, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "zone", "state"}, }, }, }) @@ -461,47 +489,20 @@ func TestAccDataflowJob_streamUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := acctest.RandString(t, 10) - job := "tf-test-dataflow-job-" + randStr - serviceAccount := "tf-test-dataflow-sa" + randStr - suffix := acctest.RandString(t, 10) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), - ExternalProviders: map[string]resource.ExternalProvider{ - "time": {}, - }, Steps: []resource.TestStep{ { - Config: testAccDataflowJob_stream(suffix, job, serviceAccount, "google_storage_bucket.bucket1.url", "cancel"), + Config: testAccDataflowJob_updateStream(suffix, "google_storage_bucket.bucket1.url"), Check: resource.ComposeTestCheckFunc( testAccDataflowJobExists(t, "google_dataflow_job.pubsub_stream"), - func(s *terraform.State) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) - defer cancel() - tick := time.NewTicker(10 * time.Second) - defer tick.Stop() - for { - select { - case <-tick.C: - job, err := testAccDataflowGetJob(t, s, "google_dataflow_job.pubsub_stream") - if err != nil { - return err - } - if job.CurrentState == "JOB_STATE_RUNNING" { - return nil - } - case <-ctx.Done(): - return fmt.Errorf("timeout waiting for Job to reach RUNNING state") - } - } - }, ), }, { - Config: testAccDataflowJob_stream(suffix, job, serviceAccount, "google_storage_bucket.bucket2.url", "cancel"), + Config: testAccDataflowJob_updateStream(suffix, "google_storage_bucket.bucket2.url"), Check: resource.ComposeTestCheckFunc( testAccDataflowJobHasTempLocation(t, "google_dataflow_job.pubsub_stream", "gs://tf-test-bucket2-"+suffix), ), @@ -522,10 +523,6 @@ func TestAccDataflowJob_virtualUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() - randStr := acctest.RandString(t, 10) - job := "tf-test-dataflow-job-" + randStr - serviceAccount := "tf-test-dataflow-sa" + randStr - suffix := acctest.RandString(t, 10) // If the update is virtual-only, the ID should remain the same after updating. @@ -534,39 +531,16 @@ func TestAccDataflowJob_virtualUpdate(t *testing.T) { PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), - ExternalProviders: map[string]resource.ExternalProvider{ - "time": {}, - }, Steps: []resource.TestStep{ { - Config: testAccDataflowJob_stream(suffix, job, serviceAccount, "google_storage_bucket.bucket1.url", "drain"), + Config: testAccDataflowJob_virtualUpdate(suffix, "drain"), Check: resource.ComposeTestCheckFunc( testAccDataflowJobExists(t, "google_dataflow_job.pubsub_stream"), testAccDataflowSetId(t, "google_dataflow_job.pubsub_stream", &id), - func(s *terraform.State) error { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) - defer cancel() - tick := time.NewTicker(10 * time.Second) - defer tick.Stop() - for { - select { - case <-tick.C: - job, err := testAccDataflowGetJob(t, s, "google_dataflow_job.pubsub_stream") - if err != nil { - return err - } - if job.CurrentState == "JOB_STATE_RUNNING" { - return nil - } - case <-ctx.Done(): - return fmt.Errorf("timeout waiting for Job to reach RUNNING state") - } - } - }, ), }, { - Config: testAccDataflowJob_stream(suffix, job, serviceAccount, "google_storage_bucket.bucket1.url", "cancel"), + Config: testAccDataflowJob_virtualUpdate(suffix, "cancel"), Check: resource.ComposeTestCheckFunc( testAccDataflowCheckId(t, "google_dataflow_job.pubsub_stream", &id), resource.TestCheckResourceAttr("google_dataflow_job.pubsub_stream", "on_delete", "cancel"), @@ -576,7 +550,7 @@ func TestAccDataflowJob_virtualUpdate(t *testing.T) { ResourceName: "google_dataflow_job.pubsub_stream", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"on_delete", "parameters", "transform_name_mapping", "skip_wait_on_job_termination", "region", "state"}, + ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination", "state"}, }, }, }) @@ -592,18 +566,18 @@ func testAccCheckDataflowJobDestroyProducer(t *testing.T) func(s *terraform.Stat config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).Do() if job != nil { - var ok bool - skipWait, err := strconv.ParseBool(rs.Primary.Attributes["skip_wait_on_job_termination"]) - if err != nil { - return fmt.Errorf("could not parse attribute: %v", err) - } + var ok bool + skipWait, err := strconv.ParseBool(rs.Primary.Attributes["skip_wait_on_job_termination"]) + if err != nil { + return fmt.Errorf("could not parse attribute: %v", err) + } _, ok = dataflow.DataflowTerminalStatesMap[job.CurrentState] - if !ok && skipWait { - _, ok = dataflow.DataflowTerminatingStatesMap[job.CurrentState] - } - if !ok { - return fmt.Errorf("Job still present") - } + if !ok && skipWait { + _, ok = dataflow.DataflowTerminatingStatesMap[job.CurrentState] + } + if !ok { + return fmt.Errorf("Job still present") + } } else if err != nil { return err } @@ -622,18 +596,18 @@ func testAccCheckDataflowJobRegionDestroyProducer(t *testing.T) func(s *terrafor config := acctest.GoogleProviderConfig(t) job, err := config.NewDataflowClient(config.UserAgent).Projects.Locations.Jobs.Get(config.Project, "us-central1", rs.Primary.ID).Do() if job != nil { - var ok bool - skipWait, err := strconv.ParseBool(rs.Primary.Attributes["skip_wait_on_job_termination"]) - if err != nil { - return fmt.Errorf("could not parse attribute: %v", err) - } + var ok bool + skipWait, err := strconv.ParseBool(rs.Primary.Attributes["skip_wait_on_job_termination"]) + if err != nil { + return fmt.Errorf("could not parse attribute: %v", err) + } _, ok = dataflow.DataflowTerminalStatesMap[job.CurrentState] - if !ok && skipWait { - _, ok = dataflow.DataflowTerminatingStatesMap[job.CurrentState] - } - if !ok { - return fmt.Errorf("Job still present") - } + if !ok && skipWait { + _, ok = dataflow.DataflowTerminatingStatesMap[job.CurrentState] + } + if !ok { + return fmt.Errorf("Job still present") + } } else if err != nil { return err } @@ -645,45 +619,22 @@ func testAccCheckDataflowJobRegionDestroyProducer(t *testing.T) func(s *terrafor func testAccDataflowJobExists(t *testing.T, resource string) resource.TestCheckFunc { return func(s *terraform.State) error { - _, err := testAccDataflowGetJob(t, s, resource) - return err - } -} - -func testAccDataflowGetJob(t *testing.T, s *terraform.State, resource string) (*dataflowapi.Job, error) { - rs, ok := s.RootModule().Resources[resource] - if !ok { - return nil, fmt.Errorf("resource %q not in state", resource) - } - if rs.Primary.ID == "" { - return nil, fmt.Errorf("no ID is set") - } + rs, ok := s.RootModule().Resources[resource] + if !ok { + return fmt.Errorf("resource %q not in state", resource) + } + if rs.Primary.ID == "" { + return fmt.Errorf("no ID is set") + } - region, ok := rs.Primary.Attributes["region"] - if !ok { - region = testDataflowJobRegion - } - config := acctest.GoogleProviderConfig(t) - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) - defer cancel() - job, err := config.NewDataflowClient(config.UserAgent).Projects.Locations.Jobs.Get(config.Project, region, rs.Primary.ID).Context(ctx).View("JOB_VIEW_ALL").Do() - if err != nil { - return nil, fmt.Errorf("could not get Dataflow Job 'projects/%s/regions/%s/jobs/%s': %w", config.Project, config.Region, rs.Primary.ID, err) - } - return job, nil -} + config := acctest.GoogleProviderConfig(t) + _, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).Do() + if err != nil { + return fmt.Errorf("could not confirm Dataflow Job %q exists: %v", rs.Primary.ID, err) + } -func testAccDataflowWorkerPool(job *dataflowapi.Job) (*dataflowapi.WorkerPool, error) { - if job == nil { - return nil, fmt.Errorf("job is nil") - } - if job.Environment == nil { - return nil, fmt.Errorf("job has no environment: %+v", job) - } - if len(job.Environment.WorkerPools) == 0 { - return nil, fmt.Errorf("job has no worker pools: %+v", job) + return nil } - return job.Environment.WorkerPools[0], nil } func testAccDataflowSetId(t *testing.T, resource string, id *string) resource.TestCheckFunc { @@ -714,16 +665,16 @@ func testAccDataflowCheckId(t *testing.T, resource string, id *string) resource. func testAccDataflowJobHasNetwork(t *testing.T, res, expected string) resource.TestCheckFunc { return func(s *terraform.State) error { - job, err := testAccDataflowGetJob(t, s, res) + instanceTmpl, err := testAccDataflowJobGetGeneratedInstanceTemplate(t, s, res) if err != nil { - return err + return fmt.Errorf("Error getting dataflow job instance template: %s", err) } - wp, err := testAccDataflowWorkerPool(job) - if err != nil { - return err + if len(instanceTmpl.Properties.NetworkInterfaces) == 0 { + return fmt.Errorf("no network interfaces in template properties: %+v", instanceTmpl.Properties) } - if wp.Network != expected { - return fmt.Errorf("network mismatch: %s != %s", wp.Network, expected) + actual := instanceTmpl.Properties.NetworkInterfaces[0].Network + if tpgresource.GetResourceNameFromSelfLink(actual) != tpgresource.GetResourceNameFromSelfLink(expected) { + return fmt.Errorf("network mismatch: %s != %s", actual, expected) } return nil } @@ -731,17 +682,16 @@ func testAccDataflowJobHasNetwork(t *testing.T, res, expected string) resource.T func testAccDataflowJobHasSubnetwork(t *testing.T, res, expected string) resource.TestCheckFunc { return func(s *terraform.State) error { - job, err := testAccDataflowGetJob(t, s, res) + instanceTmpl, err := testAccDataflowJobGetGeneratedInstanceTemplate(t, s, res) if err != nil { - return err + return fmt.Errorf("Error getting dataflow job instance template: %s", err) } - wp, err := testAccDataflowWorkerPool(job) - if err != nil { - return err + if len(instanceTmpl.Properties.NetworkInterfaces) == 0 { + return fmt.Errorf("no network interfaces in template properties: %+v", instanceTmpl.Properties) } - got := path.Base(wp.Subnetwork) - if got != expected { - return fmt.Errorf("network mismatch: %s != %s", got, expected) + actual := instanceTmpl.Properties.NetworkInterfaces[0].Subnetwork + if tpgresource.GetResourceNameFromSelfLink(actual) != tpgresource.GetResourceNameFromSelfLink(expected) { + return fmt.Errorf("subnetwork mismatch: %s != %s", actual, expected) } return nil } @@ -789,7 +739,7 @@ func testAccDataflowJobGetGeneratedInstanceTemplate(t *testing.T, s *terraform.S return resource.NonRetryableError(rerr) } if len(instanceTemplates.Items) == 0 { - return resource.RetryableError(fmt.Errorf("no instance template found for dataflow job 'projects/%s/regions/%s/jobs/%s'", config.Project, config.Region, rs.Primary.ID)) + return resource.RetryableError(fmt.Errorf("no instance template found for dataflow job %q", rs.Primary.ID)) } if len(instanceTemplates.Items) > 1 { return resource.NonRetryableError(fmt.Errorf("Wrong number of matching instance templates for dataflow job: %s, %d", rs.Primary.ID, len(instanceTemplates.Items))) @@ -828,15 +778,21 @@ func testAccRegionalDataflowJobExists(t *testing.T, res, region string) resource func testAccDataflowJobHasLabels(t *testing.T, res, key string) resource.TestCheckFunc { return func(s *terraform.State) error { - job, err := testAccDataflowGetJob(t, s, res) - if err != nil { - return err - } rs, ok := s.RootModule().Resources[res] if !ok { return fmt.Errorf("resource %q not found in state", res) } + if rs.Primary.ID == "" { + return fmt.Errorf("No ID is set") + } + config := acctest.GoogleProviderConfig(t) + + job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).Do() + if err != nil { + return fmt.Errorf("dataflow job does not exist") + } + if job.Labels[key] != rs.Primary.Attributes["labels."+key] { return fmt.Errorf("Labels do not match what is stored in state.") } @@ -847,10 +803,21 @@ func testAccDataflowJobHasLabels(t *testing.T, res, key string) resource.TestChe func testAccDataflowJobHasExperiments(t *testing.T, res string, experiments []string) resource.TestCheckFunc { return func(s *terraform.State) error { - job, err := testAccDataflowGetJob(t, s, res) + rs, ok := s.RootModule().Resources[res] + if !ok { + return fmt.Errorf("resource %q not found in state", res) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No ID is set") + } + config := acctest.GoogleProviderConfig(t) + + job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).View("JOB_VIEW_ALL").Do() if err != nil { - return err + return fmt.Errorf("dataflow job does not exist") } + for _, expectedExperiment := range experiments { var contains = false for _, actualExperiment := range job.Environment.Experiments { @@ -869,15 +836,19 @@ func testAccDataflowJobHasExperiments(t *testing.T, res string, experiments []st func testAccDataflowJobHasTempLocation(t *testing.T, res, targetLocation string) resource.TestCheckFunc { return func(s *terraform.State) error { - job, err := testAccDataflowGetJob(t, s, res) - if err != nil { - return err + rs, ok := s.RootModule().Resources[res] + if !ok { + return fmt.Errorf("resource %q not found in state", res) } - if job.Environment == nil { - return fmt.Errorf("job has no environment: %+v", job) + + if rs.Primary.ID == "" { + return fmt.Errorf("No ID is set") } - if job.Environment.SdkPipelineOptions == nil { - return fmt.Errorf("SDK pipeline options are nil") + config := acctest.GoogleProviderConfig(t) + + job, err := config.NewDataflowClient(config.UserAgent).Projects.Jobs.Get(config.Project, rs.Primary.ID).View("JOB_VIEW_ALL").Do() + if err != nil { + return fmt.Errorf("dataflow job does not exist") } sdkPipelineOptions, err := tpgresource.ConvertToMap(job.Environment.SdkPipelineOptions) if err != nil { @@ -893,19 +864,18 @@ func testAccDataflowJobHasTempLocation(t *testing.T, res, targetLocation string) } } -func testAccDataflowJob(bucket, job, region string) string { +func testAccDataflowJob_zone(bucket, job, zone string) string { return fmt.Sprintf(` resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "big_data" { name = "%s" - region = "%s" + zone = "%s" machine_type = "e2-standard-2" template_gcs_path = "%s" @@ -916,22 +886,21 @@ resource "google_dataflow_job" "big_data" { } on_delete = "cancel" } -`, bucket, job, region, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) +`, bucket, job, zone, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) } -func testAccDataflowJobSkipWait(bucket, job, region string) string { +func testAccDataflowJobSkipWait_zone(bucket, job, zone string) string { return fmt.Sprintf(` resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "big_data" { name = "%s" - region = "%s" + zone = "%s" machine_type = "e2-standard-2" template_gcs_path = "%s" @@ -943,7 +912,31 @@ resource "google_dataflow_job" "big_data" { on_delete = "cancel" skip_wait_on_job_termination = true } -`, bucket, job, region, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) +`, bucket, job, zone, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) +} + +func testAccDataflowJob_region(bucket, job string) string { + return fmt.Sprintf(` +resource "google_storage_bucket" "temp" { + name = "%s" + location = "US" + force_destroy = true +} + +resource "google_dataflow_job" "big_data" { + name = "%s" + region = "us-central1" + + template_gcs_path = "%s" + temp_gcs_location = google_storage_bucket.temp.url + parameters = { + inputFile = "%s" + output = "${google_storage_bucket.temp.url}/output" + } + + on_delete = "cancel" +} +`, bucket, job, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) } func testAccDataflowJob_network(bucket, job, network string) string { @@ -952,7 +945,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_compute_network" "net" { @@ -982,7 +974,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_compute_network" "net" { @@ -993,14 +984,13 @@ resource "google_compute_network" "net" { resource "google_compute_subnetwork" "subnet" { name = "%s" ip_cidr_range = "10.2.0.0/16" - network = google_compute_network.net.name - region = "%s" + network = google_compute_network.net.self_link } resource "google_dataflow_job" "big_data" { name = "%s" - region = "%s" - subnetwork = google_compute_subnetwork.subnet.self_link + + subnetwork = google_compute_subnetwork.subnet.self_link template_gcs_path = "%s" temp_gcs_location = google_storage_bucket.temp.url @@ -1010,7 +1000,7 @@ resource "google_dataflow_job" "big_data" { } on_delete = "cancel" } -`, bucket, network, subnet, testDataflowJobRegion, job, testDataflowJobRegion, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) +`, bucket, network, subnet, job, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) } func testAccDataflowJob_serviceAccount(bucket, job, accountId string) string { @@ -1021,7 +1011,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_service_account" "dataflow-sa" { @@ -1043,7 +1032,6 @@ resource "google_project_iam_member" "dataflow-worker" { resource "google_dataflow_job" "big_data" { name = "%s" - region = "%s" depends_on = [ google_storage_bucket_iam_member.dataflow-gcs, google_project_iam_member.dataflow-worker @@ -1058,7 +1046,7 @@ resource "google_dataflow_job" "big_data" { service_account_email = google_service_account.dataflow-sa.email } -`, bucket, accountId, job, testDataflowJobRegion, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) +`, bucket, accountId, job, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) } func testAccDataflowJob_ipConfig(bucket, job string) string { @@ -1067,7 +1055,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "big_data" { @@ -1092,7 +1079,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "big_data" { @@ -1125,7 +1111,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "big_data" { @@ -1159,7 +1144,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "big_data" { @@ -1195,7 +1179,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "big_data" { @@ -1217,7 +1200,7 @@ resource "google_dataflow_job" "big_data" { `, bucket, job, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) } -func testAccDataflowJob_kms(key_ring, crypto_key, bucket, job, region string) string { +func testAccDataflowJob_kms(key_ring, crypto_key, bucket, job, zone string) string { return fmt.Sprintf(` resource "google_kms_key_ring" "keyring" { name = "%s" @@ -1234,13 +1217,12 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "big_data" { name = "%s" - region = "%s" + zone = "%s" machine_type = "e2-standard-2" template_gcs_path = "%s" @@ -1252,7 +1234,7 @@ resource "google_dataflow_job" "big_data" { } on_delete = "cancel" } -`, key_ring, crypto_key, bucket, job, region, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) +`, key_ring, crypto_key, bucket, job, zone, testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) } func testAccDataflowJob_additionalExperiments(bucket string, job string, experiments []string) string { @@ -1261,7 +1243,6 @@ resource "google_storage_bucket" "temp" { name = "%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "with_additional_experiments" { @@ -1280,11 +1261,8 @@ resource "google_dataflow_job" "with_additional_experiments" { `, bucket, job, strings.Join(experiments, `", "`), testDataflowJobTemplateWordCountUrl, testDataflowJobSampleFileUrl) } -func testAccDataflowJob_stream(suffix, job, serviceAccount, tempLocation, ondelete string) string { +func testAccDataflowJob_updateStream(suffix, tempLocation string) string { return fmt.Sprintf(` - -data "google_project" "project" {} - resource "google_pubsub_topic" "topic" { name = "tf-test-dataflow-job-%s" } @@ -1292,46 +1270,14 @@ resource "google_storage_bucket" "bucket1" { name = "tf-test-bucket1-%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_storage_bucket" "bucket2" { name = "tf-test-bucket2-%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } - -resource "google_service_account" "dataflow-sa" { - account_id = "%s" - display_name = "DataFlow Service Account" -} - -resource "google_storage_bucket_iam_member" "bucket1" { - bucket = google_storage_bucket.bucket1.name - role = "roles/storage.objectAdmin" - member = "serviceAccount:${google_service_account.dataflow-sa.email}" -} - -resource "google_storage_bucket_iam_member" "bucket2" { - bucket = google_storage_bucket.bucket2.name - role = "roles/storage.objectAdmin" - member = "serviceAccount:${google_service_account.dataflow-sa.email}" -} - -resource "google_project_iam_member" "dataflow-worker" { - project = data.google_project.project.project_id - role = "roles/dataflow.worker" - member = "serviceAccount:${google_service_account.dataflow-sa.email}" -} - -resource "time_sleep" "wait_bind_iam_roles" { - depends_on = [google_project_iam_member.dataflow-worker, google_storage_bucket_iam_member.bucket1, google_storage_bucket_iam_member.bucket2] - create_duration = "300s" -} - resource "google_dataflow_job" "pubsub_stream" { - depends_on = [time_sleep.wait_bind_iam_roles] - name = "%s" + name = "tf-test-dataflow-job-%s" template_gcs_path = "%s" temp_gcs_location = %s parameters = { @@ -1342,10 +1288,9 @@ resource "google_dataflow_job" "pubsub_stream" { name = "test_job" env = "test" } - service_account_email = google_service_account.dataflow-sa.email - on_delete = "%s" + on_delete = "cancel" } - `, suffix, suffix, suffix, serviceAccount, job, testDataflowJobTemplateTextToPubsub, tempLocation, ondelete) + `, suffix, suffix, suffix, suffix, testDataflowJobTemplateTextToPubsub, tempLocation) } func testAccDataflowJob_virtualUpdate(suffix, onDelete string) string { @@ -1357,7 +1302,6 @@ resource "google_storage_bucket" "bucket" { name = "tf-test-bucket-%s" location = "US" force_destroy = true - uniform_bucket_level_access = true } resource "google_dataflow_job" "pubsub_stream" { name = "tf-test-dataflow-job-%s" @@ -1370,4 +1314,4 @@ resource "google_dataflow_job" "pubsub_stream" { on_delete = "%s" } `, suffix, suffix, suffix, testDataflowJobTemplateTextToPubsub, onDelete) -} \ No newline at end of file +} diff --git a/mmv1/third_party/terraform/services/datafusion/resource_data_fusion_instance_test.go b/mmv1/third_party/terraform/services/datafusion/resource_data_fusion_instance_test.go index 117501d7e1e4..cdddec134506 100644 --- a/mmv1/third_party/terraform/services/datafusion/resource_data_fusion_instance_test.go +++ b/mmv1/third_party/terraform/services/datafusion/resource_data_fusion_instance_test.go @@ -9,6 +9,7 @@ import ( ) func TestAccDataFusionInstance_update(t *testing.T) { + t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/20574") t.Parallel() instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) @@ -87,6 +88,7 @@ resource "google_data_fusion_instance" "foobar" { } func TestAccDataFusionInstanceEnterprise_update(t *testing.T) { + t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/20574") t.Parallel() instanceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) diff --git a/mmv1/third_party/terraform/services/datalossprevention/resource_data_loss_prevention_discovery_config_test.go b/mmv1/third_party/terraform/services/datalossprevention/resource_data_loss_prevention_discovery_config_test.go index e00537283bab..6251c9e3a41b 100644 --- a/mmv1/third_party/terraform/services/datalossprevention/resource_data_loss_prevention_discovery_config_test.go +++ b/mmv1/third_party/terraform/services/datalossprevention/resource_data_loss_prevention_discovery_config_test.go @@ -517,12 +517,12 @@ data "google_project" "project" { resource "google_tags_tag_key" "tag_key" { parent = "projects/${data.google_project.project.number}" - short_name = "tf_test_environment%{random_suffix}" + short_name = "environment" } resource "google_tags_tag_value" "tag_value" { parent = google_tags_tag_key.tag_key.id - short_name = "tf_test_prod%{random_suffix}" + short_name = "prod" } resource "google_data_loss_prevention_inspect_template" "basic" { @@ -587,7 +587,7 @@ resource "google_data_loss_prevention_discovery_config" "basic" { tag_resources { tag_conditions { tag { - namespaced_value = "%{project}/tf_test_environment%{random_suffix}/tf_test_prod%{random_suffix}" + namespaced_value = "%{project}/environment/prod" } sensitivity_score { score = "SENSITIVITY_HIGH" diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_asset_meta.yaml b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_asset_meta.yaml index 2dc005fae59c..8a368e8ea655 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_asset_meta.yaml +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_asset_meta.yaml @@ -3,48 +3,3 @@ generation_type: 'dcl' api_service_name: 'dataplex.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Asset' -fields: - - field: 'create_time' - - field: 'dataplex_zone' - - field: 'description' - - field: 'discovery_spec.csv_options.delimiter' - - field: 'discovery_spec.csv_options.disable_type_inference' - - field: 'discovery_spec.csv_options.encoding' - - field: 'discovery_spec.csv_options.header_rows' - - field: 'discovery_spec.enabled' - - field: 'discovery_spec.exclude_patterns' - - field: 'discovery_spec.include_patterns' - - field: 'discovery_spec.json_options.disable_type_inference' - - field: 'discovery_spec.json_options.encoding' - - field: 'discovery_spec.schedule' - - field: 'discovery_status.last_run_duration' - - field: 'discovery_status.last_run_time' - - field: 'discovery_status.message' - - field: 'discovery_status.state' - - field: 'discovery_status.stats.data_items' - - field: 'discovery_status.stats.data_size' - - field: 'discovery_status.stats.filesets' - - field: 'discovery_status.stats.tables' - - field: 'discovery_status.update_time' - - field: 'display_name' - - field: 'effective_labels' - provider_only: true - - field: 'labels' - - field: 'lake' - - field: 'location' - - field: 'name' - - field: 'project' - - field: 'resource_spec.name' - - field: 'resource_spec.read_access_mode' - - field: 'resource_spec.type' - - field: 'resource_status.message' - - field: 'resource_status.state' - - field: 'resource_status.update_time' - - field: 'security_status.message' - - field: 'security_status.state' - - field: 'security_status.update_time' - - field: 'state' - - field: 'terraform_labels' - provider_only: true - - field: 'uid' - - field: 'update_time' diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_lake_meta.yaml b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_lake_meta.yaml index 19b42e401920..30f0bc819765 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_lake_meta.yaml +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_lake_meta.yaml @@ -3,27 +3,3 @@ generation_type: 'dcl' api_service_name: 'dataplex.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Lake' -fields: - - field: 'asset_status.active_assets' - - field: 'asset_status.security_policy_applying_assets' - - field: 'asset_status.update_time' - - field: 'create_time' - - field: 'description' - - field: 'display_name' - - field: 'effective_labels' - provider_only: true - - field: 'labels' - - field: 'location' - - field: 'metastore.service' - - field: 'metastore_status.endpoint' - - field: 'metastore_status.message' - - field: 'metastore_status.state' - - field: 'metastore_status.update_time' - - field: 'name' - - field: 'project' - - field: 'service_account' - - field: 'state' - - field: 'terraform_labels' - provider_only: true - - field: 'uid' - - field: 'update_time' diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_zone_meta.yaml b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_zone_meta.yaml index 2e78d1c90a55..10cec64e04a1 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_zone_meta.yaml +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_zone_meta.yaml @@ -3,34 +3,3 @@ generation_type: 'dcl' api_service_name: 'dataplex.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Zone' -fields: - - field: 'asset_status.active_assets' - - field: 'asset_status.security_policy_applying_assets' - - field: 'asset_status.update_time' - - field: 'create_time' - - field: 'description' - - field: 'discovery_spec.csv_options.delimiter' - - field: 'discovery_spec.csv_options.disable_type_inference' - - field: 'discovery_spec.csv_options.encoding' - - field: 'discovery_spec.csv_options.header_rows' - - field: 'discovery_spec.enabled' - - field: 'discovery_spec.exclude_patterns' - - field: 'discovery_spec.include_patterns' - - field: 'discovery_spec.json_options.disable_type_inference' - - field: 'discovery_spec.json_options.encoding' - - field: 'discovery_spec.schedule' - - field: 'display_name' - - field: 'effective_labels' - provider_only: true - - field: 'labels' - - field: 'lake' - - field: 'location' - - field: 'name' - - field: 'project' - - field: 'resource_spec.location_type' - - field: 'state' - - field: 'terraform_labels' - provider_only: true - - field: 'type' - - field: 'uid' - - field: 'update_time' diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_meta.yaml b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_meta.yaml index 464f5759cd76..853ef5c93b22 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_meta.yaml +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_meta.yaml @@ -3,129 +3,3 @@ generation_type: 'handwritten' api_service_name: 'dataproc.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Cluster' -fields: - - field: 'cluster_config.autoscaling_config.policy_uri' - - field: 'cluster_config.auxiliary_node_groups.node_group.name' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.accelerators.accelerator_count' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.accelerators.accelerator_type' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.disk_config.boot_disk_size_gb' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.disk_config.boot_disk_type' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.disk_config.local_ssd_interface' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.disk_config.num_local_ssds' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.instance_names' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.machine_type' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.min_cpu_platform' - - field: 'cluster_config.auxiliary_node_groups.node_group.node_group_config.num_instances' - - field: 'cluster_config.auxiliary_node_groups.node_group.roles' - - field: 'cluster_config.auxiliary_node_groups.node_group_id' - - field: 'cluster_config.bucket' - - field: 'cluster_config.dataproc_metric_config.metrics.metric_overrides' - - field: 'cluster_config.dataproc_metric_config.metrics.metric_source' - - field: 'cluster_config.encryption_config.kms_key_name' - - field: 'cluster_config.endpoint_config.enable_http_port_access' - - field: 'cluster_config.endpoint_config.http_ports' - - field: 'cluster_config.gce_cluster_config.confidential_instance_config.enable_confidential_compute' - - field: 'cluster_config.gce_cluster_config.internal_ip_only' - - field: 'cluster_config.gce_cluster_config.metadata' - - field: 'cluster_config.gce_cluster_config.network' - - field: 'cluster_config.gce_cluster_config.node_group_affinity.node_group_uri' - - field: 'cluster_config.gce_cluster_config.reservation_affinity.consume_reservation_type' - - field: 'cluster_config.gce_cluster_config.reservation_affinity.key' - - field: 'cluster_config.gce_cluster_config.reservation_affinity.values' - - field: 'cluster_config.gce_cluster_config.service_account' - - field: 'cluster_config.gce_cluster_config.service_account_scopes' - - field: 'cluster_config.gce_cluster_config.shielded_instance_config.enable_integrity_monitoring' - - field: 'cluster_config.gce_cluster_config.shielded_instance_config.enable_secure_boot' - - field: 'cluster_config.gce_cluster_config.shielded_instance_config.enable_vtpm' - - field: 'cluster_config.gce_cluster_config.subnetwork' - - field: 'cluster_config.gce_cluster_config.tags' - - field: 'cluster_config.gce_cluster_config.zone' - - field: 'cluster_config.initialization_action.script' - - field: 'cluster_config.initialization_action.timeout_sec' - - field: 'cluster_config.lifecycle_config.auto_delete_time' - - field: 'cluster_config.lifecycle_config.idle_delete_ttl' - - field: 'cluster_config.lifecycle_config.idle_start_time' - - field: 'cluster_config.master_config.accelerators.accelerator_count' - - field: 'cluster_config.master_config.accelerators.accelerator_type' - - field: 'cluster_config.master_config.disk_config.boot_disk_size_gb' - - field: 'cluster_config.master_config.disk_config.boot_disk_type' - - field: 'cluster_config.master_config.disk_config.local_ssd_interface' - - field: 'cluster_config.master_config.disk_config.num_local_ssds' - - field: 'cluster_config.master_config.image_uri' - - field: 'cluster_config.master_config.instance_names' - - field: 'cluster_config.master_config.machine_type' - - field: 'cluster_config.master_config.min_cpu_platform' - - field: 'cluster_config.master_config.num_instances' - - field: 'cluster_config.metastore_config.dataproc_metastore_service' - - field: 'cluster_config.preemptible_worker_config.disk_config.boot_disk_size_gb' - - field: 'cluster_config.preemptible_worker_config.disk_config.boot_disk_type' - - field: 'cluster_config.preemptible_worker_config.disk_config.local_ssd_interface' - - field: 'cluster_config.preemptible_worker_config.disk_config.num_local_ssds' - - field: 'cluster_config.preemptible_worker_config.instance_flexibility_policy.instance_selection_list.machine_types' - - field: 'cluster_config.preemptible_worker_config.instance_flexibility_policy.instance_selection_list.rank' - - field: 'cluster_config.preemptible_worker_config.instance_flexibility_policy.instance_selection_results.machine_type' - - field: 'cluster_config.preemptible_worker_config.instance_flexibility_policy.instance_selection_results.vm_count' - - field: 'cluster_config.preemptible_worker_config.instance_flexibility_policy.provisioning_model_mix.standard_capacity_base' - - field: 'cluster_config.preemptible_worker_config.instance_flexibility_policy.provisioning_model_mix.standard_capacity_percent_above_base' - - field: 'cluster_config.preemptible_worker_config.instance_names' - - field: 'cluster_config.preemptible_worker_config.num_instances' - - field: 'cluster_config.preemptible_worker_config.preemptibility' - - field: 'cluster_config.security_config.kerberos_config.cross_realm_trust_admin_server' - - field: 'cluster_config.security_config.kerberos_config.cross_realm_trust_kdc' - - field: 'cluster_config.security_config.kerberos_config.cross_realm_trust_realm' - - field: 'cluster_config.security_config.kerberos_config.cross_realm_trust_shared_password_uri' - - field: 'cluster_config.security_config.kerberos_config.enable_kerberos' - - field: 'cluster_config.security_config.kerberos_config.kdc_db_key_uri' - - field: 'cluster_config.security_config.kerberos_config.key_password_uri' - - field: 'cluster_config.security_config.kerberos_config.keystore_password_uri' - - field: 'cluster_config.security_config.kerberos_config.keystore_uri' - - field: 'cluster_config.security_config.kerberos_config.kms_key_uri' - - field: 'cluster_config.security_config.kerberos_config.realm' - - field: 'cluster_config.security_config.kerberos_config.root_principal_password_uri' - - field: 'cluster_config.security_config.kerberos_config.tgt_lifetime_hours' - - field: 'cluster_config.security_config.kerberos_config.truststore_password_uri' - - field: 'cluster_config.security_config.kerberos_config.truststore_uri' - - field: 'cluster_config.software_config.image_version' - - field: 'cluster_config.software_config.optional_components' - - field: 'cluster_config.software_config.override_properties' - - field: 'cluster_config.software_config.properties' - - field: 'cluster_config.staging_bucket' - - field: 'cluster_config.temp_bucket' - - field: 'cluster_config.worker_config.accelerators.accelerator_count' - - field: 'cluster_config.worker_config.accelerators.accelerator_type' - - field: 'cluster_config.worker_config.disk_config.boot_disk_size_gb' - - field: 'cluster_config.worker_config.disk_config.boot_disk_type' - - field: 'cluster_config.worker_config.disk_config.local_ssd_interface' - - field: 'cluster_config.worker_config.disk_config.num_local_ssds' - - field: 'cluster_config.worker_config.image_uri' - - field: 'cluster_config.worker_config.instance_names' - - field: 'cluster_config.worker_config.machine_type' - - field: 'cluster_config.worker_config.min_cpu_platform' - - field: 'cluster_config.worker_config.min_num_instances' - - field: 'cluster_config.worker_config.num_instances' - - field: 'effective_labels' - provider_only: true - - field: 'graceful_decommission_timeout' - - field: 'labels' - - field: 'name' - - field: 'project' - - field: 'region' - - field: 'terraform_labels' - provider_only: true - - field: 'virtual_cluster_config.auxiliary_services_config.metastore_config.dataproc_metastore_service' - - field: 'virtual_cluster_config.auxiliary_services_config.spark_history_server_config.dataproc_cluster' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.gke_cluster_target' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool_config.autoscaling.max_node_count' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool_config.autoscaling.min_node_count' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool_config.config.local_ssd_count' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool_config.config.machine_type' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool_config.config.min_cpu_platform' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool_config.config.preemptible' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool_config.config.spot' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.node_pool_config.locations' - - field: 'virtual_cluster_config.kubernetes_cluster_config.gke_cluster_config.node_pool_target.roles' - - field: 'virtual_cluster_config.kubernetes_cluster_config.kubernetes_namespace' - - field: 'virtual_cluster_config.kubernetes_cluster_config.kubernetes_software_config.component_version' - - field: 'virtual_cluster_config.kubernetes_cluster_config.kubernetes_software_config.properties' - - field: 'virtual_cluster_config.staging_bucket' diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl index 635d78944956..85cb9de1aa05 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl @@ -1052,12 +1052,9 @@ func TestAccDataprocCluster_KMS(t *testing.T) { subnetworkName := acctest.BootstrapSubnet(t, "dataproc-cluster", networkName) acctest.BootstrapFirewallForDataprocSharedNetwork(t, "dataproc-cluster", networkName) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } var cluster dataproc.Cluster acctest.VcrTest(t, resource.TestCase{ diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_job_meta.yaml b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_job_meta.yaml index 0e6ba3879606..f791ce586f11 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_job_meta.yaml +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_job_meta.yaml @@ -3,73 +3,3 @@ generation_type: 'handwritten' api_service_name: 'dataproc.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Job' -fields: - - field: 'driver_controls_files_uri' - - field: 'driver_output_resource_uri' - - field: 'effective_labels' - provider_only: true - - field: 'force_delete' - - field: 'hadoop_config.archive_uris' - - field: 'hadoop_config.args' - - field: 'hadoop_config.file_uris' - - field: 'hadoop_config.jar_file_uris' - - field: 'hadoop_config.logging_config.driver_log_levels' - - field: 'hadoop_config.main_class' - - field: 'hadoop_config.main_jar_file_uri' - - field: 'hadoop_config.properties' - - field: 'hive_config.continue_on_failure' - - field: 'hive_config.jar_file_uris' - - field: 'hive_config.properties' - - field: 'hive_config.query_file_uri' - - field: 'hive_config.query_list' - - field: 'hive_config.script_variables' - - field: 'labels' - - field: 'pig_config.continue_on_failure' - - field: 'pig_config.jar_file_uris' - - field: 'pig_config.logging_config.driver_log_levels' - - field: 'pig_config.properties' - - field: 'pig_config.query_file_uri' - - field: 'pig_config.query_list' - - field: 'pig_config.script_variables' - - field: 'placement.cluster_name' - - field: 'placement.cluster_uuid' - - field: 'presto_config.client_tags' - - field: 'presto_config.continue_on_failure' - - field: 'presto_config.logging_config.driver_log_levels' - - field: 'presto_config.output_format' - - field: 'presto_config.properties' - - field: 'presto_config.query_file_uri' - - field: 'presto_config.query_list' - - field: 'project' - - field: 'pyspark_config.archive_uris' - - field: 'pyspark_config.args' - - field: 'pyspark_config.file_uris' - - field: 'pyspark_config.jar_file_uris' - - field: 'pyspark_config.logging_config.driver_log_levels' - - field: 'pyspark_config.main_python_file_uri' - - field: 'pyspark_config.properties' - - field: 'pyspark_config.python_file_uris' - - field: 'reference.job_id' - - field: 'region' - - field: 'scheduling.max_failures_per_hour' - - field: 'scheduling.max_failures_total' - - field: 'spark_config.archive_uris' - - field: 'spark_config.args' - - field: 'spark_config.file_uris' - - field: 'spark_config.jar_file_uris' - - field: 'spark_config.logging_config.driver_log_levels' - - field: 'spark_config.main_class' - - field: 'spark_config.main_jar_file_uri' - - field: 'spark_config.properties' - - field: 'sparksql_config.jar_file_uris' - - field: 'sparksql_config.logging_config.driver_log_levels' - - field: 'sparksql_config.properties' - - field: 'sparksql_config.query_file_uri' - - field: 'sparksql_config.query_list' - - field: 'sparksql_config.script_variables' - - field: 'status.details' - - field: 'status.state' - - field: 'status.state_start_time' - - field: 'status.substate' - - field: 'terraform_labels' - provider_only: true diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml new file mode 100644 index 000000000000..e1524801d445 --- /dev/null +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_dataproc_workflow_template' +generation_type: 'dcl' +api_service_name: 'dataproc.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'WorkflowTemplate' diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml.tmpl b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml.tmpl deleted file mode 100644 index 914adef51eb3..000000000000 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml.tmpl +++ /dev/null @@ -1,186 +0,0 @@ -resource: 'google_dataproc_workflow_template' -generation_type: 'dcl' -api_service_name: 'dataproc.googleapis.com' -api_version: 'v1' -api_resource_type_kind: 'WorkflowTemplate' -fields: - - field: 'create_time' - - field: 'dag_timeout' - - field: 'effective_labels' - provider_only: true - - field: 'encryption_config.kms_key' - - field: 'jobs.hadoop_job.archive_uris' - - field: 'jobs.hadoop_job.args' - - field: 'jobs.hadoop_job.file_uris' - - field: 'jobs.hadoop_job.jar_file_uris' - - field: 'jobs.hadoop_job.logging_config.driver_log_levels' - - field: 'jobs.hadoop_job.main_class' - - field: 'jobs.hadoop_job.main_jar_file_uri' - - field: 'jobs.hadoop_job.properties' - - field: 'jobs.hive_job.continue_on_failure' - - field: 'jobs.hive_job.jar_file_uris' - - field: 'jobs.hive_job.properties' - - field: 'jobs.hive_job.query_file_uri' - - field: 'jobs.hive_job.query_list.queries' - - field: 'jobs.hive_job.script_variables' - - field: 'jobs.labels' - - field: 'jobs.pig_job.continue_on_failure' - - field: 'jobs.pig_job.jar_file_uris' - - field: 'jobs.pig_job.logging_config.driver_log_levels' - - field: 'jobs.pig_job.properties' - - field: 'jobs.pig_job.query_file_uri' - - field: 'jobs.pig_job.query_list.queries' - - field: 'jobs.pig_job.script_variables' - - field: 'jobs.prerequisite_step_ids' - - field: 'jobs.presto_job.client_tags' - - field: 'jobs.presto_job.continue_on_failure' - - field: 'jobs.presto_job.logging_config.driver_log_levels' - - field: 'jobs.presto_job.output_format' - - field: 'jobs.presto_job.properties' - - field: 'jobs.presto_job.query_file_uri' - - field: 'jobs.presto_job.query_list.queries' - - field: 'jobs.pyspark_job.archive_uris' - - field: 'jobs.pyspark_job.args' - - field: 'jobs.pyspark_job.file_uris' - - field: 'jobs.pyspark_job.jar_file_uris' - - field: 'jobs.pyspark_job.logging_config.driver_log_levels' - - field: 'jobs.pyspark_job.main_python_file_uri' - - field: 'jobs.pyspark_job.properties' - - field: 'jobs.pyspark_job.python_file_uris' - - field: 'jobs.scheduling.max_failures_per_hour' - - field: 'jobs.scheduling.max_failures_total' - - field: 'jobs.spark_job.archive_uris' - - field: 'jobs.spark_job.args' - - field: 'jobs.spark_job.file_uris' - - field: 'jobs.spark_job.jar_file_uris' - - field: 'jobs.spark_job.logging_config.driver_log_levels' - - field: 'jobs.spark_job.main_class' - - field: 'jobs.spark_job.main_jar_file_uri' - - field: 'jobs.spark_job.properties' - - field: 'jobs.spark_r_job.archive_uris' - - field: 'jobs.spark_r_job.args' - - field: 'jobs.spark_r_job.file_uris' - - field: 'jobs.spark_r_job.logging_config.driver_log_levels' - - field: 'jobs.spark_r_job.main_r_file_uri' - - field: 'jobs.spark_r_job.properties' - - field: 'jobs.spark_sql_job.jar_file_uris' - - field: 'jobs.spark_sql_job.logging_config.driver_log_levels' - - field: 'jobs.spark_sql_job.properties' - - field: 'jobs.spark_sql_job.query_file_uri' - - field: 'jobs.spark_sql_job.query_list.queries' - - field: 'jobs.spark_sql_job.script_variables' - - field: 'jobs.step_id' - - field: 'labels' - - field: 'location' - - field: 'name' - - field: 'parameters.description' - - field: 'parameters.fields' - - field: 'parameters.name' - - field: 'parameters.validation.regex.regexes' - - field: 'parameters.validation.values.values' - - field: 'placement.cluster_selector.cluster_labels' - - field: 'placement.cluster_selector.zone' - - field: 'placement.managed_cluster.cluster_name' - - field: 'placement.managed_cluster.config.autoscaling_config.policy' - - field: 'placement.managed_cluster.config.encryption_config.gce_pd_kms_key_name' - - field: 'placement.managed_cluster.config.endpoint_config.enable_http_port_access' - - field: 'placement.managed_cluster.config.endpoint_config.http_ports' - - field: 'placement.managed_cluster.config.gce_cluster_config.internal_ip_only' - - field: 'placement.managed_cluster.config.gce_cluster_config.metadata' - - field: 'placement.managed_cluster.config.gce_cluster_config.network' - - field: 'placement.managed_cluster.config.gce_cluster_config.node_group_affinity.node_group' - - field: 'placement.managed_cluster.config.gce_cluster_config.private_ipv6_google_access' - - field: 'placement.managed_cluster.config.gce_cluster_config.reservation_affinity.consume_reservation_type' - - field: 'placement.managed_cluster.config.gce_cluster_config.reservation_affinity.key' - - field: 'placement.managed_cluster.config.gce_cluster_config.reservation_affinity.values' - - field: 'placement.managed_cluster.config.gce_cluster_config.service_account' - - field: 'placement.managed_cluster.config.gce_cluster_config.service_account_scopes' - - field: 'placement.managed_cluster.config.gce_cluster_config.shielded_instance_config.enable_integrity_monitoring' - - field: 'placement.managed_cluster.config.gce_cluster_config.shielded_instance_config.enable_secure_boot' - - field: 'placement.managed_cluster.config.gce_cluster_config.shielded_instance_config.enable_vtpm' - - field: 'placement.managed_cluster.config.gce_cluster_config.subnetwork' - - field: 'placement.managed_cluster.config.gce_cluster_config.tags' - - field: 'placement.managed_cluster.config.gce_cluster_config.zone' -{{- if ne $.TargetVersionName "ga" }} - - field: 'placement.managed_cluster.config.gke_cluster_config.namespaced_gke_deployment_target.cluster_namespace' -{{- end }} -{{- if ne $.TargetVersionName "ga" }} - - field: 'placement.managed_cluster.config.gke_cluster_config.namespaced_gke_deployment_target.target_gke_cluster' -{{- end }} - - field: 'placement.managed_cluster.config.initialization_actions.executable_file' - - field: 'placement.managed_cluster.config.initialization_actions.execution_timeout' - - field: 'placement.managed_cluster.config.lifecycle_config.auto_delete_time' - - field: 'placement.managed_cluster.config.lifecycle_config.auto_delete_ttl' - - field: 'placement.managed_cluster.config.lifecycle_config.idle_delete_ttl' - - field: 'placement.managed_cluster.config.lifecycle_config.idle_start_time' - - field: 'placement.managed_cluster.config.master_config.accelerators.accelerator_count' - - field: 'placement.managed_cluster.config.master_config.accelerators.accelerator_type' - - field: 'placement.managed_cluster.config.master_config.disk_config.boot_disk_size_gb' - - field: 'placement.managed_cluster.config.master_config.disk_config.boot_disk_type' - - field: 'placement.managed_cluster.config.master_config.disk_config.num_local_ssds' - - field: 'placement.managed_cluster.config.master_config.image' - - field: 'placement.managed_cluster.config.master_config.instance_names' - - field: 'placement.managed_cluster.config.master_config.is_preemptible' - - field: 'placement.managed_cluster.config.master_config.machine_type' - - field: 'placement.managed_cluster.config.master_config.managed_group_config.instance_group_manager_name' - - field: 'placement.managed_cluster.config.master_config.managed_group_config.instance_template_name' - - field: 'placement.managed_cluster.config.master_config.min_cpu_platform' - - field: 'placement.managed_cluster.config.master_config.num_instances' - - field: 'placement.managed_cluster.config.master_config.preemptibility' -{{- if ne $.TargetVersionName "ga" }} - - field: 'placement.managed_cluster.config.metastore_config.dataproc_metastore_service' -{{- end }} - - field: 'placement.managed_cluster.config.secondary_worker_config.accelerators.accelerator_count' - - field: 'placement.managed_cluster.config.secondary_worker_config.accelerators.accelerator_type' - - field: 'placement.managed_cluster.config.secondary_worker_config.disk_config.boot_disk_size_gb' - - field: 'placement.managed_cluster.config.secondary_worker_config.disk_config.boot_disk_type' - - field: 'placement.managed_cluster.config.secondary_worker_config.disk_config.num_local_ssds' - - field: 'placement.managed_cluster.config.secondary_worker_config.image' - - field: 'placement.managed_cluster.config.secondary_worker_config.instance_names' - - field: 'placement.managed_cluster.config.secondary_worker_config.is_preemptible' - - field: 'placement.managed_cluster.config.secondary_worker_config.machine_type' - - field: 'placement.managed_cluster.config.secondary_worker_config.managed_group_config.instance_group_manager_name' - - field: 'placement.managed_cluster.config.secondary_worker_config.managed_group_config.instance_template_name' - - field: 'placement.managed_cluster.config.secondary_worker_config.min_cpu_platform' - - field: 'placement.managed_cluster.config.secondary_worker_config.num_instances' - - field: 'placement.managed_cluster.config.secondary_worker_config.preemptibility' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.cross_realm_trust_admin_server' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.cross_realm_trust_kdc' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.cross_realm_trust_realm' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.cross_realm_trust_shared_password' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.enable_kerberos' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.kdc_db_key' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.key_password' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.keystore' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.keystore_password' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.kms_key' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.realm' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.root_principal_password' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.tgt_lifetime_hours' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.truststore' - - field: 'placement.managed_cluster.config.security_config.kerberos_config.truststore_password' - - field: 'placement.managed_cluster.config.software_config.image_version' - - field: 'placement.managed_cluster.config.software_config.optional_components' - - field: 'placement.managed_cluster.config.software_config.properties' - - field: 'placement.managed_cluster.config.staging_bucket' - - field: 'placement.managed_cluster.config.temp_bucket' - - field: 'placement.managed_cluster.config.worker_config.accelerators.accelerator_count' - - field: 'placement.managed_cluster.config.worker_config.accelerators.accelerator_type' - - field: 'placement.managed_cluster.config.worker_config.disk_config.boot_disk_size_gb' - - field: 'placement.managed_cluster.config.worker_config.disk_config.boot_disk_type' - - field: 'placement.managed_cluster.config.worker_config.disk_config.num_local_ssds' - - field: 'placement.managed_cluster.config.worker_config.image' - - field: 'placement.managed_cluster.config.worker_config.instance_names' - - field: 'placement.managed_cluster.config.worker_config.is_preemptible' - - field: 'placement.managed_cluster.config.worker_config.machine_type' - - field: 'placement.managed_cluster.config.worker_config.managed_group_config.instance_group_manager_name' - - field: 'placement.managed_cluster.config.worker_config.managed_group_config.instance_template_name' - - field: 'placement.managed_cluster.config.worker_config.min_cpu_platform' - - field: 'placement.managed_cluster.config.worker_config.num_instances' - - field: 'placement.managed_cluster.config.worker_config.preemptibility' - - field: 'placement.managed_cluster.labels' - - field: 'project' - - field: 'terraform_labels' - provider_only: true - - field: 'update_time' - - field: 'version' diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_test.go.tmpl b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_test.go.tmpl index 0ee1ed7d883a..b6ea0fa6e3b8 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_test.go.tmpl @@ -75,33 +75,6 @@ func TestAccDataprocWorkflowTemplate_withShieldedVMs(t *testing.T) { }) } -func TestAccDataprocWorkflowTemplate_encryptionConfig(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - "project": envvar.GetTestProjectFromEnv(), - "version": "2.0.35-debian10", - "kms_key_name": acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-dataproc-workflow").CryptoKey.Name, - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: funcAccTestDataprocWorkflowTemplateCheckDestroy(t), - Steps: []resource.TestStep{ - { - Config: testAccDataprocWorkflowTemplate_encryptionConfig(context), - }, - { - ImportState: true, - ImportStateVerify: true, - ResourceName: "google_dataproc_workflow_template.template", - }, - }, - }) -} - func testAccDataprocWorkflowTemplate_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_dataproc_workflow_template" "template" { @@ -224,73 +197,6 @@ resource "google_dataproc_workflow_template" "shielded_vms_template" { `, context) } -func testAccDataprocWorkflowTemplate_encryptionConfig(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_dataproc_workflow_template" "template" { - name = "template%{random_suffix}" - location = "us-central1" - encryption_config { - kms_key = "%{kms_key_name}" - } - placement { - managed_cluster { - cluster_name = "my-cluster" - config { - gce_cluster_config { - zone = "us-central1-a" - tags = ["foo", "bar"] - } - master_config { - num_instances = 1 - machine_type = "n1-standard-1" - disk_config { - boot_disk_type = "pd-ssd" - boot_disk_size_gb = 15 - } - } - worker_config { - num_instances = 3 - machine_type = "n1-standard-2" - disk_config { - boot_disk_size_gb = 10 - num_local_ssds = 2 - } - } - - secondary_worker_config { - num_instances = 2 - } - software_config { - image_version = "%{version}" - } - } - } - } - jobs { - step_id = "someJob" - spark_job { - main_class = "SomeClass" - } - } - jobs { - step_id = "otherJob" - prerequisite_step_ids = ["someJob"] - presto_job { - query_file_uri = "someuri" - } - } - depends_on =[google_kms_crypto_key_iam_member.crypto_key] -} - -data "google_project" "project" {} -resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "%{kms_key_name}" - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:service-${data.google_project.project.number}@dataproc-accounts.iam.gserviceaccount.com" -} -`, context) -} - func funcAccTestDataprocWorkflowTemplateCheckDestroy(t *testing.T) func(s *terraform.State) error { return func(s *terraform.State) error { for name, rs := range s.RootModule().Resources { diff --git a/mmv1/third_party/terraform/services/dns/resource_dns_managed_zone_test.go.tmpl b/mmv1/third_party/terraform/services/dns/resource_dns_managed_zone_test.go.tmpl index e78109484d22..37b7f7656c91 100644 --- a/mmv1/third_party/terraform/services/dns/resource_dns_managed_zone_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dns/resource_dns_managed_zone_test.go.tmpl @@ -661,113 +661,3 @@ resource "google_dns_managed_zone" "foobar" { } `, suffix, suffix, description, project) } - -{{ if not (or (eq $.TargetVersionName ``) (eq $.TargetVersionName `ga`)) }} -func TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDNSManagedZone_dnsManagedZoneWithServiceDirectory(context), - }, - { - ResourceName: "google_dns_managed_zone.sd-zone", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, - }, - { - Config: testAccDNSManagedZone_dnsManagedZoneWithServiceDirectoryUpdate(context), - }, - { - ResourceName: "google_dns_managed_zone.sd-zone", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, - }, - }, - }) -} - -func testAccDNSManagedZone_dnsManagedZoneWithServiceDirectory(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_dns_managed_zone" "sd-zone" { - provider = google-beta - - name = "tf-test-peering-zone%{random_suffix}" - dns_name = "services.example.com." - description = "Example private DNS Service Directory zone" - - visibility = "private" - - service_directory_config { - namespace { - namespace_url = google_service_directory_namespace.example.id - } - } -} - -resource "google_service_directory_namespace" "example" { - provider = google-beta - - namespace_id = "tf-test-example%{random_suffix}" - location = "us-central1" -} - -resource "google_compute_network" "network" { - provider = google-beta - - name = "tf-test-network%{random_suffix}" - auto_create_subnetworks = false -} -`, context) -} - -func testAccDNSManagedZone_dnsManagedZoneWithServiceDirectoryUpdate(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_dns_managed_zone" "sd-zone" { - provider = google-beta - - name = "tf-test-peering-zone%{random_suffix}" - dns_name = "services.example.com." - description = "Example private DNS Service Directory zone" - - visibility = "private" - - private_visibility_config { - networks { - network_url = google_compute_network.network.id - } - } - - service_directory_config { - namespace { - namespace_url = google_service_directory_namespace.example.id - } - } -} - -resource "google_service_directory_namespace" "example" { - provider = google-beta - - namespace_id = "tf-test-example%{random_suffix}" - location = "us-central1" -} - -resource "google_compute_network" "network" { - provider = google-beta - - name = "tf-test-network%{random_suffix}" - auto_create_subnetworks = false -} -`, context) -} -{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/dns/resource_dns_record_set_meta.yaml.tmpl b/mmv1/third_party/terraform/services/dns/resource_dns_record_set_meta.yaml.tmpl index 6d40e570636c..80ecb660dbc7 100644 --- a/mmv1/third_party/terraform/services/dns/resource_dns_record_set_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/dns/resource_dns_record_set_meta.yaml.tmpl @@ -7,52 +7,3 @@ api_version: 'v1beta2' api_version: 'v1' {{- end }} api_resource_type_kind: 'ResourceRecordSet' -fields: - - field: 'managed_zone' - - field: 'name' - - field: 'project' - - field: 'routing_policy.enable_geo_fencing' - - field: 'routing_policy.geo.health_checked_targets.external_endpoints' - - field: 'routing_policy.geo.health_checked_targets.internal_load_balancers.ip_address' - - field: 'routing_policy.geo.health_checked_targets.internal_load_balancers.ip_protocol' - - field: 'routing_policy.geo.health_checked_targets.internal_load_balancers.load_balancer_type' - - field: 'routing_policy.geo.health_checked_targets.internal_load_balancers.network_url' - - field: 'routing_policy.geo.health_checked_targets.internal_load_balancers.port' - - field: 'routing_policy.geo.health_checked_targets.internal_load_balancers.project' - - field: 'routing_policy.geo.health_checked_targets.internal_load_balancers.region' - - field: 'routing_policy.geo.location' - - field: 'routing_policy.geo.rrdatas' - - field: 'routing_policy.health_check' - - field: 'routing_policy.primary_backup.backup_geo.health_checked_targets.external_endpoints' - - field: 'routing_policy.primary_backup.backup_geo.health_checked_targets.internal_load_balancers.ip_address' - - field: 'routing_policy.primary_backup.backup_geo.health_checked_targets.internal_load_balancers.ip_protocol' - - field: 'routing_policy.primary_backup.backup_geo.health_checked_targets.internal_load_balancers.load_balancer_type' - - field: 'routing_policy.primary_backup.backup_geo.health_checked_targets.internal_load_balancers.network_url' - - field: 'routing_policy.primary_backup.backup_geo.health_checked_targets.internal_load_balancers.port' - - field: 'routing_policy.primary_backup.backup_geo.health_checked_targets.internal_load_balancers.project' - - field: 'routing_policy.primary_backup.backup_geo.health_checked_targets.internal_load_balancers.region' - - field: 'routing_policy.primary_backup.backup_geo.location' - - field: 'routing_policy.primary_backup.backup_geo.rrdatas' - - field: 'routing_policy.primary_backup.enable_geo_fencing_for_backups' - - field: 'routing_policy.primary_backup.primary.external_endpoints' - - field: 'routing_policy.primary_backup.primary.internal_load_balancers.ip_address' - - field: 'routing_policy.primary_backup.primary.internal_load_balancers.ip_protocol' - - field: 'routing_policy.primary_backup.primary.internal_load_balancers.load_balancer_type' - - field: 'routing_policy.primary_backup.primary.internal_load_balancers.network_url' - - field: 'routing_policy.primary_backup.primary.internal_load_balancers.port' - - field: 'routing_policy.primary_backup.primary.internal_load_balancers.project' - - field: 'routing_policy.primary_backup.primary.internal_load_balancers.region' - - field: 'routing_policy.primary_backup.trickle_ratio' - - field: 'routing_policy.wrr.health_checked_targets.external_endpoints' - - field: 'routing_policy.wrr.health_checked_targets.internal_load_balancers.ip_address' - - field: 'routing_policy.wrr.health_checked_targets.internal_load_balancers.ip_protocol' - - field: 'routing_policy.wrr.health_checked_targets.internal_load_balancers.load_balancer_type' - - field: 'routing_policy.wrr.health_checked_targets.internal_load_balancers.network_url' - - field: 'routing_policy.wrr.health_checked_targets.internal_load_balancers.port' - - field: 'routing_policy.wrr.health_checked_targets.internal_load_balancers.project' - - field: 'routing_policy.wrr.health_checked_targets.internal_load_balancers.region' - - field: 'routing_policy.wrr.rrdatas' - - field: 'routing_policy.wrr.weight' - - field: 'rrdatas' - - field: 'ttl' - - field: 'type' diff --git a/mmv1/third_party/terraform/services/eventarc/eventarc_utils.go b/mmv1/third_party/terraform/services/eventarc/eventarc_utils.go deleted file mode 100644 index 47290cfd24ac..000000000000 --- a/mmv1/third_party/terraform/services/eventarc/eventarc_utils.go +++ /dev/null @@ -1,51 +0,0 @@ -package eventarc - -import ( - "fmt" - "strings" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -func expandToLongForm(pattern string, v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if strings.HasPrefix(v.(string), "projects/") || v.(string) == "" { - // If empty or the long-form input is provided, send it as-is. - return v, nil - } - - // Otherwise, extract the project, and accept long-form inputs. - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, err - } - parts := strings.Split(project, "/") - project = parts[len(parts)-1] - - return fmt.Sprintf(pattern, project, v.(string)), nil -} - -func expandToRegionalLongForm(pattern string, v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if strings.HasPrefix(v.(string), "projects/") || v.(string) == "" { - // If empty or the long-form input is provided, send it as-is. - return v, nil - } - - // Otherwise, extract the project, and accept long-form inputs. - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, err - } - parts := strings.Split(project, "/") - project = parts[len(parts)-1] - - // Extract the location, and accept long-form inputs. - location, err := tpgresource.GetLocation(d, config) - if err != nil { - return nil, err - } - parts = strings.Split(location, "/") - location = parts[len(parts)-1] - - return fmt.Sprintf(pattern, project, location, v.(string)), nil -} diff --git a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_meta.yaml b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_meta.yaml index 9cd0a7ad1eda..5a85e593fca1 100644 --- a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_meta.yaml +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_meta.yaml @@ -3,15 +3,3 @@ generation_type: 'dcl' api_service_name: 'eventarc.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Channel' -fields: - - field: 'activation_token' - - field: 'create_time' - - field: 'crypto_key_name' - - field: 'location' - - field: 'name' - - field: 'project' - - field: 'pubsub_topic' - - field: 'state' - - field: 'third_party_provider' - - field: 'uid' - - field: 'update_time' diff --git a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_meta.yaml b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_meta.yaml index 882c45e1d75a..f7a2801a2eb2 100644 --- a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_meta.yaml +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_meta.yaml @@ -3,9 +3,3 @@ generation_type: 'dcl' api_service_name: 'eventarc.googleapis.com' api_version: 'v1' api_resource_type_kind: 'GoogleChannelConfig' -fields: - - field: 'crypto_key_name' - - field: 'location' - - field: 'name' - - field: 'project' - - field: 'update_time' diff --git a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_meta.yaml b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_meta.yaml new file mode 100644 index 000000000000..c32ae3d26500 --- /dev/null +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_eventarc_trigger' +generation_type: 'dcl' +api_service_name: 'eventarc.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Trigger' diff --git a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go deleted file mode 100644 index 1beaeb9b1df5..000000000000 --- a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go +++ /dev/null @@ -1,413 +0,0 @@ -package eventarc_test - -import ( - "testing" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccEventarcTrigger_BasicHandWritten(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "region": envvar.GetTestRegionFromEnv(), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckEventarcTriggerDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccEventarcTrigger_BasicHandWritten(context), - }, - { - ResourceName: "google_eventarc_trigger.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, - }, - { - Config: testAccEventarcTrigger_BasicHandWrittenUpdate0(context), - }, - { - ResourceName: "google_eventarc_trigger.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, - }, - { - Config: testAccEventarcTrigger_BasicHandWrittenUpdate1(context), - }, - { - ResourceName: "google_eventarc_trigger.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, - }, - }, - }) -} - -func testAccEventarcTrigger_BasicHandWritten(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_eventarc_trigger" "primary" { - name = "tf-test-name%{random_suffix}" - location = "europe-west1" - matching_criteria { - attribute = "type" - value = "google.cloud.pubsub.topic.v1.messagePublished" - } - destination { - cloud_run_service { - service = google_cloud_run_service.default.name - region = "europe-west1" - } - } - labels = { - foo = "bar" - } -} - -resource "google_pubsub_topic" "foo" { - name = "tf-test-topic%{random_suffix}" -} - -resource "google_cloud_run_service" "default" { - name = "tf-test-eventarc-service%{random_suffix}" - location = "europe-west1" - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - traffic { - percent = 100 - latest_revision = true - } -} - -`, context) -} - -func testAccEventarcTrigger_BasicHandWrittenUpdate0(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_eventarc_trigger" "primary" { - name = "tf-test-name%{random_suffix}" - location = "europe-west1" - matching_criteria { - attribute = "type" - value = "google.cloud.pubsub.topic.v1.messagePublished" - } - destination { - cloud_run_service { - service = google_cloud_run_service.default.name - region = "europe-west1" - } - } - transport { - pubsub { - topic = google_pubsub_topic.foo.id - } - } -} - -resource "google_pubsub_topic" "foo" { - name = "tf-test-topic%{random_suffix}" -} - -resource "google_cloud_run_service" "default" { - name = "tf-test-eventarc-service%{random_suffix}" - location = "europe-west1" - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - traffic { - percent = 100 - latest_revision = true - } -} - -resource "google_cloud_run_service" "default2" { - name = "tf-test-eventarc-service%{random_suffix}2" - location = "europe-north1" - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - traffic { - percent = 100 - latest_revision = true - } -} - -`, context) -} - -func testAccEventarcTrigger_BasicHandWrittenUpdate1(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_eventarc_trigger" "primary" { - name = "tf-test-name%{random_suffix}" - location = "europe-west1" - matching_criteria { - attribute = "type" - value = "google.cloud.pubsub.topic.v1.messagePublished" - } - destination { - cloud_run_service { - service = google_cloud_run_service.default2.name - region = "europe-north1" - } - } - transport { - pubsub { - topic = google_pubsub_topic.foo.id - } - } - labels = { - foo = "bar" - } - service_account = google_service_account.eventarc-sa.email -} - -resource "google_service_account" "eventarc-sa" { - account_id = "tf-test-sa%{random_suffix}" - display_name = "Test Service Account" -} - -resource "google_pubsub_topic" "foo" { - name = "tf-test-topic%{random_suffix}" -} - -resource "google_cloud_run_service" "default" { - name = "tf-test-eventarc-service%{random_suffix}" - location = "europe-west1" - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - traffic { - percent = 100 - latest_revision = true - } -} - -resource "google_cloud_run_service" "default2" { - name = "tf-test-eventarc-service%{random_suffix}2" - location = "europe-north1" - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - traffic { - percent = 100 - latest_revision = true - } -} - -`, context) -} - -func TestAccEventarcTrigger_AlternateForm(t *testing.T) { - t.Parallel() - - region := envvar.GetTestRegionFromEnv() - - context := map[string]interface{}{ - "region": region, - "project_name": envvar.GetTestProjectFromEnv(), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckEventarcTriggerDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccEventarcTrigger_AlternateForm(context), - }, - { - ResourceName: "google_eventarc_trigger.primary", - ImportState: true, - ImportStateVerify: true, - // This tests the long-form for name, location, and project, and the short-form for transport.pubsub.topic - ImportStateVerifyIgnore: []string{"name", "location", "project", "transport.0.pubsub.0.topic"}, - }, - }, - }) -} - -func testAccEventarcTrigger_AlternateForm(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_pubsub_topic" "foo" { - name = "tf-test-topic%{random_suffix}" -} - -resource "google_cloud_run_service" "default" { - name = "tf-test-eventarc-service%{random_suffix}" - location = "%{region}" - template { - spec { - containers { - image = "gcr.io/cloudrun/hello" - ports { - container_port = 8080 - } - } - container_concurrency = 50 - timeout_seconds = 100 - } - } - traffic { - percent = 100 - latest_revision = true - } -} - -resource "google_eventarc_trigger" "primary" { - name = "projects/%{project_name}/locations/%{region}/triggers/tf-test-trigger%{random_suffix}" - project = "projects/%{project_name}" - location = "long/form/%{region}" - matching_criteria { - attribute = "type" - value = "google.cloud.pubsub.topic.v1.messagePublished" - } - destination { - cloud_run_service { - service = google_cloud_run_service.default.name - region = "%{region}" - } - } - transport { - pubsub { - topic = "tf-test-topic%{random_suffix}" - } - } - depends_on = [google_cloud_run_service.default, google_pubsub_topic.foo] -} -`, context) -} - -func TestAccEventarcTrigger_ShortFormWorkflow(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "project_name": envvar.GetTestProjectFromEnv(), - "service_account": envvar.GetTestServiceAccountFromEnv(t), - "region": envvar.GetTestRegionFromEnv(), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckEventarcTriggerDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccEventarcTrigger_ShortFormWorkflow(context), - }, - { - ResourceName: "google_eventarc_trigger.primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, - }, - }, - }) -} - -func testAccEventarcTrigger_ShortFormWorkflow(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_eventarc_trigger" "primary" { - name = "tf-test-name%{random_suffix}" - location = "%{region}" - matching_criteria { - attribute = "type" - value = "google.cloud.pubsub.topic.v1.messagePublished" - } - destination { - workflow = "tf-test-eventarc-workflow%{random_suffix}" - } - service_account = "%{service_account}" - depends_on = [google_workflows_workflow.example] -} - -resource "google_workflows_workflow" "example" { - name = "tf-test-eventarc-workflow%{random_suffix}" - deletion_protection = false - region = "%{region}" - source_contents = <<-EOF - # This is a sample workflow, feel free to replace it with your source code - # - # This workflow does the following: - # - reads current time and date information from an external API and stores - # the response in CurrentDateTime variable - # - retrieves a list of Wikipedia articles related to the day of the week - # from CurrentDateTime - # - returns the list of articles as an output of the workflow - # FYI, In terraform you need to escape the $$ or it will cause errors. - - - getCurrentTime: - call: http.get - args: - url: $${sys.get_env("url")} - result: CurrentDateTime - - readWikipedia: - call: http.get - args: - url: https://en.wikipedia.org/w/api.php - query: - action: opensearch - search: $${CurrentDateTime.body.dayOfTheWeek} - result: WikiResult - - returnOutput: - return: $${WikiResult.body[1]} -EOF -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go.tmpl b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go.tmpl new file mode 100644 index 000000000000..38dc347569ce --- /dev/null +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_test.go.tmpl @@ -0,0 +1,239 @@ +package eventarc_test + +import ( + "context" + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + + dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl" + eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc{{ $.DCLVersion }}" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" +) + + +func TestAccEventarcTrigger_channel(t *testing.T) { + t.Parallel() + + region := envvar.GetTestRegionFromEnv() + key1 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-trigger-key1") + key2 := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", region, "tf-bootstrap-eventarc-trigger-key2") + + context := map[string]interface{}{ + "region": region, + "project_name": envvar.GetTestProjectFromEnv(), + "service_account": envvar.GetTestServiceAccountFromEnv(t), + "key_ring": tpgresource.GetResourceNameFromSelfLink(key1.KeyRing.Name), + "key1": tpgresource.GetResourceNameFromSelfLink(key1.CryptoKey.Name), + "key2": tpgresource.GetResourceNameFromSelfLink(key2.CryptoKey.Name), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckEventarcChannelTriggerDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccEventarcTrigger_createTriggerWithChannelName(context), + }, + { + ResourceName: "google_eventarc_trigger.primary", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccEventarcTrigger_HttpDest(t *testing.T) { + t.Parallel() + + region := envvar.GetTestRegionFromEnv() + + testNetworkName := acctest.BootstrapSharedTestNetwork(t, "attachment-network") + subnetName := acctest.BootstrapSubnet(t, "tf-test-subnet", testNetworkName) + networkAttachmentName := acctest.BootstrapNetworkAttachment(t, "tf-test-attachment", subnetName) + + // Need to have the full network attachment name in the format project/{project_id}/regions/{region_id}/networkAttachments/{networkAttachmentName} + fullFormNetworkAttachmentName := fmt.Sprintf("projects/%s/regions/%s/networkAttachments/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), networkAttachmentName) + + context := map[string]interface{}{ + "region": region, + "project_name": envvar.GetTestProjectFromEnv(), + "service_account": envvar.GetTestServiceAccountFromEnv(t), + "network_attachment": fullFormNetworkAttachmentName, + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckEventarcChannelTriggerDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccEventarcTrigger_createTriggerWithHttpDest(context), + }, + { + ResourceName: "google_eventarc_trigger.primary", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccEventarcTrigger_createTriggerWithChannelName(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_project" "test_project" { + project_id = "%{project_name}" +} + +data "google_kms_key_ring" "test_key_ring" { + name = "%{key_ring}" + location = "us-central1" +} + +data "google_kms_crypto_key" "key1" { + name = "%{key1}" + key_ring = data.google_kms_key_ring.test_key_ring.id +} + + +resource "google_kms_crypto_key_iam_member" "key1_member" { + crypto_key_id = data.google_kms_crypto_key.key1.id + role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" + + member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com" +} + +resource "google_eventarc_channel" "test_channel" { + location = "%{region}" + name = "tf-test-channel%{random_suffix}" + crypto_key_name = data.google_kms_crypto_key.key1.id + third_party_provider = "projects/${data.google_project.test_project.project_id}/locations/%{region}/providers/datadog" + depends_on = [google_kms_crypto_key_iam_member.key1_member] +} + +resource "google_cloud_run_service" "default" { + name = "tf-test-eventarc-service%{random_suffix}" + location = "%{region}" + + metadata { + namespace = "%{project_name}" + } + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + ports { + container_port = 8080 + } + } + container_concurrency = 50 + timeout_seconds = 100 + } + } + + traffic { + percent = 100 + latest_revision = true + } +} + +resource "google_eventarc_trigger" "primary" { + name = "tf-test-trigger%{random_suffix}" + location = "%{region}" + matching_criteria { + attribute = "type" + value = "datadog.v1.alert" + } + destination { + cloud_run_service { + service = google_cloud_run_service.default.name + region = "%{region}" + } + } + service_account = "%{service_account}" + + channel = "projects/${data.google_project.test_project.project_id}/locations/%{region}/channels/${google_eventarc_channel.test_channel.name}" + + depends_on = [google_cloud_run_service.default,google_eventarc_channel.test_channel] +} +`, context) +} + +func testAccEventarcTrigger_createTriggerWithHttpDest(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_project" "test_project" { + project_id = "%{project_name}" +} + +resource "google_eventarc_trigger" "primary" { + name = "tf-test-trigger%{random_suffix}" + location = "%{region}" + matching_criteria { + attribute = "type" + value = "google.cloud.pubsub.topic.v1.messagePublished" + } + destination { + http_endpoint { + uri = "http://10.10.10.8:80/route" + } + network_config { + network_attachment = "%{network_attachment}" + } + + } + service_account = "%{service_account}" + +} +`, context) +} + +func testAccCheckEventarcChannelTriggerDestroyProducer(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "rs.google_eventarc_trigger" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := acctest.GoogleProviderConfig(t) + + billingProject := "" + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + obj := &eventarc.Trigger{ + Location: dcl.String(rs.Primary.Attributes["location"]), + Name: dcl.String(rs.Primary.Attributes["name"]), + Project: dcl.StringOrNil(rs.Primary.Attributes["project"]), + ServiceAccount: dcl.String(rs.Primary.Attributes["service_account"]), + CreateTime: dcl.StringOrNil(rs.Primary.Attributes["create_time"]), + Etag: dcl.StringOrNil(rs.Primary.Attributes["etag"]), + Uid: dcl.StringOrNil(rs.Primary.Attributes["uid"]), + UpdateTime: dcl.StringOrNil(rs.Primary.Attributes["update_time"]), + Channel: dcl.StringOrNil(rs.Primary.Attributes["channel"]), + EventDataContentType: dcl.StringOrNil(rs.Primary.Attributes["event_data_content_type"]), + } + + client := transport_tpg.NewDCLEventarcClient(config, config.UserAgent, billingProject, 0) + _, err := client.GetTrigger(context.Background(), obj) + if err == nil { + return fmt.Errorf("google_eventarc_trigger still exists %v", obj) + } + } + return nil + } +} diff --git a/mmv1/third_party/terraform/services/filestore/resource_filestore_backup_test.go b/mmv1/third_party/terraform/services/filestore/resource_filestore_backup_test.go index d71056bf39d0..e0c46683257e 100644 --- a/mmv1/third_party/terraform/services/filestore/resource_filestore_backup_test.go +++ b/mmv1/third_party/terraform/services/filestore/resource_filestore_backup_test.go @@ -12,8 +12,8 @@ import ( func TestAccFilestoreBackup_update(t *testing.T) { t.Parallel() - instName := fmt.Sprintf("tf-test-fs-inst-%d", acctest.RandInt(t)) - bkupName := fmt.Sprintf("tf-test-fs-bkup-%d", acctest.RandInt(t)) + instName := fmt.Sprintf("tf-fs-inst-%d", acctest.RandInt(t)) + bkupName := fmt.Sprintf("tf-fs-bkup-%d", acctest.RandInt(t)) acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -119,8 +119,8 @@ func TestAccFilestoreBackup_tags(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - instanceName := fmt.Sprintf("tf-test-fs-inst-%d", acctest.RandInt(t)) - backupName := fmt.Sprintf("tf-test-fs-bkup-%d", acctest.RandInt(t)) + instanceName := fmt.Sprintf("tf-fs-inst-%d", acctest.RandInt(t)) + backupName := fmt.Sprintf("tf-fs-bkup-%d", acctest.RandInt(t)) tagKey := acctest.BootstrapSharedTestTagKey(t, "filestore-backups-tagkey") tagValue := acctest.BootstrapSharedTestTagValue(t, "filestore-backups-tagvalue", tagKey) diff --git a/mmv1/third_party/terraform/services/filestore/resource_filestore_instance_test.go b/mmv1/third_party/terraform/services/filestore/resource_filestore_instance_test.go index f30931e7a1f5..c5a2b7098cc9 100644 --- a/mmv1/third_party/terraform/services/filestore/resource_filestore_instance_test.go +++ b/mmv1/third_party/terraform/services/filestore/resource_filestore_instance_test.go @@ -6,10 +6,10 @@ import ( "reflect" "testing" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" "github.com/hashicorp/terraform-provider-google/google/services/filestore" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func testResourceFilestoreInstanceStateDataV0() map[string]interface{} { @@ -409,125 +409,3 @@ resource "google_filestore_instance" "instance" { } `, name, location, tier) } - -func TestAccFilestoreInstance_tags(t *testing.T) { - t.Parallel() - name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - org := envvar.GetTestOrgFromEnv(t) - tagKey := acctest.BootstrapSharedTestTagKey(t, "filestore-instances-tagkey") - tagValue := acctest.BootstrapSharedTestTagValue(t, "filestore-instances-tagvalue", tagKey) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckFilestoreInstanceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccFileInstanceTags(name, map[string]string{org + "/" + tagKey: tagValue}), - }, - { - ResourceName: "google_filestore_instance.instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zone", "location", "networks.0.reserved_ip_range", "tags"}, - }, - }, - }) -} - -func testAccFileInstanceTags(name string, tags map[string]string) string { - r := fmt.Sprintf(` -resource "google_filestore_instance" "instance" { - name = "tf-test-instance-%s" - zone = "us-central1-b" - tier = "BASIC_HDD" - file_shares { - capacity_gb = 1024 - name = "share1" - } - networks { - network = "default" - modes = ["MODE_IPV4"] - reserved_ip_range = "172.19.31.8/29" - } -tags = {`, name) - - l := "" - for key, value := range tags { - l += fmt.Sprintf("%q = %q\n", key, value) - } - - l += fmt.Sprintf("}\n}") - return r + l -} - -func TestAccFilestoreInstance_replication(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - "location_1": "us-east1", - "location_2": "us-west1", - "tier": "ENTERPRISE", - } - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckFilestoreInstanceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccFilestoreInstance_replication(context), - }, - { - ResourceName: "google_filestore_instance.replica-instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zone", "initial_replication"}, - }, - }, - }) -} - -func testAccFilestoreInstance_replication(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_filestore_instance" "instance" { - name = "tf-test-instance-%{random_suffix}" - location = "%{location_1}" - tier = "%{tier}" - description = "An instance created during testing." - - file_shares { - capacity_gb = 1024 - name = "share" - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - } -} - -resource "google_filestore_instance" "replica-instance" { - name = "tf-test-instance-%{random_suffix}" - location = "%{location_2}" - tier = "%{tier}" - description = "An replica instance created during testing." - - file_shares { - capacity_gb = 1024 - name = "share" - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - } - - initial_replication { - replicas { - peer_instance = google_filestore_instance.instance.id - } - } -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/firebasedataconnect/resource_firebase_data_connect_service_test.go b/mmv1/third_party/terraform/services/firebasedataconnect/resource_firebase_data_connect_service_test.go deleted file mode 100644 index 65c07aec3f8c..000000000000 --- a/mmv1/third_party/terraform/services/firebasedataconnect/resource_firebase_data_connect_service_test.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package firebasedataconnect_test - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" -) - -func TestAccFirebaseDataConnectService_Update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "project_id": envvar.GetTestProjectFromEnv(), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckFirebaseDataConnectServiceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccFirebaseDataConnectService_update(context, "Original display name"), - }, - { - ResourceName: "google_firebase_data_connect_service.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"annotations", "labels", "location", "service_id", "terraform_labels"}, - }, - { - Config: testAccFirebaseDataConnectService_update(context, "Updated display name"), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_firebase_data_connect_service.default", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_firebase_data_connect_service.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"annotations", "labels", "location", "service_id", "terraform_labels"}, - }, - }, - }) -} - -// TODO(b/394642094): Cover force deletion once it's supported -func testAccFirebaseDataConnectService_update(context map[string]interface{}, display_name string) string { - context["display_name"] = display_name - return acctest.Nprintf(` -# Enable Firebase Data Connect API -resource "google_project_service" "fdc" { - project = "%{project_id}" - service = "firebasedataconnect.googleapis.com" - disable_on_destroy = false -} - -# Create an FDC service -resource "google_firebase_data_connect_service" "default" { - project = "%{project_id}" - location = "us-central1" - service_id = "tf-fdc-%{random_suffix}" - display_name = "%{display_name}" - - depends_on = [google_project_service.fdc] -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_release_meta.yaml b/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_release_meta.yaml index 38461ceaee97..aa64cff5f49f 100644 --- a/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_release_meta.yaml +++ b/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_release_meta.yaml @@ -3,10 +3,3 @@ generation_type: 'dcl' api_service_name: 'firebaserules.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Release' -fields: - - field: 'create_time' - - field: 'disabled' - - field: 'name' - - field: 'project' - - field: 'ruleset_name' - - field: 'update_time' diff --git a/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_ruleset_meta.yaml b/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_ruleset_meta.yaml index ad8e4f1065ef..d83f53f09153 100644 --- a/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_ruleset_meta.yaml +++ b/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_ruleset_meta.yaml @@ -3,12 +3,3 @@ generation_type: 'dcl' api_service_name: 'firebaserules.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Ruleset' -fields: - - field: 'create_time' - - field: 'metadata.services' - - field: 'name' - - field: 'project' - - field: 'source.files.content' - - field: 'source.files.fingerprint' - - field: 'source.files.name' - - field: 'source.language' diff --git a/mmv1/third_party/terraform/services/gemini/iam_gemini_repository_group_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/iam_gemini_repository_group_test.go.tmpl index acfc4fdb9a3d..97f2c7a51308 100644 --- a/mmv1/third_party/terraform/services/gemini/iam_gemini_repository_group_test.go.tmpl +++ b/mmv1/third_party/terraform/services/gemini/iam_gemini_repository_group_test.go.tmpl @@ -1,4 +1,5 @@ package gemini_test +{{- if ne $.TargetVersionName "ga" }} import ( "fmt" @@ -15,24 +16,24 @@ import ( func TestAccGeminiRepositoryGroupIamBinding(t *testing.T) { location := "us-central1" - codeRepositoryIndexId := acctest.BootstrapSharedCodeRepositoryIndex(t, "basic", location, "", map[string]string{"ccfe_debug_note": "terraform_e2e_do_not_delete"}) + codeRepositoryIndexId := acctest.BootstrapSharedCodeRepositoryIndex(t, "basic", location, "", map[string]string{"ccfe_debug_note": "terraform_e2e_should_be_deleted"}) developerConnectionId := acctest.BootstrapDeveloperConnection(t, "basic", location, "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648) gitRepositoryLinkId := acctest.BootstrapGitRepository(t, "basic", location, "https://github.com/CC-R-github-robot/tf-test.git", developerConnectionId) repositoryGroupId := "tf-test-iam-repository-group-id-" + acctest.RandString(t, 10) context := map[string]interface{}{ - "role": "roles/cloudaicompanion.repositoryGroupsUser", - "code_repository_index": codeRepositoryIndexId, - "location": location, - "project": envvar.GetTestProjectFromEnv(), - "connection_id": developerConnectionId, - "git_link_id": gitRepositoryLinkId, - "repository_group_id": repositoryGroupId, + "role": "roles/cloudaicompanion.repositoryGroupsUser", + "code_repository_index": codeRepositoryIndexId, + "location": location, + "project": envvar.GetTestProjectFromEnv(), + "connection_id": developerConnectionId, + "git_link_id": gitRepositoryLinkId, + "repository_group_id": repositoryGroupId, } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccGeminiRepositoryGroupIamBinding_basic(context), @@ -59,24 +60,24 @@ func TestAccGeminiRepositoryGroupIamBinding(t *testing.T) { func TestAccGeminiRepositoryGroupIamMember(t *testing.T) { location := "us-central1" - codeRepositoryIndexId := acctest.BootstrapSharedCodeRepositoryIndex(t, "basic", location, "", map[string]string{"ccfe_debug_note": "terraform_e2e_do_not_delete"}) + codeRepositoryIndexId := acctest.BootstrapSharedCodeRepositoryIndex(t, "basic", location, "", map[string]string{"ccfe_debug_note": "terraform_e2e_should_be_deleted"}) developerConnectionId := acctest.BootstrapDeveloperConnection(t, "basic", location, "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648) gitRepositoryLinkId := acctest.BootstrapGitRepository(t, "basic", location, "https://github.com/CC-R-github-robot/tf-test.git", developerConnectionId) repositoryGroupId := "tf-test-iam-repository-group-id-" + acctest.RandString(t, 10) context := map[string]interface{}{ - "role": "roles/cloudaicompanion.repositoryGroupsUser", - "code_repository_index": codeRepositoryIndexId, - "location": location, - "project": envvar.GetTestProjectFromEnv(), - "connection_id": developerConnectionId, - "git_link_id": gitRepositoryLinkId, - "repository_group_id": repositoryGroupId, + "role": "roles/cloudaicompanion.repositoryGroupsUser", + "code_repository_index": codeRepositoryIndexId, + "location": location, + "project": envvar.GetTestProjectFromEnv(), + "connection_id": developerConnectionId, + "git_link_id": gitRepositoryLinkId, + "repository_group_id": repositoryGroupId, } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { // Test Iam Member creation (no update for member, no need to test) @@ -94,24 +95,24 @@ func TestAccGeminiRepositoryGroupIamMember(t *testing.T) { func TestAccGeminiRepositoryGroupIamPolicy(t *testing.T) { location := "us-central1" - codeRepositoryIndexId := acctest.BootstrapSharedCodeRepositoryIndex(t, "basic", location, "", map[string]string{"ccfe_debug_note": "terraform_e2e_do_not_delete"}) + codeRepositoryIndexId := acctest.BootstrapSharedCodeRepositoryIndex(t, "basic", location, "", map[string]string{"ccfe_debug_note": "terraform_e2e_should_be_deleted"}) developerConnectionId := acctest.BootstrapDeveloperConnection(t, "basic", location, "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648) gitRepositoryLinkId := acctest.BootstrapGitRepository(t, "basic", location, "https://github.com/CC-R-github-robot/tf-test.git", developerConnectionId) repositoryGroupId := "tf-test-iam-repository-group-id-" + acctest.RandString(t, 10) context := map[string]interface{}{ - "role": "roles/cloudaicompanion.repositoryGroupsUser", - "code_repository_index": codeRepositoryIndexId, - "location": location, - "project": envvar.GetTestProjectFromEnv(), - "connection_id": developerConnectionId, - "git_link_id": gitRepositoryLinkId, - "repository_group_id": repositoryGroupId, + "role": "roles/cloudaicompanion.repositoryGroupsUser", + "code_repository_index": codeRepositoryIndexId, + "location": location, + "project": envvar.GetTestProjectFromEnv(), + "connection_id": developerConnectionId, + "git_link_id": gitRepositoryLinkId, + "repository_group_id": repositoryGroupId, } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccGeminiRepositoryGroupIamPolicy_basic(context), @@ -139,6 +140,7 @@ func TestAccGeminiRepositoryGroupIamPolicy(t *testing.T) { func testAccGeminiRepositoryGroupIamMember_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_gemini_repository_group_iam_member" "foo" { + provider = google-beta project = "%{project}" location = "%{location}" code_repository_index = "%{code_repository_index}" @@ -148,6 +150,7 @@ resource "google_gemini_repository_group_iam_member" "foo" { } resource "google_gemini_repository_group" "example" { + provider = google-beta location = "us-central1" code_repository_index = "%{code_repository_index}" repository_group_id = "%{repository_group_id}" @@ -163,6 +166,7 @@ resource "google_gemini_repository_group" "example" { func testAccGeminiRepositoryGroupIamPolicy_basic(context map[string]interface{}) string { return acctest.Nprintf(` data "google_iam_policy" "foo" { + provider = google-beta binding { role = "%{role}" members = ["user:admin@hashicorptest.com"] @@ -170,6 +174,7 @@ data "google_iam_policy" "foo" { } resource "google_gemini_repository_group_iam_policy" "foo" { + provider = google-beta project = "%{project}" location = "%{location}" code_repository_index = "%{code_repository_index}" @@ -178,6 +183,7 @@ resource "google_gemini_repository_group_iam_policy" "foo" { } data "google_gemini_repository_group_iam_policy" "foo" { + provider = google-beta project = "%{project}" location = "%{location}" code_repository_index = "%{code_repository_index}" @@ -188,6 +194,7 @@ data "google_gemini_repository_group_iam_policy" "foo" { } resource "google_gemini_repository_group" "example" { + provider = google-beta location = "us-central1" code_repository_index = "%{code_repository_index}" repository_group_id = "%{repository_group_id}" @@ -203,9 +210,11 @@ resource "google_gemini_repository_group" "example" { func testAccGeminiRepositoryGroupIamPolicy_emptyBinding(context map[string]interface{}) string { return acctest.Nprintf(` data "google_iam_policy" "foo" { + provider = google-beta } resource "google_gemini_repository_group_iam_policy" "foo" { + provider = google-beta project = "%{project}" location = "%{location}" code_repository_index = "%{code_repository_index}" @@ -214,6 +223,7 @@ resource "google_gemini_repository_group_iam_policy" "foo" { } resource "google_gemini_repository_group" "example" { + provider = google-beta location = "us-central1" code_repository_index = "%{code_repository_index}" repository_group_id = "%{repository_group_id}" @@ -229,6 +239,7 @@ resource "google_gemini_repository_group" "example" { func testAccGeminiRepositoryGroupIamBinding_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_gemini_repository_group_iam_binding" "foo" { + provider = google-beta project = "%{project}" location = "%{location}" code_repository_index = "%{code_repository_index}" @@ -238,6 +249,7 @@ resource "google_gemini_repository_group_iam_binding" "foo" { } resource "google_gemini_repository_group" "example" { + provider = google-beta location = "us-central1" code_repository_index = "%{code_repository_index}" repository_group_id = "%{repository_group_id}" @@ -253,6 +265,7 @@ resource "google_gemini_repository_group" "example" { func testAccGeminiRepositoryGroupIamBinding_update(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_gemini_repository_group_iam_binding" "foo" { + provider = google-beta project = "%{project}" location = "%{location}" code_repository_index = "%{code_repository_index}" @@ -262,6 +275,7 @@ resource "google_gemini_repository_group_iam_binding" "foo" { } resource "google_gemini_repository_group" "example" { + provider = google-beta location = "us-central1" code_repository_index = "%{code_repository_index}" repository_group_id = "%{repository_group_id}" @@ -273,3 +287,4 @@ resource "google_gemini_repository_group" "example" { } `, context) } +{{ end }} diff --git a/mmv1/third_party/terraform/services/gemini/resource_gemini_code_repository_index_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/resource_gemini_code_repository_index_test.go.tmpl index ed0f8f87a795..ab1520dbc92b 100644 --- a/mmv1/third_party/terraform/services/gemini/resource_gemini_code_repository_index_test.go.tmpl +++ b/mmv1/third_party/terraform/services/gemini/resource_gemini_code_repository_index_test.go.tmpl @@ -1,7 +1,7 @@ package gemini_test +{{- if ne $.TargetVersionName "ga" }} import ( - "fmt" "os" "testing" @@ -14,13 +14,13 @@ func TestAccGeminiCodeRepositoryIndex_update(t *testing.T) { bootstrappedKMS := acctest.BootstrapKMSKeyInLocation(t, "us-central1") context := map[string]interface{}{ "random_suffix": acctest.RandString(t, 10), - "project_id": os.Getenv("GOOGLE_PROJECT"), - "kms_key": bootstrappedKMS.CryptoKey.Name, + "project_id": os.Getenv("GOOGLE_PROJECT"), + "kms_key": bootstrappedKMS.CryptoKey.Name, } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccGeminiCodeRepositoryIndex_basic(context), @@ -44,132 +44,10 @@ func TestAccGeminiCodeRepositoryIndex_update(t *testing.T) { }) } -// TestAccGeminiCodeRepositoryIndex_delete checks if there is no error in deleting CRI along with children resource -// note: this is an example of a bad usage, where RGs refer to the CRI using a string id, not a reference, as they -// will be force-removed upon CRI deletion, because the CRI provider uses --force option by default -// The plan after the _delete function should not be empty due to the child resource in plan -func TestAccGeminiCodeRepositoryIndex_delete(t *testing.T) { - bootstrappedKMS := acctest.BootstrapKMSKeyInLocation(t, "us-central1") - randomSuffix := acctest.RandString(t, 10) - context := map[string]interface{}{ - "random_suffix": randomSuffix, - "project_id": os.Getenv("GOOGLE_PROJECT"), - "kms_key": bootstrappedKMS.CryptoKey.Name, - "cri_id": fmt.Sprintf("tf-test-cri-index-delete-example-%s", randomSuffix), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccGeminiCodeRepositoryIndex_withChildren_basic(context), - }, - { - ResourceName: "google_gemini_code_repository_index.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"code_repository_index_id", "labels", "location", "terraform_labels", "force_destroy"}, - }, - { - Config: testAccGeminiCodeRepositoryIndex_withChildren_delete(context), - ExpectNonEmptyPlan: true, - PlanOnly: true, - }, - }, - }) -} - -func testAccGeminiCodeRepositoryIndex_withChildren_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_code_repository_index" "example" { - labels = {"ccfe_debug_note": "terraform_e2e_should_be_deleted"} - location = "us-central1" - code_repository_index_id = "%{cri_id}" - force_destroy = true -} - -resource "google_gemini_repository_group" "example" { - location = "us-central1" - code_repository_index = "%{cri_id}" - repository_group_id = "tf-test-rg-repository-group-id-%{random_suffix}" - repositories { - resource = "projects/%{project_id}/locations/us-central1/connections/${google_developer_connect_connection.github_conn.connection_id}/gitRepositoryLinks/${google_developer_connect_git_repository_link.conn.git_repository_link_id}" - branch_pattern = "main" - } - labels = {"label1": "value1"} - depends_on = [ - google_gemini_code_repository_index.example - ] -} - -resource "google_developer_connect_git_repository_link" "conn" { - git_repository_link_id = "tf-test-repository-conn-delete" - parent_connection = google_developer_connect_connection.github_conn.connection_id - clone_uri = "https://github.com/CC-R-github-robot/tf-test.git" - location = "us-central1" - annotations = {} -} - -resource "google_developer_connect_connection" "github_conn" { - location = "us-central1" - connection_id = "tf-test-cloudaicompanion-delete-%{random_suffix}" - disabled = false - - github_config { - github_app = "DEVELOPER_CONNECT" - app_installation_id = 54180648 - - authorizer_credential { - oauth_token_secret_version = "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1" - } - } -} -`, context) -} - -// Removed depends_on to not break plan test -func testAccGeminiCodeRepositoryIndex_withChildren_delete(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_repository_group" "example" { - location = "us-central1" - code_repository_index = "%{cri_id}" - repository_group_id = "tf-test-rg-repository-group-id-%{random_suffix}" - repositories { - resource = "projects/%{project_id}/locations/us-central1/connections/${google_developer_connect_connection.github_conn.connection_id}/gitRepositoryLinks/${google_developer_connect_git_repository_link.conn.git_repository_link_id}" - branch_pattern = "main" - } - labels = {"label1": "value1"} -} - -resource "google_developer_connect_git_repository_link" "conn" { - git_repository_link_id = "tf-test-repository-conn-delete" - parent_connection = google_developer_connect_connection.github_conn.connection_id - clone_uri = "https://github.com/CC-R-github-robot/tf-test.git" - location = "us-central1" - annotations = {} -} - -resource "google_developer_connect_connection" "github_conn" { - location = "us-central1" - connection_id = "tf-test-cloudaicompanion-delete-%{random_suffix}" - disabled = false - - github_config { - github_app = "DEVELOPER_CONNECT" - app_installation_id = 54180648 - - authorizer_credential { - oauth_token_secret_version = "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1" - } - } -} -`, context) -} - func testAccGeminiCodeRepositoryIndex_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_gemini_code_repository_index" "example" { + provider = google-beta labels = {"ccfe_debug_note": "terraform_e2e_should_be_deleted"} location = "us-central1" code_repository_index_id = "tf-test-cri-index-example-%{random_suffix}" @@ -178,9 +56,11 @@ resource "google_gemini_code_repository_index" "example" { } data "google_project" "project" { + provider = google-beta } resource "google_kms_crypto_key_iam_binding" "crypto_key_binding" { + provider = google-beta crypto_key_id = "%{kms_key}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" members = [ @@ -193,6 +73,7 @@ resource "google_kms_crypto_key_iam_binding" "crypto_key_binding" { func testAccGeminiCodeRepositoryIndex_update(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_gemini_code_repository_index" "example" { + provider = google-beta labels = {"ccfe_debug_note": "terraform_e2e_should_be_deleted", "new_label": "new_val"} location = "us-central1" code_repository_index_id = "tf-test-cri-index-example-%{random_suffix}" @@ -200,3 +81,4 @@ resource "google_gemini_code_repository_index" "example" { } `, context) } +{{ end }} diff --git a/mmv1/third_party/terraform/services/gemini/resource_gemini_data_sharing_with_google_setting_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/resource_gemini_data_sharing_with_google_setting_test.go.tmpl deleted file mode 100644 index c57bfd0cda4a..000000000000 --- a/mmv1/third_party/terraform/services/gemini/resource_gemini_data_sharing_with_google_setting_test.go.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -package gemini_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccGeminiDataSharingWithGoogleSetting_geminiDataSharingWithGoogleSettingBasicExample_update(t *testing.T) { - t.Parallel() - context := map[string]interface{}{ - "setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)), - } - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccGeminiDataSharingWithGoogleSetting_geminiDataSharingWithGoogleSettingBasicExample_basic(context), - }, - { - ResourceName: "google_gemini_data_sharing_with_google_setting.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "data_sharing_with_google_setting_id", "terraform_labels"}, - }, - { - Config: testAccGeminiDataSharingWithGoogleSetting_geminiDataSharingWithGoogleSettingBasicExample_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_gemini_data_sharing_with_google_setting.example", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_gemini_data_sharing_with_google_setting.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "data_sharing_with_google_setting_id", "terraform_labels"}, - }, - }, - }) -} -func testAccGeminiDataSharingWithGoogleSetting_geminiDataSharingWithGoogleSettingBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_data_sharing_with_google_setting" "example" { - provider = google-beta - data_sharing_with_google_setting_id = "%{setting_id}" - location = "global" - enable_preview_data_sharing = true -} -`, context) -} -func testAccGeminiDataSharingWithGoogleSetting_geminiDataSharingWithGoogleSettingBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_data_sharing_with_google_setting" "example" { - provider = google-beta - data_sharing_with_google_setting_id = "%{setting_id}" - location = "global" - enable_preview_data_sharing = false -} -`, context) -} -{{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/gemini/resource_gemini_gemini_gcp_enablement_setting_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/resource_gemini_gemini_gcp_enablement_setting_test.go.tmpl deleted file mode 100644 index c42716e73907..000000000000 --- a/mmv1/third_party/terraform/services/gemini/resource_gemini_gemini_gcp_enablement_setting_test.go.tmpl +++ /dev/null @@ -1,64 +0,0 @@ -package gemini_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_update(t *testing.T) { - t.Parallel() - context := map[string]interface{}{ - "setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)), - } - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_basic(context), - }, - { - ResourceName: "google_gemini_gemini_gcp_enablement_setting.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "gemini_gcp_enablement_setting_id", "terraform_labels"}, - }, - { - Config: testAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_gemini_gemini_gcp_enablement_setting.example", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_gemini_gemini_gcp_enablement_setting.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "gemini_gcp_enablement_setting_id", "terraform_labels"}, - }, - }, - }) -} -func testAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_gemini_gcp_enablement_setting" "example" { - gemini_gcp_enablement_setting_id = "%{setting_id}" - location = "global" - enable_customer_data_sharing = true -} -`, context) -} -func testAccGeminiGeminiGcpEnablementSetting_geminiGeminiGcpEnablementSettingBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_gemini_gcp_enablement_setting" "example" { - gemini_gcp_enablement_setting_id = "%{setting_id}" - location = "global" - enable_customer_data_sharing = false -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/gemini/resource_gemini_logging_setting_binding_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/resource_gemini_logging_setting_binding_test.go.tmpl deleted file mode 100644 index af87b975d7f3..000000000000 --- a/mmv1/third_party/terraform/services/gemini/resource_gemini_logging_setting_binding_test.go.tmpl +++ /dev/null @@ -1,102 +0,0 @@ -package gemini_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccGeminiLoggingSettingBinding_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "logging_setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)), - "setting_binding_id": fmt.Sprintf("tf-test-lsb-%s", acctest.RandString(t, 10)), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccGeminiLoggingSettingBinding_basic(context), - }, - { - ResourceName: "google_gemini_logging_setting_binding.basic_binding", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "logging_setting_id", "terraform_labels"}, - }, - { - Config: testAccGeminiLoggingSettingBinding_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_gemini_logging_setting_binding.basic_binding", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_gemini_logging_setting_binding.basic_binding", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "logging_setting_id", "terraform_labels"}, - }, - }, - }) -} - -func testAccGeminiLoggingSettingBinding_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_project" "project" { - provider = google-beta -} - -resource "google_gemini_logging_setting" "basic" { - provider = google-beta - logging_setting_id = "%{logging_setting_id}" - location = "global" - labels = {"my_key" = "my_value"} - log_prompts_and_responses = true -} - -resource "google_gemini_logging_setting_binding" "basic_binding" { - provider = google-beta - logging_setting_id = google_gemini_logging_setting.basic.logging_setting_id - setting_binding_id = "%{setting_binding_id}" - location = "global" - target = "projects/${data.google_project.project.number}" -} -`, context) -} - -func testAccGeminiLoggingSettingBinding_update(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_project" "project" { - provider = google-beta -} - -resource "google_gemini_logging_setting" "basic" { - provider = google-beta - logging_setting_id = "%{logging_setting_id}" - location = "global" - labels = {"my_key" = "my_value"} - log_prompts_and_responses = true -} - -resource "google_gemini_logging_setting_binding" "basic_binding" { - provider = google-beta - logging_setting_id = google_gemini_logging_setting.basic.logging_setting_id - setting_binding_id = "%{setting_binding_id}" - location = "global" - target = "projects/${data.google_project.project.number}" - labels = {"my_key" = "my_value"} - product = "GEMINI_CODE_ASSIST" -} -`, context) -} -{{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/gemini/resource_gemini_logging_setting_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/resource_gemini_logging_setting_test.go.tmpl deleted file mode 100644 index 896922b4ae77..000000000000 --- a/mmv1/third_party/terraform/services/gemini/resource_gemini_logging_setting_test.go.tmpl +++ /dev/null @@ -1,71 +0,0 @@ -package gemini_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccGeminiLoggingSetting_geminiLoggingSettingBasicExample_update(t *testing.T) { - t.Parallel() - context := map[string]interface{}{ - "setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)), - } - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccGeminiLoggingSetting_geminiLoggingSettingBasicExample_basic(context), - }, - { - ResourceName: "google_gemini_logging_setting.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "logging_setting_id", "terraform_labels"}, - }, - { - Config: testAccGeminiLoggingSetting_geminiLoggingSettingBasicExample_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_gemini_logging_setting.example", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_gemini_logging_setting.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "logging_setting_id", "terraform_labels"}, - }, - }, - }) -} -func testAccGeminiLoggingSetting_geminiLoggingSettingBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_logging_setting" "example" { - provider = google-beta - logging_setting_id = "%{setting_id}" - location = "global" - log_prompts_and_responses = true - log_metadata = true -} -`, context) -} -func testAccGeminiLoggingSetting_geminiLoggingSettingBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_logging_setting" "example" { - provider = google-beta - logging_setting_id = "%{setting_id}" - location = "global" - labels = {"my_key" = "my_value"} - log_prompts_and_responses = false - log_metadata = false -} -`, context) -} -{{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/gemini/resource_gemini_release_channel_setting_binding_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/resource_gemini_release_channel_setting_binding_test.go.tmpl deleted file mode 100644 index 04c2f70bd1bf..000000000000 --- a/mmv1/third_party/terraform/services/gemini/resource_gemini_release_channel_setting_binding_test.go.tmpl +++ /dev/null @@ -1,102 +0,0 @@ -package gemini_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccGeminiReleaseChannelSettingBinding_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "release_channel_setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)), - "setting_binding_id": fmt.Sprintf("tf-test-lsb-%s", acctest.RandString(t, 10)), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccGeminiReleaseChannelSettingBinding_basic(context), - }, - { - ResourceName: "google_gemini_release_channel_setting_binding.basic_binding", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"}, - }, - { - Config: testAccGeminiReleaseChannelSettingBinding_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_gemini_release_channel_setting_binding.basic_binding", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_gemini_release_channel_setting_binding.basic_binding", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"}, - }, - }, - }) -} - -func testAccGeminiReleaseChannelSettingBinding_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_project" "project" { - provider = google-beta -} - -resource "google_gemini_release_channel_setting" "basic" { - provider = google-beta - release_channel_setting_id = "%{release_channel_setting_id}" - location = "global" - labels = {"my_key" = "my_value"} - release_channel = "EXPERIMENTAL" -} - -resource "google_gemini_release_channel_setting_binding" "basic_binding" { - provider = google-beta - release_channel_setting_id = google_gemini_release_channel_setting.basic.release_channel_setting_id - setting_binding_id = "%{setting_binding_id}" - location = "global" - target = "projects/${data.google_project.project.number}" -} -`, context) -} - -func testAccGeminiReleaseChannelSettingBinding_update(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_project" "project" { - provider = google-beta -} - -resource "google_gemini_release_channel_setting" "basic" { - provider = google-beta - release_channel_setting_id = "%{release_channel_setting_id}" - location = "global" - labels = {"my_key" = "my_value"} - release_channel = "EXPERIMENTAL" -} - -resource "google_gemini_release_channel_setting_binding" "basic_binding" { - provider = google-beta - release_channel_setting_id = google_gemini_release_channel_setting.basic.release_channel_setting_id - setting_binding_id = "%{setting_binding_id}" - location = "global" - target = "projects/${data.google_project.project.number}" - labels = {"my_key" = "my_value"} - product = "GEMINI_CODE_ASSIST" -} -`, context) -} -{{ end }} diff --git a/mmv1/third_party/terraform/services/gemini/resource_gemini_release_channel_setting_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/resource_gemini_release_channel_setting_test.go.tmpl deleted file mode 100644 index 1ad8db54960e..000000000000 --- a/mmv1/third_party/terraform/services/gemini/resource_gemini_release_channel_setting_test.go.tmpl +++ /dev/null @@ -1,69 +0,0 @@ -package gemini_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_update(t *testing.T) { - t.Parallel() - context := map[string]interface{}{ - "setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)), - } - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_basic(context), - }, - { - ResourceName: "google_gemini_release_channel_setting.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"}, - }, - { - Config: testAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_update(context), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_gemini_release_channel_setting.example", plancheck.ResourceActionUpdate), - }, - }, - }, - { - ResourceName: "google_gemini_release_channel_setting.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"}, - }, - }, - }) -} -func testAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_release_channel_setting" "example" { - provider = google-beta - release_channel_setting_id = "%{setting_id}" - location = "global" - release_channel = "EXPERIMENTAL" -} -`, context) -} -func testAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_gemini_release_channel_setting" "example" { - provider = google-beta - release_channel_setting_id = "%{setting_id}" - location = "global" - labels = {"my_key" = "my_value"} - release_channel = "STABLE" -} -`, context) -} -{{ end }} diff --git a/mmv1/third_party/terraform/services/gemini/resource_gemini_repository_group_test.go.tmpl b/mmv1/third_party/terraform/services/gemini/resource_gemini_repository_group_test.go.tmpl index bb4547d3f545..931e861b908e 100644 --- a/mmv1/third_party/terraform/services/gemini/resource_gemini_repository_group_test.go.tmpl +++ b/mmv1/third_party/terraform/services/gemini/resource_gemini_repository_group_test.go.tmpl @@ -1,4 +1,5 @@ package gemini_test +{{- if ne $.TargetVersionName "ga" }} import ( "os" @@ -13,16 +14,16 @@ import ( // More details: https://cloud.google.com/developer-connect/docs/connect-github-repo#before_you_begin func TestAccGeminiRepositoryGroup_update(t *testing.T) { - codeRepositoryIndexId := acctest.BootstrapSharedCodeRepositoryIndex(t, "basic-rg-test", "us-central1", "", map[string]string{"ccfe_debug_note": "terraform_e2e_do_not_delete"}) + codeRepositoryIndexId := acctest.BootstrapSharedCodeRepositoryIndex(t, "basic-rg-test", "us-central1", "", map[string]string{"ccfe_debug_note": "terraform_e2e_should_be_deleted"}) context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - "project_id": os.Getenv("GOOGLE_PROJECT"), + "random_suffix": acctest.RandString(t, 10), + "project_id": os.Getenv("GOOGLE_PROJECT"), "code_repository_index": codeRepositoryIndexId, } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccGeminiRepositoryGroup_basic(context), @@ -49,12 +50,12 @@ func TestAccGeminiRepositoryGroup_update(t *testing.T) { func TestAccGeminiRepositoryGroup_noBootstrap(t *testing.T) { context := map[string]interface{}{ "random_suffix": acctest.RandString(t, 10), - "project_id": os.Getenv("GOOGLE_PROJECT"), + "project_id": os.Getenv("GOOGLE_PROJECT"), } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccGeminiRepositoryGroup_noBootstrap(context), @@ -72,6 +73,7 @@ func TestAccGeminiRepositoryGroup_noBootstrap(t *testing.T) { func testAccGeminiRepositoryGroup_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_gemini_repository_group" "example" { + provider = google-beta location = "us-central1" code_repository_index = "%{code_repository_index}" repository_group_id = "tf-test-rg-repository-group-id-%{random_suffix}" @@ -83,6 +85,7 @@ resource "google_gemini_repository_group" "example" { } resource "google_developer_connect_git_repository_link" "conn" { + provider = google-beta git_repository_link_id = "tf-test-repository-conn" parent_connection = google_developer_connect_connection.github_conn.connection_id clone_uri = "https://github.com/CC-R-github-robot/tf-test.git" @@ -91,6 +94,7 @@ resource "google_developer_connect_git_repository_link" "conn" { } resource "google_developer_connect_connection" "github_conn" { + provider = google-beta location = "us-central1" connection_id = "tf-test-cloudaicompanion2-%{random_suffix}" disabled = false @@ -109,6 +113,7 @@ resource "google_developer_connect_connection" "github_conn" { func testAccGeminiRepositoryGroup_update(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_gemini_repository_group" "example" { + provider = google-beta location = "us-central1" code_repository_index = "%{code_repository_index}" repository_group_id = "tf-test-rg-repository-group-id-%{random_suffix}" @@ -120,6 +125,7 @@ resource "google_gemini_repository_group" "example" { } resource "google_developer_connect_git_repository_link" "conn" { + provider = google-beta git_repository_link_id = "tf-test-repository-conn" parent_connection = google_developer_connect_connection.github_conn.connection_id clone_uri = "https://github.com/CC-R-github-robot/tf-test.git" @@ -128,6 +134,7 @@ resource "google_developer_connect_git_repository_link" "conn" { } resource "google_developer_connect_connection" "github_conn" { + provider = google-beta location = "us-central1" connection_id = "tf-test-cloudaicompanion3-%{random_suffix}" disabled = false @@ -147,12 +154,14 @@ resource "google_developer_connect_connection" "github_conn" { func testAccGeminiRepositoryGroup_noBootstrap(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_gemini_code_repository_index" "cri" { + provider = google-beta labels = {"ccfe_debug_note": "terraform_e2e_should_be_deleted"} location = "us-central1" code_repository_index_id = "tf-test-rg-index-example-%{random_suffix}" } resource "google_gemini_repository_group" "example_a" { + provider = google-beta location = "us-central1" code_repository_index = google_gemini_code_repository_index.cri.code_repository_index_id repository_group_id = "tf-test-rg-nb-repository-group-id1-%{random_suffix}" @@ -164,6 +173,7 @@ resource "google_gemini_repository_group" "example_a" { } resource "google_gemini_repository_group" "example_b" { + provider = google-beta location = "us-central1" code_repository_index = google_gemini_code_repository_index.cri.code_repository_index_id repository_group_id = "tf-test-rg-nb-repository-group-id2-%{random_suffix}" @@ -175,6 +185,7 @@ resource "google_gemini_repository_group" "example_b" { } resource "google_gemini_repository_group" "example_c" { + provider = google-beta location = "us-central1" code_repository_index = google_gemini_code_repository_index.cri.code_repository_index_id repository_group_id = "tf-test-rg-nb-repository-group-id3-%{random_suffix}" @@ -186,6 +197,7 @@ resource "google_gemini_repository_group" "example_c" { } resource "google_gemini_repository_group" "example_d" { + provider = google-beta location = "us-central1" code_repository_index = google_gemini_code_repository_index.cri.code_repository_index_id repository_group_id = "tf-test-rg-nb-repository-group-id4-%{random_suffix}" @@ -197,6 +209,7 @@ resource "google_gemini_repository_group" "example_d" { } resource "google_gemini_repository_group" "example_e" { + provider = google-beta location = "us-central1" code_repository_index = google_gemini_code_repository_index.cri.code_repository_index_id repository_group_id = "tf-test-rg-nb-repository-group-id5-%{random_suffix}" @@ -208,6 +221,7 @@ resource "google_gemini_repository_group" "example_e" { } resource "google_developer_connect_git_repository_link" "conn" { + provider = google-beta git_repository_link_id = "tf-test-repository-conn" parent_connection = google_developer_connect_connection.github_conn.connection_id clone_uri = "https://github.com/CC-R-github-robot/tf-test.git" @@ -216,6 +230,7 @@ resource "google_developer_connect_git_repository_link" "conn" { } resource "google_developer_connect_connection" "github_conn" { + provider = google-beta location = "us-central1" connection_id = "tf-test-cloudaicompanion1-%{random_suffix}" disabled = false @@ -231,3 +246,4 @@ resource "google_developer_connect_connection" "github_conn" { } `, context) } +{{ end }} diff --git a/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_meta.yaml.tmpl b/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_meta.yaml.tmpl index 778b7227674b..c167160ba2b4 100644 --- a/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_meta.yaml.tmpl @@ -7,66 +7,3 @@ api_version: 'v1beta' api_version: 'v1' {{- end }} api_resource_type_kind: 'Feature' -fields: - - field: 'configmanagement.binauthz.enabled' - - field: 'configmanagement.config_sync.enabled' - - field: 'configmanagement.config_sync.git.gcp_service_account_email' - - field: 'configmanagement.config_sync.git.https_proxy' - - field: 'configmanagement.config_sync.git.policy_dir' - - field: 'configmanagement.config_sync.git.secret_type' - - field: 'configmanagement.config_sync.git.sync_branch' - - field: 'configmanagement.config_sync.git.sync_repo' - - field: 'configmanagement.config_sync.git.sync_rev' - - field: 'configmanagement.config_sync.git.sync_wait_secs' - - field: 'configmanagement.config_sync.metrics_gcp_service_account_email' - - field: 'configmanagement.config_sync.oci.gcp_service_account_email' - - field: 'configmanagement.config_sync.oci.policy_dir' - - field: 'configmanagement.config_sync.oci.secret_type' - - field: 'configmanagement.config_sync.oci.sync_repo' - - field: 'configmanagement.config_sync.oci.sync_wait_secs' - - field: 'configmanagement.config_sync.prevent_drift' - - field: 'configmanagement.config_sync.source_format' - - field: 'configmanagement.config_sync.stop_syncing' - - field: 'configmanagement.hierarchy_controller.enable_hierarchical_resource_quota' - - field: 'configmanagement.hierarchy_controller.enable_pod_tree_labels' - - field: 'configmanagement.hierarchy_controller.enabled' - - field: 'configmanagement.management' - - field: 'configmanagement.policy_controller.audit_interval_seconds' - - field: 'configmanagement.policy_controller.enabled' - - field: 'configmanagement.policy_controller.exemptable_namespaces' - - field: 'configmanagement.policy_controller.log_denies_enabled' - - field: 'configmanagement.policy_controller.monitoring.backends' - - field: 'configmanagement.policy_controller.mutation_enabled' - - field: 'configmanagement.policy_controller.referential_rules_enabled' - - field: 'configmanagement.policy_controller.template_library_installed' - - field: 'configmanagement.version' - - field: 'feature' - - field: 'location' - - field: 'membership' - - field: 'membership_location' - - field: 'mesh.control_plane' - - field: 'mesh.management' - - field: 'policycontroller.policy_controller_hub_config.audit_interval_seconds' - - field: 'policycontroller.policy_controller_hub_config.constraint_violation_limit' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.component_name' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.container_resources.limits.cpu' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.container_resources.limits.memory' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.container_resources.requests.cpu' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.container_resources.requests.memory' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.pod_affinity' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.pod_tolerations.effect' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.pod_tolerations.key' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.pod_tolerations.operator' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.pod_tolerations.value' - - field: 'policycontroller.policy_controller_hub_config.deployment_configs.replica_count' - - field: 'policycontroller.policy_controller_hub_config.exemptable_namespaces' - - field: 'policycontroller.policy_controller_hub_config.install_spec' - - field: 'policycontroller.policy_controller_hub_config.log_denies_enabled' - - field: 'policycontroller.policy_controller_hub_config.monitoring.backends' - - field: 'policycontroller.policy_controller_hub_config.mutation_enabled' - - field: 'policycontroller.policy_controller_hub_config.policy_content.bundles.bundle_name' - - field: 'policycontroller.policy_controller_hub_config.policy_content.bundles.exempted_namespaces' - - field: 'policycontroller.policy_controller_hub_config.policy_content.template_library.installation' - - field: 'policycontroller.policy_controller_hub_config.referential_rules_enabled' - - field: 'policycontroller.version' - - field: 'project' diff --git a/mmv1/third_party/terraform/services/gkehub2/resource_gke_hub_feature_test.go.tmpl b/mmv1/third_party/terraform/services/gkehub2/resource_gke_hub_feature_test.go.tmpl index 88b1330b8c9b..0d8476af755b 100644 --- a/mmv1/third_party/terraform/services/gkehub2/resource_gke_hub_feature_test.go.tmpl +++ b/mmv1/third_party/terraform/services/gkehub2/resource_gke_hub_feature_test.go.tmpl @@ -579,7 +579,6 @@ resource "google_gke_hub_feature" "feature" { enabled = true prevent_drift = true source_format = "unstructured" - metrics_gcp_service_account_email = "gke-cluster-metrics@gke-foo-nonprod.iam.gserviceaccount.com" oci { sync_repo = "us-central1-docker.pkg.dev/corp-gke-build-artifacts/acm/configs:latest" policy_dir = "/acm/nonprod-root/" diff --git a/mmv1/third_party/terraform/services/kms/data_source_google_kms_key_handles.go b/mmv1/third_party/terraform/services/kms/data_source_google_kms_key_handles.go deleted file mode 100644 index 502670a86f72..000000000000 --- a/mmv1/third_party/terraform/services/kms/data_source_google_kms_key_handles.go +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package kms - -import ( - "fmt" - "log" - "strings" - - "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 DataSourceGoogleKmsKeyHandles() *schema.Resource { - return &schema.Resource{ - Read: dataSourceGoogleKmsKeyHandlesRead, - Schema: map[string]*schema.Schema{ - "project": { - Type: schema.TypeString, - Optional: true, - Description: `Project ID of the project.`, - }, - "location": { - Type: schema.TypeString, - Required: true, - Description: `The canonical id for the location. For example: "us-east1".`, - }, - "resource_type_selector": { - Type: schema.TypeString, - Required: true, - Description: ` - The resource_type_selector argument is used to add a filter query parameter that limits which key handles are retrieved by the data source: ?filter=resource_type_selector="{{resource_type_selector}}". - Example values: - * resource_type_selector="{SERVICE}.googleapis.com/{TYPE}". - [See the documentation about using filters](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyHandles/list) - `, - }, - "key_handles": { - Type: schema.TypeList, - Computed: true, - Description: "A list of all the retrieved key handles", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Computed: true, - }, - "kms_key": { - Type: schema.TypeString, - Computed: true, - }, - "resource_type_selector": { - Type: schema.TypeString, - Computed: true, - }, - }, - }, - }, - }, - } - -} - -func dataSourceGoogleKmsKeyHandlesRead(d *schema.ResourceData, meta interface{}) error { - config := meta.(*transport_tpg.Config) - project, err := tpgresource.GetProject(d, config) - if err != nil { - return err - } - resourceTypeSelector := "" - if fl, ok := d.GetOk("resource_type_selector"); ok { - resourceTypeSelector = strings.Replace(fl.(string), "\"", "%22", -1) - } - - billingProject := project - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - url, err := tpgresource.ReplaceVars(d, config, "{{KMSBasePath}}projects/{{project}}/locations/{{location}}/keyHandles") - if err != nil { - return err - } - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - params := make(map[string]string) - var keyHandles []interface{} - for { - newUrl, err := addQueryParams(url, resourceTypeSelector, params) - if err != nil { - return err - } - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: newUrl, - UserAgent: userAgent, - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.Is429RetryableQuotaError}, - }) - if err != nil { - return fmt.Errorf("Error retrieving keyhandles: %s", err) - } - - if res["keyHandles"] == nil { - break - } - pageKeyHandles, err := flattenKMSKeyHandlesList(config, res["keyHandles"]) - if err != nil { - return fmt.Errorf("error flattening key handle list: %s", err) - } - keyHandles = append(keyHandles, pageKeyHandles...) - - pToken, ok := res["nextPageToken"] - if ok && pToken != nil && pToken.(string) != "" { - params["pageToken"] = pToken.(string) - } else { - break - } - } - log.Printf("[DEBUG] Found %d key handles", len(keyHandles)) - if err := d.Set("key_handles", keyHandles); err != nil { - return fmt.Errorf("error setting key handles: %s", err) - } - d.SetId(fmt.Sprintf("projects/%s/locations/%s/keyHandles?filter=resource_type_selector=%s", project, d.Get("location"), resourceTypeSelector)) - return nil -} - -// transport_tpg.AddQueryParams() encodes the filter=resource_type_selector="value" into -// filter=resource_type_selector%3D%22value%22 -// The encoding of '=' into %3D is currently causing issue with ListKeyHandle api. -// To to handle this case currently, as part of this function, -// we are manually adding filter as a query param to the url -func addQueryParams(url string, resourceTypeSelector string, params map[string]string) (string, error) { - quoteEncoding := "%22" - if len(params) == 0 { - return fmt.Sprintf("%s?filter=resource_type_selector=%s%s%s", url, quoteEncoding, resourceTypeSelector, quoteEncoding), nil - } else { - url, err := transport_tpg.AddQueryParams(url, params) - if err != nil { - return "", nil - } - return fmt.Sprintf("%s&filter=resource_type_selector=%s%s%s", url, quoteEncoding, resourceTypeSelector, quoteEncoding), nil - } -} - -// flattenKMSKeyHandlesList flattens a list of key handles -func flattenKMSKeyHandlesList(config *transport_tpg.Config, keyHandlesList interface{}) ([]interface{}, error) { - var keyHandles []interface{} - for _, k := range keyHandlesList.([]interface{}) { - keyHandle := k.(map[string]interface{}) - - data := map[string]interface{}{} - data["name"] = keyHandle["name"] - data["kms_key"] = keyHandle["kmsKey"] - data["resource_type_selector"] = keyHandle["resourceTypeSelector"] - - keyHandles = append(keyHandles, data) - } - - return keyHandles, nil -} diff --git a/mmv1/third_party/terraform/services/kms/data_source_google_kms_key_handles_test.go.tmpl b/mmv1/third_party/terraform/services/kms/data_source_google_kms_key_handles_test.go.tmpl deleted file mode 100644 index 7112a99194c5..000000000000 --- a/mmv1/third_party/terraform/services/kms/data_source_google_kms_key_handles_test.go.tmpl +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package kms_test - -{{ if ne $.TargetVersionName `ga` -}} - -import ( - "errors" - "fmt" - "strconv" - "strings" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceGoogleKmsKeyHandles_basic(t *testing.T) { - kmsAutokey := acctest.BootstrapKMSAutokeyKeyHandle(t) - keyParts := strings.Split(kmsAutokey.KeyHandle.Name, "/") - project := keyParts[1] - location := keyParts[3] - diskFilter := fmt.Sprintf("compute.googleapis.com/Disk") - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccDataSourceGoogleKmsKeyHandles_basic(project, location, diskFilter), - Check: resource.ComposeTestCheckFunc( - validateKeyHandleName( - "data.google_kms_key_handles.mykeyhandles", kmsAutokey.KeyHandle.Name, - ), - ), - }, - }, - }) -} -func validateKeyHandleName(dataSourceName string, expectedKeyHandleName string) func(*terraform.State) error { - return func(s *terraform.State) error { - ds, ok := s.RootModule().Resources[dataSourceName] - if !ok { - return fmt.Errorf("can't find %s in state", dataSourceName) - } - - var dsAttr map[string]string - dsAttr = ds.Primary.Attributes - - totalKeyHandles, err := strconv.Atoi(dsAttr["key_handles.#"]) - if err != nil { - return errors.New("Couldn't convert length of key_handles list to integer") - } - if totalKeyHandles != 1 { - return errors.New(fmt.Sprintf("want 1 keyhandle, found %d", totalKeyHandles)) - } - actualKeyHandleName := dsAttr["key_handles.0.name"] - if actualKeyHandleName != expectedKeyHandleName { - return errors.New(fmt.Sprintf("want keyhandle name %s, got: %s", expectedKeyHandleName, actualKeyHandleName)) - } - return nil - } -} -func testAccDataSourceGoogleKmsKeyHandles_basic(project string, location string, filter string) string { - str := fmt.Sprintf(` -data "google_kms_key_handles" "mykeyhandles" { - project = "%s" - location = "%s" - resource_type_selector = "%s" -} -`, project, location, filter) - return str -} - -{{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_bucket_config_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_bucket_config_meta.yaml index 47c641681e31..dde6b3bbbdae 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_bucket_config_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_bucket_config_meta.yaml @@ -3,17 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogBucket' -fields: - - field: 'billing_account' - - field: 'bucket_id' - - field: 'cmek_settings.kms_key_name' - - field: 'cmek_settings.kms_key_version_name' - - field: 'cmek_settings.name' - - field: 'cmek_settings.service_account_id' - - field: 'description' - - field: 'index_configs.field_path' - - field: 'index_configs.type' - - field: 'lifecycle_state' - - field: 'location' - - field: 'name' - - field: 'retention_days' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_exclusion_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_exclusion_meta.yaml index 7a757579dc88..ddf57dfcd9a5 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_exclusion_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_exclusion_meta.yaml @@ -3,9 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogExclusion' -fields: - - field: 'billing_account' - - field: 'description' - - field: 'disabled' - - field: 'filter' - - field: 'name' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_sink_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_sink_meta.yaml index 31b70aeec222..d4b53b3928c7 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_sink_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_billing_account_sink_meta.yaml @@ -3,16 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogSink' -fields: - - field: 'bigquery_options.use_partitioned_tables' - - field: 'billing_account' - - field: 'description' - - field: 'destination' - - field: 'disabled' - - field: 'exclusions.description' - - field: 'exclusions.disabled' - - field: 'exclusions.filter' - - field: 'exclusions.name' - - field: 'filter' - - field: 'name' - - field: 'writer_identity' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_folder_bucket_config_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_folder_bucket_config_meta.yaml index 85029517b1bc..0cb7b8ed2b5d 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_folder_bucket_config_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_folder_bucket_config_meta.yaml @@ -3,17 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogBucket' -fields: - - field: 'bucket_id' - - field: 'cmek_settings.kms_key_name' - - field: 'cmek_settings.kms_key_version_name' - - field: 'cmek_settings.name' - - field: 'cmek_settings.service_account_id' - - field: 'description' - - field: 'folder' - - field: 'index_configs.field_path' - - field: 'index_configs.type' - - field: 'lifecycle_state' - - field: 'location' - - field: 'name' - - field: 'retention_days' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_folder_exclusion_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_folder_exclusion_meta.yaml index be0e3a806580..6a28fc914715 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_folder_exclusion_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_folder_exclusion_meta.yaml @@ -3,9 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogExclusion' -fields: - - field: 'description' - - field: 'disabled' - - field: 'filter' - - field: 'folder' - - field: 'name' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_folder_sink_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_folder_sink_meta.yaml index ca4784ed3a82..9cbbdbe7bfd2 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_folder_sink_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_folder_sink_meta.yaml @@ -3,18 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogSink' -fields: - - field: 'bigquery_options.use_partitioned_tables' - - field: 'description' - - field: 'destination' - - field: 'disabled' - - field: 'exclusions.description' - - field: 'exclusions.disabled' - - field: 'exclusions.filter' - - field: 'exclusions.name' - - field: 'filter' - - field: 'folder' - - field: 'include_children' - - field: 'intercept_children' - - field: 'name' - - field: 'writer_identity' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_organization_bucket_config_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_organization_bucket_config_meta.yaml index a41424dda69c..360364a63c13 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_organization_bucket_config_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_organization_bucket_config_meta.yaml @@ -3,17 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogBucket' -fields: - - field: 'bucket_id' - - field: 'cmek_settings.kms_key_name' - - field: 'cmek_settings.kms_key_version_name' - - field: 'cmek_settings.name' - - field: 'cmek_settings.service_account_id' - - field: 'description' - - field: 'index_configs.field_path' - - field: 'index_configs.type' - - field: 'lifecycle_state' - - field: 'location' - - field: 'name' - - field: 'organization' - - field: 'retention_days' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_organization_exclusion_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_organization_exclusion_meta.yaml index 9c48c01cc704..38fa6d3bbe2f 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_organization_exclusion_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_organization_exclusion_meta.yaml @@ -3,9 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogExclusion' -fields: - - field: 'description' - - field: 'disabled' - - field: 'filter' - - field: 'name' - - field: 'org_id' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_organization_sink_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_organization_sink_meta.yaml index 4d7f4f2d1e89..e15619ac6042 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_organization_sink_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_organization_sink_meta.yaml @@ -3,18 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogSink' -fields: - - field: 'bigquery_options.use_partitioned_tables' - - field: 'description' - - field: 'destination' - - field: 'disabled' - - field: 'exclusions.description' - - field: 'exclusions.disabled' - - field: 'exclusions.filter' - - field: 'exclusions.name' - - field: 'filter' - - field: 'include_children' - - field: 'intercept_children' - - field: 'name' - - field: 'org_id' - - field: 'writer_identity' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_project_bucket_config_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_project_bucket_config_meta.yaml index f076d6c2b469..04cee781e95a 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_project_bucket_config_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_project_bucket_config_meta.yaml @@ -3,19 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogBucket' -fields: - - field: 'bucket_id' - - field: 'cmek_settings.kms_key_name' - - field: 'cmek_settings.kms_key_version_name' - - field: 'cmek_settings.name' - - field: 'cmek_settings.service_account_id' - - field: 'description' - - field: 'enable_analytics' - - field: 'index_configs.field_path' - - field: 'index_configs.type' - - field: 'lifecycle_state' - - field: 'location' - - field: 'locked' - - field: 'name' - - field: 'project' - - field: 'retention_days' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_project_exclusion_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_project_exclusion_meta.yaml index b5c46e90e9bd..a4f8f1818ea3 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_project_exclusion_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_project_exclusion_meta.yaml @@ -3,9 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogExclusion' -fields: - - field: 'description' - - field: 'disabled' - - field: 'filter' - - field: 'name' - - field: 'project' diff --git a/mmv1/third_party/terraform/services/logging/resource_logging_project_sink_meta.yaml b/mmv1/third_party/terraform/services/logging/resource_logging_project_sink_meta.yaml index 133940e14fcc..edbc61496f71 100644 --- a/mmv1/third_party/terraform/services/logging/resource_logging_project_sink_meta.yaml +++ b/mmv1/third_party/terraform/services/logging/resource_logging_project_sink_meta.yaml @@ -3,18 +3,3 @@ generation_type: 'handwritten' api_service_name: 'logging.googleapis.com' api_version: 'v2' api_resource_type_kind: 'LogSink' -fields: - - field: 'bigquery_options.use_partitioned_tables' - - field: 'custom_writer_identity' - - field: 'description' - - field: 'destination' - - field: 'disabled' - - field: 'exclusions.description' - - field: 'exclusions.disabled' - - field: 'exclusions.filter' - - field: 'exclusions.name' - - field: 'filter' - - field: 'name' - - field: 'project' - - field: 'unique_writer_identity' - - field: 'writer_identity' diff --git a/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go index 832794319099..72814cf03c2c 100644 --- a/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go +++ b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go @@ -22,7 +22,6 @@ func TestAccMonitoringAlertPolicy(t *testing.T) { "log": testAccMonitoringAlertPolicy_log, "forecast": testAccMonitoringAlertPolicy_forecast, "promql": testAccMonitoringAlertPolicy_promql, - "sql": testAccMonitoringAlertPolicy_sql, } for name, tc := range testCases { @@ -236,24 +235,6 @@ func testAccMonitoringAlertPolicy_promql(t *testing.T) { }) } -func testAccMonitoringAlertPolicy_sql(t *testing.T) { - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckAlertPolicyDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccMonitoringAlertPolicy_sqlCfg(), - // SQL alerts require additional GCP resources to be created and billed, - // so we only run the plan test for now. - PlanOnly: true, - ExpectNonEmptyPlan: true, - }, - }, - }) -} - func testAccMonitoringAlertPolicy_basicCfg(alertName, conditionName, aligner, filter, severity string) string { return fmt.Sprintf(` resource "google_monitoring_alert_policy" "basic" { @@ -498,211 +479,3 @@ resource "google_monitoring_alert_policy" "promql" { } `, alertName, conditionName) } - -func testAccMonitoringAlertPolicy_sqlCfg() string { - return fmt.Sprintf(` -resource "google_monitoring_alert_policy" "sql_minutes_row_count" { - display_name = "minutes_row_count" - combiner = "OR" - enabled = true - - conditions { - display_name = "minutes_row_count" - - condition_sql { - query = "SELECT severity, resource FROM project.global._Default._AllLogs WHERE severity IS NOT NULL" - minutes { - periodicity = 30 - } - row_count_test { - comparison = "COMPARISON_GT" - threshold = "0" - } - } - } - - severity = "WARNING" - - documentation { - content = "test content" - mime_type = "text/markdown" - subject = "test subject" - links { - display_name = "link display name" - url = "http://mydomain.com" - } - } -} -resource "google_monitoring_alert_policy" "sql_minutes_boolean" { - display_name = "minutes_boolean" - combiner = "OR" - enabled = true - - conditions { - display_name = "minutes_boolean" - - condition_sql { - query = "SELECT severity, resource FROM project.global._Default._AllLogs WHERE severity IS NOT NULL" - minutes { - periodicity = 30 - } - boolean_test { - column = "resource" - } - } - } - - severity = "WARNING" - - documentation { - content = "test content" - mime_type = "text/markdown" - subject = "test subject" - links { - display_name = "link display name" - url = "http://mydomain.com" - } - } -} -resource "google_monitoring_alert_policy" "sql_hourly_row_count" { - display_name = "hourly_row_count" - combiner = "OR" - enabled = true - - conditions { - display_name = "hourly_row_count" - - condition_sql { - query = "SELECT severity, resource FROM project.global._Default._AllLogs WHERE severity IS NOT NULL" - hourly { - periodicity = 3 - minute_offset = 10 - } - row_count_test { - comparison = "COMPARISON_GT" - threshold = "0" - } - } - } - - severity = "WARNING" - - documentation { - content = "test content" - mime_type = "text/markdown" - subject = "test subject" - links { - display_name = "link display name" - url = "http://mydomain.com" - } - } -} -resource "google_monitoring_alert_policy" "sql_hourly_boolean" { - display_name = "hourly_boolean" - combiner = "OR" - enabled = true - - conditions { - display_name = "hourly_boolean" - - condition_sql { - query = "SELECT severity, resource FROM project.global._Default._AllLogs WHERE severity IS NOT NULL" - hourly { - periodicity = 3 - minute_offset = 10 - } - boolean_test { - column = "resource" - } - } - } - - severity = "WARNING" - - documentation { - content = "test content" - mime_type = "text/markdown" - subject = "test subject" - links { - display_name = "link display name" - url = "http://mydomain.com" - } - } -} -resource "google_monitoring_alert_policy" "sql_daily_row_count" { - display_name = "daily_row_count" - combiner = "OR" - enabled = true - - conditions { - display_name = "daily_row_count" - - condition_sql { - query = "SELECT severity, resource FROM project.global._Default._AllLogs WHERE severity IS NOT NULL" - daily { - periodicity = 3 - execution_time { - hours = 10 - minutes = 10 - seconds = 10 - nanos = 10 - } - } - row_count_test { - comparison = "COMPARISON_GT" - threshold = "0" - } - } - } - - severity = "WARNING" - - documentation { - content = "test content" - mime_type = "text/markdown" - subject = "test subject" - links { - display_name = "link display name" - url = "http://mydomain.com" - } - } -} -resource "google_monitoring_alert_policy" "sql_daily_boolean" { - display_name = "daily_boolean" - combiner = "OR" - enabled = true - - conditions { - display_name = "daily_boolean" - - condition_sql { - query = "SELECT severity, resource FROM project.global._Default._AllLogs WHERE severity IS NOT NULL" - daily { - periodicity = 3 - execution_time { - hours = 10 - minutes = 10 - seconds = 10 - nanos = 10 - } - } - boolean_test { - column = "resource" - } - } - } - - severity = "WARNING" - - documentation { - content = "test content" - mime_type = "text/markdown" - subject = "test subject" - links { - display_name = "link display name" - url = "http://mydomain.com" - } - } -} -`) -} diff --git a/mmv1/third_party/terraform/services/monitoring/resource_monitoring_dashboard_meta.yaml b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_dashboard_meta.yaml index 8008b75c43f5..626228ebebb4 100644 --- a/mmv1/third_party/terraform/services/monitoring/resource_monitoring_dashboard_meta.yaml +++ b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_dashboard_meta.yaml @@ -3,6 +3,3 @@ generation_type: 'handwritten' api_service_name: 'monitoring.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Dashboard' -fields: - - field: 'dashboard_json' - - field: 'project' diff --git a/mmv1/third_party/terraform/services/netapp/resource_netapp_storage_pool_test.go.tmpl b/mmv1/third_party/terraform/services/netapp/resource_netapp_storage_pool_test.go.tmpl index 11d6210c419a..9d3aab1f435d 100644 --- a/mmv1/third_party/terraform/services/netapp/resource_netapp_storage_pool_test.go.tmpl +++ b/mmv1/third_party/terraform/services/netapp/resource_netapp_storage_pool_test.go.tmpl @@ -316,51 +316,3 @@ data "google_compute_network" "default" { } `, context) } - -func TestAccNetappStoragePool_FlexRegionalStoragePoolNoZone(t *testing.T) { - context := map[string]interface{}{ - "network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "gcnv-network-config-1", acctest.ServiceNetworkWithParentService("netapp.servicenetworking.goog")), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckNetappStoragePoolDestroyProducer(t), - ExternalProviders: map[string]resource.ExternalProvider{ - "time": {}, - }, - Steps: []resource.TestStep{ - { - Config: testAccNetappStoragePool_FlexRegionalStoragePoolNoZone(context), - }, - { - ResourceName: "google_netapp_storage_pool.test_pool", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "name", "labels", "terraform_labels"}, - }, - }, - }) -} - -func testAccNetappStoragePool_FlexRegionalStoragePoolNoZone(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_netapp_storage_pool" "test_pool" { - name = "tf-test-pool%{random_suffix}" - location = "europe-west3-a" - service_level = "FLEX" - capacity_gib = "2048" - network = data.google_compute_network.default.id -} - -resource "time_sleep" "wait_5_minutes" { - depends_on = [google_netapp_storage_pool.test_pool] - destroy_duration = "5m" -} - -data "google_compute_network" "default" { - name = "%{network_name}" -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_quotaRule_sweeper.go b/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_quotaRule_sweeper.go deleted file mode 100644 index 9f8b9abf43e1..000000000000 --- a/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_quotaRule_sweeper.go +++ /dev/null @@ -1,127 +0,0 @@ -package netapp - -import ( - "context" - "log" - "strings" - "testing" - - "github.com/hashicorp/terraform-provider-google/google/envvar" - "github.com/hashicorp/terraform-provider-google/google/sweeper" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -func init() { - sweeper.AddTestSweepers("NetappVolumeQuotaRule", testSweepNetappVolumeQuotaRule) -} - -// At the time of writing, the CI only passes us-central1 as the region -func testSweepNetappVolumeQuotaRule(region string) error { - resourceName := "NetappVolumeQuotaRule" - log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s", resourceName) - - config, err := sweeper.SharedConfigForRegion(region) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) - return err - } - - err = config.LoadAndValidate(context.Background()) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] error loading: %s", err) - return err - } - - t := &testing.T{} - billingId := envvar.GetTestBillingAccountFromEnv(t) - - regions := []string{"us-central1", "us-west2", "us-east4"} - for _, r := range regions { - log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s in %s", resourceName, r) - - // Setup variables to replace in list template - d := &tpgresource.ResourceDataMock{ - FieldsInSchema: map[string]interface{}{ - "project": config.Project, - "region": r, - "location": r, - "zone": "-", - "billing_account": billingId, - }, - } - - listTemplate := strings.Split("https://netapp.googleapis.com/v1/projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/quotaRules", "?")[0] - listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err) - continue - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: config.Project, - RawURL: listUrl, - UserAgent: config.UserAgent, - }) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err) - continue - } - - resourceList, ok := res["volumeQuotaRules"] - if !ok { - log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.") - continue - } - - rl := resourceList.([]interface{}) - - log.Printf("[INFO][SWEEPER_LOG] Found %d items in %s list response.", len(rl), resourceName) - // Keep count of items that aren't sweepable for logging. - nonPrefixCount := 0 - for _, ri := range rl { - obj := ri.(map[string]interface{}) - if obj["name"] == nil { - log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName) - continue - } - - name := tpgresource.GetResourceNameFromSelfLink(obj["name"].(string)) - // Skip resources that shouldn't be sweeped - if !sweeper.IsSweepableTestResource(name) { - nonPrefixCount++ - continue - } - - deleteTemplate := "https://netapp.googleapis.com/v1/projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/quotaRules/{{name}}" - deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err) - continue - } - deleteUrl = deleteUrl + name - - // Don't wait on operations as we may have a lot to delete - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: config.Project, - RawURL: deleteUrl, - UserAgent: config.UserAgent, - }) - if err != nil { - log.Printf("[INFO][SWEEPER_LOG] Error deleting for url %s : %s", deleteUrl, err) - } else { - log.Printf("[INFO][SWEEPER_LOG] Sent delete request for %s resource: %s", resourceName, name) - } - } - - if nonPrefixCount > 0 { - log.Printf("[INFO][SWEEPER_LOG] %d items were non-sweepable and skipped.", nonPrefixCount) - } - } - - return nil -} diff --git a/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_quotaRule_test.go b/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_quotaRule_test.go deleted file mode 100644 index 804dcb37b292..000000000000 --- a/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_quotaRule_test.go +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package netapp_test - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccNetappVolumeQuotaRule_netappVolumeQuotaRuleBasicExample_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "gcnv-network-config-1", acctest.ServiceNetworkWithParentService("netapp.servicenetworking.goog")), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckNetappVolumeQuotaRuleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccNetappVolumeQuotaRule_netappVolumeQuotaRuleFull(context), - }, - { - ResourceName: "google_netapp_volume_quota_rule.test_default_user_quota_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels", "volume_name"}, - }, - { - ResourceName: "google_netapp_volume_quota_rule.test_default_group_quota_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels", "volume_name"}, - }, - { - ResourceName: "google_netapp_volume_quota_rule.test_individual_user_quota_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels", "volume_name"}, - }, - { - ResourceName: "google_netapp_volume_quota_rule.test_individual_group_quota_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels", "volume_name"}, - }, - { - Config: testAccNetappVolumeQuotaRule_netappVolumeQuotaRuleFull_update(context), - }, - { - ResourceName: "google_netapp_volume_quota_rule.test_default_user_quota_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels", "volume_name"}, - }, - { - ResourceName: "google_netapp_volume_quota_rule.test_default_group_quota_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels", "volume_name"}, - }, - { - ResourceName: "google_netapp_volume_quota_rule.test_individual_user_quota_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels", "volume_name"}, - }, - { - ResourceName: "google_netapp_volume_quota_rule.test_individual_group_quota_rule", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels", "volume_name"}, - }, - }, - }) -} - -func testAccNetappVolumeQuotaRule_netappVolumeQuotaRuleFull(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_netapp_storage_pool" "default" { - name = "tf-test-test-pool%{random_suffix}" - location = "us-west2" - service_level = "PREMIUM" - capacity_gib = 2048 - network = data.google_compute_network.default.id -} - -resource "google_netapp_volume" "default" { - location = google_netapp_storage_pool.default.location - name = "tf-test-test-volume%{random_suffix}" - capacity_gib = 100 - share_name = "tf-test-test-volume%{random_suffix}" - storage_pool = google_netapp_storage_pool.default.name - protocols = ["NFSV3"] -} - -resource "google_netapp_volume_quota_rule" "test_default_user_quota_rule" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - name = "tf-default-user-quota-rule%{random_suffix}" - description = "This is a test description" - type = "DEFAULT_USER_QUOTA" - disk_limit_mib = 15 -} - -resource "google_netapp_volume_quota_rule" "test_default_group_quota_rule" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - name = "tf-default-group-quota-rule%{random_suffix}" - description = "This is a test description" - labels = { - key = "test" - value = "quota_rule" - } - type = "DEFAULT_GROUP_QUOTA" - disk_limit_mib = 20 -} - -resource "google_netapp_volume_quota_rule" "test_individual_user_quota_rule" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - name = "tf-individual-user-quota-rule%{random_suffix}" - description = "This is a test description" - type = "INDIVIDUAL_USER_QUOTA" - disk_limit_mib = 25 - target = "001" -} - -resource "google_netapp_volume_quota_rule" "test_individual_group_quota_rule" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - name = "tf-individual-group-quota-rule%{random_suffix}" - description = "This is a test description" - type = "INDIVIDUAL_GROUP_QUOTA" - disk_limit_mib = 30 - target = "011" -} - -data "google_compute_network" "default" { - name = "%{network_name}" -} -`, context) -} - -func testAccNetappVolumeQuotaRule_netappVolumeQuotaRuleFull_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_netapp_storage_pool" "default" { - name = "tf-test-test-pool%{random_suffix}" - location = "us-west2" - service_level = "PREMIUM" - capacity_gib = 2048 - network = data.google_compute_network.default.id -} - -resource "google_netapp_volume" "default" { - location = google_netapp_storage_pool.default.location - name = "tf-test-test-volume%{random_suffix}" - capacity_gib = 100 - share_name = "tf-test-test-volume%{random_suffix}" - storage_pool = google_netapp_storage_pool.default.name - protocols = ["NFSV3"] -} - -resource "google_netapp_volume_quota_rule" "test_default_user_quota_rule" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - name = "tf-default-user-quota-rule%{random_suffix}" - description = "This is a test description" - type = "DEFAULT_USER_QUOTA" - disk_limit_mib = 35 -} - -resource "google_netapp_volume_quota_rule" "test_default_group_quota_rule" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - name = "tf-default-group-quota-rule%{random_suffix}" - description = "This is a test description" - labels = { - key = "test" - value = "quota_rule" - } - type = "DEFAULT_GROUP_QUOTA" - disk_limit_mib = 40 -} - -resource "google_netapp_volume_quota_rule" "test_individual_user_quota_rule" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - name = "tf-individual-user-quota-rule%{random_suffix}" - description = "This is a test description" - type = "INDIVIDUAL_USER_QUOTA" - disk_limit_mib = 45 - target = "001" -} - -resource "google_netapp_volume_quota_rule" "test_individual_group_quota_rule" { - depends_on = [google_netapp_volume.default] - location = google_netapp_volume.default.location - volume_name = google_netapp_volume.default.name - name = "tf-individual-group-quota-rule%{random_suffix}" - description = "This is a test description" - type = "INDIVIDUAL_GROUP_QUOTA" - disk_limit_mib = 50 - target = "011" -} - -data "google_compute_network" "default" { - name = "%{network_name}" -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_authz_extension_test.go b/mmv1/third_party/terraform/services/networkservices/resource_network_services_authz_extension_test.go index c0ffd27bfca2..9a6a192f21c5 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_authz_extension_test.go +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_authz_extension_test.go @@ -47,13 +47,13 @@ func TestAccNetworkServicesAuthzExtension_update(t *testing.T) { func testAccNetworkServicesAuthzExtension_start(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_compute_network" "default" { - name = "tf-test-lb-network%{random_suffix}" + name = "lb-network" project = "%{project}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "tf-test-backend-subnet%{random_suffix}" + name = "backend-subnet" project = "%{project}" region = "us-west1" ip_cidr_range = "10.1.2.0/24" @@ -61,7 +61,7 @@ resource "google_compute_subnetwork" "default" { } resource "google_compute_subnetwork" "proxy_only" { - name = "tf-test-proxy-only-subnet%{random_suffix}" + name = "proxy-only-subnet" project = "%{project}" region = "us-west1" ip_cidr_range = "10.129.0.0/23" @@ -71,7 +71,7 @@ resource "google_compute_subnetwork" "proxy_only" { } resource "google_compute_address" "default" { - name = "tf-test-l7-ilb-ip-address%{random_suffix}" + name = "l7-ilb-ip-address" project = "%{project}" region = "us-west1" subnetwork = google_compute_subnetwork.default.id @@ -81,7 +81,7 @@ resource "google_compute_address" "default" { resource "google_compute_region_health_check" "default" { - name = "tf-test-l7-ilb-basic-check%{random_suffix}" + name = "l7-ilb-basic-check" project = "%{project}" region = "us-west1" @@ -91,7 +91,7 @@ resource "google_compute_region_health_check" "default" { } resource "google_compute_region_backend_service" "url_map" { - name = "tf-test-l7-ilb-backend-service%{random_suffix}" + name = "l7-ilb-backend-service" project = "%{project}" region = "us-west1" load_balancing_scheme = "INTERNAL_MANAGED" @@ -100,7 +100,7 @@ resource "google_compute_region_backend_service" "url_map" { } resource "google_compute_forwarding_rule" "default" { - name = "tf-test-l7-ilb-forwarding-rule%{random_suffix}" + name = "l7-ilb-forwarding-rule" project = "%{project}" region = "us-west1" load_balancing_scheme = "INTERNAL_MANAGED" @@ -115,21 +115,21 @@ resource "google_compute_forwarding_rule" "default" { } resource "google_compute_region_url_map" "default" { - name = "tf-test-l7-ilb-map%{random_suffix}" + name = "l7-ilb-map" project = "%{project}" region = "us-west1" default_service = google_compute_region_backend_service.url_map.id } resource "google_compute_region_target_http_proxy" "default" { - name = "tf-test-l7-ilb-proxy%{random_suffix}" + name = "l7-ilb-proxy" project = "%{project}" region = "us-west1" url_map = google_compute_region_url_map.default.id } resource "google_compute_region_backend_service" "default" { - name = "tf-test-authz-service%{random_suffix}" + name = "authz-service" project = "%{project}" region = "us-west1" @@ -139,7 +139,7 @@ resource "google_compute_region_backend_service" "default" { } resource "google_compute_region_backend_service" "updated" { - name = "tf-test-authz-service-updated%{random_suffix}" + name = "authz-service-updated" project = "%{project}" region = "us-west1" @@ -167,13 +167,13 @@ resource "google_network_services_authz_extension" "default" { func testAccNetworkServicesAuthzExtension_update(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_compute_network" "default" { - name = "tf-test-lb-network%{random_suffix}" + name = "lb-network" project = "%{project}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "tf-test-backend-subnet%{random_suffix}" + name = "backend-subnet" project = "%{project}" region = "us-west1" ip_cidr_range = "10.1.2.0/24" @@ -181,7 +181,7 @@ resource "google_compute_subnetwork" "default" { } resource "google_compute_subnetwork" "proxy_only" { - name = "tf-test-proxy-only-subnet%{random_suffix}" + name = "proxy-only-subnet" project = "%{project}" region = "us-west1" ip_cidr_range = "10.129.0.0/23" @@ -191,7 +191,7 @@ resource "google_compute_subnetwork" "proxy_only" { } resource "google_compute_address" "default" { - name = "tf-test-l7-ilb-ip-address%{random_suffix}" + name = "l7-ilb-ip-address" project = "%{project}" region = "us-west1" subnetwork = google_compute_subnetwork.default.id @@ -200,7 +200,7 @@ resource "google_compute_address" "default" { } resource "google_compute_region_health_check" "default" { - name = "tf-test-l7-ilb-basic-check%{random_suffix}" + name = "l7-ilb-basic-check" project = "%{project}" region = "us-west1" @@ -210,7 +210,7 @@ resource "google_compute_region_health_check" "default" { } resource "google_compute_region_backend_service" "url_map" { - name = "tf-test-l7-ilb-backend-service%{random_suffix}" + name = "l7-ilb-backend-service" project = "%{project}" region = "us-west1" load_balancing_scheme = "INTERNAL_MANAGED" @@ -219,7 +219,7 @@ resource "google_compute_region_backend_service" "url_map" { } resource "google_compute_forwarding_rule" "default" { - name = "tf-test-l7-ilb-forwarding-rule%{random_suffix}" + name = "l7-ilb-forwarding-rule" project = "%{project}" region = "us-west1" load_balancing_scheme = "INTERNAL_MANAGED" @@ -234,21 +234,21 @@ resource "google_compute_forwarding_rule" "default" { } resource "google_compute_region_url_map" "default" { - name = "tf-test-l7-ilb-map%{random_suffix}" + name = "l7-ilb-map" project = "%{project}" region = "us-west1" default_service = google_compute_region_backend_service.url_map.id } resource "google_compute_region_target_http_proxy" "default" { - name = "tf-test-l7-ilb-proxy%{random_suffix}" + name = "l7-ilb-proxy" project = "%{project}" region = "us-west1" url_map = google_compute_region_url_map.default.id } resource "google_compute_region_backend_service" "default" { - name = "tf-test-authz-service%{random_suffix}" + name = "authz-service" project = "%{project}" region = "us-west1" @@ -258,7 +258,7 @@ resource "google_compute_region_backend_service" "default" { } resource "google_compute_region_backend_service" "updated" { - name = "tf-test-authz-service-updated%{random_suffix}" + name = "authz-service-updated" project = "%{project}" region = "us-west1" @@ -279,6 +279,7 @@ resource "google_network_services_authz_extension" "default" { timeout = "0.1s" fail_open = false forward_headers = ["Authorization"] + wire_format = "EXT_PROC_GRPC" metadata = { forwarding_rule_id = google_compute_forwarding_rule.default.id diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_edge_cache_service_test.go b/mmv1/third_party/terraform/services/networkservices/resource_network_services_edge_cache_service_test.go index 82b3329e5889..fadd14ede05c 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_edge_cache_service_test.go +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_edge_cache_service_test.go @@ -77,7 +77,6 @@ resource "google_network_services_edge_cache_service" "served" { cache_mode = "CACHE_ALL_STATIC" default_ttl = "3600s" } - compression_mode = "AUTOMATIC" } header_action { response_header_to_add { @@ -132,9 +131,6 @@ resource "google_network_services_edge_cache_service" "served" { default_ttl = "3600s" } } - route_methods { - allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "POST", "DELETE", "PATCH"] - } header_action { response_header_to_add { header_name = "x-cache-status" diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_gateway_test.go b/mmv1/third_party/terraform/services/networkservices/resource_network_services_gateway_test.go index d5478d2a0542..6f20ec7a7dae 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_gateway_test.go +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_gateway_test.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" ) func TestAccNetworkServicesGateway_update(t *testing.T) { @@ -31,11 +30,6 @@ func TestAccNetworkServicesGateway_update(t *testing.T) { }, { Config: testAccNetworkServicesGateway_update(gatewayName), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_network_services_gateway.foobar", plancheck.ResourceActionUpdate), - }, - }, }, { ResourceName: "google_network_services_gateway.foobar", @@ -65,7 +59,7 @@ resource "google_network_services_gateway" "foobar" { name = "%s" scope = "default-scope-update" type = "OPEN_MESH" - ports = [1000] + ports = [443] description = "update description" labels = { foo = "bar" diff --git a/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment_meta.yaml b/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment_meta.yaml index ec2c13317e50..d7041c060f3f 100644 --- a/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment_meta.yaml +++ b/mmv1/third_party/terraform/services/osconfig/resource_os_config_os_policy_assignment_meta.yaml @@ -3,109 +3,3 @@ generation_type: 'handwritten' api_service_name: 'osconfig.googleapis.com' api_version: 'v1' api_resource_type_kind: 'OSPolicyAssignment' -fields: - - field: 'baseline' - - field: 'deleted' - - field: 'description' - - field: 'etag' - - field: 'instance_filter.all' - - field: 'instance_filter.exclusion_labels.labels' - - field: 'instance_filter.inclusion_labels.labels' - - field: 'instance_filter.inventories.os_short_name' - - field: 'instance_filter.inventories.os_version' - - field: 'location' - - field: 'name' - - field: 'os_policies.allow_no_resource_group_match' - - field: 'os_policies.description' - - field: 'os_policies.id' - - field: 'os_policies.mode' - - field: 'os_policies.resource_groups.inventory_filters.os_short_name' - - field: 'os_policies.resource_groups.inventory_filters.os_version' - - field: 'os_policies.resource_groups.resources.exec.enforce.args' - - field: 'os_policies.resource_groups.resources.exec.enforce.file.allow_insecure' - - field: 'os_policies.resource_groups.resources.exec.enforce.file.gcs.bucket' - - field: 'os_policies.resource_groups.resources.exec.enforce.file.gcs.generation' - - field: 'os_policies.resource_groups.resources.exec.enforce.file.gcs.object' - - field: 'os_policies.resource_groups.resources.exec.enforce.file.local_path' - - field: 'os_policies.resource_groups.resources.exec.enforce.file.remote.sha256_checksum' - - field: 'os_policies.resource_groups.resources.exec.enforce.file.remote.uri' - - field: 'os_policies.resource_groups.resources.exec.enforce.interpreter' - - field: 'os_policies.resource_groups.resources.exec.enforce.output_file_path' - - field: 'os_policies.resource_groups.resources.exec.enforce.script' - - field: 'os_policies.resource_groups.resources.exec.validate.args' - - field: 'os_policies.resource_groups.resources.exec.validate.file.allow_insecure' - - field: 'os_policies.resource_groups.resources.exec.validate.file.gcs.bucket' - - field: 'os_policies.resource_groups.resources.exec.validate.file.gcs.generation' - - field: 'os_policies.resource_groups.resources.exec.validate.file.gcs.object' - - field: 'os_policies.resource_groups.resources.exec.validate.file.local_path' - - field: 'os_policies.resource_groups.resources.exec.validate.file.remote.sha256_checksum' - - field: 'os_policies.resource_groups.resources.exec.validate.file.remote.uri' - - field: 'os_policies.resource_groups.resources.exec.validate.interpreter' - - field: 'os_policies.resource_groups.resources.exec.validate.output_file_path' - - field: 'os_policies.resource_groups.resources.exec.validate.script' - - field: 'os_policies.resource_groups.resources.file.content' - - field: 'os_policies.resource_groups.resources.file.file.allow_insecure' - - field: 'os_policies.resource_groups.resources.file.file.gcs.bucket' - - field: 'os_policies.resource_groups.resources.file.file.gcs.generation' - - field: 'os_policies.resource_groups.resources.file.file.gcs.object' - - field: 'os_policies.resource_groups.resources.file.file.local_path' - - field: 'os_policies.resource_groups.resources.file.file.remote.sha256_checksum' - - field: 'os_policies.resource_groups.resources.file.file.remote.uri' - - field: 'os_policies.resource_groups.resources.file.path' - - field: 'os_policies.resource_groups.resources.file.permissions' - - field: 'os_policies.resource_groups.resources.file.state' - - field: 'os_policies.resource_groups.resources.id' - - field: 'os_policies.resource_groups.resources.pkg.apt.name' - - field: 'os_policies.resource_groups.resources.pkg.deb.pull_deps' - - field: 'os_policies.resource_groups.resources.pkg.deb.source.allow_insecure' - - field: 'os_policies.resource_groups.resources.pkg.deb.source.gcs.bucket' - - field: 'os_policies.resource_groups.resources.pkg.deb.source.gcs.generation' - - field: 'os_policies.resource_groups.resources.pkg.deb.source.gcs.object' - - field: 'os_policies.resource_groups.resources.pkg.deb.source.local_path' - - field: 'os_policies.resource_groups.resources.pkg.deb.source.remote.sha256_checksum' - - field: 'os_policies.resource_groups.resources.pkg.deb.source.remote.uri' - - field: 'os_policies.resource_groups.resources.pkg.desired_state' - - field: 'os_policies.resource_groups.resources.pkg.googet.name' - - field: 'os_policies.resource_groups.resources.pkg.msi.properties' - - field: 'os_policies.resource_groups.resources.pkg.msi.source.allow_insecure' - - field: 'os_policies.resource_groups.resources.pkg.msi.source.gcs.bucket' - - field: 'os_policies.resource_groups.resources.pkg.msi.source.gcs.generation' - - field: 'os_policies.resource_groups.resources.pkg.msi.source.gcs.object' - - field: 'os_policies.resource_groups.resources.pkg.msi.source.local_path' - - field: 'os_policies.resource_groups.resources.pkg.msi.source.remote.sha256_checksum' - - field: 'os_policies.resource_groups.resources.pkg.msi.source.remote.uri' - - field: 'os_policies.resource_groups.resources.pkg.rpm.pull_deps' - - field: 'os_policies.resource_groups.resources.pkg.rpm.source.allow_insecure' - - field: 'os_policies.resource_groups.resources.pkg.rpm.source.gcs.bucket' - - field: 'os_policies.resource_groups.resources.pkg.rpm.source.gcs.generation' - - field: 'os_policies.resource_groups.resources.pkg.rpm.source.gcs.object' - - field: 'os_policies.resource_groups.resources.pkg.rpm.source.local_path' - - field: 'os_policies.resource_groups.resources.pkg.rpm.source.remote.sha256_checksum' - - field: 'os_policies.resource_groups.resources.pkg.rpm.source.remote.uri' - - field: 'os_policies.resource_groups.resources.pkg.yum.name' - - field: 'os_policies.resource_groups.resources.pkg.zypper.name' - - field: 'os_policies.resource_groups.resources.repository.apt.archive_type' - - field: 'os_policies.resource_groups.resources.repository.apt.components' - - field: 'os_policies.resource_groups.resources.repository.apt.distribution' - - field: 'os_policies.resource_groups.resources.repository.apt.gpg_key' - - field: 'os_policies.resource_groups.resources.repository.apt.uri' - - field: 'os_policies.resource_groups.resources.repository.goo.name' - - field: 'os_policies.resource_groups.resources.repository.goo.url' - - field: 'os_policies.resource_groups.resources.repository.yum.base_url' - - field: 'os_policies.resource_groups.resources.repository.yum.display_name' - - field: 'os_policies.resource_groups.resources.repository.yum.gpg_keys' - - field: 'os_policies.resource_groups.resources.repository.yum.id' - - field: 'os_policies.resource_groups.resources.repository.zypper.base_url' - - field: 'os_policies.resource_groups.resources.repository.zypper.display_name' - - field: 'os_policies.resource_groups.resources.repository.zypper.gpg_keys' - - field: 'os_policies.resource_groups.resources.repository.zypper.id' - - field: 'project' - - field: 'reconciling' - - field: 'revision_create_time' - - field: 'revision_id' - - field: 'rollout.disruption_budget.fixed' - - field: 'rollout.disruption_budget.percent' - - field: 'rollout.min_wait_duration' - - field: 'rollout_state' - - field: 'skip_await_rollout' - - field: 'uid' diff --git a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter.go.tmpl deleted file mode 100644 index 290cdf4064de..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter.go.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -package parametermanager -{{ if ne $.TargetVersionName `ga` -}} - -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 DataSourceParameterManagerParameter() *schema.Resource { - - dsSchema := tpgresource.DatasourceSchemaFromResourceSchema(ResourceParameterManagerParameter().Schema) - tpgresource.AddRequiredFieldsToSchema(dsSchema, "parameter_id") - tpgresource.AddOptionalFieldsToSchema(dsSchema, "project") - - return &schema.Resource{ - Read: dataSourceParameterManagerParameterRead, - Schema: dsSchema, - } -} - -func dataSourceParameterManagerParameterRead(d *schema.ResourceData, meta interface{}) error { - id, err := tpgresource.ReplaceVars(d, meta.(*transport_tpg.Config), "projects/{{"{{"}}project{{"}}"}}/locations/global/parameters/{{"{{"}}parameter_id{{"}}"}}") - if err != nil { - return fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - err = resourceParameterManagerParameterRead(d, meta) - if err != nil { - return err - } - - if err := tpgresource.SetDataSourceLabels(d); err != nil { - return err - } - - if d.Id() == "" { - return fmt.Errorf("%s not found", id) - } - return nil -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_test.go.tmpl deleted file mode 100644 index ded4fdfeba86..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_test.go.tmpl +++ /dev/null @@ -1,59 +0,0 @@ -package parametermanager_test -{{ if ne $.TargetVersionName `ga` -}} - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceParameterManagerParameter_basic(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDataSourceParameterManagerParameter_basic(context), - Check: resource.ComposeTestCheckFunc( - acctest.CheckDataSourceStateMatchesResourceState( - "data.google_parameter_manager_parameter.parameter-datasource", - "google_parameter_manager_parameter.parameter", - ), - ), - }, - }, - }) -} - -func testAccDataSourceParameterManagerParameter_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "YAML" - - labels = { - key1 = "val1" - key2 = "val2" - key3 = "val3" - key4 = "val4" - key5 = "val5" - } -} - -data "google_parameter_manager_parameter" "parameter-datasource" { - provider = google-beta - parameter_id = google_parameter_manager_parameter.parameter.parameter_id -} -`, context) -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version.go.tmpl deleted file mode 100644 index 480406b36078..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version.go.tmpl +++ /dev/null @@ -1,162 +0,0 @@ -package parametermanager -{{- if ne $.TargetVersionName "ga" }} - -import ( - "encoding/base64" - "fmt" - "net/http" - "regexp" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func DataSourceParameterManagerParameterVersion() *schema.Resource { - return &schema.Resource{ - Read: dataSourceParameterManagerParameterVersionRead, - Schema: map[string]*schema.Schema{ - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "parameter": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - }, - "parameter_version_id": { - Type: schema.TypeString, - Required: true, - }, - "parameter_data": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, - }, - "name": { - Type: schema.TypeString, - Computed: true, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - }, - "update_time": { - Type: schema.TypeString, - Computed: true, - }, - "disabled": { - Type: schema.TypeBool, - Computed: true, - }, - }, - } -} - -func dataSourceParameterManagerParameterVersionRead(d *schema.ResourceData, meta interface{}) error { - config := meta.(*transport_tpg.Config) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - // Check if the parameter is provided as a resource reference or a parameter id. - parameterRegex := regexp.MustCompile("projects/(.+)/locations/global/parameters/(.+)$") - dParameter, ok := d.Get("parameter").(string) - if !ok { - return fmt.Errorf("wrong type for parameter field (%T), expected string", d.Get("parameter")) - } - - parts := parameterRegex.FindStringSubmatch(dParameter) - var project string - - // if reference of the parameter is provided in the parameter field - if len(parts) == 3 { - // Stores value of project to set in state - project = parts[1] - if dProject, ok := d.Get("project").(string); !ok { - return fmt.Errorf("wrong type for project (%T), expected string", d.Get("project")) - } else if dProject != "" && dProject != project { - return fmt.Errorf("project field value (%s) does not match project of parameter (%s).", dProject, project) - } - if err := d.Set("parameter", parts[2]); err != nil { - return fmt.Errorf("error setting parameter: %s", err) - } - } else { // if parameter name is provided in the parameter field - // Stores value of project to set in state - project, err = tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("error fetching project for parameter: %s", err) - } - } - if err := d.Set("project", project); err != nil { - return fmt.Errorf("error setting project: %s", err) - } - - dParameterVersionId, ok := d.Get("parameter_version_id").(string) - if !ok { - return fmt.Errorf("wrong type for parameter version id field (%T), expected string", d.Get("parameter_version_id")) - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ParameterManagerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/parameters/{{"{{"}}parameter{{"}}"}}/versions/{{"{{"}}parameter_version_id{{"}}"}}") - if err != nil { - return err - } - - headers := make(http.Header) - parameterVersion, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: userAgent, - Headers: headers, - }) - if err != nil { - return fmt.Errorf("error retrieving available parameter manager parameter versions: %s", err.Error()) - } - - // If the response contains the disabled value, return an error stating that the parameter version is currently disabled - isDisabled, ok := parameterVersion["disabled"] - if ok && isDisabled.(bool) { - return fmt.Errorf("parameter version %s is in DISABLED state.", dParameterVersionId) - } - - nameValue, ok := parameterVersion["name"] - if !ok { - return fmt.Errorf("read response didn't contain critical fields. Read may not have succeeded.") - } - - if err := d.Set("name", nameValue.(string)); err != nil { - return fmt.Errorf("error reading parameterVersion: %s", err) - } - - if err := d.Set("disabled", false); err != nil { - return fmt.Errorf("error setting disabled: %s", err) - } - - if err := d.Set("update_time", parameterVersion["updateTime"].(string)); err != nil { - return fmt.Errorf("error setting update_time: %s", err) - } - - if err := d.Set("create_time", parameterVersion["createTime"].(string)); err != nil { - return fmt.Errorf("error setting create_time: %s", err) - } - - data := parameterVersion["payload"].(map[string]interface{}) - parameterData, err := base64.StdEncoding.DecodeString(data["data"].(string)) - if err != nil { - return fmt.Errorf("error decoding parameter manager parameter version data: %s", err.Error()) - } - if err := d.Set("parameter_data", string(parameterData)); err != nil { - return fmt.Errorf("error setting parameter_data: %s", err) - } - - d.SetId(nameValue.(string)) - return nil -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_render.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_render.go.tmpl deleted file mode 100644 index 3d123b5b81a3..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_render.go.tmpl +++ /dev/null @@ -1,158 +0,0 @@ -package parametermanager -{{- if ne $.TargetVersionName "ga" }} - -import ( - "encoding/base64" - "fmt" - "net/http" - "regexp" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func DataSourceParameterManagerParameterVersionRender() *schema.Resource { - return &schema.Resource{ - Read: dataSourceParameterManagerParameterVersionRenderRead, - Schema: map[string]*schema.Schema{ - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "parameter": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - }, - "parameter_version_id": { - Type: schema.TypeString, - Required: true, - }, - "parameter_data": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, - }, - "rendered_parameter_data": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, - }, - "name": { - Type: schema.TypeString, - Computed: true, - }, - "disabled": { - Type: schema.TypeBool, - Computed: true, - }, - }, - } -} - -func dataSourceParameterManagerParameterVersionRenderRead(d *schema.ResourceData, meta interface{}) error { - config := meta.(*transport_tpg.Config) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - // Check if the parameter is provided as a resource reference or a parameter id. - parameterRegex := regexp.MustCompile("projects/(.+)/locations/global/parameters/(.+)$") - dParameter, ok := d.Get("parameter").(string) - if !ok { - return fmt.Errorf("wrong type for parameter field (%T), expected string", d.Get("parameter")) - } - - parts := parameterRegex.FindStringSubmatch(dParameter) - var project string - - // if reference of the parameter is provided in the parameter field - if len(parts) == 3 { - // Stores value of project to set in state - project = parts[1] - if dProject, ok := d.Get("project").(string); !ok { - return fmt.Errorf("wrong type for project (%T), expected string", d.Get("project")) - } else if dProject != "" && dProject != project { - return fmt.Errorf("project field value (%s) does not match project of parameter (%s).", dProject, project) - } - if err := d.Set("parameter", parts[2]); err != nil { - return fmt.Errorf("error setting parameter: %s", err) - } - } else { // if parameter name is provided in the parameter field - // Stores value of project to set in state - project, err = tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("error fetching project for parameter: %s", err) - } - } - if err := d.Set("project", project); err != nil { - return fmt.Errorf("error setting project: %s", err) - } - - dParameterVersionId, ok := d.Get("parameter_version_id").(string) - if !ok { - return fmt.Errorf("wrong type for parameter version id field (%T), expected string", d.Get("parameter_version_id")) - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ParameterManagerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/parameters/{{"{{"}}parameter{{"}}"}}/versions/{{"{{"}}parameter_version_id{{"}}"}}:render") - if err != nil { - return err - } - - headers := make(http.Header) - parameterVersion, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: userAgent, - Headers: headers, - }) - if err != nil { - return fmt.Errorf("error retrieving available parameter manager parameter version: %s", err.Error()) - } - - // If the response contains the disabled value, return an error stating that the parameter version is currently disabled - isDisabled, ok := parameterVersion["disabled"] - if ok && isDisabled.(bool) { - return fmt.Errorf("parameter version %s is in DISABLED state.", dParameterVersionId) - } - - nameValue, ok := parameterVersion["parameterVersion"] - if !ok { - return fmt.Errorf("read response didn't contain critical fields. Read may not have succeeded.") - } - - if err := d.Set("name", nameValue.(string)); err != nil { - return fmt.Errorf("error reading parameterVersion: %s", err) - } - - if err := d.Set("disabled", false); err != nil { - return fmt.Errorf("error setting disabled: %s", err) - } - - data := parameterVersion["payload"].(map[string]interface{}) - parameterData, err := base64.StdEncoding.DecodeString(data["data"].(string)) - if err != nil { - return fmt.Errorf("error decoding parameter manager parameter version data: %s", err.Error()) - } - if err := d.Set("parameter_data", string(parameterData)); err != nil { - return fmt.Errorf("error setting parameter_data: %s", err) - } - - renderedParameterData, err := base64.StdEncoding.DecodeString(parameterVersion["renderedPayload"].(string)) - if err != nil { - return fmt.Errorf("error decoding parameter manager parameter version rendered payload data: %s", err.Error()) - } - if err := d.Set("rendered_parameter_data", string(renderedParameterData)); err != nil { - return fmt.Errorf("error setting rendered_parameter_data: %s", err) - } - d.SetId(nameValue.(string)) - return nil -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_render_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_render_test.go.tmpl deleted file mode 100644 index 6e94f845bdbc..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_render_test.go.tmpl +++ /dev/null @@ -1,245 +0,0 @@ -package parametermanager_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "errors" - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceParameterManagerParameterVersionRender_basicWithResourceReference(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameterVersionRender_basicWithResourceReference(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerParameterDataDataSourceMatchesResource("data.google_parameter_manager_parameter_version_render.parameter-version-basic", "google_parameter_manager_parameter_version.parameter-version-basic"), - testAccCheckParameterManagerRenderedParameterDataMatchesDataSourceRenderedData("data.google_parameter_manager_parameter_version_render.parameter-version-basic", "\"tempsecret\": \"parameter-version-data\"\n"), - ), - }, - }, - }) -} - -func testAccParameterManagerParameterVersionRender_basicWithResourceReference(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "YAML" -} - -resource "google_secret_manager_secret" "secret-basic" { - provider = google-beta - secret_id = "tf-temp-secret-basic%{random_suffix}" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_secret.secret-basic.id - secret_data = "parameter-version-data" -} - -resource "google_secret_manager_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_secret.secret-basic.secret_id - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_parameter.parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = yamlencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_secret_version.secret-version-basic.name})" - }) -} - -data "google_parameter_manager_parameter_version_render" "parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_parameter_version.parameter-version-basic.parameter - parameter_version_id = google_parameter_manager_parameter_version.parameter-version-basic.parameter_version_id -} -`, context) -} - -func TestAccDataSourceParameterManagerParameterVersionRender_withJsonData(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameterVersionRender_withJsonData(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerParameterDataDataSourceMatchesResource("data.google_parameter_manager_parameter_version_render.parameter-version-with-json-data", "google_parameter_manager_parameter_version.parameter-version-with-json-data"), - testAccCheckParameterManagerRenderedParameterDataMatchesDataSourceRenderedData("data.google_parameter_manager_parameter_version_render.parameter-version-with-json-data", "{\"tempsecret\":\"parameter-version-data\"}"), - ), - }, - }, - }) -} - -func testAccParameterManagerParameterVersionRender_withJsonData(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "JSON" -} - -resource "google_secret_manager_secret" "secret-basic" { - provider = google-beta - secret_id = "tf-temp-secret-json-data%{random_suffix}" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_secret.secret-basic.id - secret_data = "parameter-version-data" -} - -resource "google_secret_manager_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_secret.secret-basic.secret_id - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_parameter.parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = jsonencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_secret_version.secret-version-basic.name})" - }) -} - -data "google_parameter_manager_parameter_version_render" "parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.parameter_id - parameter_version_id = google_parameter_manager_parameter_version.parameter-version-with-json-data.parameter_version_id -} -`, context) -} - -func TestAccDataSourceParameterManagerParameterVersionRender_withYamlData(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameterVersionRender_withYamlData(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerParameterDataDataSourceMatchesResource("data.google_parameter_manager_parameter_version_render.parameter-version-with-yaml-data", "google_parameter_manager_parameter_version.parameter-version-with-yaml-data"), - testAccCheckParameterManagerRenderedParameterDataMatchesDataSourceRenderedData("data.google_parameter_manager_parameter_version_render.parameter-version-with-yaml-data", "\"tempsecret\": \"parameter-version-data\"\n"), - ), - }, - }, - }) -} - -func testAccParameterManagerParameterVersionRender_withYamlData(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "YAML" -} - -resource "google_secret_manager_secret" "secret-basic" { - provider = google-beta - secret_id = "tf-temp-secret-yaml-data%{random_suffix}" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_secret.secret-basic.id - secret_data = "parameter-version-data" -} - -resource "google_secret_manager_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_secret.secret-basic.secret_id - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_parameter.parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = yamlencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_secret_version.secret-version-basic.name})" - }) -} - -data "google_parameter_manager_parameter_version_render" "parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.parameter_id - parameter_version_id = google_parameter_manager_parameter_version.parameter-version-with-yaml-data.parameter_version_id -} -`, context) -} - -func testAccCheckParameterManagerRenderedParameterDataMatchesDataSourceRenderedData(dataSource, expectedParameterData string) resource.TestCheckFunc { - return func(s *terraform.State) error { - ds, ok := s.RootModule().Resources[dataSource] - if !ok { - return fmt.Errorf("can't find Parameter Version Render data source: %s", dataSource) - } - - if ds.Primary.ID == "" { - return errors.New("data source ID not set.") - } - - dataSourceParameterData, ok := ds.Primary.Attributes["rendered_parameter_data"] - if !ok { - return errors.New("can't find 'parameter_data' attribute in Parameter Version Render data source") - } - - if expectedParameterData != dataSourceParameterData { - return fmt.Errorf("expected %s, got %s, rendered_parameter_data doesn't match", expectedParameterData, dataSourceParameterData) - } - return nil - } -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_test.go.tmpl deleted file mode 100644 index 3d9be9d5c404..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameter_version_test.go.tmpl +++ /dev/null @@ -1,240 +0,0 @@ -package parametermanager_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "errors" - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceParameterManagerParameterVersion_basicWithResourceReference(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameterVersion_basicWithResourceReference(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerParameterDataDataSourceMatchesResource("data.google_parameter_manager_parameter_version.parameter-version-basic", "google_parameter_manager_parameter_version.parameter-version-basic"), - ), - }, - }, - }) - -} - -func testAccParameterManagerParameterVersion_basicWithResourceReference(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = "test-parameter-data-with-resource-reference" -} - -data "google_parameter_manager_parameter_version" "parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_parameter_version.parameter-version-basic.parameter - parameter_version_id = google_parameter_manager_parameter_version.parameter-version-basic.parameter_version_id -} -`, context) -} - -func TestAccDataSourceParameterManagerParameterVersion_basicWithParameterName(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameterVersion_basicWithParameterName(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerParameterDataDataSourceMatchesResource("data.google_parameter_manager_parameter_version.parameter-version-basic", "google_parameter_manager_parameter_version.parameter-version-basic"), - ), - }, - }, - }) - -} - -func testAccParameterManagerParameterVersion_basicWithParameterName(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = "test-parameter-data-with-parameter-name" -} - -data "google_parameter_manager_parameter_version" "parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.parameter_id - parameter_version_id = google_parameter_manager_parameter_version.parameter-version-basic.parameter_version_id -} -`, context) -} - -func TestAccDataSourceParameterManagerParameterVersion_withJsonData(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameterVersion_withJsonData(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerParameterDataDataSourceMatchesResource("data.google_parameter_manager_parameter_version.parameter-version-with-json-data", "google_parameter_manager_parameter_version.parameter-version-with-json-data"), - ), - }, - }, - }) - -} - -func testAccParameterManagerParameterVersion_withJsonData(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "JSON" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = jsonencode({ - "key1": "val1", - "key2": "val2" - }) -} - -data "google_parameter_manager_parameter_version" "parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_parameter_version.parameter-version-with-json-data.parameter - parameter_version_id = google_parameter_manager_parameter_version.parameter-version-with-json-data.parameter_version_id -} -`, context) -} - -func TestAccDataSourceParameterManagerParameterVersion_withYamlData(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameterVersion_withYamlData(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerParameterDataDataSourceMatchesResource("data.google_parameter_manager_parameter_version.parameter-version-with-yaml-data", "google_parameter_manager_parameter_version.parameter-version-with-yaml-data"), - ), - }, - }, - }) - -} - -func testAccParameterManagerParameterVersion_withYamlData(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "YAML" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = yamlencode({ - "key1": "val1", - "key2": "val2" - }) -} - -data "google_parameter_manager_parameter_version" "parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_parameter_version.parameter-version-with-yaml-data.parameter - parameter_version_id = google_parameter_manager_parameter_version.parameter-version-with-yaml-data.parameter_version_id -} -`, context) -} - -func testAccCheckParameterManagerParameterDataDataSourceMatchesResource(dataSource, resource string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[resource] - if !ok { - return fmt.Errorf("can't find Parameter Version resource: %s", resource) - } - - ds, ok := s.RootModule().Resources[dataSource] - if !ok { - return fmt.Errorf("can't find Parameter Version data source: %s", dataSource) - } - - if rs.Primary.ID == "" { - return errors.New("resource ID not set.") - } - - if ds.Primary.ID == "" { - return errors.New("data source ID not set.") - } - - resourceParameterData, ok := rs.Primary.Attributes["parameter_data"] - if !ok { - return errors.New("can't find 'parameter_data' attribute in Parameter Version resource") - } - - dataSourceParameterData, ok := ds.Primary.Attributes["parameter_data"] - if !ok { - return errors.New("can't find 'parameter_data' attribute in Parameter Version data source") - } - - if resourceParameterData != dataSourceParameterData { - return fmt.Errorf("expected %s, got %s, parameter_data doesn't match", resourceParameterData, dataSourceParameterData) - } - return nil - } -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameters.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameters.go.tmpl deleted file mode 100644 index be5c916cdc20..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameters.go.tmpl +++ /dev/null @@ -1,168 +0,0 @@ -package parametermanager -{{- if ne $.TargetVersionName "ga" }} - -import ( - "fmt" - "strings" - - "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 DataSourceParameterManagerParameters() *schema.Resource { - - dsSchema := tpgresource.DatasourceSchemaFromResourceSchema(ResourceParameterManagerParameter().Schema) - - return &schema.Resource{ - Read: dataSourceParameterManagerParametersRead, - Schema: map[string]*schema.Schema{ - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "filter": { - Type: schema.TypeString, - Description: `Filter string, adhering to the rules in List-operation filtering. List only parameters matching the filter. -If filter is empty, all parameters are listed.`, - Optional: true, - }, - "parameters": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: dsSchema, - }, - }, - }, - } -} - -func dataSourceParameterManagerParametersRead(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, "{{"{{"}}ParameterManagerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/parameters") - if err != nil { - return err - } - - filter, has_filter := d.GetOk("filter") - - if has_filter { - url, err = transport_tpg.AddQueryParams(url, map[string]string{"filter": filter.(string)}) - if err != nil { - return err - } - } - - billingProject := "" - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("error fetching project for Parameters: %s", err) - } - billingProject = project - - // err == nil indicates that the billing_project value was found - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - // To handle the pagination locally - allParameters := make([]interface{}, 0) - token := "" - for paginate := true; paginate; { - if token != "" { - url, err = transport_tpg.AddQueryParams(url, map[string]string{"pageToken": token}) - if err != nil { - return err - } - } - parameters, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ParameterManagerParameters %q", d.Id())) - } - parametersInterface := parameters["parameters"] - if parametersInterface != nil { - allParameters = append(allParameters, parametersInterface.([]interface{})...) - } - tokenInterface := parameters["nextPageToken"] - if tokenInterface == nil { - paginate = false - } else { - paginate = true - token = tokenInterface.(string) - } - } - - if err := d.Set("parameters", flattenParameterManagerParameterParameters(allParameters, d, config)); err != nil { - return fmt.Errorf("error setting parameters: %s", err) - } - - if err := d.Set("project", project); err != nil { - return fmt.Errorf("error setting project: %s", err) - } - - if err := d.Set("filter", filter); err != nil { - return fmt.Errorf("error setting filter: %s", err) - } - - // Store the ID now - id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/global/parameters") - if err != nil { - return fmt.Errorf("error constructing id: %s", err) - } - if has_filter { - id += "/filter=" + filter.(string) - } - d.SetId(id) - - return nil -} - -func flattenParameterManagerParameterParameters(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - l := v.([]interface{}) - transformed := make([]interface{}, 0, len(l)) - for _, raw := range l { - original := raw.(map[string]interface{}) - if len(original) < 1 { - // Do not include empty json objects coming back from the api - continue - } - transformed = append(transformed, map[string]interface{}{ - "format": flattenParameterManagerParameterFormat(original["format"], d, config), - "labels": flattenParameterManagerParameterEffectiveLabels(original["labels"], d, config), - "effective_labels": flattenParameterManagerParameterEffectiveLabels(original["labels"], d, config), - "terraform_labels": flattenParameterManagerParameterEffectiveLabels(original["labels"], d, config), - "create_time": flattenParameterManagerParameterCreateTime(original["createTime"], d, config), - "update_time": flattenParameterManagerParameterUpdateTime(original["updateTime"], d, config), - "policy_member": flattenParameterManagerParameterPolicyMember(original["policyMember"], d, config), - "name": flattenParameterManagerParameterName(original["name"], d, config), - "project": getDataFromName(original["name"], 1), - "parameter_id": getDataFromName(original["name"], 5), - }) - } - return transformed -} - -func getDataFromName(v interface{}, part int) string { - name := v.(string) - split := strings.Split(name, "/") - return split[part] -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameters_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameters_test.go.tmpl deleted file mode 100644 index e80c18e7bf14..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/data_source_parameter_manager_parameters_test.go.tmpl +++ /dev/null @@ -1,254 +0,0 @@ -package parametermanager_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "errors" - "fmt" - "strconv" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceParameterManagerParameters_basic(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDataSourceParameterManagerParameters_basic(context), - Check: resource.ComposeTestCheckFunc( - checkListDataSourceStateMatchesResourceStateWithIgnores( - "data.google_parameter_manager_parameters.parameters-datasource", - "google_parameter_manager_parameter.parameters", - map[string]struct{}{ - "id": {}, - "project": {}, - }, - ), - ), - }, - }, - }) -} - -func testAccDataSourceParameterManagerParameters_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -provider "google-beta" { - add_terraform_attribution_label = false -} - -resource "google_parameter_manager_parameter" "parameters" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "YAML" - - labels = { - key1 = "val1" - key2 = "val2" - key3 = "val3" - key4 = "val4" - key5 = "val5" - } -} - -data "google_parameter_manager_parameters" "parameters-datasource" { - provider = google-beta - depends_on = [ - google_parameter_manager_parameter.parameters - ] -} -`, context) -} - -func TestAccDataSourceParameterManagerParameters_filter(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDataSourceParameterManagerParameters_filter(context), - Check: resource.ComposeTestCheckFunc( - checkListDataSourceStateMatchesResourceStateWithIgnoresForAppliedFilter( - "data.google_parameter_manager_parameters.parameters-datasource-filter", - "google_parameter_manager_parameter.parameters-1", - "google_parameter_manager_parameter.parameters-2", - map[string]struct{}{ - "id": {}, - "project": {}, - }, - ), - ), - }, - }, - }) -} - -func testAccDataSourceParameterManagerParameters_filter(context map[string]interface{}) string { - return acctest.Nprintf(` -provider "google-beta" { - add_terraform_attribution_label = false -} - -resource "google_parameter_manager_parameter" "parameters-1" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "JSON" - - labels = { - key1 = "val1" - } -} - -resource "google_parameter_manager_parameter" "parameters-2" { - provider = google-beta - parameter_id = "tf_test_parameter_2_%{random_suffix}" - format = "YAML" - - labels = { - keyoth1 = "valoth1" - } -} - -data "google_parameter_manager_parameters" "parameters-datasource-filter" { - provider = google-beta - filter = "format:JSON" - depends_on = [ - google_parameter_manager_parameter.parameters-1, - google_parameter_manager_parameter.parameters-2 - ] -} -`, context) -} - -// This function checks data source state matches for resourceName parameter manager parameter state -func checkListDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName string, ignoreFields map[string]struct{}) func(*terraform.State) error { - return func(s *terraform.State) error { - ds, ok := s.RootModule().Resources[dataSourceName] - if !ok { - return fmt.Errorf("can't find %s in state", dataSourceName) - } - - rs, ok := s.RootModule().Resources[resourceName] - if !ok { - return fmt.Errorf("can't find %s in state", resourceName) - } - - dsAttr := ds.Primary.Attributes - rsAttr := rs.Primary.Attributes - - err := checkFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr, ignoreFields) - if err != nil { - return err - } - return nil - } -} - -// This function checks whether all the attributes of the parameter manager parameter resource and the attributes of the parameter manager parameter inside the data source list are the same -func checkFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr map[string]string, ignoreFields map[string]struct{}) error { - totalParameters, err := strconv.Atoi(dsAttr["parameters.#"]) - if err != nil { - return errors.New("couldn't convert length of parameters list to integer") - } - index := "-1" - for i := 0; i < totalParameters; i++ { - if dsAttr["parameters."+strconv.Itoa(i)+".name"] == rsAttr["name"] { - index = strconv.Itoa(i) - } - } - - if index == "-1" { - return errors.New("the newly created parameter is not found in the data source") - } - - errMsg := "" - // Data sources are often derived from resources, so iterate over the resource fields to - // make sure all fields are accounted for in the data source. - // If a field exists in the data source but not in the resource, its expected value should - // be checked separately. - for k := range rsAttr { - if _, ok := ignoreFields[k]; ok { - continue - } - if k == "%" { - continue - } - if dsAttr["parameters."+index+"."+k] != rsAttr[k] { - // ignore data sources where an empty list is being compared against a null list. - if k[len(k)-1:] == "#" && (dsAttr["parameters."+index+"."+k] == "" || dsAttr["parameters."+index+"."+k] == "0") && (rsAttr[k] == "" || rsAttr[k] == "0") { - continue - } - errMsg += fmt.Sprintf("%s is %s; want %s\n", k, dsAttr["parameters."+index+"."+k], rsAttr[k]) - } - } - - if errMsg != "" { - return errors.New(errMsg) - } - - return nil -} - -// This function checks state match for resourceName and asserts the absense of resourceName2 in data source -func checkListDataSourceStateMatchesResourceStateWithIgnoresForAppliedFilter(dataSourceName, resourceName, resourceName2 string, ignoreFields map[string]struct{}) func(*terraform.State) error { - return func(s *terraform.State) error { - ds, ok := s.RootModule().Resources[dataSourceName] - if !ok { - return fmt.Errorf("can't find %s in state", dataSourceName) - } - - rs, ok := s.RootModule().Resources[resourceName] - if !ok { - return fmt.Errorf("can't find %s in state", resourceName) - } - - rs2, ok := s.RootModule().Resources[resourceName2] - if !ok { - return fmt.Errorf("can't find %s in state", resourceName2) - } - - dsAttr := ds.Primary.Attributes - rsAttr := rs.Primary.Attributes - rsAttr2 := rs2.Primary.Attributes - - err := checkFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr, ignoreFields) - if err != nil { - return err - } - err = checkResourceAbsentInDataSourceAfterFilterApplied(dsAttr, rsAttr2) - return err - } -} - -// This function asserts the absence of the parameter manager parameter resource which would not be included in the data source list due to the filter applied. -func checkResourceAbsentInDataSourceAfterFilterApplied(dsAttr, rsAttr map[string]string) error { - totalParameters, err := strconv.Atoi(dsAttr["parameters.#"]) - if err != nil { - return errors.New("couldn't convert length of parameters list to integer") - } - for i := 0; i < totalParameters; i++ { - if dsAttr["parameters."+strconv.Itoa(i)+".name"] == rsAttr["name"] { - return errors.New("the resource is present in the data source even after the filter is applied") - } - } - return nil -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/resource_parameter_manager_parameter_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/resource_parameter_manager_parameter_test.go.tmpl deleted file mode 100644 index 9e35e39f7abe..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/resource_parameter_manager_parameter_test.go.tmpl +++ /dev/null @@ -1,109 +0,0 @@ -package parametermanager_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccParameterManagerParameter_labelsUpdate(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameter_withoutLabels(context), - }, - { - ResourceName: "google_parameter_manager_parameter.parameter-with-labels", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "parameter_id", "terraform_labels"}, - }, - { - Config: testAccParameterManagerParameter_labelsUpdate(context), - }, - { - ResourceName: "google_parameter_manager_parameter.parameter-with-labels", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "parameter_id", "terraform_labels"}, - }, - { - Config: testAccParameterManagerParameter_labelsUpdateOther(context), - }, - { - ResourceName: "google_parameter_manager_parameter.parameter-with-labels", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "parameter_id", "terraform_labels"}, - }, - { - Config: testAccParameterManagerParameter_withoutLabels(context), - }, - { - ResourceName: "google_parameter_manager_parameter.parameter-with-labels", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "parameter_id", "terraform_labels"}, - }, - }, - }) -} - -func testAccParameterManagerParameter_withoutLabels(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-with-labels" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "JSON" -} -`, context) -} - -func testAccParameterManagerParameter_labelsUpdate(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-with-labels" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "JSON" - - labels = { - key1 = "val1" - key2 = "val2" - key3 = "val3" - key4 = "val4" - key5 = "val5" - } -} -`, context) -} - -func testAccParameterManagerParameter_labelsUpdateOther(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-with-labels" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - format = "JSON" - - labels = { - key1 = "val1" - key2 = "updateval2" - updatekey3 = "val3" - updatekey4 = "updateval4" - key6 = "val6" - } -} -`, context) -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanager/resource_parameter_manager_parameter_version_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanager/resource_parameter_manager_parameter_version_test.go.tmpl deleted file mode 100644 index 8c7037d65b1d..000000000000 --- a/mmv1/third_party/terraform/services/parametermanager/resource_parameter_manager_parameter_version_test.go.tmpl +++ /dev/null @@ -1,87 +0,0 @@ -package parametermanager_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccParameterManagerParameterVersion_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerParameterVersion_basic(context), - }, - { - ResourceName: "google_parameter_manager_parameter_version.parameter-version-update", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter", "parameter_version_id"}, - }, - { - Config: testAccParameterManagerParameterVersion_update(context), - }, - { - ResourceName: "google_parameter_manager_parameter_version.parameter-version-update", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter", "parameter_version_id"}, - }, - { - Config: testAccParameterManagerParameterVersion_basic(context), - }, - { - ResourceName: "google_parameter_manager_parameter_version.parameter-version-update", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter", "parameter_version_id"}, - }, - }, - }) -} - -func testAccParameterManagerParameterVersion_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-update" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-update" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-update.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = "parameter-version-data" -} -`, context) -} - -func testAccParameterManagerParameterVersion_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_parameter" "parameter-update" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" -} - -resource "google_parameter_manager_parameter_version" "parameter-version-update" { - provider = google-beta - parameter = google_parameter_manager_parameter.parameter-update.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = "parameter-version-data" - disabled = true -} -`, context) -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter.go.tmpl deleted file mode 100644 index bf86da9bd24d..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter.go.tmpl +++ /dev/null @@ -1,46 +0,0 @@ -package parametermanagerregional -{{- if ne $.TargetVersionName "ga" }} - -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 DataSourceParameterManagerRegionalRegionalParameter() *schema.Resource { - - dsSchema := tpgresource.DatasourceSchemaFromResourceSchema(ResourceParameterManagerRegionalRegionalParameter().Schema) - tpgresource.AddRequiredFieldsToSchema(dsSchema, "parameter_id") - tpgresource.AddRequiredFieldsToSchema(dsSchema, "location") - tpgresource.AddOptionalFieldsToSchema(dsSchema, "project") - - return &schema.Resource{ - Read: dataSourceParameterManagerRegionalRegionalParameterRead, - Schema: dsSchema, - } -} - -func dataSourceParameterManagerRegionalRegionalParameterRead(d *schema.ResourceData, meta interface{}) error { - id, err := tpgresource.ReplaceVars(d, meta.(*transport_tpg.Config), "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/parameters/{{"{{"}}parameter_id{{"}}"}}") - if err != nil { - return fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - err = resourceParameterManagerRegionalRegionalParameterRead(d, meta) - if err != nil { - return err - } - - if err := tpgresource.SetDataSourceLabels(d); err != nil { - return err - } - - if d.Id() == "" { - return fmt.Errorf("%s not found", id) - } - return nil -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_test.go.tmpl deleted file mode 100644 index 4f975cf8faaa..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_test.go.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -package parametermanagerregional_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceParameterManagerRegionalRegionalParameter_basic(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDataSourceParameterManagerRegionalRegionalParameter_basic(context), - Check: resource.ComposeTestCheckFunc( - acctest.CheckDataSourceStateMatchesResourceState( - "data.google_parameter_manager_regional_parameter.regional-parameter-datasource", - "google_parameter_manager_regional_parameter.regional-parameter", - ), - ), - }, - }, - }) -} - -func testAccDataSourceParameterManagerRegionalRegionalParameter_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - location = "us-central1" - format = "YAML" - - labels = { - key1 = "val1" - key2 = "val2" - key3 = "val3" - key4 = "val4" - key5 = "val5" - } -} - -data "google_parameter_manager_regional_parameter" "regional-parameter-datasource" { - provider = google-beta - parameter_id = google_parameter_manager_regional_parameter.regional-parameter.parameter_id - location = google_parameter_manager_regional_parameter.regional-parameter.location -} -`, context) -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version.go.tmpl deleted file mode 100644 index a7eca3b49296..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version.go.tmpl +++ /dev/null @@ -1,179 +0,0 @@ -package parametermanagerregional -{{- if ne $.TargetVersionName "ga" }} - -import ( - "encoding/base64" - "fmt" - "net/http" - "regexp" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func DataSourceParameterManagerRegionalRegionalParameterVersion() *schema.Resource { - return &schema.Resource{ - Read: dataSourceParameterManagerRegionalRegionalParameterVersionRead, - Schema: map[string]*schema.Schema{ - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "parameter": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - }, - "parameter_version_id": { - Type: schema.TypeString, - Required: true, - }, - "parameter_data": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, - }, - "name": { - Type: schema.TypeString, - Computed: true, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - }, - "update_time": { - Type: schema.TypeString, - Computed: true, - }, - "disabled": { - Type: schema.TypeBool, - Computed: true, - }, - "location": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - }, - } -} - -func dataSourceParameterManagerRegionalRegionalParameterVersionRead(d *schema.ResourceData, meta interface{}) error { - config := meta.(*transport_tpg.Config) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - // Check if the regional parameter is provided as a resource reference or a parameter id. - parameterRegex := regexp.MustCompile("projects/(.+)/locations/(.+)/parameters/(.+)$") - dParameter, ok := d.Get("parameter").(string) - if !ok { - return fmt.Errorf("wrong type for regional parameter field (%T), expected string", d.Get("parameter")) - } - - parts := parameterRegex.FindStringSubmatch(dParameter) - var project string - - // if reference of the regional parameter is provided in the parameter field - if len(parts) == 4 { - // Stores value of project to set in state - project = parts[1] - if dProject, ok := d.Get("project").(string); !ok { - return fmt.Errorf("wrong type for project (%T), expected string", d.Get("project")) - } else if dProject != "" && dProject != project { - return fmt.Errorf("project field value (%s) does not match project of regional parameter (%s)", dProject, project) - } - if dLocation, ok := d.Get("location").(string); !ok { - return fmt.Errorf("wrong type for location (%T), expected string", d.Get("location")) - } else if dLocation != "" && dLocation != parts[2] { - return fmt.Errorf("location field value (%s) does not match location of regional parameter (%s)", dLocation, parts[2]) - } - if err := d.Set("location", parts[2]); err != nil { - return fmt.Errorf("error setting location: %s", err) - } - if err := d.Set("parameter", parts[3]); err != nil { - return fmt.Errorf("error setting parameter: %s", err) - } - - } else { // if regional parameter name is provided in the parameter field - // Stores value of project to set in state - project, err = tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("error fetching project for regional parameter: %s", err) - } - if dLocation, ok := d.Get("location").(string); ok && dLocation == "" { - return fmt.Errorf("location must be set when providing only regional parameter name") - } - } - if err := d.Set("project", project); err != nil { - return fmt.Errorf("error setting project: %s", err) - } - - dParameterVersionId, ok := d.Get("parameter_version_id").(string) - if !ok { - return fmt.Errorf("wrong type for regional parameter version id field (%T), expected string", d.Get("parameter_version_id")) - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ParameterManagerRegionalBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/parameters/{{"{{"}}parameter{{"}}"}}/versions/{{"{{"}}parameter_version_id{{"}}"}}") - if err != nil { - return err - } - - headers := make(http.Header) - parameterVersion, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: userAgent, - Headers: headers, - }) - if err != nil { - return fmt.Errorf("error retrieving available parameter manager regional parameter versions: %s", err.Error()) - } - - // If the response contains the disabled value, return an error stating that the regional parameter version is currently disabled - isDisabled, ok := parameterVersion["disabled"] - if ok && isDisabled.(bool) { - return fmt.Errorf("regional parameter version %s is in DISABLED state", dParameterVersionId) - } - - nameValue, ok := parameterVersion["name"] - if !ok { - return fmt.Errorf("read response didn't contain critical fields. Read may not have succeeded") - } - - if err := d.Set("name", nameValue.(string)); err != nil { - return fmt.Errorf("error reading regional parameterVersion: %s", err) - } - - if err := d.Set("disabled", false); err != nil { - return fmt.Errorf("error setting disabled: %s", err) - } - - if err := d.Set("update_time", parameterVersion["updateTime"].(string)); err != nil { - return fmt.Errorf("error setting update_time: %s", err) - } - - if err := d.Set("create_time", parameterVersion["createTime"].(string)); err != nil { - return fmt.Errorf("error setting create_time: %s", err) - } - - data := parameterVersion["payload"].(map[string]interface{}) - parameterData, err := base64.StdEncoding.DecodeString(data["data"].(string)) - if err != nil { - return fmt.Errorf("error decoding parameter manager regional parameter version data: %s", err.Error()) - } - if err := d.Set("parameter_data", string(parameterData)); err != nil { - return fmt.Errorf("error setting parameter_data: %s", err) - } - - d.SetId(nameValue.(string)) - return nil -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_render.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_render.go.tmpl deleted file mode 100644 index 33b9fcbf821e..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_render.go.tmpl +++ /dev/null @@ -1,176 +0,0 @@ -package parametermanagerregional -{{ if ne $.TargetVersionName `ga` -}} - -import ( - "encoding/base64" - "fmt" - "net/http" - "regexp" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func DataSourceParameterManagerRegionalRegionalParameterVersionRender() *schema.Resource { - return &schema.Resource{ - Read: dataSourceParameterManagerRegionalRegionalParameterVersionRenderRead, - Schema: map[string]*schema.Schema{ - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "location": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "parameter": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - }, - "parameter_version_id": { - Type: schema.TypeString, - Required: true, - }, - "parameter_data": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, - }, - "rendered_parameter_data": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, - }, - "name": { - Type: schema.TypeString, - Computed: true, - }, - "disabled": { - Type: schema.TypeBool, - Computed: true, - }, - }, - } -} - -func dataSourceParameterManagerRegionalRegionalParameterVersionRenderRead(d *schema.ResourceData, meta interface{}) error { - config := meta.(*transport_tpg.Config) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - // Check if the parameter is provided as a resource reference or a parameter id. - parameterRegex := regexp.MustCompile("projects/(.+)/locations/(.+)/parameters/(.+)$") - dParameter, ok := d.Get("parameter").(string) - if !ok { - return fmt.Errorf("wrong type for parameter field (%T), expected string", d.Get("parameter")) - } - - parts := parameterRegex.FindStringSubmatch(dParameter) - var project string - - // if reference of the regional parameter is provided in the parameter field - if len(parts) == 4 { - // Stores value of project to set in state - project = parts[1] - if dProject, ok := d.Get("project").(string); !ok { - return fmt.Errorf("wrong type for project (%T), expected string", d.Get("project")) - } else if dProject != "" && dProject != project { - return fmt.Errorf("project field value (%s) does not match project of regional parameter (%s).", dProject, project) - } - - if dLocation, ok := d.Get("location").(string); !ok { - return fmt.Errorf("wrong type for location (%T), expected string", d.Get("location")) - } else if dLocation != "" && dLocation != parts[2] { - return fmt.Errorf("location field value (%s) does not match location of regional parameter (%s).", dLocation, parts[2]) - } - - if err := d.Set("location", parts[2]); err != nil { - return fmt.Errorf("error setting location: %s", err) - } - if err := d.Set("parameter", parts[3]); err != nil { - return fmt.Errorf("error setting parameter: %s", err) - } - } else { // if regional parameter name is provided in the parameter field - // Stores value of project to set in state - project, err = tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("error fetching project for regional parameter: %s", err) - } - if dLocation, ok := d.Get("location").(string); ok && dLocation == "" { - return fmt.Errorf("location must be set when providing only regional parameter name") - } - } - if err := d.Set("project", project); err != nil { - return fmt.Errorf("error setting project: %s", err) - } - - dParameterVersionId, ok := d.Get("parameter_version_id").(string) - if !ok { - return fmt.Errorf("wrong type for parameter version id field (%T), expected string", d.Get("parameter_version_id")) - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ParameterManagerRegionalBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/parameters/{{"{{"}}parameter{{"}}"}}/versions/{{"{{"}}parameter_version_id{{"}}"}}:render") - if err != nil { - return err - } - - headers := make(http.Header) - regionalParameterVersion, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: userAgent, - Headers: headers, - }) - if err != nil { - return fmt.Errorf("error retrieving available parameter manager regional parameter version: %s", err.Error()) - } - - // If the response contains the disabled value, return an error stating that the regional parameter version is currently disabled - isDisabled, ok := regionalParameterVersion["disabled"] - if ok && isDisabled.(bool) { - return fmt.Errorf("regional parameter version %s is in DISABLED state.", dParameterVersionId) - } - - nameValue, ok := regionalParameterVersion["parameterVersion"] - if !ok { - return fmt.Errorf("read response didn't contain critical fields. Read may not have succeeded.") - } - - if err := d.Set("name", nameValue.(string)); err != nil { - return fmt.Errorf("error reading regionalParameterVersion: %s", err) - } - - if err := d.Set("disabled", false); err != nil { - return fmt.Errorf("error setting disabled: %s", err) - } - - data := regionalParameterVersion["payload"].(map[string]interface{}) - parameterData, err := base64.StdEncoding.DecodeString(data["data"].(string)) - if err != nil { - return fmt.Errorf("error decoding parameter manager regional parameter version data: %s", err.Error()) - } - if err := d.Set("parameter_data", string(parameterData)); err != nil { - return fmt.Errorf("error setting parameter_data: %s", err) - } - - renderedParameterData, err := base64.StdEncoding.DecodeString(regionalParameterVersion["renderedPayload"].(string)) - if err != nil { - return fmt.Errorf("error decoding parameter manager regional parameter version rendered payload data: %s", err.Error()) - } - if err := d.Set("rendered_parameter_data", string(renderedParameterData)); err != nil { - return fmt.Errorf("error setting rendered_parameter_data: %s", err) - } - d.SetId(nameValue.(string)) - return nil -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_render_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_render_test.go.tmpl deleted file mode 100644 index 2a1fa2230903..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_render_test.go.tmpl +++ /dev/null @@ -1,395 +0,0 @@ -package parametermanagerregional_test -{{ if ne $.TargetVersionName `ga` -}} - -import ( - "errors" - "fmt" - "testing" - "time" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceParameterManagerRegionalRegionalParameterVersionRender_basicWithResourceReference(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerRegionalRegionalParameterVersionRender_basicWithResourceReferenceWithoutDatasource(context), - }, - { - // We've kept sleep because we need to grant the `Secret Manager Secret Accessor` role to the principal - // of the parameter and it can take up to 7 minutes for the role to take effect. For more information - // see the access change propagation documentation: https://cloud.google.com/iam/docs/access-change-propagation. - PreConfig: func() { - time.Sleep(7 * time.Minute) - }, - Config: testAccParameterManagerRegionalRegionalParameterVersionRender_basicWithResourceReferenceWithDatasource(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerRegionalRegionalParameterDataDataSourceMatchesResource("data.google_parameter_manager_regional_parameter_version_render.regional-parameter-version-basic", "google_parameter_manager_regional_parameter_version.regional-parameter-version-basic"), - testAccCheckParameterManagerRegionalRegionalRenderedParameterDataMatchesDataSourceRenderedData("data.google_parameter_manager_regional_parameter_version_render.regional-parameter-version-basic", "\"tempsecret\": \"regional-parameter-version-data\"\n"), - ), - }, - }, - }) -} - -func testAccParameterManagerRegionalRegionalParameterVersionRender_basicWithResourceReferenceWithoutDatasource(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - location = "us-central1" - format = "YAML" -} - -resource "google_secret_manager_regional_secret" "secret-basic" { - provider = google-beta - secret_id = "tf_temp_secret%{random_suffix}" - location = "us-central1" -} - -resource "google_secret_manager_regional_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_regional_secret.secret-basic.id - secret_data = "regional-parameter-version-data" -} - -resource "google_secret_manager_regional_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_regional_secret.secret-basic.secret_id - location = google_secret_manager_regional_secret.secret-basic.location - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_regional_parameter.regional-parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = yamlencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_regional_secret_version.secret-version-basic.name})" - }) -} -`, context) -} - -func testAccParameterManagerRegionalRegionalParameterVersionRender_basicWithResourceReferenceWithDatasource(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - location = "us-central1" - format = "YAML" -} - -resource "google_secret_manager_regional_secret" "secret-basic" { - provider = google-beta - secret_id = "tf_temp_secret%{random_suffix}" - location = "us-central1" -} - -resource "google_secret_manager_regional_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_regional_secret.secret-basic.id - secret_data = "regional-parameter-version-data" -} - -resource "google_secret_manager_regional_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_regional_secret.secret-basic.secret_id - location = google_secret_manager_regional_secret.secret-basic.location - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_regional_parameter.regional-parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = yamlencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_regional_secret_version.secret-version-basic.name})" - }) -} - -data "google_parameter_manager_regional_parameter_version_render" "regional-parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter_version.regional-parameter-version-basic.parameter - parameter_version_id = google_parameter_manager_regional_parameter_version.regional-parameter-version-basic.parameter_version_id -} -`, context) -} - -func TestAccDataSourceParameterManagerRegionalRegionalParameterVersionRender_withJsonData(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerRegionalRegionalParameterVersionRender_withJsonDataWithoutDatasource(context), - }, - { - // We've kept sleep because we need to grant the `Secret Manager Secret Accessor` role to the principal - // of the parameter and it can take up to 7 minutes for the role to take effect. For more information - // see the access change propagation documentation: https://cloud.google.com/iam/docs/access-change-propagation. - PreConfig: func() { - time.Sleep(7 * time.Minute) - }, - Config: testAccParameterManagerRegionalRegionalParameterVersionRender_withJsonDataWithDatasource(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerRegionalRegionalParameterDataDataSourceMatchesResource("data.google_parameter_manager_regional_parameter_version_render.regional-parameter-version-with-json-data", "google_parameter_manager_regional_parameter_version.regional-parameter-version-with-json-data"), - testAccCheckParameterManagerRegionalRegionalRenderedParameterDataMatchesDataSourceRenderedData("data.google_parameter_manager_regional_parameter_version_render.regional-parameter-version-with-json-data", "{\"tempsecret\":\"regional-parameter-version-data\"}"), - ), - }, - }, - }) -} - -func testAccParameterManagerRegionalRegionalParameterVersionRender_withJsonDataWithoutDatasource(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - location = "us-central1" - format = "JSON" -} - -resource "google_secret_manager_regional_secret" "secret-basic" { - provider = google-beta - secret_id = "tf_temp_secret_json_data%{random_suffix}" - location = "us-central1" -} - -resource "google_secret_manager_regional_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_regional_secret.secret-basic.id - secret_data = "regional-parameter-version-data" -} - -resource "google_secret_manager_regional_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_regional_secret.secret-basic.secret_id - location = google_secret_manager_regional_secret.secret-basic.location - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_regional_parameter.regional-parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = jsonencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_regional_secret_version.secret-version-basic.name})" - }) -} -`, context) -} - -func testAccParameterManagerRegionalRegionalParameterVersionRender_withJsonDataWithDatasource(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - location = "us-central1" - format = "JSON" -} - -resource "google_secret_manager_regional_secret" "secret-basic" { - provider = google-beta - secret_id = "tf_temp_secret_json_data%{random_suffix}" - location = "us-central1" -} - -resource "google_secret_manager_regional_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_regional_secret.secret-basic.id - secret_data = "regional-parameter-version-data" -} - -resource "google_secret_manager_regional_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_regional_secret.secret-basic.secret_id - location = google_secret_manager_regional_secret.secret-basic.location - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_regional_parameter.regional-parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = jsonencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_regional_secret_version.secret-version-basic.name})" - }) -} - -data "google_parameter_manager_regional_parameter_version_render" "regional-parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.parameter_id - parameter_version_id = google_parameter_manager_regional_parameter_version.regional-parameter-version-with-json-data.parameter_version_id - location = "us-central1" -} -`, context) -} - -func TestAccDataSourceParameterManagerRegionalRegionalParameterVersionRender_withYamlData(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerRegionalRegionalParameterVersionRender_withYamlDataWithoutDatasource(context), - }, - { - // We've kept sleep because we need to grant the `Secret Manager Secret Accessor` role to the principal - // of the parameter and it can take up to 7 minutes for the role to take effect. For more information - // see the access change propagation documentation: https://cloud.google.com/iam/docs/access-change-propagation. - PreConfig: func() { - time.Sleep(7 * time.Minute) - }, - Config: testAccParameterManagerRegionalRegionalParameterVersionRender_withYamlDataWithDatasource(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerRegionalRegionalParameterDataDataSourceMatchesResource("data.google_parameter_manager_regional_parameter_version_render.regional-parameter-version-with-yaml-data", "google_parameter_manager_regional_parameter_version.regional-parameter-version-with-yaml-data"), - testAccCheckParameterManagerRegionalRegionalRenderedParameterDataMatchesDataSourceRenderedData("data.google_parameter_manager_regional_parameter_version_render.regional-parameter-version-with-yaml-data", "\"tempsecret\": \"regional-parameter-version-data\"\n"), - ), - }, - }, - }) -} - -func testAccParameterManagerRegionalRegionalParameterVersionRender_withYamlDataWithoutDatasource(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - location = "us-central1" - format = "YAML" -} - -resource "google_secret_manager_regional_secret" "secret-basic" { - provider = google-beta - secret_id = "tf_temp_secret_yaml_data%{random_suffix}" - location = "us-central1" -} - -resource "google_secret_manager_regional_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_regional_secret.secret-basic.id - secret_data = "regional-parameter-version-data" -} - -resource "google_secret_manager_regional_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_regional_secret.secret-basic.secret_id - location = google_secret_manager_regional_secret.secret-basic.location - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_regional_parameter.regional-parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = yamlencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_regional_secret_version.secret-version-basic.name})" - }) -} -`, context) -} - -func testAccParameterManagerRegionalRegionalParameterVersionRender_withYamlDataWithDatasource(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_parameter%{random_suffix}" - location = "us-central1" - format = "YAML" -} - -resource "google_secret_manager_regional_secret" "secret-basic" { - provider = google-beta - secret_id = "tf_temp_secret_yaml_data%{random_suffix}" - location = "us-central1" -} - -resource "google_secret_manager_regional_secret_version" "secret-version-basic" { - provider = google-beta - secret = google_secret_manager_regional_secret.secret-basic.id - secret_data = "regional-parameter-version-data" -} - -resource "google_secret_manager_regional_secret_iam_member" "member" { - provider = google-beta - secret_id = google_secret_manager_regional_secret.secret-basic.secret_id - location = google_secret_manager_regional_secret.secret-basic.location - role = "roles/secretmanager.secretAccessor" - member = "${google_parameter_manager_regional_parameter.regional-parameter-basic.policy_member[0].iam_policy_uid_principal}" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_parameter_version%{random_suffix}" - parameter_data = yamlencode({ - "tempsecret": "__REF__(//secretmanager.googleapis.com/${google_secret_manager_regional_secret_version.secret-version-basic.name})" - }) -} - -data "google_parameter_manager_regional_parameter_version_render" "regional-parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.parameter_id - parameter_version_id = google_parameter_manager_regional_parameter_version.regional-parameter-version-with-yaml-data.parameter_version_id - location = "us-central1" -} -`, context) -} - -func testAccCheckParameterManagerRegionalRegionalRenderedParameterDataMatchesDataSourceRenderedData(dataSource, expectedParameterData string) resource.TestCheckFunc { - return func(s *terraform.State) error { - ds, ok := s.RootModule().Resources[dataSource] - if !ok { - return fmt.Errorf("can't find Regional Parameter Version Render data source: %s", dataSource) - } - - if ds.Primary.ID == "" { - return errors.New("data source ID not set.") - } - - dataSourceParameterData, ok := ds.Primary.Attributes["rendered_parameter_data"] - if !ok { - return errors.New("can't find 'parameter_data' attribute in Regional Parameter Version Render data source") - } - - if expectedParameterData != dataSourceParameterData { - return fmt.Errorf("expected %s, got %s, rendered_parameter_data doesn't match", expectedParameterData, dataSourceParameterData) - } - return nil - } -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_test.go.tmpl deleted file mode 100644 index be67d3561a86..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameter_version_test.go.tmpl +++ /dev/null @@ -1,246 +0,0 @@ -package parametermanagerregional_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "errors" - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceParameterManagerRegionalRegionalParameterVersion_basicWithResourceReference(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerRegionalRegionalParameterVersion_basicWithResourceReference(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerRegionalRegionalParameterDataDataSourceMatchesResource("data.google_parameter_manager_regional_parameter_version.regional-parameter-version-basic", "google_parameter_manager_regional_parameter_version.regional-parameter-version-basic"), - ), - }, - }, - }) - -} - -func testAccParameterManagerRegionalRegionalParameterVersion_basicWithResourceReference(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_regional_parameter%{random_suffix}" - location = "us-central1" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_regional_parameter_version%{random_suffix}" - parameter_data = "test-regional-parameter-data-with-resource-reference" -} - -data "google_parameter_manager_regional_parameter_version" "regional-parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter_version.regional-parameter-version-basic.parameter - parameter_version_id = google_parameter_manager_regional_parameter_version.regional-parameter-version-basic.parameter_version_id -} -`, context) -} - -func TestAccDataSourceParameterManagerRegionalRegionalParameterVersion_basicWithParameterName(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerRegionalRegionalParameterVersion_basicWithParameterName(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerRegionalRegionalParameterDataDataSourceMatchesResource("data.google_parameter_manager_regional_parameter_version.regional-parameter-version-basic", "google_parameter_manager_regional_parameter_version.regional-parameter-version-basic"), - ), - }, - }, - }) - -} - -func testAccParameterManagerRegionalRegionalParameterVersion_basicWithParameterName(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_regional_parameter%{random_suffix}" - location = "us-central1" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_regional_parameter_version%{random_suffix}" - parameter_data = "test-regional-parameter-data-with-regional-parameter-name" -} - -data "google_parameter_manager_regional_parameter_version" "regional-parameter-version-basic" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.parameter_id - parameter_version_id = google_parameter_manager_regional_parameter_version.regional-parameter-version-basic.parameter_version_id - location = "us-central1" -} -`, context) -} - -func TestAccDataSourceParameterManagerRegionalRegionalParameterVersion_withJsonData(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerRegionalRegionalParameterVersion_withJsonData(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerRegionalRegionalParameterDataDataSourceMatchesResource("data.google_parameter_manager_regional_parameter_version.regional-parameter-version-with-json-data", "google_parameter_manager_regional_parameter_version.regional-parameter-version-with-json-data"), - ), - }, - }, - }) - -} - -func testAccParameterManagerRegionalRegionalParameterVersion_withJsonData(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_regional_parameter%{random_suffix}" - format = "JSON" - location = "us-central1" - -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_regional_parameter_version%{random_suffix}" - parameter_data = jsonencode({ - "key1": "val1", - "key2": "val2" - }) -} - -data "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-json-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter_version.regional-parameter-version-with-json-data.parameter - parameter_version_id = google_parameter_manager_regional_parameter_version.regional-parameter-version-with-json-data.parameter_version_id -} -`, context) -} - -func TestAccDataSourceParameterManagerRegionalRegionalParameterVersion_withYamlData(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerRegionalRegionalParameterVersion_withYamlData(context), - Check: resource.ComposeTestCheckFunc( - testAccCheckParameterManagerRegionalRegionalParameterDataDataSourceMatchesResource("data.google_parameter_manager_regional_parameter_version.regional-parameter-version-with-yaml-data", "google_parameter_manager_regional_parameter_version.regional-parameter-version-with-yaml-data"), - ), - }, - }, - }) - -} - -func testAccParameterManagerRegionalRegionalParameterVersion_withYamlData(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { - provider = google-beta - parameter_id = "tf_test_regional_parameter%{random_suffix}" - format = "YAML" - location = "us-central1" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id - parameter_version_id = "tf_test_regional_parameter_version%{random_suffix}" - parameter_data = yamlencode({ - "key1": "val1", - "key2": "val2" - }) -} - -data "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-yaml-data" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter_version.regional-parameter-version-with-yaml-data.parameter - parameter_version_id = google_parameter_manager_regional_parameter_version.regional-parameter-version-with-yaml-data.parameter_version_id -} -`, context) -} - -func testAccCheckParameterManagerRegionalRegionalParameterDataDataSourceMatchesResource(dataSource, resource string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[resource] - if !ok { - return fmt.Errorf("can't find Regional Parameter Version resource: %s", resource) - } - - ds, ok := s.RootModule().Resources[dataSource] - if !ok { - return fmt.Errorf("can't find Regional Parameter Version data source: %s", dataSource) - } - - if rs.Primary.ID == "" { - return errors.New("resource ID not set.") - } - - if ds.Primary.ID == "" { - return errors.New("data source ID not set.") - } - - resourceParameterData, ok := rs.Primary.Attributes["parameter_data"] - if !ok { - return errors.New("can't find 'parameter_data' attribute in Regoinal Parameter Version resource") - } - - dataSourceParameterData, ok := ds.Primary.Attributes["parameter_data"] - if !ok { - return errors.New("can't find 'parameter_data' attribute in Regional Parameter Version data source") - } - - if resourceParameterData != dataSourceParameterData { - return fmt.Errorf("expected %s, got %s, parameter_data doesn't match", resourceParameterData, dataSourceParameterData) - } - return nil - } -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameters.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameters.go.tmpl deleted file mode 100644 index aef664ac6ac6..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameters.go.tmpl +++ /dev/null @@ -1,173 +0,0 @@ -package parametermanagerregional -{{- if ne $.TargetVersionName "ga" }} - -import ( - "fmt" - "strings" - - "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 DataSourceParameterManagerRegionalRegionalParameters() *schema.Resource { - - dsSchema := tpgresource.DatasourceSchemaFromResourceSchema(ResourceParameterManagerRegionalRegionalParameter().Schema) - - return &schema.Resource{ - Read: dataSourceParameterManagerRegionalRegionalParametersRead, - Schema: map[string]*schema.Schema{ - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "filter": { - Type: schema.TypeString, - Description: `Filter string, adhering to the rules in List-operation filtering. List only parameters matching the filter. -If filter is empty, all regional parameters are listed from specific location.`, - Optional: true, - }, - "parameters": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: dsSchema, - }, - }, - "location": { - Type: schema.TypeString, - Required: true, - }, - }, - } -} - -func dataSourceParameterManagerRegionalRegionalParametersRead(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, "{{"{{"}}ParameterManagerRegionalBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/parameters") - if err != nil { - return err - } - - filter, has_filter := d.GetOk("filter") - - if has_filter { - url, err = transport_tpg.AddQueryParams(url, map[string]string{"filter": filter.(string)}) - if err != nil { - return err - } - } - - billingProject := "" - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("error fetching project for Regional Parameters: %s", err) - } - billingProject = project - - // err == nil indicates that the billing_project value was found - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - // To handle the pagination locally - allParameters := make([]interface{}, 0) - token := "" - for paginate := true; paginate; { - if token != "" { - url, err = transport_tpg.AddQueryParams(url, map[string]string{"pageToken": token}) - if err != nil { - return err - } - } - parameters, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ParameterManagerRegionalParameters %q", d.Id())) - } - parametersInterface := parameters["parameters"] - if parametersInterface != nil { - allParameters = append(allParameters, parametersInterface.([]interface{})...) - } - tokenInterface := parameters["nextPageToken"] - if tokenInterface == nil { - paginate = false - } else { - paginate = true - token = tokenInterface.(string) - } - } - - if err := d.Set("parameters", flattenParameterManagerRegionalRegionalParameterParameters(allParameters, d, config)); err != nil { - return fmt.Errorf("error setting regional parameters: %s", err) - } - - if err := d.Set("project", project); err != nil { - return fmt.Errorf("error setting project: %s", err) - } - - if err := d.Set("filter", filter); err != nil { - return fmt.Errorf("error setting filter: %s", err) - } - - // Store the ID now - id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/parameters") - if err != nil { - return fmt.Errorf("error constructing id: %s", err) - } - if has_filter { - id += "/filter=" + filter.(string) - } - d.SetId(id) - - return nil -} - -func flattenParameterManagerRegionalRegionalParameterParameters(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - l := v.([]interface{}) - transformed := make([]interface{}, 0, len(l)) - for _, raw := range l { - original := raw.(map[string]interface{}) - if len(original) < 1 { - // Do not include empty json objects coming back from the api - continue - } - transformed = append(transformed, map[string]interface{}{ - "format": flattenParameterManagerRegionalRegionalParameterFormat(original["format"], d, config), - "labels": flattenParameterManagerRegionalRegionalParameterEffectiveLabels(original["labels"], d, config), - "effective_labels": flattenParameterManagerRegionalRegionalParameterEffectiveLabels(original["labels"], d, config), - "terraform_labels": flattenParameterManagerRegionalRegionalParameterEffectiveLabels(original["labels"], d, config), - "create_time": flattenParameterManagerRegionalRegionalParameterCreateTime(original["createTime"], d, config), - "update_time": flattenParameterManagerRegionalRegionalParameterUpdateTime(original["updateTime"], d, config), - "policy_member": flattenParameterManagerRegionalRegionalParameterPolicyMember(original["policyMember"], d, config), - "name": flattenParameterManagerRegionalRegionalParameterName(original["name"], d, config), - "project": getDataFromName(original["name"], 1), - "location": getDataFromName(original["name"], 3), - "parameter_id": getDataFromName(original["name"], 5), - }) - } - return transformed -} - -func getDataFromName(v interface{}, part int) string { - name := v.(string) - split := strings.Split(name, "/") - return split[part] -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameters_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameters_test.go.tmpl deleted file mode 100644 index 95597a66bc07..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/data_source_parameter_manager_regional_parameters_test.go.tmpl +++ /dev/null @@ -1,260 +0,0 @@ -package parametermanagerregional_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "errors" - "fmt" - "strconv" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceParameterManagerRegionalRegionalParameters_basic(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDataSourceParameterManagerRegionalRegionalParameters_basic(context), - Check: resource.ComposeTestCheckFunc( - checkListDataSourceStateMatchesResourceStateWithIgnores( - "data.google_parameter_manager_regional_parameters.regional-parameters-datasource", - "google_parameter_manager_regional_parameter.regional-parameters", - map[string]struct{}{ - "id": {}, - "project": {}, - }, - ), - ), - }, - }, - }) -} - -func testAccDataSourceParameterManagerRegionalRegionalParameters_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -provider "google-beta" { - add_terraform_attribution_label = false -} - -resource "google_parameter_manager_regional_parameter" "regional-parameters" { - provider = google-beta - parameter_id = "tf_test_regional_parameter%{random_suffix}" - format = "YAML" - location = "us-central1" - - labels = { - key1 = "val1" - key2 = "val2" - key3 = "val3" - key4 = "val4" - key5 = "val5" - } -} - -data "google_parameter_manager_regional_parameters" "regional-parameters-datasource" { - provider = google-beta - depends_on = [ - google_parameter_manager_regional_parameter.regional-parameters - ] - location = "us-central1" -} -`, context) -} - -func TestAccDataSourceParameterManagerRegionalRegionalParameters_filter(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDataSourceParameterManagerRegionalRegionalParameters_filter(context), - Check: resource.ComposeTestCheckFunc( - checkListDataSourceStateMatchesResourceStateWithIgnoresForAppliedFilter( - "data.google_parameter_manager_regional_parameters.regional-parameters-datasource-filter", - "google_parameter_manager_regional_parameter.regional-parameters-1", - "google_parameter_manager_regional_parameter.regional-parameters-2", - map[string]struct{}{ - "id": {}, - "project": {}, - }, - ), - ), - }, - }, - }) -} - -func testAccDataSourceParameterManagerRegionalRegionalParameters_filter(context map[string]interface{}) string { - return acctest.Nprintf(` -provider "google-beta" { - add_terraform_attribution_label = false -} - -resource "google_parameter_manager_regional_parameter" "regional-parameters-1" { - provider = google-beta - parameter_id = "tf_test_regional_parameter%{random_suffix}" - format = "JSON" - location = "us-central1" - - labels = { - key1 = "val1" - } -} - -resource "google_parameter_manager_regional_parameter" "regional-parameters-2" { - provider = google-beta - parameter_id = "tf_test_regional_parameter_2_%{random_suffix}" - format = "YAML" - location = "us-central1" - - labels = { - keyoth1 = "valoth1" - } -} - -data "google_parameter_manager_regional_parameters" "regional-parameters-datasource-filter" { - provider = google-beta - filter = "format:JSON" - location = "us-central1" - - depends_on = [ - google_parameter_manager_regional_parameter.regional-parameters-1, - google_parameter_manager_regional_parameter.regional-parameters-2 - ] -} -`, context) -} - -// This function checks data source state matches for resourceName parameter manager regional parameter state -func checkListDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName string, ignoreFields map[string]struct{}) func(*terraform.State) error { - return func(s *terraform.State) error { - ds, ok := s.RootModule().Resources[dataSourceName] - if !ok { - return fmt.Errorf("can't find %s in state", dataSourceName) - } - - rs, ok := s.RootModule().Resources[resourceName] - if !ok { - return fmt.Errorf("can't find %s in state", resourceName) - } - - dsAttr := ds.Primary.Attributes - rsAttr := rs.Primary.Attributes - - err := checkFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr, ignoreFields) - if err != nil { - return err - } - return nil - } -} - -// This function checks whether all the attributes of the parameter manager regional parameter resource and the attributes of the parameter manager regional parameter inside the data source list are the same -func checkFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr map[string]string, ignoreFields map[string]struct{}) error { - totalParameters, err := strconv.Atoi(dsAttr["parameters.#"]) - if err != nil { - return errors.New("couldn't convert length of regional parameters list to integer") - } - index := "-1" - for i := 0; i < totalParameters; i++ { - if dsAttr["parameters."+strconv.Itoa(i)+".name"] == rsAttr["name"] { - index = strconv.Itoa(i) - } - } - - if index == "-1" { - return errors.New("the newly created regional parameter is not found in the data source") - } - - errMsg := "" - // Data sources are often derived from resources, so iterate over the resource fields to - // make sure all fields are accounted for in the data source. - // If a field exists in the data source but not in the resource, its expected value should - // be checked separately. - for k := range rsAttr { - if _, ok := ignoreFields[k]; ok { - continue - } - if k == "%" { - continue - } - if dsAttr["parameters."+index+"."+k] != rsAttr[k] { - // ignore data sources where an empty list is being compared against a null list. - if k[len(k)-1:] == "#" && (dsAttr["parameters."+index+"."+k] == "" || dsAttr["parameters."+index+"."+k] == "0") && (rsAttr[k] == "" || rsAttr[k] == "0") { - continue - } - errMsg += fmt.Sprintf("%s is %s; want %s\n", k, dsAttr["parameters."+index+"."+k], rsAttr[k]) - } - } - - if errMsg != "" { - return errors.New(errMsg) - } - - return nil -} - -// This function checks state match for resourceName and asserts the absense of resourceName2 in data source -func checkListDataSourceStateMatchesResourceStateWithIgnoresForAppliedFilter(dataSourceName, resourceName, resourceName2 string, ignoreFields map[string]struct{}) func(*terraform.State) error { - return func(s *terraform.State) error { - ds, ok := s.RootModule().Resources[dataSourceName] - if !ok { - return fmt.Errorf("can't find %s in state", dataSourceName) - } - - rs, ok := s.RootModule().Resources[resourceName] - if !ok { - return fmt.Errorf("can't find %s in state", resourceName) - } - - rs2, ok := s.RootModule().Resources[resourceName2] - if !ok { - return fmt.Errorf("can't find %s in state", resourceName2) - } - - dsAttr := ds.Primary.Attributes - rsAttr := rs.Primary.Attributes - rsAttr2 := rs2.Primary.Attributes - - err := checkFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr, ignoreFields) - if err != nil { - return err - } - err = checkResourceAbsentInDataSourceAfterFilterApplied(dsAttr, rsAttr2) - return err - } -} - -// This function asserts the absence of the parameter manager regional parameter resource which would not be included in the data source list due to the filter applied. -func checkResourceAbsentInDataSourceAfterFilterApplied(dsAttr, rsAttr map[string]string) error { - totalParameters, err := strconv.Atoi(dsAttr["parameters.#"]) - if err != nil { - return errors.New("couldn't convert length of regional parameters list to integer") - } - for i := 0; i < totalParameters; i++ { - if dsAttr["parameters."+strconv.Itoa(i)+".name"] == rsAttr["name"] { - return errors.New("the resource is present in the data source even after the filter is applied") - } - } - return nil -} - -{{ end }} diff --git a/mmv1/third_party/terraform/services/parametermanagerregional/resource_parameter_manager_regional_parameter_version_test.go.tmpl b/mmv1/third_party/terraform/services/parametermanagerregional/resource_parameter_manager_regional_parameter_version_test.go.tmpl deleted file mode 100644 index 194602cf68ab..000000000000 --- a/mmv1/third_party/terraform/services/parametermanagerregional/resource_parameter_manager_regional_parameter_version_test.go.tmpl +++ /dev/null @@ -1,89 +0,0 @@ -package parametermanagerregional_test -{{- if ne $.TargetVersionName "ga" }} - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccParameterManagerRegionalRegionalParameterVersion_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckParameterManagerRegionalRegionalParameterVersionDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccParameterManagerRegionalRegionalParameterVersion_basic(context), - }, - { - ResourceName: "google_parameter_manager_regional_parameter_version.regional-parameter-version-update", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter", "parameter_version_id"}, - }, - { - Config: testAccParameterManagerRegionalRegionalParameterVersion_update(context), - }, - { - ResourceName: "google_parameter_manager_regional_parameter_version.regional-parameter-version-update", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter", "parameter_version_id"}, - }, - { - Config: testAccParameterManagerRegionalRegionalParameterVersion_basic(context), - }, - { - ResourceName: "google_parameter_manager_regional_parameter_version.regional-parameter-version-update", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter", "parameter_version_id"}, - }, - }, - }) -} - -func testAccParameterManagerRegionalRegionalParameterVersion_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-update" { - provider = google-beta - parameter_id = "tf_test_regional_parameter%{random_suffix}" - location = "us-central1" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-update" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-update.id - parameter_version_id = "tf_test_regional_parameter_version%{random_suffix}" - parameter_data = "regional-parameter-version-data" -} -`, context) -} - -func testAccParameterManagerRegionalRegionalParameterVersion_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_parameter_manager_regional_parameter" "regional-parameter-update" { - provider = google-beta - parameter_id = "tf_test_regional_parameter%{random_suffix}" - location = "us-central1" -} - -resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-update" { - provider = google-beta - parameter = google_parameter_manager_regional_parameter.regional-parameter-update.id - parameter_version_id = "tf_test_regional_parameter_version%{random_suffix}" - parameter_data = "regional-parameter-version-data" - disabled = true -} -`, context) -} - -{{ 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 932cad28804a..d8ad8234b133 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 @@ -241,16 +241,9 @@ func TestAccPubsubSubscriptionBigQuery_serviceAccount(t *testing.T) { topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) subscriptionShort := fmt.Sprintf("tf-test-sub-%s", acctest.RandString(t, 10)) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com", - Role: "roles/bigquery.dataEditor", - }, - { - Member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com", - Role: "roles/bigquery.metadataViewer", - }, - }) + if acctest.BootstrapPSARoles(t, "service-", "gcp-sa-pubsub", []string{"roles/bigquery.dataEditor", "roles/bigquery.metadataViewer"}) { + t.Fatal("Stopping the test because roles were added to IAM policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/services/pubsub/resource_pubsub_topic_test.go b/mmv1/third_party/terraform/services/pubsub/resource_pubsub_topic_test.go index a4efa7568eda..38d02051d76e 100644 --- a/mmv1/third_party/terraform/services/pubsub/resource_pubsub_topic_test.go +++ b/mmv1/third_party/terraform/services/pubsub/resource_pubsub_topic_test.go @@ -48,12 +48,9 @@ func TestAccPubsubTopic_cmek(t *testing.T) { kms := acctest.BootstrapKMSKey(t) topicName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)) - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "gcp-sa-pubsub", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -233,7 +230,6 @@ resource "google_pubsub_topic" "foo" { allowed_persistence_regions = [ "%s", ] - enforce_in_transit = false } } `, topic, key, value, region) @@ -371,215 +367,3 @@ resource "google_pubsub_topic" "foo" { } `, topic) } - -func TestAccPubsubTopic_azureEventHubsIngestionUpdate(t *testing.T) { - t.Parallel() - - topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckPubsubTopicDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccPubsubTopic_updateWithAzureEventHubsIngestionSettings(topic), - }, - { - ResourceName: "google_pubsub_topic.foo", - ImportStateId: topic, - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccPubsubTopic_updateWithUpdatedAzureEventHubsIngestionSettings(topic), - }, - { - ResourceName: "google_pubsub_topic.foo", - ImportStateId: topic, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccPubsubTopic_updateWithAzureEventHubsIngestionSettings(topic string) string { - return fmt.Sprintf(` -resource "google_pubsub_topic" "foo" { - name = "%s" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass. - ingestion_data_source_settings { - azure_event_hubs { - resource_group = "azure-ingestion-resource-group" - namespace = "azure-ingestion-namespace" - event_hub = "azure-ingestion-event-hub" - client_id = "aZZZZZZZ-YYYY-HHHH-GGGG-abcdef569123" - tenant_id = "0XXXXXXX-YYYY-HHHH-GGGG-123456789123" - subscription_id = "bXXXXXXX-YYYY-HHHH-GGGG-123456789123" - gcp_service_account = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com" - } - } -} -`, topic) -} - -func testAccPubsubTopic_updateWithUpdatedAzureEventHubsIngestionSettings(topic string) string { - return fmt.Sprintf(` -resource "google_pubsub_topic" "foo" { - name = "%s" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass. - ingestion_data_source_settings { - azure_event_hubs { - resource_group = "ingestion-resource-group" - namespace = "ingestion-namespace" - event_hub = "ingestion-event-hub" - client_id = "aZZZZZZZ-YYYY-HHHH-GGGG-abcdef123456" - tenant_id = "0XXXXXXX-YYYY-HHHH-GGGG-123456123456" - subscription_id = "bXXXXXXX-YYYY-HHHH-GGGG-123456123456" - gcp_service_account = "fake-account@new-gcp-project.iam.gserviceaccount.com" - } - } -} -`, topic) -} - -func TestAccPubsubTopic_awsMskIngestionUpdate(t *testing.T) { - t.Parallel() - - topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckPubsubTopicDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccPubsubTopic_updateWithAwsMskIngestionSettings(topic), - }, - { - ResourceName: "google_pubsub_topic.foo", - ImportStateId: topic, - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccPubsubTopic_updateWithUpdatedAwsMskIngestionSettings(topic), - }, - { - ResourceName: "google_pubsub_topic.foo", - ImportStateId: topic, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccPubsubTopic_updateWithAwsMskIngestionSettings(topic string) string { - return fmt.Sprintf(` -resource "google_pubsub_topic" "foo" { - name = "%s" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass. - ingestion_data_source_settings { - aws_msk { - cluster_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name" - topic = "test-topic" - aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name" - gcp_service_account = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com" - } - } -} -`, topic) -} - -func testAccPubsubTopic_updateWithUpdatedAwsMskIngestionSettings(topic string) string { - return fmt.Sprintf(` -resource "google_pubsub_topic" "foo" { - name = "%s" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass. - ingestion_data_source_settings { - aws_msk { - cluster_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name" - topic = "test-topic" - aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name" - gcp_service_account = "updated-fake-service-account@fake-gcp-project.iam.gserviceaccount.com" - } - } -} -`, topic) -} - -func TestAccPubsubTopic_confluentCloudIngestionUpdate(t *testing.T) { - t.Parallel() - - topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckPubsubTopicDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccPubsubTopic_updateWithConfluentCloudIngestionSettings(topic), - }, - { - ResourceName: "google_pubsub_topic.foo", - ImportStateId: topic, - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccPubsubTopic_updateWithUpdatedConfluentCloudIngestionSettings(topic), - }, - { - ResourceName: "google_pubsub_topic.foo", - ImportStateId: topic, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccPubsubTopic_updateWithConfluentCloudIngestionSettings(topic string) string { - return fmt.Sprintf(` -resource "google_pubsub_topic" "foo" { - name = "%s" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass. - ingestion_data_source_settings { - confluent_cloud { - bootstrap_server = "test.us-west2.gcp.confluent.cloud:1111" - cluster_id = "1234" - topic = "test-topic" - identity_pool_id = "test-identity-pool-id" - gcp_service_account = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com" - } - } -} -`, topic) -} - -func testAccPubsubTopic_updateWithUpdatedConfluentCloudIngestionSettings(topic string) string { - return fmt.Sprintf(` -resource "google_pubsub_topic" "foo" { - name = "%s" - - # Outside of automated terraform-provider-google CI tests, these values must be of actual Cloud Storage resources for the test to pass. - ingestion_data_source_settings { - confluent_cloud { - bootstrap_server = "test.us-west2.gcp.confluent.cloud:1111" - cluster_id = "1234" - topic = "test-topic" - identity_pool_id = "test-identity-pool-id" - gcp_service_account = "updated-fake-service-account@fake-gcp-project.iam.gserviceaccount.com" - } - } -} -`, topic) -} diff --git a/mmv1/third_party/terraform/services/recaptchaenterprise/resource_recaptcha_enterprise_key_meta.yaml b/mmv1/third_party/terraform/services/recaptchaenterprise/resource_recaptcha_enterprise_key_meta.yaml index 71507d60dac1..d8540f7b4cc3 100644 --- a/mmv1/third_party/terraform/services/recaptchaenterprise/resource_recaptcha_enterprise_key_meta.yaml +++ b/mmv1/third_party/terraform/services/recaptchaenterprise/resource_recaptcha_enterprise_key_meta.yaml @@ -3,26 +3,3 @@ generation_type: 'dcl' api_service_name: 'recaptchaenterprise.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Key' -fields: - - field: 'android_settings.allow_all_package_names' - - field: 'android_settings.allowed_package_names' - - field: 'create_time' - - field: 'display_name' - - field: 'effective_labels' - provider_only: true - - field: 'ios_settings.allow_all_bundle_ids' - - field: 'ios_settings.allowed_bundle_ids' - - field: 'labels' - - field: 'name' - - field: 'project' - - field: 'terraform_labels' - provider_only: true - - field: 'testing_options.testing_challenge' - - field: 'testing_options.testing_score' - - field: 'waf_settings.waf_feature' - - field: 'waf_settings.waf_service' - - field: 'web_settings.allow_all_domains' - - field: 'web_settings.allow_amp_traffic' - - field: 'web_settings.allowed_domains' - - field: 'web_settings.challenge_security_preference' - - field: 'web_settings.integration_type' diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.tmpl index 3042df527a02..31a8759a32d2 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.tmpl @@ -349,75 +349,6 @@ func TestAccRedisCluster_switchoverAndDetachSecondary(t *testing.T) { }) } -// Validate that cluster endpoints are updated for the cluster -func TestAccRedisCluster_updateClusterEndpoints(t *testing.T) { - t.Parallel() - - name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckRedisClusterDestroyProducer(t), - Steps: []resource.TestStep{ - { - // create cluster with no user created connections - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true, zoneDistributionMode: "MULTI_ZONE", maintenanceDay: "MONDAY", maintenanceHours: 1, maintenanceMinutes: 0, maintenanceSeconds: 0, maintenanceNanos: 0, userEndpointCount: 0}), - }, - { - ResourceName: "google_redis_cluster.test", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"psc_configs"}, - }, - { - // create cluster with one user created connection - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true, zoneDistributionMode: "MULTI_ZONE", maintenanceDay: "MONDAY", maintenanceHours: 1, maintenanceMinutes: 0, maintenanceSeconds: 0, maintenanceNanos: 0, userEndpointCount: 1}), - }, - { - ResourceName: "google_redis_cluster.test", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"psc_configs"}, - }, - { - // update cluster with 2 endpoints - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true, zoneDistributionMode: "MULTI_ZONE", maintenanceDay: "MONDAY", maintenanceHours: 1, maintenanceMinutes: 0, maintenanceSeconds: 0, maintenanceNanos: 0, userEndpointCount: 2}), - }, - { - ResourceName: "google_redis_cluster.test", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"psc_configs"}, - }, - { - // update cluster with 1 endpoint - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true, zoneDistributionMode: "MULTI_ZONE", maintenanceDay: "MONDAY", maintenanceHours: 1, maintenanceMinutes: 0, maintenanceSeconds: 0, maintenanceNanos: 0, userEndpointCount: 1}), - }, - { - ResourceName: "google_redis_cluster.test", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"psc_configs"}, - }, - { - // update cluster with 0 endpoints - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true, zoneDistributionMode: "MULTI_ZONE", maintenanceDay: "MONDAY", maintenanceHours: 1, maintenanceMinutes: 0, maintenanceSeconds: 0, maintenanceNanos: 0, userEndpointCount: 0}), - }, - { - ResourceName: "google_redis_cluster.test", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"psc_configs"}, - }, - { - // clean up the resource - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, zoneDistributionMode: "MULTI_ZONE", maintenanceDay: "MONDAY", maintenanceHours: 1, maintenanceMinutes: 0, maintenanceSeconds: 0, maintenanceNanos: 0, userEndpointCount: 0}), - }, - }, - }) -} - type ClusterParams struct { name string replicaCount int @@ -436,242 +367,6 @@ type ClusterParams struct { shouldCreateSecondary bool secondaryClusterName string ccrRole string - userEndpointCount int -} - -func createRedisClusterEndpoints(params *ClusterParams) string { - if params.userEndpointCount == 2 { - return createRedisClusterEndpointsWithTwoUserCreatedConnections(params) - } else if params.userEndpointCount == 1 { - return createRedisClusterEndpointsWithOneUserCreatedConnections(params) - } - return `` -} - -func createRedisClusterEndpointsWithOneUserCreatedConnections(params *ClusterParams) string { - return fmt.Sprintf(` - resource "google_redis_cluster_user_created_connections" "default" { - provider = google-beta - name = "%s" - region = "us-central1" - cluster_endpoints { - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule1_network1.psc_connection_id - address = google_compute_address.ip1_network1.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule1_network1.id - network = google_compute_network.network1.id - project_id = data.google_project.project.project_id - service_attachment = google_redis_cluster.test.psc_service_attachments[0].service_attachment - } - } - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule2_network1.psc_connection_id - address = google_compute_address.ip2_network1.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule2_network1.id - network = google_compute_network.network1.id - service_attachment = google_redis_cluster.test.psc_service_attachments[1].service_attachment - } - } - } - } - data "google_project" "project" { - provider = google-beta - } - %s - `, - params.name, - createRedisClusterUserCreatedConnection1(params), - ) - -} - -func createRedisClusterEndpointsWithTwoUserCreatedConnections(params *ClusterParams) string { - return fmt.Sprintf(` - resource "google_redis_cluster_user_created_connections" "default" { - provider = google-beta - name = "%s" - region = "us-central1" - cluster_endpoints { - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule1_network1.psc_connection_id - address = google_compute_address.ip1_network1.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule1_network1.id - network = google_compute_network.network1.id - project_id = data.google_project.project.project_id - service_attachment = google_redis_cluster.test.psc_service_attachments[0].service_attachment - } - } - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule2_network1.psc_connection_id - address = google_compute_address.ip2_network1.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule2_network1.id - network = google_compute_network.network1.id - service_attachment = google_redis_cluster.test.psc_service_attachments[1].service_attachment - } - } - } - cluster_endpoints { - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule1_network2.psc_connection_id - address = google_compute_address.ip1_network2.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule1_network2.id - network = google_compute_network.network2.id - service_attachment = google_redis_cluster.test.psc_service_attachments[0].service_attachment - } - } - connections { - psc_connection { - psc_connection_id = google_compute_forwarding_rule.forwarding_rule2_network2.psc_connection_id - address = google_compute_address.ip2_network2.address - forwarding_rule = google_compute_forwarding_rule.forwarding_rule2_network2.id - network = google_compute_network.network2.id - service_attachment = google_redis_cluster.test.psc_service_attachments[1].service_attachment - } - } - } - } - data "google_project" "project" { - provider = google-beta - } - %s - %s - `, - params.name, - createRedisClusterUserCreatedConnection1(params), - createRedisClusterUserCreatedConnection2(params), - ) -} - -func createRedisClusterUserCreatedConnection1(params *ClusterParams) string { - return fmt.Sprintf(` - resource "google_compute_forwarding_rule" "forwarding_rule1_network1" { - provider = google-beta - name = "%s" - region = "us-central1" - ip_address = google_compute_address.ip1_network1.id - load_balancing_scheme = "" - network = google_compute_network.network1.id - target = google_redis_cluster.test.psc_service_attachments[0].service_attachment - } - - resource "google_compute_forwarding_rule" "forwarding_rule2_network1" { - provider = google-beta - name = "%s" - region = "us-central1" - ip_address = google_compute_address.ip2_network1.id - load_balancing_scheme = "" - network = google_compute_network.network1.id - target = google_redis_cluster.test.psc_service_attachments[1].service_attachment - } - - resource "google_compute_address" "ip1_network1" { - provider = google-beta - name = "%s" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network1.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" - } - - resource "google_compute_address" "ip2_network1" { - provider = google-beta - name = "%s" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network1.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" - } - - resource "google_compute_subnetwork" "subnet_network1" { - provider = google-beta - name = "%s" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.network1.id - } - - resource "google_compute_network" "network1" { - provider = google-beta - name = "%s" - auto_create_subnetworks = false - } - `, - params.name+"-11", // fwd-rule1-net1 - params.name+"-12", // fwd-rule2-net1 - params.name+"-11", // ip1-net1 - params.name+"-12", // ip2-net1 - params.name+"-1", // subnet-net1 - params.name+"-1", // net1 - ) -} - -func createRedisClusterUserCreatedConnection2(params *ClusterParams) string { - return fmt.Sprintf(` - resource "google_compute_forwarding_rule" "forwarding_rule1_network2" { - provider = google-beta - name = "%s" - region = "us-central1" - ip_address = google_compute_address.ip1_network2.id - load_balancing_scheme = "" - network = google_compute_network.network2.id - target = google_redis_cluster.test.psc_service_attachments[0].service_attachment - } - - resource "google_compute_forwarding_rule" "forwarding_rule2_network2" { - provider = google-beta - name = "%s" - region = "us-central1" - ip_address = google_compute_address.ip2_network2.id - load_balancing_scheme = "" - network = google_compute_network.network2.id - target = google_redis_cluster.test.psc_service_attachments[1].service_attachment - } - - resource "google_compute_address" "ip1_network2" { - provider = google-beta - name = "%s" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network2.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" - } - - resource "google_compute_address" "ip2_network2" { - provider = google-beta - name = "%s" - region = "us-central1" - subnetwork = google_compute_subnetwork.subnet_network2.id - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" - } - - resource "google_compute_subnetwork" "subnet_network2" { - provider = google-beta - name = "%s" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.network2.id - } - - resource "google_compute_network" "network2" { - provider = google-beta - name = "%s" - auto_create_subnetworks = false - } - `, - params.name+"-21", // fwd-rule1-net2 - params.name+"-22", // fwd-rule2-net2 - params.name+"-21", // ip1-net2 - params.name+"-22", // ip2-net2 - params.name+"-2", // subnet-net2 - params.name+"-2", // net2 - ) - } func createOrUpdateRedisCluster(params *ClusterParams) string { @@ -681,10 +376,7 @@ func createOrUpdateRedisCluster(params *ClusterParams) string { secClusterResourceBlock = createRedisClusterResourceConfig(params, /*isSecondaryCluster*/true) } - endpointBlock := createRedisClusterEndpoints(params) - return fmt.Sprintf(` - %s %s %s resource "google_network_connectivity_service_connection_policy" "default" { @@ -713,7 +405,6 @@ func createOrUpdateRedisCluster(params *ClusterParams) string { auto_create_subnetworks = false } `, - endpointBlock, clusterResourceBlock, secClusterResourceBlock, params.name, diff --git a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_organizations.go b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_organizations.go deleted file mode 100644 index d92db6891971..000000000000 --- a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_organizations.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package resourcemanager - -import ( - "context" - "fmt" - "path/filepath" - - "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" - - "google.golang.org/api/cloudresourcemanager/v1" -) - -func DataSourceGoogleOrganizations() *schema.Resource { - return &schema.Resource{ - Read: datasourceGoogleOrganizationsRead, - Schema: map[string]*schema.Schema{ - "filter": { - Optional: true, - Type: schema.TypeString, - }, - "organizations": { - Computed: true, - Type: schema.TypeList, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "directory_customer_id": { - Computed: true, - Type: schema.TypeString, - }, - "display_name": { - Computed: true, - Type: schema.TypeString, - }, - "lifecycle_state": { - Computed: true, - Type: schema.TypeString, - }, - "name": { - Computed: true, - Type: schema.TypeString, - }, - "org_id": { - Computed: true, - Type: schema.TypeString, - }, - }, - }, - }, - }, - } -} - -func datasourceGoogleOrganizationsRead(d *schema.ResourceData, meta interface{}) error { - config := meta.(*transport_tpg.Config) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - organizations := make([]map[string]interface{}, 0) - - filter := "" - if v, ok := d.GetOk("filter"); ok { - filter = v.(string) - } - - request := config.NewResourceManagerClient(userAgent).Organizations.Search(&cloudresourcemanager.SearchOrganizationsRequest{ - Filter: filter, - }) - - err = request.Pages(context.Background(), func(organizationList *cloudresourcemanager.SearchOrganizationsResponse) error { - for _, organization := range organizationList.Organizations { - directoryCustomerId := "" - if organization.Owner != nil { - directoryCustomerId = organization.Owner.DirectoryCustomerId - } - - organizations = append(organizations, map[string]interface{}{ - "directory_customer_id": directoryCustomerId, - "display_name": organization.DisplayName, - "lifecycle_state": organization.LifecycleState, - "name": organization.Name, - "org_id": filepath.Base(organization.Name), - }) - } - return nil - }) - - if err != nil { - return fmt.Errorf("Error retrieving organizations: %s", err) - } - - if err := d.Set("organizations", organizations); err != nil { - return fmt.Errorf("Error setting organizations: %s", err) - } - - if filter == "" { - filter = "empty_filter" - } - d.SetId(filter) - - return nil -} diff --git a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_organizations_test.go b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_organizations_test.go deleted file mode 100644 index 31a2b2a65b37..000000000000 --- a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_organizations_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package resourcemanager_test - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" -) - -func TestAccDataSourceGoogleOrganizations_basic(t *testing.T) { - t.Parallel() - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: `data "google_organizations" "test" {}`, - Check: resource.ComposeTestCheckFunc( - // We assume that every principal finds at least one organization and we'll only check set-ness - resource.TestCheckResourceAttrSet("data.google_organizations.test", "organizations.0.directory_customer_id"), - resource.TestCheckResourceAttrSet("data.google_organizations.test", "organizations.0.display_name"), - resource.TestCheckResourceAttrSet("data.google_organizations.test", "organizations.0.lifecycle_state"), - resource.TestCheckResourceAttrSet("data.google_organizations.test", "organizations.0.name"), - resource.TestCheckResourceAttrSet("data.google_organizations.test", "organizations.0.org_id"), - ), - }, - }, - }) -} diff --git a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_accounts.go b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_accounts.go index 375314e62075..ae5521520a70 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_accounts.go +++ b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_accounts.go @@ -3,35 +3,22 @@ package resourcemanager import ( - "context" "fmt" - "regexp" "strings" "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" - "github.com/hashicorp/terraform-provider-google/google/verify" - "google.golang.org/api/iam/v1" ) func DataSourceGoogleServiceAccounts() *schema.Resource { return &schema.Resource{ Read: datasourceGoogleServiceAccountsRead, Schema: map[string]*schema.Schema{ - "prefix": { - Type: schema.TypeString, - Optional: true, - }, "project": { Type: schema.TypeString, Optional: true, }, - "regex": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateRegexCompiles(), - }, "accounts": { Type: schema.TypeList, Computed: true, @@ -84,64 +71,33 @@ func datasourceGoogleServiceAccountsRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("Error fetching project for service accounts: %s", err) } - prefix := d.Get("prefix").(string) - regexPattern := d.Get("regex").(string) - - var regex *regexp.Regexp - if regexPattern != "" { - regex, err = regexp.Compile(regexPattern) - if err != nil { - return fmt.Errorf("Invalid regex pattern: %s", err) - } - } - accounts := make([]map[string]interface{}, 0) - request := config.NewIamClient(userAgent).Projects.ServiceAccounts.List("projects/" + project) - - err = request.Pages(context.Background(), func(accountList *iam.ListServiceAccountsResponse) error { - for _, account := range accountList.Accounts { - accountId := strings.Split(account.Email, "@")[0] - - if prefix != "" && !strings.HasPrefix(accountId, prefix) { - continue - } - if regex != nil && !regex.MatchString(account.Email) { - continue - } - - accounts = append(accounts, map[string]interface{}{ - "account_id": accountId, - "disabled": account.Disabled, - "email": account.Email, - "display_name": account.DisplayName, - "member": "serviceAccount:" + account.Email, - "name": account.Name, - "unique_id": account.UniqueId, - }) - } - return nil - }) - + accountList, err := config.NewIamClient(userAgent).Projects.ServiceAccounts.List("projects/" + project).Do() if err != nil { - return fmt.Errorf("Error retrieving service accounts: %s", err) + return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("Service accounts: %s", project)) } - if err := d.Set("accounts", accounts); err != nil { - return fmt.Errorf("Error setting service accounts: %s", err) + for _, account := range accountList.Accounts { + accounts = append(accounts, map[string]interface{}{ + "account_id": strings.Split(account.Email, "@")[0], + "disabled": account.Disabled, + "email": account.Email, + "display_name": account.DisplayName, + "member": "serviceAccount:" + account.Email, + "name": account.Name, + "unique_id": account.UniqueId, + }) } - idParts := []string{"projects", project} - - if prefix != "" { - idParts = append(idParts, "prefix/"+prefix) - } - if regexPattern != "" { - idParts = append(idParts, "regex/"+regexPattern) + if err := d.Set("accounts", accounts); err != nil { + return fmt.Errorf("Error retrieving service accounts: %s", err) } - // Set the ID dynamically based on the provided attributes - d.SetId(strings.Join(idParts, "/")) + d.SetId(fmt.Sprintf( + "projects/%s", + project, + )) return nil } diff --git a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_accounts_test.go b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_accounts_test.go index 39c8f6d7f59f..a5ee59409d87 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_accounts_test.go +++ b/mmv1/third_party/terraform/services/resourcemanager/data_source_google_service_accounts_test.go @@ -38,28 +38,18 @@ func TestAccDataSourceGoogleServiceAccounts_basic(t *testing.T) { // We can't guarantee that no more service accounts are in the project, so we'll check set-ness rather than correctness resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.0.account_id"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.0.disabled"), + resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.0.display_name"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.0.email"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.0.member"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.0.name"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.0.unique_id"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.1.account_id"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.1.disabled"), + resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.1.display_name"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.1.email"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.1.member"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.1.name"), resource.TestCheckResourceAttrSet("data.google_service_accounts.all", "accounts.1.unique_id"), - - // Check for prefix on account id - resource.TestCheckResourceAttr("data.google_service_accounts.with_prefix", "accounts.0.account_id", sa_1), - - // Check for regex on email - resource.TestCheckResourceAttr("data.google_service_accounts.with_regex", "accounts.0.email", fmt.Sprintf("%s@%s.iam.gserviceaccount.com", sa_1, project)), - - // Check if the account_id matches the prefix - resource.TestCheckResourceAttr("data.google_service_accounts.with_prefix_and_regex", "accounts.0.account_id", fmt.Sprintf(sa_1)), - - // Check if the email matches the regex - resource.TestCheckResourceAttr("data.google_service_accounts.with_prefix_and_regex", "accounts.0.email", fmt.Sprintf("%s@%s.iam.gserviceaccount.com", sa_1, project)), ), }, }, @@ -90,26 +80,10 @@ data "google_service_accounts" "all" { project = local.project_id depends_on = [ - google_service_account.sa_one, - google_service_account.sa_two, + google_service_account.sa_one, + google_service_account.sa_two, ] } - -data "google_service_accounts" "with_prefix" { - prefix = google_service_account.sa_one.account_id - project = local.project_id -} - -data "google_service_accounts" "with_regex" { - project = local.project_id - regex = ".*${google_service_account.sa_one.account_id}.*@.*\\.gserviceaccount\\.com" -} - -data "google_service_accounts" "with_prefix_and_regex" { - prefix = google_service_account.sa_one.account_id - project = local.project_id - regex = ".*${google_service_account.sa_one.account_id}.*@.*\\.gserviceaccount\\.com" -} `, context["project"].(string), context["sa_1"].(string), diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_billing_subaccount_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_billing_subaccount_meta.yaml index 748852309419..896f474b1bac 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_billing_subaccount_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_billing_subaccount_meta.yaml @@ -3,10 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudbilling.googleapis.com' api_version: 'v1' api_resource_type_kind: 'BillingAccount' -fields: - - field: 'billing_account_id' - - field: 'deletion_policy' - - field: 'display_name' - - field: 'master_billing_account' - - field: 'name' - - field: 'open' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_folder_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_folder_meta.yaml index dcbb91615338..b88b40ee25a1 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_folder_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_folder_meta.yaml @@ -3,12 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudresourcemanager.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Folder' -fields: - - field: 'create_time' - - field: 'deletion_protection' - - field: 'display_name' - - field: 'folder_id' - - field: 'lifecycle_state' - - field: 'name' - - field: 'parent' - - field: 'tags' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_folder_organization_policy_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_folder_organization_policy_meta.yaml index 31c825c71698..9c7a0c24ccdf 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_folder_organization_policy_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_folder_organization_policy_meta.yaml @@ -3,17 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudresourcemanager.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Folder' -fields: - - field: 'boolean_policy.enforced' - - field: 'constraint' - - field: 'etag' - - field: 'folder' - - field: 'list_policy.allow.all' - - field: 'list_policy.allow.values' - - field: 'list_policy.deny.all' - - field: 'list_policy.deny.values' - - field: 'list_policy.inherit_from_parent' - - field: 'list_policy.suggested_value' - - field: 'restore_policy.default' - - field: 'update_time' - - field: 'version' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_organization_iam_custom_role_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_organization_iam_custom_role_meta.yaml index 56623a72cbda..711257ae01b4 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_organization_iam_custom_role_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_organization_iam_custom_role_meta.yaml @@ -3,12 +3,3 @@ generation_type: 'handwritten' api_service_name: 'iam.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Role' -fields: - - field: 'deleted' - - field: 'description' - - field: 'name' - - field: 'org_id' - - field: 'permissions' - - field: 'role_id' - - field: 'stage' - - field: 'title' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_organization_policy_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_organization_policy_meta.yaml index 764ff84e4f2d..ad67418123b0 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_organization_policy_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_organization_policy_meta.yaml @@ -3,17 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudresourcemanager.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Organization' -fields: - - field: 'boolean_policy.enforced' - - field: 'constraint' - - field: 'etag' - - field: 'list_policy.allow.all' - - field: 'list_policy.allow.values' - - field: 'list_policy.deny.all' - - field: 'list_policy.deny.values' - - field: 'list_policy.inherit_from_parent' - - field: 'list_policy.suggested_value' - - field: 'org_id' - - field: 'restore_policy.default' - - field: 'update_time' - - field: 'version' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project.go b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project.go index 208f4655ed0f..835473882ded 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project.go +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project.go @@ -216,9 +216,9 @@ func resourceGoogleProjectCreate(d *schema.ResourceData, meta interface{}) error } } - // Sleep to let the billing account settle before other resources + // Sleep for 10s, letting the billing account settle before other resources // try to use this project. - time.Sleep(15 * time.Second) + time.Sleep(10 * time.Second) err = resourceGoogleProjectRead(d, meta) if err != nil { @@ -245,7 +245,7 @@ func resourceGoogleProjectCreate(d *schema.ResourceData, meta interface{}) error err = forceDeleteComputeNetwork(d, config, project.ProjectId, "default") // Retry if API is not yet enabled. if err != nil && transport_tpg.IsGoogleApiErrorWithCode(err, 403) { - time.Sleep(15 * time.Second) + time.Sleep(10 * time.Second) err = forceDeleteComputeNetwork(d, config, project.ProjectId, "default") } if err != nil { diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_default_service_accounts_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_default_service_accounts_meta.yaml index 8f3113b9c2b3..d606fe7c4e13 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_default_service_accounts_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_default_service_accounts_meta.yaml @@ -3,8 +3,3 @@ generation_type: 'handwritten' api_service_name: 'iam.googleapis.com' api_version: 'v1' api_resource_type_kind: 'ServiceAccount' -fields: - - field: 'action' - - field: 'project' - - field: 'restore_policy' - - field: 'service_accounts' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_iam_custom_role_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_iam_custom_role_meta.yaml index 03db6c3183a7..9617e5cd42bb 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_iam_custom_role_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_iam_custom_role_meta.yaml @@ -3,12 +3,3 @@ generation_type: 'handwritten' api_service_name: 'iam.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Role' -fields: - - field: 'deleted' - - field: 'description' - - field: 'name' - - field: 'permissions' - - field: 'project' - - field: 'role_id' - - field: 'stage' - - field: 'title' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_iam_member_remove_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_iam_member_remove_meta.yaml index 4eaef9a93e06..cac8201a0334 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_iam_member_remove_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_iam_member_remove_meta.yaml @@ -3,7 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudresourcemanager.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Project' -fields: - - field: 'member' - - field: 'project' - - field: 'role' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_meta.yaml index c9fb0c8ed19d..f27a48de4e8a 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_meta.yaml @@ -3,18 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudresourcemanager.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Project' -fields: - - field: 'auto_create_network' - - field: 'billing_account' - - field: 'deletion_policy' - - field: 'effective_labels' - provider_only: true - - field: 'folder_id' - - field: 'labels' - - field: 'name' - - field: 'number' - - field: 'org_id' - - field: 'project_id' - - field: 'tags' - - field: 'terraform_labels' - provider_only: true diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_organization_policy_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_organization_policy_meta.yaml index 05d079ddb3d1..8ffc2a275619 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_organization_policy_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_organization_policy_meta.yaml @@ -3,17 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudresourcemanager.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Project' -fields: - - field: 'boolean_policy.enforced' - - field: 'constraint' - - field: 'etag' - - field: 'list_policy.allow.all' - - field: 'list_policy.allow.values' - - field: 'list_policy.deny.all' - - field: 'list_policy.deny.values' - - field: 'list_policy.inherit_from_parent' - - field: 'list_policy.suggested_value' - - field: 'project' - - field: 'restore_policy.default' - - field: 'update_time' - - field: 'version' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_service_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_service_meta.yaml new file mode 100644 index 000000000000..b408fdc49c94 --- /dev/null +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_service_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_project_service' +generation_type: 'handwritten' +api_service_name: 'serviceusage.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Service' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_service_meta.yaml.tmpl b/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_service_meta.yaml.tmpl deleted file mode 100644 index 92417c380fc8..000000000000 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_project_service_meta.yaml.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource: 'google_project_service' -generation_type: 'handwritten' -api_service_name: 'serviceusage.googleapis.com' -api_version: 'v1' -api_resource_type_kind: 'Service' -fields: -{{- if ne $.TargetVersionName "ga" }} - - field: 'check_if_service_has_usage_on_destroy' -{{- end }} - - field: 'disable_dependent_services' - - field: 'disable_on_destroy' - - field: 'project' - - field: 'service' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_key_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_key_meta.yaml index 0a3ba5b0b0fc..9abaeee5f9ca 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_key_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_key_meta.yaml @@ -3,15 +3,3 @@ generation_type: 'handwritten' api_service_name: 'iam.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Key' -fields: - - field: 'keepers' - - field: 'key_algorithm' - - field: 'name' - - field: 'private_key' - - field: 'private_key_type' - - field: 'public_key' - - field: 'public_key_data' - - field: 'public_key_type' - - field: 'service_account_id' - - field: 'valid_after' - - field: 'valid_before' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_meta.yaml b/mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_meta.yaml index 2edb55bcab7e..25273cda66be 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_meta.yaml +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_meta.yaml @@ -3,14 +3,3 @@ generation_type: 'handwritten' api_service_name: 'iam.googleapis.com' api_version: 'v1' api_resource_type_kind: 'ServiceAccount' -fields: - - field: 'account_id' - - field: 'create_ignore_already_exists' - - field: 'description' - - field: 'disabled' - - field: 'display_name' - - field: 'email' - - field: 'member' - - field: 'name' - - field: 'project' - - field: 'unique_id' diff --git a/mmv1/third_party/terraform/services/resourcemanager/resource_project_service_identity_meta.yaml.tmpl b/mmv1/third_party/terraform/services/resourcemanager/resource_project_service_identity_meta.yaml.tmpl index e998af291739..60c35ff72cfb 100644 --- a/mmv1/third_party/terraform/services/resourcemanager/resource_project_service_identity_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/resourcemanager/resource_project_service_identity_meta.yaml.tmpl @@ -4,9 +4,4 @@ generation_type: 'handwritten' api_service_name: 'serviceusage.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Service' -fields: - - field: 'email' - - field: 'member' - - field: 'project' - - field: 'service' {{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_config_meta.yaml.tmpl b/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_config_meta.yaml.tmpl index cdbaf42e2683..996c58c77d70 100644 --- a/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_config_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_config_meta.yaml.tmpl @@ -4,8 +4,4 @@ generation_type: 'handwritten' api_service_name: 'runtimeconfig.googleapis.com' api_version: 'v1beta1' api_resource_type_kind: 'RuntimeConfig' -fields: - - field: 'description' - - field: 'name' - - field: 'project' {{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_variable_meta.yaml.tmpl b/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_variable_meta.yaml.tmpl index a10829766011..0cf5e15e6696 100644 --- a/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_variable_meta.yaml.tmpl +++ b/mmv1/third_party/terraform/services/runtimeconfig/resource_runtimeconfig_variable_meta.yaml.tmpl @@ -4,11 +4,4 @@ generation_type: 'handwritten' api_service_name: 'runtimeconfig.googleapis.com' api_version: 'v1beta1' api_resource_type_kind: 'Variable' -fields: - - field: 'name' - - field: 'parent' - - field: 'project' - - field: 'text' - - field: 'update_time' - - field: 'value' {{ end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/securitycenter/resource_scc_mute_config_test.go b/mmv1/third_party/terraform/services/securitycenter/resource_scc_mute_config_test.go deleted file mode 100644 index c30e7bfb60d0..000000000000 --- a/mmv1/third_party/terraform/services/securitycenter/resource_scc_mute_config_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package securitycenter_test - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" -) - -func TestAccSecurityCenterMuteConfig(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "org_id": envvar.GetTestOrgFromEnv(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": {}, - }, - Steps: []resource.TestStep{ - { - Config: testAccSecurityCenterMuteConfig_basic(context), - }, - { - ResourceName: "google_scc_mute_config.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "mute_config_id", - }, - }, - { - Config: testAccSecurityCenterMuteConfig_update(context), - }, - { - ResourceName: "google_scc_mute_config.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "mute_config_id", - }, - }, - }, - }) -} - -func testAccSecurityCenterMuteConfig_basic(context map[string]interface{}) string { - return acctest.Nprintf(` - -resource "google_scc_mute_config" "default" { - mute_config_id = "tf-test-mute-config-%{random_suffix}" - parent = "organizations/%{org_id}" - filter = "category: \"OS_VULNERABILITY\"" - description = "A Test Mute Config" - type = "DYNAMIC" - expiry_time = "2215-02-03T15:01:23Z" -} -`, context) -} - -func testAccSecurityCenterMuteConfig_update(context map[string]interface{}) string { - return acctest.Nprintf(` - -resource "google_scc_mute_config" "default" { - mute_config_id = "tf-test-mute-config-%{random_suffix}" - parent = "organizations/%{org_id}" - filter = "category: \"OS_VULNERABILITY\"" - description = "An Updated Test Mute Config" - type = "DYNAMIC" - expiry_time = "2215-02-03T15:01:23Z" -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/servicemanagement/resource_endpoints_service_meta.yaml b/mmv1/third_party/terraform/services/servicemanagement/resource_endpoints_service_meta.yaml index 47800836e732..92596bf91c15 100644 --- a/mmv1/third_party/terraform/services/servicemanagement/resource_endpoints_service_meta.yaml +++ b/mmv1/third_party/terraform/services/servicemanagement/resource_endpoints_service_meta.yaml @@ -3,20 +3,3 @@ generation_type: 'handwritten' api_service_name: 'servicemanagement.googleapis.com' api_version: 'v1' api_resource_type_kind: 'ManagedService' -fields: - - field: 'apis.methods.name' - - field: 'apis.methods.request_type' - - field: 'apis.methods.response_type' - - field: 'apis.methods.syntax' - - field: 'apis.name' - - field: 'apis.syntax' - - field: 'apis.version' - - field: 'config_id' - - field: 'dns_address' - - field: 'endpoints.address' - - field: 'endpoints.name' - - field: 'grpc_config' - - field: 'openapi_config' - - field: 'project' - - field: 'protoc_output_base64' - - field: 'service_name' diff --git a/mmv1/third_party/terraform/services/servicenetworking/resource_google_service_networking_peered_dns_domain_meta.yaml b/mmv1/third_party/terraform/services/servicenetworking/resource_google_service_networking_peered_dns_domain_meta.yaml index fa9c29559aff..07f91c6ec982 100644 --- a/mmv1/third_party/terraform/services/servicenetworking/resource_google_service_networking_peered_dns_domain_meta.yaml +++ b/mmv1/third_party/terraform/services/servicenetworking/resource_google_service_networking_peered_dns_domain_meta.yaml @@ -3,10 +3,3 @@ generation_type: 'handwritten' api_service_name: 'servicenetworking.googleapis.com' api_version: 'v1' api_resource_type_kind: 'PeeredDnsDomain' -fields: - - field: 'dns_suffix' - - field: 'name' - - field: 'network' - - field: 'parent' - - field: 'project' - - field: 'service' diff --git a/mmv1/third_party/terraform/services/servicenetworking/resource_service_networking_connection_meta.yaml b/mmv1/third_party/terraform/services/servicenetworking/resource_service_networking_connection_meta.yaml index ab4711f8201a..b39338c93c9c 100644 --- a/mmv1/third_party/terraform/services/servicenetworking/resource_service_networking_connection_meta.yaml +++ b/mmv1/third_party/terraform/services/servicenetworking/resource_service_networking_connection_meta.yaml @@ -3,10 +3,3 @@ generation_type: 'handwritten' api_service_name: 'servicenetworking.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Connection' -fields: - - field: 'deletion_policy' - - field: 'network' - - field: 'peering' - - field: 'reserved_peering_ranges' - - field: 'service' - - field: 'update_on_creation_fail' diff --git a/mmv1/third_party/terraform/services/siteverification/resource_site_verification_owner_meta.yaml b/mmv1/third_party/terraform/services/siteverification/resource_site_verification_owner_meta.yaml index 2030861c3b26..0f8a2b3448ce 100644 --- a/mmv1/third_party/terraform/services/siteverification/resource_site_verification_owner_meta.yaml +++ b/mmv1/third_party/terraform/services/siteverification/resource_site_verification_owner_meta.yaml @@ -3,6 +3,3 @@ generation_type: 'handwritten' api_service_name: 'siteverification.googleapis.com' api_version: 'v1' api_resource_type_kind: 'WebResource' -fields: - - field: 'email' - - field: 'web_resource_id' diff --git a/mmv1/third_party/terraform/services/spanner/resource_spanner_database_test.go.tmpl b/mmv1/third_party/terraform/services/spanner/resource_spanner_database_test.go.tmpl index 5d438850a80a..c5ba7eecf981 100644 --- a/mmv1/third_party/terraform/services/spanner/resource_spanner_database_test.go.tmpl +++ b/mmv1/third_party/terraform/services/spanner/resource_spanner_database_test.go.tmpl @@ -520,12 +520,10 @@ resource "google_spanner_database" "database" { func TestAccSpannerDatabase_cmek(t *testing.T) { t.Parallel() - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@gcp-sa-spanner.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + // Handle bootstrapping out of band so we don't need beta provider, and for consistency with mrcmek test + if acctest.BootstrapPSARole(t, "service-", "gcp-sa-spanner", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } // Make the keys outside of Terraform so that a) the project isn't littered with a key from each run and b) so that VCR // can work. diff --git a/mmv1/third_party/terraform/services/spanner/resource_spanner_instance_test.go b/mmv1/third_party/terraform/services/spanner/resource_spanner_instance_test.go index 37ce3c4d4913..6643921dd708 100644 --- a/mmv1/third_party/terraform/services/spanner/resource_spanner_instance_test.go +++ b/mmv1/third_party/terraform/services/spanner/resource_spanner_instance_test.go @@ -360,32 +360,6 @@ func TestAccSpannerInstance_basicWithAsymmetricAutoscalingConfigsUpdate(t *testi }) } -func TestAccSpannerInstance_spannerInstanceWithAutoscaling(t *testing.T) { - - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckSpannerInstanceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccSpannerInstance_spannerInstanceWithAutoscaling(context), - }, - { - ResourceName: "google_spanner_instance.example", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"config", "labels", "terraform_labels"}, - }, - }, - }) -} - func testAccSpannerInstance_basic(name string) string { return fmt.Sprintf(` resource "google_spanner_instance" "basic" { @@ -598,30 +572,3 @@ resource "google_spanner_instance" "main" { edition = "ENTERPRISE_PLUS" }`, name, name, minNodes, maxNodes) } - -func testAccSpannerInstance_spannerInstanceWithAutoscaling(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_spanner_instance" "example" { - config = "regional-us-central1" - display_name = "Test Spanner Instance" - autoscaling_config { - autoscaling_limits { - // Define the minimum and maximum compute capacity allocated to the instance - // Either use nodes or processing units to specify the limits, - // but should use the same unit to set both the min_limit and max_limit. - max_processing_units = 3000 // OR max_nodes = 3 - min_processing_units = 2000 // OR min_nodes = 2 - } - autoscaling_targets { - high_priority_cpu_utilization_percent = 75 - storage_utilization_percent = 90 - } - } - edition = "ENTERPRISE" - - labels = { - "foo" = "bar" - } -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/spanner/resource_spanner_schedule_backup_test.go b/mmv1/third_party/terraform/services/spanner/resource_spanner_schedule_backup_test.go index 96310a48fc57..2b263aa5c30d 100644 --- a/mmv1/third_party/terraform/services/spanner/resource_spanner_schedule_backup_test.go +++ b/mmv1/third_party/terraform/services/spanner/resource_spanner_schedule_backup_test.go @@ -42,68 +42,6 @@ func TestAccSpannerBackupSchedule_update(t *testing.T) { }) } -func TestAccSpannerBackupSchedule_CMEKIncrementalBackup(t *testing.T) { - t.Parallel() - suffix := acctest.RandString(t, 10) - kms := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-spanner-key") - - context := map[string]interface{}{ - "random_suffix": suffix, - "key_name": kms.CryptoKey.Name, - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckSpannerBackupScheduleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccSpannerBackupSchedule_CMEKIncremental(context), - }, - { - ResourceName: "google_spanner_backup_schedule.backup_schedule", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func TestAccSpannerBackupSchedule_CMEKFullBackup(t *testing.T) { - t.Parallel() - suffix := acctest.RandString(t, 10) - kms := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-spanner-key") - - context := map[string]interface{}{ - "random_suffix": suffix, - "key_name": kms.CryptoKey.Name, - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckSpannerBackupScheduleDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccSpannerBackupSchedule_basic(context), - }, - { - ResourceName: "google_spanner_backup_schedule.backup_schedule", - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccSpannerBackupSchedule_CMEKFull(context), - }, - { - ResourceName: "google_spanner_backup_schedule.backup_schedule", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccSpannerBackupSchedule_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_spanner_instance" "instance" { @@ -111,7 +49,6 @@ resource "google_spanner_instance" "instance" { config = "regional-us-central1" display_name = "My Instance" num_nodes = 1 - edition = "ENTERPRISE" } resource "google_spanner_database" "database" { @@ -148,7 +85,6 @@ resource "google_spanner_instance" "instance" { config = "regional-us-central1" display_name = "My Instance" num_nodes = 1 - edition = "ENTERPRISE" } resource "google_spanner_database" "database" { @@ -177,90 +113,3 @@ resource "google_spanner_backup_schedule" "backup_schedule" { } `, context) } - -func testAccSpannerBackupSchedule_CMEKIncremental(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_spanner_instance" "instance" { - name = "my-instance-%{random_suffix}" - config = "regional-us-central1" - display_name = "My Instance" - num_nodes = 1 - edition = "ENTERPRISE" -} - -resource "google_spanner_database" "database" { - instance = google_spanner_instance.instance.name - name = "my-database-%{random_suffix}" - ddl = [ - "CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)", - ] - deletion_protection = false - - encryption_config { - kms_key_name = "%{key_name}" - } -} - -resource "google_spanner_backup_schedule" "backup_schedule" { - instance = google_spanner_instance.instance.name - database = google_spanner_database.database.name - name = "my-backup-schedule-%{random_suffix}" - - retention_duration = "172800s" - - spec { - cron_spec { - text = "0 12 * * *" - } - } - - incremental_backup_spec {} - - encryption_config { - encryption_type = "GOOGLE_DEFAULT_ENCRYPTION" - } -} -`, context) -} - -func testAccSpannerBackupSchedule_CMEKFull(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_spanner_instance" "instance" { - name = "my-instance-%{random_suffix}" - config = "regional-us-central1" - display_name = "My Instance" - num_nodes = 1 - edition = "ENTERPRISE" -} - -resource "google_spanner_database" "database" { - instance = google_spanner_instance.instance.name - name = "my-database-%{random_suffix}" - ddl = [ - "CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)", - ] - deletion_protection = false -} - -resource "google_spanner_backup_schedule" "backup_schedule" { - instance = google_spanner_instance.instance.name - database = google_spanner_database.database.name - name = "my-backup-schedule-%{random_suffix}" - - retention_duration = "172800s" - - spec { - cron_spec { - text = "0 12 * * *" - } - } - - full_backup_spec {} - - encryption_config { - encryption_type = "CUSTOMER_MANAGED_ENCRYPTION" - kms_key_name = "%{key_name}" - } -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances.go b/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances.go index 8f48b4a5df94..24e4e30f66f5 100644 --- a/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances.go +++ b/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances.go @@ -153,7 +153,6 @@ func flattenDatasourceGoogleDatabaseInstancesList(fetchedInstances []*sqladmin.D } instance["replica_configuration"] = flattenReplicaConfigurationforDataSource(rawInstance.ReplicaConfiguration) - instance["replication_cluster"] = flattenReplicationClusterForDataSource(rawInstance.ReplicationCluster) ipAddresses := flattenIpAddresses(rawInstance.IpAddresses) instance["ip_address"] = ipAddresses @@ -199,19 +198,3 @@ func flattenReplicaConfigurationforDataSource(replicaConfiguration *sqladmin.Rep return rc } - -// flattenReplicationClusterForDataSource converts cloud SQL backend ReplicationCluster (proto) to -// terraform replication_cluster. We explicitly allow the case when ReplicationCluster -// is nil since replication_cluster is computed+optional. -func flattenReplicationClusterForDataSource(replicationCluster *sqladmin.ReplicationCluster) []map[string]interface{} { - data := make(map[string]interface{}) - data["failover_dr_replica_name"] = "" - if replicationCluster != nil && replicationCluster.FailoverDrReplicaName != "" { - data["failover_dr_replica_name"] = replicationCluster.FailoverDrReplicaName - } - data["dr_replica"] = false - if replicationCluster != nil { - data["dr_replica"] = replicationCluster.DrReplica - } - return []map[string]interface{}{data} -} diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl index c037a4c61f68..1ce97cf50157 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl @@ -925,27 +925,6 @@ is set to true. Defaults to ZONAL.`, }, Description: `The replicas of the instance.`, }, - "replication_cluster": { - Type: schema.TypeList, - Computed: true, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "failover_dr_replica_name": { - Type: schema.TypeString, - Optional: true, - Description: fmt.Sprintf(`If the instance is a primary instance, then this field identifies the disaster recovery (DR) replica. The standard format of this field is "your-project:your-instance". You can also set this field to "your-instance", but cloud SQL backend will convert it to the aforementioned standard format.`), - }, - "dr_replica": { - Type: schema.TypeBool, - Computed: true, - Description: `Read-only field that indicates whether the replica is a DR replica.`, - }, - }, - }, - Description: "A primary instance and disaster recovery replica pair. Applicable to MySQL and PostgreSQL. This field can be set only after both the primary and replica are created.", - }, "server_ca_cert": { Type: schema.TypeList, Computed: true, @@ -1631,7 +1610,7 @@ func expandSqlServerAdvancedMachineFeatures(configured interface{}) *sqladmin.Ad func expandSqlServerAuditConfig(configured interface{}) *sqladmin.SqlServerAuditConfig { l := configured.([]interface{}) - if len(l) == 0 || l[0] == nil{ + if len(l) == 0 { return nil } @@ -1740,11 +1719,6 @@ func resourceSqlDatabaseInstanceRead(d *schema.ResourceData, meta interface{}) e if err := d.Set("replica_names", instance.ReplicaNames); err != nil { return fmt.Errorf("Error setting replica_names: %w", err) } - - // We always set replication_cluster because it is computed+optional. - if err := d.Set("replication_cluster", flattenReplicationCluster(instance.ReplicationCluster, d)); err != nil { - return fmt.Errorf("Error setting replication_cluster: %w", err) - } ipAddresses := flattenIpAddresses(instance.IpAddresses) if err := d.Set("ip_address", ipAddresses); err != nil { log.Printf("[WARN] Failed to set SQL Database Instance IP Addresses") @@ -2007,7 +1981,7 @@ func resourceSqlDatabaseInstanceUpdate(d *schema.ResourceData, meta interface{}) ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.IsSqlOperationInProgressError}, }) if err != nil { - return fmt.Errorf("Error, failed to promote read replica instance as primary stand-alone %s: %s", d.Get("name"), err) + return fmt.Errorf("Error, failed to promote read replica instance as primary stand-alone %s: %s", instance.Name, err) } err = SqlAdminOperationWaitTime(config, op, project, "Promote Instance", userAgent, d.Timeout(schema.TimeoutUpdate)) if err != nil { @@ -2076,13 +2050,6 @@ func resourceSqlDatabaseInstanceUpdate(d *schema.ResourceData, meta interface{}) instance.DatabaseVersion = databaseVersion } - failoverDrReplicaName := d.Get("replication_cluster.0.failover_dr_replica_name").(string) - if failoverDrReplicaName != "" { - instance.ReplicationCluster = &sqladmin.ReplicationCluster{ - FailoverDrReplicaName: failoverDrReplicaName, - } - } - err = transport_tpg.Retry(transport_tpg.RetryOptions{ RetryFunc: func() (rerr error) { op, rerr = config.NewSqlAdminClient(userAgent).Instances.Update(project, d.Get("name").(string), instance).Do() @@ -2410,22 +2377,6 @@ func flattenDatabaseFlags(databaseFlags []*sqladmin.DatabaseFlags) []map[string] return flags } -// flattenReplicationCluster converts cloud SQL backend ReplicationCluster (proto) to -// terraform replication_cluster. We explicitly allow the case when ReplicationCluster -// is nil since replication_cluster is computed+optional. -func flattenReplicationCluster(replicationCluster *sqladmin.ReplicationCluster, d *schema.ResourceData) []map[string]interface{} { - data := make(map[string]interface{}) - data["failover_dr_replica_name"] = "" - if replicationCluster != nil && replicationCluster.FailoverDrReplicaName != "" { - data["failover_dr_replica_name"] = replicationCluster.FailoverDrReplicaName - } - data["dr_replica"] = false - if replicationCluster != nil { - data["dr_replica"] = replicationCluster.DrReplica - } - return []map[string]interface{}{data} -} - func flattenIpConfiguration(ipConfiguration *sqladmin.IpConfiguration, d *schema.ResourceData) interface{} { data := map[string]interface{}{ "ipv4_enabled": ipConfiguration.Ipv4Enabled, @@ -2708,6 +2659,11 @@ func isSwitchoverRequested(d *schema.ResourceData) bool { if !slices.Contains(newReplicaNames.([]interface{}), originalPrimaryName) { return false } + dbVersion := d.Get("database_version") + if !strings.HasPrefix(dbVersion.(string), "SQLSERVER") { + log.Printf("[WARN] Switchover is only supported for SQL Server %q", dbVersion) + return false + } return true } @@ -2725,6 +2681,10 @@ func isReplicaPromoteRequested(_ context.Context, oldInstanceType interface{}, n // Check if this resource change is the manual update done on old primary after a switchover. If true, no replacement is needed. func isSwitchoverFromOldPrimarySide(d *schema.ResourceDiff) bool { dbVersion := d.Get("database_version") + if !strings.HasPrefix(dbVersion.(string), "SQLSERVER") { + log.Printf("[WARN] Switchover is only supported for SQL Server %q", dbVersion) + return false + } oldInstanceType, newInstanceType := d.GetChange("instance_type") oldReplicaNames, newReplicaNames := d.GetChange("replica_names") _, newMasterInstanceName := d.GetChange("master_instance_name") @@ -2739,12 +2699,11 @@ func isSwitchoverFromOldPrimarySide(d *schema.ResourceDiff) bool { newMasterInOldReplicaNames := slices.Contains(oldReplicaNames.([]interface{}), newMasterInstanceName) newMasterNotInNewReplicaNames := !slices.Contains(newReplicaNames.([]interface{}), newMasterInstanceName) isCascadableReplica := cascadableReplicaFieldExists && cascadableReplica.(bool) - isSQLServer := strings.HasPrefix(dbVersion.(string), "SQLSERVER") return newMasterInstanceName != nil && instanceTypeChangedFromPrimaryToReplica && - newMasterInOldReplicaNames && newMasterNotInNewReplicaNames && (!isSQLServer || - isCascadableReplica) + newMasterInOldReplicaNames && newMasterNotInNewReplicaNames && + isCascadableReplica } func checkPromoteConfigurations(d *schema.ResourceData) error { diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_meta.yaml b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_meta.yaml index bcbb45b0ee6d..1bb27fc50f14 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_meta.yaml +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_meta.yaml @@ -2,122 +2,4 @@ resource: 'google_sql_database_instance' generation_type: 'handwritten' api_service_name: 'sqladmin.googleapis.com' api_version: 'v1beta4' -api_resource_type_kind: 'DatabaseInstance' -fields: - - field: 'available_maintenance_versions' - - field: 'clone.allocated_ip_range' - - field: 'clone.database_names' - - field: 'clone.point_in_time' - - field: 'clone.preferred_zone' - - field: 'clone.source_instance_name' - - field: 'connection_name' - - field: 'database_version' - - field: 'deletion_protection' - - field: 'dns_name' - - field: 'encryption_key_name' - - field: 'first_ip_address' - - field: 'instance_type' - - field: 'ip_address.ip_address' - - field: 'ip_address.time_to_retire' - - field: 'ip_address.type' - - field: 'maintenance_version' - - field: 'master_instance_name' - - field: 'name' - - field: 'private_ip_address' - - field: 'project' - - field: 'psc_service_attachment_link' - - field: 'public_ip_address' - - field: 'region' - - field: 'replica_configuration.ca_certificate' - - field: 'replica_configuration.cascadable_replica' - - field: 'replica_configuration.client_certificate' - - field: 'replica_configuration.client_key' - - field: 'replica_configuration.connect_retry_interval' - - field: 'replica_configuration.dump_file_path' - - field: 'replica_configuration.failover_target' - - field: 'replica_configuration.master_heartbeat_period' - - field: 'replica_configuration.password' - - field: 'replica_configuration.ssl_cipher' - - field: 'replica_configuration.username' - - field: 'replica_configuration.verify_server_certificate' - - field: 'replica_names' - - field: 'replication_cluster.dr_replica' - - field: 'replication_cluster.failover_dr_replica_name' - - field: 'restore_backup_context.backup_run_id' - - field: 'restore_backup_context.instance_id' - - field: 'restore_backup_context.project' - - field: 'root_password' - - field: 'self_link' - - field: 'server_ca_cert.cert' - - field: 'server_ca_cert.common_name' - - field: 'server_ca_cert.create_time' - - field: 'server_ca_cert.expiration_time' - - field: 'server_ca_cert.sha1_fingerprint' - - field: 'service_account_email_address' - - field: 'settings.activation_policy' - - field: 'settings.active_directory_config.domain' - - field: 'settings.advanced_machine_features.threads_per_core' - - field: 'settings.availability_type' - - field: 'settings.backup_configuration.backup_retention_settings.retained_backups' - - field: 'settings.backup_configuration.backup_retention_settings.retention_unit' - - field: 'settings.backup_configuration.binary_log_enabled' - - field: 'settings.backup_configuration.enabled' - - field: 'settings.backup_configuration.location' - - field: 'settings.backup_configuration.point_in_time_recovery_enabled' - - field: 'settings.backup_configuration.start_time' - - field: 'settings.backup_configuration.transaction_log_retention_days' - - field: 'settings.collation' - - field: 'settings.connector_enforcement' - - field: 'settings.data_cache_config.data_cache_enabled' - - field: 'settings.database_flags.name' - - field: 'settings.database_flags.value' - - field: 'settings.deletion_protection_enabled' - - field: 'settings.deny_maintenance_period.end_date' - - field: 'settings.deny_maintenance_period.start_date' - - field: 'settings.deny_maintenance_period.time' - - field: 'settings.disk_autoresize' - - field: 'settings.disk_autoresize_limit' - - field: 'settings.disk_size' - - field: 'settings.disk_type' - - field: 'settings.edition' - - field: 'settings.enable_dataplex_integration' - - field: 'settings.enable_google_ml_integration' - - field: 'settings.insights_config.query_insights_enabled' - - field: 'settings.insights_config.query_plans_per_minute' - - field: 'settings.insights_config.query_string_length' - - field: 'settings.insights_config.record_application_tags' - - field: 'settings.insights_config.record_client_address' - - field: 'settings.ip_configuration.allocated_ip_range' - - field: 'settings.ip_configuration.authorized_networks.expiration_time' - - field: 'settings.ip_configuration.authorized_networks.name' - - field: 'settings.ip_configuration.authorized_networks.value' - - field: 'settings.ip_configuration.enable_private_path_for_google_cloud_services' - - field: 'settings.ip_configuration.ipv4_enabled' - - field: 'settings.ip_configuration.private_network' - - field: 'settings.ip_configuration.psc_config.allowed_consumer_projects' - - field: 'settings.ip_configuration.psc_config.psc_auto_connections.consumer_network' - - field: 'settings.ip_configuration.psc_config.psc_auto_connections.consumer_service_project_id' - - field: 'settings.ip_configuration.psc_config.psc_enabled' - - field: 'settings.ip_configuration.server_ca_mode' - - field: 'settings.ip_configuration.server_ca_pool' - - field: 'settings.ip_configuration.ssl_mode' - - field: 'settings.location_preference.follow_gae_application' - - field: 'settings.location_preference.secondary_zone' - - field: 'settings.location_preference.zone' - - field: 'settings.maintenance_window.day' - - field: 'settings.maintenance_window.hour' - - field: 'settings.maintenance_window.update_track' - - field: 'settings.password_validation_policy.complexity' - - field: 'settings.password_validation_policy.disallow_username_substring' - - field: 'settings.password_validation_policy.enable_password_policy' - - field: 'settings.password_validation_policy.min_length' - - field: 'settings.password_validation_policy.password_change_interval' - - field: 'settings.password_validation_policy.reuse_interval' - - field: 'settings.pricing_plan' - - field: 'settings.sql_server_audit_config.bucket' - - field: 'settings.sql_server_audit_config.retention_interval' - - field: 'settings.sql_server_audit_config.upload_interval' - - field: 'settings.tier' - - field: 'settings.time_zone' - - field: 'settings.user_labels' - - field: 'settings.version' +api_resource_type_kind: 'Instance' diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go index bf7966e1a1e2..52e84b781316 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go @@ -973,7 +973,7 @@ func TestAccSqlDatabaseInstance_withPSCEnabled_withoutPscAutoConnections(t *test func TestAccSqlDatabaseInstance_withPSCEnabled_withPscAutoConnections(t *testing.T) { t.Parallel() - testId := "test-psc-auto-con-1" + testId := "test-psc-auto-con" + acctest.RandString(t, 10) instanceName := "tf-test-" + acctest.RandString(t, 10) projectId := envvar.GetTestProjectFromEnv() networkName := acctest.BootstrapSharedTestNetwork(t, testId) @@ -1002,7 +1002,7 @@ func TestAccSqlDatabaseInstance_withPSCEnabled_withPscAutoConnections(t *testing func TestAccSqlDatabaseInstance_withPSCEnabled_thenAddPscAutoConnections_thenRemovePscAutoConnections(t *testing.T) { t.Parallel() - testId := "test-psc-auto-con-2" + testId := "test-psc-auto-con" + acctest.RandString(t, 10) instanceName := "tf-test-" + acctest.RandString(t, 10) projectId := envvar.GetTestProjectFromEnv() networkName := acctest.BootstrapSharedTestNetwork(t, testId) @@ -2583,158 +2583,6 @@ func TestAccSqlDatabaseInstance_SwitchoverSuccess(t *testing.T) { }) } -// Switchover for MySQL. -func TestAccSqlDatabaseInstance_MysqlSwitchoverSuccess(t *testing.T) { - t.Parallel() - primaryName := "tf-test-mysql-sw-primary-" + acctest.RandString(t, 10) - replicaName := "tf-test-mysql-sw-replica-" + acctest.RandString(t, 10) - project := envvar.GetTestProjectFromEnv() - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testGoogleSqlDatabaseInstanceConfig_mysqlEplusWithReplica(project, primaryName, replicaName), - }, - { - ResourceName: "google_sql_database_instance.original-primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: ignoredReplicaConfigurationFields, - }, - { - ResourceName: "google_sql_database_instance.original-replica", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: ignoredReplicaConfigurationFields, - }, - // Let's make sure that setting and unsetting failover replica works. - { - Config: googleSqlDatabaseInstance_mysqlSetFailoverReplica(project, primaryName, replicaName), - }, - { - Config: googleSqlDatabaseInstance_mysqlUnsetFailoverReplica(project, primaryName, replicaName), - }, - { - Config: googleSqlDatabaseInstance_mysqlSetFailoverReplica(project, primaryName, replicaName), - }, - { - // Split into two configs because current TestStep implementation checks diff before refreshing. - Config: googleSqlDatabaseInstance_mysqlSwitchoverOnReplica(project, primaryName, replicaName), - // Original primary needs to be updated at the next step. - ExpectNonEmptyPlan: true, - }, - { - Config: googleSqlDatabaseInstance_mysqlUpdatePrimaryAfterSwitchover(project, primaryName, replicaName), - }, - { - RefreshState: true, - Check: resource.ComposeTestCheckFunc(resource.TestCheckTypeSetElemAttr("google_sql_database_instance.original-replica", "replica_names.*", primaryName), checkSwitchoverOriginalReplicaConfigurations("google_sql_database_instance.original-replica"), checkSwitchoverOriginalPrimaryConfigurations("google_sql_database_instance.original-primary", replicaName)), - }, - { - ResourceName: "google_sql_database_instance.original-primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: ignoredReplicaConfigurationFields, - }, - { - ResourceName: "google_sql_database_instance.original-replica", - ImportState: true, - ImportStateVerify: true, - // original-replica is no longer a replica, but replica_configuration is O + C and cannot be unset - ImportStateVerifyIgnore: []string{"replica_configuration", "deletion_protection", "root_password"}, - }, - { - // Delete replica first so PostTestDestroy doesn't fail when deleting instances which have replicas. We've already validated switchover behavior, the remaining steps are cleanup - Config: googleSqlDatabaseInstance_mysqlDeleteReplicasAfterSwitchover(project, primaryName, replicaName), - // We delete replica, but haven't updated the master's replica_names - ExpectNonEmptyPlan: true, - }, - { - // Remove replica from primary's resource - Config: googleSqlDatabaseInstance_mysqlRemoveReplicaFromPrimaryAfterSwitchover(project, replicaName), - }, - }, - }) -} - -// Switchover for PostgreSQL. -func TestAccSqlDatabaseInstance_PostgresSwitchoverSuccess(t *testing.T) { - t.Parallel() - primaryName := "tf-test-pg-sw-primary-" + acctest.RandString(t, 10) - replicaName := "tf-test-pg-sw-replica-" + acctest.RandString(t, 10) - project := envvar.GetTestProjectFromEnv() - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testGoogleSqlDatabaseInstanceConfig_postgresEplusWithReplica(project, primaryName, replicaName), - }, - { - ResourceName: "google_sql_database_instance.original-primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: ignoredReplicaConfigurationFields, - }, - { - ResourceName: "google_sql_database_instance.original-replica", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: ignoredReplicaConfigurationFields, - }, - // Let's make sure that setting and unsetting failover replica works. - { - Config: googleSqlDatabaseInstance_postgresSetFailoverReplica(project, primaryName, replicaName), - }, - { - Config: googleSqlDatabaseInstance_postgresUnsetFailoverReplica(project, primaryName, replicaName), - }, - { - Config: googleSqlDatabaseInstance_postgresSetFailoverReplica(project, primaryName, replicaName), - }, - { - // Split into two configs because current TestStep implementation checks diff before refreshing. - Config: googleSqlDatabaseInstance_postgresSwitchoverOnReplica(project, primaryName, replicaName), - // Original primary needs to be updated at the next step. - ExpectNonEmptyPlan: true, - }, - { - Config: googleSqlDatabaseInstance_postgresUpdatePrimaryAfterSwitchover(project, primaryName, replicaName), - }, - { - RefreshState: true, - Check: resource.ComposeTestCheckFunc(resource.TestCheckTypeSetElemAttr("google_sql_database_instance.original-replica", "replica_names.*", primaryName), checkSwitchoverOriginalReplicaConfigurations("google_sql_database_instance.original-replica"), checkSwitchoverOriginalPrimaryConfigurations("google_sql_database_instance.original-primary", replicaName)), - }, - { - ResourceName: "google_sql_database_instance.original-primary", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: ignoredReplicaConfigurationFields, - }, - { - ResourceName: "google_sql_database_instance.original-replica", - ImportState: true, - ImportStateVerify: true, - // original-replica is no longer a replica, but replica_configuration is O + C and cannot be unset - ImportStateVerifyIgnore: []string{"replica_configuration", "deletion_protection", "root_password"}, - }, - { - // Delete replica first so PostTestDestroy doesn't fail when deleting instances which have replicas. We've already validated switchover behavior, the remaining steps are cleanup - Config: googleSqlDatabaseInstance_postgresDeleteReplicasAfterSwitchover(project, primaryName, replicaName), - // We delete replica, but haven't updated the master's replica_names - ExpectNonEmptyPlan: true, - }, - { - // Remove replica from primary's resource - Config: googleSqlDatabaseInstance_postgresRemoveReplicaFromPrimaryAfterSwitchover(project, replicaName), - }, - }, - }) -} - func TestAccSqlDatabaseInstance_updateSslOptionsForPostgreSQL(t *testing.T) { t.Parallel() @@ -3620,554 +3468,6 @@ resource "google_sql_database_instance" "original-replica" { `, replicaName) } -func testGoogleSqlDatabaseInstanceConfig_mysqlEplusWithReplica(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - deletion_protection = false - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = google_sql_database_instance.original-primary.name - deletion_protection = false - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } -} -`, project, primaryName, project, replicaName) -} - -func googleSqlDatabaseInstance_mysqlSetFailoverReplica(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = "%s" - deletion_protection = false - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } -} -`, project, primaryName, project, replicaName, project, replicaName, primaryName) -} - -func googleSqlDatabaseInstance_mysqlUnsetFailoverReplica(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = "%s" - deletion_protection = false - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } -} -`, project, primaryName, project, replicaName, primaryName) -} - -func googleSqlDatabaseInstance_mysqlSwitchoverOnReplica(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = ["%s"] - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} -`, project, primaryName, project, replicaName, project, replicaName, primaryName, project, primaryName) -} - -func googleSqlDatabaseInstance_mysqlUpdatePrimaryAfterSwitchover(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "MYSQL_8_0" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = "%s" - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = false - binary_log_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = ["%s"] - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} -`, project, primaryName, replicaName, project, replicaName, primaryName, project, primaryName) -} - -// After a switchover, the original-primary is now the replica and must be removed first. -func googleSqlDatabaseInstance_mysqlDeleteReplicasAfterSwitchover(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = ["%s"] - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} -`, project, replicaName, primaryName, project, primaryName) -} - -// Update original-replica replica_names after deleting original-primary -func googleSqlDatabaseInstance_mysqlRemoveReplicaFromPrimaryAfterSwitchover(project, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = [] - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} -`, project, replicaName) -} - -func testGoogleSqlDatabaseInstanceConfig_postgresEplusWithReplica(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - deletion_protection = false - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = google_sql_database_instance.original-primary.name - deletion_protection = false - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } -} -`, project, primaryName, project, replicaName) -} - -func googleSqlDatabaseInstance_postgresSetFailoverReplica(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = "%s" - deletion_protection = false - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } -} -`, project, primaryName, project, replicaName, project, replicaName, primaryName) -} - -func googleSqlDatabaseInstance_postgresUnsetFailoverReplica(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = "%s" - deletion_protection = false - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } -} -`, project, primaryName, project, replicaName, primaryName) -} - -func googleSqlDatabaseInstance_postgresSwitchoverOnReplica(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = ["%s"] - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} -`, project, primaryName, project, replicaName, project, replicaName, primaryName, project, primaryName) -} - -func googleSqlDatabaseInstance_postgresUpdatePrimaryAfterSwitchover(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-primary" { - project = "%s" - name = "%s" - region = "us-east1" - database_version = "POSTGRES_12" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = "%s" - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = false - point_in_time_recovery_enabled = false - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = ["%s"] - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} -`, project, primaryName, replicaName, project, replicaName, primaryName, project, primaryName) -} - -// After a switchover, the original-primary is now the replica and must be removed first. -func googleSqlDatabaseInstance_postgresDeleteReplicasAfterSwitchover(project, primaryName, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = ["%s"] - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "%s:%s" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} -`, project, replicaName, primaryName, project, primaryName) -} - -// Update original-replica replica_names after deleting original-primary -func googleSqlDatabaseInstance_postgresRemoveReplicaFromPrimaryAfterSwitchover(project, replicaName string) string { - return fmt.Sprintf(` -resource "google_sql_database_instance" "original-replica" { - project = "%s" - name = "%s" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = [] - deletion_protection = false - - replication_cluster { - failover_dr_replica_name = "" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} -`, project, replicaName) -} - func testAccSqlDatabaseInstance_basicInstanceForPsc(instanceName string, projectId string, orgId string, billingAccount string) string { return fmt.Sprintf(` resource "google_project" "testproject" { diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_ssl_cert_meta.yaml b/mmv1/third_party/terraform/services/sql/resource_sql_ssl_cert_meta.yaml index d3300d017576..1723d2c37b62 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_ssl_cert_meta.yaml +++ b/mmv1/third_party/terraform/services/sql/resource_sql_ssl_cert_meta.yaml @@ -3,14 +3,3 @@ generation_type: 'handwritten' api_service_name: 'sqladmin.googleapis.com' api_version: 'v1beta4' api_resource_type_kind: 'SslCert' -fields: - - field: 'cert' - - field: 'cert_serial_number' - - field: 'common_name' - - field: 'create_time' - - field: 'expiration_time' - - field: 'instance' - - field: 'private_key' - - field: 'project' - - field: 'server_ca_cert' - - field: 'sha1_fingerprint' diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_user_meta.yaml b/mmv1/third_party/terraform/services/sql/resource_sql_user_meta.yaml index 68c932caf8d0..e70e60cadfe8 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_user_meta.yaml +++ b/mmv1/third_party/terraform/services/sql/resource_sql_user_meta.yaml @@ -3,19 +3,3 @@ generation_type: 'handwritten' api_service_name: 'sqladmin.googleapis.com' api_version: 'v1beta4' api_resource_type_kind: 'User' -fields: - - field: 'deletion_policy' - - field: 'host' - - field: 'instance' - - field: 'name' - - field: 'password' - - field: 'password_policy.allowed_failed_attempts' - - field: 'password_policy.enable_failed_attempts_check' - - field: 'password_policy.enable_password_verification' - - field: 'password_policy.password_expiration_duration' - - field: 'password_policy.status.locked' - - field: 'password_policy.status.password_expiration_time' - - field: 'project' - - field: 'sql_server_user_details.disabled' - - field: 'sql_server_user_details.server_roles' - - field: 'type' diff --git a/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content.go b/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content.go index b7b51f44dcaa..af56c3c89295 100644 --- a/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content.go +++ b/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content.go @@ -18,9 +18,7 @@ func DataSourceGoogleStorageBucketObjectContent() *schema.Resource { tpgresource.AddRequiredFieldsToSchema(dsSchema, "bucket") tpgresource.AddRequiredFieldsToSchema(dsSchema, "name") - - // The field must be optional for backward compatibility. - dsSchema["content"].Optional = true + tpgresource.AddOptionalFieldsToSchema(dsSchema, "content") return &schema.Resource{ Read: dataSourceGoogleStorageBucketObjectContentRead, diff --git a/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content_test.go b/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content_test.go index 6debefc53827..ec3f170655d8 100644 --- a/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content_test.go +++ b/mmv1/third_party/terraform/services/storage/data_source_storage_bucket_object_content_test.go @@ -47,59 +47,3 @@ resource "google_storage_bucket" "contenttest" { force_destroy = true }`, content, bucket) } - -func TestAccDataSourceStorageBucketObjectContent_Issue15717(t *testing.T) { - - bucket := "tf-bucket-object-content-" + acctest.RandString(t, 10) - content := "qwertyuioasdfghjk1234567!!@#$*" - - config := fmt.Sprintf(` -%s - -output "output" { - value = replace(data.google_storage_bucket_object_content.default.content, "q", "Q") -}`, testAccDataSourceStorageBucketObjectContent_Basic(content, bucket)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: config, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.google_storage_bucket_object_content.default", "content"), - resource.TestCheckResourceAttr("data.google_storage_bucket_object_content.default", "content", content), - ), - }, - }, - }) -} - -func TestAccDataSourceStorageBucketObjectContent_Issue15717BackwardCompatibility(t *testing.T) { - - bucket := "tf-bucket-object-content-" + acctest.RandString(t, 10) - content := "qwertyuioasdfghjk1234567!!@#$*" - - config := fmt.Sprintf(` -%s - -data "google_storage_bucket_object_content" "new" { - bucket = google_storage_bucket.contenttest.name - content = "%s" - name = google_storage_bucket_object.object.name -}`, testAccDataSourceStorageBucketObjectContent_Basic(content, bucket), content) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: config, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.google_storage_bucket_object_content.new", "content"), - resource.TestCheckResourceAttr("data.google_storage_bucket_object_content.new", "content", content), - ), - }, - }, - }) -} diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_acl_meta.yaml b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_acl_meta.yaml index 3e08e3339b17..4a8a1aa4171a 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_acl_meta.yaml +++ b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_acl_meta.yaml @@ -3,8 +3,3 @@ generation_type: 'handwritten' api_service_name: 'storage.googleapis.com' api_version: 'v1' api_resource_type_kind: 'BucketAccessControl' -fields: - - field: 'bucket' - - field: 'default_acl' - - field: 'predefined_acl' - - field: 'role_entity' diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_meta.yaml b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_meta.yaml index 6a27fa7a5f1f..f86d83bc8b1d 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_meta.yaml +++ b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_meta.yaml @@ -3,58 +3,3 @@ generation_type: 'handwritten' api_service_name: 'storage.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Bucket' -fields: - - field: 'autoclass.enabled' - - field: 'autoclass.terminal_storage_class' - - field: 'cors.max_age_seconds' - - field: 'cors.method' - - field: 'cors.origin' - - field: 'cors.response_header' - - field: 'custom_placement_config.data_locations' - - field: 'default_event_based_hold' - - field: 'effective_labels' - provider_only: true - - field: 'enable_object_retention' - - field: 'encryption.default_kms_key_name' - - field: 'force_destroy' - - field: 'hierarchical_namespace.enabled' - - field: 'labels' - - field: 'lifecycle_rule.action.storage_class' - - field: 'lifecycle_rule.action.type' - - field: 'lifecycle_rule.condition.age' - - field: 'lifecycle_rule.condition.created_before' - - field: 'lifecycle_rule.condition.custom_time_before' - - field: 'lifecycle_rule.condition.days_since_custom_time' - - field: 'lifecycle_rule.condition.days_since_noncurrent_time' - - field: 'lifecycle_rule.condition.matches_prefix' - - field: 'lifecycle_rule.condition.matches_storage_class' - - field: 'lifecycle_rule.condition.matches_suffix' - - field: 'lifecycle_rule.condition.noncurrent_time_before' - - field: 'lifecycle_rule.condition.num_newer_versions' - - field: 'lifecycle_rule.condition.send_age_if_zero' - - field: 'lifecycle_rule.condition.send_days_since_custom_time_if_zero' - - field: 'lifecycle_rule.condition.send_days_since_noncurrent_time_if_zero' - - field: 'lifecycle_rule.condition.send_num_newer_versions_if_zero' - - field: 'lifecycle_rule.condition.with_state' - - field: 'location' - - field: 'logging.log_bucket' - - field: 'logging.log_object_prefix' - - field: 'name' - - field: 'project' - - field: 'project_number' - - field: 'public_access_prevention' - - field: 'requester_pays' - - field: 'retention_policy.is_locked' - - field: 'retention_policy.retention_period' - - field: 'rpo' - - field: 'self_link' - - field: 'soft_delete_policy.effective_time' - - field: 'soft_delete_policy.retention_duration_seconds' - - field: 'storage_class' - - field: 'terraform_labels' - provider_only: true - - field: 'uniform_bucket_level_access' - - field: 'url' - - field: 'versioning.enabled' - - field: 'website.main_page_suffix' - - field: 'website.not_found_page' diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object_meta.yaml b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object_meta.yaml index 403af44524b8..2c69c0c14139 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object_meta.yaml +++ b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object_meta.yaml @@ -3,29 +3,3 @@ generation_type: 'handwritten' api_service_name: 'storage.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Object' -fields: - - field: 'bucket' - - field: 'cache_control' - - field: 'content' - - field: 'content_disposition' - - field: 'content_encoding' - - field: 'content_language' - - field: 'content_type' - - field: 'crc32c' - - field: 'customer_encryption.encryption_algorithm' - - field: 'customer_encryption.encryption_key' - - field: 'detect_md5hash' - - field: 'event_based_hold' - - field: 'generation' - - field: 'kms_key_name' - - field: 'md5hash' - - field: 'media_link' - - field: 'metadata' - - field: 'name' - - field: 'output_name' - - field: 'retention.mode' - - field: 'retention.retain_until_time' - - field: 'self_link' - - field: 'source' - - field: 'storage_class' - - field: 'temporary_hold' diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_default_object_acl_meta.yaml b/mmv1/third_party/terraform/services/storage/resource_storage_default_object_acl_meta.yaml index a76369719824..6572312da7b2 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_default_object_acl_meta.yaml +++ b/mmv1/third_party/terraform/services/storage/resource_storage_default_object_acl_meta.yaml @@ -3,6 +3,3 @@ generation_type: 'handwritten' api_service_name: 'storage.googleapis.com' api_version: 'v1' api_resource_type_kind: 'ObjectAccessControl' -fields: - - field: 'bucket' - - field: 'role_entity' diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_notification_meta.yaml b/mmv1/third_party/terraform/services/storage/resource_storage_notification_meta.yaml index c9ffe4041ed5..d06f98fcd331 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_notification_meta.yaml +++ b/mmv1/third_party/terraform/services/storage/resource_storage_notification_meta.yaml @@ -3,12 +3,3 @@ generation_type: 'handwritten' api_service_name: 'storage.googleapis.com' api_version: 'v1' api_resource_type_kind: 'NotificationConfig' -fields: - - field: 'bucket' - - field: 'custom_attributes' - - field: 'event_types' - - field: 'notification_id' - - field: 'object_name_prefix' - - field: 'payload_format' - - field: 'self_link' - - field: 'topic' diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_object_acl_meta.yaml b/mmv1/third_party/terraform/services/storage/resource_storage_object_acl_meta.yaml index 1571519d6ef1..2dd0a823b055 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_object_acl_meta.yaml +++ b/mmv1/third_party/terraform/services/storage/resource_storage_object_acl_meta.yaml @@ -3,8 +3,3 @@ generation_type: 'handwritten' api_service_name: 'storage.googleapis.com' api_version: 'v1' api_resource_type_kind: 'ObjectAccessControl' -fields: - - field: 'bucket' - - field: 'object' - - field: 'predefined_acl' - - field: 'role_entity' diff --git a/mmv1/third_party/terraform/services/storage/storage_operation.go b/mmv1/third_party/terraform/services/storage/storage_operation.go deleted file mode 100644 index 9cdc840b0c99..000000000000 --- a/mmv1/third_party/terraform/services/storage/storage_operation.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package storage - -import ( - "encoding/json" - "errors" - "fmt" - "time" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -type StorageOperationWaiter struct { - Config *transport_tpg.Config - UserAgent string - SelfLink string - tpgresource.CommonOperationWaiter -} - -func (w *StorageOperationWaiter) QueryOp() (interface{}, error) { - if w == nil { - return nil, fmt.Errorf("Cannot query operation, it's unset or nil.") - } - // Returns the proper get. - url := fmt.Sprintf(w.SelfLink) - - return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: w.Config, - Method: "GET", - RawURL: url, - UserAgent: w.UserAgent, - }) -} - -func createStorageWaiter(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string) (*StorageOperationWaiter, error) { - val, ok := op["selfLink"].(string) - if !ok { - return nil, fmt.Errorf("Unable to parse selfLink from LRO metadata") - } - w := &StorageOperationWaiter{ - Config: config, - UserAgent: userAgent, - SelfLink: val, - } - if err := w.CommonOperationWaiter.SetOp(op); err != nil { - return nil, err - } - return w, nil -} - -// nolint: deadcode,unused -func StorageOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, activity, userAgent string, timeout time.Duration) error { - w, err := createStorageWaiter(config, op, activity, userAgent) - if err != nil { - return err - } - if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil { - return err - } - rawResponse := []byte(w.CommonOperationWaiter.Op.Response) - if len(rawResponse) == 0 { - return errors.New("`resource` not set in operation response") - } - return json.Unmarshal(rawResponse, response) -} - -func StorageOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string, timeout time.Duration) error { - if val, ok := op["name"]; !ok || val == "" { - // This was a synchronous call - there is no operation to wait for. - return nil - } - w, err := createStorageWaiter(config, op, activity, userAgent) - if err != nil { - // If w is nil, the op was synchronous. - return err - } - return tpgresource.OperationWait(w, activity, timeout, config.PollInterval) -} diff --git a/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_meta.yaml b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_meta.yaml new file mode 100644 index 000000000000..e7e13025224d --- /dev/null +++ b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_storage_transfer_job' +generation_type: 'handwritten' +api_service_name: 'storagetransfer.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'TransferJob' diff --git a/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_meta.yaml.tmpl b/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_meta.yaml.tmpl deleted file mode 100644 index 08c6990098ee..000000000000 --- a/mmv1/third_party/terraform/services/storagetransfer/resource_storage_transfer_job_meta.yaml.tmpl +++ /dev/null @@ -1,76 +0,0 @@ -resource: 'google_storage_transfer_job' -generation_type: 'handwritten' -api_service_name: 'storagetransfer.googleapis.com' -api_version: 'v1' -api_resource_type_kind: 'TransferJob' -fields: - - field: 'creation_time' - - field: 'deletion_time' - - field: 'description' - - field: 'event_stream.event_stream_expiration_time' - - field: 'event_stream.event_stream_start_time' - - field: 'event_stream.name' - - field: 'last_modification_time' - - field: 'name' - - field: 'notification_config.event_types' - - field: 'notification_config.payload_format' - - field: 'notification_config.pubsub_topic' - - field: 'project' - - field: 'replication_spec.gcs_data_sink.bucket_name' - - field: 'replication_spec.gcs_data_sink.path' - - field: 'replication_spec.gcs_data_source.bucket_name' - - field: 'replication_spec.gcs_data_source.path' - - field: 'replication_spec.object_conditions.exclude_prefixes' - - field: 'replication_spec.object_conditions.include_prefixes' - - field: 'replication_spec.object_conditions.last_modified_before' - - field: 'replication_spec.object_conditions.last_modified_since' - - field: 'replication_spec.object_conditions.max_time_elapsed_since_last_modification' - - field: 'replication_spec.object_conditions.min_time_elapsed_since_last_modification' - - field: 'replication_spec.transfer_options.delete_objects_from_source_after_transfer' - - field: 'replication_spec.transfer_options.delete_objects_unique_in_sink' - - field: 'replication_spec.transfer_options.overwrite_objects_already_existing_in_sink' - - field: 'replication_spec.transfer_options.overwrite_when' - - field: 'schedule.repeat_interval' - - field: 'schedule.schedule_end_date.day' - - field: 'schedule.schedule_end_date.month' - - field: 'schedule.schedule_end_date.year' - - field: 'schedule.schedule_start_date.day' - - field: 'schedule.schedule_start_date.month' - - field: 'schedule.schedule_start_date.year' - - field: 'schedule.start_time_of_day.hours' - - field: 'schedule.start_time_of_day.minutes' - - field: 'schedule.start_time_of_day.nanos' - - field: 'schedule.start_time_of_day.seconds' - - field: 'status' - - field: 'transfer_spec.aws_s3_data_source.aws_access_key.access_key_id' - - field: 'transfer_spec.aws_s3_data_source.aws_access_key.secret_access_key' - - field: 'transfer_spec.aws_s3_data_source.bucket_name' - - field: 'transfer_spec.aws_s3_data_source.path' - - field: 'transfer_spec.aws_s3_data_source.role_arn' - - field: 'transfer_spec.azure_blob_storage_data_source.azure_credentials.sas_token' - - field: 'transfer_spec.azure_blob_storage_data_source.container' -{{- if ne $.TargetVersionName "ga" }} - - field: 'transfer_spec.azure_blob_storage_data_source.credentials_secret' -{{- end }} - - field: 'transfer_spec.azure_blob_storage_data_source.path' - - field: 'transfer_spec.azure_blob_storage_data_source.storage_account' - - field: 'transfer_spec.gcs_data_sink.bucket_name' - - field: 'transfer_spec.gcs_data_sink.path' - - field: 'transfer_spec.gcs_data_source.bucket_name' - - field: 'transfer_spec.gcs_data_source.path' - - field: 'transfer_spec.hdfs_data_source.path' - - field: 'transfer_spec.http_data_source.list_url' - - field: 'transfer_spec.object_conditions.exclude_prefixes' - - field: 'transfer_spec.object_conditions.include_prefixes' - - field: 'transfer_spec.object_conditions.last_modified_before' - - field: 'transfer_spec.object_conditions.last_modified_since' - - field: 'transfer_spec.object_conditions.max_time_elapsed_since_last_modification' - - field: 'transfer_spec.object_conditions.min_time_elapsed_since_last_modification' - - field: 'transfer_spec.posix_data_sink.root_directory' - - field: 'transfer_spec.posix_data_source.root_directory' - - field: 'transfer_spec.sink_agent_pool_name' - - field: 'transfer_spec.source_agent_pool_name' - - field: 'transfer_spec.transfer_options.delete_objects_from_source_after_transfer' - - field: 'transfer_spec.transfer_options.delete_objects_unique_in_sink' - - field: 'transfer_spec.transfer_options.overwrite_objects_already_existing_in_sink' - - field: 'transfer_spec.transfer_options.overwrite_when' diff --git a/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_binding_meta.yaml b/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_binding_meta.yaml index 922547337d1d..b54d7fe1a0e2 100644 --- a/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_binding_meta.yaml +++ b/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_binding_meta.yaml @@ -3,8 +3,3 @@ generation_type: 'handwritten' api_service_name: 'cloudresourcemanager.googleapis.com' api_version: 'v3' api_resource_type_kind: 'TagBinding' -fields: - - field: 'location' - - field: 'name' - - field: 'parent' - - field: 'tag_value' diff --git a/mmv1/third_party/terraform/services/vmwareengine/data_source_google_vmwareengine_network_peering_test.go b/mmv1/third_party/terraform/services/vmwareengine/data_source_google_vmwareengine_network_peering_test.go new file mode 100644 index 000000000000..b96b3be603ab --- /dev/null +++ b/mmv1/third_party/terraform/services/vmwareengine/data_source_google_vmwareengine_network_peering_test.go @@ -0,0 +1,100 @@ +package vmwareengine_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccDataSourceVmwareengineNetworkPeering_basic(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + "org_id": envvar.GetTestOrgFromEnv(t), + "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": {}, + }, + CheckDestroy: testAccCheckVmwareengineNetworkPeeringDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccVmwareengineNetworkPeering_ds(context), + Check: resource.ComposeTestCheckFunc( + acctest.CheckDataSourceStateMatchesResourceStateWithIgnores("data.google_vmwareengine_network_peering.ds", "google_vmwareengine_network_peering.vmw-engine-network-peering", map[string]struct{}{}), + ), + }, + }, + }) +} + +func testAccVmwareengineNetworkPeering_ds(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_project" "project" { + project_id = "tf-test%{random_suffix}" + name = "tf-test%{random_suffix}" + org_id = "%{org_id}" + billing_account = "%{billing_account}" + deletion_policy = "DELETE" +} + +resource "google_project_service" "vmwareengine" { + project = google_project.project.project_id + service = "vmwareengine.googleapis.com" +} + +resource "time_sleep" "sleep" { + create_duration = "1m" + depends_on = [ + google_project_service.vmwareengine, + ] +} + +resource "google_vmwareengine_network" "network-peering-nw" { + project = google_project.project.project_id + name = "tf-test-sample-nw%{random_suffix}" + location = "global" + type = "STANDARD" + + depends_on = [ + time_sleep.sleep # Sleep allows permissions in the new project to propagate + ] +} + +resource "google_vmwareengine_network" "network-peering-peer-nw" { + project = google_project.project.project_id + name = "tf-test-peer-nw%{random_suffix}" + location = "global" + type = "STANDARD" + + depends_on = [ + time_sleep.sleep # Sleep allows permissions in the new project to propagate + ] +} + +resource "google_vmwareengine_network_peering" "vmw-engine-network-peering" { + project = google_project.project.project_id + name = "tf-test-sample-network-peering%{random_suffix}" + description = "Sample description" + vmware_engine_network = google_vmwareengine_network.network-peering-nw.id + peer_network = google_vmwareengine_network.network-peering-peer-nw.id + peer_network_type = "VMWARE_ENGINE_NETWORK" + + depends_on = [ + time_sleep.sleep # Sleep allows permissions in the new project to propagate + ] +} + +data "google_vmwareengine_network_peering" "ds" { + project = google_project.project.project_id + name = google_vmwareengine_network_peering.vmw-engine-network-peering.name +} +`, context) +} diff --git a/mmv1/third_party/terraform/services/vmwareengine/data_source_google_vmwareengine_network_policy_test.go b/mmv1/third_party/terraform/services/vmwareengine/data_source_google_vmwareengine_network_policy_test.go new file mode 100644 index 000000000000..5bf2f8114544 --- /dev/null +++ b/mmv1/third_party/terraform/services/vmwareengine/data_source_google_vmwareengine_network_policy_test.go @@ -0,0 +1,101 @@ +package vmwareengine_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccDataSourceVmwareengineNetworkPolicy_basic(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "region": envvar.GetTestRegionFromEnv(), + "random_suffix": acctest.RandString(t, 10), + "org_id": envvar.GetTestOrgFromEnv(t), + "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": {}, + }, + CheckDestroy: testAccCheckVmwareengineNetworkPolicyDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccVmwareengineNetworkPolicy_ds(context), + Check: resource.ComposeTestCheckFunc( + acctest.CheckDataSourceStateMatchesResourceStateWithIgnores("data.google_vmwareengine_network_policy.ds", "google_vmwareengine_network_policy.vmw-engine-network-policy", map[string]struct{}{}), + ), + }, + }, + }) +} + +func testAccVmwareengineNetworkPolicy_ds(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_project" "project" { + project_id = "tf-test%{random_suffix}" + name = "tf-test%{random_suffix}" + org_id = "%{org_id}" + billing_account = "%{billing_account}" + deletion_policy = "DELETE" +} + +resource "google_project_service" "vmwareengine" { + project = google_project.project.project_id + service = "vmwareengine.googleapis.com" +} + +resource "time_sleep" "sleep" { + create_duration = "1m" + depends_on = [ + google_project_service.vmwareengine, + ] +} + +resource "google_vmwareengine_network" "network-policy-ds-nw" { + project = google_project.project.project_id + name = "tf-test-sample-nw%{random_suffix}" + location = "global" + type = "STANDARD" + description = "VMwareEngine standard network sample" + + depends_on = [ + time_sleep.sleep # Sleep allows permissions in the new project to propagate + ] +} + +resource "google_vmwareengine_network_policy" "vmw-engine-network-policy" { + project = google_project.project.project_id + location = "%{region}" + name = "tf-test-sample-network-policy%{random_suffix}" + internet_access { + enabled = true + } + external_ip { + enabled = true + } + edge_services_cidr = "192.168.30.0/26" + vmware_engine_network = google_vmwareengine_network.network-policy-ds-nw.id + + depends_on = [ + time_sleep.sleep # Sleep allows permissions in the new project to propagate + ] +} + +data "google_vmwareengine_network_policy" "ds" { + project = google_project.project.project_id + name = google_vmwareengine_network_policy.vmw-engine-network-policy.name + location = "%{region}" + depends_on = [ + google_vmwareengine_network_policy.vmw-engine-network-policy, + ] +} + +`, context) +} diff --git a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_cluster_test.go b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_cluster_test.go index 30b1aa43ef02..74d99aabf854 100644 --- a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_cluster_test.go +++ b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_cluster_test.go @@ -2,7 +2,6 @@ package vmwareengine_test import ( "fmt" - "os" "strings" "testing" @@ -16,15 +15,15 @@ import ( ) func TestAccVmwareengineCluster_vmwareEngineClusterUpdate(t *testing.T) { + t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/20719") acctest.SkipIfVcr(t) t.Parallel() context := map[string]interface{}{ - "region": "me-west1", // region with allocated quota - "random_suffix": acctest.RandString(t, 10), - "org_id": envvar.GetTestOrgFromEnv(t), - "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "vmwareengine_project": os.Getenv("GOOGLE_VMWAREENGINE_PROJECT"), + "region": "me-west1", // region with allocated quota + "random_suffix": acctest.RandString(t, 10), + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), } acctest.VcrTest(t, resource.TestCase{ @@ -73,7 +72,6 @@ func testVmwareEngineClusterConfig(context map[string]interface{}, nodeCount int context["node_count"] = nodeCount return acctest.Nprintf(` resource "google_vmwareengine_network" "cluster-nw" { - project = "%{vmwareengine_project}" name = "tf-test-cluster-nw%{random_suffix}" location = "global" type = "STANDARD" @@ -81,7 +79,6 @@ resource "google_vmwareengine_network" "cluster-nw" { } resource "google_vmwareengine_private_cloud" "cluster-pc" { - project = "%{vmwareengine_project}" location = "%{region}-b" name = "tf-test-cluster-pc%{random_suffix}" description = "Sample test PC." @@ -139,7 +136,6 @@ func testVmwareEngineClusterUpdateConfig(context map[string]interface{}, nodeCou context["node_count"] = nodeCount return acctest.Nprintf(` resource "google_vmwareengine_network" "cluster-nw" { - project = "%{vmwareengine_project}" name = "tf-test-cluster-nw%{random_suffix}" location = "global" type = "STANDARD" @@ -147,7 +143,6 @@ resource "google_vmwareengine_network" "cluster-nw" { } resource "google_vmwareengine_private_cloud" "cluster-pc" { - project = "%{vmwareengine_project}" location = "%{region}-b" name = "tf-test-cluster-pc%{random_suffix}" description = "Sample test PC." diff --git a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_external_address_test.go b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_external_address_test.go index 4c89a3617bca..519528ed1ccd 100644 --- a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_external_address_test.go +++ b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_external_address_test.go @@ -2,7 +2,6 @@ package vmwareengine_test import ( "fmt" - "os" "strings" "testing" @@ -15,14 +14,14 @@ import ( ) func TestAccVmwareengineExternalAddress_vmwareEngineExternalAddressUpdate(t *testing.T) { + t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/20719") t.Parallel() context := map[string]interface{}{ - "region": "me-west1", // region with allocated quota - "random_suffix": acctest.RandString(t, 10), - "org_id": envvar.GetTestOrgFromEnv(t), - "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "vmwareengine_project": os.Getenv("GOOGLE_VMWAREENGINE_PROJECT"), + "region": "me-west1", // region with allocated quota + "random_suffix": acctest.RandString(t, 10), + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, @@ -103,14 +102,12 @@ func testVmwareengineExternalAccessRuleUpdateConfig(context map[string]interface func testVmwareengineBaseConfig(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_vmwareengine_network" "vmw-engine-ea-ear-nw" { - project = "%{vmwareengine_project}" name = "tf-test-sample-ea-ear-nw%{random_suffix}" location = "global" type = "STANDARD" description = "PC network description." } resource "google_vmwareengine_private_cloud" "vmw-engine-ea-ear-pc" { - project = "%{vmwareengine_project}" location = "%{region}-b" name = "tf-test-sample-ea-ear-pc%{random_suffix}" type = "TIME_LIMITED" @@ -131,7 +128,6 @@ resource "google_vmwareengine_private_cloud" "vmw-engine-ea-ear-pc" { } resource "google_vmwareengine_network_policy" "vmw-engine-ea-ear-np" { - project = "%{vmwareengine_project}" location = "%{region}" name = "tf-test-sample-ea-ear-np%{random_suffix}" edge_services_cidr = "192.168.0.0/26" diff --git a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_network_peering_test.go b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_network_peering_test.go index 11d3fc08db6a..38fb4a3169f5 100644 --- a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_network_peering_test.go +++ b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_network_peering_test.go @@ -1,7 +1,6 @@ package vmwareengine_test import ( - "os" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" @@ -10,13 +9,13 @@ import ( ) func TestAccVmwareengineNetworkPeering_update(t *testing.T) { + t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/20719") t.Parallel() context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - "org_id": envvar.GetTestOrgFromEnv(t), - "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "vmwareengine_project": os.Getenv("GOOGLE_VMWAREENGINE_PROJECT"), + "random_suffix": acctest.RandString(t, 10), + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), } acctest.VcrTest(t, resource.TestCase{ @@ -29,9 +28,6 @@ func TestAccVmwareengineNetworkPeering_update(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccVmwareengineNetworkPeering_config(context, "Sample description."), - Check: resource.ComposeTestCheckFunc( - acctest.CheckDataSourceStateMatchesResourceStateWithIgnores("data.google_vmwareengine_network_peering.ds", "google_vmwareengine_network_peering.vmw-engine-network-peering", map[string]struct{}{}), - ), }, { ResourceName: "google_vmwareengine_network_peering.vmw-engine-network-peering", @@ -56,31 +52,23 @@ func testAccVmwareengineNetworkPeering_config(context map[string]interface{}, de context["description"] = description return acctest.Nprintf(` resource "google_vmwareengine_network" "network-peering-nw" { - project = "%{vmwareengine_project}" name = "tf-test-sample-nw%{random_suffix}" location = "global" type = "STANDARD" } resource "google_vmwareengine_network" "network-peering-peer-nw" { - project = "%{vmwareengine_project}" name = "tf-test-peer-nw%{random_suffix}" location = "global" type = "STANDARD" } resource "google_vmwareengine_network_peering" "vmw-engine-network-peering" { - project = "%{vmwareengine_project}" name = "tf-test-sample-network-peering%{random_suffix}" description = "%{description}" vmware_engine_network = google_vmwareengine_network.network-peering-nw.id peer_network = google_vmwareengine_network.network-peering-peer-nw.id peer_network_type = "VMWARE_ENGINE_NETWORK" } - -data "google_vmwareengine_network_peering" "ds" { - project = "%{vmwareengine_project}" - name = google_vmwareengine_network_peering.vmw-engine-network-peering.name -} `, context) } diff --git a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_network_policy_test.go b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_network_policy_test.go index db213a10cfbe..3824256d8688 100644 --- a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_network_policy_test.go +++ b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_network_policy_test.go @@ -1,7 +1,6 @@ package vmwareengine_test import ( - "os" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" @@ -11,14 +10,14 @@ import ( ) func TestAccVmwareengineNetworkPolicy_update(t *testing.T) { + t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/20719") t.Parallel() context := map[string]interface{}{ - "region": "me-west1", // region with allocated quota - "random_suffix": acctest.RandString(t, 10), - "org_id": envvar.GetTestOrgFromEnv(t), - "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "vmwareengine_project": os.Getenv("GOOGLE_VMWAREENGINE_PROJECT"), + "region": "me-west1", // region with allocated quota + "random_suffix": acctest.RandString(t, 10), + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), } acctest.VcrTest(t, resource.TestCase{ @@ -31,9 +30,6 @@ func TestAccVmwareengineNetworkPolicy_update(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccVmwareengineNetworkPolicy_config(context, "description1", "192.168.0.0/26", false, false), - Check: resource.ComposeTestCheckFunc( - acctest.CheckDataSourceStateMatchesResourceStateWithIgnores("data.google_vmwareengine_network_policy.ds", "google_vmwareengine_network_policy.vmw-engine-network-policy", map[string]struct{}{}), - ), }, { ResourceName: "google_vmwareengine_network_policy.vmw-engine-network-policy", @@ -62,7 +58,6 @@ func testAccVmwareengineNetworkPolicy_config(context map[string]interface{}, des return acctest.Nprintf(` resource "google_vmwareengine_network" "network-policy-nw" { - project = "%{vmwareengine_project}" name = "tf-test-sample-nw%{random_suffix}" location = "global" type = "STANDARD" @@ -70,7 +65,6 @@ resource "google_vmwareengine_network" "network-policy-nw" { } resource "google_vmwareengine_network_policy" "vmw-engine-network-policy" { - project = "%{vmwareengine_project}" location = "%{region}" name = "tf-test-sample-network-policy%{random_suffix}" description = "%{description}" @@ -83,11 +77,5 @@ resource "google_vmwareengine_network_policy" "vmw-engine-network-policy" { edge_services_cidr = "%{edge_services_cidr}" vmware_engine_network = google_vmwareengine_network.network-policy-nw.id } - -data "google_vmwareengine_network_policy" "ds" { - project = "%{vmwareengine_project}" - name = google_vmwareengine_network_policy.vmw-engine-network-policy.name - location = "%{region}" -} `, context) } diff --git a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_private_cloud_test.go b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_private_cloud_test.go index 89bb4f4a9a6e..80cabe6bcba1 100644 --- a/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_private_cloud_test.go +++ b/mmv1/third_party/terraform/services/vmwareengine/resource_vmwareengine_private_cloud_test.go @@ -2,7 +2,6 @@ package vmwareengine_test import ( "fmt" - "os" "strings" "testing" @@ -15,15 +14,15 @@ import ( ) func TestAccVmwareenginePrivateCloud_vmwareEnginePrivateCloudUpdate(t *testing.T) { + t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/20719") acctest.SkipIfVcr(t) t.Parallel() context := map[string]interface{}{ - "region": "me-west1", // region with allocated quota - "random_suffix": acctest.RandString(t, 10), - "org_id": envvar.GetTestOrgFromEnv(t), - "billing_account": envvar.GetTestBillingAccountFromEnv(t), - "vmwareengine_project": os.Getenv("GOOGLE_VMWAREENGINE_PROJECT"), + "region": "me-west1", // region with allocated quota + "random_suffix": acctest.RandString(t, 10), + "org_id": envvar.GetTestOrgFromEnv(t), + "billing_account": envvar.GetTestBillingAccountFromEnv(t), } acctest.VcrTest(t, resource.TestCase{ @@ -183,7 +182,6 @@ func testVmwareenginePrivateCloudConfig(context map[string]interface{}, descript context["type"] = pcType return acctest.Nprintf(` resource "google_vmwareengine_network" "vmw-engine-nw" { - project = "%{vmwareengine_project}" name = "tf-test-pc-nw-%{random_suffix}" location = "global" type = "STANDARD" @@ -191,7 +189,6 @@ resource "google_vmwareengine_network" "vmw-engine-nw" { } resource "google_vmwareengine_private_cloud" "vmw-engine-pc" { - project = "%{vmwareengine_project}" location = "%{region}-b" name = "tf-test-sample-pc%{random_suffix}" description = "%{description}" @@ -213,7 +210,6 @@ resource "google_vmwareengine_private_cloud" "vmw-engine-pc" { } data "google_vmwareengine_private_cloud" "ds" { - project = "%{vmwareengine_project}" location = "%{region}-b" name = "tf-test-sample-pc%{random_suffix}" depends_on = [ @@ -230,7 +226,6 @@ func testVmwareenginePrivateCloudAutoscaleConfig(context map[string]interface{}, context["type"] = pcType return acctest.Nprintf(` resource "google_vmwareengine_network" "vmw-engine-nw" { - project = "%{vmwareengine_project}" name = "tf-test-pc-nw-%{random_suffix}" location = "global" type = "STANDARD" @@ -238,7 +233,6 @@ resource "google_vmwareengine_network" "vmw-engine-nw" { } resource "google_vmwareengine_private_cloud" "vmw-engine-pc" { - project = "%{vmwareengine_project}" location = "%{region}-b" name = "tf-test-sample-pc%{random_suffix}" description = "%{description}" @@ -282,7 +276,6 @@ resource "google_vmwareengine_private_cloud" "vmw-engine-pc" { } data "google_vmwareengine_private_cloud" "ds" { - project = "%{vmwareengine_project}" location = "%{region}-b" name = "tf-test-sample-pc%{random_suffix}" depends_on = [ @@ -295,7 +288,6 @@ data "google_vmwareengine_private_cloud" "ds" { func testVmwareenginePrivateCloudDeletedConfig(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_vmwareengine_network" "vmw-engine-nw" { - project = "%{vmwareengine_project}" name = "tf-test-pc-nw-%{random_suffix}" location = "global" type = "STANDARD" diff --git a/mmv1/third_party/terraform/services/workbench/resource_workbench_instance_test.go.tmpl b/mmv1/third_party/terraform/services/workbench/resource_workbench_instance_test.go.tmpl index c40f3c141c0c..9df865d0e4b5 100644 --- a/mmv1/third_party/terraform/services/workbench/resource_workbench_instance_test.go.tmpl +++ b/mmv1/third_party/terraform/services/workbench/resource_workbench_instance_test.go.tmpl @@ -290,73 +290,6 @@ func TestAccWorkbenchInstance_updateMetadata(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "google_workbench_instance.instance", "state", "ACTIVE"), - ), - }, - { - ResourceName: "google_workbench_instance.instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "instance_owners", "location", "instance_id", "request_id", "labels", "terraform_labels"}, - }, - { - Config: testAccWorkbenchInstance_basic(context), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "google_workbench_instance.instance", "state", "ACTIVE"), - ), - }, - { - ResourceName: "google_workbench_instance.instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "instance_owners", "location", "instance_id", "request_id", "labels", "terraform_labels"}, - }, - }, - }) -} - -func TestAccWorkbenchInstance_updateMetadataKey(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccWorkbenchInstance_updateMetadata(context), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "google_workbench_instance.instance", "state", "ACTIVE"), - ), - }, - { - ResourceName: "google_workbench_instance.instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "instance_owners", "location", "instance_id", "request_id", "labels", "terraform_labels"}, - }, - { - Config: testAccWorkbenchInstance_updateMetadataKey(context), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "google_workbench_instance.instance", "state", "ACTIVE"), - ), - }, - { - ResourceName: "google_workbench_instance.instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "instance_owners", "location", "instance_id", "request_id", "labels", "terraform_labels"}, - }, - { - Config: testAccWorkbenchInstance_updateMetadata(context), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "google_workbench_instance.instance", "state", "ACTIVE"), ), }, { @@ -389,27 +322,6 @@ resource "google_workbench_instance" "instance" { `, context) } -func testAccWorkbenchInstance_updateMetadataKey(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_workbench_instance" "instance" { - name = "tf-test-workbench-instance%{random_suffix}" - location = "us-central1-a" - - gce_setup { - metadata = { - terraform = "true", - "idle-timeout-seconds" = "10800", - } - } - - labels = { - k = "val" - } - -} -`, context) -} - func TestAccWorkbenchInstance_updateState(t *testing.T) { t.Parallel() @@ -778,75 +690,3 @@ resource "google_workbench_instance" "instance" { } `, context) } - - -func TestAccWorkbenchInstance_updateCustomContainers(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccWorkbenchInstance_customcontainer(context), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "google_workbench_instance.instance", "state", "ACTIVE"), - ), - }, - { - ResourceName: "google_workbench_instance.instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "instance_owners", "location", "instance_id", "request_id", "labels", "terraform_labels","desired_state"}, - }, - { - Config: testAccWorkbenchInstance_updatedcustomcontainer(context), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "google_workbench_instance.instance", "state", "ACTIVE"), - ), - }, - { - ResourceName: "google_workbench_instance.instance", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name", "instance_owners", "location", "instance_id", "request_id", "labels", "terraform_labels","desired_state"}, - }, - }, - }) -} - -func testAccWorkbenchInstance_customcontainer(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_workbench_instance" "instance" { - name = "tf-test-workbench-instance%{random_suffix}" - location = "us-central1-a" - gce_setup { - container_image { - repository = "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310" - tag = "latest" - } - } -} -`, context) -} - -func testAccWorkbenchInstance_updatedcustomcontainer(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_workbench_instance" "instance" { - name = "tf-test-workbench-instance%{random_suffix}" - location = "us-central1-a" - gce_setup { - container_image { - repository = "gcr.io/deeplearning-platform-release/workbench-container" - tag = "20241117-2200-rc0" - } - } -} -`, context) -} diff --git a/mmv1/third_party/terraform/services/workflows/resource_workflows_workflow_test.go.tmpl b/mmv1/third_party/terraform/services/workflows/resource_workflows_workflow_test.go.tmpl index c0dde5b9f305..2cf5fb488483 100644 --- a/mmv1/third_party/terraform/services/workflows/resource_workflows_workflow_test.go.tmpl +++ b/mmv1/third_party/terraform/services/workflows/resource_workflows_workflow_test.go.tmpl @@ -13,6 +13,7 @@ import ( ) func TestAccWorkflowsWorkflow_Update(t *testing.T) { + // Custom test written to test diffs t.Parallel() workflowName := fmt.Sprintf("tf-test-acc-workflow-%d", acctest.RandInt(t)) @@ -43,9 +44,6 @@ resource "google_workflows_workflow" "example" { url = "https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam" } deletion_protection = false - labels = { - env = "test" - } source_contents = <<-EOF # This is a sample workflow, feel free to replace it with your source code # @@ -82,15 +80,12 @@ func testAccWorkflowsWorkflow_Updated(name string) string { resource "google_workflows_workflow" "example" { name = "%s" region = "us-central1" - description = "Magic-updated" - call_log_level = "LOG_ALL_CALLS" + description = "Magic" + call_log_level = "LOG_ERRORS_ONLY" user_env_vars = { - url = "https://timeapi.io/api/Time/current/zone?timeZone=Europe/London" + url = "https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam" } deletion_protection = false - labels = { - env = "updated" - } source_contents = <<-EOF # This is a sample workflow, feel free to replace it with your source code # @@ -107,7 +102,7 @@ resource "google_workflows_workflow" "example" { args: url: $${sys.get_env("url")} result: CurrentDateTime - - readWikipediaUpdated: + - readWikipedia: call: http.get args: url: https:/fi.wikipedia.org/w/api.php @@ -292,12 +287,9 @@ func TestAccWorkflowsWorkflow_CMEK(t *testing.T) { workflowName := fmt.Sprintf("tf-test-acc-workflow-%d", acctest.RandInt(t)) kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1") - acctest.BootstrapIamMembers(t, []acctest.IamMember{ - { - Member: "serviceAccount:service-{project_number}@gcp-sa-workflows.iam.gserviceaccount.com", - Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", - }, - }) + if acctest.BootstrapPSARole(t, "service-", "gcp-sa-workflows", "roles/cloudkms.cryptoKeyEncrypterDecrypter") { + t.Fatal("Stopping the test because a role was added to the policy.") + } acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, diff --git a/mmv1/third_party/terraform/services/workstations/resource_workstations_workstation_config_test.go.tmpl b/mmv1/third_party/terraform/services/workstations/resource_workstations_workstation_config_test.go.tmpl index 462033f22479..b9bfb4e4321f 100644 --- a/mmv1/third_party/terraform/services/workstations/resource_workstations_workstation_config_test.go.tmpl +++ b/mmv1/third_party/terraform/services/workstations/resource_workstations_workstation_config_test.go.tmpl @@ -175,15 +175,6 @@ func TestAccWorkstationsWorkstationConfig_persistentDirectories(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"etag", "labels", "terraform_labels"}, }, - { - Config: testAccWorkstationsWorkstationConfig_persistentDirectoriesUpdated(context), - }, - { - ResourceName: "google_workstations_workstation_cluster.default", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"etag", "labels", "terraform_labels"}, - }, }, }) } @@ -233,56 +224,6 @@ resource "google_workstations_workstation_config" "default" { `, context) } -func testAccWorkstationsWorkstationConfig_persistentDirectoriesUpdated(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_compute_network" "default" { - provider = google-beta - name = "tf-test-workstation-cluster%{random_suffix}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - provider = google-beta - name = "tf-test-workstation-cluster%{random_suffix}" - ip_cidr_range = "10.0.0.0/24" - region = "us-central1" - network = google_compute_network.default.name -} - -resource "google_workstations_workstation_cluster" "default" { - provider = google-beta - workstation_cluster_id = "tf-test-workstation-cluster%{random_suffix}" - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - location = "us-central1" - - labels = { - foo = "bar" - } -} - -resource "google_workstations_workstation_config" "default" { - provider = google-beta - workstation_config_id = "tf-test-workstation-config%{random_suffix}" - workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id - location = "us-central1" - - persistent_directories { - mount_path = "/home" - - gce_pd { - disk_type = "pd-standard" - size_gb = 200 - } - } - - labels = { - foo = "bar" - } -} -`, context) -} - func TestAccWorkstationsWorkstationConfig_ephemeralDirectories(t *testing.T) { t.Parallel() diff --git a/mmv1/third_party/terraform/sweeper/gcp_sweeper.go b/mmv1/third_party/terraform/sweeper/gcp_sweeper.go index 887d6613c5e2..6f19cd0499bb 100644 --- a/mmv1/third_party/terraform/sweeper/gcp_sweeper.go +++ b/mmv1/third_party/terraform/sweeper/gcp_sweeper.go @@ -8,6 +8,8 @@ import ( "runtime" "strings" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/envvar" "github.com/hashicorp/terraform-provider-google/google/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" @@ -54,14 +56,8 @@ func SharedConfigForRegion(region string) (*transport_tpg.Config, error) { } func IsSweepableTestResource(resourceName string) bool { - return hasAnyPrefix(resourceName, testResourcePrefixes) -} - -// hasAnyPrefix checks if the input string begins with any prefix from the given slice. -// Returns true if a match is found, false otherwise. -func hasAnyPrefix(input string, prefixes []string) bool { - for _, p := range prefixes { - if strings.HasPrefix(input, p) { + for _, p := range testResourcePrefixes { + if strings.HasPrefix(resourceName, p) { return true } } @@ -114,7 +110,7 @@ func AddTestSweepers(name string, sweeper func(region string) error) { hashedFilename := hex.EncodeToString(hash.Sum(nil)) uniqueName := name + "_" + hashedFilename - addTestSweepers(uniqueName, &Sweeper{ + resource.AddTestSweepers(uniqueName, &resource.Sweeper{ Name: name, F: sweeper, }) diff --git a/mmv1/third_party/terraform/sweeper/gcp_sweeper_test.go.tmpl b/mmv1/third_party/terraform/sweeper/gcp_sweeper_test.go.tmpl index 08c9482c7807..c10152aabb2a 100644 --- a/mmv1/third_party/terraform/sweeper/gcp_sweeper_test.go.tmpl +++ b/mmv1/third_party/terraform/sweeper/gcp_sweeper_test.go.tmpl @@ -4,6 +4,8 @@ package sweeper_test import ( "testing" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + {{- range $product := $.Products }} _ "github.com/hashicorp/terraform-provider-google/google/services/{{ lower $product.Name }}" {{- end }} @@ -21,15 +23,8 @@ import ( _ "github.com/hashicorp/terraform-provider-google/google/services/firebaserules" _ "github.com/hashicorp/terraform-provider-google/google/services/networkconnectivity" _ "github.com/hashicorp/terraform-provider-google/google/services/recaptchaenterprise" - - // TODO: remove dependency on hashicorp flags - // need to blank import hashicorp sweeper code to maintain the flags declared in their package - _ "github.com/hashicorp/terraform-plugin-testing/helper/resource" - - "github.com/hashicorp/terraform-provider-google/google/sweeper" ) -func TestAccExecuteSweepers(t *testing.T) { - sweeper.ExecuteSweepers(t) +func TestMain(m *testing.M) { + resource.TestMain(m) } - diff --git a/mmv1/third_party/terraform/sweeper/hashi_sweeper_fork.go b/mmv1/third_party/terraform/sweeper/hashi_sweeper_fork.go deleted file mode 100644 index c9cd12dfc2e2..000000000000 --- a/mmv1/third_party/terraform/sweeper/hashi_sweeper_fork.go +++ /dev/null @@ -1,274 +0,0 @@ -package sweeper - -import ( - "flag" - "fmt" - "log" - "os" - "strings" - "testing" - "time" -) - -// flagSweep is a flag available when running tests on the command line. It -// contains a comma separated list of regions to for the sweeper functions to -// run in. This flag bypasses the normal Test path and instead runs functions designed to -// clean up any leaked resources a testing environment could have created. It is -// a best effort attempt, and relies on Provider authors to implement "Sweeper" -// methods for resources. - -// Adding Sweeper methods with AddTestSweepers will -// construct a list of sweeper funcs to be called here. We iterate through -// regions provided by the sweep flag, and for each region we iterate through the -// tests, and exit on any errors. At time of writing, sweepers are ran -// sequentially, however they can list dependencies to be ran first. We track -// the sweepers that have been ran, so as to not run a sweeper twice for a given -// region. -// -// WARNING: -// Sweepers are designed to be destructive. You should not use the -sweep flag -// in any environment that is not strictly a test environment. Resources will be -// destroyed. - -var ( - flagSweep *string - flagSweepAllowFailures *bool - flagSweepRun *string - sweeperFuncs map[string]*Sweeper -) - -// SweeperFunc is a signature for a function that acts as a sweeper. It -// accepts a string for the region that the sweeper is to be ran in. This -// function must be able to construct a valid client for that region. -type SweeperFunc func(r string) error - -type Sweeper struct { - // Name for sweeper. Must be unique to be ran by the Sweeper Runner - Name string - - // Dependencies list the const names of other Sweeper functions that must be ran - // prior to running this Sweeper. This is an ordered list that will be invoked - // recursively at the helper/resource level - Dependencies []string - - // Sweeper function that when invoked sweeps the Provider of specific - // resources - F SweeperFunc -} - -func init() { - sweeperFuncs = make(map[string]*Sweeper) -} - -// registerFlags checks for and gets existing flag definitions before trying to redefine them. -// This is needed because this package and terraform-plugin-testing both define the same sweep flags. -// By checking first, we ensure we reuse any existing flags rather than causing a panic from flag redefinition. -// This allows this module to be used alongside terraform-plugin-testing without conflicts. -func registerFlags() { - // Check for existing flags in global CommandLine - if f := flag.Lookup("sweep"); f != nil { - // Use the Value.Get() interface to get the values - if getter, ok := f.Value.(flag.Getter); ok { - vs := getter.Get().(string) - flagSweep = &vs - } - if f := flag.Lookup("sweep-allow-failures"); f != nil { - if getter, ok := f.Value.(flag.Getter); ok { - vb := getter.Get().(bool) - flagSweepAllowFailures = &vb - } - } - if f := flag.Lookup("sweep-run"); f != nil { - if getter, ok := f.Value.(flag.Getter); ok { - vs := getter.Get().(string) - flagSweepRun = &vs - } - } - } else { - // Define our flags if they don't exist - fsDefault := "" - fsafDefault := true - fsrDefault := "" - flagSweep = &fsDefault - flagSweepAllowFailures = &fsafDefault - flagSweepRun = &fsrDefault - } -} - -// AddTestSweepers function adds a given name and Sweeper configuration -// pair to the internal sweeperFuncs map. Invoke this function to register a -// resource sweeper to be available for running when the -sweep flag is used -// with `go test`. Sweeper names must be unique to help ensure a given sweeper -// is only ran once per run. -func addTestSweepers(name string, s *Sweeper) { - if _, ok := sweeperFuncs[name]; ok { - log.Fatalf("[ERR] Error adding (%s) to sweeperFuncs: function already exists in map", name) - } - - sweeperFuncs[name] = s -} - -// ExecuteSweepers -// -// Sweepers enable infrastructure cleanup functions to be included with -// resource definitions, typically so developers can remove all resources of -// that resource type from testing infrastructure in case of failures that -// prevented the normal resource destruction behavior of acceptance tests. -// Use the AddTestSweepers() function to configure available sweepers. -// -// Sweeper flags added to the "go test" command: -// -// -sweep: Comma-separated list of locations/regions to run available sweepers. -// -sweep-allow-failues: Enable to allow other sweepers to run after failures. -// -sweep-run: Comma-separated list of resource type sweepers to run. Defaults -// to all sweepers. -// -// Refer to the Env prefixed constants for environment variables that further -// control testing functionality. -func ExecuteSweepers(t *testing.T) { - registerFlags() - flag.Parse() - if *flagSweep != "" { - // parse flagSweep contents for regions to run - regions := strings.Split(*flagSweep, ",") - - // get filtered list of sweepers to run based on sweep-run flag - sweepers := filterSweepers(*flagSweepRun, sweeperFuncs) - - if err := runSweepers(t, regions, sweepers, *flagSweepAllowFailures); err != nil { - os.Exit(1) - } - } else { - t.Skip("skipping sweeper run. No region supplied") - } -} - -func runSweepers(t *testing.T, regions []string, sweepers map[string]*Sweeper, allowFailures bool) error { - // Sort sweepers by dependency order - sorted, err := validateAndOrderSweepers(sweepers) - if err != nil { - return fmt.Errorf("failed to sort sweepers: %v", err) - } - - // Run each sweeper in dependency order - for _, sweeper := range sorted { - sweeper := sweeper // capture for closure - t.Run(sweeper.Name, func(t *testing.T) { - for _, region := range regions { - region := strings.TrimSpace(region) - log.Printf("[DEBUG] Running Sweeper (%s) in region (%s)", sweeper.Name, region) - - start := time.Now() - err := sweeper.F(region) - elapsed := time.Since(start) - - log.Printf("[DEBUG] Completed Sweeper (%s) in region (%s) in %s", sweeper.Name, region, elapsed) - - if err != nil { - log.Printf("[ERROR] Error running Sweeper (%s) in region (%s): %s", sweeper.Name, region, err) - if allowFailures { - t.Errorf("failed in region %s: %s", region, err) - } else { - t.Fatalf("failed in region %s: %s", region, err) - } - } - } - }) - } - - return nil -} - -// filterSweepers takes a comma separated string listing the names of sweepers -// to be ran, and returns a filtered set from the list of all of sweepers to -// run based on the names given. -func filterSweepers(f string, source map[string]*Sweeper) map[string]*Sweeper { - filterSlice := strings.Split(strings.ToLower(f), ",") - if len(filterSlice) == 1 && filterSlice[0] == "" { - // if the filter slice is a single element of "" then no sweeper list was - // given, so just return the full list - return source - } - - sweepers := make(map[string]*Sweeper) - for name := range source { - for _, s := range filterSlice { - if strings.Contains(strings.ToLower(name), s) { - for foundName, foundSweeper := range filterSweeperWithDependencies(name, source) { - sweepers[foundName] = foundSweeper - } - } - } - } - return sweepers -} - -// filterSweeperWithDependencies recursively returns sweeper and all dependencies. -// Since filterSweepers performs fuzzy matching, this function is used -// to perform exact sweeper and dependency lookup. -func filterSweeperWithDependencies(name string, source map[string]*Sweeper) map[string]*Sweeper { - result := make(map[string]*Sweeper) - - currentSweeper, ok := source[name] - if !ok { - log.Printf("[WARN] Sweeper has dependency (%s), but that sweeper was not found", name) - return result - } - - result[name] = currentSweeper - - for _, dependency := range currentSweeper.Dependencies { - for foundName, foundSweeper := range filterSweeperWithDependencies(dependency, source) { - result[foundName] = foundSweeper - } - } - - return result -} - -// validateAndOrderSweepers performs topological sort on sweepers based on their dependencies. -// It ensures there are no cycles in the dependency graph and all referenced dependencies exist. -// Returns an ordered list of sweepers where each sweeper appears after its dependencies. -// Returns error if there are any cycles or missing dependencies. -func validateAndOrderSweepers(sweepers map[string]*Sweeper) ([]*Sweeper, error) { - // Detect cycles and get sorted list - visited := make(map[string]bool) - inPath := make(map[string]bool) - sorted := make([]*Sweeper, 0, len(sweepers)) - - var visit func(name string) error - visit = func(name string) error { - if inPath[name] { - return fmt.Errorf("dependency cycle detected: %s", name) - } - if visited[name] { - return nil - } - - inPath[name] = true - sweeper := sweepers[name] - for _, dep := range sweeper.Dependencies { - if _, exists := sweepers[dep]; !exists { - return fmt.Errorf("sweeper %s depends on %s, but %s not found", name, dep, dep) - } - if err := visit(dep); err != nil { - return err - } - } - inPath[name] = false - visited[name] = true - sorted = append(sorted, sweeper) - return nil - } - - // Visit all sweepers - for name := range sweepers { - if !visited[name] { - if err := visit(name); err != nil { - return nil, err - } - } - } - - return sorted, nil -} diff --git a/mmv1/third_party/terraform/sweeper/hashi_sweeper_fork_test.go b/mmv1/third_party/terraform/sweeper/hashi_sweeper_fork_test.go deleted file mode 100644 index 0c22b3a092d6..000000000000 --- a/mmv1/third_party/terraform/sweeper/hashi_sweeper_fork_test.go +++ /dev/null @@ -1,356 +0,0 @@ -package sweeper - -import ( - "reflect" - "strings" - "testing" -) - -func TestValidateAndOrderSweepers_Simple(t *testing.T) { - sweepers := map[string]*Sweeper{ - "B": { - Name: "B", - Dependencies: []string{"A"}, - }, - "C": { - Name: "C", - Dependencies: []string{"B"}, - }, - "A": { - Name: "A", - Dependencies: []string{}, - }, - } - - sorted, err := validateAndOrderSweepers(sweepers) - if err != nil { - t.Fatalf("Expected no error, got: %v", err) - } - - // Verify order: A should come before B, B before C - names := make([]string, len(sorted)) - for i, s := range sorted { - names[i] = s.Name - } - - expected := []string{"A", "B", "C"} - if !reflect.DeepEqual(names, expected) { - t.Errorf("Expected order %v, got %v", expected, names) - } -} - -func TestValidateAndOrderSweepers_Cycle(t *testing.T) { - testCases := []struct { - name string - sweepers map[string]*Sweeper - wantErr bool - errMsg string - }{ - { - name: "direct_cycle", - sweepers: map[string]*Sweeper{ - "A": { - Name: "A", - Dependencies: []string{"B"}, - }, - "B": { - Name: "B", - Dependencies: []string{"A"}, - }, - }, - wantErr: true, - errMsg: "dependency cycle detected", - }, - { - name: "indirect_cycle", - sweepers: map[string]*Sweeper{ - "A": { - Name: "A", - Dependencies: []string{"B"}, - }, - "B": { - Name: "B", - Dependencies: []string{"C"}, - }, - "C": { - Name: "C", - Dependencies: []string{"A"}, - }, - }, - wantErr: true, - errMsg: "dependency cycle detected", - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := validateAndOrderSweepers(tc.sweepers) - if tc.wantErr { - if err == nil { - t.Error("Expected error, got nil") - } else if !strings.Contains(err.Error(), tc.errMsg) { - t.Errorf("Expected error containing %q, got %v", tc.errMsg, err) - } - } else if err != nil { - t.Errorf("Expected no error, got %v", err) - } - }) - } -} - -func TestValidateAndOrderSweepers_MissingDependency(t *testing.T) { - sweepers := map[string]*Sweeper{ - "A": { - Name: "A", - Dependencies: []string{"NonExistent"}, - }, - } - - _, err := validateAndOrderSweepers(sweepers) - if err == nil { - t.Fatal("Expected error for missing dependency, got nil") - } - expected := "sweeper A depends on NonExistent, but NonExistent not found" - if err.Error() != expected { - t.Errorf("Expected error message %q, got %q", expected, err.Error()) - } -} - -func TestValidateAndOrderSweepers_Complex(t *testing.T) { - sweepers := map[string]*Sweeper{ - "A": { - Name: "A", - Dependencies: []string{}, - }, - "B": { - Name: "B", - Dependencies: []string{"A"}, - }, - "C": { - Name: "C", - Dependencies: []string{"A"}, - }, - "D": { - Name: "D", - Dependencies: []string{"B", "C"}, - }, - "E": { - Name: "E", - Dependencies: []string{"C"}, - }, - } - - sorted, err := validateAndOrderSweepers(sweepers) - if err != nil { - t.Fatalf("Expected no error, got: %v", err) - } - - // Create a map to check relative positions - positions := make(map[string]int) - for i, s := range sorted { - positions[s.Name] = i - } - - // Verify dependencies come before dependents - checks := []struct { - dependency string - dependent string - }{ - {"A", "B"}, - {"A", "C"}, - {"B", "D"}, - {"C", "D"}, - {"C", "E"}, - } - - for _, check := range checks { - if positions[check.dependency] >= positions[check.dependent] { - t.Errorf("Expected %s to come before %s, but got positions %d and %d", - check.dependency, check.dependent, - positions[check.dependency], positions[check.dependent]) - } - } -} - -func TestValidateAndOrderSweepers_Empty(t *testing.T) { - sweepers := map[string]*Sweeper{} - - sorted, err := validateAndOrderSweepers(sweepers) - if err != nil { - t.Fatalf("Expected no error for empty sweepers, got: %v", err) - } - if len(sorted) != 0 { - t.Errorf("Expected empty result for empty input, got %d items", len(sorted)) - } -} - -func TestValidateAndOrderSweepers_SelfDependency(t *testing.T) { - sweepers := map[string]*Sweeper{ - "A": { - Name: "A", - Dependencies: []string{"A"}, - }, - } - - _, err := validateAndOrderSweepers(sweepers) - if err == nil { - t.Fatal("Expected error for self-dependency, got nil") - } - if !strings.Contains(err.Error(), "dependency cycle detected") { - t.Errorf("Expected cycle detection error, got: %v", err) - } -} - -func TestFilterSweepers(t *testing.T) { - testCases := []struct { - name string - filter string - sourceSweepers map[string]*Sweeper - expected map[string]*Sweeper - }{ - { - name: "empty_filter", - filter: "", - sourceSweepers: map[string]*Sweeper{ - "test": {Name: "test"}, - "prod": {Name: "prod"}, - }, - expected: map[string]*Sweeper{ - "test": {Name: "test"}, - "prod": {Name: "prod"}, - }, - }, - { - name: "single_match", - filter: "test", - sourceSweepers: map[string]*Sweeper{ - "test": {Name: "test"}, - "testing": {Name: "testing"}, - "prod": {Name: "prod"}, - }, - expected: map[string]*Sweeper{ - "test": {Name: "test"}, - "testing": {Name: "testing"}, - }, - }, - { - name: "multiple_filters", - filter: "test,prod", - sourceSweepers: map[string]*Sweeper{ - "test": {Name: "test"}, - "testing": {Name: "testing"}, - "prod": {Name: "prod"}, - "stage": {Name: "stage"}, - }, - expected: map[string]*Sweeper{ - "test": {Name: "test"}, - "testing": {Name: "testing"}, - "prod": {Name: "prod"}, - }, - }, - { - name: "case_insensitive", - filter: "TEST", - sourceSweepers: map[string]*Sweeper{ - "test": {Name: "test"}, - "testing": {Name: "testing"}, - }, - expected: map[string]*Sweeper{ - "test": {Name: "test"}, - "testing": {Name: "testing"}, - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := filterSweepers(tc.filter, tc.sourceSweepers) - if !reflect.DeepEqual(result, tc.expected) { - t.Errorf("Expected %v, got %v", tc.expected, result) - } - }) - } -} - -func TestFilterSweeperWithDependencies(t *testing.T) { - testCases := []struct { - name string - sweeper string - sourceSweepers map[string]*Sweeper - expected map[string]*Sweeper - }{ - { - name: "no_dependencies", - sweeper: "test", - sourceSweepers: map[string]*Sweeper{ - "test": { - Name: "test", - Dependencies: []string{}, - }, - }, - expected: map[string]*Sweeper{ - "test": { - Name: "test", - Dependencies: []string{}, - }, - }, - }, - { - name: "with_dependencies", - sweeper: "test", - sourceSweepers: map[string]*Sweeper{ - "test": { - Name: "test", - Dependencies: []string{"dep1", "dep2"}, - }, - "dep1": { - Name: "dep1", - Dependencies: []string{}, - }, - "dep2": { - Name: "dep2", - Dependencies: []string{}, - }, - }, - expected: map[string]*Sweeper{ - "test": { - Name: "test", - Dependencies: []string{"dep1", "dep2"}, - }, - "dep1": { - Name: "dep1", - Dependencies: []string{}, - }, - "dep2": { - Name: "dep2", - Dependencies: []string{}, - }, - }, - }, - { - name: "missing_dependency", - sweeper: "test", - sourceSweepers: map[string]*Sweeper{ - "test": { - Name: "test", - Dependencies: []string{"missing"}, - }, - }, - expected: map[string]*Sweeper{ - "test": { - Name: "test", - Dependencies: []string{"missing"}, - }, - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - result := filterSweeperWithDependencies(tc.sweeper, tc.sourceSweepers) - if !reflect.DeepEqual(result, tc.expected) { - t.Errorf("Expected %v, got %v", tc.expected, result) - } - }) - } -} diff --git a/mmv1/third_party/terraform/verify/validation.go b/mmv1/third_party/terraform/verify/validation.go index 3967336fba03..b3a0152e7436 100644 --- a/mmv1/third_party/terraform/verify/validation.go +++ b/mmv1/third_party/terraform/verify/validation.go @@ -438,14 +438,3 @@ func ValidateRegexp(re string) schema.SchemaValidateFunc { return } } - -func ValidateRegexCompiles() schema.SchemaValidateFunc { - return func(v interface{}, k string) (ws []string, errs []error) { - value := v.(string) - if _, err := regexp.Compile(value); err != nil { - errs = append(errs, fmt.Errorf( - "%s (%s) is not a valid regex pattern: %s", k, value, err)) - } - return - } -} diff --git a/mmv1/third_party/terraform/website/docs/d/alloydb_instance.html.markdown b/mmv1/third_party/terraform/website/docs/d/alloydb_instance.html.markdown deleted file mode 100644 index 7be540a5165c..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/alloydb_instance.html.markdown +++ /dev/null @@ -1,43 +0,0 @@ ---- -subcategory: "AlloyDB" -description: |- - Fetches the details of available instance. ---- - -# google_alloydb_instance - -Use this data source to get information about the available instance. For more details refer the [API docs](https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.clusters.instances). - -## Example Usage - - -```hcl -data "google_alloydb_instance" "qa" { -} -``` - -## Argument Reference - -The following arguments are supported: - -* `cluster_id` - - (Required) - The ID of the alloydb cluster that the instance belongs to. - 'alloydb_cluster_id' - -* `instance_id` - - (Required) - The ID of the alloydb instance. - 'alloydb_instance_id' - -* `project` - - (optional) - The ID of the project in which the resource belongs. If it is not provided, the provider project is used. - -* `location` - - (optional) - The canonical id of the location.If it is not provided, the provider project is used. For example: us-east1. - -## Attributes Reference - -See [google_alloydb_instance](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/alloydb_instance) resource for details of all the available attributes. diff --git a/mmv1/third_party/terraform/website/docs/d/backup_dr_backup.html.markdown b/mmv1/third_party/terraform/website/docs/d/backup_dr_backup.html.markdown index f5f5675fbbb8..ca31d46d9824 100644 --- a/mmv1/third_party/terraform/website/docs/d/backup_dr_backup.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/backup_dr_backup.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Backup and DR Service" +subcategory: "Backup and DR Backup" description: |- Get information about a Backupdr Backup. --- @@ -26,4 +26,4 @@ The following arguments are supported: * `location` - (Required) The location in which the Backup belongs. * `project` - (Required) The Google Cloud Project in which the Backup belongs. * `data_source_id` - (Required) The ID of the Data Source in which the Backup belongs. -* `backup_vault_id` - (Required) The ID of the Backup Vault of the Data Source in which the Backup belongs. +* `backup_vault_id` - (Required) The ID of the Backup Vault of the Data Source in which the Backup belongs. \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/d/backup_dr_backup_plan_association.html.markdown b/mmv1/third_party/terraform/website/docs/d/backup_dr_backup_plan_association.html.markdown index dccc2cb63e44..096b6a102752 100644 --- a/mmv1/third_party/terraform/website/docs/d/backup_dr_backup_plan_association.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/backup_dr_backup_plan_association.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Backup and DR Service" +subcategory: "Backup and DR BackupPlanAssociation" description: |- Get information about a Backupdr BackupPlanAssociation. --- diff --git a/mmv1/third_party/terraform/website/docs/d/backup_dr_backup_vault.html.markdown b/mmv1/third_party/terraform/website/docs/d/backup_dr_backup_vault.html.markdown index cc04761902f0..5e819723211b 100644 --- a/mmv1/third_party/terraform/website/docs/d/backup_dr_backup_vault.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/backup_dr_backup_vault.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Backup and DR Service" +subcategory: "Backup and DR BackupVault" description: |- Get information about a Backupdr BackupVault. --- @@ -31,4 +31,4 @@ The following arguments are supported: ## Attributes Reference -See [google_backup_dr_backup_vault](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/backup_dr_backup_vault) resource for details of the available attributes. +See [google_backup_dr_backup_vault](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/backup_dr_backup_vault) resource for details of the available attributes. \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/d/backup_dr_data_source.html.markdown b/mmv1/third_party/terraform/website/docs/d/backup_dr_data_source.html.markdown index 10f5c806631f..13d794e27721 100644 --- a/mmv1/third_party/terraform/website/docs/d/backup_dr_data_source.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/backup_dr_data_source.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Backup and DR Service" +subcategory: "Backup and DR Data Source" description: |- Get information about a Backupdr Data Source. --- @@ -26,4 +26,4 @@ The following arguments are supported: * `location` - (Required) The location in which the Data Source belongs. * `project` - (Required) The Google Cloud Project in which the Data Source belongs. * `data_source_id` - (Required) The ID of the Data Source. -* `backup_vault_id` - (Required) The ID of the Backup Vault in which the Data Source belongs. +* `backup_vault_id` - (Required) The ID of the Backup Vault in which the Data Source belongs. \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/d/backup_dr_management_server.html.markdown b/mmv1/third_party/terraform/website/docs/d/backup_dr_management_server.html.markdown index 8d21dc256b49..35c59d9d2dac 100644 --- a/mmv1/third_party/terraform/website/docs/d/backup_dr_management_server.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/backup_dr_management_server.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Backup and DR Service" +subcategory: "BackupDR Management Server" description: |- Get information about a Backupdr Management server. --- diff --git a/mmv1/third_party/terraform/website/docs/d/certificate_manager_certificate_map.html.markdown b/mmv1/third_party/terraform/website/docs/d/certificate_manager_certificate_map.html.markdown index 9126b760a2d0..20e2e4fe5b0c 100644 --- a/mmv1/third_party/terraform/website/docs/d/certificate_manager_certificate_map.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/certificate_manager_certificate_map.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Certificate Manager" +subcategory: "Certificate manager" description: |- Contains the data that describes a Certificate Map --- diff --git a/mmv1/third_party/terraform/website/docs/d/certificate_manager_certificates.html.markdown b/mmv1/third_party/terraform/website/docs/d/certificate_manager_certificates.html.markdown index 0c730467e253..d2199700a56f 100644 --- a/mmv1/third_party/terraform/website/docs/d/certificate_manager_certificates.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/certificate_manager_certificates.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Certificate Manager" +subcategory: "Certificate manager" description: |- List all certificates within a project and region. --- diff --git a/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown index c35a66159a1a..52de13d65ff5 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown @@ -44,7 +44,7 @@ In addition to the arguments listed above, the following attributes are exported * `internal_ipv6_range` - The ula internal ipv6 range assigned to this network. -* `network_profile` - A full or partial URL of the network profile to apply to this network. +* `network_profile` - [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) A full or partial URL of the network profile to apply to this network. * `subnetworks_self_links` - the list of subnetworks which belong to the network diff --git a/mmv1/third_party/terraform/website/docs/d/dataproc_metastore_service.markdown b/mmv1/third_party/terraform/website/docs/d/dataproc_metastore_service.markdown index b641023555cf..775296585185 100644 --- a/mmv1/third_party/terraform/website/docs/d/dataproc_metastore_service.markdown +++ b/mmv1/third_party/terraform/website/docs/d/dataproc_metastore_service.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Dataproc Metastore" +subcategory: "Dataproc metastore" description: |- Get a Dataproc Metastore Service from Google Cloud --- diff --git a/mmv1/third_party/terraform/website/docs/d/kms_key_handles.html.markdown b/mmv1/third_party/terraform/website/docs/d/kms_key_handles.html.markdown deleted file mode 100644 index 7cc9ac8ba4f5..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/kms_key_handles.html.markdown +++ /dev/null @@ -1,59 +0,0 @@ ---- -subcategory: "Cloud Key Management Service" -description: |- - Provides access to KMS key handle data with Google Cloud KMS. ---- - -# google_kms_key_handles - -Provides access to Google Cloud Platform KMS KeyHandle. A key handle is a Cloud KMS resource that helps you safely span the separation of duties to create new Cloud KMS keys for CMEK using Autokey. - -~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. - -For more information see -[the official documentation](https://cloud.google.com/kms/docs/resource-hierarchy#key_handles) -and -[API](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyHandles/list). - - -## Example Usage - -```hcl -data "google_kms_key_handles" "my_key_handles" { - project = "resource-project-id" - location = "us-central1" - resource_type_selector = "storage.googleapis.com/Bucket" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `location` - (Required) The Google Cloud Platform location for the KeyHandle. - A full list of valid locations can be found by running `gcloud kms locations list`. - -* `resource_type_selector` - (Required) The resource type by which to filter KeyHandle e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types. - -- - - - -* `project` - (Optional) The project in which the resource belongs. If it - is not provided, the provider project is used. - -## Attributes Reference - -In addition to the arguments listed above, the following computed attributes are -exported: - -* `name` - The name of the KeyHandle. Its format is `projects/{projectId}/locations/{location}/keyHandles/{keyHandleName}`. - -* `kms_key` - The identifier of the KMS Key created for the KeyHandle. Its format is `projects/{projectId}/locations/{location}/keyRings/{keyRingName}/cryptoKeys/{cryptoKeyName}`. - -* `location` - The location of the KMS Key and KeyHandle. - -* `project` - The identifier of the project where KMS KeyHandle is created. - -* `resource_type_selector` - Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types. - - diff --git a/mmv1/third_party/terraform/website/docs/d/organizations.html.markdown b/mmv1/third_party/terraform/website/docs/d/organizations.html.markdown deleted file mode 100644 index e2593be8b8e4..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/organizations.html.markdown +++ /dev/null @@ -1,45 +0,0 @@ ---- -subcategory: "Cloud Platform" -description: |- - Get all organizations. ---- - - -# google_organizations - -Gets a list of all organizations. -See [the official documentation](https://cloud.google.com/resource-manager/docs/creating-managing-organization) -and [API](https://cloud.google.com/resource-manager/reference/rest/v1/organizations/search). - -## Example Usage - -```hcl -data "google_organizations" "example" { - filter = "domain:example.com" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `filter` - (Optional) An optional query string used to filter the Organizations to return in the response. Filter rules are case-insensitive. Further information can be found in the [REST API](https://cloud.google.com/resource-manager/reference/rest/v1/organizations/search#request-body). - - -## Attributes Reference - -The following attributes are exported: - -* `organizations` - A list of all retrieved organizations. Structure is [defined below](#nested_organizations). - -The `organizations` block supports: - -* `directory_customer_id` - The Google for Work customer ID of the Organization. - -* `display_name` - A human-readable string that refers to the Organization in the Google Cloud console. The string will be set to the primary domain (for example, `"google.com"`) of the G Suite customer that owns the organization. - -* `lifecycle_state` - The Organization's current lifecycle state. - -* `name` - The resource name of the Organization in the form `organizations/{organization_id}`. - -* `org_id` - The Organization ID. diff --git a/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter.html.markdown b/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter.html.markdown deleted file mode 100644 index 059b7c9f62f3..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -subcategory: "Parameter Manager" -description: |- - Get information about a Parameter Manager Parameter. ---- - -# google_parameter_manager_parameter - -Use this data source to get information about a Parameter Manager Parameter. - -~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta datasources. - -## Example Usage - -```hcl -data "google_parameter_manager_parameter" "parameter_datasource" { - parameter_id = "foobar" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `parameter_id` - (required) The name of the parameter. - -* `project` - (optional) The ID of the project in which the resource belongs. - -## Attributes Reference -See [google_parameter_manager_parameter](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/parameter_manager_parameter) resource for details of all the available attributes. diff --git a/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter_version.html.markdown b/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter_version.html.markdown deleted file mode 100644 index 71e39b2397f4..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter_version.html.markdown +++ /dev/null @@ -1,48 +0,0 @@ ---- -subcategory: "Parameter Manager" -description: |- - Get information about an Parameter Manager Parameter Version ---- - -# google_parameter_manager_parameter_version - -Get the value and metadata from a Parameter Manager Parameter version. For more information see the [official documentation](https://cloud.google.com/secret-manager/parameter-manager/docs/overview) and [API](https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters.versions). - -~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta datasources. - -## Example Usage - -```hcl -data "google_parameter_manager_parameter_version" "basic" { - parameter = "test-parameter" - parameter_version_id = "test-parameter-version" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `project` - (Optional) The project for retrieving the Parameter Version. If it's not specified, - the provider project will be used. - -* `parameter` - (Required) The parameter for obtaining the Parameter Version. - This can be either the reference of the parameter as in `projects/{{project}}/locations/global/parameters/{{parameter_id}}` or only the name of the parameter as in `{{parameter_id}}`. - -* `parameter_version_id` - (Required) The version of the parameter to get. - -## Attributes Reference - -The following attributes are exported: - -* `parameter_data` - The parameter data. - -* `name` - The resource name of the ParameterVersion. Format: - `projects/{{project}}/locations/global/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` - -* `create_time` - The time at which the Parameter Version was created. - -* `update_time` - The time at which the Parameter Version was last updated. - -* `disabled` - The current state of the Parameter Version. diff --git a/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter_version_render.html.markdown b/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter_version_render.html.markdown deleted file mode 100644 index 5c5c466f6dfe..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameter_version_render.html.markdown +++ /dev/null @@ -1,46 +0,0 @@ ---- -subcategory: "Parameter Manager" -description: |- - Get information about an Parameter Manager Parameter Version Render ---- - -# google_parameter_manager_parameter_version_render - -Get the value and metadata from a Parameter Manager Parameter version with render payload data. For this datasource to work as expected, the principal of the parameter must be provided with the [Secret Manager Secret Accessor](https://cloud.google.com/secret-manager/docs/access-control#secretmanager.secretAccessor) role. For more information see the [official documentation](https://cloud.google.com/secret-manager/parameter-manager/docs/overview) and [API](https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters.versions/render). - -~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta datasources. - -## Example Usage - -```hcl -data "google_parameter_manager_parameter_version_render" "basic" { - parameter = "test-parameter" - parameter_version_id = "test-parameter-version" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `project` - (Optional) The project for retrieving the Parameter Version. If it's not specified, - the provider project will be used. - -* `parameter` - (Required) The Parameter for obtaining the Parameter Version. - This can be either the reference of the parameter as in `projects/{{project}}/locations/global/parameters/{{parameter_id}}` or only the name of the parameter as in `{{parameter_id}}`. - -* `parameter_version_id` - (Required) The version of the parameter to get. - -## Attributes Reference - -The following attributes are exported: - -* `parameter_data` - The Parameter data. - -* `render_parameter_data` - The Rendered Parameter Data specifies that if you use `__REF__()` to reference a secret and the format is JSON or YAML, the placeholder `__REF__()` will be replaced with the actual secret value. However, if the format is UNFORMATTED, it will stay the same as the original `parameter_data`. - -* `name` - The resource name of the ParameterVersion. Format: - `projects/{{project}}/locations/global/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` - -* `disabled` - The current state of the Parameter Version. diff --git a/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameters.html.markdown b/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameters.html.markdown deleted file mode 100644 index 3e8db95aaf9a..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/parameter_manager_parameters.html.markdown +++ /dev/null @@ -1,63 +0,0 @@ ---- -subcategory: "Parameter Manager" -description: |- - List the Parameter Manager Parameters. ---- - -# google_parameter_manager_parameters - -Use this data source to list the Parameter Manager Parameters. - -~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta datasources. - -## Example Usage - -```hcl -data "google_parameter_manager_parameters" "parameters" { -} -``` - -## Argument Reference - -The following arguments are supported: - -* `project` - (optional) The ID of the project. - -* `filter` - (optional) Filter string, adhering to the rules in List-operation filtering. List only parameters matching the filter. If filter is empty, all parameters are listed. - -## Attributes Reference - -In addition to the arguments listed above, the following computed attributes are -exported: - -* `parameters` - A list of parameters matching the filter. Structure is [defined below](#nested_parameters). - -The `parameters` block supports: - -* `format` - The format type of the parameter. - -* `labels` - The labels assigned to the parameter. - -* `create_time` - The time at which the parameter was created. - -* `update_time` - The time at which the parameter was updated. - -* `project` - The ID of the project in which the resource belongs. - -* `parameter_id` - The unique name of the resource. - -* `name` - The resource name of the parameter. Format: `projects/{{project}}/locations/global/parameters/{{parameter_id}}` - -* `policy_member` - An object containing a unique resource identity tied to the parameter. Structure is [documented below](#nested_policy_member). - -The `policy_member` block contains: - -* `iam_policy_uid_principal` - IAM policy binding member referring to a Google Cloud resource by system-assigned unique identifier. -If a resource is deleted and recreated with the same name, the binding will not be applicable to the -new resource. Format: -`principal://parametermanager.googleapis.com/projects/{{project}}/uid/locations/global/parameters/{{uid}}` - -* `iam_policy_name_principal` - AM policy binding member referring to a Google Cloud resource by user-assigned name. If a resource is deleted and recreated with the same name, the binding will be applicable to the -new resource. Format: -`principal://parametermanager.googleapis.com/projects/{{project}}/name/locations/global/parameters/{{parameter_id}}` \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter.html.markdown b/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter.html.markdown deleted file mode 100644 index 32be5c827f36..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter.html.markdown +++ /dev/null @@ -1,34 +0,0 @@ ---- -subcategory: "Parameter Manager" -description: |- - Get information about a Parameter Manager Regional Parameter. ---- - -# google_parameter_manager_regional_parameter - -Use this data source to get information about a Parameter Manager Regional Parameter. - -~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta datasources. - -## Example Usage - -```hcl -data "google_parameter_manager_regional_parameter" "reg_parameter_datasource" { - parameter_id = "foobar" - location = "us-central1" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `parameter_id` - (required) The name of the regional parameter. - -* `location` - (required) The location of the regional parameter. eg us-central1 - -* `project` - (optional) The ID of the project in which the resource belongs. - -## Attributes Reference -See [google_parameter_manager_regional_parameter](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/parameter_manager_regional_parameter) resource for details of all the available attributes. diff --git a/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter_version.html.markdown b/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter_version.html.markdown deleted file mode 100644 index ee933ef9ebed..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter_version.html.markdown +++ /dev/null @@ -1,52 +0,0 @@ ---- -subcategory: "Parameter Manager" -description: |- - Get information about an Parameter Manager Regional Parameter Version ---- - -# google_parameter_manager_regional_parameter_version - -Get the value and metadata from a Parameter Manager Regional Parameter version. For more information see the [official documentation](https://cloud.google.com/secret-manager/parameter-manager/docs/overview) and [API](https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters.versions). - -~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta datasources. - -## Example Usage - -```hcl -data "google_parameter_manager_regional_parameter_version" "basic" { - parameter = "test-regional-parameter" - parameter_version_id = "test-regional-parameter-version" - location = "us-central1" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `project` - (Optional) The project for retrieving the Regional Parameter Version. If it's not specified, - the provider project will be used. - -* `parameter` - (Required) The parameter for obtaining the Regional Parameter Version. - This can be either the reference of the regional parameter as in `projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}` or only the name of the regional parameter as in `{{parameter_id}}`. - -* `parameter_version_id` - (Required) The version of the regional parameter to get. - -* `location` - (Optional) The location of regional parameter. - - -## Attributes Reference - -The following attributes are exported: - -* `parameter_data` - The regional parameter data. - -* `name` - The resource name of the Regional Parameter Version. Format: - `projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` - -* `create_time` - The time at which the Regional Parameter Version was created. - -* `update_time` - The time at which the Regional Parameter Version was last updated. - -* `disabled` - The current state of the Regional Parameter Version. diff --git a/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter_version_render.html.markdown b/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter_version_render.html.markdown deleted file mode 100644 index 4aa77ee42d3f..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameter_version_render.html.markdown +++ /dev/null @@ -1,52 +0,0 @@ ---- -subcategory: "Parameter Manager" -description: |- - Get information about an Parameter Manager Regional Parameter Version with Rendered Payload Data. ---- - -# google_parameter_manager_regional_parameter_version_render - -Get the value and metadata from a Parameter Manager Regional Parameter version with rendered payload data. For this datasource to work as expected, the principal of the parameter must be provided with the [Secret Manager Secret Accessor](https://cloud.google.com/secret-manager/docs/access-control#secretmanager.secretAccessor) role. For more information see the [official documentation](https://cloud.google.com/secret-manager/parameter-manager/docs/overview) and [API](https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters.versions/render). - -~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta datasources. - -~> **Warning:** To use this data source, we must grant the `Secret Manager Secret Accessor` role to the principal of the parameter. Please note that it can take up to 7 minutes for the role to take effect. Hence, we might need to wait approximately 7 minutes after granting `Secret Manager Secret Accessor` role to the principal of the parameter. For more information see the [access change propagation documentation](https://cloud.google.com/iam/docs/access-change-propagation). - -## Example Usage - -```hcl -data "google_parameter_manager_regional_parameter_version_render" "basic" { - parameter = "test-regional-parameter" - parameter_version_id = "test-regional-parameter-version" - location = "us-central1" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `project` - (Optional) The project for retrieving the Regional Parameter Version. If it's not - specified, the provider project will be used. - -* `parameter` - (Required) The Parameter for obtaining the Regional Parameter Version. - This can be either the reference of the parameter as in `projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}` or only the name of the parameter as in `{{parameter_id}}`. - -* `location` - (Optional) Location of Parameter Manager regional Parameter resource. - It must be provided when the `parameter` field provided consists of only the name of the regional parameter. - -* `parameter_version_id` - (Required) The version of the regional parameter to get. - -## Attributes Reference - -The following attributes are exported: - -* `parameter_data` - The Parameter data. - -* `render_parameter_data` - The Rendered Parameter Data specifies that if you use `__REF__()` to reference a secret and the format is JSON or YAML, the placeholder `__REF__()` will be replaced with the actual secret value. However, if the format is UNFORMATTED, it will stay the same as the original `parameter_data`. - -* `name` - The resource name of the RegionalParameterVersion. Format: - `projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` - -* `disabled` - The current state of the Regional Parameter Version. diff --git a/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameters.html.markdown b/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameters.html.markdown deleted file mode 100644 index 4ab44990f5ef..000000000000 --- a/mmv1/third_party/terraform/website/docs/d/parameter_manager_regional_parameters.html.markdown +++ /dev/null @@ -1,67 +0,0 @@ ---- -subcategory: "Parameter Manager" -description: |- - List the Parameter Manager Regional Parameters. ---- - -# google_parameter_manager_regional_parameters - -Use this data source to list the Parameter Manager Regional Parameters - -~> **Warning:** This datasource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta datasources. - -## Example Usage - -```hcl -data "google_parameter_manager_regional_parameters" "regional-parameters" { - location = "us-central1" -} -``` - -## Argument Reference - -The following arguments are supported: - -- `project` - (optional) The ID of the project. - -- `filter` - (optional) Filter string, adhering to the rules in List-operation filtering. List only parameters matching the filter. If filter is empty, all regional parameters are listed. - -- `location` - (Required) The location of regional parameter. - - -## Attributes Reference - -In addition to the arguments listed above, the following computed attributes are -exported: - -- `parameters` - A list of regional parameters matching the filter. Structure is [defined below](#nested_parameters). - -The `parameters` block supports: - -- `format` - The format type of the regional parameter. - -- `labels` - The labels assigned to the regional parameter. - -- `create_time` - The time at which the regional parameter was created. - -- `update_time` - The time at which the regional parameter was updated. - -- `project` - The ID of the project in which the resource belongs. - -- `parameter_id` - The unique name of the resource. - -- `name` - The resource name of the regional parameter. Format: `projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}` - -- `policy_member` - An object containing a unique resource identity tied to the regional parameter. Structure is [documented below](#nested_policy_member). - -The `policy_member` block contains: - -* `iam_policy_uid_principal` - IAM policy binding member referring to a Google Cloud resource by system-assigned unique identifier. -If a resource is deleted and recreated with the same name, the binding will not be applicable to the -new resource. Format: -`principal://parametermanager.googleapis.com/projects/{{project}}/uid/locations/{{location}}/parameters/{{uid}}` - -* `iam_policy_name_principal` - AM policy binding member referring to a Google Cloud resource by user-assigned name. If a resource is deleted and recreated with the same name, the binding will be applicable to the -new resource. Format: -`principal://parametermanager.googleapis.com/projects/{{project}}/name/locations/{{location}}/parameters/{{parameter_id}}` \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/d/service_accounts.html.markdown b/mmv1/third_party/terraform/website/docs/d/service_accounts.html.markdown index 5b1b2ad2997c..f263c41cd681 100644 --- a/mmv1/third_party/terraform/website/docs/d/service_accounts.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/service_accounts.html.markdown @@ -13,7 +13,7 @@ and [API](https://cloud.google.com/iam/docs/reference/rest/v1/projects.serviceAc ## Example Usage -Get all service accounts from a project +Example service accounts. ```hcl data "google_service_accounts" "example" { @@ -21,40 +21,12 @@ data "google_service_accounts" "example" { } ``` -Get all service accounts that are prefixed with `"foo"` - -```hcl -data "google_service_accounts" "foo" { - prefix = "foo" -} -``` - -Get all service accounts that contain `"bar"` - -```hcl -data "google_service_accounts" "bar" { - regex = ".*bar.*" -} -``` - -Get all service accounts that are prefixed with `"foo"` and contain `"bar"` - -```hcl -data "google_service_accounts" "foo_bar" { - prefix = "foo" - regex = ".*bar.*" -} -``` - ## Argument Reference The following arguments are supported: -* `prefix` - (Optional) A prefix for filtering. It's applied with the `account_id`. - * `project` - (Optional) The ID of the project. If it is not provided, the provider project is used. -* `regex` - (Optional) A regular expression for filtering. It's applied with the `email`. Further information about the syntax can be found [here](https://github.com/google/re2/wiki/Syntax). ## Attributes Reference diff --git a/mmv1/third_party/terraform/website/docs/d/storage_bucket_object_content.html.markdown b/mmv1/third_party/terraform/website/docs/d/storage_bucket_object_content.html.markdown index 86b4eae308d3..0d36abc9aca2 100644 --- a/mmv1/third_party/terraform/website/docs/d/storage_bucket_object_content.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/storage_bucket_object_content.html.markdown @@ -41,4 +41,4 @@ The following arguments are supported: The following attributes are exported: -* `content` - (Computed) The content of the object. +* `content` - (Computed) [Content-Language](https://tools.ietf.org/html/rfc7231#section-3.1.3.2) of the object content. diff --git a/mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown b/mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown index 221c87b69efe..b2e6fbc392bf 100644 --- a/mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/provider_reference.html.markdown @@ -181,23 +181,19 @@ variable. ## Quota Management Configuration -* `user_project_override` - (Optional) Defaults to `false`. Controls the -[quota project](https://cloud.google.com/docs/quotas/quota-project) used -in requests to GCP APIs for the purpose of preconditions, quota, and -billing. If `false`, the quota project is determined by the API and may -be the project associated with your credentials for a -[client-based API](https://cloud.google.com/docs/quotas/quota-project#project-client-based), -or the resource project for a -[resource-based API](https://cloud.google.com/docs/quotas/quota-project#project-resource-based). -If `true`, most resources in the provider will explicitly supply their resource -project, as described in their documentation. Otherwise, a `billing_project` -value must be supplied. Alternatively, this can be specified using the -`USER_PROJECT_OVERRIDE` environment variable. +* `user_project_override` - (Optional) Defaults to `false`. Controls the quota +project used in requests to GCP APIs for the purpose of preconditions, quota, +and billing. If `false`, the quota project is determined by the API and may be +the project associated with your credentials, or the resource project. If `true`, +most resources in the provider will explicitly supply their resource project, as +described in their documentation. Otherwise, a `billing_project` value must be +supplied. Alternatively, this can be specified using the `USER_PROJECT_OVERRIDE` +environment variable. Service account credentials are associated with the project the service account was created in. Credentials that come from the gcloud tool are associated with a project owned by Google. In order to properly use credentials that come from -gcloud with Terraform, it is recommended to set this property to `true`. +gcloud with Terraform, it is recommended to set this property to true. `user_project_override` uses the `X-Goog-User-Project` [system parameter](https://cloud.google.com/apis/docs/system-parameters). When diff --git a/mmv1/third_party/terraform/website/docs/guides/sql_instance_switchover.html.markdown b/mmv1/third_party/terraform/website/docs/guides/sql_instance_switchover.html.markdown index eaa817f0de0c..07623519a9ed 100644 --- a/mmv1/third_party/terraform/website/docs/guides/sql_instance_switchover.html.markdown +++ b/mmv1/third_party/terraform/website/docs/guides/sql_instance_switchover.html.markdown @@ -7,7 +7,7 @@ description: |- # Performing a SQL Instance Switchover This page is a brief walkthrough of performing a switchover through terraform. -## SQL Server + ~> **NOTE:** Only supported for SQL Server. 1. Create a **cross-region** primary and cascadable replica. It is recommended to use deletion_protection to prevent accidental deletions. ``` @@ -83,405 +83,4 @@ resource "google_sql_database_instance" "original-primary" { - `terraform plan` does not say **"must be replaced"** for any resource - Every resource **"will be updated in-place"** - Only the 2 instances involved in switchover have planned changes -- (Recommended) Use `deletion_protection` on instances as a safety measure - -## MySQL - -1. Create a **cross-region, Enterprise Plus edition** primary and replica. The primary should have backup and binary log enabled. - -``` -resource "google_sql_database_instance" "original-primary" { - project = "your-project" - name = "your-original-primary" - # Can be any region. - region = "us-east1" - # Any database version that supports Enterprise Plus edition. - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - - settings { - # Any tier that supports Enterprise Plus edition. - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } - - # You can add more settings. -} - -resource "google_sql_database_instance" "original-replica" { - project = "your-project" - name = "your-original-replica" - # Can be any region, but must be different from the primary's region. - region = "us-west2" - # Must be same as the primary's database_version. - database_version = "MYSQL_8_0" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = google_sql_database_instance.original-primary.name - - settings { - # Any tier that supports Enterprise Plus edition. - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } - - # You can add more settings. -} -``` - -2. Designate the replica as DR replica of the primary by adding `replication_cluster.failover_dr_replica_name`. -```diff -resource "google_sql_database_instance" "original-primary" { - project = "your-project" - name = "your-original-primary" - region = "us-east1" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - -+ replication_cluster { -+ # Note that the format of the name is "project:instance". -+ # If you want to unset DR replica, put empty string in this field. -+ failover_dr_replica_name = "your-project:your-original-replica" -+ } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "your-project" - name = "your-original-replica" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = "your-original-primary" - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } -} -``` - -3. Invoke switchover on the original replica. - -* Change `instance_type` from `READ_REPLICA_INSTANCE` to `CLOUD_SQL_INSTANCE`. -* Remove `master_instance_name`. -* Add original primary's name to the original replica's `replica_names` list and `replication_cluster.failover_dr_replica_name`. -* Enable backup and binary log for original replica. - -```diff -resource "google_sql_database_instance" "original-primary" { - project = "your-project" - name = "your-original-primary" - region = "us-east1" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - - replication_cluster { - failover_dr_replica_name = "your-project:your-original-replica" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "your-project" - name = "your-original-replica" - region = "us-west2" - database_version = "MYSQL_8_0" -- instance_type = "READ_REPLICA_INSTANCE" -+ instance_type = "CLOUD_SQL_INSTANCE" -- master_instance_name = "your-original-primary" -+ replica_names = ["your-original-primary"] - -+ replication_cluster { -+ failover_dr_replica_name = "your-project:your-original-primary" -+ } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" -+ backup_configuration { -+ enabled = true -+ binary_log_enabled = true -+ } - } -} -``` - -4. Update the original primary and run `terraform plan`. -* Change `instance_type` from `CLOUD_SQL_INSTANCE` to `READ_REPLICA_INSTANCE`. -* Set `master_instance_name` to the new primary (original replica). -* (If `replica_names` is present) Remove original replica from `replica_names`. - * **NOTE**: Do **not** delete the `replica_names` field, even if it has no replicas remaining. Set `replica_names = [ ]` to indicate it having no replicas. -* Remove original replica from `replication_cluster.failover_dr_replica_name` by setting this field to the empty string. -* Disable backup for original primary (because it became a replica). -* Run `terraform plan` and verify that your configuration matches infrastructure. You should see a message like the following: - * **`No changes. Your infrastructure matches the configuration.`** - -```diff -resource "google_sql_database_instance" "original-primary" { - project = "your-project" - name = "your-original-primary" - region = "us-east1" - database_version = "MYSQL_8_0" -- instance_type = "CLOUD_SQL_INSTANCE" -+ instance_type = "READ_REPLICA_INSTANCE" -+ master_instance_name = "your-original-replica" - - replication_cluster { -- failover_dr_replica_name = "your-project:your-original-replica" -+ failover_dr_replica_name = "" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { -- enabled = true -+ enabled = false - binary_log_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "your-project" - name = "your-original-replica" - region = "us-west2" - database_version = "MYSQL_8_0" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = ["your-original-primary"] - - replication_cluster { - failover_dr_replica_name = "your-project:your-original-primary" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - binary_log_enabled = true - } - } -} -``` - -## PostgreSQL - -1. Create a **cross-region, Enterprise Plus edition** primary and replica. The primary should have backup and PITR enabled. - -``` -resource "google_sql_database_instance" "original-primary" { - project = "your-project" - name = "your-original-primary" - # Can be any region. - region = "us-east1" - # Any database version that supports Enterprise Plus edition. - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - - settings { - # Any tier that supports Enterprise Plus edition. - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } - - # You can add more settings. -} - -resource "google_sql_database_instance" "original-replica" { - project = "your-project" - name = "your-original-replica" - # Can be any region, but must be different from the primary's region. - region = "us-west2" - # Must be same as the primary's database_version. - database_version = "POSTGRES_12" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = google_sql_database_instance.original-primary.name - - settings { - # Any tier that supports Enterprise Plus edition. - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } - - # You can add more settings. -} -``` - -2. Designate the replica as DR replica of the primary by adding `replication_cluster.failover_dr_replica_name`. -```diff -resource "google_sql_database_instance" "original-primary" { - project = "your-project" - name = "your-original-primary" - region = "us-east1" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - -+ replication_cluster { -+ # Note that the format of the name is "project:instance". -+ # If you want to unset DR replica, put empty string in this field. -+ failover_dr_replica_name = "your-project:your-original-replica" -+ } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "your-project" - name = "your-original-replica" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "READ_REPLICA_INSTANCE" - master_instance_name = "your-original-primary" - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - } -} -``` - -3. Invoke switchover on the original replica. - -* Change `instance_type` from `READ_REPLICA_INSTANCE` to `CLOUD_SQL_INSTANCE`. -* Remove `master_instance_name`. -* Add original primary's name to the original replica's `replica_names` list and `replication_cluster.failover_dr_replica_name`. -* Enable backup and PITR for original replica. - -```diff -resource "google_sql_database_instance" "original-primary" { - project = "your-project" - name = "your-original-primary" - region = "us-east1" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - - replication_cluster { - failover_dr_replica_name = "your-project:your-original-replica" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "your-project" - name = "your-original-replica" - region = "us-west2" - database_version = "POSTGRES_12" -- instance_type = "READ_REPLICA_INSTANCE" -+ instance_type = "CLOUD_SQL_INSTANCE" -- master_instance_name = "your-original-primary" -+ replica_names = ["your-original-primary"] - -+ replication_cluster { -+ failover_dr_replica_name = "your-project:your-original-primary" -+ } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" -+ backup_configuration { -+ enabled = true -+ point_in_time_recovery_enabled = true -+ } - } -} -``` - -4. Update the original primary and run `terraform plan`. -* Change `instance_type` from `CLOUD_SQL_INSTANCE` to `READ_REPLICA_INSTANCE`. -* Set `master_instance_name` to the new primary (original replica). -* (If `replica_names` is present) Remove original replica from `replica_names`. - * **NOTE**: Do **not** delete the `replica_names` field, even if it has no replicas remaining. Set `replica_names = [ ]` to indicate it having no replicas. -* Remove original replica from `replication_cluster.failover_dr_replica_name` by setting this field to the empty string. -* Disable backup and PITR for original primary (because it became a replica). -* Run `terraform plan` and verify that your configuration matches infrastructure. You should see a message like the following: - * **`No changes. Your infrastructure matches the configuration.`** - -```diff -resource "google_sql_database_instance" "original-primary" { - project = "your-project" - name = "your-original-primary" - region = "us-east1" - database_version = "POSTGRES_12" -- instance_type = "CLOUD_SQL_INSTANCE" -+ instance_type = "READ_REPLICA_INSTANCE" -+ master_instance_name = "your-original-replica" - - replication_cluster { -- failover_dr_replica_name = "your-project:your-original-replica" -+ failover_dr_replica_name = "" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { -- enabled = true -+ enabled = false -- point_in_time_recovery_enabled = true -+ point_in_time_recovery_enabled = false - } - } -} - -resource "google_sql_database_instance" "original-replica" { - project = "your-project" - name = "your-original-replica" - region = "us-west2" - database_version = "POSTGRES_12" - instance_type = "CLOUD_SQL_INSTANCE" - replica_names = ["your-original-primary"] - - replication_cluster { - failover_dr_replica_name = "your-project:your-original-primary" - } - - settings { - tier = "db-perf-optimized-N-2" - edition = "ENTERPRISE_PLUS" - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - } -} -``` +- (Recommended) Use `deletion_protection` on instances as a safety measure \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/r/apigee_api.html.markdown b/mmv1/third_party/terraform/website/docs/r/apigee_api.html.markdown index 6193bf056d3f..ad9130bb7d26 100644 --- a/mmv1/third_party/terraform/website/docs/r/apigee_api.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/apigee_api.html.markdown @@ -30,8 +30,8 @@ data "archive_file" "bundle" { output_file_mode = "0644" } -resource "google_apigee_api" "api_proxy" { - name = "proxy1" +resource "google_apigee_sharedflow" "sharedflow" { + name = "shareflow1" org_id = var.org_id config_bundle = data.archive_file.bundle.output_path } diff --git a/mmv1/third_party/terraform/website/docs/r/bigquery_table.html.markdown b/mmv1/third_party/terraform/website/docs/r/bigquery_table.html.markdown index 41e290a486df..0a4893bed884 100644 --- a/mmv1/third_party/terraform/website/docs/r/bigquery_table.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/bigquery_table.html.markdown @@ -143,11 +143,6 @@ The following arguments are supported: with `external_data_configuration.schema`. Otherwise, schemas must be specified with this top-level field. -* `schema_foreign_type_info` - (Optional, [Beta] -(https://terraform.io/docs/providers/google/guides/provider_versions.html)) - Specifies metadata of the foreign data type definition in field schema. - Structure is [documented below](#nested_schema_foreign_type_info). - * `time_partitioning` - (Optional) If specified, configures time-based partitioning for this table. Structure is [documented below](#nested_time_partitioning). @@ -185,8 +180,7 @@ The following arguments are supported: globally unique. Tag key is expected to be in the namespaced format, for example "123456789012/environment" where 123456789012 is the ID of the parent organization or project resource for this tag key. Tag value is - expected to be the short name, for example "Production". See [Tag definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) - for more details. + expected to be the short name, for example "Production". * `external_catalog_table_options` - (Optional, [Beta] (https://terraform.io/docs/providers/google/guides/provider_versions.html)) @@ -380,12 +374,6 @@ The following arguments are supported: * `enable_list_inference` - (Optional) Indicates whether to use schema inference specifically for Parquet LIST logical type. -The `schema_foreign_type_info` block supports: - -* `type_system` - (Required, [Beta] -(https://terraform.io/docs/providers/google/guides/provider_versions.html)) - Specifies the system which defines the foreign data type. - The `time_partitioning` block supports: * `expiration_ms` - (Optional) Number of milliseconds for which to keep the diff --git a/mmv1/third_party/terraform/website/docs/r/compute_firewall_policy.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_firewall_policy.html.markdown new file mode 100644 index 000000000000..d1636b4d5600 --- /dev/null +++ b/mmv1/third_party/terraform/website/docs/r/compute_firewall_policy.html.markdown @@ -0,0 +1,107 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: DCL *** +# +# ---------------------------------------------------------------------------- +# +# This file is managed by Magic Modules (https:#github.com/GoogleCloudPlatform/magic-modules) +# and is based on the DCL (https:#github.com/GoogleCloudPlatform/declarative-resource-client-library). +# Changes will need to be made to the DCL or Magic Modules instead of here. +# +# We are not currently able to accept contributions to this file. If changes +# are required, please file an issue at https:#github.com/hashicorp/terraform-provider-google/issues/new/choose +# +# ---------------------------------------------------------------------------- +subcategory: "Compute Engine" +description: |- + Creates a hierarchical firewall policy +--- + +# google_compute_firewall_policy + +Hierarchical firewall policy rules let you create and enforce a consistent firewall policy across your organization. Rules can explicitly allow or deny connections or delegate evaluation to lower level policies. Policies can be created within organizations or folders. + +This resource should be generally be used with `google_compute_firewall_policy_association` and `google_compute_firewall_policy_rule` + +For more information see the [official documentation](https://cloud.google.com/vpc/docs/firewall-policies) + +## Example Usage + +```hcl +resource "google_compute_firewall_policy" "default" { + parent = "organizations/12345" + short_name = "my-policy" + description = "Example Resource" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `parent` - + (Required) + The parent of the firewall policy. + +* `short_name` - + (Required) + User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + + + +- - - + +* `description` - + (Optional) + An optional description of this resource. Provide this property when you create the resource. + + + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + +* `id` - an identifier for the resource with format `locations/global/firewallPolicies/{{name}}` + +* `creation_timestamp` - + Creation timestamp in RFC3339 text format. + +* `fingerprint` - + Fingerprint of the resource. This field is used internally during updates of this resource. + +* `id` - + The unique identifier for the resource. This identifier is defined by the server. + +* `name` - + Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy. + +* `rule_tuple_count` - + Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples. + +* `self_link` - + Server-defined URL for the resource. + +* `self_link_with_id` - + Server-defined URL for this resource with the resource id. + +## Timeouts + +This resource provides the following +[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: configuration options: + +- `create` - Default is 20 minutes. +- `update` - Default is 20 minutes. +- `delete` - Default is 20 minutes. + +## Import + +FirewallPolicy can be imported using any of these accepted formats: + +``` +$ terraform import google_compute_firewall_policy.default locations/global/firewallPolicies/{{name}} +$ terraform import google_compute_firewall_policy.default {{name}} +``` + + + diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown index 0c1854455d04..1fddef270915 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown @@ -397,7 +397,7 @@ is desired, you will need to modify your state file manually using array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range). -* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, IDPF, MRDMA, IRDMA. +* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, IDPF. In the beta provider the additional values of MRDMA and IRDMA are supported. * `network_attachment` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) The URL of the network attachment that this interface should connect to in the following format: `projects/{projectNumber}/regions/{region_name}/networkAttachments/{network_attachment_name}`. @@ -505,25 +505,6 @@ specified, then this instance will have no external IPv6 Internet access. Struct * `maintenance_interval` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) Specifies the frequency of planned maintenance events. The accepted values are: `PERIODIC`. * `local_ssd_recovery_timeout` - (Optional) (https://terraform.io/docs/providers/google/guides/provider_versions.html) Specifies the maximum amount of time a Local Ssd Vm should wait while recovery of the Local Ssd state is attempted. Its value should be in between 0 and 168 hours with hour granularity and the default value being 1 hour. Structure is [documented below](#nested_local_ssd_recovery_timeout). - -* `graceful_shutdown` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) Settings for the instance to perform a graceful shutdown. Structure is [documented below](#nested_graceful_shutdown). - -The `graceful_shutdown` block supports: - -* `enabled` - (Required) Opts-in for graceful shutdown. - -* `max_duration` (Optional) The time allotted for the instance to gracefully shut down. - If the graceful shutdown isn't complete after this time, then the instance - transitions to the STOPPING state. Structure is documented below: - - * `nanos` - (Optional) Span of time that's a fraction of a second at nanosecond - resolution. Durations less than one second are represented with a 0 - `seconds` field and a positive `nanos` field. Must be from 0 to - 999,999,999 inclusive. - - * `seconds` - (Required) Span of time at a resolution of a second. - The value must be between 1 and 3600, which is 3,600 seconds (one hour).` - The `local_ssd_recovery_timeout` block supports: * `nanos` - (Optional) Span of time that's a fraction of a second at nanosecond diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown index 5740d8b01b4d..efe4969eb92a 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown @@ -331,9 +331,6 @@ The following arguments are supported: To create a machine with a [custom type](https://cloud.google.com/dataproc/docs/concepts/compute/custom-machine-types) (such as extended memory), format the value like `custom-VCPUS-MEM_IN_MB` like `custom-6-20480` for 6 vCPU and 20GB of RAM. - More advanced machine types like [z3](https://cloud.google.com/compute/docs/storage-optimized-machines) will - create disks that cannot be managed by Terraform by default. You can account for that by using `lifecycle.ignore_changes` or adding these disks into your config. - - - - * `name` - (Optional) The name of the instance template. If you leave this blank, Terraform will auto-generate a unique name. @@ -564,7 +561,7 @@ The following arguments are supported: array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range). -* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, MRDMA, IRDMA. +* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. In the beta provider the additional values of MRDMA and IRDMA are supported. * `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6, IPV6_ONLY or IPV4_ONLY. If not specified, IPV4_ONLY will be used. @@ -653,25 +650,6 @@ specified, then this instance will have no external IPv6 Internet access. Struct * `maintenance_interval` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) Specifies the frequency of planned maintenance events. The accepted values are: `PERIODIC`. * `local_ssd_recovery_timeout` - (Optional) (https://terraform.io/docs/providers/google/guides/provider_versions.html) Specifies the maximum amount of time a Local Ssd Vm should wait while recovery of the Local Ssd state is attempted. Its value should be in between 0 and 168 hours with hour granularity and the default value being 1 hour. Structure is [documented below](#nested_local_ssd_recovery_timeout). - -* `graceful_shutdown` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) Settings for the instance to perform a graceful shutdown. Structure is [documented below](#nested_graceful_shutdown). - -The `graceful_shutdown` block supports: - -* `enabled` - (Required) Opts-in for graceful shutdown. - -* `max_duration` (Optional) The time allotted for the instance to gracefully shut down. - If the graceful shutdown isn't complete after this time, then the instance - transitions to the STOPPING state. Structure is documented below: - - * `nanos` - (Optional) Span of time that's a fraction of a second at nanosecond - resolution. Durations less than one second are represented with a 0 - `seconds` field and a positive `nanos` field. Must be from 0 to - 999,999,999 inclusive. - - * `seconds` - (Required) Span of time at a resolution of a second. - The value must be between 1 and 3600, which is 3,600 seconds (one hour).` - The `local_ssd_recovery_timeout` block supports: * `nanos` - (Optional) Span of time that's a fraction of a second at nanosecond diff --git a/mmv1/third_party/terraform/website/docs/r/compute_project_metadata_item.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_project_metadata_item.html.markdown index ff0556f2663f..3c624d8fcd3c 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_project_metadata_item.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_project_metadata_item.html.markdown @@ -44,13 +44,12 @@ In addition to the arguments listed above, the following computed attributes are Project metadata items can be imported using the `key`, e.g. * `{{key}}` -* `projects/{{project}}/meta-data/{{key}}` In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import project metadata items using one of the formats above. For example: ```tf import { - id = "projects/{{project}}/meta-data/{{key}}" + id = "{{key}}" to = google_compute_project_metadata_item.default } ``` @@ -59,7 +58,6 @@ When using the [`terraform import` command](https://developer.hashicorp.com/terr ``` $ terraform import google_compute_project_metadata_item.default {{key}} -$ terraform import google_compute_project_metadata_item.default projects/{{project}}/meta-data/{{key}} ``` ## Timeouts diff --git a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown index d73982e63aeb..908b5362a54f 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown @@ -527,7 +527,7 @@ The following arguments are supported: array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range). -* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, MRDMA, IRDMA. +* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. In the beta provider the additional values of MRDMA and IRDMA are supported. * `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6, IPV6_ONLY or IPV4_ONLY. If not specified, IPV4_ONLY will be used. @@ -636,24 +636,6 @@ specified, then this instance will have no external IPv6 Internet access. Struct 315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years. -* `graceful_shutdown` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) Settings for the instance to perform a graceful shutdown. Structure is [documented below](#nested_graceful_shutdown). - -The `graceful_shutdown` block supports: - -* `enabled` - (Required) Opts-in for graceful shutdown. - -* `max_duration` (Optional) The time allotted for the instance to gracefully shut down. - If the graceful shutdown isn't complete after this time, then the instance - transitions to the STOPPING state. Structure is documented below: - - * `nanos` - (Optional) Span of time that's a fraction of a second at nanosecond - resolution. Durations less than one second are represented with a 0 - `seconds` field and a positive `nanos` field. Must be from 0 to - 999,999,999 inclusive. - - * `seconds` - (Required) Span of time at a resolution of a second. - The value must be between 1 and 3600, which is 3,600 seconds (one hour).` - The `guest_accelerator` block supports: * `type` (Required) - The accelerator type resource to expose to this instance. E.g. `nvidia-tesla-k80`. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_router_peer.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_router_peer.html.markdown index 6cca69ef1193..2f818307c962 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_router_peer.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_router_peer.html.markdown @@ -68,34 +68,6 @@ resource "google_compute_router_peer" "peer" { } } ``` -## Example Usage - Router Zero Custom Learend Route Priority - - -```hcl -resource "google_compute_router_peer" "peer" { - name = "my-router-peer" - router = "my-router" - region = "us-central1" - interface = "interface-1" - peer_asn = 65513 - custom_learned_route_priority = 0 - zero_custom_learned_route_priority = true -} -``` -## Example Usage - Router Zero Advertised Route Priority - - -```hcl -resource "google_compute_router_peer" "peer" { - name = "my-router-peer" - router = "my-router" - region = "us-central1" - interface = "interface-1" - peer_asn = 65513 - advertised_route_priority = 0 - zero_advertised_route_priority = true -} -```
Open in Cloud Shell @@ -412,11 +384,6 @@ The following arguments are supported: Where there is more than one matching route of maximum length, the routes with the lowest priority value win. -* `zero_advertised_route_priority` - - (Optional) - The user-defined zero-advertised-route-priority for a advertised-route-priority in BGP session. - This value has to be set true to force the advertised_route_priority to be 0. - * `advertise_mode` - (Optional) User-specified flag to indicate which mode to use for advertisement. @@ -453,11 +420,6 @@ The following arguments are supported: You can choose a value from 0 to 65335. If you don't provide a value, Google Cloud assigns a priority of 100 to the ranges. -* `zero_custom_learned_route_priority` - - (Optional) - The user-defined zero-custom-learned-route-priority for a custom-learned-route-priority in BGP session. - This value has to be set true to force the custom_learned_route_priority to be 0. - * `custom_learned_ip_ranges` - (Optional) The custom learned route IP address range. Must be a valid CIDR-formatted prefix. diff --git a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown index c1264c25a6ac..b69680f24eca 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -582,7 +582,7 @@ for a list of types. * `minimum` - (Optional) Minimum amount of the resource in the cluster. -* `maximum` - (Required) Maximum amount of the resource in the cluster. +* `maximum` - (Optional) Maximum amount of the resource in the cluster. The `auto_provisioning_defaults` block supports: @@ -663,11 +663,6 @@ This block also contains several computed attributes, documented below. The `managed_prometheus` block supports: * `enabled` - (Required) Whether or not the managed collection is enabled. -* `auto_monitoring_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Configuration options for GKE Auto-Monitoring. - -The `auto_monitoring_config` block supports: - -* `scope` - (Required) Whether or not to enable GKE Auto-Monitoring. Supported values include: `ALL`, `NONE`. The `advanced_datapath_observability_config` block supports: @@ -923,8 +918,6 @@ gvnic { * `resource_labels` - (Optional) The GCP labels (key/value pairs) to be applied to each node. Refer [here](https://cloud.google.com/kubernetes-engine/docs/how-to/creating-managing-labels) for how these labels are applied to clusters, node pools and nodes. -* `max_run_duration` - (Optional) The runtime of each node in the node pool in seconds, terminated by 's'. Example: "3600s". - * `local_ssd_count` - (Optional) The amount of local SSD disks that will be attached to each cluster node. Defaults to 0. @@ -1349,24 +1342,6 @@ such as `"300ms"`. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", * `pod_pids_limit` - (Optional) Controls the maximum number of processes allowed to run in a pod. The value must be greater than or equal to 1024 and less than 4194304. -* `container_log_max_size` - (Optional) Defines the maximum size of the - container log file before it is rotated. Specified as a positive number and a - unit suffix, such as `"100Ki"`, `"10Mi"`. Valid units are "Ki", "Mi", "Gi". - The value must be between `"10Mi"` and `"500Mi"`, inclusive. And the total container log size - (`container_log_max_size` * `container_log_max_files`) cannot exceed 1% of the total storage of the node. - -* `container_log_max_files` - (Optional) Defines the maximum number of container log files that can be present for a container. The integer must be between 2 and 10, inclusive. - -* `image_gc_low_threshold_percent` - (Optional) Defines the percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to. The integer must be between 10 and 85, inclusive. - -* `image_gc_high_threshold_percent` - (Optional) Defines the percent of disk usage after which image garbage collection is always run. The integer must be between 10 and 85, inclusive. - -* `image_minimum_gc_age` - (Optional) Defines the minimum age for an unused image before it is garbage collected. Specified as a sequence of decimal numbers, each with optional fraction and a unit suffix, such as `"300s"`, `"1.5m"`. The value cannot be greater than "2m". - -* `image_maximum_gc_age` - (Optional) Defines the maximum age an image can be unused before it is garbage collected. Specified as a sequence of decimal numbers, each with optional fraction and a unit suffix, such as `"300s"`, `"1.5m"`, and `"2h45m"`. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". The value must be a positive duration. - -* `allowed_unsafe_sysctls` - (Optional) Defines a comma-separated allowlist of unsafe sysctls or sysctl patterns which can be set on the Pods. The allowed sysctl groups are `kernel.shm*`, `kernel.msg*`, `kernel.sem`, `fs.mqueue.*`, and `net.*`. - The `linux_node_config` block supports: * `sysctls` - (Optional) The Linux kernel parameters to be applied to the nodes diff --git a/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown index 07c4fb7008f6..6f6e2e668bd3 100644 --- a/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown @@ -380,11 +380,11 @@ The optional `settings.backup_configuration` subblock supports: * `start_time` - (Optional) `HH:MM` format time indicating when backup configuration starts. -* `point_in_time_recovery_enabled` - (Optional) True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL and SQL Server instances. Enabled by default for PostgreSQL Enterprise Plus and SQL Server Enterprise Plus instances. +* `point_in_time_recovery_enabled` - (Optional) True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL and SQL Server instances. * `location` - (Optional) The region where the backup will be stored -* `transaction_log_retention_days` - (Optional) The number of days of transaction logs we retain for point in time restore, from 1-7. For PostgreSQL Enterprise Plus and SQL Server Enterprise Plus instances, the number of days of retained transaction logs can be set from 1 to 35. +* `transaction_log_retention_days` - (Optional) The number of days of transaction logs we retain for point in time restore, from 1-7. For PostgreSQL Enterprise Plus instances, the number of days of retained transaction logs can be set from 1 to 35. * `backup_retention_settings` - (Optional) Backup retention settings. The configuration is detailed below. @@ -557,12 +557,6 @@ block during resource creation/update will trigger the restore action after the * `project` - (Optional) The full project ID of the source instance.` -The optional, computed `replication_cluster` block represents a primary instance and disaster recovery replica pair. Applicable to MySQL and PostgreSQL. This field can be set only after both the primary and replica are created. This block supports: - -* `failover_dr_replica_name`: (Optional) If the instance is a primary instance, then this field identifies the disaster recovery (DR) replica. The standard format of this field is "your-project:your-instance". You can also set this field to "your-instance", but cloud SQL backend will convert it to the aforementioned standard format. - -* `dr_replica`: Read-only field that indicates whether the replica is a DR replica. - ## Attributes Reference In addition to the arguments listed above, the following computed attributes are @@ -626,8 +620,8 @@ performing filtering in a Terraform config. * `server_ca_cert.0.sha1_fingerprint` - SHA Fingerprint of the CA Cert. -## Switchover -Users can perform a switchover on a replica by following the steps below. +## Switchover (SQL Server Only) +Users can perform a switchover on any direct `cascadable` replica by following the steps below. ~>**WARNING:** Failure to follow these steps can lead to data loss (You will be warned during plan stage). To prevent data loss during a switchover, please verify your plan with the checklist below. @@ -635,26 +629,22 @@ For a more in-depth walkthrough with example code, see the [Switchover Guide](.. ### Steps to Invoke Switchover -MySQL/PostgreSQL: Create a cross-region, Enterprise Plus edition primary and replica pair, then set the value of primary's `replication_cluster.failover_dr_replica_name` as the replica. - -SQL Server: Create a `cascadable` replica in a different region from the primary (`cascadable_replica` is set to true in `replica_configuration`) +Create a `cascadable` replica in a different region from the primary (`cascadable_replica` is set to true in `replica_configuration`) #### Invoking switchover in the replica resource: 1. Change instance_type from `READ_REPLICA_INSTANCE` to `CLOUD_SQL_INSTANCE` 2. Remove `master_instance_name` -3. (SQL Server) Remove `replica_configuration` +3. Remove `replica_configuration` 4. Add current primary's name to the replica's `replica_names` list -5. (MySQL/PostgreSQL) Add current primary's name to the replica's `replication_cluster.failover_dr_replica_name`. -6. (MySQL/PostgreSQL) Adjust `backup_configuration`. See [Switchover Guide](../guides/sql_instance_switchover.html.markdown) for details. #### Updating the primary resource: 1. Change `instance_type` from `CLOUD_SQL_INSTANCE` to `READ_REPLICA_INSTANCE` 2. Set `master_instance_name` to the original replica (which will be primary after switchover) -3. (SQL Server) Set `replica_configuration` and set `cascadable_replica` to `true` +3. Set `replica_configuration` and set `cascadable_replica` to `true` 4. Remove original replica from `replica_names` - * **NOTE**: Do **not** delete the replica_names field, even if it has no replicas remaining. Set replica_names = [ ] to indicate it having no replicas. -5. (MySQL/PostgreSQL) Set `replication_cluster.failover_dr_replica_name` as the empty string. -6. (MySQL/PostgreSQL) Adjust `backup_configuration`. See [Switchover Guide](../guides/sql_instance_switchover.html.markdown) for details. + + ~> **NOTE**: Do **not** delete the replica_names field, even if it has no replicas remaining. Set replica_names = [ ] to indicate it having no replicas. + #### Plan and verify that: - `terraform plan` outputs **"0 to add, 0 to destroy"** - `terraform plan` does not say **"must be replaced"** for any resource diff --git a/mmv1/third_party/terraform/website/docs/r/storage_bucket.html.markdown b/mmv1/third_party/terraform/website/docs/r/storage_bucket.html.markdown index f18fb57ccb65..958029498d8c 100644 --- a/mmv1/third_party/terraform/website/docs/r/storage_bucket.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/storage_bucket.html.markdown @@ -111,7 +111,7 @@ resource "google_storage_bucket" "auto-expire" { location = "US" force_destroy = true - hierarchical_namespace { + hierarchical_namespace = { enabled = true } } diff --git a/mmv1/third_party/terraform/website/docs/r/storage_bucket_object.html.markdown b/mmv1/third_party/terraform/website/docs/r/storage_bucket_object.html.markdown index 85b67ab8b973..c58c1c856fce 100644 --- a/mmv1/third_party/terraform/website/docs/r/storage_bucket_object.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/storage_bucket_object.html.markdown @@ -13,10 +13,6 @@ Creates a new object inside an existing bucket in Google cloud storage service ( and [API](https://cloud.google.com/storage/docs/json_api/v1/objects). -A datasource can be used to retrieve the data of the stored object: - -* `google_storage_bucket_object_content`: Retrieves the content within a specified bucket object in Google Cloud Storage Service (GCS) - ## Example Usage diff --git a/mmv1/third_party/tgc/tests/data/example_access_context_manager_service_perimeter.json b/mmv1/third_party/tgc/tests/data/example_access_context_manager_service_perimeter.json index e77cb4bcf775..8e0990e72376 100644 --- a/mmv1/third_party/tgc/tests/data/example_access_context_manager_service_perimeter.json +++ b/mmv1/third_party/tgc/tests/data/example_access_context_manager_service_perimeter.json @@ -20,13 +20,9 @@ "sources": [ { "accessLevel": "accessPolicies/987654/accessLevels/restrict_storage" - }, - { - "resource": "projects/4321" } ] - }, - "title": "egress_policy_title" + } } ], "ingressPolicies": [ @@ -53,8 +49,7 @@ "resources": [ "*" ] - }, - "title": "ingress_policy_title" + } } ], "resources": [ diff --git a/mmv1/third_party/tgc/tests/data/example_access_context_manager_service_perimeter.tf b/mmv1/third_party/tgc/tests/data/example_access_context_manager_service_perimeter.tf index c722b7fc7595..ca8852445502 100644 --- a/mmv1/third_party/tgc/tests/data/example_access_context_manager_service_perimeter.tf +++ b/mmv1/third_party/tgc/tests/data/example_access_context_manager_service_perimeter.tf @@ -53,8 +53,6 @@ resource "google_access_context_manager_service_perimeter" "service-perimeter" { } } } - - title = "ingress_policy_title" } egress_policies { @@ -62,14 +60,9 @@ resource "google_access_context_manager_service_perimeter" "service-perimeter" { sources { access_level = "accessPolicies/987654/accessLevels/restrict_storage" } - sources { - resource = "projects/4321" - } - source_restriction = "SOURCE_RESTRICTION_ENABLED" + source_restriction = "SOURCE_RESTRICTION_ENABLED" identity_type = "ANY_USER_ACCOUNT" } - - title = "egress_policy_title" } } } diff --git a/mmv1/third_party/tgc_v6/cai2hcl/converters/services/compute/compute_instance.go b/mmv1/third_party/tgc_v6/cai2hcl/converters/services/compute/compute_instance.go deleted file mode 100644 index 284d0c0ea3a8..000000000000 --- a/mmv1/third_party/tgc_v6/cai2hcl/converters/services/compute/compute_instance.go +++ /dev/null @@ -1,216 +0,0 @@ -package compute - -import ( - "fmt" - "strings" - - "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/pkg/cai2hcl/converters/utils" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/pkg/cai2hcl/models" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/pkg/caiasset" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" - compute "google.golang.org/api/compute/v0.beta" -) - -// ComputeInstanceAssetType is the CAI asset type name for compute instance. -const ComputeInstanceAssetType string = "compute.googleapis.com/Instance" - -// ComputeInstanceSchemaName is the TF resource schema name for compute instance. -const ComputeInstanceSchemaName string = "google_compute_instance" - -// ComputeInstanceConverter for compute instance resource. -type ComputeInstanceConverter struct { - name string - schema map[string]*schema.Schema -} - -// NewComputeInstanceConverter returns an HCL converter for compute instance. -func NewComputeInstanceConverter(provider *schema.Provider) models.Converter { - schema := provider.ResourcesMap[ComputeInstanceSchemaName].Schema - - return &ComputeInstanceConverter{ - name: ComputeInstanceSchemaName, - schema: schema, - } -} - -// Convert converts asset to HCL resource blocks. -func (c *ComputeInstanceConverter) Convert(asset *caiasset.Asset) ([]*models.TerraformResourceBlock, error) { - if asset == nil || asset.Resource == nil && asset.Resource.Data == nil { - return nil, nil - } - var blocks []*models.TerraformResourceBlock - block, err := c.convertResourceData(asset) - if err != nil { - return nil, err - } - blocks = append(blocks, block) - return blocks, nil -} - -func (c *ComputeInstanceConverter) convertResourceData(asset *caiasset.Asset) (*models.TerraformResourceBlock, error) { - if asset == nil || asset.Resource == nil || asset.Resource.Data == nil { - return nil, fmt.Errorf("asset resource data is nil") - } - - project := utils.ParseFieldValue(asset.Name, "projects") - - var instance *compute.Instance - if err := utils.DecodeJSON(asset.Resource.Data, &instance); err != nil { - return nil, err - } - - hclData := make(map[string]interface{}) - - if instance.CanIpForward { - hclData["can_ip_forward"] = instance.CanIpForward - } - hclData["machine_type"] = tpgresource.GetResourceNameFromSelfLink(instance.MachineType) - hclData["network_performance_config"] = flattenNetworkPerformanceConfig(instance.NetworkPerformanceConfig) - - // Set the networks - networkInterfaces, _, _, err := flattenNetworkInterfaces(instance.NetworkInterfaces, project) - if err != nil { - return nil, err - } - hclData["network_interface"] = networkInterfaces - - if instance.Tags != nil { - hclData["tags"] = tpgresource.ConvertStringArrToInterface(instance.Tags.Items) - } - - hclData["labels"] = utils.RemoveTerraformAttributionLabel(instance.Labels) - hclData["service_account"] = flattenServiceAccounts(instance.ServiceAccounts) - hclData["resource_policies"] = instance.ResourcePolicies - - bootDisk, ads, scratchDisks := flattenDisks(instance.Disks, instance.Name) - hclData["boot_disk"] = bootDisk - hclData["attached_disk"] = ads - hclData["scratch_disk"] = scratchDisks - - hclData["scheduling"] = flattenScheduling(instance.Scheduling) - hclData["guest_accelerator"] = flattenGuestAccelerators(instance.GuestAccelerators) - hclData["shielded_instance_config"] = flattenShieldedVmConfig(instance.ShieldedInstanceConfig) - hclData["enable_display"] = flattenEnableDisplay(instance.DisplayDevice) - hclData["min_cpu_platform"] = instance.MinCpuPlatform - - // Only convert the field when its value is not default false - if instance.DeletionProtection { - hclData["deletion_protection"] = instance.DeletionProtection - } - hclData["zone"] = tpgresource.GetResourceNameFromSelfLink(instance.Zone) - hclData["name"] = instance.Name - hclData["description"] = instance.Description - hclData["hostname"] = instance.Hostname - hclData["confidential_instance_config"] = flattenConfidentialInstanceConfig(instance.ConfidentialInstanceConfig) - hclData["advanced_machine_features"] = flattenAdvancedMachineFeatures(instance.AdvancedMachineFeatures) - hclData["reservation_affinity"] = flattenReservationAffinity(instance.ReservationAffinity) - hclData["key_revocation_action_type"] = instance.KeyRevocationActionType - - // TODO: convert details from the boot disk assets (separate disk assets) into initialize_params in cai2hcl? - // It needs to integrate the disk assets into instance assets with the resolver. - - ctyVal, err := utils.MapToCtyValWithSchema(hclData, c.schema) - if err != nil { - return nil, err - } - return &models.TerraformResourceBlock{ - Labels: []string{c.name, instance.Name}, - Value: ctyVal, - }, nil - -} - -func flattenDisks(disks []*compute.AttachedDisk, instanceName string) ([]map[string]interface{}, []map[string]interface{}, []map[string]interface{}) { - attachedDisks := []map[string]interface{}{} - bootDisk := []map[string]interface{}{} - scratchDisks := []map[string]interface{}{} - for _, disk := range disks { - if disk.Boot { - bootDisk = flattenBootDisk(disk, instanceName) - } else if disk.Type == "SCRATCH" { - scratchDisks = append(scratchDisks, flattenScratchDisk(disk)) - } else { - di := map[string]interface{}{ - "source": tpgresource.ConvertSelfLinkToV1(disk.Source), - "device_name": disk.DeviceName, - "mode": disk.Mode, - } - if key := disk.DiskEncryptionKey; key != nil { - if key.KmsKeyName != "" { - // The response for crypto keys often includes the version of the key which needs to be removed - // format: projects//locations//keyRings//cryptoKeys//cryptoKeyVersions/1 - di["kms_key_self_link"] = strings.Split(disk.DiskEncryptionKey.KmsKeyName, "/cryptoKeyVersions")[0] - } - } - attachedDisks = append(attachedDisks, di) - } - } - - // Remove nils from map in case there were disks in the config that were not present on read; - // i.e. a disk was detached out of band - ads := []map[string]interface{}{} - for _, d := range attachedDisks { - if d != nil { - ads = append(ads, d) - } - } - return bootDisk, ads, scratchDisks -} - -func flattenBootDisk(disk *compute.AttachedDisk, instanceName string) []map[string]interface{} { - result := map[string]interface{}{} - - if !disk.AutoDelete { - result["auto_delete"] = false - } - - if !strings.Contains(disk.DeviceName, "persistent-disk-") { - result["device_name"] = disk.DeviceName - } - - if disk.Mode != "READ_WRITE" { - result["mode"] = disk.Mode - } - - if disk.DiskEncryptionKey != nil { - if disk.DiskEncryptionKey.KmsKeyName != "" { - // The response for crypto keys often includes the version of the key which needs to be removed - // format: projects//locations//keyRings//cryptoKeys//cryptoKeyVersions/1 - result["kms_key_self_link"] = strings.Split(disk.DiskEncryptionKey.KmsKeyName, "/cryptoKeyVersions")[0] - } - } - - // Don't convert the field with the default value - if disk.Interface != "SCSI" { - result["interface"] = disk.Interface - } - - if !strings.HasSuffix(disk.Source, instanceName) { - result["source"] = tpgresource.ConvertSelfLinkToV1(disk.Source) - } - - if len(result) == 0 { - return nil - } - - return []map[string]interface{}{result} -} - -func flattenScratchDisk(disk *compute.AttachedDisk) map[string]interface{} { - result := map[string]interface{}{ - "size": disk.DiskSizeGb, - } - - if !strings.Contains(disk.DeviceName, "persistent-disk-") { - result["device_name"] = disk.DeviceName - } - - // Don't convert the field with the default value - if disk.Interface != "SCSI" { - result["interface"] = disk.Interface - } - - return result -} diff --git a/mmv1/third_party/tgc_v6/cai2hcl/converters/services/compute/compute_instance_helpers.go b/mmv1/third_party/tgc_v6/cai2hcl/converters/services/compute/compute_instance_helpers.go deleted file mode 100644 index 2631e0c181cf..000000000000 --- a/mmv1/third_party/tgc_v6/cai2hcl/converters/services/compute/compute_instance_helpers.go +++ /dev/null @@ -1,330 +0,0 @@ -package compute - -import ( - "strconv" - "strings" - - "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/pkg/cai2hcl/converters/utils" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" - - compute "google.golang.org/api/compute/v0.beta" -) - -func flattenAliasIpRange(ranges []*compute.AliasIpRange) []map[string]interface{} { - rangesSchema := make([]map[string]interface{}, 0, len(ranges)) - for _, ipRange := range ranges { - rangesSchema = append(rangesSchema, map[string]interface{}{ - "ip_cidr_range": ipRange.IpCidrRange, - "subnetwork_range_name": ipRange.SubnetworkRangeName, - }) - } - return rangesSchema -} - -func flattenScheduling(resp *compute.Scheduling) []map[string]interface{} { - schedulingMap := make(map[string]interface{}, 0) - - if resp.InstanceTerminationAction != "" { - schedulingMap["instance_termination_action"] = resp.InstanceTerminationAction - } - - if resp.MinNodeCpus != 0 { - schedulingMap["min_node_cpus"] = resp.MinNodeCpus - } - - if resp.OnHostMaintenance != "MIGRATE" { - schedulingMap["on_host_maintenance"] = resp.OnHostMaintenance - } - - if resp.AutomaticRestart != nil && !*resp.AutomaticRestart { - schedulingMap["automatic_restart"] = *resp.AutomaticRestart - } - - if resp.Preemptible { - schedulingMap["preemptible"] = resp.Preemptible - } - - if resp.NodeAffinities != nil && len(resp.NodeAffinities) > 0 { - nodeAffinities := []map[string]interface{}{} - for _, na := range resp.NodeAffinities { - nodeAffinities = append(nodeAffinities, map[string]interface{}{ - "key": na.Key, - "operator": na.Operator, - "values": tpgresource.ConvertStringArrToInterface(na.Values), - }) - } - schedulingMap["node_affinities"] = nodeAffinities - } - - if resp.ProvisioningModel != "STANDARD" { - schedulingMap["provisioning_model"] = resp.ProvisioningModel - } - - if resp.AvailabilityDomain != 0 { - schedulingMap["availability_domain"] = resp.AvailabilityDomain - } - - if resp.MaxRunDuration != nil { - schedulingMap["max_run_duration"] = flattenComputeMaxRunDuration(resp.MaxRunDuration) - } - - if resp.OnInstanceStopAction != nil { - schedulingMap["on_instance_stop_action"] = flattenOnInstanceStopAction(resp.OnInstanceStopAction) - } - - if resp.HostErrorTimeoutSeconds != 0 { - schedulingMap["host_error_timeout_seconds"] = resp.HostErrorTimeoutSeconds - } - - if resp.MaintenanceInterval != "" { - schedulingMap["maintenance_interval"] = resp.MaintenanceInterval - } - - if resp.LocalSsdRecoveryTimeout != nil { - schedulingMap["local_ssd_recovery_timeout"] = flattenComputeLocalSsdRecoveryTimeout(resp.LocalSsdRecoveryTimeout) - } - - if len(schedulingMap) == 0 { - return nil - } - - return []map[string]interface{}{schedulingMap} -} - -func flattenComputeMaxRunDuration(v *compute.Duration) []interface{} { - if v == nil { - return nil - } - transformed := make(map[string]interface{}) - transformed["nanos"] = v.Nanos - transformed["seconds"] = v.Seconds - return []interface{}{transformed} -} - -func flattenOnInstanceStopAction(v *compute.SchedulingOnInstanceStopAction) []interface{} { - if v == nil { - return nil - } - transformed := make(map[string]interface{}) - transformed["discard_local_ssd"] = v.DiscardLocalSsd - return []interface{}{transformed} -} - -func flattenComputeLocalSsdRecoveryTimeout(v *compute.Duration) []interface{} { - if v == nil { - return nil - } - transformed := make(map[string]interface{}) - transformed["nanos"] = v.Nanos - transformed["seconds"] = v.Seconds - return []interface{}{transformed} -} - -func flattenAccessConfigs(accessConfigs []*compute.AccessConfig) ([]map[string]interface{}, string) { - flattened := make([]map[string]interface{}, len(accessConfigs)) - natIP := "" - for i, ac := range accessConfigs { - flattened[i] = map[string]interface{}{ - "nat_ip": ac.NatIP, - "network_tier": ac.NetworkTier, - } - if ac.SetPublicPtr { - flattened[i]["public_ptr_domain_name"] = ac.PublicPtrDomainName - } - if natIP == "" { - natIP = ac.NatIP - } - if ac.SecurityPolicy != "" { - flattened[i]["security_policy"] = ac.SecurityPolicy - } - } - return flattened, natIP -} - -func flattenIpv6AccessConfigs(ipv6AccessConfigs []*compute.AccessConfig) []map[string]interface{} { - flattened := make([]map[string]interface{}, len(ipv6AccessConfigs)) - for i, ac := range ipv6AccessConfigs { - flattened[i] = map[string]interface{}{ - "network_tier": ac.NetworkTier, - } - flattened[i]["public_ptr_domain_name"] = ac.PublicPtrDomainName - flattened[i]["external_ipv6"] = ac.ExternalIpv6 - flattened[i]["external_ipv6_prefix_length"] = strconv.FormatInt(ac.ExternalIpv6PrefixLength, 10) - flattened[i]["name"] = ac.Name - if ac.SecurityPolicy != "" { - flattened[i]["security_policy"] = ac.SecurityPolicy - } - } - return flattened -} - -func flattenNetworkInterfaces(networkInterfaces []*compute.NetworkInterface, project string) ([]map[string]interface{}, string, string, error) { - flattened := make([]map[string]interface{}, len(networkInterfaces)) - var internalIP, externalIP string - - for i, iface := range networkInterfaces { - var ac []map[string]interface{} - ac, externalIP = flattenAccessConfigs(iface.AccessConfigs) - - flattened[i] = map[string]interface{}{ - "network_ip": iface.NetworkIP, - "access_config": ac, - "alias_ip_range": flattenAliasIpRange(iface.AliasIpRanges), - "nic_type": iface.NicType, - "ipv6_access_config": flattenIpv6AccessConfigs(iface.Ipv6AccessConfigs), - "ipv6_address": iface.Ipv6Address, - } - - if !strings.HasSuffix(iface.Network, "/default") { - flattened[i]["network"] = tpgresource.ConvertSelfLinkToV1(iface.Network) - } - - if !strings.HasSuffix(iface.Subnetwork, "/default") { - flattened[i]["subnetwork"] = tpgresource.ConvertSelfLinkToV1(iface.Subnetwork) - } - - subnetProject := utils.ParseFieldValue(iface.Subnetwork, "projects") - if subnetProject != project { - flattened[i]["subnetwork_project"] = subnetProject - } - - if iface.StackType != "IPV4_ONLY" { - flattened[i]["stack_type"] = iface.StackType - } - - if iface.QueueCount != 0 { - flattened[i]["queue_count"] = iface.QueueCount - } - - if internalIP == "" { - internalIP = iface.NetworkIP - } - - if iface.NetworkAttachment != "" { - networkAttachment, err := tpgresource.GetRelativePath(iface.NetworkAttachment) - if err != nil { - return nil, "", "", err - } - flattened[i]["network_attachment"] = networkAttachment - } - - // the security_policy for a network_interface is found in one of its accessConfigs. - if len(iface.AccessConfigs) > 0 && iface.AccessConfigs[0].SecurityPolicy != "" { - flattened[i]["security_policy"] = iface.AccessConfigs[0].SecurityPolicy - } else if len(iface.Ipv6AccessConfigs) > 0 && iface.Ipv6AccessConfigs[0].SecurityPolicy != "" { - flattened[i]["security_policy"] = iface.Ipv6AccessConfigs[0].SecurityPolicy - } - } - return flattened, internalIP, externalIP, nil -} - -func flattenServiceAccounts(serviceAccounts []*compute.ServiceAccount) []map[string]interface{} { - result := make([]map[string]interface{}, len(serviceAccounts)) - for i, serviceAccount := range serviceAccounts { - result[i] = map[string]interface{}{ - "email": serviceAccount.Email, - "scopes": serviceAccount.Scopes, - } - } - return result -} - -func flattenGuestAccelerators(accelerators []*compute.AcceleratorConfig) []map[string]interface{} { - acceleratorsSchema := make([]map[string]interface{}, len(accelerators)) - for i, accelerator := range accelerators { - acceleratorsSchema[i] = map[string]interface{}{ - "count": accelerator.AcceleratorCount, - "type": accelerator.AcceleratorType, - } - } - return acceleratorsSchema -} - -func flattenConfidentialInstanceConfig(ConfidentialInstanceConfig *compute.ConfidentialInstanceConfig) []map[string]interface{} { - if ConfidentialInstanceConfig == nil { - return nil - } - - return []map[string]interface{}{{ - "enable_confidential_compute": ConfidentialInstanceConfig.EnableConfidentialCompute, - "confidential_instance_type": ConfidentialInstanceConfig.ConfidentialInstanceType, - }} -} - -func flattenAdvancedMachineFeatures(AdvancedMachineFeatures *compute.AdvancedMachineFeatures) []map[string]interface{} { - if AdvancedMachineFeatures == nil { - return nil - } - return []map[string]interface{}{{ - "enable_nested_virtualization": AdvancedMachineFeatures.EnableNestedVirtualization, - "threads_per_core": AdvancedMachineFeatures.ThreadsPerCore, - "turbo_mode": AdvancedMachineFeatures.TurboMode, - "visible_core_count": AdvancedMachineFeatures.VisibleCoreCount, - "performance_monitoring_unit": AdvancedMachineFeatures.PerformanceMonitoringUnit, - "enable_uefi_networking": AdvancedMachineFeatures.EnableUefiNetworking, - }} -} - -func flattenShieldedVmConfig(shieldedVmConfig *compute.ShieldedInstanceConfig) []map[string]bool { - if shieldedVmConfig == nil { - return nil - } - - shieldedInstanceConfig := map[string]bool{} - - if shieldedVmConfig.EnableSecureBoot { - shieldedInstanceConfig["enable_secure_boot"] = shieldedVmConfig.EnableSecureBoot - } - - if !shieldedVmConfig.EnableVtpm { - shieldedInstanceConfig["enable_vtpm"] = shieldedVmConfig.EnableVtpm - } - - if !shieldedVmConfig.EnableIntegrityMonitoring { - shieldedInstanceConfig["enable_integrity_monitoring"] = shieldedVmConfig.EnableIntegrityMonitoring - } - - if len(shieldedInstanceConfig) == 0 { - return nil - } - - return []map[string]bool{shieldedInstanceConfig} -} - -func flattenEnableDisplay(displayDevice *compute.DisplayDevice) interface{} { - if displayDevice == nil { - return nil - } - - return displayDevice.EnableDisplay -} - -func flattenReservationAffinity(affinity *compute.ReservationAffinity) []map[string]interface{} { - if affinity == nil { - return nil - } - - flattened := map[string]interface{}{ - "type": affinity.ConsumeReservationType, - } - - if affinity.ConsumeReservationType == "SPECIFIC_RESERVATION" { - flattened["specific_reservation"] = []map[string]interface{}{{ - "key": affinity.Key, - "values": affinity.Values, - }} - } - - return []map[string]interface{}{flattened} -} - -func flattenNetworkPerformanceConfig(c *compute.NetworkPerformanceConfig) []map[string]interface{} { - if c == nil { - return nil - } - return []map[string]interface{}{ - { - "total_egress_bandwidth_tier": c.TotalEgressBandwidthTier, - }, - } -} diff --git a/mmv1/third_party/tgc_v6/cai2hcl/converters/utils/utils.go b/mmv1/third_party/tgc_v6/cai2hcl/converters/utils/utils.go index 4496cf8179a6..15a1d0379663 100644 --- a/mmv1/third_party/tgc_v6/cai2hcl/converters/utils/utils.go +++ b/mmv1/third_party/tgc_v6/cai2hcl/converters/utils/utils.go @@ -24,22 +24,13 @@ func ParseFieldValue(url string, name string) string { } // Remove the Terraform attribution label "goog-terraform-provisioned" from labels -func RemoveTerraformAttributionLabel(raw interface{}) interface{} { +func RemoveTerraformAttributionLabel(raw interface{}) map[string]interface{} { if raw == nil { return nil } - - if labels, ok := raw.(map[string]string); ok { - delete(labels, "goog-terraform-provisioned") - return labels - } - - if labels, ok := raw.(map[string]interface{}); ok { - delete(labels, "goog-terraform-provisioned") - return labels - } - - return nil + labels := raw.(map[string]interface{}) + delete(labels, "goog-terraform-provisioned") + return labels } // DecodeJSON decodes the map object into the target struct. diff --git a/tools/diff-processor/cmd/breaking_changes.go b/tools/diff-processor/cmd/breaking_changes.go index 9a97f40903bb..bd16d705f67c 100644 --- a/tools/diff-processor/cmd/breaking_changes.go +++ b/tools/diff-processor/cmd/breaking_changes.go @@ -3,6 +3,8 @@ package cmd import ( "encoding/json" "fmt" + newProvider "google/provider/new/google/provider" + oldProvider "google/provider/old/google/provider" "io" "os" @@ -25,7 +27,7 @@ func newBreakingChangesCmd(rootOptions *rootOptions) *cobra.Command { o := &breakingChangesOptions{ rootOptions: rootOptions, computeSchemaDiff: func() diff.SchemaDiff { - return schemaDiff + return diff.ComputeSchemaDiff(oldProvider.ResourceMap(), newProvider.ResourceMap()) }, stdout: os.Stdout, } diff --git a/tools/diff-processor/cmd/changed_schema_resources.go b/tools/diff-processor/cmd/changed_schema_resources.go new file mode 100644 index 000000000000..52ff34381954 --- /dev/null +++ b/tools/diff-processor/cmd/changed_schema_resources.go @@ -0,0 +1,53 @@ +package cmd + +import ( + newProvider "google/provider/new/google/provider" + oldProvider "google/provider/old/google/provider" + + "encoding/json" + "fmt" + "io" + "os" + + "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" + "github.com/spf13/cobra" + "golang.org/x/exp/maps" +) + +const changedSchemaResourcesDesc = `Compute list of resources with changed schemas.` + +type changedSchemaResourcesOptions struct { + rootOptions *rootOptions + computeSchemaDiff func() diff.SchemaDiff + stdout io.Writer +} + +func newChangedSchemaResourcesCmd(rootOptions *rootOptions) *cobra.Command { + o := &changedSchemaResourcesOptions{ + rootOptions: rootOptions, + computeSchemaDiff: func() diff.SchemaDiff { + return diff.ComputeSchemaDiff(oldProvider.ResourceMap(), newProvider.ResourceMap()) + }, + stdout: os.Stdout, + } + cmd := &cobra.Command{ + Use: "changed-schema-resources", + Short: changedSchemaResourcesDesc, + Long: changedSchemaResourcesDesc, + Args: cobra.NoArgs, + RunE: func(c *cobra.Command, args []string) error { + return o.run() + }, + } + return cmd +} +func (o *changedSchemaResourcesOptions) run() error { + schemaDiff := o.computeSchemaDiff() + affectedResources := maps.Keys(schemaDiff) + + if err := json.NewEncoder(o.stdout).Encode(affectedResources); err != nil { + return fmt.Errorf("Error encoding json: %w", err) + } + + return nil +} diff --git a/tools/diff-processor/cmd/changed_schema_resources_test.go b/tools/diff-processor/cmd/changed_schema_resources_test.go new file mode 100644 index 000000000000..43ff0bec3a6c --- /dev/null +++ b/tools/diff-processor/cmd/changed_schema_resources_test.go @@ -0,0 +1,165 @@ +package cmd + +import ( + "bytes" + _ "embed" + "encoding/json" + "testing" + + "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func TestChangedSchemaResourcesCmdRun(t *testing.T) { + cases := map[string]struct { + args []string + oldResourceMap map[string]*schema.Resource + newResourceMap map[string]*schema.Resource + expectedResources []string + expectError bool + }{ + "empty resource map": { + args: []string{"12345"}, + oldResourceMap: map[string]*schema.Resource{}, + newResourceMap: map[string]*schema.Resource{}, + expectedResources: nil, + }, + "resource isn't changed": { + args: []string{"12345"}, + oldResourceMap: map[string]*schema.Resource{ + "google_x_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Optional: true}, + "field_b": {Description: "beep", Optional: true}, + }, + }, + }, + newResourceMap: map[string]*schema.Resource{ + "google_x_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Optional: true}, + "field_b": {Description: "beep", Optional: true}, + }, + }, + }, + expectedResources: nil, + }, + "resource is changed": { + args: []string{"12345"}, + oldResourceMap: map[string]*schema.Resource{ + "google_x_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Optional: true}, + "field_b": {Description: "beep", Optional: true}, + }, + }, + }, + newResourceMap: map[string]*schema.Resource{ + "google_x_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Required: true}, + }, + }, + }, + expectedResources: []string{"google_x_resource"}, + }, + "multiple resources are changed": { + args: []string{"12345"}, + oldResourceMap: map[string]*schema.Resource{ + "google_x_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Optional: true}, + "field_b": {Description: "beep", Optional: true}, + }, + }, + "google_z_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Optional: true}, + "field_b": {Description: "beep", Optional: true}, + }, + }, + }, + newResourceMap: map[string]*schema.Resource{ + "google_x_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Required: true}, + }, + }, + "google_z_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Required: true}, + }, + }, + }, + expectedResources: []string{"google_x_resource", "google_z_resource"}, + }, + "multiple resources but not all are changed": { + args: []string{"12345"}, + oldResourceMap: map[string]*schema.Resource{ + "google_x_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Optional: true}, + "field_b": {Description: "beep", Optional: true}, + }, + }, + "google_z_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Optional: true}, + "field_b": {Description: "beep", Optional: true}, + }, + }, + }, + newResourceMap: map[string]*schema.Resource{ + "google_x_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Required: true}, + }, + }, + "google_z_resource": { + Schema: map[string]*schema.Schema{ + "field_a": {Description: "beep", Optional: true}, + "field_b": {Description: "beep", Optional: true}, + }, + }, + }, + expectedResources: []string{"google_x_resource"}, + }, + } + + for tn, tc := range cases { + tc := tc + t.Run(tn, func(t *testing.T) { + t.Parallel() + + var buf bytes.Buffer + o := changedSchemaResourcesOptions{ + computeSchemaDiff: func() diff.SchemaDiff { + return diff.ComputeSchemaDiff(tc.oldResourceMap, tc.newResourceMap) + }, + stdout: &buf, + } + + err := o.run() + if err != nil { + if tc.expectError { + return + } + t.Errorf("Error running command: %s", err) + } + + out := make([]byte, buf.Len()) + buf.Read(out) + var gotResources []string + if err = json.Unmarshal(out, &gotResources); err != nil { + t.Fatalf("Unable to unmarshal labels (%q): %s", out, err) + } + + less := func(a, b string) bool { return a < b } + if (len(tc.expectedResources) > 0 || len(gotResources) > 0) && !cmp.Equal(tc.expectedResources, gotResources, cmpopts.SortSlices(less)) { + t.Errorf("Unexpected final labels. Want %q, got %q", tc.expectedResources, gotResources) + } + }) + } +} diff --git a/tools/diff-processor/cmd/detect_missing_docs.go b/tools/diff-processor/cmd/detect_missing_docs.go deleted file mode 100644 index 276e441b77a1..000000000000 --- a/tools/diff-processor/cmd/detect_missing_docs.go +++ /dev/null @@ -1,77 +0,0 @@ -package cmd - -import ( - "slices" - "sort" - - "encoding/json" - "fmt" - "io" - "os" - - "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/detector" - "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/spf13/cobra" - "golang.org/x/exp/maps" -) - -const detectMissingDocDesc = `Compute list of fields missing documents` - -type MissingDocsInfo struct { - Name string - FilePath string - Fields []string -} - -type detectMissingDocsOptions struct { - rootOptions *rootOptions - computeSchemaDiff func() diff.SchemaDiff - newResourceSchema map[string]*schema.Resource - stdout io.Writer -} - -func newDetectMissingDocsCmd(rootOptions *rootOptions) *cobra.Command { - o := &detectMissingDocsOptions{ - rootOptions: rootOptions, - computeSchemaDiff: func() diff.SchemaDiff { - return schemaDiff - }, - stdout: os.Stdout, - } - cmd := &cobra.Command{ - Use: "detect-missing-docs", - Short: detectMissingDocDesc, - Long: detectMissingDocDesc, - Args: cobra.ExactArgs(1), - RunE: func(c *cobra.Command, args []string) error { - return o.run(args) - }, - } - return cmd -} -func (o *detectMissingDocsOptions) run(args []string) error { - schemaDiff := o.computeSchemaDiff() - detectedResources, err := detector.DetectMissingDocs(schemaDiff, args[0], o.newResourceSchema) - if err != nil { - return err - } - resources := maps.Keys(detectedResources) - slices.Sort(resources) - info := []MissingDocsInfo{} - for _, r := range resources { - details := detectedResources[r] - sort.Strings(details.Fields) - info = append(info, MissingDocsInfo{ - Name: r, - FilePath: details.FilePath, - Fields: details.Fields, - }) - } - - if err := json.NewEncoder(o.stdout).Encode(info); err != nil { - return fmt.Errorf("error encoding json: %w", err) - } - - return nil -} diff --git a/tools/diff-processor/cmd/detect_missing_docs_test.go b/tools/diff-processor/cmd/detect_missing_docs_test.go deleted file mode 100644 index e385488c04ba..000000000000 --- a/tools/diff-processor/cmd/detect_missing_docs_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package cmd - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" - "github.com/google/go-cmp/cmp" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func TestDetectMissingDocs(t *testing.T) { - cases := []struct { - name string - oldResourceMap map[string]*schema.Resource - newResourceMap map[string]*schema.Resource - want []MissingDocsInfo - }{ - { - name: "no new fields", - oldResourceMap: map[string]*schema.Resource{ - "google_x": { - Schema: map[string]*schema.Schema{ - "field-a": {Description: "beep", Computed: true, Optional: true}, - "field-b": {Description: "beep", Computed: true}, - }, - }, - }, - newResourceMap: map[string]*schema.Resource{ - "google_x": { - Schema: map[string]*schema.Schema{ - "field-a": {Description: "beep", Computed: true, Optional: true}, - "field-b": {Description: "beep", Computed: true}, - }, - }, - }, - want: []MissingDocsInfo{}, - }, - { - name: "multiple new fields missing doc", - oldResourceMap: map[string]*schema.Resource{}, - newResourceMap: map[string]*schema.Resource{ - "google_x": { - Schema: map[string]*schema.Schema{ - "field-a": {Description: "beep", Computed: true, Optional: true}, - "field-b": {Description: "beep", Computed: true}, - }, - }, - }, - want: []MissingDocsInfo{ - { - Name: "google_x", - FilePath: "/website/docs/r/x.html.markdown", - Fields: []string{"field-a", "field-b"}, - }, - }, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - var buf bytes.Buffer - o := detectMissingDocsOptions{ - computeSchemaDiff: func() diff.SchemaDiff { - return diff.ComputeSchemaDiff(tc.oldResourceMap, tc.newResourceMap) - }, - newResourceSchema: tc.newResourceMap, - stdout: &buf, - } - - err := o.run([]string{t.TempDir()}) - if err != nil { - t.Fatalf("Error running command: %s", err) - } - - out := make([]byte, buf.Len()) - buf.Read(out) - - var got []MissingDocsInfo - if err = json.Unmarshal(out, &got); err != nil { - t.Fatalf("Failed to unmarshall output: %s", err) - } - - if diff := cmp.Diff(tc.want, got); diff != "" { - t.Errorf("Unexpected result. Want %+v, got %+v. ", tc.want, got) - } - }) - } -} diff --git a/tools/diff-processor/cmd/detect_missing_tests.go b/tools/diff-processor/cmd/detect_missing_tests.go index 0951b87e8ded..84d027e58a1d 100644 --- a/tools/diff-processor/cmd/detect_missing_tests.go +++ b/tools/diff-processor/cmd/detect_missing_tests.go @@ -2,12 +2,15 @@ package cmd import ( "encoding/json" + newProvider "google/provider/new/google/provider" + oldProvider "google/provider/old/google/provider" "io" "fmt" "os" "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/detector" + "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" "github.com/GoogleCloudPlatform/magic-modules/tools/test-reader/reader" "github.com/golang/glog" "github.com/spf13/cobra" @@ -42,6 +45,8 @@ func (o *detectMissingTestsOptions) run(args []string) error { glog.Infof("error reading path: %s, err: %v", path, err) } + schemaDiff := diff.ComputeSchemaDiff(oldProvider.ResourceMap(), newProvider.ResourceMap()) + missingTests, err := detector.DetectMissingTests(schemaDiff, allTests) if err != nil { return fmt.Errorf("error detecting missing tests: %v", err) diff --git a/tools/diff-processor/cmd/root.go b/tools/diff-processor/cmd/root.go index b22222ab0876..0ecf9f3fad3d 100644 --- a/tools/diff-processor/cmd/root.go +++ b/tools/diff-processor/cmd/root.go @@ -22,8 +22,8 @@ func newRootCmd() (*cobra.Command, *rootOptions, error) { SilenceErrors: true, } cmd.AddCommand(newBreakingChangesCmd(o)) + cmd.AddCommand(newChangedSchemaResourcesCmd(o)) cmd.AddCommand(newDetectMissingTestsCmd(o)) - cmd.AddCommand(newSchemaDiffCmd(o)) return cmd, o, nil } diff --git a/tools/diff-processor/cmd/schema_diff.go b/tools/diff-processor/cmd/schema_diff.go deleted file mode 100644 index 837360b06a89..000000000000 --- a/tools/diff-processor/cmd/schema_diff.go +++ /dev/null @@ -1,74 +0,0 @@ -package cmd - -import ( - newProvider "google/provider/new/google/provider" - oldProvider "google/provider/old/google/provider" - - "encoding/json" - "fmt" - "io" - "os" - "sort" - - "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" - "github.com/spf13/cobra" -) - -const schemaDiffDesc = `Return a simple summary of the schema diff for this build.` - -var schemaDiff = diff.ComputeSchemaDiff(oldProvider.ResourceMap(), newProvider.ResourceMap()) - -type simpleSchemaDiff struct { - AddedResources, ModifiedResources, RemovedResources []string -} - -type schemaDiffOptions struct { - rootOptions *rootOptions - computeSchemaDiff func() diff.SchemaDiff - stdout io.Writer -} - -func newSchemaDiffCmd(rootOptions *rootOptions) *cobra.Command { - o := &schemaDiffOptions{ - rootOptions: rootOptions, - computeSchemaDiff: func() diff.SchemaDiff { - return schemaDiff - }, - stdout: os.Stdout, - } - cmd := &cobra.Command{ - Use: "schema-diff", - Short: schemaDiffDesc, - Long: schemaDiffDesc, - Args: cobra.NoArgs, - RunE: func(c *cobra.Command, args []string) error { - return o.run() - }, - } - return cmd -} -func (o *schemaDiffOptions) run() error { - schemaDiff := o.computeSchemaDiff() - - simple := simpleSchemaDiff{} - - for k, d := range schemaDiff { - if d.ResourceConfig.Old == nil { - simple.AddedResources = append(simple.AddedResources, k) - } else if d.ResourceConfig.New == nil { - simple.RemovedResources = append(simple.RemovedResources, k) - } else { - simple.ModifiedResources = append(simple.ModifiedResources, k) - } - } - - sort.Strings(simple.AddedResources) - sort.Strings(simple.ModifiedResources) - sort.Strings(simple.RemovedResources) - - if err := json.NewEncoder(o.stdout).Encode(simple); err != nil { - return fmt.Errorf("Error encoding json: %w", err) - } - - return nil -} diff --git a/tools/diff-processor/cmd/schema_diff_test.go b/tools/diff-processor/cmd/schema_diff_test.go deleted file mode 100644 index 8e2725c4f2d8..000000000000 --- a/tools/diff-processor/cmd/schema_diff_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package cmd - -import ( - "bytes" - _ "embed" - "encoding/json" - "testing" - - "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" - "github.com/google/go-cmp/cmp" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func TestSchemaDiffCmdRun(t *testing.T) { - cases := []struct { - name string - args []string - oldResourceMap map[string]*schema.Resource - newResourceMap map[string]*schema.Resource - want simpleSchemaDiff - }{ - { - name: "empty resource map", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{}, - newResourceMap: map[string]*schema.Resource{}, - want: simpleSchemaDiff{}, - }, - { - name: "resource is added", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{}, - newResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - want: simpleSchemaDiff{ - AddedResources: []string{"google_x_resource"}, - }, - }, - { - name: "multiple resources are added", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{}, - newResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Required: true}, - }, - }, - "google_z_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Required: true}, - }, - }, - }, - want: simpleSchemaDiff{ - AddedResources: []string{"google_x_resource", "google_z_resource"}, - }, - }, - { - name: "resource is removed", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - newResourceMap: map[string]*schema.Resource{}, - want: simpleSchemaDiff{ - RemovedResources: []string{"google_x_resource"}, - }, - }, - { - name: "multiple resources are removed", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - "google_z_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - newResourceMap: map[string]*schema.Resource{}, - want: simpleSchemaDiff{ - RemovedResources: []string{"google_x_resource", "google_z_resource"}, - }, - }, - { - name: "resource isn't changed", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - newResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - want: simpleSchemaDiff{}, - }, - { - name: "resource is changed", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - newResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Required: true}, - }, - }, - }, - want: simpleSchemaDiff{ - ModifiedResources: []string{"google_x_resource"}, - }, - }, - { - name: "multiple resources are changed", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - "google_z_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - newResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Required: true}, - }, - }, - "google_z_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Required: true}, - }, - }, - }, - want: simpleSchemaDiff{ - ModifiedResources: []string{"google_x_resource", "google_z_resource"}, - }, - }, - { - name: "multiple resources but not all are changed", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - "google_z_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - newResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Required: true}, - }, - }, - "google_z_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - want: simpleSchemaDiff{ - ModifiedResources: []string{"google_x_resource"}, - }, - }, - { - name: "multiple resources are added, changed, or removed", - args: []string{"12345"}, - oldResourceMap: map[string]*schema.Resource{ - "google_y_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - "google_z_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - }, - }, - }, - newResourceMap: map[string]*schema.Resource{ - "google_x_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Required: true}, - }, - }, - "google_y_resource": { - Schema: map[string]*schema.Schema{ - "field_a": {Description: "beep", Optional: true}, - "field_b": {Description: "beep", Optional: true}, - "field_c": {Description: "beep", Optional: true}, - }, - }, - }, - want: simpleSchemaDiff{ - AddedResources: []string{"google_x_resource"}, - ModifiedResources: []string{"google_y_resource"}, - RemovedResources: []string{"google_z_resource"}, - }, - }, - } - - for _, tc := range cases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - var buf bytes.Buffer - o := schemaDiffOptions{ - computeSchemaDiff: func() diff.SchemaDiff { - return diff.ComputeSchemaDiff(tc.oldResourceMap, tc.newResourceMap) - }, - stdout: &buf, - } - - err := o.run() - if err != nil { - t.Errorf("Error running command: %s", err) - } - - out := make([]byte, buf.Len()) - buf.Read(out) - var got simpleSchemaDiff - if err = json.Unmarshal(out, &got); err != nil { - t.Fatalf("Unable to unmarshal simple diff (%q): %s", out, err) - } - - if !cmp.Equal(tc.want, got) { - t.Errorf("Unexpected simple diff. Want %q, got %q", tc.want, got) - } - }) - } -} diff --git a/tools/diff-processor/detector/detector.go b/tools/diff-processor/detector/detector.go index 05e0720f085f..8305aaac1407 100644 --- a/tools/diff-processor/detector/detector.go +++ b/tools/diff-processor/detector/detector.go @@ -1,14 +1,10 @@ package detector import ( - "fmt" - "os" - "path/filepath" "sort" "strings" "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" - "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/documentparser" "github.com/GoogleCloudPlatform/magic-modules/tools/test-reader/reader" "github.com/hashicorp/hcl/v2/hclwrite" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -37,12 +33,6 @@ type Field struct { Tested bool } -// MissingDocDetails denotes the doc file path and the fields that are not shown up in the corresponding doc. -type MissingDocDetails struct { - FilePath string - Fields []string -} - // Detect missing tests for the given resource changes map in the given slice of tests. // Return a map of resource names to missing test info about that resource. func DetectMissingTests(schemaDiff diff.SchemaDiff, allTests []*reader.Test) (map[string]*MissingTestInfo, error) { @@ -162,91 +152,3 @@ func suggestedTest(resourceName string, untested []string) string { } return strings.ReplaceAll(string(f.Bytes()), `"VALUE"`, "# value needed") } - -// DetectMissingDocs detect new fields that are missing docs given the schema diffs. -// Return a map of resource names to missing doc info. -func DetectMissingDocs(schemaDiff diff.SchemaDiff, repoPath string, resourceMap map[string]*schema.Resource) (map[string]MissingDocDetails, error) { - ret := make(map[string]MissingDocDetails) - for resource, resourceDiff := range schemaDiff { - fieldsInDoc := make(map[string]bool) - - docFilePath, err := resourceToDocFile(resource, repoPath) - if err != nil { - fmt.Printf("Warning: %s.\n", err) - } else { - content, err := os.ReadFile(docFilePath) - if err != nil { - return nil, fmt.Errorf("failed to read resource doc %s: %w", docFilePath, err) - } - parser := documentparser.NewParser() - err = parser.Parse(content) - if err != nil { - return nil, fmt.Errorf("failed to parse document %s: %w", docFilePath, err) - } - - argumentsInDoc := listToMap(parser.Arguments()) - attributesInDoc := listToMap(parser.Attributes()) - for _, m := range []map[string]bool{argumentsInDoc, attributesInDoc} { - for k, v := range m { - fieldsInDoc[k] = v - } - } - // for iam resource - if v, ok := fieldsInDoc["member/members"]; ok { - fieldsInDoc["member"] = v - fieldsInDoc["members"] = v - } - } - details := MissingDocDetails{ - FilePath: strings.ReplaceAll(docFilePath, repoPath, ""), - } - - for field, fieldDiff := range resourceDiff.Fields { - if !isNewField(fieldDiff) { - continue - } - if !fieldsInDoc[field] { - details.Fields = append(details.Fields, field) - } - } - if len(details.Fields) > 0 { - ret[resource] = details - } - } - return ret, nil -} - -func isNewField(fieldDiff diff.FieldDiff) bool { - return fieldDiff.Old == nil && fieldDiff.New != nil -} - -func resourceToDocFile(resource string, repoPath string) (string, error) { - baseNameOptions := []string{ - strings.TrimPrefix(resource, "google_") + ".html.markdown", - resource + ".html.markdown", - } - suffix := []string{"_policy", "_binding", "_member"} - for _, s := range suffix { - if strings.HasSuffix(resource, "_iam"+s) { - iamName := strings.TrimSuffix(resource, s) - baseNameOptions = append(baseNameOptions, iamName+".html.markdown") - baseNameOptions = append(baseNameOptions, strings.TrimPrefix(iamName, "google_")+".html.markdown") - } - } - for _, baseName := range baseNameOptions { - fullPath := filepath.Join(repoPath, "website", "docs", "r", baseName) - _, err := os.ReadFile(fullPath) - if !os.IsNotExist(err) { - return fullPath, nil - } - } - return filepath.Join(repoPath, "website", "docs", "r", baseNameOptions[0]), fmt.Errorf("no document files found in %s for resource %q", baseNameOptions, resource) -} - -func listToMap(items []string) map[string]bool { - m := make(map[string]bool) - for _, item := range items { - m[item] = true - } - return m -} diff --git a/tools/diff-processor/detector/detector_test.go b/tools/diff-processor/detector/detector_test.go index 30f0dcc5813a..60ad7739bc7f 100644 --- a/tools/diff-processor/detector/detector_test.go +++ b/tools/diff-processor/detector/detector_test.go @@ -2,12 +2,10 @@ package detector import ( "reflect" - "sort" "testing" "github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff" "github.com/GoogleCloudPlatform/magic-modules/tools/test-reader/reader" - "github.com/google/go-cmp/cmp" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -203,206 +201,3 @@ func TestGetMissingTestsForChanges(t *testing.T) { } } } - -func TestDetectMissingDocs(t *testing.T) { - // top level field_one is argument, field_two is attribute. - resourceSchema := map[string]*schema.Resource{ - "a_resource": { - Schema: map[string]*schema.Schema{ - "field_one": { - Computed: true, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "a": { - Computed: true, - Optional: true, - }, - "b": { - Computed: true, - Optional: false, - }, - "c": { - Computed: true, - Optional: false, - }, - }, - }, - }, - "field_two": { - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "a": { - Computed: true, - Optional: false, - }, - "b": { - Computed: true, - Optional: false, - }, - "c": { - Computed: true, - Optional: false, - }, - }, - }, - }, - "field_three": { - Computed: true, - Optional: true, - }, - "field_four": { - Computed: true, - }, - }, - }, - } - - // If repo is not temp dir, then the doc file points to tools/diff-processor/testdata/website/docs/r/a_resource.html.markdown. - for _, test := range []struct { - name string - schemaDiff diff.SchemaDiff - repo string - want map[string]MissingDocDetails - }{ - { - name: "doc file not exist", - schemaDiff: diff.SchemaDiff{ - "a_resource": diff.ResourceDiff{ - Fields: map[string]diff.FieldDiff{ - "field_one": { - New: &schema.Schema{}, - }, - "field_one.a": { - New: &schema.Schema{}, - }, - "field_one.b": { - New: &schema.Schema{}, - }, - "field_two.a": { - New: &schema.Schema{}, - Old: &schema.Schema{}, - }, - "field_two.b": { - New: &schema.Schema{}, - }, - "field_three": { - New: &schema.Schema{ - Computed: true, - Optional: true, - }, - }, - "field_four": { - New: &schema.Schema{ - Computed: true, - }, - }, - }, - }, - }, - repo: t.TempDir(), - want: map[string]MissingDocDetails{ - "a_resource": { - FilePath: "/website/docs/r/a_resource.html.markdown", - Fields: []string{"field_one", "field_one.a", "field_one.b", "field_two.b", "field_three", "field_four"}, - }, - }, - }, - { - name: "doc file exist", - schemaDiff: diff.SchemaDiff{ - "a_resource": diff.ResourceDiff{ - Fields: map[string]diff.FieldDiff{ - "field_one": { - New: &schema.Schema{}, - }, - "field_one.a": { - New: &schema.Schema{}, - }, - "field_one.b": { - New: &schema.Schema{}, - }, - "field_two.a": { - New: &schema.Schema{}, - Old: &schema.Schema{}, - }, - "field_two.b": { - New: &schema.Schema{}, - }, - "field_three": { - New: &schema.Schema{ - Computed: true, - Optional: true, - }, - }, - "field_four": { - New: &schema.Schema{ - Computed: true, - }, - }, - }, - }, - }, - repo: "../testdata", - want: map[string]MissingDocDetails{ - "a_resource": { - FilePath: "/website/docs/r/a_resource.html.markdown", - Fields: []string{"field_one.b", "field_two.b", "field_three", "field_four"}, - }, - }, - }, - { - name: "nested new field missing doc", - schemaDiff: diff.SchemaDiff{ - "a_resource": diff.ResourceDiff{ - Fields: map[string]diff.FieldDiff{ - "field_one.c": { - New: &schema.Schema{}, - }, - }, - }, - }, - repo: "../testdata", - want: map[string]MissingDocDetails{ - "a_resource": { - FilePath: "/website/docs/r/a_resource.html.markdown", - Fields: []string{"field_one.c"}, - }, - }, - }, - { - name: "member and members is member/members in doc", - schemaDiff: diff.SchemaDiff{ - "a_resource": diff.ResourceDiff{ - Fields: map[string]diff.FieldDiff{ - "member": { - New: &schema.Schema{}, - }, - "members": { - New: &schema.Schema{}, - }, - }, - }, - }, - repo: "../testdata", - want: map[string]MissingDocDetails{}, - }, - } { - t.Run(test.name, func(t *testing.T) { - got, err := DetectMissingDocs(test.schemaDiff, test.repo, resourceSchema) - if err != nil { - t.Fatalf("DetectMissingDocs = %v, want = nil", err) - } - for r := range test.want { - sort.Strings(test.want[r].Fields) - } - for r := range got { - sort.Strings(got[r].Fields) - } - if diff := cmp.Diff(test.want, got); diff != "" { - t.Errorf("DetectMissingDocs = %v, want = %v", got, test.want) - } - }) - } -} diff --git a/tools/diff-processor/diff/diff.go b/tools/diff-processor/diff/diff.go index a12eb8eb76e8..1f70760b1a89 100644 --- a/tools/diff-processor/diff/diff.go +++ b/tools/diff-processor/diff/diff.go @@ -1,13 +1,12 @@ package diff import ( - "maps" "reflect" - "slices" - "strings" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "golang.org/x/exp/maps" ) // SchemaDiff is a nested map with resource names as top-level keys. @@ -16,35 +15,8 @@ type SchemaDiff map[string]ResourceDiff type ResourceDiff struct { ResourceConfig ResourceConfigDiff Fields map[string]FieldDiff - FieldSets ResourceFieldSetsDiff } -type ResourceFieldSetsDiff struct { - Old ResourceFieldSets - New ResourceFieldSets -} - -type ResourceFieldSetsDiffWithKeys struct { - Old ResourceFieldSetsWithKeys - New ResourceFieldSetsWithKeys -} - -type ResourceFieldSets struct { - ConflictsWith []FieldSet - ExactlyOneOf []FieldSet - AtLeastOneOf []FieldSet - RequiredWith []FieldSet -} - -type ResourceFieldSetsWithKeys struct { - ConflictsWith map[string]FieldSet - ExactlyOneOf map[string]FieldSet - AtLeastOneOf map[string]FieldSet - RequiredWith map[string]FieldSet -} - -type FieldSet map[string]struct{} - type ResourceConfigDiff struct { Old *schema.Resource New *schema.Resource @@ -57,7 +29,7 @@ type FieldDiff struct { func ComputeSchemaDiff(oldResourceMap, newResourceMap map[string]*schema.Resource) SchemaDiff { schemaDiff := make(SchemaDiff) - for resource := range union(oldResourceMap, newResourceMap) { + for resource, _ := range union(maps.Keys(oldResourceMap), maps.Keys(newResourceMap)) { // Compute diff between old and new resources and fields. // TODO: add support for computing diff between resource configs, not just whether the // resource was added/removed. b/300114839 @@ -75,16 +47,16 @@ func ComputeSchemaDiff(oldResourceMap, newResourceMap map[string]*schema.Resourc } resourceDiff.Fields = make(map[string]FieldDiff) - fieldSetsDiffWithKeys := ResourceFieldSetsDiffWithKeys{} - for key := range union(flattenedOldSchema, flattenedNewSchema) { + for key, _ := range union(maps.Keys(flattenedOldSchema), maps.Keys(flattenedNewSchema)) { oldField := flattenedOldSchema[key] newField := flattenedNewSchema[key] - if fieldDiff, fieldSetsDiff, changed := diffFields(oldField, newField, key); changed { - resourceDiff.Fields[key] = fieldDiff - fieldSetsDiffWithKeys = mergeFieldSetsDiff(fieldSetsDiffWithKeys, fieldSetsDiff) + if fieldChanged(oldField, newField) { + resourceDiff.Fields[key] = FieldDiff{ + Old: oldField, + New: newField, + } } } - resourceDiff.FieldSets = removeFieldSetsDiffKeys(fieldSetsDiffWithKeys) if len(resourceDiff.Fields) > 0 || !cmp.Equal(resourceDiff.ResourceConfig.Old, resourceDiff.ResourceConfig.New) { schemaDiff[resource] = resourceDiff } @@ -92,6 +64,17 @@ func ComputeSchemaDiff(oldResourceMap, newResourceMap map[string]*schema.Resourc return schemaDiff } +func union(keys1, keys2 []string) map[string]struct{} { + allKeys := make(map[string]struct{}) + for _, key := range keys1 { + allKeys[key] = struct{}{} + } + for _, key := range keys2 { + allKeys[key] = struct{}{} + } + return allKeys +} + func flattenSchema(parentKey string, schemaObj map[string]*schema.Schema) map[string]*schema.Schema { flattened := make(map[string]*schema.Schema) @@ -113,48 +96,16 @@ func flattenSchema(parentKey string, schemaObj map[string]*schema.Schema) map[st return flattened } -func diffFields(oldField, newField *schema.Schema, fieldName string) (FieldDiff, ResourceFieldSetsDiff, bool) { +func fieldChanged(oldField, newField *schema.Schema) bool { // If either field is nil, it is changed; if both are nil (which should never happen) it's not if oldField == nil && newField == nil { - return FieldDiff{}, ResourceFieldSetsDiff{}, false - } - - oldFieldSets := fieldSets(oldField, fieldName) - newFieldSets := fieldSets(newField, fieldName) - - fieldDiff := FieldDiff{ - Old: oldField, - New: newField, - } - fieldSetsDiff := ResourceFieldSetsDiff{ - Old: oldFieldSets, - New: newFieldSets, + return false } if oldField == nil || newField == nil { - return fieldDiff, fieldSetsDiff, true + return true } // Check if any basic Schema struct fields have changed. // https://github.com/hashicorp/terraform-plugin-sdk/blob/v2.24.0/helper/schema/schema.go#L44 - if basicSchemaChanged(oldField, newField) { - return fieldDiff, fieldSetsDiff, true - } - - if !cmp.Equal(oldFieldSets, newFieldSets) { - return fieldDiff, fieldSetsDiff, true - } - - if elemChanged(oldField, newField) { - return fieldDiff, fieldSetsDiff, true - } - - if funcsChanged(oldField, newField) { - return fieldDiff, fieldSetsDiff, true - } - - return FieldDiff{}, ResourceFieldSetsDiff{}, false -} - -func basicSchemaChanged(oldField, newField *schema.Schema) bool { if oldField.Type != newField.Type { return true } @@ -197,35 +148,26 @@ func basicSchemaChanged(oldField, newField *schema.Schema) bool { if oldField.Sensitive != newField.Sensitive { return true } - return false -} -func fieldSets(field *schema.Schema, fieldName string) ResourceFieldSets { - if field == nil { - return ResourceFieldSets{} - } - var conflictsWith, exactlyOneOf, atLeastOneOf, requiredWith []FieldSet - if len(field.ConflictsWith) > 0 { - conflictsWith = []FieldSet{sliceToSetRemoveZeroPadding(append(field.ConflictsWith, fieldName))} - } - if len(field.ExactlyOneOf) > 0 { - exactlyOneOf = []FieldSet{sliceToSetRemoveZeroPadding(append(field.ExactlyOneOf, fieldName))} + // Compare slices + less := func(a, b string) bool { return a < b } + + if (len(oldField.ConflictsWith) > 0 || len(newField.ConflictsWith) > 0) && !cmp.Equal(oldField.ConflictsWith, newField.ConflictsWith, cmpopts.SortSlices(less)) { + return true } - if len(field.AtLeastOneOf) > 0 { - atLeastOneOf = []FieldSet{sliceToSetRemoveZeroPadding(append(field.AtLeastOneOf, fieldName))} + + if (len(oldField.ExactlyOneOf) > 0 || len(newField.ExactlyOneOf) > 0) && !cmp.Equal(oldField.ExactlyOneOf, newField.ExactlyOneOf, cmpopts.SortSlices(less)) { + return true } - if len(field.RequiredWith) > 0 { - requiredWith = []FieldSet{sliceToSetRemoveZeroPadding(append(field.RequiredWith, fieldName))} + + if (len(oldField.AtLeastOneOf) > 0 || len(newField.AtLeastOneOf) > 0) && !cmp.Equal(oldField.AtLeastOneOf, newField.AtLeastOneOf, cmpopts.SortSlices(less)) { + return true } - return ResourceFieldSets{ - ConflictsWith: conflictsWith, - ExactlyOneOf: exactlyOneOf, - AtLeastOneOf: atLeastOneOf, - RequiredWith: requiredWith, + + if (len(oldField.RequiredWith) > 0 || len(newField.RequiredWith) > 0) && !cmp.Equal(oldField.RequiredWith, newField.RequiredWith, cmpopts.SortSlices(less)) { + return true } -} -func elemChanged(oldField, newField *schema.Schema) bool { // Check if Elem changed (unless old and new both represent nested fields) if (oldField.Elem == nil && newField.Elem != nil) || (oldField.Elem != nil && newField.Elem == nil) { return true @@ -241,15 +183,12 @@ func elemChanged(oldField, newField *schema.Schema) bool { return true } if !oldIsResource && !newIsResource { - if _, _, changed := diffFields(oldField.Elem.(*schema.Schema), newField.Elem.(*schema.Schema), ""); changed { + if fieldChanged(oldField.Elem.(*schema.Schema), newField.Elem.(*schema.Schema)) { return true } } } - return false -} -func funcsChanged(oldField, newField *schema.Schema) bool { // Check if any Schema struct fields that are functions have changed if funcChanged(oldField.DiffSuppressFunc, newField.DiffSuppressFunc) { return true @@ -269,6 +208,7 @@ func funcsChanged(oldField, newField *schema.Schema) bool { if funcChanged(oldField.ValidateDiagFunc, newField.ValidateDiagFunc) { return true } + return false } @@ -285,52 +225,3 @@ func funcChanged(oldFunc, newFunc interface{}) bool { // b/300157205 return false } - -func mergeFieldSetsDiff(allFields ResourceFieldSetsDiffWithKeys, currentField ResourceFieldSetsDiff) ResourceFieldSetsDiffWithKeys { - allFields.Old = mergeResourceFieldSets(allFields.Old, currentField.Old) - allFields.New = mergeResourceFieldSets(allFields.New, currentField.New) - return allFields -} - -func mergeResourceFieldSets(allFields ResourceFieldSetsWithKeys, currentField ResourceFieldSets) ResourceFieldSetsWithKeys { - allFields.ConflictsWith = mergeFieldSets(allFields.ConflictsWith, currentField.ConflictsWith) - allFields.ExactlyOneOf = mergeFieldSets(allFields.ExactlyOneOf, currentField.ExactlyOneOf) - allFields.AtLeastOneOf = mergeFieldSets(allFields.AtLeastOneOf, currentField.AtLeastOneOf) - allFields.RequiredWith = mergeFieldSets(allFields.RequiredWith, currentField.RequiredWith) - return allFields -} - -func mergeFieldSets(allFields map[string]FieldSet, currentField []FieldSet) map[string]FieldSet { - if allFields == nil { - allFields = make(map[string]FieldSet) - } - for _, fieldSet := range currentField { - allFields[setKey(fieldSet)] = fieldSet - } - return allFields -} - -func setKey(set FieldSet) string { - slice := setToSortedSlice(set) - return strings.Join(slice, ",") -} - -func removeFieldSetsDiffKeys(fieldSets ResourceFieldSetsDiffWithKeys) ResourceFieldSetsDiff { - return ResourceFieldSetsDiff{ - Old: removeFieldSetsKey(fieldSets.Old), - New: removeFieldSetsKey(fieldSets.New), - } -} - -func removeFieldSetsKey(fieldSets ResourceFieldSetsWithKeys) ResourceFieldSets { - return ResourceFieldSets{ - ConflictsWith: removeFieldSetKey(fieldSets.ConflictsWith), - ExactlyOneOf: removeFieldSetKey(fieldSets.ExactlyOneOf), - AtLeastOneOf: removeFieldSetKey(fieldSets.AtLeastOneOf), - RequiredWith: removeFieldSetKey(fieldSets.RequiredWith), - } -} - -func removeFieldSetKey(fieldSets map[string]FieldSet) []FieldSet { - return slices.Collect(maps.Values(fieldSets)) -} diff --git a/tools/diff-processor/diff/diff_test.go b/tools/diff-processor/diff/diff_test.go index bab738355ea7..5fb6057abd5c 100644 --- a/tools/diff-processor/diff/diff_test.go +++ b/tools/diff-processor/diff/diff_test.go @@ -984,7 +984,7 @@ func TestFieldChanged(t *testing.T) { tc := tc t.Run(tn, func(t *testing.T) { t.Parallel() - _, _, changed := diffFields(tc.oldField, tc.newField, "") + changed := fieldChanged(tc.oldField, tc.newField) if changed != tc.expectChanged { if diff := cmp.Diff(tc.oldField, tc.newField); diff != "" { t.Errorf("want %t; got %t.\nField diff (-old, +new):\n%s", @@ -1074,15 +1074,9 @@ func TestComputeSchemaDiff(t *testing.T) { Schema: map[string]*schema.Schema{ "field_one": { Type: schema.TypeString, - ConflictsWith: []string{ - "field_two", - }, }, "field_two": { Type: schema.TypeList, - ConflictsWith: []string{ - "field_one", - }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "field_three": { @@ -1116,15 +1110,9 @@ func TestComputeSchemaDiff(t *testing.T) { Schema: map[string]*schema.Schema{ "field_one": { Type: schema.TypeString, - ConflictsWith: []string{ - "field_two", - }, }, "field_two": { Type: schema.TypeList, - ConflictsWith: []string{ - "field_one", - }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "field_three": { @@ -1146,15 +1134,9 @@ func TestComputeSchemaDiff(t *testing.T) { Schema: map[string]*schema.Schema{ "field_three": { Type: schema.TypeString, - ConflictsWith: []string{ - "field_two.0.field_four", - }, }, "field_four": { Type: schema.TypeInt, - ConflictsWith: []string{ - "field_two.0.field_three", - }, }, }, }, @@ -1169,35 +1151,10 @@ func TestComputeSchemaDiff(t *testing.T) { New: &schema.Resource{}, }, Fields: map[string]FieldDiff{ - "field_two.field_three": FieldDiff{ - Old: &schema.Schema{ - Type: schema.TypeString, - }, - New: &schema.Schema{ - Type: schema.TypeString, - ConflictsWith: []string{ - "field_two.0.field_four", - }, - }, - }, "field_two.field_four": FieldDiff{ Old: nil, New: &schema.Schema{ Type: schema.TypeInt, - ConflictsWith: []string{ - "field_two.0.field_three", - }, - }, - }, - }, - FieldSets: ResourceFieldSetsDiff{ - Old: ResourceFieldSets{}, - New: ResourceFieldSets{ - ConflictsWith: []FieldSet{ - { - "field_two.field_three": {}, - "field_two.field_four": {}, - }, }, }, }, diff --git a/tools/diff-processor/diff/sets.go b/tools/diff-processor/diff/sets.go deleted file mode 100644 index 51e1636ff837..000000000000 --- a/tools/diff-processor/diff/sets.go +++ /dev/null @@ -1,55 +0,0 @@ -package diff - -import ( - "sort" - "strings" -) - -// Return the union of two maps, overwriting any shared keys with the second map's values -func union[K comparable, V any](map1, map2 map[K]V) map[K]V { - if len(map1) == 0 { - return map2 - } - if len(map2) == 0 { - return map1 - } - merged := make(map[K]V, len(map1)+len(map2)) - for k, v := range map1 { - merged[k] = v - } - for k, v := range map2 { - merged[k] = v - } - return merged -} - -func sliceToSetRemoveZeroPadding(slice []string) map[string]struct{} { - set := make(map[string]struct{}) - for _, item := range slice { - set[removeZeroPadding(item)] = struct{}{} - } - return set -} - -// field1.0.field2 -> field1.field2 -func removeZeroPadding(zeroPadded string) string { - var trimmed string - for _, part := range strings.Split(zeroPadded, ".") { - if part != "0" { - trimmed += part + "." - } - } - if trimmed == "" { - return "" - } - return trimmed[:len(trimmed)-1] -} - -func setToSortedSlice(set map[string]struct{}) []string { - slice := make([]string, 0, len(set)) - for item := range set { - slice = append(slice, item) - } - sort.Strings(slice) - return slice -} diff --git a/tools/diff-processor/diff/sets_test.go b/tools/diff-processor/diff/sets_test.go deleted file mode 100644 index f2eb7a81923b..000000000000 --- a/tools/diff-processor/diff/sets_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package diff - -import ( - "testing" -) - -func TestRemoveZeroPadding(t *testing.T) { - for _, tc := range []struct { - name string - zeroPadded string - expected string - }{ - { - name: "no zeroes", - zeroPadded: "a.b.c", - expected: "a.b.c", - }, - { - name: "one zero", - zeroPadded: "a.0.b.c", - expected: "a.b.c", - }, - { - name: "two zeroes", - zeroPadded: "a.0.b.0.c", - expected: "a.b.c", - }, - } { - if got := removeZeroPadding(tc.zeroPadded); got != tc.expected { - t.Errorf("unexpected result for test case %s: %s (expected %s)", tc.name, got, tc.expected) - } - } -} diff --git a/tools/diff-processor/documentparser/document_parser.go b/tools/diff-processor/documentparser/document_parser.go deleted file mode 100644 index 28969906c665..000000000000 --- a/tools/diff-processor/documentparser/document_parser.go +++ /dev/null @@ -1,202 +0,0 @@ -package documentparser - -import ( - "fmt" - "regexp" - "sort" - "strings" -) - -const ( - nestedNamePattern = `\(#(nested_[a-z0-9_]+)\)` - - itemNamePattern = "\\* `([a-z0-9_\\./]+)`" - nestedLinkPattern = `` - - sectionSeparator = "## " - nestedObjectSeparator = ` 0 { - l := len(queue) - for _, cur := range queue { - // the separator should always at the beginning of the line - items := strings.Split(cur.text, "\n"+listItemSeparator) - for _, item := range items[1:] { - text := listItemSeparator + item - itemName, err := findItemName(text) - if err != nil { - return err - } - // There is a special case in some hand written resource eg. in compute_instance, where its attributes is in a.0.b.0.c format. - itemName = strings.ReplaceAll(itemName, ".0.", ".") - nestedName, err := findNestedName(text) - if err != nil { - return err - } - newNode := &node{ - name: itemName, - } - cur.children = append(cur.children, newNode) - if text, ok := nestedBlock[nestedName]; ok { - newNode.text = text - queue = append(queue, newNode) - } - } - - } - queue = queue[l:] - } - return nil -} - -func findItemName(text string) (name string, err error) { - name, err = findPattern(text, itemNamePattern) - if err != nil { - return "", err - } - if name == "" { - return "", fmt.Errorf("cannot find item name from %s", text) - } - return -} - -func findPattern(text string, pattern string) (string, error) { - re, err := regexp.Compile(pattern) - if err != nil { - return "", err - } - match := re.FindStringSubmatch(text) - - if match != nil { - return match[1], nil - } - return "", nil -} - -func findNestedName(text string) (string, error) { - s := strings.ReplaceAll(text, "\n", "") - return findPattern(s, nestedNamePattern) -} diff --git a/tools/diff-processor/documentparser/document_parser_test.go b/tools/diff-processor/documentparser/document_parser_test.go deleted file mode 100644 index d48df5f184e8..000000000000 --- a/tools/diff-processor/documentparser/document_parser_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package documentparser - -import ( - "os" - "sort" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestParse(t *testing.T) { - b, err := os.ReadFile("../testdata/resource.html.markdown") - if err != nil { - t.Fatal(err) - } - parser := NewParser() - if err := parser.Parse(b); err != nil { - t.Fatal(err) - } - wantArguments := []string{ - "boot_disk", - "boot_disk.auto_delete", - "boot_disk.device_name", - "boot_disk.disk_encryption_key_raw", - "boot_disk.initialize_params", - "boot_disk.initialize_params.enable_confidential_compute", - "boot_disk.initialize_params.image", - "boot_disk.initialize_params.labels", - "boot_disk.initialize_params.provisioned_iops", - "boot_disk.initialize_params.provisioned_throughput", - "boot_disk.initialize_params.resource_manager_tags", - "boot_disk.initialize_params.size", - "boot_disk.initialize_params.storage_pool", - "boot_disk.initialize_params.type", - "boot_disk.kms_key_self_link", - "boot_disk.mode", - "boot_disk.source", - "name", - "network_interface", - "network_interface.access_config", - "network_interface.access_config.nat_ip", - "network_interface.access_config.network_tier", - "network_interface.access_config.public_ptr_domain_name", - "network_interface.alias_ip_range", - "network_interface.alias_ip_range.ip_cidr_range", - "network_interface.alias_ip_range.subnetwork_range_name", - "network_interface.ipv6_access_config", - "network_interface.ipv6_access_config.external_ipv6", - "network_interface.ipv6_access_config.external_ipv6_prefix_length", - "network_interface.ipv6_access_config.name", - "network_interface.ipv6_access_config.network_tier", - "network_interface.ipv6_access_config.public_ptr_domain_name", - "network_interface.network", - "network_interface.network_attachment", - "network_interface.network_ip", - "network_interface.nic_type", - "network_interface.queue_count", - "network_interface.security_policy", - "network_interface.stack_type", - "params", - // "params.resource_manager_tags", // params text does not include a nested tag - "zone", - "labels", - "description", - "traffic_port_selector", - "traffic_port_selector.ports", - "project", - } - wantAttributes := []string{ - "id", - "network_interface.access_config.nat_ip", - "workload_identity_config", - "errors", - "workload_identity_config.identity_provider", - "workload_identity_config.issuer_uri", - "workload_identity_config.workload_pool", - "errors.message", - } - gotArguments := parser.Arguments() - gotAttributes := parser.Attributes() - for _, arr := range [][]string{gotArguments, wantArguments, gotAttributes, wantAttributes} { - sort.Strings(arr) - } - if diff := cmp.Diff(wantArguments, gotArguments); diff != "" { - t.Errorf("Parse returned diff in arguments(-want, +got): %s", diff) - } - if diff := cmp.Diff(wantAttributes, gotAttributes); diff != "" { - t.Errorf("Parse returned diff in attributes(-want, +got): %s", diff) - } -} - -func TestTraverse(t *testing.T) { - n1 := &node{name: "n1"} - n2 := &node{name: "n2"} - n3 := &node{name: "n3"} - n4 := &node{name: "n4"} - root := &node{ - children: []*node{n1, n2, n3}, - } - n1.children = []*node{n4} - n2.children = []*node{n4} - - var paths []string - traverse(&paths, "", root) - - wantPaths := []string{ - "n1", - "n1.n4", - "n2", - "n2.n4", - "n3", - } - if diff := cmp.Diff(wantPaths, paths); diff != "" { - t.Errorf("traverse returned diff(-want, +got): %s", diff) - } -} diff --git a/tools/diff-processor/go.mod b/tools/diff-processor/go.mod index d36995f9f3d0..ab15e328d016 100644 --- a/tools/diff-processor/go.mod +++ b/tools/diff-processor/go.mod @@ -15,67 +15,74 @@ replace github.com/GoogleCloudPlatform/magic-modules/tools/test-reader => ../tes require ( github.com/GoogleCloudPlatform/magic-modules/tools/test-reader v0.0.0-00010101000000-000000000000 github.com/davecgh/go-spew v1.1.1 - github.com/golang/glog v1.2.4 + github.com/golang/glog v1.2.0 github.com/google/go-cmp v0.6.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/hcl/v2 v2.20.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 github.com/spf13/cobra v1.8.0 - github.com/stretchr/testify v1.9.0 - github.com/zclconf/go-cty v1.14.4 - golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 + github.com/stretchr/testify v1.8.4 + github.com/zclconf/go-cty v1.14.2 + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 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 - cel.dev/expr v0.16.0 // indirect - cloud.google.com/go v0.116.0 // indirect - cloud.google.com/go/auth v0.13.0 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect - cloud.google.com/go/bigtable v1.33.0 // indirect - cloud.google.com/go/compute/metadata v0.6.0 // indirect - cloud.google.com/go/iam v1.2.2 // indirect - cloud.google.com/go/longrunning v0.6.2 // indirect - cloud.google.com/go/monitoring v1.21.2 // indirect - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.77.0 // indirect + cloud.google.com/go v0.112.0 // indirect + cloud.google.com/go/bigtable v1.19.0 // indirect + cloud.google.com/go/compute v1.23.4 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/iam v1.1.6 // indirect + cloud.google.com/go/longrunning v0.5.5 // indirect + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.64.0 // indirect + github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-cidr v1.1.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cncf/xds/go v0.0.0-20240822171458-6449f94b4d59 // indirect - github.com/envoyproxy/go-control-plane v0.13.0 // indirect - github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cloudflare/circl v1.3.7 // indirect + github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect + github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa // indirect + github.com/envoyproxy/go-control-plane v0.12.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 // indirect github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92 // indirect - github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932 // indirect - github.com/google/s2a-go v0.1.8 // indirect + github.com/google/s2a-go v0.1.7 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect - github.com/googleapis/gax-go/v2 v2.14.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.1 // 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-hclog v1.6.3 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-plugin v1.6.0 // 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.6.3 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-plugin-framework v1.13.0 // indirect + github.com/hashicorp/terraform-exec v0.20.0 // indirect + github.com/hashicorp/terraform-json v0.21.0 // indirect + github.com/hashicorp/terraform-plugin-framework v1.7.0 // indirect github.com/hashicorp/terraform-plugin-framework-validators v0.9.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.25.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.22.1 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-plugin-testing v1.5.1 // indirect github.com/hashicorp/terraform-provider-google v1.20.0 // indirect + github.com/hashicorp/terraform-registry-address v0.2.3 // indirect + github.com/hashicorp/terraform-svchost v0.1.1 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -87,7 +94,7 @@ require ( 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/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect + github.com/oklog/run v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -95,29 +102,26 @@ require ( github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect - go.opentelemetry.io/otel v1.29.0 // indirect - go.opentelemetry.io/otel/metric v1.29.0 // indirect - go.opentelemetry.io/otel/sdk v1.29.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect - go.opentelemetry.io/otel/trace v1.29.0 // indirect - go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect - golang.org/x/crypto v0.31.0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.33.0 // indirect - golang.org/x/oauth2 v0.24.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect - golang.org/x/time v0.8.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/api v0.214.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect + go.opentelemetry.io/otel v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect + golang.org/x/crypto v0.19.0 // indirect + golang.org/x/mod v0.15.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect + golang.org/x/tools v0.13.0 // indirect + google.golang.org/api v0.167.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect - google.golang.org/grpc v1.67.1 // indirect - google.golang.org/protobuf v1.35.2 // indirect + google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect + google.golang.org/grpc v1.62.1 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/tools/diff-processor/go.sum b/tools/diff-processor/go.sum index effd906557ba..71e1d1bb56e9 100644 --- a/tools/diff-processor/go.sum +++ b/tools/diff-processor/go.sum @@ -1,29 +1,27 @@ bitbucket.org/creachadair/stringset v0.0.8 h1:gQqe4vs8XWgMyijfyKE6K8o4TcyGGrRXe0JvHgx5H+M= bitbucket.org/creachadair/stringset v0.0.8/go.mod h1:AgthVMyMxC/6FK1KBJ2ALdqkZObGN8hOetgpwXyMn34= -cel.dev/expr v0.16.0 h1:yloc84fytn4zmJX2GU3TkXGsaieaV7dQ057Qs4sIG2Y= -cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE= -cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U= -cloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs= -cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q= -cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU= -cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= -cloud.google.com/go/bigtable v1.33.0 h1:2BDaWLRAwXO14DJL/u8crbV2oUbMZkIa2eGq8Yao1bk= -cloud.google.com/go/bigtable v1.33.0/go.mod h1:HtpnH4g25VT1pejHRtInlFPnN5sjTxbQlsYBjh9t5l0= -cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= -cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= -cloud.google.com/go/iam v1.2.2 h1:ozUSofHUGf/F4tCNy/mu9tHLTaxZFLOUiKzjcgWHGIA= -cloud.google.com/go/iam v1.2.2/go.mod h1:0Ys8ccaZHdI1dEUilwzqng/6ps2YB6vRsjIe00/+6JY= -cloud.google.com/go/longrunning v0.6.2 h1:xjDfh1pQcWPEvnfjZmwjKQEcHnpz6lHjfy7Fo0MK+hc= -cloud.google.com/go/longrunning v0.6.2/go.mod h1:k/vIs83RN4bE3YCswdXC5PFfWVILjm3hpEUlSko4PiI= -cloud.google.com/go/monitoring v1.21.2 h1:FChwVtClH19E7pJ+e0xUhJPGksctZNVOk2UhMmblmdU= -cloud.google.com/go/monitoring v1.21.2/go.mod h1:hS3pXvaG8KgWTSz+dAdyzPrGUYmi2Q+WFX8g2hqVEZU= +cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= +cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go/bigtable v1.19.0 h1:wiq9LT0kukfInzvy1joMDijCw/OD1UChpSbORXYn0LI= +cloud.google.com/go/bigtable v1.19.0/go.mod h1:xl5kPa8PTkJjdBxg6qdGH88464nNqmbISHSRU+D2yFE= +cloud.google.com/go/compute v1.23.4 h1:EBT9Nw4q3zyE7G45Wvv3MzolIrCJEuHys5muLY0wvAw= +cloud.google.com/go/compute v1.23.4/go.mod h1:/EJMj55asU6kAFnuZET8zqgwgJ9FvXWXOkkfQZa4ioI= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= +cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +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.77.0 h1:fCJw7h8lc8oVQAhoMABdsWAGWF8E6+4A5HvDHe5OsVM= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.77.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= -github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg= -github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.64.0 h1:QA90iKudX8ijAW795f/jVbo0oEo7VoevwxLCNyi2qRc= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.64.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 v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= +github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= 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/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= @@ -31,34 +29,43 @@ github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/Y github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= 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/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/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20240822171458-6449f94b4d59 h1:fLZ97KE86ELjEYJCEUVzmbhfzDxHHGwBrDVMd4XL6Bs= -github.com/cncf/xds/go v0.0.0-20240822171458-6449f94b4d59/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe h1:QQ3GSy+MqSHxm/d8nCtnAiZdYFd45cYZPs8vOOIYKfk= +github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/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-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= +github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 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= -github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= -github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= +github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= +github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= -github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= @@ -68,11 +75,17 @@ github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 h1:R+19WKQClnfMXS6 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/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.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= +github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= 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= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 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= @@ -81,8 +94,8 @@ github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3a 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= -github.com/golang/glog v1.2.4 h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc= -github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -100,10 +113,10 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD 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/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= -github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +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= @@ -115,59 +128,59 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/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/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= -github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= -github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= -github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o= -github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/gax-go/v2 v2.12.1 h1:9F8GV9r9ztXyAi00gsMQHNoF51xPZm8uj1dpYt2ZETM= +github.com/googleapis/gax-go/v2 v2.12.1/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= 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/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.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.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/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.6.2 h1:zdGAEd0V1lCaU0u+MxWQhtSDQmahpkwOun8U8EiRVog= -github.com/hashicorp/go-plugin v1.6.2/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= +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.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.6.4 h1:QLqlM56/+SIIGvGcfFiwMY3z5WGXT066suo/v9Km8e0= -github.com/hashicorp/hc-install v0.6.4/go.mod h1:05LWLy8TD842OtgcfBbOT0WMoInBMUSHjmDx10zuBIA= +github.com/hashicorp/hc-install v0.6.3 h1:yE/r1yJvWbtrJ0STwScgEnCanb0U9v7zp0Gbkmcoxqs= +github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= github.com/hashicorp/hcl/v2 v2.20.1 h1:M6hgdyz7HYt1UN9e61j+qKJBqR3orTWbI1HKBJEdxtc= github.com/hashicorp/hcl/v2 v2.20.1/go.mod h1:TZDqQ4kNKCbh1iJp99FdPiUaVDDUPivbqxZulxDYqL4= 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.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ= -github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= -github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec= -github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= -github.com/hashicorp/terraform-plugin-framework v1.13.0 h1:8OTG4+oZUfKgnfTdPTJwZ532Bh2BobF4H+yBiYJ/scw= -github.com/hashicorp/terraform-plugin-framework v1.13.0/go.mod h1:j64rwMGpgM3NYXTKuxrCnyubQb/4VKldEKlcG8cvmjU= +github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo= +github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= +github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= +github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= +github.com/hashicorp/terraform-plugin-framework v1.7.0 h1:wOULbVmfONnJo9iq7/q+iBOBJul5vRovaYJIu2cY/Pw= +github.com/hashicorp/terraform-plugin-framework v1.7.0/go.mod h1:jY9Id+3KbZ17OMpulgnWLSfwxNVYSoYBQFTgsx044CI= github.com/hashicorp/terraform-plugin-framework-validators v0.9.0 h1:LYz4bXh3t7bTEydXOmPDPupRRnA480B/9+jV8yZvxBA= github.com/hashicorp/terraform-plugin-framework-validators v0.9.0/go.mod h1:+BVERsnfdlhYR2YkXMBtPnmn9UsL19U3qUtSZ+Y/5MY= -github.com/hashicorp/terraform-plugin-go v0.25.0 h1:oi13cx7xXA6QciMcpcFi/rwA974rdTxjqEhXJjbAyks= -github.com/hashicorp/terraform-plugin-go v0.25.0/go.mod h1:+SYagMYadJP86Kvn+TGeV+ofr/R3g4/If0O5sO96MVw= +github.com/hashicorp/terraform-plugin-go v0.22.1 h1:iTS7WHNVrn7uhe3cojtvWWn83cm2Z6ryIUDTRO0EV7w= +github.com/hashicorp/terraform-plugin-go v0.22.1/go.mod h1:qrjnqRghvQ6KnDbB12XeZ4FluclYwptntoWCr9QaXTI= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-plugin-mux v0.17.0 h1:/J3vv3Ps2ISkbLPiZOLspFcIZ0v5ycUXCEQScudGCCw= -github.com/hashicorp/terraform-plugin-mux v0.17.0/go.mod h1:yWuM9U1Jg8DryNfvCp+lH70WcYv6D8aooQxxxIzFDsE= +github.com/hashicorp/terraform-plugin-mux v0.15.0 h1:+/+lDx0WUsIOpkAmdwBIoFU8UP9o2eZASoOnLsWbKME= +github.com/hashicorp/terraform-plugin-mux v0.15.0/go.mod h1:9ezplb1Dyq394zQ+ldB0nvy/qbNAz3mMoHHseMTMaKo= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= -github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c= -github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0= github.com/hashicorp/terraform-provider-google v1.20.0 h1:dVzBoqMHZA4PDAJaH3ztIey2cxFx6e+kRDAr3bMSrmI= github.com/hashicorp/terraform-provider-google v1.20.0/go.mod h1:19QAcvJTh1z3BfW6cxR5MQd89aIurcIIur99oJGbv/E= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= @@ -178,6 +191,12 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +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= @@ -216,18 +235,22 @@ github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx 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/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= 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/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +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/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -242,8 +265,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ 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= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +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= @@ -251,51 +274,49 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= 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= -github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= -github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.14.2 h1:kTG7lqmBou0Zkx35r6HJHUQTvaRPr5bIAf3AoHS0izI= +github.com/zclconf/go-cty v1.14.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI= 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/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= -go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= -go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= -go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= -go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= -go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= -go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= -go.opentelemetry.io/otel/sdk/metric v1.29.0 h1:K2CfmJohnRgvZ9UAj2/FhIf/okdWcNdBwe1m8xFXiSY= -go.opentelemetry.io/otel/sdk/metric v1.29.0/go.mod h1:6zZLdCl2fkauYoZIOn/soQIDSWFmNSRcICarHfuhNJQ= -go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= -go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 h1:P+/g8GpuJGYbOp2tAdKrIPUX9JO02q8Q0YNlHolpibA= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0/go.mod h1:tIKj3DbO8N9Y2xo52og3irLsPI4GW02DSMtrVgNMgxg= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 h1:doUP+ExOpH3spVTLS0FcWGLnQrPct/hD/bCPbDRUEAU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0/go.mod h1:rdENBZMT2OE6Ne/KLwpiXudnAsbdrdBaqBvTN8M8BgA= +go.opentelemetry.io/otel v1.23.0 h1:Df0pqjqExIywbMCMTxkAwzjLZtRf+bBKLbUcpxO2C9E= +go.opentelemetry.io/otel v1.23.0/go.mod h1:YCycw9ZeKhcJFrb34iVSkyT0iczq/zYDtZYFufObyB0= +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= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= -go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= 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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc= -golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= 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/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/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-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -307,19 +328,19 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= -golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= +golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= 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-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/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 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= @@ -337,8 +358,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -346,10 +367,10 @@ 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.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= -golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= 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= @@ -359,14 +380,14 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn 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/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +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= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.214.0 h1:h2Gkq07OYi6kusGOaT/9rnNljuXmqPnaig7WGPmKbwA= -google.golang.org/api v0.214.0/go.mod h1:bYPpLG8AyeMWwDU6NXoB00xC0DFkikVvd5MfwoxjLqE= +google.golang.org/api v0.167.0 h1:CKHrQD1BLRii6xdkatBDXyKzM0mkawt2QP+H3LtPmSE= +google.golang.org/api v0.167.0/go.mod h1:4FcBc686KFi7QI/U51/2GKKevfZMpM17sCdibqe/bSA= 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.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= @@ -375,20 +396,20 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA 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-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 h1:KJjNNclfpIkVqrZlTWcgOOaVQ00LdBnoEaRfkUx760s= -google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:mt9/MofW7AWQ+Gy179ChOnvmJatV8YHUmrcedo9CIFI= -google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= -google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 h1:g/4bk7P6TPMkAUbUhquq98xey1slwvuVJPosdBqYJlU= +google.golang.org/genproto v0.0.0-20240205150955-31a09d347014/go.mod h1:xEgQu1e4stdSSsxPDK8Azkrk/ECl5HvdPf6nbZrTS5M= +google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 h1:x9PwdEgd11LgK+orcck69WVRo7DezSO4VUMPI4xpc8A= +google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014/go.mod h1:rbHMSEDyoYX62nRVLOCc4Qt1HbsdytAYoVwgjiOhF3I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 h1:hZB7eLIaYlW9qXRfCq/qDaPdbeY3757uARz5Vvfv+cY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:YUWgXUFRPfoYK1IHMuxH5K6nPEXSCzIMljnQ59lLRCk= 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.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= 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= @@ -400,12 +421,14 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD 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.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= -google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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-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.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/tools/diff-processor/testdata/resource.html.markdown b/tools/diff-processor/testdata/resource.html.markdown deleted file mode 100644 index b06fc5b13984..000000000000 --- a/tools/diff-processor/testdata/resource.html.markdown +++ /dev/null @@ -1,285 +0,0 @@ ---- -subcategory: "Compute Engine" -description: |- - Manages abcdefg. ---- - -# google_test_resource - -This resource combines some sections in google_compute_instance, google_container_attached_cluster, network_services_endpoint_policy and irrelvant parts are trimmed. - -## Example Usage - -Lorem ipsum - -## Example usage - Confidential Computing - -Lorem ipsum - - -## Argument Reference - -The following arguments are supported: - -* `boot_disk` - (Required) The boot disk for the instance. - Structure is [documented below](#nested_boot_disk). - -* `name` - (Required) A unique name for the resource, required by GCE. - Changing this forces a new resource to be created. - -* `zone` - (Optional) The zone that the machine should be created in. If it is not provided, the provider zone is used. - -* `network_interface` - (Required) Networks to attach to the instance. This can - be specified multiple times. Structure is [documented below](#nested_network_interface). - -* `params` - (Optional) Additional instance parameters. - ---- - -The `boot_disk` block supports: - -* `auto_delete` - (Optional) Whether the disk will be auto-deleted when the instance - is deleted. Defaults to true. - -* `device_name` - (Optional) Name with which attached disk will be accessible. - On the instance, this device will be `/dev/disk/by-id/google-{{device_name}}`. - -* `mode` - (Optional) The mode in which to attach this disk, either `READ_WRITE` - or `READ_ONLY`. If not specified, the default is to attach the disk in `READ_WRITE` mode. - -* `disk_encryption_key_raw` - (Optional) A 256-bit [customer-supplied encryption key] - (https://cloud.google.com/compute/docs/disks/customer-supplied-encryption), - encoded in [RFC 4648 base64](https://tools.ietf.org/html/rfc4648#section-4) - to encrypt this disk. Only one of `kms_key_self_link` and `disk_encryption_key_raw` - may be set. - -* `kms_key_self_link` - (Optional) The self_link of the encryption key that is - stored in Google Cloud KMS to encrypt this disk. Only one of `kms_key_self_link` - and `disk_encryption_key_raw` may be set. - -* `initialize_params` - (Optional) Parameters for a new disk that will be created - alongside the new instance. Either `initialize_params` or `source` must be set. - Structure is [documented below](#nested_initialize_params). - -* `source` - (Optional) The name or self_link of the existing disk (such as those managed by - `google_compute_disk`) or disk image. To create an instance from a snapshot, first create a - `google_compute_disk` from a snapshot and reference it here. - -The `initialize_params` block supports: - -* `size` - (Optional) The size of the image in gigabytes. If not specified, it - will inherit the size of its base image. - -* `type` - (Optional) The GCE disk type. Such as pd-standard, pd-balanced or pd-ssd. - -* `image` - (Optional) The image from which to initialize this disk. This can be - one of: the image's `self_link`, `projects/{project}/global/images/{image}`, - `projects/{project}/global/images/family/{family}`, `global/images/{image}`, - `global/images/family/{family}`, `family/{family}`, `{project}/{family}`, - `{project}/{image}`, `{family}`, or `{image}`. If referred by family, the - images names must include the family name. If they don't, use the - [google_compute_image data source](/docs/providers/google/d/compute_image.html). - For instance, the image `centos-6-v20180104` includes its family name `centos-6`. - These images can be referred by family name here. - -* `labels` - (Optional) A set of key/value label pairs assigned to the disk. This - field is only applicable for persistent disks. - -* `resource_manager_tags` - (Optional) A tag is a key-value pair that can be attached to a Google Cloud resource. You can use tags to conditionally allow or deny policies based on whether a resource has a specific tag. This value is not returned by the API. In Terraform, this value cannot be updated and changing it will recreate the resource. - -* `provisioned_iops` - (Optional) Indicates how many IOPS to provision for the disk. - This sets the number of I/O operations per second that the disk can handle. - For more details,see the [Hyperdisk documentation](https://cloud.google.com/compute/docs/disks/hyperdisks). - Note: Updating currently is only supported for hyperdisk skus via disk update - api/gcloud without the need to delete and recreate the disk, hyperdisk allows - for an update of IOPS every 4 hours. To update your hyperdisk more frequently, - you'll need to manually delete and recreate it. - -* `provisioned_throughput` - (Optional) Indicates how much throughput to provision for the disk. - This sets the number of throughput mb per second that the disk can handle. - For more details,see the [Hyperdisk documentation](https://cloud.google.com/compute/docs/disks/hyperdisks). - Note: Updating currently is only supported for hyperdisk skus via disk update - api/gcloud without the need to delete and recreate the disk, hyperdisk allows - for an update of throughput every 4 hours. To update your hyperdisk more - frequently, you'll need to manually delete and recreate it. - -* `enable_confidential_compute` - (Optional) Whether this disk is using confidential compute mode. - Note: Only supported on hyperdisk skus, disk_encryption_key is required when setting to true. - -* `storage_pool` - (Optional) The URL of the storage pool in which the new disk is created. - For example: - * https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/storagePools/{storagePool} - * /projects/{project}/zones/{zone}/storagePools/{storagePool} - - -The `network_interface` block supports: - -* `network` - (Optional) The name or self_link of the network to attach this interface to. - Either `network` or `subnetwork` must be provided. If network isn't provided it will - be inferred from the subnetwork. - -* `subnetwork` - (Optional) The name or self_link of the subnetwork to attach this - interface to. Either `network` or `subnetwork` must be provided. If network isn't provided - it will be inferred from the subnetwork. The subnetwork must exist in the same region this - instance will be created in. If the network resource is in - [legacy](https://cloud.google.com/vpc/docs/legacy) mode, do not specify this field. If the - network is in auto subnet mode, specifying the subnetwork is optional. If the network is - in custom subnet mode, specifying the subnetwork is required. - - -* `subnetwork_project` - (Optional) The project in which the subnetwork belongs. - If the `subnetwork` is a self_link, this field is ignored in favor of the project - defined in the subnetwork self_link. If the `subnetwork` is a name and this - field is not provided, the provider project is used. - -* `network_ip` - (Optional) The private IP address to assign to the instance. If - empty, the address will be automatically assigned. - -* `access_config` - (Optional) Access configurations, i.e. IPs via which this - instance can be accessed via the Internet. Omit to ensure that the instance - is not accessible from the Internet. If omitted, ssh provisioners will not - work unless Terraform can send traffic to the instance's network (e.g. via - tunnel or because it is running on another cloud instance on that network). - This block can be repeated multiple times. Structure [documented below](#nested_access_config). - -* `alias_ip_range` - (Optional) An - array of alias IP ranges for this network interface. Can only be specified for network - interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range). - -* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. - -* `network_attachment` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) The URL of the network attachment that this interface should connect to in the following format: `projects/{projectNumber}/regions/{region_name}/networkAttachments/{network_attachment_name}`. - -* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. If not specified, IPV4_ONLY will be used. - -* `ipv6_access_config` - (Optional) An array of IPv6 access configurations for this interface. -Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig -specified, then this instance will have no external IPv6 Internet access. Structure [documented below](#nested_ipv6_access_config). - -* `queue_count` - (Optional) The networking queue count that's specified by users for the network interface. Both Rx and Tx queues will be set to this number. It will be empty if not specified. - -* `security_policy` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) A full or partial URL to a security policy to add to this instance. If this field is set to an empty string it will remove the associated security policy. - -The `access_config` block supports: - -* `nat_ip` - (Optional) The IP address that will be 1:1 mapped to the instance's - network ip. If not given, one will be generated. - -* `public_ptr_domain_name` - (Optional) The DNS domain name for the public PTR record. - To set this field on an instance, you must be verified as the owner of the domain. - See [the docs](https://cloud.google.com/compute/docs/instances/create-ptr-record) for how - to become verified as a domain owner. - -* `network_tier` - (Optional) The [networking tier](https://cloud.google.com/network-tiers/docs/overview) used for configuring this instance. - This field can take the following values: PREMIUM, FIXED_STANDARD or STANDARD. If this field is - not specified, it is assumed to be PREMIUM. - -The `ipv6_access_config` block supports: - -* `external_ipv6` - (Optional) The first IPv6 address of the external IPv6 range associated - with this instance, prefix length is stored in externalIpv6PrefixLength in ipv6AccessConfig. - To use a static external IP address, it must be unused and in the same region as the instance's zone. - If not specified, Google Cloud will automatically assign an external IPv6 address from the instance's subnetwork. - -* `external_ipv6_prefix_length` - (Optional) The prefix length of the external IPv6 range. - -* `name` - (Optional) The name of this access configuration. In ipv6AccessConfigs, the recommended name - is "External IPv6". - -* `network_tier` - (Optional) The service-level to be provided for IPv6 traffic when the - subnet has an external subnet. Only PREMIUM or STANDARD tier is valid for IPv6. - -* `public_ptr_domain_name` - (Optional) The domain name to be used when creating DNSv6 - records for the external IPv6 ranges.. - -The `alias_ip_range` block supports: - -* `ip_cidr_range` - The IP CIDR range represented by this alias IP range. This IP CIDR range - must belong to the specified subnetwork and cannot contain IP addresses reserved by - system or used by other network interfaces. This range may be a single IP address - (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string (e.g. 10.1.2.0/24). - -* `subnetwork_range_name` - (Optional) The subnetwork secondary range name specifying - the secondary range from which to allocate the IP CIDR range for this alias IP - range. If left unspecified, the primary range of the subnetwork will be used. - -The `params` block supports: - -* `resource_manager_tags` (Optional) - A tag is a key-value pair that can be attached to a Google Cloud resource. You can use tags to conditionally allow or deny policies based on whether a resource has a specific tag. This value is not returned by the API. In Terraform, this value cannot be updated and changing it will recreate the resource. - -- - - - - -* `labels` - - (Optional) - Set of label tags associated with the TcpRoute resource. - **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. - Please refer to the field `effective_labels` for all of the labels present on the resource. - -* `description` - - (Optional) - A free-text description of the resource. Max length 1024 characters. - -* `traffic_port_selector` - - (Optional) - Port selector for the (matched) endpoints. If no port selector is provided, the matched config is applied to all ports. - Structure is [documented below](#nested_traffic_port_selector). - -* `project` - (Optional) The ID of the project in which the resource belongs. - If it is not provided, the provider project is used. - - -The `traffic_port_selector` block supports: - -* `ports` - - (Required) - List of ports. Can be port numbers or port range (example, [80-90] specifies all ports from 80 to 90, including 80 and 90) or named ports or * to specify all ports. If the list is empty, all ports are selected. - - -## Attributes Reference - -In addition to the arguments listed above, the following computed attributes are -exported: - -* `id` - an identifier for the resource with format `projects/{{project}}/zones/{{zone}}/instances/{{name}}` - -* `network_interface.0.access_config.0.nat_ip` - If the instance has an access config, either the given external ip (in the `nat_ip` field) or the ephemeral (generated) ip (if you didn't provide one). - -* `workload_identity_config` - - Workload Identity settings. - Structure is [documented below](#nested_workload_identity_config). - -* `errors` - - A set of errors found in the cluster. - Structure is [documented below](#nested_errors). - - -The `workload_identity_config` block contains: - -* `identity_provider` - - (Optional) - The ID of the OIDC Identity Provider (IdP) associated to - the Workload Identity Pool. - -* `issuer_uri` - - (Optional) - The OIDC issuer URL for this cluster. - -* `workload_pool` - - (Optional) - The Workload Identity Pool associated to the cluster. - -The `errors` block contains: - -* `message` - - (Optional) - Human-friendly description of the error. - -## Timeouts - -Lorem ipsum - -## Import - -Lorem ipsum - diff --git a/tools/diff-processor/testdata/website/docs/r/a_resource.html.markdown b/tools/diff-processor/testdata/website/docs/r/a_resource.html.markdown deleted file mode 100644 index 9d3f5a0cde76..000000000000 --- a/tools/diff-processor/testdata/website/docs/r/a_resource.html.markdown +++ /dev/null @@ -1,18 +0,0 @@ -## Some resource description - -## Argument Reference - -* `field_one` lorem ipsum. Structure is [documented below](#nested_field_one). -* `member/members` - (Required) lorem ipsum. - -The `field_one` block supports: - -* `a` - (Optional) lorem ipsum. - -## Attributes Reference - -* `field_two` lorem ipsum. Structure is [documented below](#nested_field_two). - -The `field_two` block supports: - -* `a` - (Optional) lorem ipsum. \ No newline at end of file diff --git a/tools/issue-labeler/cmd/compute_new_labels.go b/tools/issue-labeler/cmd/compute_new_labels.go index 614d321a3306..22b5326fae95 100644 --- a/tools/issue-labeler/cmd/compute_new_labels.go +++ b/tools/issue-labeler/cmd/compute_new_labels.go @@ -45,23 +45,6 @@ func execComputeNewLabels() error { affectedResources := labeler.ExtractAffectedResources(issueBody) labels := labeler.ComputeLabels(affectedResources, regexpLabels) - // If there are more than 3 service labels, treat this as a cross-provider issue. - // Note that labeler.ComputeLabels() currently only returns service labels, but - // the logic here remains defensive in case that changes. - var serviceLabels []string - var nonServiceLabels []string - for _, l := range labels { - if strings.HasPrefix(l, "service/") { - serviceLabels = append(serviceLabels, l) - } else { - nonServiceLabels = append(nonServiceLabels, l) - } - } - if len(serviceLabels) > 3 { - serviceLabels = []string{"service/terraform"} - } - labels = append(nonServiceLabels, serviceLabels...) - if len(labels) > 0 { labels = append(labels, "forward/review") sort.Strings(labels) diff --git a/tools/issue-labeler/labeler/backfill.go b/tools/issue-labeler/labeler/backfill.go index cd7f36b25526..e96e1ab4df53 100644 --- a/tools/issue-labeler/labeler/backfill.go +++ b/tools/issue-labeler/labeler/backfill.go @@ -27,7 +27,7 @@ func GetIssues(repository, since string) ([]*github.Issue, error) { return nil, fmt.Errorf("invalid repository format: %w", err) } - sinceTime, err := time.Parse("2006-01-02", since) // input format YYYY-MM-DD + sinceTime, err := time.Parse(time.RFC3339, since) if err != nil { return nil, fmt.Errorf("invalid since time format: %w", err) } @@ -50,7 +50,16 @@ func GetIssues(repository, since string) ([]*github.Issue, error) { if err != nil { return nil, fmt.Errorf("listing issues: %w", err) } - allIssues = append(allIssues, issues...) + + // Convert github.Issue to our Issue type + for _, issue := range issues { + labels := make([]Label, len(issue.Labels)) + for i, l := range issue.Labels { + labels[i] = Label{Name: *l.Name} + } + + allIssues = append(allIssues, issue) + } if resp.NextPage == 0 { break @@ -66,8 +75,7 @@ func ComputeIssueUpdates(issues []*github.Issue, regexpLabels []RegexpLabel) []I var issueUpdates []IssueUpdate for _, issue := range issues { - // Skip pull requests - if issue.IsPullRequest() { + if !issue.IsPullRequest() { continue } @@ -96,7 +104,7 @@ func ComputeIssueUpdates(issues []*github.Issue, regexpLabels []RegexpLabel) []I issueUpdate.OldLabels = append(issueUpdate.OldLabels, label) } - affectedResources := ExtractAffectedResources(issue.GetBody()) + affectedResources := ExtractAffectedResources(*issue.Body) for _, needed := range ComputeLabels(affectedResources, regexpLabels) { desired[needed] = struct{}{} } @@ -110,10 +118,8 @@ func ComputeIssueUpdates(issues []*github.Issue, regexpLabels []RegexpLabel) []I } sort.Strings(issueUpdate.Labels) - issueUpdate.Number = issue.GetNumber() - if issueUpdate.Number > 0 { - issueUpdates = append(issueUpdates, issueUpdate) - } + issueUpdate.Number = *issue.Number + issueUpdates = append(issueUpdates, issueUpdate) } } diff --git a/tools/issue-labeler/labeler/backfill_test.go b/tools/issue-labeler/labeler/backfill_test.go index 85cf70731516..96e5f9d1dda2 100644 --- a/tools/issue-labeler/labeler/backfill_test.go +++ b/tools/issue-labeler/labeler/backfill_test.go @@ -4,20 +4,50 @@ import ( "fmt" "reflect" "regexp" + "strconv" "strings" "testing" "github.com/google/go-github/v61/github" ) -func testIssueBodyWithResources(resources []string) *string { - return github.String(fmt.Sprintf(` +// TestIssue represents a simplified issue structure for testing +type TestIssue struct { + Number int + Body string + Labels []string +} + +// Convert TestIssue to github.Issue +func (i TestIssue) toGithubIssue() *github.Issue { + var labels []*github.Label + for _, l := range i.Labels { + name := l + label := github.Label{Name: &name} + labels = append(labels, &label) + } + + number := i.Number + body := i.Body + pullRequestURLstr := "https://api.github.com/repos/owner/repo/pulls/" + strconv.Itoa(number) + prLinks := &github.PullRequestLinks{URL: &pullRequestURLstr} + + return &github.Issue{ + Number: &number, + Body: &body, + Labels: labels, + PullRequestLinks: prLinks, + } +} + +func testIssueBodyWithResources(resources []string) string { + return fmt.Sprintf(` ### New or Affected Resource(s): %s # -`, strings.Join(resources, "\n"))) +`, strings.Join(resources, "\n")) } func TestComputeIssueUpdates(t *testing.T) { @@ -36,80 +66,40 @@ func TestComputeIssueUpdates(t *testing.T) { }, } - cases := []struct { - name, description string - issues []*github.Issue + cases := map[string]struct { + issues []TestIssue regexpLabels []RegexpLabel expectedIssueUpdates []IssueUpdate }{ - { - name: "no issues", - description: "no issues means no updates", - issues: []*github.Issue{}, - regexpLabels: defaultRegexpLabels, - expectedIssueUpdates: []IssueUpdate{}, - }, - { - name: "nil body", - description: "gracefully handle a nil issue body", - issues: []*github.Issue{ - { - Number: github.Int(1), - }, - }, - regexpLabels: defaultRegexpLabels, - expectedIssueUpdates: []IssueUpdate{}, - }, - { - name: "nil number", - description: "gracefully handle a nil issue number", - issues: []*github.Issue{ - { - Body: testIssueBodyWithResources([]string{"google_service1_resource1"}), - }, - }, + "no issues -> no updates": { + issues: []TestIssue{}, regexpLabels: defaultRegexpLabels, expectedIssueUpdates: []IssueUpdate{}, }, - { - name: "no listed resources", - issues: []*github.Issue{ - { - Number: github.Int(1), - Body: github.String("Body with unusual structure"), - }, - }, - regexpLabels: defaultRegexpLabels, - expectedIssueUpdates: []IssueUpdate{}, - }, - { - name: "service/terraform", - description: "issues with service/terraform shouldn't get new labels", - issues: []*github.Issue{ + "exempt labels -> no updates": { + issues: []TestIssue{ { - Number: github.Int(1), + Number: 1, Body: testIssueBodyWithResources([]string{"google_service1_resource1"}), - Labels: []*github.Label{{Name: github.String("service/terraform")}}, + Labels: []string{"service/terraform"}, }, { - Number: github.Int(2), + Number: 2, Body: testIssueBodyWithResources([]string{"google_service1_resource1"}), - Labels: []*github.Label{{Name: github.String("forward/exempt")}}, + Labels: []string{"forward/exempt"}, }, }, regexpLabels: defaultRegexpLabels, expectedIssueUpdates: []IssueUpdate{}, }, - { - name: "add resource & review labels", - description: "issues with affected resources should normally get new labels added", - issues: []*github.Issue{ + "add resource & review labels": { + issues: []TestIssue{ { - Number: github.Int(1), + Number: 1, Body: testIssueBodyWithResources([]string{"google_service1_resource1"}), }, { - Number: github.Int(2), + Number: 2, Body: testIssueBodyWithResources([]string{"google_service2_resource1"}), }, }, @@ -125,37 +115,33 @@ func TestComputeIssueUpdates(t *testing.T) { }, }, }, - { - name: "labels already correct", - description: "don't update issues if all expected service labels are already present", - issues: []*github.Issue{ + "don't update issues if all service labels are already present": { + issues: []TestIssue{ { - Number: github.Int(1), + Number: 1, Body: testIssueBodyWithResources([]string{"google_service1_resource1"}), - Labels: []*github.Label{{Name: github.String("service/service1")}}, + Labels: []string{"service/service1"}, }, { - Number: github.Int(2), + Number: 2, Body: testIssueBodyWithResources([]string{"google_service2_resource1"}), - Labels: []*github.Label{{Name: github.String("service/service2-subteam1")}}, + Labels: []string{"service/service2-subteam1"}, }, }, regexpLabels: defaultRegexpLabels, expectedIssueUpdates: []IssueUpdate{}, }, - { - name: "missing labels", - description: "add missing service labels", - issues: []*github.Issue{ + "add missing service labels": { + issues: []TestIssue{ { - Number: github.Int(1), + Number: 1, Body: testIssueBodyWithResources([]string{"google_service1_resource1"}), - Labels: []*github.Label{{Name: github.String("service/service2-subteam1")}}, + Labels: []string{"service/service2-subteam1"}, }, { - Number: github.Int(2), + Number: 2, Body: testIssueBodyWithResources([]string{"google_service2_resource2"}), - Labels: []*github.Label{{Name: github.String("service/service1")}}, + Labels: []string{"service/service1"}, }, }, regexpLabels: defaultRegexpLabels, @@ -172,14 +158,12 @@ func TestComputeIssueUpdates(t *testing.T) { }, }, }, - { - name: "forward/linked", - description: "don't add missing service labels if already linked", - issues: []*github.Issue{ + "don't add missing service labels if already linked": { + issues: []TestIssue{ { - Number: github.Int(1), + Number: 1, Body: testIssueBodyWithResources([]string{"google_service1_resource1"}), - Labels: []*github.Label{{Name: github.String("service/service2-subteam1")}, {Name: github.String("forward/linked")}}, + Labels: []string{"service/service2-subteam1", "forward/linked"}, }, }, regexpLabels: defaultRegexpLabels, @@ -187,14 +171,20 @@ func TestComputeIssueUpdates(t *testing.T) { }, } - for _, tc := range cases { + for tn, tc := range cases { tc := tc - t.Run(tc.name, func(t *testing.T) { + t.Run(tn, func(t *testing.T) { t.Parallel() - issueUpdates := ComputeIssueUpdates(tc.issues, tc.regexpLabels) + // Convert TestIssues to github.Issues + var githubIssues []*github.Issue + for _, issue := range tc.issues { + githubIssues = append(githubIssues, issue.toGithubIssue()) + } + + issueUpdates := ComputeIssueUpdates(githubIssues, tc.regexpLabels) if !issueUpdatesEqual(issueUpdates, tc.expectedIssueUpdates) { - t.Errorf("ComputeIssueUpdates(%s) expected %v, got %v", tc.name, tc.expectedIssueUpdates, issueUpdates) + t.Errorf("Expected %v, got %v", tc.expectedIssueUpdates, issueUpdates) } }) } diff --git a/tools/issue-labeler/labeler/enrolled_teams.yml b/tools/issue-labeler/labeler/enrolled_teams.yml index 76ac6d097508..ea72f5e0b956 100755 --- a/tools/issue-labeler/labeler/enrolled_teams.yml +++ b/tools/issue-labeler/labeler/enrolled_teams.yml @@ -368,19 +368,8 @@ service/filestore: service/firebase: team: firebase-terraform resources: - - google_firebase_android.* - - google_firebase_apple.* - - google_firebase_app_check.* - - google_firebase_database.* - - google_firebase_extensions.* - - google_firebase_hosting.* - - google_firebase_project - - google_firebase_storage.* - - google_firebase_web.* + - google_firebase_.* - google_firebaserules_.* -service/firebasedataconnect: - resources: - - google_firebase_data_connect_.* service/firestore-controlplane: resources: - google_firestore_backup_schedule diff --git a/tpgtools/go.mod b/tpgtools/go.mod index 309ce3d2a5d4..9893922153c6 100644 --- a/tpgtools/go.mod +++ b/tpgtools/go.mod @@ -4,7 +4,7 @@ go 1.23 require ( bitbucket.org/creachadair/stringset v0.0.11 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.77.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.76.0 github.com/golang/glog v1.1.2 github.com/hashicorp/hcl v1.0.0 github.com/kylelemons/godebug v1.1.0 diff --git a/tpgtools/go.sum b/tpgtools/go.sum index c8792f090932..ef2bc02873bf 100644 --- a/tpgtools/go.sum +++ b/tpgtools/go.sum @@ -8,8 +8,6 @@ cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2Aawl github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.76.0 h1:VH/j8GmTsvPds/NkGfo4OYr9C7R8ysikaqq4rcDUT0s= github.com/GoogleCloudPlatform/declarative-resource-client-library v1.76.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.77.0 h1:fCJw7h8lc8oVQAhoMABdsWAGWF8E6+4A5HvDHe5OsVM= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.77.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= 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/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= diff --git a/tpgtools/overrides/compute/beta/firewall_policy.yaml b/tpgtools/overrides/compute/beta/firewall_policy.yaml new file mode 100644 index 000000000000..af851d79a0c9 --- /dev/null +++ b/tpgtools/overrides/compute/beta/firewall_policy.yaml @@ -0,0 +1,4 @@ +- type: CUSTOMIZE_DIFF + details: + functions: + - tpgresource.DefaultProviderProject diff --git a/tpgtools/overrides/eventarc/beta/trigger.yaml b/tpgtools/overrides/eventarc/beta/trigger.yaml new file mode 100644 index 000000000000..6900d95ba3a9 --- /dev/null +++ b/tpgtools/overrides/eventarc/beta/trigger.yaml @@ -0,0 +1,27 @@ +# Copyright 2021 Google LLC. All Rights Reserved. +# +# 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. +- type: CUSTOMIZE_DIFF + details: + functions: + - tpgresource.DefaultProviderProject +- type: CUSTOM_SCHEMA_VALUES + field: destination.cloud_function + details: + required: false + optional: false + computed: true +- type: CUSTOM_DESCRIPTION + field: destination.cloud_function + details: + description: "The Cloud Function resource name. Only Cloud Functions V2 is supported. Format projects/{project}/locations/{location}/functions/{function} This is a read-only field. [WARNING] Creating Cloud Functions V2 triggers is only supported via the Cloud Functions product. An error will be returned if the user sets this value." \ No newline at end of file diff --git a/tpgtools/overrides/eventarc/samples/trigger/basic.tf.tmpl b/tpgtools/overrides/eventarc/samples/trigger/basic.tf.tmpl new file mode 100644 index 000000000000..a866fe9513a2 --- /dev/null +++ b/tpgtools/overrides/eventarc/samples/trigger/basic.tf.tmpl @@ -0,0 +1,48 @@ +resource "google_eventarc_trigger" "primary" { + name = "{{name}}" + location = "europe-west1" + matching_criteria { + attribute = "type" + value = "google.cloud.pubsub.topic.v1.messagePublished" + } + destination { + cloud_run_service { + service = google_cloud_run_service.default.name + region = "europe-west1" + } + } + labels = { + foo = "bar" + } +} + +resource "google_pubsub_topic" "foo" { + name = "{{topic}}" +} + +resource "google_cloud_run_service" "default" { + name = "{{eventarc-service}}" + location = "europe-west1" + + metadata { + namespace = "{{project}}" + } + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + ports { + container_port = 8080 + } + } + container_concurrency = 50 + timeout_seconds = 100 + } + } + + traffic { + percent = 100 + latest_revision = true + } +} diff --git a/tpgtools/overrides/eventarc/samples/trigger/basic.yaml b/tpgtools/overrides/eventarc/samples/trigger/basic.yaml new file mode 100644 index 000000000000..b9a29806ff86 --- /dev/null +++ b/tpgtools/overrides/eventarc/samples/trigger/basic.yaml @@ -0,0 +1,16 @@ +updates: + - resource: basic_update_transport.tf.tmpl + - resource: basic_update_transport_2.tf.tmpl +variables: + - name: "project" + type: "project" + - name: "region" + type: "region" + - name: "name" + type: "resource_name" + - name: "topic" + type: "resource_name" + - name: "eventarc-service" + type: "resource_name" + - name: "sa" + type: "resource_name" diff --git a/tpgtools/overrides/eventarc/samples/trigger/basic_update_transport.tf.tmpl b/tpgtools/overrides/eventarc/samples/trigger/basic_update_transport.tf.tmpl new file mode 100644 index 000000000000..7e5afb55ce53 --- /dev/null +++ b/tpgtools/overrides/eventarc/samples/trigger/basic_update_transport.tf.tmpl @@ -0,0 +1,77 @@ +resource "google_eventarc_trigger" "primary" { + name = "{{name}}" + location = "europe-west1" + matching_criteria { + attribute = "type" + value = "google.cloud.pubsub.topic.v1.messagePublished" + } + destination { + cloud_run_service { + service = google_cloud_run_service.default.name + region = "europe-west1" + } + } + transport { + pubsub { + topic = google_pubsub_topic.foo.id + } + } +} + +resource "google_pubsub_topic" "foo" { + name = "{{topic}}" +} + +resource "google_cloud_run_service" "default" { + name = "{{eventarc-service}}" + location = "europe-west1" + + metadata { + namespace = "{{project}}" + } + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + ports { + container_port = 8080 + } + } + container_concurrency = 50 + timeout_seconds = 100 + } + } + + traffic { + percent = 100 + latest_revision = true + } +} + +resource "google_cloud_run_service" "default2" { + name = "{{eventarc-service}}2" + location = "europe-north1" + + metadata { + namespace = "{{project}}" + } + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + ports { + container_port = 8080 + } + } + container_concurrency = 50 + timeout_seconds = 100 + } + } + + traffic { + percent = 100 + latest_revision = true + } +} diff --git a/tpgtools/overrides/eventarc/samples/trigger/basic_update_transport_2.tf.tmpl b/tpgtools/overrides/eventarc/samples/trigger/basic_update_transport_2.tf.tmpl new file mode 100644 index 000000000000..7b84dc9911af --- /dev/null +++ b/tpgtools/overrides/eventarc/samples/trigger/basic_update_transport_2.tf.tmpl @@ -0,0 +1,86 @@ +resource "google_eventarc_trigger" "primary" { + name = "{{name}}" + location = "europe-west1" + matching_criteria { + attribute = "type" + value = "google.cloud.pubsub.topic.v1.messagePublished" + } + destination { + cloud_run_service { + service = google_cloud_run_service.default2.name + region = "europe-north1" + } + } + transport { + pubsub { + topic = google_pubsub_topic.foo.id + } + } + labels = { + foo = "bar" + } + service_account = google_service_account.eventarc-sa.email +} + +resource "google_service_account" "eventarc-sa" { + account_id = "{{sa}}" + display_name = "Test Service Account" +} + +resource "google_pubsub_topic" "foo" { + name = "{{topic}}" +} + +resource "google_cloud_run_service" "default" { + name = "{{eventarc-service}}" + location = "europe-west1" + + metadata { + namespace = "{{project}}" + } + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + ports { + container_port = 8080 + } + } + container_concurrency = 50 + timeout_seconds = 100 + } + } + + traffic { + percent = 100 + latest_revision = true + } +} + +resource "google_cloud_run_service" "default2" { + name = "{{eventarc-service}}2" + location = "europe-north1" + + metadata { + namespace = "{{project}}" + } + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + ports { + container_port = 8080 + } + } + container_concurrency = 50 + timeout_seconds = 100 + } + } + + traffic { + percent = 100 + latest_revision = true + } +} diff --git a/tpgtools/overrides/eventarc/samples/trigger/meta.yaml b/tpgtools/overrides/eventarc/samples/trigger/meta.yaml new file mode 100644 index 000000000000..e33fe393d690 --- /dev/null +++ b/tpgtools/overrides/eventarc/samples/trigger/meta.yaml @@ -0,0 +1,4 @@ +# meta.yaml +# +# + diff --git a/tpgtools/overrides/eventarc/trigger.yaml b/tpgtools/overrides/eventarc/trigger.yaml new file mode 100644 index 000000000000..6900d95ba3a9 --- /dev/null +++ b/tpgtools/overrides/eventarc/trigger.yaml @@ -0,0 +1,27 @@ +# Copyright 2021 Google LLC. All Rights Reserved. +# +# 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. +- type: CUSTOMIZE_DIFF + details: + functions: + - tpgresource.DefaultProviderProject +- type: CUSTOM_SCHEMA_VALUES + field: destination.cloud_function + details: + required: false + optional: false + computed: true +- type: CUSTOM_DESCRIPTION + field: destination.cloud_function + details: + description: "The Cloud Function resource name. Only Cloud Functions V2 is supported. Format projects/{project}/locations/{location}/functions/{function} This is a read-only field. [WARNING] Creating Cloud Functions V2 triggers is only supported via the Cloud Functions product. An error will be returned if the user sets this value." \ No newline at end of file