diff --git a/mmv1/templates/terraform/constants/access_approval.go.tmpl b/mmv1/templates/terraform/constants/access_approval.go.tmpl index 4d6306f11131..1c4a7a19475b 100644 --- a/mmv1/templates/terraform/constants/access_approval.go.tmpl +++ b/mmv1/templates/terraform/constants/access_approval.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} var accessApprovalCloudProductMapping = map[string]string{ "appengine.googleapis.com": "App Engine", "bigquery.googleapis.com": "BigQuery", diff --git a/mmv1/templates/terraform/constants/agent_pool.go.tmpl b/mmv1/templates/terraform/constants/agent_pool.go.tmpl index c64ae88de421..5f4bbdcfa820 100644 --- a/mmv1/templates/terraform/constants/agent_pool.go.tmpl +++ b/mmv1/templates/terraform/constants/agent_pool.go.tmpl @@ -1,4 +1,4 @@ -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} // waitForAgentPoolReady waits for an agent pool to leave the // "CREATING" state and become "CREATED", to indicate that it's ready. func waitForAgentPoolReady(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { @@ -19,4 +19,4 @@ func waitForAgentPoolReady(d *schema.ResourceData, config *transport_tpg.Config, } }) } -<% end -%> +{{- end }} diff --git a/mmv1/templates/terraform/constants/artifact_registry_repository.go.tmpl b/mmv1/templates/terraform/constants/artifact_registry_repository.go.tmpl index 52e5b587d59c..46d3754d6602 100644 --- a/mmv1/templates/terraform/constants/artifact_registry_repository.go.tmpl +++ b/mmv1/templates/terraform/constants/artifact_registry_repository.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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 upstreamPoliciesDiffSuppress(k, old, new string, d *schema.ResourceData) bool { o, n := d.GetChange("virtual_repository_config.0.upstream_policies") oldPolicies, ok := o.([]any) diff --git a/mmv1/templates/terraform/constants/backend_service.go.tmpl b/mmv1/templates/terraform/constants/backend_service.go.tmpl index 72faefd5c4ef..31123d1a9e54 100644 --- a/mmv1/templates/terraform/constants/backend_service.go.tmpl +++ b/mmv1/templates/terraform/constants/backend_service.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // suppress changes on sample_rate if log_config is set to disabled. func suppressWhenDisabled(k, old, new string, d *schema.ResourceData) bool { _, n := d.GetChange("log_config.0.enable") diff --git a/mmv1/templates/terraform/constants/go/bigquery_job.go.tmpl b/mmv1/templates/terraform/constants/bigquery_job.go.tmpl similarity index 100% rename from mmv1/templates/terraform/constants/go/bigquery_job.go.tmpl rename to mmv1/templates/terraform/constants/bigquery_job.go.tmpl diff --git a/mmv1/templates/terraform/constants/billing_budget.tmpl b/mmv1/templates/terraform/constants/billing_budget.tmpl index 465333d10285..bf8fb67c6bc7 100644 --- a/mmv1/templates/terraform/constants/billing_budget.tmpl +++ b/mmv1/templates/terraform/constants/billing_budget.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} // Check to see if a specified value in the config exists and suppress diffs if so. Otherwise run EmptyOrDefaultStringSuppress. diff --git a/mmv1/templates/terraform/constants/binaryauthorization_attestor.go.tmpl b/mmv1/templates/terraform/constants/binaryauthorization_attestor.go.tmpl index beb4543c3800..d6e763776f23 100644 --- a/mmv1/templates/terraform/constants/binaryauthorization_attestor.go.tmpl +++ b/mmv1/templates/terraform/constants/binaryauthorization_attestor.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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 CompareSignatureAlgorithm(_, old, new string, _ *schema.ResourceData) bool { // See https://cloud.google.com/binary-authorization/docs/reference/rest/v1/projects.attestors#signaturealgorithm normalizedAlgorithms := map[string]string{ diff --git a/mmv1/templates/terraform/constants/binaryauthorization_policy.tmpl b/mmv1/templates/terraform/constants/binaryauthorization_policy.tmpl index 534a3b19da55..2c4e5d6c27bb 100644 --- a/mmv1/templates/terraform/constants/binaryauthorization_policy.tmpl +++ b/mmv1/templates/terraform/constants/binaryauthorization_policy.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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. --%> +{{/* + 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 DefaultBinaryAuthorizationPolicy(project string) map[string]interface{} { return map[string]interface{}{ "name": fmt.Sprintf("projects/%s/policy", project), diff --git a/mmv1/templates/terraform/constants/cert_manager.tmpl b/mmv1/templates/terraform/constants/cert_manager.tmpl index d74867aab7eb..5cbc173001a4 100644 --- a/mmv1/templates/terraform/constants/cert_manager.tmpl +++ b/mmv1/templates/terraform/constants/cert_manager.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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 certManagerDefaultScopeDiffSuppress(_, old, new string, diff *schema.ResourceData) bool { if old == "" && new == "DEFAULT" || old == "DEFAULT" && new == "" { diff --git a/mmv1/templates/terraform/constants/clouddomains_registration.go.tmpl b/mmv1/templates/terraform/constants/clouddomains_registration.go.tmpl index 565f10b887a4..a544535a321e 100644 --- a/mmv1/templates/terraform/constants/clouddomains_registration.go.tmpl +++ b/mmv1/templates/terraform/constants/clouddomains_registration.go.tmpl @@ -1,4 +1,4 @@ -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} // waitForRegistrationActive waits for a registration to leave the // "REGISTRATION_PENDING" state and become "ACTIVE" or any other state. func waitForRegistrationActive(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { @@ -19,4 +19,4 @@ func waitForRegistrationActive(d *schema.ResourceData, config *transport_tpg.Con } }) } -<% end -%> +{{- end }} diff --git a/mmv1/templates/terraform/constants/compute_service_attachment.go.tmpl b/mmv1/templates/terraform/constants/compute_service_attachment.go.tmpl index ee6a557b2f22..560f03a720d2 100644 --- a/mmv1/templates/terraform/constants/compute_service_attachment.go.tmpl +++ b/mmv1/templates/terraform/constants/compute_service_attachment.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // Hash based on key, which is either project_id_or_num or network_url. func computeServiceAttachmentConsumerAcceptListsHash(v interface{}) int { diff --git a/mmv1/templates/terraform/constants/datastream_stream.go.tmpl b/mmv1/templates/terraform/constants/datastream_stream.go.tmpl index bf26549931bd..a5f35834357a 100644 --- a/mmv1/templates/terraform/constants/datastream_stream.go.tmpl +++ b/mmv1/templates/terraform/constants/datastream_stream.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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 resourceDatastreamStreamCustomDiffFunc(diff tpgresource.TerraformResourceDiff) error { if diff.HasChange("desired_state") { old, new := diff.GetChange("desired_state") @@ -43,7 +41,7 @@ func resourceDatastreamStreamCustomDiff(_ context.Context, diff *schema.Resource return resourceDatastreamStreamCustomDiffFunc(diff) } -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} // waitForDatastreamStreamReady waits for an agent pool to reach a stable state to indicate that it's ready. func waitForDatastreamStreamReady(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { return retry.Retry(timeout, func() *retry.RetryError { @@ -78,4 +76,4 @@ func resourceDatastreamStreamDatabaseIdDiffSuppress(_, old, new string, _ *schem return old == new } -<% end -%> +{{ end }} diff --git a/mmv1/templates/terraform/constants/disk.tmpl b/mmv1/templates/terraform/constants/disk.tmpl index 409d59f3fb99..a3947c725250 100644 --- a/mmv1/templates/terraform/constants/disk.tmpl +++ b/mmv1/templates/terraform/constants/disk.tmpl @@ -1,5 +1,5 @@ -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} // diffsupress for hyperdisk provisioned_iops func hyperDiskIopsUpdateDiffSupress(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { if !strings.Contains(d.Get("type").(string), "hyperdisk") { @@ -15,14 +15,14 @@ func hyperDiskIopsUpdateDiffSupress(_ context.Context, d *schema.ResourceDiff, m return nil } -<% end -%> +{{- end }} -<% unless version == "ga" -%> +{{ if ne $.TargetVersionName `ga` -}} // Suppress all diffs, used for Disk.Interface which is a nonfunctional field func AlwaysDiffSuppress(_, _, _ string, _ *schema.ResourceData) bool { return true } -<% end -%> +{{- end }} // diffsupress for beta and to check change in source_disk attribute func sourceDiskDiffSupress(_, old, new string, _ *schema.ResourceData) bool { diff --git a/mmv1/templates/terraform/constants/dlp_stored_info_type.go.tmpl b/mmv1/templates/terraform/constants/dlp_stored_info_type.go.tmpl index c13ff8364538..ee31a43a150f 100644 --- a/mmv1/templates/terraform/constants/dlp_stored_info_type.go.tmpl +++ b/mmv1/templates/terraform/constants/dlp_stored_info_type.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} // This customizeDiff allows updating the dictionary, regex, and large_custom_dictionary fields, but // it recreates the resource if changing between these fields. e.g., updating the regex field should // be allowed, while changing from regex to dictionary should trigger the recreation of the resource. diff --git a/mmv1/templates/terraform/constants/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/constants/firebase_database_instance.go.tmpl index 2a4107669e53..56b904e98b12 100644 --- a/mmv1/templates/terraform/constants/firebase_database_instance.go.tmpl +++ b/mmv1/templates/terraform/constants/firebase_database_instance.go.tmpl @@ -1,5 +1,5 @@ func enableRTDB(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string) error { - url, err := tpgresource.ReplaceVars(d, config, "{{FirebaseDatabaseBasePath}}projects/{{project}}/locations/{{region}}/instances/{{instance_id}}:reenable") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseDatabaseBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/instances/{{"{{"}}instance_id{{"}}"}}:reenable") if err != nil { return err } @@ -20,7 +20,7 @@ func enableRTDB(config *transport_tpg.Config, d *schema.ResourceData, project st } func disableRTDB(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string) error { - url, err := tpgresource.ReplaceVars(d, config, "{{FirebaseDatabaseBasePath}}projects/{{project}}/locations/{{region}}/instances/{{instance_id}}:disable") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseDatabaseBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/instances/{{"{{"}}instance_id{{"}}"}}:disable") if err != nil { return err } diff --git a/mmv1/templates/terraform/constants/firebase_project.go.tmpl b/mmv1/templates/terraform/constants/firebase_project.go.tmpl index 0a12218e36dc..7c4be2f6e49f 100644 --- a/mmv1/templates/terraform/constants/firebase_project.go.tmpl +++ b/mmv1/templates/terraform/constants/firebase_project.go.tmpl @@ -1,5 +1,5 @@ func getExistingFirebaseProjectId(config *transport_tpg.Config, d *schema.ResourceData, billingProject string, userAgent string) (string, error) { - url, err := tpgresource.ReplaceVars(d, config, "{{FirebaseBasePath}}projects/{{project}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}") if err != nil { return "", err } @@ -12,7 +12,7 @@ func getExistingFirebaseProjectId(config *transport_tpg.Config, d *schema.Resour UserAgent: userAgent, }) if err == nil { - id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}") + id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}") if err != nil { return "", fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/constants/firewall.tmpl b/mmv1/templates/terraform/constants/firewall.tmpl index ca97156f569d..af53f902e987 100644 --- a/mmv1/templates/terraform/constants/firewall.tmpl +++ b/mmv1/templates/terraform/constants/firewall.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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 resourceComputeFirewallRuleHash(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) diff --git a/mmv1/templates/terraform/constants/go/gke_hub_membership_diff.go.tmpl b/mmv1/templates/terraform/constants/gke_hub_membership_diff.go.tmpl similarity index 100% rename from mmv1/templates/terraform/constants/go/gke_hub_membership_diff.go.tmpl rename to mmv1/templates/terraform/constants/gke_hub_membership_diff.go.tmpl diff --git a/mmv1/templates/terraform/constants/go/access_approval.go.tmpl b/mmv1/templates/terraform/constants/go/access_approval.go.tmpl deleted file mode 100644 index 1c4a7a19475b..000000000000 --- a/mmv1/templates/terraform/constants/go/access_approval.go.tmpl +++ /dev/null @@ -1,34 +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. -*/ -}} -var accessApprovalCloudProductMapping = map[string]string{ - "appengine.googleapis.com": "App Engine", - "bigquery.googleapis.com": "BigQuery", - "bigtable.googleapis.com": "Cloud Bigtable", - "cloudkms.googleapis.com": "Cloud Key Management Service", - "compute.googleapis.com": "Compute Engine", - "dataflow.googleapis.com": "Cloud Dataflow", - "iam.googleapis.com": "Cloud Identity and Access Management", - "pubsub.googleapis.com": "Cloud Pub/Sub", - "storage.googleapis.com": "Cloud Storage", -} -func accessApprovalEnrolledServicesHash(v interface{}) int { - var buf bytes.Buffer - m := v.(map[string]interface{}) - cp := m["cloud_product"].(string) - if n, ok := accessApprovalCloudProductMapping[cp]; ok { - cp = n - } - buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(cp))) // ToLower just in case - buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(m["enrollment_level"].(string)))) - return tpgresource.Hashcode(buf.String()) -} diff --git a/mmv1/templates/terraform/constants/go/agent_pool.go.tmpl b/mmv1/templates/terraform/constants/go/agent_pool.go.tmpl deleted file mode 100644 index 5f4bbdcfa820..000000000000 --- a/mmv1/templates/terraform/constants/go/agent_pool.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -// waitForAgentPoolReady waits for an agent pool to leave the -// "CREATING" state and become "CREATED", to indicate that it's ready. -func waitForAgentPoolReady(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { - return retry.Retry(timeout, func() *retry.RetryError { - if err := resourceStorageTransferAgentPoolRead(d, config); err != nil { - return retry.NonRetryableError(err) - } - - name := d.Get("name").(string) - state := d.Get("state").(string) - if state == "CREATING" { - return retry.RetryableError(fmt.Errorf("AgentPool %q has state %q.", name, state)) - } else if state == "CREATED" { - log.Printf("[DEBUG] AgentPool %q has state %q.", name, state) - return nil - } else { - return retry.NonRetryableError(fmt.Errorf("AgentPool %q has state %q.", name, state)) - } - }) -} -{{- end }} diff --git a/mmv1/templates/terraform/constants/go/apigee_instance.go.tmpl b/mmv1/templates/terraform/constants/go/apigee_instance.go.tmpl deleted file mode 100644 index c092cf26daed..000000000000 --- a/mmv1/templates/terraform/constants/go/apigee_instance.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -// Supress diffs when the lists of project have the same number of entries to handle the case that -// API does not return what the user originally provided. Instead, API does some transformation. -// For example, user provides a list of project number, but API returns a list of project Id. -func projectListDiffSuppress(_, _, _ string, d *schema.ResourceData) bool { - return ProjectListDiffSuppressFunc(d) -} - -func ProjectListDiffSuppressFunc(d tpgresource.TerraformResourceDataChange) bool { - kLength := "consumer_accept_list.#" - oldLength, newLength := d.GetChange(kLength) - - oldInt, ok := oldLength.(int) - if !ok { - return false - } - - newInt, ok := newLength.(int) - if !ok { - return false - } - log.Printf("[DEBUG] - suppressing diff with oldInt %d, newInt %d", oldInt, newInt) - - return oldInt == newInt -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/apphub_service_project.go.tmpl b/mmv1/templates/terraform/constants/go/apphub_service_project.go.tmpl deleted file mode 100644 index 55e38f6b1d44..000000000000 --- a/mmv1/templates/terraform/constants/go/apphub_service_project.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// Suppress all diff for the field Service Project -func ServiceProjectDiffSuppress(_, _, _ string, _ *schema.ResourceData) bool { - return true -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/artifact_registry_repository.go.tmpl b/mmv1/templates/terraform/constants/go/artifact_registry_repository.go.tmpl deleted file mode 100644 index 46d3754d6602..000000000000 --- a/mmv1/templates/terraform/constants/go/artifact_registry_repository.go.tmpl +++ /dev/null @@ -1,45 +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 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) -} diff --git a/mmv1/templates/terraform/constants/go/autokey_config_folder_diff.go.tmpl b/mmv1/templates/terraform/constants/go/autokey_config_folder_diff.go.tmpl deleted file mode 100644 index 530fc23be125..000000000000 --- a/mmv1/templates/terraform/constants/go/autokey_config_folder_diff.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -func folderPrefixSuppress(_, old, new string, d *schema.ResourceData) bool { - prefix := "folders/" - return prefix+old == new || prefix+new == old -} diff --git a/mmv1/templates/terraform/constants/go/backend_service.go.tmpl b/mmv1/templates/terraform/constants/go/backend_service.go.tmpl deleted file mode 100644 index 31123d1a9e54..000000000000 --- a/mmv1/templates/terraform/constants/go/backend_service.go.tmpl +++ /dev/null @@ -1,158 +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. -*/ -}} -// suppress changes on sample_rate if log_config is set to disabled. -func suppressWhenDisabled(k, old, new string, d *schema.ResourceData) bool { - _, n := d.GetChange("log_config.0.enable") - if tpgresource.IsEmptyValue(reflect.ValueOf(n)) { - return true - } - return false -} - -// Whether the backend is a global or regional NEG -func isNegBackend(backend map[string]interface{}) bool { - backendGroup, ok := backend["group"] - if !ok { - return false - } - - match, err := regexp.MatchString("(?:global|regions/[^/]+)/networkEndpointGroups", backendGroup.(string)) - if err != nil { - // should not happen as long as the regexp pattern compiled correctly - return false - } - return match -} - -func resourceGoogleComputeBackendServiceBackendHash(v interface{}) int { - if v == nil { - return 0 - } - - var buf bytes.Buffer - m := v.(map[string]interface{}) - log.Printf("[DEBUG] hashing %v", m) - - if group, err := tpgresource.GetRelativePath(m["group"].(string)); err != nil { - log.Printf("[WARN] Error on retrieving relative path of instance group: %s", err) - buf.WriteString(fmt.Sprintf("%s-", m["group"].(string))) - } else { - buf.WriteString(fmt.Sprintf("%s-", group)) - } - - if v, ok := m["balancing_mode"]; ok { - if v == nil { - v = "" - } - - buf.WriteString(fmt.Sprintf("%v-", v)) - } - if v, ok := m["capacity_scaler"]; ok { - if v == nil { - v = 0.0 - } - - // floats can't be added to the hash with %v as the other values are because - // %v and %f are not equivalent strings so this must remain as a float so that - // the hash function doesn't return something else. - buf.WriteString(fmt.Sprintf("%f-", v.(float64))) - } - if v, ok := m["description"]; ok { - if v == nil { - v = "" - } - - log.Printf("[DEBUG] writing description %s", v) - buf.WriteString(fmt.Sprintf("%v-", v)) - } - if v, ok := m["max_rate"]; ok { - if v == nil { - v = 0 - } - - buf.WriteString(fmt.Sprintf("%v-", v)) - } - if v, ok := m["max_rate_per_instance"]; ok { - if v == nil { - v = 0.0 - } - - // floats can't be added to the hash with %v as the other values are because - // %v and %f are not equivalent strings so this must remain as a float so that - // the hash function doesn't return something else. - buf.WriteString(fmt.Sprintf("%f-", v.(float64))) - } - if v, ok := m["max_connections"]; ok { - if v == nil { - v = 0 - } - - buf.WriteString(fmt.Sprintf("%v-", v)) - } - if v, ok := m["max_connections_per_instance"]; ok { - if v == nil { - v = 0 - } - - buf.WriteString(fmt.Sprintf("%v-", v)) - } - if v, ok := m["max_rate_per_instance"]; ok { - if v == nil { - v = 0.0 - } - - // floats can't be added to the hash with %v as the other values are because - // %v and %f are not equivalent strings so this must remain as a float so that - // the hash function doesn't return something else. - buf.WriteString(fmt.Sprintf("%f-", v.(float64))) - } - if v, ok := m["max_connections_per_endpoint"]; ok { - if v == nil { - v = 0 - } - - buf.WriteString(fmt.Sprintf("%v-", v)) - } - if v, ok := m["max_rate_per_endpoint"]; ok { - if v == nil { - v = 0.0 - } - - // floats can't be added to the hash with %v as the other values are because - // %v and %f are not equivalent strings so this must remain as a float so that - // the hash function doesn't return something else. - buf.WriteString(fmt.Sprintf("%f-", v.(float64))) - } - if v, ok := m["max_utilization"]; ok && !isNegBackend(m) { - if v == nil { - v = 0.0 - } - - // floats can't be added to the hash with %v as the other values are because - // %v and %f are not equivalent strings so this must remain as a float so that - // the hash function doesn't return something else. - buf.WriteString(fmt.Sprintf("%f-", v.(float64))) - } - - // This is in region backend service, but not in backend service. Should be a no-op - // if it's not present. - if v, ok := m["failover"]; ok { - if v == nil { - v = false - } - buf.WriteString(fmt.Sprintf("%v-", v.(bool))) - } - - log.Printf("[DEBUG] computed hash value of %v from %v", tpgresource.Hashcode(buf.String()), buf.String()) - return tpgresource.Hashcode(buf.String()) -} diff --git a/mmv1/templates/terraform/constants/go/bigquery_data_transfer.go.tmpl b/mmv1/templates/terraform/constants/go/bigquery_data_transfer.go.tmpl deleted file mode 100644 index ed5121bc3ef8..000000000000 --- a/mmv1/templates/terraform/constants/go/bigquery_data_transfer.go.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -var sensitiveParams = []string{"secret_access_key"} - -func sensitiveParamCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - for _, sp := range sensitiveParams { - mapLabel := diff.Get("params." + sp).(string) - authLabel := diff.Get("sensitive_params.0." + sp).(string) - if mapLabel != "" && authLabel != "" { - return fmt.Errorf("Sensitive param [%s] cannot be set in both `params` and the `sensitive_params` block.", sp) - } - } - return nil -} - -// This customizeDiff is to use ForceNew for params fields data_path_template or data_path and -// destination_table_name_template only if the value of "data_source_id" is "google_cloud_storage" or "amazon_s3". -func ParamsCustomizeDiffFunc(diff tpgresource.TerraformResourceDiff) error { - old, new := diff.GetChange("params") - dsId := diff.Get("data_source_id").(string) - oldParams := old.(map[string]interface{}) - newParams := new.(map[string]interface{}) - var err error - - switch dsId { - case "google_cloud_storage": - if oldParams["data_path_template"] != nil && newParams["data_path_template"] != nil && oldParams["data_path_template"].(string) != newParams["data_path_template"].(string) { - err = diff.ForceNew("params") - if err != nil { - return fmt.Errorf("ForceNew failed for params, old - %v and new - %v", oldParams, newParams) - } - return nil - } - - if oldParams["destination_table_name_template"] != nil && newParams["destination_table_name_template"] != nil && oldParams["destination_table_name_template"].(string) != newParams["destination_table_name_template"].(string) { - err = diff.ForceNew("params") - if err != nil { - return fmt.Errorf("ForceNew failed for params, old - %v and new - %v", oldParams, newParams) - } - return nil - } - case "amazon_s3": - if oldParams["data_path"] != nil && newParams["data_path"] != nil && oldParams["data_path"].(string) != newParams["data_path"].(string) { - err = diff.ForceNew("params") - if err != nil { - return fmt.Errorf("ForceNew failed for params, old - %v and new - %v", oldParams, newParams) - } - return nil - } - - if oldParams["destination_table_name_template"] != nil && newParams["destination_table_name_template"] != nil && oldParams["destination_table_name_template"].(string) != newParams["destination_table_name_template"].(string) { - err = diff.ForceNew("params") - if err != nil { - return fmt.Errorf("ForceNew failed for params, old - %v and new - %v", oldParams, newParams) - } - return nil - } - } - return nil -} -func paramsCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - return ParamsCustomizeDiffFunc(diff) -} diff --git a/mmv1/templates/terraform/constants/go/bigquery_dataset.go.tmpl b/mmv1/templates/terraform/constants/go/bigquery_dataset.go.tmpl deleted file mode 100644 index 3a5f4b930334..000000000000 --- a/mmv1/templates/terraform/constants/go/bigquery_dataset.go.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -const datasetIdRegexp = `^[0-9A-Za-z_]+$` - -func validateDatasetId(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - if !regexp.MustCompile(datasetIdRegexp).MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_)", k)) - } - - if len(value) > 1024 { - errors = append(errors, fmt.Errorf( - "%q cannot be greater than 1,024 characters", k)) - } - - return -} - -func validateDefaultTableExpirationMs(v interface{}, k string) (ws []string, errors []error) { - value := v.(int) - if value < 3600000 { - errors = append(errors, fmt.Errorf("%q cannot be shorter than 3600000 milliseconds (one hour)", k)) - } - - return -} diff --git a/mmv1/templates/terraform/constants/go/bigquery_dataset_access.go.tmpl b/mmv1/templates/terraform/constants/go/bigquery_dataset_access.go.tmpl deleted file mode 100644 index e3b8f39cbee3..000000000000 --- a/mmv1/templates/terraform/constants/go/bigquery_dataset_access.go.tmpl +++ /dev/null @@ -1,122 +0,0 @@ -var bigqueryAccessRoleToPrimitiveMap = map[string]string { - "roles/bigquery.dataOwner": "OWNER", - "roles/bigquery.dataEditor": "WRITER", - "roles/bigquery.dataViewer": "READER", -} - -func resourceBigQueryDatasetAccessRoleDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - if primitiveRole, ok := bigqueryAccessRoleToPrimitiveMap[new]; ok { - return primitiveRole == old - } - return false -} - -// we want to diff suppress any iam_members that are configured as `iam_member`, but stored in state as a different member type -func resourceBigQueryDatasetAccessIamMemberDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - if primitiveRole, ok := bigqueryAccessRoleToPrimitiveMap[new]; ok { - return primitiveRole == old - } - - if d.Get("api_updated_member") == true { - expectedIamMember := d.Get("iam_member").(string) - parts := strings.SplitAfter(expectedIamMember, ":") - - strippedIamMember := parts[0] - if len(parts) > 1 { - strippedIamMember = parts[1] - } - - if memberInState := d.Get("user_by_email").(string); memberInState != "" { - return strings.ToLower(memberInState) == strings.ToLower(strippedIamMember) - } - - if memberInState := d.Get("group_by_email").(string); memberInState != "" { - return strings.ToLower(memberInState) == strings.ToLower(strippedIamMember) - } - - if memberInState := d.Get("domain").(string); memberInState != "" { - return strings.ToLower(memberInState) == strings.ToLower(strippedIamMember) - } - - if memberInState := d.Get("special_group").(string); memberInState != "" { - return strings.ToLower(memberInState) == strings.ToLower(strippedIamMember) - } - } - - if memberInState := d.Get("user_by_email").(string); memberInState != "" { - return strings.ToLower(old) == strings.ToLower(new) - } - - if memberInState := d.Get("group_by_email").(string); memberInState != "" { - return strings.ToLower(old) == strings.ToLower(new) - } - - return false -} - -// this function will go through a response's access list and see if the iam_member has been reassigned to a different member_type -// if it has, it will return the member type, and the member -func resourceBigQueryDatasetAccessReassignIamMemberInNestedObjectList(d *schema.ResourceData, meta interface{}, items []interface{}) (member_type string, member interface{}, err error) { - expectedRole, err := expandNestedBigQueryDatasetAccessRole(d.Get("role"), d, meta.(*transport_tpg.Config)) - if err != nil { - return "", nil, err - } - expectedFlattenedRole := flattenNestedBigQueryDatasetAccessRole(expectedRole, d, meta.(*transport_tpg.Config)) - - expectedIamMember, err := expandNestedBigQueryDatasetAccessIamMember(d.Get("iam_member"), d, meta.(*transport_tpg.Config)) - if err != nil { - return "", nil, err - } - expectedFlattenedIamMember := flattenNestedBigQueryDatasetAccessIamMember(expectedIamMember, d, meta.(*transport_tpg.Config)) - - parts := strings.SplitAfter(expectedFlattenedIamMember.(string), ":") - - expectedStrippedIamMember := parts[0] - if len(parts) > 1 { - expectedStrippedIamMember = parts[1] - } - - // Search list for this resource. - for _, itemRaw := range items { - if itemRaw == nil { - continue - } - item := itemRaw.(map[string]interface{}) - - itemRole := flattenNestedBigQueryDatasetAccessRole(item["role"], d, meta.(*transport_tpg.Config)) - // IsEmptyValue check so that if one is nil and the other is "", that's considered a match - if !(tpgresource.IsEmptyValue(reflect.ValueOf(itemRole)) && tpgresource.IsEmptyValue(reflect.ValueOf(expectedFlattenedRole))) && !reflect.DeepEqual(itemRole, expectedFlattenedRole) { - log.Printf("[DEBUG] Skipping item with role= %#v, looking for %#v)", itemRole, expectedFlattenedRole) - continue - } - - itemUserByEmail := flattenNestedBigQueryDatasetAccessUserByEmail(item["userByEmail"], d, meta.(*transport_tpg.Config)) - if reflect.DeepEqual(itemUserByEmail, expectedStrippedIamMember) { - log.Printf("[DEBUG] Iam Member changed to userByEmail= %#v)", itemUserByEmail) - return "user_by_email", itemUserByEmail, nil - } - itemGroupByEmail := flattenNestedBigQueryDatasetAccessGroupByEmail(item["groupByEmail"], d, meta.(*transport_tpg.Config)) - if reflect.DeepEqual(itemGroupByEmail, expectedStrippedIamMember) { - log.Printf("[DEBUG] Iam Member changed to groupByEmail= %#v)", itemGroupByEmail) - return "group_by_email", itemGroupByEmail, nil - } - itemDomain := flattenNestedBigQueryDatasetAccessDomain(item["domain"], d, meta.(*transport_tpg.Config)) - if reflect.DeepEqual(itemDomain, expectedStrippedIamMember) { - log.Printf("[DEBUG] Iam Member changed to domain= %#v)", itemDomain) - return "domain", itemDomain, nil - } - itemSpecialGroup := flattenNestedBigQueryDatasetAccessSpecialGroup(item["specialGroup"], d, meta.(*transport_tpg.Config)) - if reflect.DeepEqual(itemSpecialGroup, expectedStrippedIamMember) { - log.Printf("[DEBUG] Iam Member changed to specialGroup= %#v)", itemSpecialGroup) - return "special_group", itemSpecialGroup, nil - } - itemIamMember := flattenNestedBigQueryDatasetAccessIamMember(item["iamMember"], d, meta.(*transport_tpg.Config)) - if reflect.DeepEqual(itemIamMember, expectedFlattenedIamMember) { - log.Printf("[DEBUG] Iam Member stayed as iamMember= %#v)", itemIamMember) - return "", nil, nil - } - continue - } - log.Printf("[DEBUG] Did not find item for resource %q)", d.Id()) - return "", nil, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/bigquery_reservation_capacity_commitment.go.tmpl b/mmv1/templates/terraform/constants/go/bigquery_reservation_capacity_commitment.go.tmpl deleted file mode 100644 index 8af8fa7e5755..000000000000 --- a/mmv1/templates/terraform/constants/go/bigquery_reservation_capacity_commitment.go.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -func bigqueryReservationCapacityCommitmentPlanDiffSuppressFunc(_, old, new string, _ *schema.ResourceData) bool { - if (old == "FLEX" || old == "MONTHLY" || old == "ANNUAL") && new == old+"_FLAT_RATE" { - return true - } - return false -} diff --git a/mmv1/templates/terraform/constants/go/billing_budget.tmpl b/mmv1/templates/terraform/constants/go/billing_budget.tmpl deleted file mode 100644 index bf8fb67c6bc7..000000000000 --- a/mmv1/templates/terraform/constants/go/billing_budget.tmpl +++ /dev/null @@ -1,23 +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. -*/ -}} - -// Check to see if a specified value in the config exists and suppress diffs if so. Otherwise run EmptyOrDefaultStringSuppress. - -func checkValAndDefaultStringSuppress(defaultVal string, checkVal string) schema.SchemaDiffSuppressFunc { - return func(k, old, new string, d *schema.ResourceData) bool { - if _, ok := d.GetOkExists(checkVal); ok { - return false - } - return (old == "" && new == defaultVal) || (new == "" && old == defaultVal) - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/binaryauthorization_attestor.go.tmpl b/mmv1/templates/terraform/constants/go/binaryauthorization_attestor.go.tmpl deleted file mode 100644 index d6e763776f23..000000000000 --- a/mmv1/templates/terraform/constants/go/binaryauthorization_attestor.go.tmpl +++ /dev/null @@ -1,39 +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 CompareSignatureAlgorithm(_, old, new string, _ *schema.ResourceData) bool { - // See https://cloud.google.com/binary-authorization/docs/reference/rest/v1/projects.attestors#signaturealgorithm - normalizedAlgorithms := map[string]string{ - "ECDSA_P256_SHA256": "ECDSA_P256_SHA256", - "EC_SIGN_P256_SHA256": "ECDSA_P256_SHA256", - "ECDSA_P384_SHA384": "ECDSA_P384_SHA384", - "EC_SIGN_P384_SHA384": "ECDSA_P384_SHA384", - "ECDSA_P521_SHA512": "ECDSA_P521_SHA512", - "EC_SIGN_P521_SHA512": "ECDSA_P521_SHA512", - } - - normalizedOld := old - normalizedNew := new - - if normalized, ok := normalizedAlgorithms[old]; ok { - normalizedOld = normalized - } - if normalized, ok := normalizedAlgorithms[new]; ok { - normalizedNew = normalized - } - - if normalizedNew == normalizedOld { - return true - } - - return false -} diff --git a/mmv1/templates/terraform/constants/go/binaryauthorization_policy.tmpl b/mmv1/templates/terraform/constants/go/binaryauthorization_policy.tmpl deleted file mode 100644 index 2c4e5d6c27bb..000000000000 --- a/mmv1/templates/terraform/constants/go/binaryauthorization_policy.tmpl +++ /dev/null @@ -1,26 +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 DefaultBinaryAuthorizationPolicy(project string) map[string]interface{} { - return map[string]interface{}{ - "name": fmt.Sprintf("projects/%s/policy", project), - "admissionWhitelistPatterns": []interface{}{ - map[string]interface{}{ - "namePattern": "gcr.io/google_containers/*", - }, - }, - "defaultAdmissionRule": map[string]interface{}{ - "evaluationMode": "ALWAYS_ALLOW", - "enforcementMode": "ENFORCED_BLOCK_AND_AUDIT_LOG", - }, - } -} diff --git a/mmv1/templates/terraform/constants/go/cert_manager.tmpl b/mmv1/templates/terraform/constants/go/cert_manager.tmpl deleted file mode 100644 index 5cbc173001a4..000000000000 --- a/mmv1/templates/terraform/constants/go/cert_manager.tmpl +++ /dev/null @@ -1,19 +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 certManagerDefaultScopeDiffSuppress(_, old, new string, diff *schema.ResourceData) bool { - if old == "" && new == "DEFAULT" || old == "DEFAULT" && new == "" { - return true - } - return false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/cloud_run_domain_mapping.go.tmpl b/mmv1/templates/terraform/constants/go/cloud_run_domain_mapping.go.tmpl deleted file mode 100644 index eacab2177f96..000000000000 --- a/mmv1/templates/terraform/constants/go/cloud_run_domain_mapping.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -func hasMetadata(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - newCount := diff.Get("metadata.#") - - if newCount.(int) < 1 { - return fmt.Errorf("Insufficient \"metadata\" blocks. 1 \"metadata\" block is required.") - } - - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/cloud_run_service.go.tmpl b/mmv1/templates/terraform/constants/go/cloud_run_service.go.tmpl deleted file mode 100644 index 0b748a4b3ba6..000000000000 --- a/mmv1/templates/terraform/constants/go/cloud_run_service.go.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -func revisionNameCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - autogen := diff.Get("autogenerate_revision_name").(bool) - if autogen && diff.HasChange("template.0.metadata.0.name") { - return fmt.Errorf("google_cloud_run_service: `template.metadata.name` cannot be set while `autogenerate_revision_name` is true. Please remove the field or set `autogenerate_revision_name` to false.") - } - - return nil -} - -var cloudRunGoogleProvidedTemplateAnnotations = regexp.MustCompile(`template\.0\.metadata\.0\.annotations\.run\.googleapis\.com/sandbox`) -var cloudRunGoogleProvidedTemplateAnnotations_autoscaling_maxscale = regexp.MustCompile(`template\.0\.metadata\.0\.annotations\.autoscaling\.knative\.dev/maxScale`) - -func cloudrunTemplateAnnotationDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for the annotations provided by API - if cloudRunGoogleProvidedTemplateAnnotations.MatchString(k) && - old == "gvisor" && new == "" { - return true - } - - if cloudRunGoogleProvidedTemplateAnnotations_autoscaling_maxscale.MatchString(k) && new == "" { - return true - } - - // For other keys, don't suppress diff. - return false -} - -var cloudRunGoogleProvidedTemplateLabels = []string{ - "run.googleapis.com/startupProbeType", -} - -func cloudrunTemplateLabelDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for the labels provided by Google - for _, label := range cloudRunGoogleProvidedTemplateLabels { - if strings.Contains(k, label) && new == "" { - return true - } - } - - // Let diff be determined by labels (above) - if strings.Contains(k, "labels.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} diff --git a/mmv1/templates/terraform/constants/go/cloud_tasks_retry_config_custom_diff.go.tmpl b/mmv1/templates/terraform/constants/go/cloud_tasks_retry_config_custom_diff.go.tmpl deleted file mode 100644 index 55af1c530fdf..000000000000 --- a/mmv1/templates/terraform/constants/go/cloud_tasks_retry_config_custom_diff.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -func suppressOmittedMaxDuration(k, old, new string, d *schema.ResourceData) bool { - if old == "" && new == "0s" { - log.Printf("[INFO] max retry is 0s and api omitted field, suppressing diff") - return true - } - return tpgresource.DurationDiffSuppress(k, old, new, d) -} diff --git a/mmv1/templates/terraform/constants/go/cloudbuild_trigger.tmpl b/mmv1/templates/terraform/constants/go/cloudbuild_trigger.tmpl deleted file mode 100644 index 395ede2a9fdc..000000000000 --- a/mmv1/templates/terraform/constants/go/cloudbuild_trigger.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -func stepTimeoutCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - buildList := diff.Get("build").([]interface{}) - if len(buildList) == 0 || buildList[0] == nil { - return nil - } - build := buildList[0].(map[string]interface{}) - buildTimeoutString := build["timeout"].(string) - - buildTimeout, err := time.ParseDuration(buildTimeoutString) - if err != nil { - return fmt.Errorf("Error parsing build timeout : %s", err) - } - - var stepTimeoutSum time.Duration = 0 - steps := build["step"].([]interface{}) - for _, rawstep := range steps { - if rawstep == nil { - continue - } - step := rawstep.(map[string]interface{}) - timeoutString := step["timeout"].(string) - if len(timeoutString) == 0 { - continue - } - - timeout, err := time.ParseDuration(timeoutString) - if err != nil { - return fmt.Errorf("Error parsing build step timeout: %s", err) - } - stepTimeoutSum += timeout - } - if stepTimeoutSum > buildTimeout { - return fmt.Errorf("Step timeout sum (%v) cannot be greater than build timeout (%v)", stepTimeoutSum, buildTimeout) - } - return nil -} diff --git a/mmv1/templates/terraform/constants/go/clouddomains_registration.go.tmpl b/mmv1/templates/terraform/constants/go/clouddomains_registration.go.tmpl deleted file mode 100644 index a544535a321e..000000000000 --- a/mmv1/templates/terraform/constants/go/clouddomains_registration.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -// waitForRegistrationActive waits for a registration to leave the -// "REGISTRATION_PENDING" state and become "ACTIVE" or any other state. -func waitForRegistrationActive(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { - return retry.Retry(timeout, func() *retry.RetryError { - if err := resourceClouddomainsRegistrationRead(d, config); err != nil { - return retry.NonRetryableError(err) - } - - name := d.Get("name").(string) - state := d.Get("state").(string) - if state == "REGISTRATION_PENDING" { - return retry.RetryableError(fmt.Errorf("Registration %q has state %q.", name, state)) - } else if state == "REGISTRATION_FAILED" { - return retry.NonRetryableError(fmt.Errorf("Registration %q has failed with state %q.", name, state)) - } else { - log.Printf("[DEBUG] Registration %q has state %q.", name, state) - return nil - } - }) -} -{{- end }} diff --git a/mmv1/templates/terraform/constants/go/cloudfunctions2_function.go.tmpl b/mmv1/templates/terraform/constants/go/cloudfunctions2_function.go.tmpl deleted file mode 100644 index c447509eff60..000000000000 --- a/mmv1/templates/terraform/constants/go/cloudfunctions2_function.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -// Suppress diffs for the system environment variables -func environmentVariablesDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - if k == "service_config.0.environment_variables.LOG_EXECUTION_ID" && new == "" { - return true - } - - // Let diff be determined by environment_variables (above) - if strings.HasPrefix(k, "service_config.0.environment_variables.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} diff --git a/mmv1/templates/terraform/constants/go/compute_certificate.go.tmpl b/mmv1/templates/terraform/constants/go/compute_certificate.go.tmpl deleted file mode 100644 index f5f6aae3c09d..000000000000 --- a/mmv1/templates/terraform/constants/go/compute_certificate.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -// sha256DiffSuppress -// if old is the hex-encoded sha256 sum of new, treat them as equal -func sha256DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - return hex.EncodeToString(sha256.New().Sum([]byte(old))) == new -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/compute_forwarding_rule.go.tmpl b/mmv1/templates/terraform/constants/go/compute_forwarding_rule.go.tmpl deleted file mode 100644 index 19580c9b79b3..000000000000 --- a/mmv1/templates/terraform/constants/go/compute_forwarding_rule.go.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -func forwardingRuleCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - log.Println("[DEBUG] [PSC] Reached forwardingRuleCustomizeDiff function") - - // if target is not a string it's not set so no PSC connection - if target, ok := diff.Get("target").(string); ok { - if strings.Contains(target, "/serviceAttachments/") { - recreateClosedPsc, _ := diff.Get("recreate_closed_psc").(bool) - if pscConnectionStatus, ok := diff.Get("psc_connection_status").(string); ok && recreateClosedPsc && pscConnectionStatus == "CLOSED" { - // https://discuss.hashicorp.com/t/force-new-resource-based-on-api-read-difference/29759/6 - diff.SetNewComputed("psc_connection_status") - diff.ForceNew("psc_connection_status") - } - } - } - return nil -} - -// Port range '80' and '80-80' is equivalent. -// `old` is read from the server and always has the full range format (e.g. '80-80', '1024-2048'). -// `new` can be either a single port or a port range. -func PortRangeDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return old == new+"-"+new -} - -// 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 { - addr_equality := false - netmask_equality := false - - addr_netmask_old := strings.Split(old, "/") - addr_netmask_new := strings.Split(new, "/") - - // Check if old or new are IPs (with or without netmask) - var addr_old net.IP - if net.ParseIP(addr_netmask_old[0]) == nil { - addr_old = net.ParseIP(old) - } else { - addr_old = net.ParseIP(addr_netmask_old[0]) - } - var addr_new net.IP - if net.ParseIP(addr_netmask_new[0]) == nil { - addr_new = net.ParseIP(new) - } else { - addr_new = net.ParseIP(addr_netmask_new[0]) - } - - if addr_old != nil { - if addr_new == nil { - // old is an IP and new is a reference - addr_equality = true - } else { - // old and new are IP addresses - addr_equality = bytes.Equal(addr_old, addr_new) - } - } - - // If old and new both have a netmask compare them, otherwise suppress - // This is not technically correct but prevents the permadiff described in https://github.com/hashicorp/terraform-provider-google/issues/16400 - if (len(addr_netmask_old)) == 2 && (len(addr_netmask_new) == 2) { - netmask_equality = addr_netmask_old[1] == addr_netmask_new[1] - } else { - netmask_equality = true - } - - return addr_equality && netmask_equality -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/compute_instance.go.tmpl b/mmv1/templates/terraform/constants/go/compute_instance.go.tmpl deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/mmv1/templates/terraform/constants/go/compute_managed_ssl_certificate.go.tmpl b/mmv1/templates/terraform/constants/go/compute_managed_ssl_certificate.go.tmpl deleted file mode 100644 index e80b7c1f9075..000000000000 --- a/mmv1/templates/terraform/constants/go/compute_managed_ssl_certificate.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -// For managed SSL certs, if new is an absolute FQDN (trailing '.') but old isn't, treat them as equals. -func AbsoluteDomainSuppress(k, old, new string, _ *schema.ResourceData) bool { - if strings.HasPrefix(k, "managed.0.domains.") { - return old == strings.TrimRight(new, ".") || new == strings.TrimRight(old, ".") - } - return false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/compute_network_endpoint_group.go.tmpl b/mmv1/templates/terraform/constants/go/compute_network_endpoint_group.go.tmpl deleted file mode 100644 index ad1828dfe457..000000000000 --- a/mmv1/templates/terraform/constants/go/compute_network_endpoint_group.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -// Use this method when subnet is optioanl and auto_create_subnetworks = true -// API sometimes choose a subnet so the diff needs to be ignored -func compareOptionalSubnet(_, old, new string, _ *schema.ResourceData) bool { - if tpgresource.IsEmptyValue(reflect.ValueOf(new)) { - return true - } - // otherwise compare as self links - return tpgresource.CompareSelfLinkOrResourceName("", old, new, nil) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/compute_resource_policy.go.tmpl b/mmv1/templates/terraform/constants/go/compute_resource_policy.go.tmpl deleted file mode 100644 index 4acee74aa971..000000000000 --- a/mmv1/templates/terraform/constants/go/compute_resource_policy.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -// Suppresses a diff on cases like 1:00 when it should be 01:00. -// Because API will normalize this value -func HourlyFormatSuppressDiff(_, old, new string, _ *schema.ResourceData) bool { - return old == "0"+new -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/compute_route.go.tmpl b/mmv1/templates/terraform/constants/go/compute_route.go.tmpl deleted file mode 100644 index 915d204a137f..000000000000 --- a/mmv1/templates/terraform/constants/go/compute_route.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -// Use this method when the field accepts either an IP address or a -// self_link referencing a resource (such as google_compute_route's -// next_hop_ilb) -func CompareIpAddressOrSelfLinkOrResourceName(_, old, new string, _ *schema.ResourceData) bool { - // if we can parse `new` as an IP address, then compare as strings - if net.ParseIP(new) != nil { - return new == old - } - - // otherwise compare as self links - return tpgresource.CompareSelfLinkOrResourceName("", old, new, nil) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/compute_service_attachment.go.tmpl b/mmv1/templates/terraform/constants/go/compute_service_attachment.go.tmpl deleted file mode 100644 index 560f03a720d2..000000000000 --- a/mmv1/templates/terraform/constants/go/compute_service_attachment.go.tmpl +++ /dev/null @@ -1,48 +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. -*/ -}} - -// Hash based on key, which is either project_id_or_num or network_url. -func computeServiceAttachmentConsumerAcceptListsHash(v interface{}) int { - if v == nil { - return 0 - } - - var buf bytes.Buffer - m := v.(map[string]interface{}) - log.Printf("[DEBUG] hashing %v", m) - - if v, ok := m["project_id_or_num"]; ok { - if v == nil { - v = "" - } - - buf.WriteString(fmt.Sprintf("%v-", v)) - } - - if v, ok := m["network_url"]; ok { - if v == nil { - v = "" - } else { - if networkUrl, err := tpgresource.GetRelativePath(v.(string)); err != nil { - log.Printf("[WARN] Error on retrieving relative path of network url: %s", err) - } else { - v = networkUrl - } - } - - buf.WriteString(fmt.Sprintf("%v-", v)) - } - - log.Printf("[DEBUG] computed hash value of %v from %v", tpgresource.Hashcode(buf.String()), buf.String()) - return tpgresource.Hashcode(buf.String()) -} diff --git a/mmv1/templates/terraform/constants/go/containerattached_cluster_diff.go.tmpl b/mmv1/templates/terraform/constants/go/containerattached_cluster_diff.go.tmpl deleted file mode 100644 index 1535e5b67e50..000000000000 --- a/mmv1/templates/terraform/constants/go/containerattached_cluster_diff.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -func suppressAttachedClustersLoggingConfigDiff(_, old, new string, d *schema.ResourceData) bool { - if old == new { - return true - } - _, n := d.GetChange("logging_config.0.component_config.0.enable_components") - if tpgresource.IsEmptyValue(reflect.ValueOf(n)) { - return true - } - return false -} diff --git a/mmv1/templates/terraform/constants/go/data_fusion_instance_option.go.tmpl b/mmv1/templates/terraform/constants/go/data_fusion_instance_option.go.tmpl deleted file mode 100644 index ede5560480b8..000000000000 --- a/mmv1/templates/terraform/constants/go/data_fusion_instance_option.go.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -var instanceAcceleratorOptions = []string{ - "delta.default.checkpoint.directory", - "ui.feature.cdc", -} - -func instanceOptionsDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for the options generated by adding an accelerator to a data fusion instance - for _, option := range instanceAcceleratorOptions { - if strings.Contains(k, option) && new == "" { - return true - } - } - - // Let diff be determined by options (above) - if strings.Contains(k, "options.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/dataproc_cluster.go.tmpl b/mmv1/templates/terraform/constants/go/dataproc_cluster.go.tmpl deleted file mode 100644 index 2761e8c4a5e2..000000000000 --- a/mmv1/templates/terraform/constants/go/dataproc_cluster.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -// Suppress diffs for values that are equivalent except for their use of the words "location" -// compared to "region" or "zone" -func locationDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return locationDiffSuppressHelper(old, new) || locationDiffSuppressHelper(new, old) -} - -func locationDiffSuppressHelper(a, b string) bool { - return strings.Replace(a, "/locations/", "/regions/", 1) == b || - strings.Replace(a, "/locations/", "/zones/", 1) == b -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/datastream_stream.go.tmpl b/mmv1/templates/terraform/constants/go/datastream_stream.go.tmpl deleted file mode 100644 index a5f35834357a..000000000000 --- a/mmv1/templates/terraform/constants/go/datastream_stream.go.tmpl +++ /dev/null @@ -1,79 +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 resourceDatastreamStreamCustomDiffFunc(diff tpgresource.TerraformResourceDiff) error { - if diff.HasChange("desired_state") { - old, new := diff.GetChange("desired_state") - oldState := old.(string) - newState := new.(string) - - if tpgresource.IsNewResource(diff) { - if newState != "NOT_STARTED" && newState != "RUNNING" { - return fmt.Errorf("`desired_state` can only be set to `NOT_STARTED` or `RUNNING` when creating a new Stream") - } - } else { - if newState == "NOT_STARTED" && oldState != newState { - return fmt.Errorf("Field `desired_state` cannot be changed to `NOT_STARTED` for an already-created Stream") - } - - if oldState == "NOT_STARTED" && newState != "RUNNING" { - return fmt.Errorf("Field `desired_state` can only be set to `RUNNING` from `NOT_STARTED`") - } - - if newState != "RUNNING" && newState != "PAUSED" { - return fmt.Errorf("`desired_state` can only be set to `RUNNING` or `PAUSED` when updating a Stream") - } - } - } - return nil -} -func resourceDatastreamStreamCustomDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - // separate func to allow unit testing - return resourceDatastreamStreamCustomDiffFunc(diff) -} - -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -// waitForDatastreamStreamReady waits for an agent pool to reach a stable state to indicate that it's ready. -func waitForDatastreamStreamReady(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { - return retry.Retry(timeout, func() *retry.RetryError { - if err := resourceDatastreamStreamRead(d, config); err != nil { - return retry.NonRetryableError(err) - } - - name := d.Get("name").(string) - state := d.Get("state").(string) - if state == "STARTING" || state == "DRAINING" { - return retry.RetryableError(fmt.Errorf("Stream %q has state %q.", name, state)) - } else if state == "NOT_STARTED" || state == "RUNNING" || state == "PAUSED" { - log.Printf("[DEBUG] Stream %q has state %q.", name, state) - return nil - } else { - return retry.NonRetryableError(fmt.Errorf("Stream %q has state %q.", name, state)) - } - }) -} - -func resourceDatastreamStreamDatabaseIdDiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - re := regexp.MustCompile(`projects/(.+)/datasets/([^\.\?\#]+)`) - paths := re.FindStringSubmatch(new) - - // db returns value in form : - if len(paths) == 3 { - project := paths[1] - datasetId := paths[2] - new = fmt.Sprintf("%s:%s", project, datasetId) - } - - return old == new -} - -{{ end }} diff --git a/mmv1/templates/terraform/constants/go/deployment_manager_deployment.go.tmpl b/mmv1/templates/terraform/constants/go/deployment_manager_deployment.go.tmpl deleted file mode 100644 index 5929b7650f79..000000000000 --- a/mmv1/templates/terraform/constants/go/deployment_manager_deployment.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -func customDiffDeploymentManagerDeployment(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { - if preview := d.Get("preview").(bool); preview { - log.Printf("[WARN] Deployment preview set to true - Terraform will treat Deployment as recreate-only") - - if d.HasChange("preview") { - if err := d.ForceNew("preview"); err != nil { - return err - } - } - - if d.HasChange("target") { - if err := d.ForceNew("target"); err != nil { - return err - } - } - - if d.HasChange("labels") { - if err := d.ForceNew("labels"); err != nil { - return err - } - } - } - return nil -} diff --git a/mmv1/templates/terraform/constants/go/disk.tmpl b/mmv1/templates/terraform/constants/go/disk.tmpl deleted file mode 100644 index a3947c725250..000000000000 --- a/mmv1/templates/terraform/constants/go/disk.tmpl +++ /dev/null @@ -1,267 +0,0 @@ - -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -// diffsupress for hyperdisk provisioned_iops -func hyperDiskIopsUpdateDiffSupress(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { - if !strings.Contains(d.Get("type").(string), "hyperdisk") { - resourceSchema := ResourceComputeDisk().Schema - for field := range resourceSchema { - if field == "provisioned_iops" && d.HasChange(field) { - if err := d.ForceNew(field); err != nil { - return err - } - } - } - } - - return nil -} -{{- end }} - -{{ if ne $.TargetVersionName `ga` -}} -// Suppress all diffs, used for Disk.Interface which is a nonfunctional field -func AlwaysDiffSuppress(_, _, _ string, _ *schema.ResourceData) bool { - return true -} -{{- end }} - -// diffsupress for beta and to check change in source_disk attribute -func sourceDiskDiffSupress(_, old, new string, _ *schema.ResourceData) bool { - s1 := strings.TrimPrefix(old, "https://www.googleapis.com/compute/beta") - s2 := strings.TrimPrefix(new, "https://www.googleapis.com/compute/v1") - if strings.HasSuffix(s1, s2) { - return true - } - return false -} - -// Is the new disk size smaller than the old one? -func IsDiskShrinkage(_ context.Context, old, new, _ interface{}) bool { - // It's okay to remove size entirely. - if old == nil || new == nil { - return false - } - return new.(int) < old.(int) -} - -// We cannot suppress the diff for the case when family name is not part of the image name since we can't -// make a network call in a DiffSuppressFunc. -func DiskImageDiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - // Understand that this function solves a messy problem ("how do we tell if the diff between two images - // is 'ForceNew-worthy', without making a network call?") in the best way we can: through a series of special - // cases and regexes. If you find yourself here because you are trying to add a new special case, - // you are probably looking for the diskImageFamilyEquals function and its subfunctions. - // In order to keep this maintainable, we need to ensure that the positive and negative examples - // in resource_compute_disk_test.go are as complete as possible. - - // 'old' is read from the API. - // It always has the format 'https://www.googleapis.com/compute/v1/projects/(%s)/global/images/(%s)' - matches := resolveImageLink.FindStringSubmatch(old) - if matches == nil { - // Image read from the API doesn't have the expected format. In practice, it should never happen - return false - } - oldProject := matches[1] - oldName := matches[2] - - // Partial or full self link family - if resolveImageProjectFamily.MatchString(new) { - // Value matches pattern "projects/{project}/global/images/family/{family-name}$" - matches := resolveImageProjectFamily.FindStringSubmatch(new) - newProject := matches[1] - newFamilyName := matches[2] - - return diskImageProjectNameEquals(oldProject, newProject) && diskImageFamilyEquals(oldName, newFamilyName) - } - - // Partial or full self link image - if resolveImageProjectImage.MatchString(new) { - // Value matches pattern "projects/{project}/global/images/{image-name}$" - matches := resolveImageProjectImage.FindStringSubmatch(new) - newProject := matches[1] - newImageName := matches[2] - - return diskImageProjectNameEquals(oldProject, newProject) && diskImageEquals(oldName, newImageName) - } - - // Partial link without project family - if resolveImageGlobalFamily.MatchString(new) { - // Value is "global/images/family/{family-name}" - matches := resolveImageGlobalFamily.FindStringSubmatch(new) - familyName := matches[1] - - return diskImageFamilyEquals(oldName, familyName) - } - - // Partial link without project image - if resolveImageGlobalImage.MatchString(new) { - // Value is "global/images/{image-name}" - matches := resolveImageGlobalImage.FindStringSubmatch(new) - imageName := matches[1] - - return diskImageEquals(oldName, imageName) - } - - // Family shorthand - if resolveImageFamilyFamily.MatchString(new) { - // Value is "family/{family-name}" - matches := resolveImageFamilyFamily.FindStringSubmatch(new) - familyName := matches[1] - - return diskImageFamilyEquals(oldName, familyName) - } - - // Shorthand for image or family - if resolveImageProjectImageShorthand.MatchString(new) { - // Value is "{project}/{image-name}" or "{project}/{family-name}" - matches := resolveImageProjectImageShorthand.FindStringSubmatch(new) - newProject := matches[1] - newName := matches[2] - - return diskImageProjectNameEquals(oldProject, newProject) && - (diskImageEquals(oldName, newName) || diskImageFamilyEquals(oldName, newName)) - } - - // Image or family only - if diskImageEquals(oldName, new) || diskImageFamilyEquals(oldName, new) { - // Value is "{image-name}" or "{family-name}" - return true - } - - return false -} - -func diskImageProjectNameEquals(project1, project2 string) bool { - // Convert short project name to full name - // For instance, centos => centos-cloud - fullProjectName, ok := ImageMap[project2] - if ok { - project2 = fullProjectName - } - - return project1 == project2 -} - -func diskImageEquals(oldImageName, newImageName string) bool { - return oldImageName == newImageName -} - -func diskImageFamilyEquals(imageName, familyName string) bool { - // Handles the case when the image name includes the family name - // e.g. image name: debian-11-bullseye-v20220719, family name: debian-11 - - // First condition is to check if image contains arm64 because of case like: - // image name: opensuse-leap-15-4-v20220713-arm64, family name: opensuse-leap (should not be evaluated during handling of amd64 cases) - // In second condition, we have to check for amd64 because of cases like: - // image name: ubuntu-2210-kinetic-amd64-v20221022, family name: ubuntu-2210 (should not suppress) - if !strings.Contains(imageName, "-arm64") && strings.Contains(imageName, strings.TrimSuffix(familyName, "-amd64")) { - if strings.Contains(imageName, "-amd64") { - return strings.HasSuffix(familyName, "-amd64") - } else { - return !strings.HasSuffix(familyName, "-amd64") - } - } - - // We have to check for arm64 because of cases like: - // image name: opensuse-leap-15-4-v20220713-arm64, family name: opensuse-leap (should not suppress) - if strings.Contains(imageName, strings.TrimSuffix(familyName, "-arm64")) { - if strings.Contains(imageName, "-arm64") { - return strings.HasSuffix(familyName, "-arm64") - } else { - return !strings.HasSuffix(familyName, "-arm64") - } - } - - if suppressCanonicalFamilyDiff(imageName, familyName) { - return true - } - - if suppressCosFamilyDiff(imageName, familyName) { - return true - } - - if suppressWindowsSqlFamilyDiff(imageName, familyName) { - return true - } - - if suppressWindowsFamilyDiff(imageName, familyName) { - return true - } - - return false -} - -// e.g. image: ubuntu-1404-trusty-v20180122, family: ubuntu-1404-lts -func suppressCanonicalFamilyDiff(imageName, familyName string) bool { - parts := canonicalUbuntuLtsImage.FindStringSubmatch(imageName) - if len(parts) == 4 { - var f string - if parts[3] == "" { - f = fmt.Sprintf("ubuntu-%s%s-lts", parts[1], parts[2]) - } else { - f = fmt.Sprintf("ubuntu-%s%s-lts-%s", parts[1], parts[2], parts[3]) - } - if f == familyName { - return true - } - } - - return false -} - -// e.g. image: cos-NN-*, family: cos-NN-lts -func suppressCosFamilyDiff(imageName, familyName string) bool { - parts := cosLtsImage.FindStringSubmatch(imageName) - if len(parts) == 2 { - f := fmt.Sprintf("cos-%s-lts", parts[1]) - if f == familyName { - return true - } - } - - return false -} - -// e.g. image: sql-2017-standard-windows-2016-dc-v20180109, family: sql-std-2017-win-2016 -// e.g. image: sql-2017-express-windows-2012-r2-dc-v20180109, family: sql-exp-2017-win-2012-r2 -func suppressWindowsSqlFamilyDiff(imageName, familyName string) bool { - parts := windowsSqlImage.FindStringSubmatch(imageName) - if len(parts) == 5 { - edition := parts[2] // enterprise, standard or web. - sqlVersion := parts[1] - windowsVersion := parts[3] - - // Translate edition - switch edition { - case "enterprise": - edition = "ent" - case "standard": - edition = "std" - case "express": - edition = "exp" - } - - var f string - if revision := parts[4]; revision != "" { - // With revision - f = fmt.Sprintf("sql-%s-%s-win-%s-r%s", edition, sqlVersion, windowsVersion, revision) - } else { - // No revision - f = fmt.Sprintf("sql-%s-%s-win-%s", edition, sqlVersion, windowsVersion) - } - - if f == familyName { - return true - } - } - - return false -} - -// e.g. image: windows-server-1709-dc-core-v20180109, family: windows-1709-core -// e.g. image: windows-server-1709-dc-core-for-containers-v20180109, family: "windows-1709-core-for-containers -func suppressWindowsFamilyDiff(imageName, familyName string) bool { - updatedFamilyString := strings.Replace(familyName, "windows-", "windows-server-", 1) - updatedImageName := strings.Replace(imageName, "-dc-", "-", 1) - - return strings.Contains(updatedImageName, updatedFamilyString) -} diff --git a/mmv1/templates/terraform/constants/go/dlp_stored_info_type.go.tmpl b/mmv1/templates/terraform/constants/go/dlp_stored_info_type.go.tmpl deleted file mode 100644 index ee31a43a150f..000000000000 --- a/mmv1/templates/terraform/constants/go/dlp_stored_info_type.go.tmpl +++ /dev/null @@ -1,37 +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. -*/ -}} -// This customizeDiff allows updating the dictionary, regex, and large_custom_dictionary fields, but -// it recreates the resource if changing between these fields. e.g., updating the regex field should -// be allowed, while changing from regex to dictionary should trigger the recreation of the resource. -func storedInfoTypeCustomizeDiffFunc(diff tpgresource.TerraformResourceDiff) error { - oldDict, newDict := diff.GetChange("dictionary") - oldRegex, newRegex := diff.GetChange("regex") - oldLargeCD, newLargeCD := diff.GetChange("large_custom_dictionary") - if !tpgresource.IsEmptyValue(reflect.ValueOf(oldDict)) && tpgresource.IsEmptyValue(reflect.ValueOf(newDict)) { - diff.ForceNew("dictionary") - return nil - } - if !tpgresource.IsEmptyValue(reflect.ValueOf(oldRegex)) && tpgresource.IsEmptyValue(reflect.ValueOf(newRegex)) { - diff.ForceNew("regex") - return nil - } - if !tpgresource.IsEmptyValue(reflect.ValueOf(oldLargeCD)) && tpgresource.IsEmptyValue(reflect.ValueOf(newLargeCD)) { - diff.ForceNew("large_custom_dictionary") - return nil - } - return nil -} - -func storedInfoTypeCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - return storedInfoTypeCustomizeDiffFunc(diff) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/constants/go/firebase_database_instance.go.tmpl deleted file mode 100644 index 56b904e98b12..000000000000 --- a/mmv1/templates/terraform/constants/go/firebase_database_instance.go.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -func enableRTDB(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string) error { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseDatabaseBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/instances/{{"{{"}}instance_id{{"}}"}}:reenable") - if err != nil { - return err - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return fmt.Errorf("Error reenabling firebase_database_instance %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished reenabling firebase_database_instance %q: %#v", d.Id(), res) - } - return nil -} - -func disableRTDB(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string) error { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseDatabaseBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/instances/{{"{{"}}instance_id{{"}}"}}:disable") - if err != nil { - return err - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return fmt.Errorf("Error disabling firebase_database_instance %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished disabling firebase_database_instance %q: %#v", d.Id(), res) - } - return nil -} diff --git a/mmv1/templates/terraform/constants/go/firebase_project.go.tmpl b/mmv1/templates/terraform/constants/go/firebase_project.go.tmpl deleted file mode 100644 index 7c4be2f6e49f..000000000000 --- a/mmv1/templates/terraform/constants/go/firebase_project.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -func getExistingFirebaseProjectId(config *transport_tpg.Config, d *schema.ResourceData, billingProject string, userAgent string) (string, error) { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}") - if err != nil { - return "", err - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err == nil { - id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}") - if err != nil { - return "", fmt.Errorf("Error constructing id: %s", err) - } - return id, nil - } - - if !transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - return "", err - } - - return "", nil -} diff --git a/mmv1/templates/terraform/constants/go/firestore_index.go.tmpl b/mmv1/templates/terraform/constants/go/firestore_index.go.tmpl deleted file mode 100644 index 4b9fa4a2c829..000000000000 --- a/mmv1/templates/terraform/constants/go/firestore_index.go.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * FirestoreIndex api apends __name__ as an item to the - * end of the fields list if not present. We are suppressing - * this server generated field. - */ -func FirestoreIFieldsDiffSuppressFunc(k, old, new string, d tpgresource.TerraformResourceDataChange) bool { - kLength := "fields.#" - oldLength, newLength := d.GetChange(kLength) - oldInt, ok := oldLength.(int) - if !ok { - return false - } - newInt, ok := newLength.(int) - if !ok { - return false - } - - if oldInt == newInt+1 { - kold := fmt.Sprintf("fields.%v.field_path", oldInt-1) - knew := fmt.Sprintf("fields.%v.field_path", newInt-1) - - oldLastIndexName, _ := d.GetChange(kold) - _, newLastIndexName := d.GetChange(knew) - if oldLastIndexName == "__name__" && newLastIndexName != "__name__" { - oldBase := fmt.Sprintf("fields.%v", oldInt-1) - if strings.HasPrefix(k, oldBase) || k == kLength { - return true - } - } - } - return false -} - -func firestoreIFieldsDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return FirestoreIFieldsDiffSuppressFunc(k, old, new, d) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/firewall.tmpl b/mmv1/templates/terraform/constants/go/firewall.tmpl deleted file mode 100644 index af53f902e987..000000000000 --- a/mmv1/templates/terraform/constants/go/firewall.tmpl +++ /dev/null @@ -1,112 +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 resourceComputeFirewallRuleHash(v interface{}) int { - var buf bytes.Buffer - m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(m["protocol"].(string)))) - - // We need to make sure to sort the strings below so that we always - // generate the same hash code no matter what is in the set. - if v, ok := m["ports"]; ok && v != nil { - s := tpgresource.ConvertStringArr(v.([]interface{})) - sort.Strings(s) - - for _, v := range s { - buf.WriteString(fmt.Sprintf("%s-", v)) - } - } - - return tpgresource.Hashcode(buf.String()) -} - -func diffSuppressEnableLogging(k, old, new string, d *schema.ResourceData) bool { - if k == "log_config.#" { - if new == "0" && d.Get("enable_logging").(bool) { - return true - } - } - - return false -} - -func resourceComputeFirewallEnableLoggingCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - enableLogging, enableExists := diff.GetOkExists("enable_logging") - if !enableExists { - return nil - } - - logConfigExists := diff.Get("log_config.#").(int) != 0 - if logConfigExists && enableLogging == false { - return fmt.Errorf("log_config cannot be defined when enable_logging is false") - } - - return nil -} - -// Per https://github.com/hashicorp/terraform-provider-google/issues/2924 -// Make one of the source_ parameters Required in ingress google_compute_firewall -func resourceComputeFirewallSourceFieldsCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - direction := diff.Get("direction").(string) - - if direction != "EGRESS" { - _, tagsOk := diff.GetOk("source_tags") - _, rangesOk := diff.GetOk("source_ranges") - _, sasOk := diff.GetOk("source_service_accounts") - - _, tagsExist := diff.GetOkExists("source_tags") - _, rangesExist := diff.GetOkExists("source_ranges") - _, sasExist := diff.GetOkExists("source_service_accounts") - - if !tagsOk && !rangesOk && !sasOk && !tagsExist && !rangesExist && !sasExist { - return fmt.Errorf("one of source_tags, source_ranges, or source_service_accounts must be defined") - } - } - - return nil -} - -func diffSuppressSourceRanges(k, old, new string, d *schema.ResourceData) bool { - if k == "source_ranges.#" { - if old == "1" && new == "0" { - // Allow diffing on the individual element if we are going from 1 -> 0 - // this allows for diff suppress on ["0.0.0.0/0"] -> [] - return true - } - // For any other source_ranges.# diff, don't suppress - return false - } - kLength := "source_ranges.#" - oldLength, newLength := d.GetChange(kLength) - oldInt, ok := oldLength.(int) - - if !ok { - return false - } - - newInt, ok := newLength.(int) - if !ok { - return false - } - - // Diff suppress only should suppress removing the default range - // This should probably be newInt == 0, but due to Terraform core internals - // (bug?) values found via GetChange may not have the correct new value - // in some circumstances - if oldInt == 1 && newInt == 1 { - if old == "0.0.0.0/0" && new == "" { - return true - } - } - // For any other source_ranges value diff, don't suppress - return false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/health_check.tmpl b/mmv1/templates/terraform/constants/go/health_check.tmpl deleted file mode 100644 index fd79330386f8..000000000000 --- a/mmv1/templates/terraform/constants/go/health_check.tmpl +++ /dev/null @@ -1,82 +0,0 @@ -// Whether the port should be set or not -func validatePortSpec(diff *schema.ResourceDiff, blockName string) error { - block := diff.Get(blockName+".0").(map[string]interface{}) - portSpec := block["port_specification"] - portName := block["port_name"] - port := block["port"] - - hasPort := (port != nil && port != 0) - noName := (portName == nil || portName == "") - - if portSpec == "USE_NAMED_PORT" && hasPort { - return fmt.Errorf("Error in %s: port cannot be specified when using port_specification USE_NAMED_PORT.", blockName) - } - if portSpec == "USE_NAMED_PORT" && noName { - return fmt.Errorf("Error in %s: Must specify port_name when using USE_NAMED_PORT as port_specification.", blockName) - } - - if portSpec == "USE_SERVING_PORT" && hasPort { - return fmt.Errorf("Error in %s: port cannot be specified when using port_specification USE_SERVING_PORT.", blockName) - } - if portSpec == "USE_SERVING_PORT" && !noName { - return fmt.Errorf("Error in %s: port_name cannot be specified when using port_specification USE_SERVING_PORT.", blockName) - } - - return nil -} - -func healthCheckCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - if diff.Get("http_health_check") != nil { - return validatePortSpec(diff, "http_health_check") - } - if diff.Get("https_health_check") != nil { - return validatePortSpec(diff, "https_health_check") - } - if diff.Get("http2_health_check") != nil { - return validatePortSpec(diff, "http2_health_check") - } - if diff.Get("tcp_health_check") != nil { - return validatePortSpec(diff, "tcp_health_check") - } - if diff.Get("ssl_health_check") != nil { - return validatePortSpec(diff, "ssl_health_check") - } - - return nil -} - -func portDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - b := strings.Split(k, ".") - if len(b) > 2 { - attr := b[2] - - if attr == "port" { - var defaultPort int64 - - blockType := b[0] - - switch blockType { - case "http_health_check": - defaultPort = 80 - case "https_health_check": - defaultPort = 443 - case "http2_health_check": - defaultPort = 443 - case "tcp_health_check": - defaultPort = 80 - case "ssl_health_check": - defaultPort = 443 - } - - oldPort, _ := strconv.Atoi(old) - newPort, _ := strconv.Atoi(new) - - portSpec := d.Get(b[0] + ".0.port_specification") - if int64(oldPort) == defaultPort && newPort == 0 && (portSpec == "USE_FIXED_PORT" || portSpec == "") { - return true - } - } - } - - return false -} diff --git a/mmv1/templates/terraform/constants/go/iam_workforce_pool.go.tmpl b/mmv1/templates/terraform/constants/go/iam_workforce_pool.go.tmpl deleted file mode 100644 index b5a0de78a6a0..000000000000 --- a/mmv1/templates/terraform/constants/go/iam_workforce_pool.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -const workforcePoolIdRegexp = `^[a-z][a-z0-9-]{4,61}[a-z0-9]$` - -func ValidateWorkforcePoolId(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - - if strings.HasPrefix(value, "gcp-") { - errors = append(errors, fmt.Errorf( - "%q (%q) can not start with \"gcp-\". " + - "The prefix `gcp-` is reserved for use by Google, and may not be specified.", k, value)) - } - - if !regexp.MustCompile(workforcePoolIdRegexp).MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q (%q) must contain only lowercase letters [a-z], digits [0-9], and hyphens " + - "[-]. The WorkforcePool ID must be between 6 and 63 characters, begin " + - "with a letter, and cannot have a trailing hyphen.", k, value)) - } - - return -} diff --git a/mmv1/templates/terraform/constants/go/iam_workforce_pool_provider.go.tmpl b/mmv1/templates/terraform/constants/go/iam_workforce_pool_provider.go.tmpl deleted file mode 100644 index 70dd31c25ff9..000000000000 --- a/mmv1/templates/terraform/constants/go/iam_workforce_pool_provider.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -const workforcePoolProviderIdRegexp = `^[a-z0-9-]{4,32}$` - -func ValidateWorkforcePoolProviderId(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - - if strings.HasPrefix(value, "gcp-") { - errors = append(errors, fmt.Errorf( - "%q (%q) can not start with \"gcp-\". " + - "The prefix `gcp-` is reserved for use by Google, and may not be specified.", k, value)) - } - - if !regexp.MustCompile(workforcePoolProviderIdRegexp).MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q (%q) must be 4-32 characters, and may contain the characters [a-z0-9-].", k, value)) - } - - return -} diff --git a/mmv1/templates/terraform/constants/go/iam_workload_identity_pool.go.tmpl b/mmv1/templates/terraform/constants/go/iam_workload_identity_pool.go.tmpl deleted file mode 100644 index 56d8cfd92d07..000000000000 --- a/mmv1/templates/terraform/constants/go/iam_workload_identity_pool.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -const workloadIdentityPoolIdRegexp = `^[0-9a-z-]+$` - -func ValidateWorkloadIdentityPoolId(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - - if strings.HasPrefix(value, "gcp-") { - errors = append(errors, fmt.Errorf( - "%q (%q) can not start with \"gcp-\"", k, value)) - } - - if !regexp.MustCompile(workloadIdentityPoolIdRegexp).MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q must contain only lowercase letters (a-z), numbers (0-9), or dashes (-)", k)) - } - - if len(value) < 4 { - errors = append(errors, fmt.Errorf( - "%q cannot be smaller than 4 characters", k)) - } - - if len(value) > 32 { - errors = append(errors, fmt.Errorf( - "%q cannot be greater than 32 characters", k)) - } - - return -} diff --git a/mmv1/templates/terraform/constants/go/iam_workload_identity_pool_provider.go.tmpl b/mmv1/templates/terraform/constants/go/iam_workload_identity_pool_provider.go.tmpl deleted file mode 100644 index d9362d079287..000000000000 --- a/mmv1/templates/terraform/constants/go/iam_workload_identity_pool_provider.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -const workloadIdentityPoolProviderIdRegexp = `^[0-9a-z-]+$` - -func ValidateWorkloadIdentityPoolProviderId(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - - if strings.HasPrefix(value, "gcp-") { - errors = append(errors, fmt.Errorf( - "%q (%q) can not start with \"gcp-\"", k, value)) - } - - if !regexp.MustCompile(workloadIdentityPoolProviderIdRegexp).MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q must contain only lowercase letters (a-z), numbers (0-9), or dashes (-)", k)) - } - - if len(value) < 4 { - errors = append(errors, fmt.Errorf( - "%q cannot be smaller than 4 characters", k)) - } - - if len(value) > 32 { - errors = append(errors, fmt.Errorf( - "%q cannot be greater than 32 characters", k)) - } - - return -} diff --git a/mmv1/templates/terraform/constants/go/integration_connectors_connection.go.tmpl b/mmv1/templates/terraform/constants/go/integration_connectors_connection.go.tmpl deleted file mode 100644 index d84dd8c0ab1b..000000000000 --- a/mmv1/templates/terraform/constants/go/integration_connectors_connection.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -// waitforConnectionReady waits for an connecion to leave the -// "CREATING" state, to indicate that it's ready. -func waitforConnectionReady(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { - return retry.Retry(timeout, func() *retry.RetryError { - if err := resourceIntegrationConnectorsConnectionRead(d, config); err != nil { - return retry.NonRetryableError(err) - } - name := d.Get("name").(string) - status := d.Get("status").([]interface{}) - state := status[0].(map[string]interface{})["state"] - log.Printf("[DEBUG] Connection %q has state %v.", name, state) - if state == "CREATING" || state == "UPDATING" { - return retry.RetryableError(fmt.Errorf("Connection %q has state %q.", name, state)) - } - log.Printf("[DEBUG] Connection %q has state %q.", name, state) - return nil - }) -} -{{- end }} diff --git a/mmv1/templates/terraform/constants/go/interconnect.go.tmpl b/mmv1/templates/terraform/constants/go/interconnect.go.tmpl deleted file mode 100644 index a9e930ed2169..000000000000 --- a/mmv1/templates/terraform/constants/go/interconnect.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func InterconnectTypeDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return old == "IT_PRIVATE" && new == "DEDICATED" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/interconnect_attachment.go.tmpl b/mmv1/templates/terraform/constants/go/interconnect_attachment.go.tmpl deleted file mode 100644 index e247612fbff7..000000000000 --- a/mmv1/templates/terraform/constants/go/interconnect_attachment.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -// waitForAttachmentToBeProvisioned waits for an attachment to leave the -// "UNPROVISIONED" state, to indicate that it's either ready or awaiting partner -// activity. -func waitForAttachmentToBeProvisioned(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { - return retry.Retry(timeout, func() *retry.RetryError { - if err := resourceComputeInterconnectAttachmentRead(d, config); err != nil { - return retry.NonRetryableError(err) - } - - name := d.Get("name").(string) - state := d.Get("state").(string) - if state == "UNPROVISIONED" { - return retry.RetryableError(fmt.Errorf("InterconnectAttachment %q has state %q.", name, state)) - } - log.Printf("InterconnectAttachment %q has state %q.", name, state) - return nil - }) -} -{{- end }} diff --git a/mmv1/templates/terraform/constants/go/monitoring_alert_policy.go.tmpl b/mmv1/templates/terraform/constants/go/monitoring_alert_policy.go.tmpl deleted file mode 100644 index e6bef3f23850..000000000000 --- a/mmv1/templates/terraform/constants/go/monitoring_alert_policy.go.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} - -// API does not return a value for REDUCE_NONE -func crossSeriesReducerDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return (new == "" && old == "REDUCE_NONE") || (new == "REDUCE_NONE" && old == "") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/constants/go/monitoring_monitored_project.go.tmpl deleted file mode 100644 index f6210abb6b41..000000000000 --- a/mmv1/templates/terraform/constants/go/monitoring_monitored_project.go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -func ResourceMonitoringMonitoredProjectNameDiffSuppressFunc(k, old, new string, d tpgresource.TerraformResourceDataChange) bool { - // Don't suppress if values are empty strings - if old == "" || new == "" { - return false - } - - oldShort := tpgresource.GetResourceNameFromSelfLink(old) - newShort := tpgresource.GetResourceNameFromSelfLink(new) - - // Suppress if short names are equal - if oldShort == newShort { - return true - } - - _, isOldNumErr := tpgresource.StringToFixed64(oldShort) - isOldNumber := isOldNumErr == nil - _, isNewNumErr := tpgresource.StringToFixed64(newShort) - isNewNumber := isNewNumErr == nil - - // Suppress if comparing a project number to project id - return isOldNumber != isNewNumber -} - -func resourceMonitoringMonitoredProjectNameDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return ResourceMonitoringMonitoredProjectNameDiffSuppressFunc(k, old, new, d) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/monitoring_notification_channel.go.tmpl b/mmv1/templates/terraform/constants/go/monitoring_notification_channel.go.tmpl deleted file mode 100644 index 3f34afa0d715..000000000000 --- a/mmv1/templates/terraform/constants/go/monitoring_notification_channel.go.tmpl +++ /dev/null @@ -1,13 +0,0 @@ - -var sensitiveLabels = []string{"auth_token", "service_key", "password"} - -func sensitiveLabelCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - for _, sl := range sensitiveLabels { - mapLabel := diff.Get("labels." + sl).(string) - authLabel := diff.Get("sensitive_labels.0." + sl).(string) - if mapLabel != "" && authLabel != "" { - return fmt.Errorf("Sensitive label [%s] cannot be set in both `labels` and the `sensitive_labels` block.", sl) - } - } - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/monitoring_slo.go.tmpl b/mmv1/templates/terraform/constants/go/monitoring_slo.go.tmpl deleted file mode 100644 index df0e301c15ba..000000000000 --- a/mmv1/templates/terraform/constants/go/monitoring_slo.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -func validateMonitoringSloGoal(v interface{}, k string) (warnings []string, errors []error) { - goal := v.(float64) - if goal <= 0 || goal > 0.9999 { - errors = append(errors, fmt.Errorf("goal %f must be > 0 and <= 0.9999", goal)) - } - return -} - -func validateAvailabilitySli(v interface{}, key string) (ws []string, errs []error) { - if v.(bool) == false { - errs = append(errs, fmt.Errorf("%q must be set to true, got: %v", key, v)) - } - return -} diff --git a/mmv1/templates/terraform/constants/go/monitoring_uptime_check_config.go.tmpl b/mmv1/templates/terraform/constants/go/monitoring_uptime_check_config.go.tmpl deleted file mode 100644 index 8b22300db65c..000000000000 --- a/mmv1/templates/terraform/constants/go/monitoring_uptime_check_config.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -func resourceMonitoringUptimeCheckConfigHttpCheckPathDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return old == "/"+new -} - -func resourceMonitoringUptimeCheckConfigMonitoredResourceLabelsDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // GCP adds the project_id to the labels if unset. - // We want to suppress the diff if not set in the config. - if strings.HasSuffix(k, "project_id") && new == "" && old != "" { - return true - } - return false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/netapp_volume_replication.go.tmpl b/mmv1/templates/terraform/constants/go/netapp_volume_replication.go.tmpl deleted file mode 100644 index dcae7d2b141c..000000000000 --- a/mmv1/templates/terraform/constants/go/netapp_volume_replication.go.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -// Custom function to wait for mirrorState target states -func NetappVolumeReplicationWaitForMirror(d *schema.ResourceData, meta interface{}, targetState string) error { - config := meta.(*transport_tpg.Config) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/volumes/{{"{{"}}volume_name{{"}}"}}/replications/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - billingProject := "" - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("Error fetching project for volume replication: %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 - } - - for { - res, 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("NetappVolumeReplication %q", d.Id())) - } - - log.Printf("[DEBUG] waiting for mirrorState. actual: %v, target: %v", res["mirrorState"], targetState) - - if res["mirrorState"] == targetState { - break - } - - time.Sleep(30 * time.Second) - // This method can potentially run for days, e.g. when setting up a replication for a source volume - // with dozens of TiB of data. Timeout handling yes/no? - } - - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/network_endpoints.go.tmpl b/mmv1/templates/terraform/constants/go/network_endpoints.go.tmpl deleted file mode 100644 index 2f0fc216b2cf..000000000000 --- a/mmv1/templates/terraform/constants/go/network_endpoints.go.tmpl +++ /dev/null @@ -1,113 +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. -*/ -}} - -type NetworkEndpointsNetworkEndpoint struct { - IPAddress string - Port int - Instance string -} - -func NetworkEndpointsNetworkEndpointConvertToStruct(endpoint interface{}) NetworkEndpointsNetworkEndpoint { - e := endpoint.(map[string]interface{}) - ipAddress := e["ip_address"].(string) - port := e["port"].(int) - instance, _ := e["instance"].(string) - return NetworkEndpointsNetworkEndpoint{ - IPAddress: ipAddress, - Port: port, - Instance: instance, - } -} - -func NetworkEndpointsNetworkEndpointConvertToAny(endpoint NetworkEndpointsNetworkEndpoint) interface{} { - m := make(map[string]interface{}) - m["ip_address"] = endpoint.IPAddress - m["port"] = endpoint.Port - m["instance"] = endpoint.Instance - return m -} - -// Continues to read network endpoints as long as there are unread pages remaining -func networkEndpointsPaginatedRead(d *schema.ResourceData, config *transport_tpg.Config, userAgent, url, project, billingProject, pt string) ([]interface{}, error) { - var allEndpoints []interface{} - for len(pt) > 0 { - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: fmt.Sprintf("%s?pageToken=%s", url, pt), - UserAgent: userAgent, - }) - if err != nil { - return nil, transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ComputeNetworkEndpoints %q", d.Id())) - } - resEndpoints := res["items"].([]interface{}) - allEndpoints = append(allEndpoints, resEndpoints...) - pt, _ = res["nextPageToken"].(string) - } - return allEndpoints, nil -} - -// Mutates the parent NEG by attaching or detaching endpoints in chunks. `url` determines if endpoints are attached or detached. -// The last page is not processed, but instead returned for the Create/Delete functions to write. -func networkEndpointsPaginatedMutate(d *schema.ResourceData, endpoints []interface{}, config *transport_tpg.Config, userAgent, url, project, billingProject string, chunkSize int, returnLastPage bool) ([]interface{}, error) { - // Pull out what this mutation is doing - either attachNetworkEndpoints or detachNetworkEndpoints - verb := url[len(url)-len("attachNetworkEndpoints"):] - id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}network_endpoint_group{{"}}"}}/endpoints") - if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) - } - i := 0 - for ; i < len(endpoints); i += chunkSize { - j := i + chunkSize - if j > len(endpoints) { - if returnLastPage { - break - } - j = len(endpoints) - } - timeoutType := schema.TimeoutCreate - if verb != "attachNetworkEndpoints" { - timeoutType = schema.TimeoutDelete - } - body := map[string]interface{}{"networkEndpoints": endpoints[i:j]} - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: body, - Timeout: d.Timeout(timeoutType), - }) - if err != nil { - return nil, fmt.Errorf("Error during %s: %s", verb, err) - } - - err = ComputeOperationWaitTime( - config, res, project, verb, userAgent, - d.Timeout(schema.TimeoutDefault)) - - if err != nil { - // The mutation wasn't applied - return nil, fmt.Errorf("Error in %s operation: %s", verb, err) - } - - log.Printf("[DEBUG] Finished %s %q: %#v", verb, id, res) - } - if returnLastPage { - return endpoints[i:], nil - } - return nil, nil -} diff --git a/mmv1/templates/terraform/constants/go/network_services_gateway.go.tmpl b/mmv1/templates/terraform/constants/go/network_services_gateway.go.tmpl deleted file mode 100644 index c5e1a0a8b4fa..000000000000 --- a/mmv1/templates/terraform/constants/go/network_services_gateway.go.tmpl +++ /dev/null @@ -1,126 +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. -*/ -}} -// Checks if there is another gateway under the same location. -func gatewaysSameLocation(d *schema.ResourceData, config *transport_tpg.Config, billingProject, userAgent string) ([]interface{}, error) { - log.Print("[DEBUG] Looking for gateways under the same location.") - var gateways []interface{} - - gatewaysUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetworkServicesBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/gateways") - if err != nil { - return gateways, err - } - - resp, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: gatewaysUrl, - UserAgent: userAgent, - }) - if err != nil { - return gateways, err - } - - data, ok := resp["gateways"] - if !ok || data == nil { - log.Print("[DEBUG] No gateways under the same location found.") - return gateways, nil - } - - gateways = data.([]interface{}) - - log.Printf("[DEBUG] There are still gateways under the same location: %#v", gateways) - - return gateways, nil -} - -// Checks if the given list of gateways contains a gateway of type SECURE_WEB_GATEWAY. -func isLastSWGGateway(gateways []interface{}, network string) bool { - log.Print("[DEBUG] Checking if this is the last gateway of type SECURE_WEB_GATEWAY.") - for _, itemRaw := range gateways { - if itemRaw == nil { - continue - } - item := itemRaw.(map[string]interface{}) - - gType, ok := item["type"] - if !ok || gType == nil { - continue - } - - gNetwork, ok := item["network"] - if !ok || gNetwork == nil { - continue - } - - if gType.(string) == "SECURE_WEB_GATEWAY" && gNetwork.(string) == network { - return false - } - } - - log.Print("[DEBUG] There is no other gateway of type SECURE_WEB_GATEWAY.") - // no gateways of type SWG found. - return true -} - -//Deletes the swg-autogen-router if the current gateway being deleted is the type of swg so there is no other gateway using it. -func deleteSWGAutoGenRouter(d *schema.ResourceData, config *transport_tpg.Config, billingProject, userAgent string) error { - log.Printf("[DEBUG] Searching the network id by name %q.", d.Get("network")) - - networkPath := fmt.Sprintf("{{"{{"}}ComputeBasePath{{"}}"}}%s", d.Get("network")) - networkUrl, err := tpgresource.ReplaceVars(d, config, networkPath) - if err != nil { - return err - } - - resp, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: networkUrl, - UserAgent: userAgent, - }) - if err != nil { - return err - } - - // The name of swg auto generated router is in the following format: swg-autogen-router-{NETWORK-ID} - routerId := fmt.Sprintf("swg-autogen-router-%s", resp["id"]) - log.Printf("[DEBUG] Deleting the auto generated router %q.", routerId) - - routerPath := fmt.Sprintf("{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}location{{"}}"}}/routers/%s", routerId) - routerUrl, err := tpgresource.ReplaceVars(d, config, routerPath) - if err != nil { - return err - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: billingProject, - RawURL: routerUrl, - UserAgent: userAgent, - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.IsSwgAutogenRouterRetryable}, - }) - if err != nil { - if transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - // The swg auto gen router may have already been deleted. - // No further action needed. - return nil - } - - return err - } - - return nil -} diff --git a/mmv1/templates/terraform/constants/go/notebooks_instance.go.tmpl b/mmv1/templates/terraform/constants/go/notebooks_instance.go.tmpl deleted file mode 100644 index 17c73cc0954e..000000000000 --- a/mmv1/templates/terraform/constants/go/notebooks_instance.go.tmpl +++ /dev/null @@ -1,102 +0,0 @@ -var NotebooksInstanceProvidedScopes = []string{ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/userinfo.email", -} - -var NotebooksInstanceProvidedTags = []string{ - "deeplearning-vm", - "notebook-instance", -} - -func NotebooksInstanceScopesDiffSuppress(_, _, _ string, d *schema.ResourceData) bool { - return NotebooksDiffSuppressTemplate("service_account_scopes", NotebooksInstanceProvidedScopes, d) -} - -func NotebooksInstanceTagsDiffSuppress(_, _, _ string, d *schema.ResourceData) bool { - return NotebooksDiffSuppressTemplate("tags", NotebooksInstanceProvidedTags, d) -} - -func NotebooksDiffSuppressTemplate(field string, defaults []string, d *schema.ResourceData) bool { - old, new := d.GetChange(field) - - oldValue := old.([]interface{}) - newValue := new.([]interface{}) - oldValueList := []string{} - newValueList := []string{} - - for _, item := range oldValue { - oldValueList = append(oldValueList,item.(string)) - } - - for _, item := range newValue { - newValueList = append(newValueList,item.(string)) - } - newValueList= append(newValueList,defaults...) - - sort.Strings(oldValueList) - sort.Strings(newValueList) - if reflect.DeepEqual(oldValueList, newValueList) { - return true - } - return false -} - -func NotebooksInstanceKmsDiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - if strings.HasPrefix(old, new) { - return true - } - return false -} - -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -// waitForNotebooksInstanceActive waits for an Notebook instance to become "ACTIVE" -func waitForNotebooksInstanceActive(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { - return retry.Retry(timeout, func() *retry.RetryError { - if err := resourceNotebooksInstanceRead(d, config); err != nil { - return retry.NonRetryableError(err) - } - - name := d.Get("name").(string) - state := d.Get("state").(string) - if state == "ACTIVE" { - log.Printf("[DEBUG] Notebook Instance %q has state %q.", name, state) - return nil - } else { - return retry.RetryableError(fmt.Errorf("Notebook Instance %q has state %q. Waiting for ACTIVE state", name, state)) - } - - }) -} -{{- end }} - -func modifyNotebooksInstanceState(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, "{{"{{"}}NotebooksBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/instances/{{"{{"}}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_notebooks_instance %q: %s", state, d.Id(), err) - } - return res, nil -} - -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -func waitForNotebooksOperation(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string, response map[string]interface{}) error { - var opRes map[string]interface{} - err := NotebooksOperationWaitTimeWithResponse( - config, response, &opRes, project, "Modifying Notebook Instance state", userAgent, - d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err - } - return nil -} -{{- end }} diff --git a/mmv1/templates/terraform/constants/go/notebooks_runtime.go.tmpl b/mmv1/templates/terraform/constants/go/notebooks_runtime.go.tmpl deleted file mode 100644 index 70d43f5257c4..000000000000 --- a/mmv1/templates/terraform/constants/go/notebooks_runtime.go.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -const notebooksRuntimeGoogleProvidedLabel = "goog-caip-managed-notebook" - -func NotebooksRuntimeLabelDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for the label provided by Google - if strings.Contains(k, notebooksRuntimeGoogleProvidedLabel) && new == "" { - return true - } - - // Let diff be determined by labels (above) - if strings.Contains(k, "labels.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} - -// NotReturnedByAPIDiffSuppress -func NotReturnedByAPIDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return true -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/org_policy_policy.go.tmpl b/mmv1/templates/terraform/constants/go/org_policy_policy.go.tmpl deleted file mode 100644 index e6bd256ca587..000000000000 --- a/mmv1/templates/terraform/constants/go/org_policy_policy.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -func resourceOrgpolicyPolicyRulesConditionExpressionDiffSuppress(_, old, new string, d *schema.ResourceData) bool { - oldReplaced := strings.ReplaceAll(strings.ReplaceAll(old, "Labels", "TagId"), "label", "tag") - newReplaced := strings.ReplaceAll(strings.ReplaceAll(new, "Labels", "TagId"), "label", "tag") - return oldReplaced == newReplaced -} diff --git a/mmv1/templates/terraform/constants/go/posture.go.tmpl b/mmv1/templates/terraform/constants/go/posture.go.tmpl deleted file mode 100644 index 82542f9a8ac5..000000000000 --- a/mmv1/templates/terraform/constants/go/posture.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -// Compute revision_id for changes in posture fields. -func revisionIdCustomizeDiff(ctx context.Context, d *schema.ResourceDiff, meta interface{}) error { - if d.HasChanges("description", "state", "policy_sets") { - err := d.SetNewComputed("revision_id") - if err != nil { - return fmt.Errorf("Error re-setting revision_id: %s", err) - } - } - return nil -} diff --git a/mmv1/templates/terraform/constants/go/private_connection.go.tmpl b/mmv1/templates/terraform/constants/go/private_connection.go.tmpl deleted file mode 100644 index 3d0da390dd8d..000000000000 --- a/mmv1/templates/terraform/constants/go/private_connection.go.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} - -func extractError(d *schema.ResourceData) error { - // Casts are not safe since the logic that populate it is type deterministic. - error := d.Get("error").([]interface{})[0].(map[string]interface{}) - message := error["message"].(string) - details := error["details"].(map[string]interface{}) - detailsJSON, _ := json.Marshal(details) - return fmt.Errorf("Failed to create PrivateConnection. %s details = %s", message, string(detailsJSON)) -} - -// waitForPrivateConnectionReady waits for a private connection state to become -// CREATED, if the state is FAILED propegate the error to the user. -func waitForPrivateConnectionReady(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { - return retry.Retry(timeout, func() *retry.RetryError { - if err := resourceDatastreamPrivateConnectionRead(d, config); err != nil { - return retry.NonRetryableError(err) - } - - name := d.Get("name").(string) - state := d.Get("state").(string) - if state == "CREATING" { - return retry.RetryableError(fmt.Errorf("PrivateConnection %q has state %q.", name, state)) - } else if state == "CREATED" { - log.Printf("[DEBUG] PrivateConnection %q has state %q.", name, state) - return nil - } else if state == "FAILED" { - return retry.NonRetryableError(extractError(d)) - } else { - return retry.NonRetryableError(fmt.Errorf("PrivateConnection %q has state %q.", name, state)) - } - }) -} -{{- end }} diff --git a/mmv1/templates/terraform/constants/go/privateca_certificate_authority.go.tmpl b/mmv1/templates/terraform/constants/go/privateca_certificate_authority.go.tmpl deleted file mode 100644 index 97e7a44e3700..000000000000 --- a/mmv1/templates/terraform/constants/go/privateca_certificate_authority.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -func resourcePrivateCaCACustomDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - if diff.HasChange("desired_state") { - _, new := diff.GetChange("desired_state") - - if tpgresource.IsNewResource(diff) { - if diff.Get("type").(string) == "SUBORDINATE" { - return fmt.Errorf("`desired_state` can not be specified when creating a SUBORDINATE CA") - } - if new.(string) != "STAGED" && new.(string) != "ENABLED" { - return fmt.Errorf("`desired_state` can only be set to `STAGED` or `ENABLED` when creating a new CA") - } - } else { - if new == "STAGED" && diff.Get("state") != new { - return fmt.Errorf("Field `desired_state` can only be set to `STAGED` when creating a new CA") - } - } - } - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/privileged_access_manager_entitlement.go.tmpl b/mmv1/templates/terraform/constants/go/privileged_access_manager_entitlement.go.tmpl deleted file mode 100644 index 2b99a467de4e..000000000000 --- a/mmv1/templates/terraform/constants/go/privileged_access_manager_entitlement.go.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -const deletedRegexp = `^deleted:` - -func validateDeletedPrincipals(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - if regexp.MustCompile(deletedRegexp).MatchString(value) { - errors = append(errors, fmt.Errorf( - "Terraform does not support IAM policies for deleted principals: %s", k)) - } - - return -} - -const entitlementIdRegexp = `^[a-z][a-z0-9-]{3,62}$` - -func validateEntitlementId(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - if !regexp.MustCompile(entitlementIdRegexp).MatchString(value) { - errors = append(errors, fmt.Errorf( - "Entitlement Id should be 4-63 characters, and valid characters are '[a-z]', '[0-9]', and '-'. The first character should be from [a-z]. : %s", k)) - } - - return -} diff --git a/mmv1/templates/terraform/constants/go/pubsub_subscription.go.tmpl b/mmv1/templates/terraform/constants/go/pubsub_subscription.go.tmpl deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/mmv1/templates/terraform/constants/go/redis_instance.go.tmpl b/mmv1/templates/terraform/constants/go/redis_instance.go.tmpl deleted file mode 100644 index d79a3bb02f0c..000000000000 --- a/mmv1/templates/terraform/constants/go/redis_instance.go.tmpl +++ /dev/null @@ -1,39 +0,0 @@ - -// Is the new redis version less than the old one? -func isRedisVersionDecreasing(_ context.Context, old, new, _ interface{}) bool { - return isRedisVersionDecreasingFunc(old, new) -} - -// separate function for unit testing -func isRedisVersionDecreasingFunc(old, new interface{}) bool { - if old == nil || new == nil { - return false - } - re := regexp.MustCompile(`REDIS_(\d+)_(\d+)`) - oldParsed := re.FindSubmatch([]byte(old.(string))) - newParsed := re.FindSubmatch([]byte(new.(string))) - - if oldParsed == nil || newParsed == nil { - return false - } - - oldVersion, err := strconv.ParseFloat(fmt.Sprintf("%s.%s", oldParsed[1], oldParsed[2]), 32) - if err != nil { - return false - } - newVersion, err := strconv.ParseFloat(fmt.Sprintf("%s.%s", newParsed[1], newParsed[2]), 32) - if err != nil { - return false - } - - return newVersion < oldVersion -} - -// returns true if old=new or old='auto' -func secondaryIpDiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - if ((strings.ToLower(new) == "auto" && old != "") || old == new) { - return true - } - return false -} - diff --git a/mmv1/templates/terraform/constants/go/region_backend_service.go.tmpl b/mmv1/templates/terraform/constants/go/region_backend_service.go.tmpl deleted file mode 100644 index 85b43ba5f628..000000000000 --- a/mmv1/templates/terraform/constants/go/region_backend_service.go.tmpl +++ /dev/null @@ -1,100 +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. -*/ -}} -// Fields in "backends" that are not allowed for non-managed backend services -// (loadBalancingScheme) - the API returns an error if they are set at all -// in the request. -var backendServiceOnlyManagedFieldNames = []string{ - "capacity_scaler", - "max_connections", - "max_connections_per_instance", - "max_connections_per_endpoint", - "max_rate", - "max_rate_per_instance", - "max_rate_per_endpoint", - "max_utilization", -} - -// validateManagedBackendServiceBackends ensures capacity_scaler is set for each backend in a managed -// backend service. To prevent a permadiff, we decided to override the API behavior and require the -// capacity_scaler value in this case. -// -// The API: -// - requires the sum of the backends' capacity_scalers be > 0 -// - defaults to 1 if capacity_scaler is omitted from the request -// -// However, the schema.Set Hash function defaults to 0 if not given, which we chose because it's the default -// float and because non-managed backends can't have the value set, so there will be a permadiff for a -// situational non-zero default returned from the API. We can't diff suppress or customdiff a -// field inside a set object in ResourceDiff, since the value also determines the hash for that set object. -func validateManagedBackendServiceBackends(backends []interface{}, d *schema.ResourceDiff) error { - sum := 0.0 - - for _, b := range backends { - if b == nil { - continue - } - backend := b.(map[string]interface{}) - if v, ok := backend["capacity_scaler"]; ok && v != nil { - sum += v.(float64) - } else { - return fmt.Errorf("capacity_scaler is required for each backend in managed backend service") - } - } - if sum == 0.0 { - return fmt.Errorf("managed backend service must have at least one non-zero capacity_scaler for backends") - } - return nil -} - -// If INTERNAL or EXTERNAL, make sure the user did not provide values for any of the fields that cannot be sent. -// We ignore these values regardless when sent to the API, but this adds plan-time validation if a -// user sets the value to non-zero. We can't validate for empty but set because -// of how the SDK handles set objects (on any read, nil fields will get set to empty values) -func validateNonManagedBackendServiceBackends(backends []interface{}, d *schema.ResourceDiff) error { - for _, b := range backends { - if b == nil { - continue - } - backend := b.(map[string]interface{}) - for _, fn := range backendServiceOnlyManagedFieldNames { - if v, ok := backend[fn]; ok && !tpgresource.IsEmptyValue(reflect.ValueOf(v)) { - return fmt.Errorf("%q cannot be set for non-managed backend service, found value %v", fn, v) - } - } - } - return nil -} - -func customDiffRegionBackendService(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { - v, ok := d.GetOk("backend") - if !ok { - return nil - } - if v == nil { - return nil - } - - backends := v.(*schema.Set).List() - if len(backends) == 0 { - return nil - } - - switch d.Get("load_balancing_scheme").(string) { - case "INTERNAL", "EXTERNAL": - return validateNonManagedBackendServiceBackends(backends, d) - case "INTERNAL_MANAGED": - return nil - default: - return validateManagedBackendServiceBackends(backends, d) - } -} diff --git a/mmv1/templates/terraform/constants/go/region_ssl_policy.tmpl b/mmv1/templates/terraform/constants/go/region_ssl_policy.tmpl deleted file mode 100644 index d333f71872ef..000000000000 --- a/mmv1/templates/terraform/constants/go/region_ssl_policy.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 regionSslPolicyCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - profile := diff.Get("profile") - customFeaturesCount := diff.Get("custom_features.#") - - // Validate that policy configs aren't incompatible during all phases - // CUSTOM profile demands non-zero custom_features, and other profiles (i.e., not CUSTOM) demand zero custom_features - if diff.HasChange("profile") || diff.HasChange("custom_features") { - if profile.(string) == "CUSTOM" && customFeaturesCount.(int) == 0 { - return fmt.Errorf("Error in SSL Policy %s: the profile is set to %s but no custom_features are set.", diff.Get("name"), profile.(string)) - } else if profile.(string) != "CUSTOM" && customFeaturesCount.(int) != 0 { - return fmt.Errorf("Error in SSL Policy %s: the profile is set to %s but using custom_features requires the profile to be CUSTOM.", diff.Get("name"), profile.(string)) - } - return nil - } - return nil -} diff --git a/mmv1/templates/terraform/constants/go/resource_compute_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/constants/go/resource_compute_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index 43f7fd30e2c3..000000000000 --- a/mmv1/templates/terraform/constants/go/resource_compute_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -func firewallPolicyWithRulesConvertPriorityToInt(v interface {}) (int64, error) { - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal, nil - } - } - - if intVal, ok := v.(int64); ok { - return intVal, nil - } - - if floatVal, ok := v.(float64); ok { - intVal := int64(floatVal) - return intVal, nil - } - - return 0, fmt.Errorf("Incorrect rule priority: %s. Priority must be a number", v) -} - -func firewallPolicyWithRulesIsPredefinedRule(rule map[string]interface{}) (bool, error) { - // Priorities from 2147483548 to 2147483647 are reserved and cannot be modified by the user. - const ReservedPriorityStart = 2147483548 - - priority := rule["priority"] - priorityInt, err := firewallPolicyWithRulesConvertPriorityToInt(priority) - - if err != nil { - return false, err - } - - return priorityInt >= ReservedPriorityStart, nil -} - -func firewallPolicyWithRulesSplitPredefinedRules(allRules []interface{}) ([]interface{}, []interface{}, error) { - predefinedRules := make([]interface{}, 0) - rules := make([]interface{}, 0) - for _, rule := range allRules { - isPredefined, err := firewallPolicyWithRulesIsPredefinedRule(rule.(map[string]interface{})) - if err != nil { - return nil, nil, err - } - - if isPredefined { - predefinedRules = append(predefinedRules, rule) - } else { - rules = append(rules, rule) - } - } - return rules, predefinedRules, nil -} - diff --git a/mmv1/templates/terraform/constants/go/resource_compute_network_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/constants/go/resource_compute_network_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index 3a1f2c840e51..000000000000 --- a/mmv1/templates/terraform/constants/go/resource_compute_network_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -func networkFirewallPolicyWithRulesConvertPriorityToInt(v interface {}) (int64, error) { - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal, nil - } - } - - if intVal, ok := v.(int64); ok { - return intVal, nil - } - - if floatVal, ok := v.(float64); ok { - intVal := int64(floatVal) - return intVal, nil - } - - return 0, fmt.Errorf("Incorrect rule priority: %s. Priority must be a number", v) -} - -func networkFirewallPolicyWithRulesIsPredefinedRule(rule map[string]interface{}) (bool, error) { - // Priorities from 2147483548 to 2147483647 are reserved and cannot be modified by the user. - const ReservedPriorityStart = 2147483548 - - priority := rule["priority"] - priorityInt, err := networkFirewallPolicyWithRulesConvertPriorityToInt(priority) - - if err != nil { - return false, err - } - - return priorityInt >= ReservedPriorityStart, nil - -} - -func networkFirewallPolicyWithRulesSplitPredefinedRules(allRules []interface{}) ([]interface{}, []interface{}, error) { - predefinedRules := make([]interface{}, 0) - rules := make([]interface{}, 0) - - for _, rule := range allRules { - isPredefined, err := networkFirewallPolicyWithRulesIsPredefinedRule(rule.(map[string]interface{})) - if err != nil { - return nil, nil, err - } - - if isPredefined { - predefinedRules = append(predefinedRules, rule) - } else { - rules = append(rules, rule) - } - } - - return rules, predefinedRules, nil -} - diff --git a/mmv1/templates/terraform/constants/go/resource_dns_resource_record_set.go.tmpl b/mmv1/templates/terraform/constants/go/resource_dns_resource_record_set.go.tmpl deleted file mode 100644 index 6b8fdffae7d3..000000000000 --- a/mmv1/templates/terraform/constants/go/resource_dns_resource_record_set.go.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -func rrdatasDnsDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - o, n := d.GetChange("rrdatas") - if o == nil || n == nil { - return false - } - - oList := tpgresource.ConvertStringArr(o.([]interface{})) - nList := tpgresource.ConvertStringArr(n.([]interface{})) - - parseFunc := func(record string) string { - switch d.Get("type") { - case "AAAA": - // parse ipv6 to a key from one list - return net.ParseIP(record).String() - case "MX", "DS": - return strings.ToLower(record) - case "TXT": - return strings.ToLower(strings.Trim(record, `"`)) - default: - return record - } - } - return RrdatasListDiffSuppress(oList, nList, parseFunc, d) -} - -// suppress on a list when 1) its items have dups that need to be ignored -// and 2) string comparison on the items may need a special parse function -// example of usage can be found ../../../third_party/terraform/services/dns/resource_dns_record_set_test.go.tmpl -func RrdatasListDiffSuppress(oldList, newList []string, fun func(x string) string, _ *schema.ResourceData) bool { - // compare two lists of unordered records - diff := make(map[string]bool, len(oldList)) - for _, oldRecord := range oldList { - // set all new IPs to true - diff[fun(oldRecord)] = true - } - for _, newRecord := range newList { - // set matched IPs to false otherwise can't suppress - if diff[fun(newRecord)] { - diff[fun(newRecord)] = false - } else { - return false - } - } - // can't suppress if unmatched records are found - for _, element := range diff { - if element { - return false - } - } - return true -} diff --git a/mmv1/templates/terraform/constants/go/router.go.tmpl b/mmv1/templates/terraform/constants/go/router.go.tmpl deleted file mode 100644 index f4f93dfb5b2f..000000000000 --- a/mmv1/templates/terraform/constants/go/router.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. -*/ -}} -// customizeDiff func for additional checks on google_compute_router properties: -func resourceComputeRouterCustomDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - - block := diff.Get("bgp.0").(map[string]interface{}) - advertiseMode := block["advertise_mode"] - advertisedGroups := block["advertised_groups"].([]interface{}) - advertisedIPRanges := block["advertised_ip_ranges"].([]interface{}) - - if advertiseMode == "DEFAULT" && len(advertisedGroups) != 0 { - return fmt.Errorf("Error in bgp: advertised_groups cannot be specified when using advertise_mode DEFAULT") - } - if advertiseMode == "DEFAULT" && len(advertisedIPRanges) != 0 { - return fmt.Errorf("Error in bgp: advertised_ip_ranges cannot be specified when using advertise_mode DEFAULT") - } - - return nil -} diff --git a/mmv1/templates/terraform/constants/go/router_bgp_peer.tmpl b/mmv1/templates/terraform/constants/go/router_bgp_peer.tmpl deleted file mode 100644 index 840494bf6e27..000000000000 --- a/mmv1/templates/terraform/constants/go/router_bgp_peer.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -func ipv6RepresentationDiffSuppress(_, old, new string, d *schema.ResourceData) bool { - //Diff suppress any equal IPV6 address in different representations - //An IPV6 address can have long or short representations - //E.g 2001:0cb0:0000:0000:0fc0:0000:0000:0abc, after compression: - //A) 2001:0cb0::0fc0:0000:0000:0abc (Omit groups of all zeros) - //B) 2001:cb0:0:0:fc0::abc (Omit leading zeros) - //C) 2001:cb0::fc0:0:0:abc (Combining A and B) - //The GCP API follows rule B) for normalzation - - oldIp := net.ParseIP(old) - newIp := net.ParseIP(new) - return oldIp.Equal(newIp) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/router_nat.go.tmpl b/mmv1/templates/terraform/constants/go/router_nat.go.tmpl deleted file mode 100644 index f7550929c0ac..000000000000 --- a/mmv1/templates/terraform/constants/go/router_nat.go.tmpl +++ /dev/null @@ -1,175 +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 resourceNameSetFromSelfLinkSet(v interface{}) *schema.Set { - if v == nil { - return schema.NewSet(schema.HashString, nil) - } - vSet := v.(*schema.Set) - ls := make([]interface{}, 0, vSet.Len()) - for _, v := range vSet.List() { - if v == nil { - continue - } - ls = append(ls, tpgresource.GetResourceNameFromSelfLink(v.(string))) - } - return schema.NewSet(schema.HashString, ls) -} - -// drain_nat_ips MUST be set from (just set) previous values of nat_ips -// so this customizeDiff func makes sure drainNatIps values: -// - aren't set at creation time -// - are in old value of nat_ips but not in new values -func resourceComputeRouterNatDrainNatIpsCustomDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - o, n := diff.GetChange("drain_nat_ips") - oSet := resourceNameSetFromSelfLinkSet(o) - nSet := resourceNameSetFromSelfLinkSet(n) - addDrainIps := nSet.Difference(oSet) - - // We don't care if there are no new drainNatIps - if addDrainIps.Len() == 0 { - return nil - } - - // Resource hasn't been created yet - return error - if diff.Id() == "" { - return fmt.Errorf("New RouterNat cannot have drain_nat_ips, got values %+v", addDrainIps.List()) - } - // - o, n = diff.GetChange("nat_ips") - oNatSet := resourceNameSetFromSelfLinkSet(o) - nNatSet := resourceNameSetFromSelfLinkSet(n) - - // Resource is being updated - make sure new drainNatIps were in natIps prior d and no longer are in natIps. - for _, v := range addDrainIps.List() { - if !oNatSet.Contains(v) { - return fmt.Errorf("drain_nat_ip %q was not previously set in nat_ips %+v", v.(string), oNatSet.List()) - } - if nNatSet.Contains(v) { - return fmt.Errorf("drain_nat_ip %q cannot be drained if still set in nat_ips %+v", v.(string), nNatSet.List()) - } - } - return nil -} - -func computeRouterNatSubnetworkHash(v interface{}) int { - obj := v.(map[string]interface{}) - name := obj["name"] - sourceIpRanges := obj["source_ip_ranges_to_nat"] - sourceIpRangesHash := 0 - if sourceIpRanges != nil { - sourceIpSet := sourceIpRanges.(*schema.Set) - - for _, ipRange := range sourceIpSet.List() { - sourceIpRangesHash += schema.HashString(ipRange.(string)) - } - } - - secondaryIpRangeNames := obj["secondary_ip_range_names"] - secondaryIpRangeHash := 0 - if secondaryIpRangeNames != nil { - secondaryIpRangeSet := secondaryIpRangeNames.(*schema.Set) - - for _, secondaryIp := range secondaryIpRangeSet.List() { - secondaryIpRangeHash += schema.HashString(secondaryIp.(string)) - } - } - - return schema.HashString(tpgresource.NameFromSelfLinkStateFunc(name)) + sourceIpRangesHash + secondaryIpRangeHash -} - -func computeRouterNatIPsHash(v interface{}) int { - val := (v.(string)) - newParts := strings.Split(val, "/") - if len(newParts) == 1 { - return schema.HashString(newParts[0]) - } - return schema.HashString(tpgresource.GetResourceNameFromSelfLink(val)) -} - -{{ if ne $.TargetVersionName `ga` -}} -func computeRouterNatRulesSubnetHash(v interface{}) int { - return computeRouterNatIPsHash(v) -} -{{- end }} - -func computeRouterNatRulesHash(v interface{}) int { - obj := v.(map[string]interface{}) - ruleNumber := obj["rule_number"].(int) - - description := obj["description"] - descriptionHash := 0 - if description != nil { - descriptionHash = schema.HashString(description.(string)) - } - - match := obj["match"].(string) - - sourceNatActiveIpHash := 0 - sourceNatDrainIpHash := 0 - {{- if ne $.TargetVersionName "ga" }} - sourceNatActiveRangeHash := 0 - sourceNatDrainRangeHash := 0 - {{- end }} - routerNatRulesHash := 0 - - if obj["action"] != nil { - actions := obj["action"].([]interface{}) - if len(actions) != 0 && actions[0] != nil { - action := actions[0].(map[string]interface{}) - - sourceNatActiveIps := action["source_nat_active_ips"] - if sourceNatActiveIps != nil { - sourceNatActiveIpSet := sourceNatActiveIps.(*schema.Set) - for _, sourceNatActiveIp := range sourceNatActiveIpSet.List() { - sourceNatActiveIpStr := fmt.Sprintf("source_nat_active_ips-%d", computeRouterNatIPsHash(sourceNatActiveIp.(string))) - sourceNatActiveIpHash += schema.HashString(sourceNatActiveIpStr) - } - } - - soureNatDrainIps := action["source_nat_drain_ips"] - if soureNatDrainIps != nil { - soureNatDrainIpSet := soureNatDrainIps.(*schema.Set) - for _, soureNatDrainIp := range soureNatDrainIpSet.List() { - sourceNatDrainIpStr := fmt.Sprintf("source_nat_drain_ips-%d", computeRouterNatIPsHash(soureNatDrainIp.(string))) - sourceNatDrainIpHash += schema.HashString(sourceNatDrainIpStr) - } - } - - {{ if ne $.TargetVersionName `ga` -}} - sourceNatActiveRanges := action["source_nat_active_ranges"] - if sourceNatActiveRanges != nil { - sourceNatActiveRangesSet := sourceNatActiveRanges.(*schema.Set) - for _, sourceNatActiveRange := range sourceNatActiveRangesSet.List() { - sourceNatActiveRangeStr := fmt.Sprintf("source_nat_active_ranges-%d", computeRouterNatRulesSubnetHash(sourceNatActiveRange.(string))) - sourceNatActiveRangeHash += schema.HashString(sourceNatActiveRangeStr) - } - } - - sourceNatDrainRanges := action["source_nat_drain_ranges"] - if sourceNatDrainRanges != nil { - sourceNatDrainRangesSet := sourceNatDrainRanges.(*schema.Set) - for _, sourceNatDrainRange := range sourceNatDrainRangesSet.List() { - sourceNatDrainRangeStr := fmt.Sprintf("source_nat_drain_ranges-%d", computeRouterNatRulesSubnetHash(sourceNatDrainRange.(string))) - sourceNatDrainRangeHash += schema.HashString(sourceNatDrainRangeStr) - } - } - {{- end }} - } - } - - routerNatRulesHash = ruleNumber + descriptionHash + schema.HashString(match) + sourceNatActiveIpHash + sourceNatDrainIpHash - {{- if ne $.TargetVersionName "ga" }} - routerNatRulesHash += sourceNatActiveRangeHash + sourceNatDrainRangeHash - {{- end }} - return routerNatRulesHash -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/router_nat_validate_action_active_range.go.tmpl b/mmv1/templates/terraform/constants/go/router_nat_validate_action_active_range.go.tmpl deleted file mode 100644 index b1dbba3c8a53..000000000000 --- a/mmv1/templates/terraform/constants/go/router_nat_validate_action_active_range.go.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -{{- if ne $.TargetVersionName "ga" -}} -natType := d.Get("type").(string) -if natType == "PRIVATE" { - rules := d.Get("rules").(*schema.Set) - for _, rule := range rules.List() { - objRule := rule.(map[string]interface{}) - actions := objRule["action"].([]interface{}) - - containAction := len(actions) != 0 && actions[0] != nil - containActiveRange := true - - if containAction { - action := actions[0].(map[string]interface{}) - sourceNatActiveRanges := action["source_nat_active_ranges"] - if sourceNatActiveRanges != nil { - sourceNatActiveRangesSet := sourceNatActiveRanges.(*schema.Set) - if len(sourceNatActiveRangesSet.List()) == 0 { - containActiveRange = false - } - } - } - - if !containAction || !containActiveRange { - return fmt.Errorf("The rule for PRIVATE nat type must contain an action with source_nat_active_ranges set") - } - } -} -{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/scheduler.tmpl b/mmv1/templates/terraform/constants/go/scheduler.tmpl deleted file mode 100644 index 5905fb671cc3..000000000000 --- a/mmv1/templates/terraform/constants/go/scheduler.tmpl +++ /dev/null @@ -1,81 +0,0 @@ -// Both oidc and oauth headers cannot be set -func validateAuthHeaders(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - httpBlock := diff.Get("http_target.0").(map[string]interface{}) - - if httpBlock != nil { - oauth := httpBlock["oauth_token"] - oidc := httpBlock["oidc_token"] - - if oauth != nil && oidc != nil { - if len(oidc.([]interface{})) > 0 && len(oauth.([]interface{})) > 0 { - return fmt.Errorf("Error in http_target: only one of oauth_token or oidc_token can be specified, but not both.") - } - } - } - - return nil -} - -// Suppress diffs in below cases -// "https://hello-rehvs75zla-uc.a.run.app/" -> "https://hello-rehvs75zla-uc.a.run.app" -// "https://hello-rehvs75zla-uc.a.run.app" -> "https://hello-rehvs75zla-uc.a.run.app/" -func LastSlashDiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - if last := len(new) - 1; last >= 0 && new[last] == '/' { - new = new[:last] - } - - if last := len(old) - 1; last >= 0 && old[last] == '/' { - old = old[:last] - } - return new == old -} - -func authHeaderDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // If generating an `oauth_token` and `scope` is not provided in the configuration, - // the default "https://www.googleapis.com/auth/cloud-platform" scope will be used. - // Similarly, if generating an `oidc_token` and `audience` is not provided in the - // configuration, the URI specified in target will be used. Although not in the - // configuration, in both cases the default is returned in the object, but is not in. - // state. We suppress the diff if the values are these defaults but are not stored in state. - - b := strings.Split(k, ".") - if b[0] == "http_target" && len(b) > 4 { - block := b[2] - attr := b[4] - - if block == "oauth_token" && attr == "scope" { - if old == tpgresource.CanonicalizeServiceScope("cloud-platform") && new == "" { - return true - } - } - - if block == "oidc_token" && attr == "audience" { - uri := d.Get(strings.Join(b[0:2], ".")+".uri") - if old == uri && new == "" { - return true - } - } - - } - - return false -} - -func validateHttpHeaders() schema.SchemaValidateFunc { - return func(i interface{}, k string) (s []string, es []error) { - headers := i.(map[string]interface{}) - if _, ok := headers["Content-Length"]; ok { - es = append(es, fmt.Errorf("Cannot set the Content-Length header on %s", k)) - return - } - r := regexp.MustCompile(`(X-Google-|X-AppEngine-).*`) - for key := range headers { - if r.MatchString(key) { - es = append(es, fmt.Errorf("Cannot set the %s header on %s", key, k)) - return - } - } - - return - } -} diff --git a/mmv1/templates/terraform/constants/go/secret_manager_secret.go.tmpl b/mmv1/templates/terraform/constants/go/secret_manager_secret.go.tmpl deleted file mode 100644 index 13db855f5e7e..000000000000 --- a/mmv1/templates/terraform/constants/go/secret_manager_secret.go.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -// Prevent ForceNew when upgrading replication.automatic -> replication.auto -func secretManagerSecretAutoCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - oAutomatic, nAutomatic := diff.GetChange("replication.0.automatic") - _, nAuto := diff.GetChange("replication.0.auto") - autoLen := len(nAuto.([]interface{})) - - // Do not ForceNew if we are removing "automatic" while adding "auto" - if oAutomatic == true && nAutomatic == false && autoLen > 0 { - return nil - } - - if diff.HasChange("replication.0.automatic") { - if err := diff.ForceNew("replication.0.automatic"); err != nil { - return err - } - } - - if diff.HasChange("replication.0.auto") { - if err := diff.ForceNew("replication.0.auto"); err != nil { - return err - } - } - - return nil -} diff --git a/mmv1/templates/terraform/constants/go/service_networking_vpc_service_controls.go.tmpl b/mmv1/templates/terraform/constants/go/service_networking_vpc_service_controls.go.tmpl deleted file mode 100644 index 78776e58a471..000000000000 --- a/mmv1/templates/terraform/constants/go/service_networking_vpc_service_controls.go.tmpl +++ /dev/null @@ -1,76 +0,0 @@ -func resourceServiceNetworkingVPCServiceControlsSet(d *schema.ResourceData, meta interface{}, config *transport_tpg.Config) error { - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return err - } - projectNumber, err := getProjectNumber(d, config, project, userAgent) - if err != nil { - return err - } - - network := d.Get("network").(string) - enabled := d.Get("enabled").(bool) - - obj := make(map[string]interface{}) - obj["consumerNetwork"] = fmt.Sprintf("projects/%s/global/networks/%s", projectNumber, network) - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ServiceNetworkingBasePath{{"}}"}}services/{{"{{"}}service{{"}}"}}") - if err != nil { - return err - } - - if enabled { - url = url + ":enableVpcServiceControls" - } else { - url = url + ":disableVpcServiceControls" - } - - log.Printf("[DEBUG] Setting service networking VPC service controls: %#v", obj) - billingProject := "" - - // err == nil indicates that the billing_project value was found - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - headers := make(http.Header) - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutCreate), - Headers: headers, - }) - if err != nil { - return fmt.Errorf("Error creating VPCServiceControls: %s", err) - } - - id, err := tpgresource.ReplaceVars(d, config, "services/{{"{{"}}service{{"}}"}}/projects/{{"{{"}}project{{"}}"}}/networks/{{"{{"}}network{{"}}"}}") - if err != nil { - return fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - err = ServiceNetworkingOperationWaitTime( - config, res, "Setting service networking VPC service controls", userAgent, project, - d.Timeout(schema.TimeoutCreate)) - - if err != nil { - // The resource didn't actually create - d.SetId("") - return fmt.Errorf("Error waiting to set service networking VPC service controls: %s", err) - } - - log.Printf("[DEBUG] Finished setting service networking VPC service controls %q: %#v", d.Id(), res) - - return resourceServiceNetworkingVPCServiceControlsRead(d, meta) -} diff --git a/mmv1/templates/terraform/constants/go/source_repo_repository.go.tmpl b/mmv1/templates/terraform/constants/go/source_repo_repository.go.tmpl deleted file mode 100644 index f4dfd14cf77a..000000000000 --- a/mmv1/templates/terraform/constants/go/source_repo_repository.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 resourceSourceRepoRepositoryPubSubConfigsHash(v interface{}) int { - if v == nil { - return 0 - } - - var buf bytes.Buffer - m := v.(map[string]interface{}) - - buf.WriteString(fmt.Sprintf("%s-", tpgresource.GetResourceNameFromSelfLink(m["topic"].(string)))) - buf.WriteString(fmt.Sprintf("%s-", m["message_format"].(string))) - if v, ok := m["service_account_email"]; ok { - buf.WriteString(fmt.Sprintf("%s-", v.(string))) - } - - return tpgresource.Hashcode(buf.String()) -} diff --git a/mmv1/templates/terraform/constants/go/spanner_database.go.tmpl b/mmv1/templates/terraform/constants/go/spanner_database.go.tmpl deleted file mode 100644 index 9370e272df37..000000000000 --- a/mmv1/templates/terraform/constants/go/spanner_database.go.tmpl +++ /dev/null @@ -1,59 +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. -*/ -}} -// customizeDiff func for additional checks on google_spanner_database properties: -func resourceSpannerDBDdlCustomDiffFunc(diff tpgresource.TerraformResourceDiff) error { - old, new := diff.GetChange("ddl") - oldDdls := old.([]interface{}) - newDdls := new.([]interface{}) - var err error - - if len(newDdls) < len(oldDdls) { - err = diff.ForceNew("ddl") - if err != nil { - return fmt.Errorf("ForceNew failed for ddl, old - %v and new - %v", oldDdls, newDdls) - } - return nil - } - - for i := range oldDdls { - if newDdls[i].(string) != oldDdls[i].(string) { - err = diff.ForceNew("ddl") - if err != nil { - return fmt.Errorf("ForceNew failed for ddl, old - %v and new - %v", oldDdls, newDdls) - } - return nil - } - } - return nil -} - -func resourceSpannerDBDdlCustomDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - // separate func to allow unit testing - return resourceSpannerDBDdlCustomDiffFunc(diff) -} - -func resourceSpannerDBVirtualUpdate(d *schema.ResourceData, resourceSchema map[string]*schema.Schema) bool { - // deletion_protection is the only virtual field - if d.HasChange("deletion_protection") { - for field := range resourceSchema { - if field == "deletion_protection" { - continue - } - if d.HasChange(field) { - return false - } - } - return true - } - return false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/spanner_instance.go.tmpl b/mmv1/templates/terraform/constants/go/spanner_instance.go.tmpl deleted file mode 100644 index 522a02da844a..000000000000 --- a/mmv1/templates/terraform/constants/go/spanner_instance.go.tmpl +++ /dev/null @@ -1,68 +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 deleteSpannerBackups(d *schema.ResourceData, config *transport_tpg.Config, res map[string]interface{}, userAgent string, billingProject string) error { - var v interface{} - var ok bool - - v, ok = res["backups"] - if !ok || v == nil { - return nil - } - - // Iterate over the list and delete each backup. - for _, itemRaw := range v.([]interface{}) { - if itemRaw == nil { - continue - } - item := itemRaw.(map[string]interface{}) - - backupName := item["name"].(string) - - log.Printf("[DEBUG] Found backups for resource %q: %#v)", d.Id(), item) - - path := "{{"{{"}}SpannerBasePath{{"}}"}}" + backupName - - url, err := tpgresource.ReplaceVars(d, config, path) - if err != nil { - return err - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return err - } - } - return nil -} - -func resourceSpannerInstanceVirtualUpdate(d *schema.ResourceData, resourceSchema map[string]*schema.Schema) bool { - // force_destroy is the only virtual field - if d.HasChange("force_destroy") { - for field := range resourceSchema { - if field == "force_destroy" { - continue - } - if d.HasChange(field) { - return false - } - } - return true - } - return false -} diff --git a/mmv1/templates/terraform/constants/go/spanner_instance_config.go.tmpl b/mmv1/templates/terraform/constants/go/spanner_instance_config.go.tmpl deleted file mode 100644 index 988ffdbae97c..000000000000 --- a/mmv1/templates/terraform/constants/go/spanner_instance_config.go.tmpl +++ /dev/null @@ -1,55 +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 replicasHash(v interface{}) int { - var buf bytes.Buffer - m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(m["location"].(string)))) // ToLower just in case - buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(m["type"].(string)))) - var isLeader interface{} - if m["defaultLeaderLocation"] != nil { - isLeader = m["defaultLeaderLocation"] - } else { - isLeader = false - } - buf.WriteString(fmt.Sprintf("%v-", isLeader.(bool))) - return tpgresource.Hashcode(buf.String()) -} - -func getBaseInstanceConfigReplicas(d *schema.ResourceData, config *transport_tpg.Config, baseConfigProp interface{}, billingProject, userAgent string) ([]interface{}, error) { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SpannerBasePath{{"}}"}}") - if err != nil { - return nil, err - } - - headers := make(http.Header) - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: fmt.Sprintf("%s%s", url, baseConfigProp.(string)), - UserAgent: userAgent, - Timeout: d.Timeout(schema.TimeoutCreate), - Headers: headers, - }) - if err != nil { - return nil, fmt.Errorf("Error fetching base InstanceConfig: %s", err) - } - - data, ok := res["replicas"] - if !ok || data == nil { - log.Print("[DEBUG] No replicas in the base InstanceConfig.") - return nil, nil - } - - return data.([]interface{}), nil -} diff --git a/mmv1/templates/terraform/constants/go/ssl_policy.tmpl b/mmv1/templates/terraform/constants/go/ssl_policy.tmpl deleted file mode 100644 index 40544d2cf32d..000000000000 --- a/mmv1/templates/terraform/constants/go/ssl_policy.tmpl +++ /dev/null @@ -1,32 +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 sslPolicyCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - profile := diff.Get("profile") - customFeaturesCount := diff.Get("custom_features.#") - - // Validate that policy configs aren't incompatible during all phases - // CUSTOM profile demands non-zero custom_features, and other profiles (i.e., not CUSTOM) demand zero custom_features - if diff.HasChange("profile") || diff.HasChange("custom_features") { - if profile.(string) == "CUSTOM" { - if customFeaturesCount.(int) == 0 { - return fmt.Errorf("Error in SSL Policy %s: the profile is set to %s but no custom_features are set.", diff.Get("name"), profile.(string)) - } - } else { - if customFeaturesCount != 0 { - return fmt.Errorf("Error in SSL Policy %s: the profile is set to %s but using custom_features requires the profile to be CUSTOM.", diff.Get("name"), profile.(string)) - } - } - return nil - } - return nil -} diff --git a/mmv1/templates/terraform/constants/go/subnetwork.tmpl b/mmv1/templates/terraform/constants/go/subnetwork.tmpl deleted file mode 100644 index 74edec68a5a5..000000000000 --- a/mmv1/templates/terraform/constants/go/subnetwork.tmpl +++ /dev/null @@ -1,50 +0,0 @@ -// Whether the IP CIDR change shrinks the block. -func IsShrinkageIpCidr(_ context.Context, old, new, _ interface{}) bool { - _, oldCidr, oldErr := net.ParseCIDR(old.(string)) - _, newCidr, newErr := net.ParseCIDR(new.(string)) - - if oldErr != nil || newErr != nil { - // This should never happen. The ValidateFunc on the field ensures it. - return false - } - - oldStart, oldEnd := cidr.AddressRange(oldCidr) - - if newCidr.Contains(oldStart) && newCidr.Contains(oldEnd) { - // This is a CIDR range expansion, no need to ForceNew, we have an update method for it. - return false - } - - return true -} - -func sendSecondaryIpRangeIfEmptyDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - // on create, return immediately as we don't need to determine if the value is empty or not - if diff.Id() == "" { - return nil - } - - sendZero := diff.Get("send_secondary_ip_range_if_empty").(bool) - if !sendZero { - return nil - } - - configSecondaryIpRange := diff.GetRawConfig().GetAttr("secondary_ip_range") - if !configSecondaryIpRange.IsKnown() { - return nil - } - configValueIsEmpty := configSecondaryIpRange.IsNull() || configSecondaryIpRange.LengthInt() == 0 - - stateSecondaryIpRange := diff.GetRawState().GetAttr("secondary_ip_range") - if !stateSecondaryIpRange.IsKnown() { - return nil - } - stateValueIsEmpty := stateSecondaryIpRange.IsNull() || stateSecondaryIpRange.LengthInt() == 0 - - if configValueIsEmpty && !stateValueIsEmpty { - log.Printf("[DEBUG] setting secondary_ip_range to newly empty") - diff.SetNew("secondary_ip_range", make([]interface{}, 0)) - } - - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/subscription.go.tmpl b/mmv1/templates/terraform/constants/go/subscription.go.tmpl deleted file mode 100644 index 336517ee07a7..000000000000 --- a/mmv1/templates/terraform/constants/go/subscription.go.tmpl +++ /dev/null @@ -1,46 +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 comparePubsubSubscriptionExpirationPolicy(_, old, new string, _ *schema.ResourceData) bool { - trimmedNew := strings.TrimLeft(new, "0") - trimmedOld := strings.TrimLeft(old, "0") - if strings.Contains(trimmedNew, ".") { - trimmedNew = strings.TrimRight(strings.TrimSuffix(trimmedNew, "s"), "0") + "s" - } - if strings.Contains(trimmedOld, ".") { - trimmedOld = strings.TrimRight(strings.TrimSuffix(trimmedOld, "s"), "0") + "s" - } - return trimmedNew == trimmedOld -} - -func IgnoreMissingKeyInMap(key string) schema.SchemaDiffSuppressFunc { - return func(k, old, new string, d *schema.ResourceData) bool { - log.Printf("[DEBUG] - suppressing diff %q with old %q, new %q", k, old, new) - if strings.HasSuffix(k, ".%") { - oldNum, err := strconv.Atoi(old) - if err != nil { - log.Printf("[ERROR] could not parse %q as number, no longer attempting diff suppress", old) - return false - } - newNum, err := strconv.Atoi(new) - if err != nil { - log.Printf("[ERROR] could not parse %q as number, no longer attempting diff suppress", new) - return false - } - return oldNum+1 == newNum - } else if strings.HasSuffix(k, "." + key) { - return old == "" - } - return false - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/tagtemplate_fields.go.tmpl b/mmv1/templates/terraform/constants/go/tagtemplate_fields.go.tmpl deleted file mode 100644 index 3fb2624ef7eb..000000000000 --- a/mmv1/templates/terraform/constants/go/tagtemplate_fields.go.tmpl +++ /dev/null @@ -1,72 +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. -*/ -}} - -//Use it to delete TagTemplate Field -func deleteTagTemplateField(d *schema.ResourceData, config *transport_tpg.Config, name, billingProject, userAgent string) (error) { - - url_delete, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DataCatalogBasePath{{"}}"}}{{"{{"}}name{{"}}"}}/fields/"+name+"?force={{"{{"}}force_delete{{"}}"}}") - if err != nil { - return err - } - var obj map[string]interface{} - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: billingProject, - RawURL: url_delete, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), - }) - if err != nil { - return fmt.Errorf("Error deleting TagTemplate Field %v: %s", name, err) - } - - log.Printf("[DEBUG] Finished deleting TagTemplate Field %q: %#v", name, res) - return nil -} - -//Use it to create TagTemplate Field -func createTagTemplateField(d *schema.ResourceData, config *transport_tpg.Config, body map[string]interface{}, name, billingProject, userAgent string) (error) { - - url_create, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DataCatalogBasePath{{"}}"}}{{"{{"}}name{{"}}"}}/fields") - if err != nil { - return err - } - - url_create, err = transport_tpg.AddQueryParams(url_create, map[string]string{"tagTemplateFieldId": name}) - if err != nil { - return err - } - - res_create, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url_create, - UserAgent: userAgent, - Body: body, - Timeout: d.Timeout(schema.TimeoutCreate), - }) - if err != nil { - return fmt.Errorf("Error creating TagTemplate Field: %s", err) - } - - if err != nil { - return fmt.Errorf("Error creating TagTemplate Field %v: %s", name, err) - } else { - log.Printf("[DEBUG] Finished creating TagTemplate Field %v: %#v", name, res_create) - } - - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/go/tpu_node.tmpl b/mmv1/templates/terraform/constants/go/tpu_node.tmpl deleted file mode 100644 index 716bdc9adb7e..000000000000 --- a/mmv1/templates/terraform/constants/go/tpu_node.tmpl +++ /dev/null @@ -1,50 +0,0 @@ -// compareTpuNodeSchedulingConfig diff suppresses for the default -// scheduling, i.e. if preemptible is false, the API may either return no -// schedulingConfig or an empty schedulingConfig. -func compareTpuNodeSchedulingConfig(k, old, new string, d *schema.ResourceData) bool { - if k == "scheduling_config.0.preemptible" { - return old == "" && new == "false" - } - if k == "scheduling_config.#" { - o, n := d.GetChange("scheduling_config.0.preemptible") - return o.(bool) == n.(bool) - } - return false -} - -func tpuNodeCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { - old, new := diff.GetChange("network") - config := meta.(*transport_tpg.Config) - - networkLinkRegex := regexp.MustCompile("projects/(.+)/global/networks/(.+)") - - var pid string - - if networkLinkRegex.MatchString(new.(string)) { - parts := networkLinkRegex.FindStringSubmatch(new.(string)) - pid = parts[1] - } - - if pid == "" { - return nil - } - - project, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(pid).Do() - if err != nil { - return fmt.Errorf("Failed to retrieve project, pid: %s, err: %s", pid, err) - } - - if networkLinkRegex.MatchString(old.(string)) { - parts := networkLinkRegex.FindStringSubmatch(old.(string)) - i, err := tpgresource.StringToFixed64(parts[1]) - if err == nil { - if project.ProjectNumber == i { - if err := diff.SetNew("network", old); err != nil { - return err - } - return nil - } - } - } - return nil -} diff --git a/mmv1/templates/terraform/constants/go/tpu_vm.go.tmpl b/mmv1/templates/terraform/constants/go/tpu_vm.go.tmpl deleted file mode 100644 index d985d189243a..000000000000 --- a/mmv1/templates/terraform/constants/go/tpu_vm.go.tmpl +++ /dev/null @@ -1,46 +0,0 @@ - -// Suppress unremovable default scope values from GCP. -func tpuServiceAccountAddedScopesSuppress(k, old, new string, d *schema.ResourceData) bool { - if strings.Contains(k, "scope.#") && (new == "0" || new == "") && old != new { - return false - } - - // Get changes for service_account.xx.scope - b := strings.Split(k, ".") - o, n := d.GetChange(strings.TrimSuffix(k, "."+b[len(b)-1])) - if o == nil || n == nil { - return false - } - - oList := normalizeScopes(tpgresource.ConvertStringArr(o.([]interface{}))) - nList := normalizeScopes(tpgresource.ConvertStringArr(n.([]interface{}))) - - return reflect.DeepEqual(oList, nList) -} - -// Normalize the scopes by filtering out the `https://www.googleapis.com/auth/pubsub` scope during -// comparison -func normalizeScopes(scopes []string) []string { - var result []string - for _, s := range scopes { - if s != "https://www.googleapis.com/auth/pubsub" { - result = append(result, s) - } - } - return result -} - -// For backwards compatibility, we need to maintain original behavior where `accelerator_type` -// defaults "v2-8" when nothing is set. However, if the newly introduced `accelerator_config` field -// is set, then use that value instead of the `accelerator_type` default. -func acceleratorTypeCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - _, isTypeSet := diff.GetOk("accelerator_type") - _, isConfigSet := diff.GetOk("accelerator_config") - if !isTypeSet && !isConfigSet { - if err := diff.SetNew("accelerator_type", "v2-8"); err != nil { - return err - } - } - - return nil -} diff --git a/mmv1/templates/terraform/constants/go/vertex_ai_featurestore_entitytype.go.tmpl b/mmv1/templates/terraform/constants/go/vertex_ai_featurestore_entitytype.go.tmpl deleted file mode 100644 index bc77cf0eba2e..000000000000 --- a/mmv1/templates/terraform/constants/go/vertex_ai_featurestore_entitytype.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -if v, ok := d.GetOk("featurestore"); ok { - re := regexp.MustCompile("projects/([a-zA-Z0-9-]*)/(?:locations|regions)/([a-zA-Z0-9-]*)") - switch { - case re.MatchString(v.(string)): - if res := re.FindStringSubmatch(v.(string)); len(res) == 3 && res[1] != "" { - project = res[1] - } - } -} diff --git a/mmv1/templates/terraform/constants/go/vertex_ai_featurestore_entitytype_feature.go.tmpl b/mmv1/templates/terraform/constants/go/vertex_ai_featurestore_entitytype_feature.go.tmpl deleted file mode 100644 index 857082b84f35..000000000000 --- a/mmv1/templates/terraform/constants/go/vertex_ai_featurestore_entitytype_feature.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -if v, ok := d.GetOk("entitytype"); ok { - re := regexp.MustCompile("projects/([a-zA-Z0-9-]*)/(?:locations|regions)/([a-zA-Z0-9-]*)") - switch { - case re.MatchString(v.(string)): - if res := re.FindStringSubmatch(v.(string)); len(res) == 3 && res[1] != "" { - project = res[1] - } - } -} diff --git a/mmv1/templates/terraform/constants/go/vmwareengine_private_cloud.go.tmpl b/mmv1/templates/terraform/constants/go/vmwareengine_private_cloud.go.tmpl deleted file mode 100644 index 5123f7eaf04e..000000000000 --- a/mmv1/templates/terraform/constants/go/vmwareengine_private_cloud.go.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -func vmwareenginePrivateCloudStandardTypeDiffSuppressFunc(_, old, new string, d *schema.ResourceData) bool { - if (old == "STANDARD" && new == "") || (old == "" && new == "STANDARD") { - return true - } - if (isMultiNodePrivateCloud(d) && old == "TIME_LIMITED" && new == "STANDARD") { - log.Printf("[DEBUG] Multinode Private Cloud found, facilitating TYPE change to STANDARD") - return true - } - return false -} - -func isMultiNodePrivateCloud(d *schema.ResourceData) bool { - nodeConfigMap := d.Get("management_cluster.0.node_type_configs").(*schema.Set).List() - totalNodeCount := 0 - for _, nodeConfig := range nodeConfigMap { - configMap, ok := nodeConfig.(map[string]interface{}) - if !ok { - log.Printf("[DEBUG] Invalid node configuration format for private cloud.") - continue - } - nodeCount, ok := configMap["node_count"].(int) - if !ok { - log.Printf("[DEBUG] Invalid node_count format for private cloud.") - continue - } - totalNodeCount += nodeCount - } - log.Printf("[DEBUG] The node count of the private cloud is found to be %v nodes.", totalNodeCount) - if totalNodeCount > 2 { - return true - } - return false -} - -func isPrivateCloudInDeletedState(config *transport_tpg.Config, d *schema.ResourceData, billingProject string, userAgent string) (bool, error) { - baseurl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.SelfLinkUri}}") - if err != nil { - return false, err - } - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: baseurl, - UserAgent: userAgent, - }) - if err != nil { - if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 { - log.Printf("[DEBUG] No existing private cloud found") - return false, nil - } - return false, err - } - // if resource exists but is marked for deletion - v, ok := res["state"] - if ok && v.(string) == "DELETED" { - log.Printf("[DEBUG] The Private cloud exists and is marked for deletion.") - return true, nil - } - return false, nil -} - -// Check if private cloud is absent or if it exists in a deleted state. -func pollCheckForPrivateCloudAbsence(resp map[string]interface{}, respErr error) transport_tpg.PollResult { - if respErr != nil { - if transport_tpg.IsGoogleApiErrorWithCode(respErr, 404) { - return transport_tpg.SuccessPollResult() - } - return transport_tpg.ErrorPollResult(respErr) - } - // if resource exists but is marked for deletion - log.Printf("[DEBUG] Fetching state of the private cloud.") - v, ok := resp["state"] - if ok && v.(string) == "DELETED" { - log.Printf("[DEBUG] The Private cloud has been successfully marked for delayed deletion.") - return transport_tpg.SuccessPollResult() - } - return transport_tpg.PendingStatusPollResult("found") -} diff --git a/mmv1/templates/terraform/constants/go/vpn_tunnel.tmpl b/mmv1/templates/terraform/constants/go/vpn_tunnel.tmpl deleted file mode 100644 index 1b25e0ae770d..000000000000 --- a/mmv1/templates/terraform/constants/go/vpn_tunnel.tmpl +++ /dev/null @@ -1,100 +0,0 @@ -// validatePeerAddr returns false if a tunnel's peer_ip property -// is invalid. Currently, only addresses that collide with RFC -// 5735 (https://tools.ietf.org/html/rfc5735) fail validation. -func validatePeerAddr(i interface{}, val string) ([]string, []error) { - ip := net.ParseIP(i.(string)) - if ip == nil { - return nil, []error{fmt.Errorf("could not parse %q to IP address", val)} - } - for _, test := range invalidPeerAddrs { - if bytes.Compare(ip, test.from) >= 0 && bytes.Compare(ip, test.to) <= 0 { - return nil, []error{fmt.Errorf("address is invalid (is between %q and %q, conflicting with RFC5735)", test.from, test.to)} - } - } - return nil, nil -} - -// invalidPeerAddrs is a collection of IP address ranges that represent -// a conflict with RFC 5735 (https://tools.ietf.org/html/rfc5735#page-3). -// CIDR range notations in the RFC were converted to a (from, to) pair -// for easy checking with bytes.Compare. -var invalidPeerAddrs = []struct { - from net.IP - to net.IP -}{ - { - from: net.ParseIP("0.0.0.0"), - to: net.ParseIP("0.255.255.255"), - }, - { - from: net.ParseIP("10.0.0.0"), - to: net.ParseIP("10.255.255.255"), - }, - { - from: net.ParseIP("127.0.0.0"), - to: net.ParseIP("127.255.255.255"), - }, - { - from: net.ParseIP("169.254.0.0"), - to: net.ParseIP("169.254.255.255"), - }, - { - from: net.ParseIP("172.16.0.0"), - to: net.ParseIP("172.31.255.255"), - }, - { - from: net.ParseIP("192.0.0.0"), - to: net.ParseIP("192.0.0.255"), - }, - { - from: net.ParseIP("192.0.2.0"), - to: net.ParseIP("192.0.2.255"), - }, - { - from: net.ParseIP("192.88.99.0"), - to: net.ParseIP("192.88.99.255"), - }, - { - from: net.ParseIP("192.168.0.0"), - to: net.ParseIP("192.168.255.255"), - }, - { - from: net.ParseIP("198.18.0.0"), - to: net.ParseIP("198.19.255.255"), - }, - { - from: net.ParseIP("198.51.100.0"), - to: net.ParseIP("198.51.100.255"), - }, - { - from: net.ParseIP("203.0.113.0"), - to: net.ParseIP("203.0.113.255"), - }, - { - from: net.ParseIP("224.0.0.0"), - to: net.ParseIP("239.255.255.255"), - }, - { - from: net.ParseIP("240.0.0.0"), - to: net.ParseIP("255.255.255.255"), - }, - { - from: net.ParseIP("255.255.255.255"), - to: net.ParseIP("255.255.255.255"), - }, -} - -func getVpnTunnelLink(config *transport_tpg.Config, project, region, tunnel, userAgent string) (string, error) { - if !strings.Contains(tunnel, "/") { - // Tunnel value provided is just the name, lookup the tunnel SelfLink - tunnelData, err := config.NewComputeClient(userAgent).VpnTunnels.Get( - project, region, tunnel).Do() - if err != nil { - return "", fmt.Errorf("Error reading tunnel: %s", err) - } - tunnel = tunnelData.SelfLink - } - - return tunnel, nil - -} diff --git a/mmv1/templates/terraform/constants/integration_connectors_connection.go.tmpl b/mmv1/templates/terraform/constants/integration_connectors_connection.go.tmpl index d0f610704185..d84dd8c0ab1b 100644 --- a/mmv1/templates/terraform/constants/integration_connectors_connection.go.tmpl +++ b/mmv1/templates/terraform/constants/integration_connectors_connection.go.tmpl @@ -1,4 +1,4 @@ -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} // waitforConnectionReady waits for an connecion to leave the // "CREATING" state, to indicate that it's ready. func waitforConnectionReady(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { @@ -17,4 +17,4 @@ func waitforConnectionReady(d *schema.ResourceData, config *transport_tpg.Config return nil }) } -<% end -%> +{{- end }} diff --git a/mmv1/templates/terraform/constants/interconnect_attachment.go.tmpl b/mmv1/templates/terraform/constants/interconnect_attachment.go.tmpl index cf52429784ce..e247612fbff7 100644 --- a/mmv1/templates/terraform/constants/interconnect_attachment.go.tmpl +++ b/mmv1/templates/terraform/constants/interconnect_attachment.go.tmpl @@ -1,4 +1,4 @@ -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} // waitForAttachmentToBeProvisioned waits for an attachment to leave the // "UNPROVISIONED" state, to indicate that it's either ready or awaiting partner // activity. @@ -17,4 +17,4 @@ func waitForAttachmentToBeProvisioned(d *schema.ResourceData, config *transport_ return nil }) } -<% end -%> +{{- end }} diff --git a/mmv1/templates/terraform/constants/monitoring_alert_policy.go.tmpl b/mmv1/templates/terraform/constants/monitoring_alert_policy.go.tmpl index 5aa9581d2903..e6bef3f23850 100644 --- a/mmv1/templates/terraform/constants/monitoring_alert_policy.go.tmpl +++ b/mmv1/templates/terraform/constants/monitoring_alert_policy.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} // API does not return a value for REDUCE_NONE func crossSeriesReducerDiffSuppress(k, old, new string, d *schema.ResourceData) bool { diff --git a/mmv1/templates/terraform/constants/netapp_volume_replication.go.tmpl b/mmv1/templates/terraform/constants/netapp_volume_replication.go.tmpl index 2b4d61481b1d..dcae7d2b141c 100644 --- a/mmv1/templates/terraform/constants/netapp_volume_replication.go.tmpl +++ b/mmv1/templates/terraform/constants/netapp_volume_replication.go.tmpl @@ -6,7 +6,7 @@ func NetappVolumeReplicationWaitForMirror(d *schema.ResourceData, meta interface return err } - url, err := tpgresource.ReplaceVars(d, config, "{{NetappBasePath}}projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/replications/{{name}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/volumes/{{"{{"}}volume_name{{"}}"}}/replications/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/constants/network_endpoints.go.tmpl b/mmv1/templates/terraform/constants/network_endpoints.go.tmpl index 3a66c7f4388e..2f0fc216b2cf 100644 --- a/mmv1/templates/terraform/constants/network_endpoints.go.tmpl +++ b/mmv1/templates/terraform/constants/network_endpoints.go.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} type NetworkEndpointsNetworkEndpoint struct { IPAddress string @@ -66,7 +64,7 @@ func networkEndpointsPaginatedRead(d *schema.ResourceData, config *transport_tpg func networkEndpointsPaginatedMutate(d *schema.ResourceData, endpoints []interface{}, config *transport_tpg.Config, userAgent, url, project, billingProject string, chunkSize int, returnLastPage bool) ([]interface{}, error) { // Pull out what this mutation is doing - either attachNetworkEndpoints or detachNetworkEndpoints verb := url[len(url)-len("attachNetworkEndpoints"):] - id, err := tpgresource.ReplaceVars(d, config, "{{project}}/{{zone}}/{{network_endpoint_group}}/endpoints") + id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}network_endpoint_group{{"}}"}}/endpoints") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/constants/network_services_gateway.go.tmpl b/mmv1/templates/terraform/constants/network_services_gateway.go.tmpl index 83af49eab04d..c5e1a0a8b4fa 100644 --- a/mmv1/templates/terraform/constants/network_services_gateway.go.tmpl +++ b/mmv1/templates/terraform/constants/network_services_gateway.go.tmpl @@ -1,23 +1,21 @@ -<%# The license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} // Checks if there is another gateway under the same location. func gatewaysSameLocation(d *schema.ResourceData, config *transport_tpg.Config, billingProject, userAgent string) ([]interface{}, error) { log.Print("[DEBUG] Looking for gateways under the same location.") var gateways []interface{} - gatewaysUrl, err := tpgresource.ReplaceVars(d, config, "{{NetworkServicesBasePath}}projects/{{project}}/locations/{{location}}/gateways") + gatewaysUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetworkServicesBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/gateways") if err != nil { return gateways, err } @@ -79,7 +77,7 @@ func isLastSWGGateway(gateways []interface{}, network string) bool { func deleteSWGAutoGenRouter(d *schema.ResourceData, config *transport_tpg.Config, billingProject, userAgent string) error { log.Printf("[DEBUG] Searching the network id by name %q.", d.Get("network")) - networkPath := fmt.Sprintf("{{ComputeBasePath}}%s", d.Get("network")) + networkPath := fmt.Sprintf("{{"{{"}}ComputeBasePath{{"}}"}}%s", d.Get("network")) networkUrl, err := tpgresource.ReplaceVars(d, config, networkPath) if err != nil { return err @@ -100,7 +98,7 @@ func deleteSWGAutoGenRouter(d *schema.ResourceData, config *transport_tpg.Config routerId := fmt.Sprintf("swg-autogen-router-%s", resp["id"]) log.Printf("[DEBUG] Deleting the auto generated router %q.", routerId) - routerPath := fmt.Sprintf("{{ComputeBasePath}}projects/{{project}}/regions/{{location}}/routers/%s", routerId) + routerPath := fmt.Sprintf("{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}location{{"}}"}}/routers/%s", routerId) routerUrl, err := tpgresource.ReplaceVars(d, config, routerPath) if err != nil { return err diff --git a/mmv1/templates/terraform/constants/notebooks_instance.go.tmpl b/mmv1/templates/terraform/constants/notebooks_instance.go.tmpl index 6181d1ce386e..17c73cc0954e 100644 --- a/mmv1/templates/terraform/constants/notebooks_instance.go.tmpl +++ b/mmv1/templates/terraform/constants/notebooks_instance.go.tmpl @@ -48,7 +48,7 @@ func NotebooksInstanceKmsDiffSuppress(_, old, new string, _ *schema.ResourceData return false } -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} // waitForNotebooksInstanceActive waits for an Notebook instance to become "ACTIVE" func waitForNotebooksInstanceActive(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { return retry.Retry(timeout, func() *retry.RetryError { @@ -67,10 +67,10 @@ func waitForNotebooksInstanceActive(d *schema.ResourceData, config *transport_tp }) } -<% end -%> +{{- end }} func modifyNotebooksInstanceState(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, "{{NotebooksBasePath}}projects/{{project}}/locations/{{location}}/instances/{{name}}:"+state) + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NotebooksBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/instances/{{"{{"}}name{{"}}"}}:"+state) if err != nil { return nil, err } @@ -88,7 +88,7 @@ func modifyNotebooksInstanceState(config *transport_tpg.Config, d *schema.Resour return res, nil } -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} func waitForNotebooksOperation(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string, response map[string]interface{}) error { var opRes map[string]interface{} err := NotebooksOperationWaitTimeWithResponse( @@ -99,4 +99,4 @@ func waitForNotebooksOperation(config *transport_tpg.Config, d *schema.ResourceD } return nil } -<% end -%> +{{- end }} diff --git a/mmv1/templates/terraform/constants/private_connection.go.tmpl b/mmv1/templates/terraform/constants/private_connection.go.tmpl index f6fa4fe80290..3d0da390dd8d 100644 --- a/mmv1/templates/terraform/constants/private_connection.go.tmpl +++ b/mmv1/templates/terraform/constants/private_connection.go.tmpl @@ -1,4 +1,4 @@ -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} func extractError(d *schema.ResourceData) error { // Casts are not safe since the logic that populate it is type deterministic. @@ -31,4 +31,4 @@ func waitForPrivateConnectionReady(d *schema.ResourceData, config *transport_tpg } }) } -<% end -%> +{{- end }} diff --git a/mmv1/templates/terraform/constants/region_backend_service.go.tmpl b/mmv1/templates/terraform/constants/region_backend_service.go.tmpl index 1094db54e7b5..85b43ba5f628 100644 --- a/mmv1/templates/terraform/constants/region_backend_service.go.tmpl +++ b/mmv1/templates/terraform/constants/region_backend_service.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // Fields in "backends" that are not allowed for non-managed backend services // (loadBalancingScheme) - the API returns an error if they are set at all // in the request. diff --git a/mmv1/templates/terraform/constants/region_ssl_policy.tmpl b/mmv1/templates/terraform/constants/region_ssl_policy.tmpl index 73aa50b7b10a..d333f71872ef 100644 --- a/mmv1/templates/terraform/constants/region_ssl_policy.tmpl +++ b/mmv1/templates/terraform/constants/region_ssl_policy.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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 regionSslPolicyCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { profile := diff.Get("profile") customFeaturesCount := diff.Get("custom_features.#") diff --git a/mmv1/templates/terraform/constants/resource_dns_resource_record_set.go.tmpl b/mmv1/templates/terraform/constants/resource_dns_resource_record_set.go.tmpl index 3fe62eb8782b..6b8fdffae7d3 100644 --- a/mmv1/templates/terraform/constants/resource_dns_resource_record_set.go.tmpl +++ b/mmv1/templates/terraform/constants/resource_dns_resource_record_set.go.tmpl @@ -25,7 +25,7 @@ func rrdatasDnsDiffSuppress(k, old, new string, d *schema.ResourceData) bool { // suppress on a list when 1) its items have dups that need to be ignored // and 2) string comparison on the items may need a special parse function -// example of usage can be found ../../../third_party/terraform/services/dns/resource_dns_record_set_test.go.erb +// example of usage can be found ../../../third_party/terraform/services/dns/resource_dns_record_set_test.go.tmpl func RrdatasListDiffSuppress(oldList, newList []string, fun func(x string) string, _ *schema.ResourceData) bool { // compare two lists of unordered records diff := make(map[string]bool, len(oldList)) diff --git a/mmv1/templates/terraform/constants/router.go.tmpl b/mmv1/templates/terraform/constants/router.go.tmpl index 2e59bde739fb..f4f93dfb5b2f 100644 --- a/mmv1/templates/terraform/constants/router.go.tmpl +++ b/mmv1/templates/terraform/constants/router.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // customizeDiff func for additional checks on google_compute_router properties: func resourceComputeRouterCustomDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { diff --git a/mmv1/templates/terraform/constants/router_nat.go.tmpl b/mmv1/templates/terraform/constants/router_nat.go.tmpl index 4c7997d556e9..f7550929c0ac 100644 --- a/mmv1/templates/terraform/constants/router_nat.go.tmpl +++ b/mmv1/templates/terraform/constants/router_nat.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2019 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. --%> +{{/* + 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 resourceNameSetFromSelfLinkSet(v interface{}) *schema.Set { if v == nil { return schema.NewSet(schema.HashString, nil) @@ -98,11 +96,11 @@ func computeRouterNatIPsHash(v interface{}) int { return schema.HashString(tpgresource.GetResourceNameFromSelfLink(val)) } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} func computeRouterNatRulesSubnetHash(v interface{}) int { return computeRouterNatIPsHash(v) } -<% end -%> +{{- end }} func computeRouterNatRulesHash(v interface{}) int { obj := v.(map[string]interface{}) @@ -118,10 +116,10 @@ func computeRouterNatRulesHash(v interface{}) int { sourceNatActiveIpHash := 0 sourceNatDrainIpHash := 0 - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} sourceNatActiveRangeHash := 0 sourceNatDrainRangeHash := 0 - <% end -%> + {{- end }} routerNatRulesHash := 0 if obj["action"] != nil { @@ -147,7 +145,7 @@ func computeRouterNatRulesHash(v interface{}) int { } } - <% unless version == 'ga' -%> + {{ if ne $.TargetVersionName `ga` -}} sourceNatActiveRanges := action["source_nat_active_ranges"] if sourceNatActiveRanges != nil { sourceNatActiveRangesSet := sourceNatActiveRanges.(*schema.Set) @@ -165,13 +163,13 @@ func computeRouterNatRulesHash(v interface{}) int { sourceNatDrainRangeHash += schema.HashString(sourceNatDrainRangeStr) } } - <% end -%> + {{- end }} } } routerNatRulesHash = ruleNumber + descriptionHash + schema.HashString(match) + sourceNatActiveIpHash + sourceNatDrainIpHash - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} routerNatRulesHash += sourceNatActiveRangeHash + sourceNatDrainRangeHash - <% end -%> + {{- end }} return routerNatRulesHash } \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/router_nat_validate_action_active_range.go.tmpl b/mmv1/templates/terraform/constants/router_nat_validate_action_active_range.go.tmpl index 0437b25d316f..b1dbba3c8a53 100644 --- a/mmv1/templates/terraform/constants/router_nat_validate_action_active_range.go.tmpl +++ b/mmv1/templates/terraform/constants/router_nat_validate_action_active_range.go.tmpl @@ -1,4 +1,4 @@ -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" -}} natType := d.Get("type").(string) if natType == "PRIVATE" { rules := d.Get("rules").(*schema.Set) @@ -25,4 +25,4 @@ if natType == "PRIVATE" { } } } -<% end -%> \ No newline at end of file +{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/constants/service_networking_vpc_service_controls.go.tmpl b/mmv1/templates/terraform/constants/service_networking_vpc_service_controls.go.tmpl index 9133cfdfe634..78776e58a471 100644 --- a/mmv1/templates/terraform/constants/service_networking_vpc_service_controls.go.tmpl +++ b/mmv1/templates/terraform/constants/service_networking_vpc_service_controls.go.tmpl @@ -19,7 +19,7 @@ func resourceServiceNetworkingVPCServiceControlsSet(d *schema.ResourceData, meta obj := make(map[string]interface{}) obj["consumerNetwork"] = fmt.Sprintf("projects/%s/global/networks/%s", projectNumber, network) - url, err := tpgresource.ReplaceVars(d, config, "{{ServiceNetworkingBasePath}}services/{{service}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ServiceNetworkingBasePath{{"}}"}}services/{{"{{"}}service{{"}}"}}") if err != nil { return err } @@ -54,7 +54,7 @@ func resourceServiceNetworkingVPCServiceControlsSet(d *schema.ResourceData, meta return fmt.Errorf("Error creating VPCServiceControls: %s", err) } - id, err := tpgresource.ReplaceVars(d, config, "services/{{service}}/projects/{{project}}/networks/{{network}}") + id, err := tpgresource.ReplaceVars(d, config, "services/{{"{{"}}service{{"}}"}}/projects/{{"{{"}}project{{"}}"}}/networks/{{"{{"}}network{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/constants/source_repo_repository.go.tmpl b/mmv1/templates/terraform/constants/source_repo_repository.go.tmpl index 72757e3fe4ec..f4dfd14cf77a 100644 --- a/mmv1/templates/terraform/constants/source_repo_repository.go.tmpl +++ b/mmv1/templates/terraform/constants/source_repo_repository.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2019 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. --%> +{{/* + 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 resourceSourceRepoRepositoryPubSubConfigsHash(v interface{}) int { if v == nil { return 0 diff --git a/mmv1/templates/terraform/constants/spanner_database.go.tmpl b/mmv1/templates/terraform/constants/spanner_database.go.tmpl index 926488ac8c68..9370e272df37 100644 --- a/mmv1/templates/terraform/constants/spanner_database.go.tmpl +++ b/mmv1/templates/terraform/constants/spanner_database.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // customizeDiff func for additional checks on google_spanner_database properties: func resourceSpannerDBDdlCustomDiffFunc(diff tpgresource.TerraformResourceDiff) error { old, new := diff.GetChange("ddl") diff --git a/mmv1/templates/terraform/constants/spanner_instance.go.tmpl b/mmv1/templates/terraform/constants/spanner_instance.go.tmpl index dcf579986938..522a02da844a 100644 --- a/mmv1/templates/terraform/constants/spanner_instance.go.tmpl +++ b/mmv1/templates/terraform/constants/spanner_instance.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file - # Copyright 2021 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. --%> +{{/* + 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 deleteSpannerBackups(d *schema.ResourceData, config *transport_tpg.Config, res map[string]interface{}, userAgent string, billingProject string) error { var v interface{} var ok bool @@ -32,7 +30,7 @@ func deleteSpannerBackups(d *schema.ResourceData, config *transport_tpg.Config, log.Printf("[DEBUG] Found backups for resource %q: %#v)", d.Id(), item) - path := "{{SpannerBasePath}}" + backupName + path := "{{"{{"}}SpannerBasePath{{"}}"}}" + backupName url, err := tpgresource.ReplaceVars(d, config, path) if err != nil { diff --git a/mmv1/templates/terraform/constants/spanner_instance_config.go.tmpl b/mmv1/templates/terraform/constants/spanner_instance_config.go.tmpl index 553c0c23bd7c..988ffdbae97c 100644 --- a/mmv1/templates/terraform/constants/spanner_instance_config.go.tmpl +++ b/mmv1/templates/terraform/constants/spanner_instance_config.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file - # Copyright 2021 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. --%> +{{/* + 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 replicasHash(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) @@ -28,7 +26,7 @@ func replicasHash(v interface{}) int { } func getBaseInstanceConfigReplicas(d *schema.ResourceData, config *transport_tpg.Config, baseConfigProp interface{}, billingProject, userAgent string) ([]interface{}, error) { - url, err := tpgresource.ReplaceVars(d, config, "{{SpannerBasePath}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SpannerBasePath{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/constants/ssl_policy.tmpl b/mmv1/templates/terraform/constants/ssl_policy.tmpl index 27e32b4adc5b..40544d2cf32d 100644 --- a/mmv1/templates/terraform/constants/ssl_policy.tmpl +++ b/mmv1/templates/terraform/constants/ssl_policy.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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 sslPolicyCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { profile := diff.Get("profile") customFeaturesCount := diff.Get("custom_features.#") diff --git a/mmv1/templates/terraform/constants/subscription.go.tmpl b/mmv1/templates/terraform/constants/subscription.go.tmpl index 4b40b1748bd7..336517ee07a7 100644 --- a/mmv1/templates/terraform/constants/subscription.go.tmpl +++ b/mmv1/templates/terraform/constants/subscription.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2019 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. --%> +{{/* + 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 comparePubsubSubscriptionExpirationPolicy(_, old, new string, _ *schema.ResourceData) bool { trimmedNew := strings.TrimLeft(new, "0") diff --git a/mmv1/templates/terraform/constants/tagtemplate_fields.go.tmpl b/mmv1/templates/terraform/constants/tagtemplate_fields.go.tmpl index 65db38addb04..3fb2624ef7eb 100644 --- a/mmv1/templates/terraform/constants/tagtemplate_fields.go.tmpl +++ b/mmv1/templates/terraform/constants/tagtemplate_fields.go.tmpl @@ -1,22 +1,20 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} //Use it to delete TagTemplate Field func deleteTagTemplateField(d *schema.ResourceData, config *transport_tpg.Config, name, billingProject, userAgent string) (error) { - url_delete, err := tpgresource.ReplaceVars(d, config, "{{DataCatalogBasePath}}{{name}}/fields/"+name+"?force={{force_delete}}") + url_delete, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DataCatalogBasePath{{"}}"}}{{"{{"}}name{{"}}"}}/fields/"+name+"?force={{"{{"}}force_delete{{"}}"}}") if err != nil { return err } @@ -41,7 +39,7 @@ func deleteTagTemplateField(d *schema.ResourceData, config *transport_tpg.Config //Use it to create TagTemplate Field func createTagTemplateField(d *schema.ResourceData, config *transport_tpg.Config, body map[string]interface{}, name, billingProject, userAgent string) (error) { - url_create, err := tpgresource.ReplaceVars(d, config, "{{DataCatalogBasePath}}{{name}}/fields") + url_create, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DataCatalogBasePath{{"}}"}}{{"{{"}}name{{"}}"}}/fields") if err != nil { return err } diff --git a/mmv1/templates/terraform/constants/vmwareengine_private_cloud.go.tmpl b/mmv1/templates/terraform/constants/vmwareengine_private_cloud.go.tmpl index 16a34e0b742b..5123f7eaf04e 100644 --- a/mmv1/templates/terraform/constants/vmwareengine_private_cloud.go.tmpl +++ b/mmv1/templates/terraform/constants/vmwareengine_private_cloud.go.tmpl @@ -33,7 +33,7 @@ func isMultiNodePrivateCloud(d *schema.ResourceData) bool { } func isPrivateCloudInDeletedState(config *transport_tpg.Config, d *schema.ResourceData, billingProject string, userAgent string) (bool, error) { - baseurl, err := tpgresource.ReplaceVars(d, config, "{{<%=object.__product.name-%>BasePath}}<%=object.self_link_uri-%>") + baseurl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.SelfLinkUri}}") if err != nil { return false, err } diff --git a/mmv1/templates/terraform/constants/go/vmwareengine_private_cloud_type.go.tmpl b/mmv1/templates/terraform/constants/vmwareengine_private_cloud_type.go.tmpl similarity index 100% rename from mmv1/templates/terraform/constants/go/vmwareengine_private_cloud_type.go.tmpl rename to mmv1/templates/terraform/constants/vmwareengine_private_cloud_type.go.tmpl diff --git a/mmv1/templates/terraform/constants/go/workbench_instance.go.tmpl b/mmv1/templates/terraform/constants/workbench_instance.go.tmpl similarity index 100% rename from mmv1/templates/terraform/constants/go/workbench_instance.go.tmpl rename to mmv1/templates/terraform/constants/workbench_instance.go.tmpl diff --git a/mmv1/templates/terraform/custom_check_destroy/apigee_addons_override.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/apigee_addons_override.go.tmpl index 715193bffcca..52d22054bb7e 100644 --- a/mmv1/templates/terraform/custom_check_destroy/apigee_addons_override.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/apigee_addons_override.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ApigeeBasePath}}organizations/{{org}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ApigeeBasePath{{"}}"}}organizations/{{"{{"}}org{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/bigquery_bi_reservation.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/bigquery_bi_reservation.go.tmpl index 3f76ff14b0b1..6449ec3f91a1 100644 --- a/mmv1/templates/terraform/custom_check_destroy/bigquery_bi_reservation.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/bigquery_bi_reservation.go.tmpl @@ -3,7 +3,7 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{BigqueryReservationBasePath}}projects/{{project}}/locations/{{location}}/biReservation") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}BigqueryReservationBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/biReservation") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/billing_project_info.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/billing_project_info.go.tmpl index 6f2f074d3c63..ebd8a74ea63d 100644 --- a/mmv1/templates/terraform/custom_check_destroy/billing_project_info.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/billing_project_info.go.tmpl @@ -5,7 +5,7 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{CoreBillingBasePath}}projects/{{project}}/billingInfo") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}CoreBillingBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/billingInfo") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/consumer_quota_override.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/consumer_quota_override.go.tmpl index 9968e9246b22..fdfb09e126a4 100644 --- a/mmv1/templates/terraform/custom_check_destroy/consumer_quota_override.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/consumer_quota_override.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ServiceUsageBasePath}}projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ServiceUsageBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/services/{{"{{"}}service{{"}}"}}/consumerQuotaMetrics/{{"{{"}}metric{{"}}"}}/limits/{{"{{"}}limit{{"}}"}}/consumerOverrides/") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/go/firebase_app_check_service_config.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/firebase_app_check_service_config.go.tmpl similarity index 100% rename from mmv1/templates/terraform/custom_check_destroy/go/firebase_app_check_service_config.go.tmpl rename to mmv1/templates/terraform/custom_check_destroy/firebase_app_check_service_config.go.tmpl diff --git a/mmv1/templates/terraform/custom_check_destroy/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/firebase_database_instance.go.tmpl index 3aa3f321423d..a8f8b99502b7 100644 --- a/mmv1/templates/terraform/custom_check_destroy/firebase_database_instance.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/firebase_database_instance.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{FirebaseDatabaseBasePath}}projects/{{project}}/locations/{{region}}/instances/{{instance_id}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}FirebaseDatabaseBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/instances/{{"{{"}}instance_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/firebasehosting_custom_domain_soft_delete.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/firebasehosting_custom_domain_soft_delete.go.tmpl index 146c3b1335c1..e6d1df322f6a 100644 --- a/mmv1/templates/terraform/custom_check_destroy/firebasehosting_custom_domain_soft_delete.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/firebasehosting_custom_domain_soft_delete.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{FirebaseHostingBasePath}}projects/{{project}}/sites/{{site_id}}/customDomains/{{custom_domain}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}FirebaseHostingBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/sites/{{"{{"}}site_id{{"}}"}}/customDomains/{{"{{"}}custom_domain{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.tmpl index 7b5fe9d1fffc..e42823418c84 100644 --- a/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.tmpl @@ -4,7 +4,7 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{FirestoreBasePath}}projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/fields/{{field}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}FirestoreBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/databases/{{"{{"}}database{{"}}"}}/collectionGroups/{{"{{"}}collection{{"}}"}}/fields/{{"{{"}}field{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/go/apigee_addons_override.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/apigee_addons_override.go.tmpl deleted file mode 100644 index 52d22054bb7e..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/apigee_addons_override.go.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ApigeeBasePath{{"}}"}}organizations/{{"{{"}}org{{"}}"}}") -if err != nil { - return err -} - -billingProject := "" - -if config.BillingProject != "" { - billingProject = config.BillingProject -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, -}) - -if err != nil { - // If the Apigee org doesn't exist, then a 403 can also be returned. - if transport_tpg.IsGoogleApiErrorWithCode(err, 403) || transport_tpg.IsGoogleApiErrorWithCode(err, 404) { - return nil - } else { - return err - } -} - -v, ok := res["addonsConfig"] - -if ok || v != nil { - return fmt.Errorf("ApigeeAddonConfig still exists at %s", url) -} diff --git a/mmv1/templates/terraform/custom_check_destroy/go/appengine.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/appengine.go.tmpl deleted file mode 100644 index 07e0d309886f..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/appengine.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -log.Printf("[DEBUG] Ignoring destroy during test") diff --git a/mmv1/templates/terraform/custom_check_destroy/go/bigquery_bi_reservation.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/bigquery_bi_reservation.go.tmpl deleted file mode 100644 index 6449ec3f91a1..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/bigquery_bi_reservation.go.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -// BI reservation is a singleton resource and can't be deleted. -// We will check if the reservation info has been cleared - -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}BigqueryReservationBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/biReservation") -if err != nil { - return err -} - -billingProject := "" - -if config.BillingProject != "" { - billingProject = config.BillingProject -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return nil -} - -if _, ok := res["size"]; ok { - return fmt.Errorf("BIReservation was not cleared") -} -if _, ok := res["preferredTables"]; ok { - return fmt.Errorf("BIReservation was not cleared") -} - -return nil diff --git a/mmv1/templates/terraform/custom_check_destroy/go/billing_project_info.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/billing_project_info.go.tmpl deleted file mode 100644 index ebd8a74ea63d..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/billing_project_info.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -// After deleting a project, you can still query its billing account -// (it will be empty). We change the destroy check to ensure the -// project has no billing account linked after destroying the -// google_billing_project_info resource - -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}CoreBillingBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/billingInfo") -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return nil -} - -if ba := res["billingAccountName"]; ba == "" { - return nil -} - -return fmt.Errorf("Billing account still linked at %s", url) diff --git a/mmv1/templates/terraform/custom_check_destroy/go/consumer_quota_override.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/consumer_quota_override.go.tmpl deleted file mode 100644 index fdfb09e126a4..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/consumer_quota_override.go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ServiceUsageBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/services/{{"{{"}}service{{"}}"}}/consumerQuotaMetrics/{{"{{"}}metric{{"}}"}}/limits/{{"{{"}}limit{{"}}"}}/consumerOverrides/") -if err != nil { - return err -} - -billingProject := "" - -if config.BillingProject != "" { - billingProject = config.BillingProject -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, -}) -if err == nil { - // Sometimes the API returns an empty response instead of erroring, treat empty as nonexistent - if len(res) != 0 { - return fmt.Errorf("ServiceUsageConsumerQuotaOverride still exists at %s", url) - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_check_destroy/go/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/firebase_database_instance.go.tmpl deleted file mode 100644 index a8f8b99502b7..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/firebase_database_instance.go.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}FirebaseDatabaseBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/instances/{{"{{"}}instance_id{{"}}"}}") -if err != nil { - return err -} - -billingProject := "" - -if config.BillingProject != "" { - billingProject = config.BillingProject -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return err // RTDB only supports soft-delete. -} - -dbState := res["state"] -if dbState == "DELETED" { - return nil // USER_DATABASE soft deleted. -} -dbType := res["type"] -if dbState == "DISABLED" && dbType == "DEFAULT_DATABASE" { - return nil // DEFAULT_DATABASE is left in a DISABLED state because it cannot be deleted. -} - -return fmt.Errorf("firebase_database_instance %s got state=%s, want DELETED", url, s) diff --git a/mmv1/templates/terraform/custom_check_destroy/go/firebasehosting_custom_domain_soft_delete.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/firebasehosting_custom_domain_soft_delete.go.tmpl deleted file mode 100644 index e6d1df322f6a..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/firebasehosting_custom_domain_soft_delete.go.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}FirebaseHostingBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/sites/{{"{{"}}site_id{{"}}"}}/customDomains/{{"{{"}}custom_domain{{"}}"}}") -if err != nil { - return err -} - -billingProject := "" - -if config.BillingProject != "" { - billingProject = config.BillingProject -} - -resp, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, -}) -if err == nil && resp["deleteTime"].(string) == "" { - return fmt.Errorf("FirebaseHostingCustomDomain still exists at %s", url) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_check_destroy/go/firestore_field.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/firestore_field.go.tmpl deleted file mode 100644 index e42823418c84..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/firestore_field.go.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -// Firestore fields are not deletable. We consider the field deleted if: -// 1) the index configuration has no overrides and matches the ancestor configuration. -// 2) the ttl configuration is unset. - -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}FirestoreBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/databases/{{"{{"}}database{{"}}"}}/collectionGroups/{{"{{"}}collection{{"}}"}}/fields/{{"{{"}}field{{"}}"}}") -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - e := err.(*googleapi.Error) - if e.Code == 403 && strings.Contains(e.Message, "Cloud Firestore API has not been used in project") { - // The acceptance test has provisioned the resources under test in a new project, and the destory check is seeing the - // effects of the project not existing. This means the service isn't enabled, and that the resource is definitely destroyed. - // We do not return the error in this case - destroy was successful - return nil - } - - // Return err in all other cases - return err -} - -if v := res["indexConfig"]; v != nil { - indexConfig := v.(map[string]interface{}) - - usesAncestorConfig, ok := indexConfig["usesAncestorConfig"].(bool) - - if !ok || !usesAncestorConfig { - return fmt.Errorf("Index configuration is not using the ancestor config %s.", url) - } -} - -if res["ttlConfig"] != nil { - return fmt.Errorf("TTL configuration was not deleted at %s.", url) -} diff --git a/mmv1/templates/terraform/custom_check_destroy/go/iam_workforce_pool.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/iam_workforce_pool.go.tmpl deleted file mode 100644 index e96ee2427b1e..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/iam_workforce_pool.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}IAMWorkforcePoolBasePath{{"}}"}}locations/{{"{{"}}location{{"}}"}}/workforcePools/{{"{{"}}workforce_pool_id{{"}}"}}") -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return nil -} - -if v := res["state"]; v == "DELETED" { - return nil -} - -return fmt.Errorf("IAMWorkforcePool still exists at %s", url) diff --git a/mmv1/templates/terraform/custom_check_destroy/go/iam_workload_identity_pool.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/iam_workload_identity_pool.go.tmpl deleted file mode 100644 index 66f7217401f9..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/iam_workload_identity_pool.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}IAMBetaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/workloadIdentityPools/{{"{{"}}workload_identity_pool_id{{"}}"}}") -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return nil -} - -if v := res["state"]; v == "DELETED" { - return nil -} - -return fmt.Errorf("IAMBetaWorkloadIdentityPool still exists at %s", url) diff --git a/mmv1/templates/terraform/custom_check_destroy/go/iam_workload_identity_pool_provider.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/iam_workload_identity_pool_provider.go.tmpl deleted file mode 100644 index 9ddbfa3c899a..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/iam_workload_identity_pool_provider.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}IAMBetaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/workloadIdentityPools/{{"{{"}}workload_identity_pool_id{{"}}"}}/providers/{{"{{"}}workload_identity_pool_provider_id{{"}}"}}") -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return nil -} - -if v := res["state"]; v == "DELETED" { - return nil -} - -return fmt.Errorf("IAMBetaWorkloadIdentityPoolProvider still exists at %s", url) diff --git a/mmv1/templates/terraform/custom_check_destroy/go/kms_autokey_config.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/kms_autokey_config.go.tmpl deleted file mode 100644 index 8e801cb0449f..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/kms_autokey_config.go.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}KMSBasePath{{"}}"}}folders/{{"{{"}}folder{{"}}"}}/autokeyConfig") -url = strings.Replace(url, "folders/folders/", "folders/", 1) -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return nil -} - -if v := res["key_project"]; v != nil { - return fmt.Errorf("AutokeyConfig still exists at %s", url) -} - -return nil diff --git a/mmv1/templates/terraform/custom_check_destroy/go/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/monitoring_monitored_project.go.tmpl deleted file mode 100644 index 0c2f700ab11e..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/monitoring_monitored_project.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 := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}MonitoringBasePath{{"}}"}}v1/locations/global/metricsScopes/{{"{{"}}metrics_scope{{"}}"}}") -if err != nil { - return err -} - -billingProject := "" - -if config.BillingProject != "" { - billingProject = config.BillingProject -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, -}) - -rName := tpgresource.GetResourceNameFromSelfLink(rs.Primary.Attributes["name"]) -project, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(rName).Do() -rName = strconv.FormatInt(project.ProjectNumber, 10) - -for _, monitoredProject := range res["monitoredProjects"].([]any) { - if strings.HasSuffix(monitoredProject.(map[string]any)["name"].(string), rName) { - return fmt.Errorf("MonitoringMonitoredProject still exists at %s", url) - } -} diff --git a/mmv1/templates/terraform/custom_check_destroy/go/privateca_certificate.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/privateca_certificate.go.tmpl deleted file mode 100644 index 2f5143f8c828..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/privateca_certificate.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}PrivatecaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/caPools/{{"{{"}}pool{{"}}"}}/certificates/{{"{{"}}name{{"}}"}}") - -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return err -} - - -if _, ok := res["revocationDetails"]; !ok { - return fmt.Errorf("CertificateAuthority.Certificate Revocation expected %s got %s, want revocationDetails.revocationTime", url, s) -} - -return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_check_destroy/go/privateca_certificate_authority.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/privateca_certificate_authority.go.tmpl deleted file mode 100644 index be08015674ba..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/privateca_certificate_authority.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}PrivatecaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/caPools/{{"{{"}}pool{{"}}"}}/certificateAuthorities/{{"{{"}}certificate_authority_id{{"}}"}}") -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return nil -} - -if s := res["state"]; s != "DELETED" { - return fmt.Errorf("CertificateAuthority %s got %s, want DELETED", url, s) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_check_destroy/go/skip_delete_during_test.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/skip_delete_during_test.go.tmpl deleted file mode 100644 index 07e0d309886f..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/skip_delete_during_test.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -log.Printf("[DEBUG] Ignoring destroy during test") diff --git a/mmv1/templates/terraform/custom_check_destroy/go/storage_hmac_key.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/go/storage_hmac_key.go.tmpl deleted file mode 100644 index f4e09436a9b6..000000000000 --- a/mmv1/templates/terraform/custom_check_destroy/go/storage_hmac_key.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -config := acctest.GoogleProviderConfig(t) - -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}StorageBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/hmacKeys/{{"{{"}}access_id{{"}}"}}") -if err != nil { - return err -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: config.UserAgent, -}) -if err != nil { - return nil -} - -if v := res["state"]; v == "DELETED" { - return nil -} - -return fmt.Errorf("StorageHmacKey still exists at %s", url) diff --git a/mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.tmpl index 78e81e0d4652..e96ee2427b1e 100644 --- a/mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IAMWorkforcePoolBasePath}}locations/{{location}}/workforcePools/{{workforce_pool_id}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}IAMWorkforcePoolBasePath{{"}}"}}locations/{{"{{"}}location{{"}}"}}/workforcePools/{{"{{"}}workforce_pool_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool.go.tmpl index 7b676eacfe20..66f7217401f9 100644 --- a/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IAMBetaBasePath}}projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}IAMBetaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/workloadIdentityPools/{{"{{"}}workload_identity_pool_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool_provider.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool_provider.go.tmpl index 3b99f3954e5a..9ddbfa3c899a 100644 --- a/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool_provider.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/iam_workload_identity_pool_provider.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{IAMBetaBasePath}}projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}/providers/{{workload_identity_pool_provider_id}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}IAMBetaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/workloadIdentityPools/{{"{{"}}workload_identity_pool_id{{"}}"}}/providers/{{"{{"}}workload_identity_pool_provider_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/kms_autokey_config.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/kms_autokey_config.go.tmpl index 9add7b5818c5..8e801cb0449f 100644 --- a/mmv1/templates/terraform/custom_check_destroy/kms_autokey_config.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/kms_autokey_config.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{KMSBasePath}}folders/{{folder}}/autokeyConfig") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}KMSBasePath{{"}}"}}folders/{{"{{"}}folder{{"}}"}}/autokeyConfig") url = strings.Replace(url, "folders/folders/", "folders/", 1) if err != nil { return err diff --git a/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.tmpl index 1e0f3f0937f1..0c2f700ab11e 100644 --- a/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/monitoring_monitored_project.go.tmpl @@ -1,20 +1,18 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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 := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{MonitoringBasePath}}v1/locations/global/metricsScopes/{{metrics_scope}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}MonitoringBasePath{{"}}"}}v1/locations/global/metricsScopes/{{"{{"}}metrics_scope{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/privateca_certificate.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/privateca_certificate.go.tmpl index 0cf655724fa7..2f5143f8c828 100644 --- a/mmv1/templates/terraform/custom_check_destroy/privateca_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/privateca_certificate.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{PrivatecaBasePath}}projects/{{project}}/locations/{{location}}/caPools/{{pool}}/certificates/{{name}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}PrivatecaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/caPools/{{"{{"}}pool{{"}}"}}/certificates/{{"{{"}}name{{"}}"}}") if err != nil { return err diff --git a/mmv1/templates/terraform/custom_check_destroy/privateca_certificate_authority.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/privateca_certificate_authority.go.tmpl index 697663141610..be08015674ba 100644 --- a/mmv1/templates/terraform/custom_check_destroy/privateca_certificate_authority.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/privateca_certificate_authority.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{PrivatecaBasePath}}projects/{{project}}/locations/{{location}}/caPools/{{pool}}/certificateAuthorities/{{certificate_authority_id}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}PrivatecaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/caPools/{{"{{"}}pool{{"}}"}}/certificateAuthorities/{{"{{"}}certificate_authority_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_check_destroy/storage_hmac_key.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/storage_hmac_key.go.tmpl index 9205dbd909c1..f4e09436a9b6 100644 --- a/mmv1/templates/terraform/custom_check_destroy/storage_hmac_key.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/storage_hmac_key.go.tmpl @@ -1,6 +1,6 @@ config := acctest.GoogleProviderConfig(t) -url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{StorageBasePath}}projects/{{project}}/hmacKeys/{{access_id}}") +url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}StorageBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/hmacKeys/{{"{{"}}access_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_create/go/apigee_environment_keyvaluemaps.go.tmpl b/mmv1/templates/terraform/custom_create/apigee_environment_keyvaluemaps.go.tmpl similarity index 100% rename from mmv1/templates/terraform/custom_create/go/apigee_environment_keyvaluemaps.go.tmpl rename to mmv1/templates/terraform/custom_create/apigee_environment_keyvaluemaps.go.tmpl diff --git a/mmv1/templates/terraform/custom_create/go/identity_platform_config.go.tmpl b/mmv1/templates/terraform/custom_create/go/identity_platform_config.go.tmpl deleted file mode 100644 index 0479fcd874df..000000000000 --- a/mmv1/templates/terraform/custom_create/go/identity_platform_config.go.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) -if err != nil { - return err -} - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}IdentityPlatformBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/identityPlatform:initializeAuth") -if err != nil { - return err -} - -billingProject := "" - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return fmt.Errorf("Error fetching project for Config: %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 -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Timeout: d.Timeout(schema.TimeoutCreate), -}) -if err != nil { - return fmt.Errorf("Error creating Config: %s", err) -} -if err := d.Set("name", flattenIdentityPlatformConfigName(res["name"], d, config)); err != nil { - return fmt.Errorf(`Error setting computed identity field "name": %s`, err) -} - -// Store the ID now -id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/config") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -// Update the resource after initializing auth to set fields. -if err := resourceIdentityPlatformConfigUpdate(d, meta); err != nil { - return err -} - -log.Printf("[DEBUG] Finished creating Config %q: %#v", d.Id(), res) - -return resourceIdentityPlatformConfigRead(d, meta) diff --git a/mmv1/templates/terraform/custom_create/go/service_networking_vpc_service_controls.go.tmpl b/mmv1/templates/terraform/custom_create/go/service_networking_vpc_service_controls.go.tmpl deleted file mode 100644 index 6779a2b7246c..000000000000 --- a/mmv1/templates/terraform/custom_create/go/service_networking_vpc_service_controls.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -return resourceServiceNetworkingVPCServiceControlsSet(d, meta, config) diff --git a/mmv1/templates/terraform/custom_create/identity_platform_config.go.tmpl b/mmv1/templates/terraform/custom_create/identity_platform_config.go.tmpl index aa385658ba9f..0479fcd874df 100644 --- a/mmv1/templates/terraform/custom_create/identity_platform_config.go.tmpl +++ b/mmv1/templates/terraform/custom_create/identity_platform_config.go.tmpl @@ -3,7 +3,7 @@ if err != nil { return err } -url, err := tpgresource.ReplaceVars(d, config, "{{IdentityPlatformBasePath}}projects/{{project}}/identityPlatform:initializeAuth") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}IdentityPlatformBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/identityPlatform:initializeAuth") if err != nil { return err } @@ -37,7 +37,7 @@ if err := d.Set("name", flattenIdentityPlatformConfigName(res["name"], d, config } // Store the ID now -id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/config") +id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/config") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_delete/active_directory_domain_trust.go.tmpl b/mmv1/templates/terraform/custom_delete/active_directory_domain_trust.go.tmpl index a2dea22e890e..2b9dfd7bbce6 100644 --- a/mmv1/templates/terraform/custom_delete/active_directory_domain_trust.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/active_directory_domain_trust.go.tmpl @@ -3,12 +3,12 @@ return err } - url, err := tpgresource.ReplaceVars(d, config, "{{ActiveDirectoryBasePath}}projects/{{project}}/locations/global/domains/{{domain}}:detachTrust") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ActiveDirectoryBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/domains/{{"{{"}}domain{{"}}"}}:detachTrust") if err != nil { return err } - <%# The generate DELETE method isn't including the {trust: } object in the response body thus custom_delete is needed -%> + {{/* The generate DELETE method isn't including the {trust: } object in the response body thus custom_delete is needed */ -}} obj := make(map[string]interface{}) targetDomainNameProp, err := expandNestedActiveDirectoryDomainTrustTargetDomainName(d.Get("target_domain_name"), d, config) diff --git a/mmv1/templates/terraform/custom_delete/appversion_delete.go.tmpl b/mmv1/templates/terraform/custom_delete/appversion_delete.go.tmpl index e3a18c439ad8..89abcbfbacab 100644 --- a/mmv1/templates/terraform/custom_delete/appversion_delete.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/appversion_delete.go.tmpl @@ -9,7 +9,7 @@ if err != nil { return err } -lockName, err := tpgresource.ReplaceVars(d, config, "apps/{{project}}/services/{{service}}") +lockName, err := tpgresource.ReplaceVars(d, config, "apps/{{"{{"}}project{{"}}"}}/services/{{"{{"}}service{{"}}"}}") if err != nil { return err } @@ -17,7 +17,7 @@ transport_tpg.MutexStore.Lock(lockName) defer transport_tpg.MutexStore.Unlock(lockName) if d.Get("delete_service_on_destroy") == true { - url, err := tpgresource.ReplaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/services/{{service}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AppEngineBasePath{{"}}"}}apps/{{"{{"}}project{{"}}"}}/services/{{"{{"}}service{{"}}"}}") if err != nil { return err } @@ -31,12 +31,12 @@ if d.Get("delete_service_on_destroy") == true { UserAgent: userAgent, Body: obj, Timeout: d.Timeout(schema.TimeoutDelete), -<% if object.error_retry_predicates -%> - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_retry_predicates.join(',') -%>}, -<% end -%> -<% if object.error_abort_predicates -%> - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_abort_predicates.join(',') -%>}, -<% end -%> +{{- if $.ErrorRetryPredicates }} + ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorRetryPredicates "," -}} }, +{{- end }} +{{- if $.ErrorAbortPredicates }} + ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorAbortPredicates "," -}} }, +{{- end }} }) if err != nil { return transport_tpg.HandleNotFoundError(err, d, "Service") @@ -51,7 +51,7 @@ if d.Get("delete_service_on_destroy") == true { log.Printf("[DEBUG] Finished deleting Service %q: %#v", d.Id(), res) return nil } else { - url, err := tpgresource.ReplaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/services/{{service}}/versions/{{version_id}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AppEngineBasePath{{"}}"}}apps/{{"{{"}}project{{"}}"}}/services/{{"{{"}}service{{"}}"}}/versions/{{"{{"}}version_id{{"}}"}}") if err != nil { return err } @@ -65,12 +65,12 @@ if d.Get("delete_service_on_destroy") == true { UserAgent: userAgent, Body: obj, Timeout: d.Timeout(schema.TimeoutDelete), -<% if object.error_retry_predicates -%> - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_retry_predicates.join(',') -%>}, -<% end -%> -<% if object.error_abort_predicates -%> - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_abort_predicates.join(',') -%>}, -<% end -%> +{{- if $.ErrorRetryPredicates }} + ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorRetryPredicates "," -}} }, +{{- end }} +{{- if $.ErrorAbortPredicates }} + ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorAbortPredicates "," -}} }, +{{- end }} }) if err != nil { return transport_tpg.HandleNotFoundError(err, d, "AppVersion") diff --git a/mmv1/templates/terraform/custom_delete/clear_bigquery_bi_reservation.go.tmpl b/mmv1/templates/terraform/custom_delete/clear_bigquery_bi_reservation.go.tmpl index 2a4301990857..35b277bf03a4 100644 --- a/mmv1/templates/terraform/custom_delete/clear_bigquery_bi_reservation.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/clear_bigquery_bi_reservation.go.tmpl @@ -2,7 +2,7 @@ obj := make(map[string]interface{}) obj["preferredTables"] = []string{} obj["size"] = 0 -url, err := tpgresource.ReplaceVars(d, config, "{{BigqueryReservationBasePath}}projects/{{project}}/locations/{{location}}/biReservation") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}BigqueryReservationBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/biReservation") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/clear_folder_access_approval_settings.go.tmpl b/mmv1/templates/terraform/custom_delete/clear_folder_access_approval_settings.go.tmpl index a103e2a16340..5da573c92fcb 100644 --- a/mmv1/templates/terraform/custom_delete/clear_folder_access_approval_settings.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/clear_folder_access_approval_settings.go.tmpl @@ -3,7 +3,7 @@ obj["notificationEmails"] = []string{} obj["enrolledServices"] = []string{} obj["activeKeyVersion"] = "" -url, err := tpgresource.ReplaceVars(d, config, "{{AccessApprovalBasePath}}folders/{{folder_id}}/accessApprovalSettings") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessApprovalBasePath{{"}}"}}folders/{{"{{"}}folder_id{{"}}"}}/accessApprovalSettings") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/clear_instance_settings.go.tmpl b/mmv1/templates/terraform/custom_delete/clear_instance_settings.go.tmpl index 9c37ae53ac04..05ae8e236abe 100644 --- a/mmv1/templates/terraform/custom_delete/clear_instance_settings.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/clear_instance_settings.go.tmpl @@ -1,4 +1,4 @@ -url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/instanceSettings") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceSettings") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/clear_organization_access_approval_settings.go.tmpl b/mmv1/templates/terraform/custom_delete/clear_organization_access_approval_settings.go.tmpl index f2ff271d4ac2..6586e7f50fea 100644 --- a/mmv1/templates/terraform/custom_delete/clear_organization_access_approval_settings.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/clear_organization_access_approval_settings.go.tmpl @@ -3,7 +3,7 @@ obj["notificationEmails"] = []string{} obj["enrolledServices"] = []string{} obj["activeKeyVersion"] = "" -url, err := tpgresource.ReplaceVars(d, config, "{{AccessApprovalBasePath}}organizations/{{organization_id}}/accessApprovalSettings") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessApprovalBasePath{{"}}"}}organizations/{{"{{"}}organization_id{{"}}"}}/accessApprovalSettings") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/clear_project_access_approval_settings.go.tmpl b/mmv1/templates/terraform/custom_delete/clear_project_access_approval_settings.go.tmpl index 52dcdee6b4d5..08f5bf7df9fb 100644 --- a/mmv1/templates/terraform/custom_delete/clear_project_access_approval_settings.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/clear_project_access_approval_settings.go.tmpl @@ -3,7 +3,7 @@ obj["notificationEmails"] = []string{} obj["enrolledServices"] = []string{} obj["activeKeyVersion"] = "" -url, err := tpgresource.ReplaceVars(d, config, "{{AccessApprovalBasePath}}projects/{{project_id}}/accessApprovalSettings") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessApprovalBasePath{{"}}"}}projects/{{"{{"}}project_id{{"}}"}}/accessApprovalSettings") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/compute_mig_resize_request_delete.go.tmpl b/mmv1/templates/terraform/custom_delete/compute_mig_resize_request_delete.go.tmpl index 0de19a5558f4..f0a4a2dc3592 100644 --- a/mmv1/templates/terraform/custom_delete/compute_mig_resize_request_delete.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/compute_mig_resize_request_delete.go.tmpl @@ -6,7 +6,7 @@ if err != nil { // Get cancel url var cancelUrl string -cancelUrl, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/resizeRequests/{{name}}/cancel") +cancelUrl, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/resizeRequests/{{"{{"}}name{{"}}"}}/cancel") if err != nil { return err @@ -14,7 +14,7 @@ if err != nil { // Get delete url var deleteUrl string -deleteUrl, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/resizeRequests/{{name}}") +deleteUrl, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/resizeRequests/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/firebase_app_deletion_policy.tmpl b/mmv1/templates/terraform/custom_delete/firebase_app_deletion_policy.tmpl index b4dc6d2ef6a3..a59a9c5cbd21 100644 --- a/mmv1/templates/terraform/custom_delete/firebase_app_deletion_policy.tmpl +++ b/mmv1/templates/terraform/custom_delete/firebase_app_deletion_policy.tmpl @@ -15,7 +15,7 @@ } billingProject = project - url, err := tpgresource.ReplaceVars(d, config, "{{FirebaseBasePath}}{{name}}:remove") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseBasePath{{"}}"}}{{"{{"}}name{{"}}"}}:remove") if err != nil { return err } 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 7e78f7c53e0d..fb893e9b7bf1 100644 --- a/mmv1/templates/terraform/custom_delete/firestore_field_delete.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/firestore_field_delete.go.tmpl @@ -10,7 +10,7 @@ if err != nil { } billingProject = project -url, err := tpgresource.ReplaceVars(d, config, "{{FirestoreBasePath}}{{name}}") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirestoreBasePath{{"}}"}}{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/go/active_directory_domain_trust.go.tmpl b/mmv1/templates/terraform/custom_delete/go/active_directory_domain_trust.go.tmpl deleted file mode 100644 index 2b9dfd7bbce6..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/active_directory_domain_trust.go.tmpl +++ /dev/null @@ -1,80 +0,0 @@ - project, err := tpgresource.GetProject(d, config) - if err != nil { - return err - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ActiveDirectoryBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/global/domains/{{"{{"}}domain{{"}}"}}:detachTrust") - if err != nil { - return err - } - - {{/* The generate DELETE method isn't including the {trust: } object in the response body thus custom_delete is needed */ -}} - - obj := make(map[string]interface{}) - targetDomainNameProp, err := expandNestedActiveDirectoryDomainTrustTargetDomainName(d.Get("target_domain_name"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("target_domain_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, targetDomainNameProp)) { - obj["targetDomainName"] = targetDomainNameProp - } - trustTypeProp, err := expandNestedActiveDirectoryDomainTrustTrustType(d.Get("trust_type"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("trust_type"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, trustTypeProp)) { - obj["trustType"] = trustTypeProp - } - trustDirectionProp, err := expandNestedActiveDirectoryDomainTrustTrustDirection(d.Get("trust_direction"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("trust_direction"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, trustDirectionProp)) { - obj["trustDirection"] = trustDirectionProp - } - selectiveAuthenticationProp, err := expandNestedActiveDirectoryDomainTrustSelectiveAuthentication(d.Get("selective_authentication"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("selective_authentication"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, selectiveAuthenticationProp)) { - obj["selectiveAuthentication"] = selectiveAuthenticationProp - } - targetDnsIpAddressesProp, err := expandNestedActiveDirectoryDomainTrustTargetDnsIpAddresses(d.Get("target_dns_ip_addresses"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("target_dns_ip_addresses"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, targetDnsIpAddressesProp)) { - obj["targetDnsIpAddresses"] = targetDnsIpAddressesProp - } - trustHandshakeSecretProp, err := expandNestedActiveDirectoryDomainTrustTrustHandshakeSecret(d.Get("trust_handshake_secret"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("trust_handshake_secret"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, trustHandshakeSecretProp)) { - obj["trustHandshakeSecret"] = trustHandshakeSecretProp - } - - obj, err = resourceActiveDirectoryDomainTrustEncoder(d, meta, obj) - if err != nil { - return err - } - - log.Printf("[DEBUG] Deleting DomainTrust %q", d.Id()) - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, "DomainTrust") - } - - err = ActiveDirectoryOperationWaitTime( - config, res, project, "Deleting DomainTrust", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - - log.Printf("[DEBUG] Finished deleting DomainTrust %q: %#v", d.Id(), res) - return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/go/appversion_delete.go.tmpl b/mmv1/templates/terraform/custom_delete/go/appversion_delete.go.tmpl deleted file mode 100644 index 89abcbfbacab..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/appversion_delete.go.tmpl +++ /dev/null @@ -1,89 +0,0 @@ - -if d.Get("noop_on_destroy") == true { - log.Printf("[DEBUG] Keeping the AppVersion %q", d.Id()) - return nil -} - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return err -} - -lockName, err := tpgresource.ReplaceVars(d, config, "apps/{{"{{"}}project{{"}}"}}/services/{{"{{"}}service{{"}}"}}") -if err != nil { - return err -} -transport_tpg.MutexStore.Lock(lockName) -defer transport_tpg.MutexStore.Unlock(lockName) - -if d.Get("delete_service_on_destroy") == true { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AppEngineBasePath{{"}}"}}apps/{{"{{"}}project{{"}}"}}/services/{{"{{"}}service{{"}}"}}") - if err != nil { - return err - } - var obj map[string]interface{} - log.Printf("[DEBUG] Deleting Service %q", d.Id()) - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), -{{- if $.ErrorRetryPredicates }} - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorRetryPredicates "," -}} }, -{{- end }} -{{- if $.ErrorAbortPredicates }} - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorAbortPredicates "," -}} }, -{{- end }} - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, "Service") - } - err = AppEngineOperationWaitTime( - config, res, project, "Deleting Service", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - log.Printf("[DEBUG] Finished deleting Service %q: %#v", d.Id(), res) - return nil -} else { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AppEngineBasePath{{"}}"}}apps/{{"{{"}}project{{"}}"}}/services/{{"{{"}}service{{"}}"}}/versions/{{"{{"}}version_id{{"}}"}}") - if err != nil { - return err - } - var obj map[string]interface{} - log.Printf("[DEBUG] Deleting AppVersion %q", d.Id()) - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), -{{- if $.ErrorRetryPredicates }} - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorRetryPredicates "," -}} }, -{{- end }} -{{- if $.ErrorAbortPredicates }} - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorAbortPredicates "," -}} }, -{{- end }} - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, "AppVersion") - } - err = AppEngineOperationWaitTime( - config, res, project, "Deleting AppVersion", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - log.Printf("[DEBUG] Finished deleting AppVersion %q: %#v", d.Id(), res) - return nil - - -} diff --git a/mmv1/templates/terraform/custom_delete/go/clear_bigquery_bi_reservation.go.tmpl b/mmv1/templates/terraform/custom_delete/go/clear_bigquery_bi_reservation.go.tmpl deleted file mode 100644 index 35b277bf03a4..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/clear_bigquery_bi_reservation.go.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -obj := make(map[string]interface{}) -obj["preferredTables"] = []string{} -obj["size"] = 0 - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}BigqueryReservationBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/biReservation") -if err != nil { - return err -} - -log.Printf("[DEBUG] Clearing BIReservation %q: %#v", d.Id(), obj) -updateMask := []string{} - -updateMask = append(updateMask, "size") -updateMask = append(updateMask, "preferredTables") - -// 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 -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error clearing BIReservation %q: %s", d.Id(), err) -} else { - log.Printf("[DEBUG] Finished clearing BIReservation %q: %#v", d.Id(), res) -} - -return nil diff --git a/mmv1/templates/terraform/custom_delete/go/clear_folder_access_approval_settings.go.tmpl b/mmv1/templates/terraform/custom_delete/go/clear_folder_access_approval_settings.go.tmpl deleted file mode 100644 index 5da573c92fcb..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/clear_folder_access_approval_settings.go.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -obj := make(map[string]interface{}) -obj["notificationEmails"] = []string{} -obj["enrolledServices"] = []string{} -obj["activeKeyVersion"] = "" - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessApprovalBasePath{{"}}"}}folders/{{"{{"}}folder_id{{"}}"}}/accessApprovalSettings") -if err != nil { - return err -} - -log.Printf("[DEBUG] Emptying FolderSettings %q: %#v", d.Id(), obj) -updateMask := []string{} - -updateMask = append(updateMask, "notificationEmails") -updateMask = append(updateMask, "enrolledServices") -updateMask = append(updateMask, "activeKeyVersion") - -// 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 -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error emptying FolderSettings %q: %s", d.Id(), err) -} else { - log.Printf("[DEBUG] Finished emptying FolderSettings %q: %#v", d.Id(), res) -} - -return nil diff --git a/mmv1/templates/terraform/custom_delete/go/clear_instance_settings.go.tmpl b/mmv1/templates/terraform/custom_delete/go/clear_instance_settings.go.tmpl deleted file mode 100644 index 05ae8e236abe..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/clear_instance_settings.go.tmpl +++ /dev/null @@ -1,49 +0,0 @@ -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceSettings") -if err != nil { - return err -} - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return fmt.Errorf("Error fetching project for InstanceSettings: %s", err) -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: userAgent, -}) - -if err != nil { - return err -} - -obj := map[string]interface {}{"fingerprint":res["fingerprint"], "metadata":map[string]interface {}{"items":map[string]string{}}} -log.Printf("[DEBUG] Emptying InstanceSettings %#v", obj) - -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": "*"}) -if err != nil { - return err -} - -res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error emptying InstanceSettings %s", err) -} else { - log.Printf("[DEBUG] Finished emptying InstanceSettings %#v", res) -} - -time.Sleep(1 * time.Minute) - -return nil diff --git a/mmv1/templates/terraform/custom_delete/go/clear_organization_access_approval_settings.go.tmpl b/mmv1/templates/terraform/custom_delete/go/clear_organization_access_approval_settings.go.tmpl deleted file mode 100644 index 6586e7f50fea..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/clear_organization_access_approval_settings.go.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -obj := make(map[string]interface{}) -obj["notificationEmails"] = []string{} -obj["enrolledServices"] = []string{} -obj["activeKeyVersion"] = "" - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessApprovalBasePath{{"}}"}}organizations/{{"{{"}}organization_id{{"}}"}}/accessApprovalSettings") -if err != nil { - return err -} - -log.Printf("[DEBUG] Emptying OrganizationSettings %q: %#v", d.Id(), obj) -updateMask := []string{} - -updateMask = append(updateMask, "notificationEmails") -updateMask = append(updateMask, "enrolledServices") -updateMask = append(updateMask, "activeKeyVersion") - -// 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 -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error emptying OrganizationSettings %q: %s", d.Id(), err) -} else { - log.Printf("[DEBUG] Finished emptying OrganizationSettings %q: %#v", d.Id(), res) -} - -return nil diff --git a/mmv1/templates/terraform/custom_delete/go/clear_project_access_approval_settings.go.tmpl b/mmv1/templates/terraform/custom_delete/go/clear_project_access_approval_settings.go.tmpl deleted file mode 100644 index 08f5bf7df9fb..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/clear_project_access_approval_settings.go.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -obj := make(map[string]interface{}) -obj["notificationEmails"] = []string{} -obj["enrolledServices"] = []string{} -obj["activeKeyVersion"] = "" - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessApprovalBasePath{{"}}"}}projects/{{"{{"}}project_id{{"}}"}}/accessApprovalSettings") -if err != nil { - return err -} - -log.Printf("[DEBUG] Emptying ProjectSettings %q: %#v", d.Id(), obj) -updateMask := []string{} - -updateMask = append(updateMask, "notificationEmails") -updateMask = append(updateMask, "enrolledServices") -updateMask = append(updateMask, "activeKeyVersion") - -// 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 -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error emptying ProjectSettings %q: %s", d.Id(), err) -} else { - log.Printf("[DEBUG] Finished emptying ProjectSettings %q: %#v", d.Id(), res) -} - -return nil diff --git a/mmv1/templates/terraform/custom_delete/go/compute_mig_resize_request_delete.go.tmpl b/mmv1/templates/terraform/custom_delete/go/compute_mig_resize_request_delete.go.tmpl deleted file mode 100644 index f0a4a2dc3592..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/compute_mig_resize_request_delete.go.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -// Get project id -project, err := tpgresource.GetProject(d, config) -if err != nil { - return fmt.Errorf("Error fetching project for resize request: %s", err) -} - -// Get cancel url -var cancelUrl string -cancelUrl, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/resizeRequests/{{"{{"}}name{{"}}"}}/cancel") - -if err != nil { - return err -} - -// Get delete url -var deleteUrl string -deleteUrl, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/resizeRequests/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} - -// Get current state (accepted or not) and delete -if d.Get("state") == "ACCEPTED" { - // cancel resize request - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: cancelUrl, - UserAgent: userAgent, - Timeout: d.Timeout(schema.TimeoutDelete), - }) - - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, "ResizeRequest") - } - - err = ComputeOperationWaitTime( - config, res, project, "Cancelling the resize request", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } -} - -// delete resize request -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: project, - RawURL: deleteUrl, - UserAgent: userAgent, - Timeout: d.Timeout(schema.TimeoutDelete), -}) - -err = ComputeOperationWaitTime( -config, res, project, "Cancelling the resize request", userAgent, -d.Timeout(schema.TimeoutDelete)) - - -if err != nil { - return err -} -return nil - - diff --git a/mmv1/templates/terraform/custom_delete/go/firebase_app_deletion_policy.tmpl b/mmv1/templates/terraform/custom_delete/go/firebase_app_deletion_policy.tmpl deleted file mode 100644 index a59a9c5cbd21..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/firebase_app_deletion_policy.tmpl +++ /dev/null @@ -1,57 +0,0 @@ - // Handwritten - obj := make(map[string]interface{}) - if d.Get("deletion_policy") == "DELETE" { - obj["immediate"] = true - } else { - fmt.Printf("Skip deleting App %q due to deletion_policy: %q\n", d.Id(), d.Get("deletion_policy")) - return nil - } - // End of Handwritten - billingProject := "" - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("Error fetching project for App: %s", err) - } - billingProject = project - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseBasePath{{"}}"}}{{"{{"}}name{{"}}"}}:remove") - if err != nil { - return err - } - - log.Printf("[DEBUG] Deleting App %q", d.Id()) - - // err == nil indicates that the billing_project value was found - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, "App") - } - - err = FirebaseOperationWaitTime( - config, res, project, "Deleting App", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - - log.Printf("[DEBUG] Finished deleting App %q: %#v", d.Id(), res) - - // This is useful if the Delete operation returns before the Get operation - // during post-test destroy shows the completed state of the resource. - time.Sleep(5 * time.Second) - - return nil diff --git a/mmv1/templates/terraform/custom_delete/go/firestore_field_delete.go.tmpl b/mmv1/templates/terraform/custom_delete/go/firestore_field_delete.go.tmpl deleted file mode 100644 index fb893e9b7bf1..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/firestore_field_delete.go.tmpl +++ /dev/null @@ -1,56 +0,0 @@ -// Firestore fields cannot be deleted, instead we clear the indexConfig and ttlConfig. - -log.Printf("[DEBUG] Deleting Field %q", d.Id()) - -billingProject := "" - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return fmt.Errorf("Error fetching project for App: %s", err) -} -billingProject = project - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirestoreBasePath{{"}}"}}{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} - -updateMask := []string{"indexConfig", "ttlConfig"} - -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 -} - -// Clear fields by sending an empty PATCH request with appropriate update mask. -req := make(map[string]interface{}) -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: req, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error deleting Field %q: %s", d.Id(), err) -} - -err = FirestoreOperationWaitTime( - config, res, project, "Deleting Field", userAgent, - d.Timeout(schema.TimeoutDelete)) - -if err != nil { - return err -} - -log.Printf("[DEBUG] Finished deleting Field %q", d.Id()) -return nil diff --git a/mmv1/templates/terraform/custom_delete/go/kms_crypto_key.tmpl b/mmv1/templates/terraform/custom_delete/go/kms_crypto_key.tmpl deleted file mode 100644 index 12ecf3ef4d1d..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/kms_crypto_key.tmpl +++ /dev/null @@ -1,25 +0,0 @@ - cryptoKeyId, err := ParseKmsCryptoKeyId(d.Id(), config) - if err != nil { - return err - } - - log.Printf(` -[WARNING] KMS CryptoKey resources cannot be deleted from GCP. The CryptoKey %s will be removed from Terraform state, -and all its CryptoKeyVersions will be destroyed, but it will still be present in the project.`, cryptoKeyId.CryptoKeyId()) - - // Delete all versions of the key - if err := clearCryptoKeyVersions(cryptoKeyId, userAgent, config); err != nil { - return err - } - - // Make sure automatic key rotation is disabled if set - if d.Get("rotation_period") != "" { - if err := disableCryptoKeyRotation(cryptoKeyId, userAgent, config); err != nil { - return fmt.Errorf( - "While cryptoKeyVersions were cleared, Terraform was unable to disable automatic rotation of key due to an error: %s."+ - "Please retry or manually disable automatic rotation to prevent creation of a new version of this key.", err) - } - } - - d.SetId("") - return nil diff --git a/mmv1/templates/terraform/custom_delete/go/kms_crypto_key_version.tmpl b/mmv1/templates/terraform/custom_delete/go/kms_crypto_key_version.tmpl deleted file mode 100644 index a1683a05dd3e..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/kms_crypto_key_version.tmpl +++ /dev/null @@ -1,13 +0,0 @@ - - cryptoKeyVersionId, err := parseKmsCryptoKeyVersionId(d.Id(), config) - if err != nil { - return err - } - if cryptoKeyVersionId == nil { - return nil - } - if err := deleteCryptoKeyVersions(cryptoKeyVersionId, d, userAgent, config); err != nil { - return nil - } - d.SetId("") - return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/go/monitoring_uptime_check_config.go.tmpl b/mmv1/templates/terraform/custom_delete/go/monitoring_uptime_check_config.go.tmpl deleted file mode 100644 index 30dc2bf22c6a..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/monitoring_uptime_check_config.go.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -billingProject := "" - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return fmt.Errorf("Error fetching project for UptimeCheckConfig: %s", err) -} -billingProject = project - -lockName, err := tpgresource.ReplaceVars(d, config, "stackdriver/groups/{{"{{"}}project{{"}}"}}") -if err != nil { - return err -} -transport_tpg.MutexStore.Lock(lockName) -defer transport_tpg.MutexStore.Unlock(lockName) - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}MonitoringBasePath{{"}}"}}v3/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} - -var obj map[string]interface{} -log.Printf("[DEBUG] Deleting UptimeCheckConfig %q", d.Id()) - -// err == nil indicates that the billing_project value was found -if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp -} - -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.IsMonitoringConcurrentEditError}, -}) - - -{{/* The generated DELETE method returns a generic error for 400. - Need to include a help message about deleting associated Alert Policies. */ -}} - -if err != nil { - if transport_tpg.IsGoogleApiErrorWithCode(err, 400) { - err := fmt.Errorf("%w - please ensure all associated Alert Policies are deleted.", err) - return errwrap.Wrapf("Error when reading or editing UptimeCheckConfig: {{"{{"}}err{{"}}"}}", err) - } - return transport_tpg.HandleNotFoundError(err, d, "UptimeCheckConfig") -} - -log.Printf("[DEBUG] Finished deleting UptimeCheckConfig %q: %#v", d.Id(), res) -return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/go/only_remove_from_state.go.tmpl b/mmv1/templates/terraform/custom_delete/go/only_remove_from_state.go.tmpl deleted file mode 100644 index 0280b5d91c1d..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/only_remove_from_state.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -log.Printf("[WARNING] Resource [%s] will be only removed from Terraform state, but will be left intact on GCP. %s", d.Id(), userAgent) - -return schema.RemoveFromState(d, meta) \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/go/per_instance_config.go.tmpl b/mmv1/templates/terraform/custom_delete/go/per_instance_config.go.tmpl deleted file mode 100644 index 1063876a5063..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/per_instance_config.go.tmpl +++ /dev/null @@ -1,115 +0,0 @@ - project, err := tpgresource.GetProject(d, config) - if err != nil { - return err - } - - lockName, err := tpgresource.ReplaceVars(d, config, "instanceGroupManager/{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}instance_group_manager{{"}}"}}") - if err != nil { - return err - } - transport_tpg.MutexStore.Lock(lockName) - defer transport_tpg.MutexStore.Unlock(lockName) - - var url string - if d.Get("remove_instance_on_destroy").(bool) { - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/deleteInstances") - } else { - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/deletePerInstanceConfigs") - } - if err != nil { - return err - } - - var obj map[string]interface{} - if d.Get("remove_instance_on_destroy").(bool) { - // Instance name in deleteInstances request must include zone - instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{"{{"}}zone{{"}}"}}/instances/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - obj = map[string]interface{}{ - "instances": [1]string{instanceName}, - } - } else { - obj = map[string]interface{}{ - "names": [1]string{d.Get("name").(string)}, - } - } - log.Printf("[DEBUG] Deleting PerInstanceConfig %q", d.Id()) - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, "PerInstanceConfig") - } - - err = ComputeOperationWaitTime( - config, res, project, "Deleting PerInstanceConfig", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - - if d.Get("remove_instance_on_destroy").(bool) { - err = transport_tpg.PollingWaitTime(resourceComputePerInstanceConfigInstancePollRead(d, meta, d.Get("name").(string)), PollCheckInstanceConfigInstanceDeleted, "Deleting PerInstanceConfig", d.Timeout(schema.TimeoutDelete), 1) - if err != nil { - return fmt.Errorf("Error waiting for instance delete on PerInstanceConfig %q: %s", d.Id(), err) - } - } else if d.Get("remove_instance_state_on_destroy").(bool) { - // Potentially delete the state managed by this config - - // Instance name in applyUpdatesToInstances request must include zone - instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{"{{"}}zone{{"}}"}}/instances/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - obj = make(map[string]interface{}) - obj["instances"] = []string{instanceName} - - // The deletion must be applied to the instance after the PerInstanceConfig is deleted - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/applyUpdatesToInstances") - if err != nil { - return err - } - - log.Printf("[DEBUG] Applying updates to PerInstanceConfig %q: %#v", d.Id(), obj) - res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - - if err != nil { - return fmt.Errorf("Error deleting PerInstanceConfig %q: %s", d.Id(), err) - } - - err = ComputeOperationWaitTime( - config, res, project, "Applying update to PerInstanceConfig", userAgent, - d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return fmt.Errorf("Error deleting PerInstanceConfig %q: %s", d.Id(), err) - } - - // PerInstanceConfig goes into "DELETING" state while the instance is actually deleted - err = transport_tpg.PollingWaitTime(resourceComputePerInstanceConfigPollRead(d, meta), PollCheckInstanceConfigDeleted, "Deleting PerInstanceConfig", d.Timeout(schema.TimeoutDelete), 1) - if err != nil { - return fmt.Errorf("Error waiting for delete on PerInstanceConfig %q: %s", d.Id(), err) - } - } - - log.Printf("[DEBUG] Finished deleting PerInstanceConfig %q: %#v", d.Id(), res) - return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/go/region_per_instance_config.go.tmpl b/mmv1/templates/terraform/custom_delete/go/region_per_instance_config.go.tmpl deleted file mode 100644 index 57027d277ddb..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/region_per_instance_config.go.tmpl +++ /dev/null @@ -1,115 +0,0 @@ - project, err := tpgresource.GetProject(d, config) - if err != nil { - return err - } - - lockName, err := tpgresource.ReplaceVars(d, config, "instanceGroupManager/{{"{{"}}project{{"}}"}}/{{"{{"}}region{{"}}"}}/{{"{{"}}region_instance_group_manager{{"}}"}}") - if err != nil { - return err - } - transport_tpg.MutexStore.Lock(lockName) - defer transport_tpg.MutexStore.Unlock(lockName) - - var url string - if d.Get("remove_instance_on_destroy").(bool) { - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/instanceGroupManagers/{{"{{"}}region_instance_group_manager{{"}}"}}/deleteInstances") - } else { - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/instanceGroupManagers/{{"{{"}}region_instance_group_manager{{"}}"}}/deletePerInstanceConfigs") - } - if err != nil { - return err - } - - var obj map[string]interface{} - if d.Get("remove_instance_on_destroy").(bool) { - // Instance name in deleteInstances request must include zone - instanceName, err := findInstanceName(d, config) - if err != nil { - return err - } - - obj = map[string]interface{}{ - "instances": [1]string{instanceName}, - } - } else { - obj = map[string]interface{}{ - "names": [1]string{d.Get("name").(string)}, - } - } - log.Printf("[DEBUG] Deleting RegionPerInstanceConfig %q", d.Id()) - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, "RegionPerInstanceConfig") - } - - err = ComputeOperationWaitTime( - config, res, project, "Deleting RegionPerInstanceConfig", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - - if d.Get("remove_instance_on_destroy").(bool) { - err = transport_tpg.PollingWaitTime(resourceComputeRegionPerInstanceConfigInstancePollRead(d, meta, d.Get("name").(string)), PollCheckInstanceConfigInstanceDeleted, "Deleting RegionPerInstanceConfig", d.Timeout(schema.TimeoutDelete), 1) - if err != nil { - return fmt.Errorf("Error waiting for instance delete on RegionPerInstanceConfig %q: %s", d.Id(), err) - } - } else if d.Get("remove_instance_state_on_destroy").(bool) { - // Potentially delete the state managed by this config - // Instance name in applyUpdatesToInstances request must include zone - instanceName, err := findInstanceName(d, config) - if err != nil { - return err - } - - obj = make(map[string]interface{}) - obj["instances"] = []string{instanceName} - - // Updates must be applied to the instance after deleting the PerInstanceConfig - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/instanceGroupManagers/{{"{{"}}region_instance_group_manager{{"}}"}}/applyUpdatesToInstances") - if err != nil { - return err - } - - log.Printf("[DEBUG] Applying updates to PerInstanceConfig %q: %#v", d.Id(), obj) - res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - - if err != nil { - return fmt.Errorf("Error updating PerInstanceConfig %q: %s", d.Id(), err) - } - - err = ComputeOperationWaitTime( - config, res, project, "Applying update to PerInstanceConfig", userAgent, - d.Timeout(schema.TimeoutUpdate)) - - if err != nil { - return fmt.Errorf("Error deleting PerInstanceConfig %q: %s", d.Id(), err) - } - - // RegionPerInstanceConfig goes into "DELETING" state while the instance is actually deleted - err = transport_tpg.PollingWaitTime(resourceComputeRegionPerInstanceConfigPollRead(d, meta), PollCheckInstanceConfigDeleted, "Deleting RegionPerInstanceConfig", d.Timeout(schema.TimeoutDelete), 1) - if err != nil { - return fmt.Errorf("Error waiting for delete on RegionPerInstanceConfig %q: %s", d.Id(), err) - } - } - - log.Printf("[DEBUG] Finished deleting RegionPerInstanceConfig %q: %#v", d.Id(), res) - return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/go/replace_all_access_levels_empty_list.go.tmpl b/mmv1/templates/terraform/custom_delete/go/replace_all_access_levels_empty_list.go.tmpl deleted file mode 100644 index 5d3f716fc2cb..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/replace_all_access_levels_empty_list.go.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -obj := make(map[string]interface{}) -obj["accessLevels"] = []string{} - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessContextManagerBasePath{{"}}"}}{{"{{"}}parent{{"}}"}}/accessLevels:replaceAll") -if err != nil { - return err -} - -log.Printf("[DEBUG] Deleting AccessLevels %q: %#v", d.Id(), obj) -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error deleting AccessLevels %q: %s", d.Id(), err) -} else { - log.Printf("[DEBUG] Finished deleting AccessLevels %q: %#v", d.Id(), res) -} - -err = AccessContextManagerOperationWaitTime( - config, res, "Updating AccessLevels", userAgent, - d.Timeout(schema.TimeoutUpdate)) - -if err != nil { - return err -} - -return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/go/replace_all_service_perimeters_empty_list.go.tmpl b/mmv1/templates/terraform/custom_delete/go/replace_all_service_perimeters_empty_list.go.tmpl deleted file mode 100644 index d8cd95f965ce..000000000000 --- a/mmv1/templates/terraform/custom_delete/go/replace_all_service_perimeters_empty_list.go.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -obj := make(map[string]interface{}) -obj["servicePerimeters"] = []string{} - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessContextManagerBasePath{{"}}"}}{{"{{"}}parent{{"}}"}}/servicePerimeters:replaceAll") -if err != nil { - return err -} - -log.Printf("[DEBUG] Deleting servicePerimeters %q: %#v", d.Id(), obj) -res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error deleting ServicePerimeters %q: %s", d.Id(), err) -} else { - log.Printf("[DEBUG] Finished deleting ServicePerimeters %q: %#v", d.Id(), res) -} - -err = AccessContextManagerOperationWaitTime( - config, res, "Updating ServicePerimeters", userAgent, - d.Timeout(schema.TimeoutUpdate)) - -if err != nil { - return err -} - -return nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_delete/monitoring_uptime_check_config.go.tmpl b/mmv1/templates/terraform/custom_delete/monitoring_uptime_check_config.go.tmpl index 737359dceee3..30dc2bf22c6a 100644 --- a/mmv1/templates/terraform/custom_delete/monitoring_uptime_check_config.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/monitoring_uptime_check_config.go.tmpl @@ -6,14 +6,14 @@ if err != nil { } billingProject = project -lockName, err := tpgresource.ReplaceVars(d, config, "stackdriver/groups/{{project}}") +lockName, err := tpgresource.ReplaceVars(d, config, "stackdriver/groups/{{"{{"}}project{{"}}"}}") if err != nil { return err } transport_tpg.MutexStore.Lock(lockName) defer transport_tpg.MutexStore.Unlock(lockName) -url, err := tpgresource.ReplaceVars(d, config, "{{MonitoringBasePath}}v3/{{name}}") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}MonitoringBasePath{{"}}"}}v3/{{"{{"}}name{{"}}"}}") if err != nil { return err } @@ -38,15 +38,13 @@ res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ }) -<%# - The generated DELETE method returns a generic error for 400. - Need to include a help message about deleting associated Alert Policies. --%> +{{/* The generated DELETE method returns a generic error for 400. + Need to include a help message about deleting associated Alert Policies. */ -}} if err != nil { if transport_tpg.IsGoogleApiErrorWithCode(err, 400) { err := fmt.Errorf("%w - please ensure all associated Alert Policies are deleted.", err) - return errwrap.Wrapf("Error when reading or editing UptimeCheckConfig: {{err}}", err) + return errwrap.Wrapf("Error when reading or editing UptimeCheckConfig: {{"{{"}}err{{"}}"}}", err) } return transport_tpg.HandleNotFoundError(err, d, "UptimeCheckConfig") } 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 71a62d09cd76..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}}") + lockName, err := tpgresource.ReplaceVars(d, config, "instanceGroupManager/{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}instance_group_manager{{"}}"}}") if err != nil { return err } @@ -12,9 +12,9 @@ var url string if d.Get("remove_instance_on_destroy").(bool) { - url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/deleteInstances") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/deleteInstances") } else { - url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/deletePerInstanceConfigs") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/deletePerInstanceConfigs") } if err != nil { return err @@ -23,7 +23,7 @@ var obj map[string]interface{} if d.Get("remove_instance_on_destroy").(bool) { // Instance name in deleteInstances request must include zone - instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{zone}}/instances/{{name}}") + instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{"{{"}}zone{{"}}"}}/instances/{{"{{"}}name{{"}}"}}") if err != nil { return err } @@ -68,7 +68,7 @@ // Potentially delete the state managed by this config // Instance name in applyUpdatesToInstances request must include zone - instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{zone}}/instances/{{name}}") + instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{"{{"}}zone{{"}}"}}/instances/{{"{{"}}name{{"}}"}}") if err != nil { return err } @@ -77,7 +77,7 @@ obj["instances"] = []string{instanceName} // The deletion must be applied to the instance after the PerInstanceConfig is deleted - url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/applyUpdatesToInstances") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/applyUpdatesToInstances") if err != nil { return err } 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 4df61c37649d..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}}") + lockName, err := tpgresource.ReplaceVars(d, config, "instanceGroupManager/{{"{{"}}project{{"}}"}}/{{"{{"}}region{{"}}"}}/{{"{{"}}region_instance_group_manager{{"}}"}}") if err != nil { return err } @@ -12,9 +12,9 @@ var url string if d.Get("remove_instance_on_destroy").(bool) { - url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/instanceGroupManagers/{{region_instance_group_manager}}/deleteInstances") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/instanceGroupManagers/{{"{{"}}region_instance_group_manager{{"}}"}}/deleteInstances") } else { - url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/instanceGroupManagers/{{region_instance_group_manager}}/deletePerInstanceConfigs") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/instanceGroupManagers/{{"{{"}}region_instance_group_manager{{"}}"}}/deletePerInstanceConfigs") } if err != nil { return err @@ -76,7 +76,7 @@ obj["instances"] = []string{instanceName} // Updates must be applied to the instance after deleting the PerInstanceConfig - url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/instanceGroupManagers/{{region_instance_group_manager}}/applyUpdatesToInstances") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/instanceGroupManagers/{{"{{"}}region_instance_group_manager{{"}}"}}/applyUpdatesToInstances") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/replace_all_access_levels_empty_list.go.tmpl b/mmv1/templates/terraform/custom_delete/replace_all_access_levels_empty_list.go.tmpl index 81b9124a7675..5d3f716fc2cb 100644 --- a/mmv1/templates/terraform/custom_delete/replace_all_access_levels_empty_list.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/replace_all_access_levels_empty_list.go.tmpl @@ -1,7 +1,7 @@ obj := make(map[string]interface{}) obj["accessLevels"] = []string{} -url, err := tpgresource.ReplaceVars(d, config, "{{AccessContextManagerBasePath}}{{parent}}/accessLevels:replaceAll") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessContextManagerBasePath{{"}}"}}{{"{{"}}parent{{"}}"}}/accessLevels:replaceAll") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_delete/replace_all_service_perimeters_empty_list.go.tmpl b/mmv1/templates/terraform/custom_delete/replace_all_service_perimeters_empty_list.go.tmpl index 3ea319bf40c1..d8cd95f965ce 100644 --- a/mmv1/templates/terraform/custom_delete/replace_all_service_perimeters_empty_list.go.tmpl +++ b/mmv1/templates/terraform/custom_delete/replace_all_service_perimeters_empty_list.go.tmpl @@ -1,7 +1,7 @@ obj := make(map[string]interface{}) obj["servicePerimeters"] = []string{} -url, err := tpgresource.ReplaceVars(d, config, "{{AccessContextManagerBasePath}}{{parent}}/servicePerimeters:replaceAll") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}AccessContextManagerBasePath{{"}}"}}{{"{{"}}parent{{"}}"}}/servicePerimeters:replaceAll") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_expand/apphub_service_project.go.tmpl b/mmv1/templates/terraform/custom_expand/apphub_service_project.go.tmpl index 716466f55f9b..a08ddcf1f866 100644 --- a/mmv1/templates/terraform/custom_expand/apphub_service_project.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/apphub_service_project.go.tmpl @@ -1,4 +1,4 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { service_project := "projects/" + d.Get("service_project_attachment_id").(string) diff --git a/mmv1/templates/terraform/custom_expand/array_resourceref_with_validation.go.tmpl b/mmv1/templates/terraform/custom_expand/array_resourceref_with_validation.go.tmpl index 255550196d2d..3493454ce2e5 100644 --- a/mmv1/templates/terraform/custom_expand/array_resourceref_with_validation.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/array_resourceref_with_validation.go.tmpl @@ -1,30 +1,28 @@ -<%- # the license inside this block applies to this file -# Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { -<% if property.is_set -%> +{{/* + 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 $.IsSet }} v = v.(*schema.Set).List() -<% end -%> +{{- end }} l := v.([]interface{}) req := make([]interface{}, 0, len(l)) for _, raw := range l { if raw == nil { - return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: nil") + return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: nil") } - f, err := <%= build_expand_resource_ref('raw.(string)', property.item_type, pwd) %> + f, err := {{ template "expandResourceRef" dict "VarName" "raw.(string)" "ResourceRef" $.ItemType.ResourceRef "ResourceType" $.ItemType.ResourceType}} if err != nil { - return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: %s", err) + return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: %s", err) } req = append(req, f.RelativeLink()) } diff --git a/mmv1/templates/terraform/custom_expand/base64.go.tmpl b/mmv1/templates/terraform/custom_expand/base64.go.tmpl index 0b64c95e6a71..d8a4241f722a 100644 --- a/mmv1/templates/terraform/custom_expand/base64.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/base64.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_expand/bigquery_access_role.go.tmpl b/mmv1/templates/terraform/custom_expand/bigquery_access_role.go.tmpl index ef0c7718cb25..d789edc7091e 100644 --- a/mmv1/templates/terraform/custom_expand/bigquery_access_role.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/bigquery_access_role.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_expand/bigquery_dataset_ref.go.tmpl b/mmv1/templates/terraform/custom_expand/bigquery_dataset_ref.go.tmpl index 50d23affb88f..bb63a9cf7784 100644 --- a/mmv1/templates/terraform/custom_expand/bigquery_dataset_ref.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/bigquery_dataset_ref.go.tmpl @@ -1,18 +1,16 @@ -<%# # the license inside this if block pertains to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { return nil, nil diff --git a/mmv1/templates/terraform/custom_expand/bigquery_table_ref.go.tmpl b/mmv1/templates/terraform/custom_expand/bigquery_table_ref.go.tmpl index 4faf2b8c31f0..2cee71c3a8ec 100644 --- a/mmv1/templates/terraform/custom_expand/bigquery_table_ref.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/bigquery_table_ref.go.tmpl @@ -1,18 +1,16 @@ -<%# # the license inside this if block pertains to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { return nil, nil diff --git a/mmv1/templates/terraform/custom_expand/bigquery_table_ref_array.go.tmpl b/mmv1/templates/terraform/custom_expand/bigquery_table_ref_array.go.tmpl index 0b80c66967bb..19fb689a348c 100644 --- a/mmv1/templates/terraform/custom_expand/bigquery_table_ref_array.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/bigquery_table_ref_array.go.tmpl @@ -1,18 +1,16 @@ -<%# # the license inside this if block pertains to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { l := v.([]interface{}) req := make([]interface{}, 0, len(l)) for _, raw := range l { diff --git a/mmv1/templates/terraform/custom_expand/bigtable_app_profile_routing.tmpl b/mmv1/templates/terraform/custom_expand/bigtable_app_profile_routing.tmpl index d9a80f2ca5a3..ec33a04d251c 100644 --- a/mmv1/templates/terraform/custom_expand/bigtable_app_profile_routing.tmpl +++ b/mmv1/templates/terraform/custom_expand/bigtable_app_profile_routing.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 || !v.(bool) { return nil, nil } diff --git a/mmv1/templates/terraform/custom_expand/billing_budget_budget_filter_labels.tmpl b/mmv1/templates/terraform/custom_expand/billing_budget_budget_filter_labels.tmpl index 0f8d8dd148ed..cb6a11a28db7 100644 --- a/mmv1/templates/terraform/custom_expand/billing_budget_budget_filter_labels.tmpl +++ b/mmv1/templates/terraform/custom_expand/billing_budget_budget_filter_labels.tmpl @@ -1,4 +1,4 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string][]string, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string][]string, error) { if v == nil { return map[string][]string{}, nil } diff --git a/mmv1/templates/terraform/custom_expand/binaryauthorization_attestors.tmpl b/mmv1/templates/terraform/custom_expand/binaryauthorization_attestors.tmpl index ca30fc413f74..2c871906f019 100644 --- a/mmv1/templates/terraform/custom_expand/binaryauthorization_attestors.tmpl +++ b/mmv1/templates/terraform/custom_expand/binaryauthorization_attestors.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { r := regexp.MustCompile("projects/(.+)/attestors/(.+)") // It's possible that all entries in the list will specify a project, in diff --git a/mmv1/templates/terraform/custom_expand/bool_to_object.go.tmpl b/mmv1/templates/terraform/custom_expand/bool_to_object.go.tmpl index 38eb8b8552eb..ce0c8bfd5895 100644 --- a/mmv1/templates/terraform/custom_expand/bool_to_object.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/bool_to_object.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 || !v.(bool) { return nil, nil } diff --git a/mmv1/templates/terraform/custom_expand/bool_to_upper_string.tmpl b/mmv1/templates/terraform/custom_expand/bool_to_upper_string.tmpl index 70ddf5d39d33..100af9c9d271 100644 --- a/mmv1/templates/terraform/custom_expand/bool_to_upper_string.tmpl +++ b/mmv1/templates/terraform/custom_expand/bool_to_upper_string.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2021 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_expand/certificate_manager_certificate_construct_full_url.go.tmpl b/mmv1/templates/terraform/custom_expand/certificate_manager_certificate_construct_full_url.go.tmpl index fa9b8685ff7e..fabce69a7f41 100644 --- a/mmv1/templates/terraform/custom_expand/certificate_manager_certificate_construct_full_url.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/certificate_manager_certificate_construct_full_url.go.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 } @@ -20,7 +18,7 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t req := make([]interface{}, 0, len(l)) for _, raw := range l { if raw == nil { - return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: nil") + return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: nil") } if strings.HasPrefix(raw.(string), "//") || strings.HasPrefix(raw.(string), "https://") { // Any full URL will be passed to the API request (regardless of the resource type). This is to allow self_links of CertificateManagerCeritificate resources. @@ -31,7 +29,7 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t self_link := "https://certificatemanager.googleapis.com/v1/" + raw.(string) req = append(req, self_link) } else { - return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: %v is an invalid format for a certificateManagerCertificate resource", raw.(string)) + return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: %v is an invalid format for a certificateManagerCertificate resource", raw.(string)) } } return req, nil diff --git a/mmv1/templates/terraform/custom_expand/cloud_run_service_revision_name.tmpl b/mmv1/templates/terraform/custom_expand/cloud_run_service_revision_name.tmpl index 657993f495a1..2d22f0215d33 100644 --- a/mmv1/templates/terraform/custom_expand/cloud_run_service_revision_name.tmpl +++ b/mmv1/templates/terraform/custom_expand/cloud_run_service_revision_name.tmpl @@ -1,4 +1,4 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if d.Get("autogenerate_revision_name") == true { return nil, nil } diff --git a/mmv1/templates/terraform/custom_expand/cloudquotas_quota_preference_trace_id.go.tmpl b/mmv1/templates/terraform/custom_expand/cloudquotas_quota_preference_trace_id.go.tmpl index bb5152e6fb1a..1518e1014a61 100644 --- a/mmv1/templates/terraform/custom_expand/cloudquotas_quota_preference_trace_id.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/cloudquotas_quota_preference_trace_id.go.tmpl @@ -1,3 +1,3 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return nil, nil } \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/compute_full_url.tmpl b/mmv1/templates/terraform/custom_expand/compute_full_url.tmpl index dfc6706ffd3b..1e1d3dd1fd32 100644 --- a/mmv1/templates/terraform/custom_expand/compute_full_url.tmpl +++ b/mmv1/templates/terraform/custom_expand/compute_full_url.tmpl @@ -1,27 +1,25 @@ -<%# 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. --%> -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 || v.(string) == "" { return "", nil } - f, err := <%= build_expand_resource_ref('v.(string)', property, pwd) %> + f, err := {{ template "expandResourceRef" dict "VarName" "v.(string)" "ResourceRef" $.ResourceRef "ResourceType" $.ResourceType}} if err != nil { - return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: %s", err) + return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: %s", err) } - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}"+f.RelativeLink()) + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}"+f.RelativeLink()) if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/custom_expand/compute_instance_settings_fingerprint.tmpl b/mmv1/templates/terraform/custom_expand/compute_instance_settings_fingerprint.tmpl index cff49efd90a2..f98f54248e63 100644 --- a/mmv1/templates/terraform/custom_expand/compute_instance_settings_fingerprint.tmpl +++ b/mmv1/templates/terraform/custom_expand/compute_instance_settings_fingerprint.tmpl @@ -1,4 +1,4 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { project, err := tpgresource.GetProject(d, config) if err != nil { return nil, err @@ -9,7 +9,7 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t return nil, err } - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/instanceSettings/{{name}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceSettings/{{"{{"}}name{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/custom_expand/computed_lite_subscription_topic.tmpl b/mmv1/templates/terraform/custom_expand/computed_lite_subscription_topic.tmpl index 10f3e1baab59..548fc4d52118 100644 --- a/mmv1/templates/terraform/custom_expand/computed_lite_subscription_topic.tmpl +++ b/mmv1/templates/terraform/custom_expand/computed_lite_subscription_topic.tmpl @@ -1,18 +1,16 @@ -<%# # the license inside this if block pertains to this file - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { project, err := tpgresource.GetProject(d, config) if err != nil { return "", err diff --git a/mmv1/templates/terraform/custom_expand/computed_subscription_topic.tmpl b/mmv1/templates/terraform/custom_expand/computed_subscription_topic.tmpl index ebef66450605..940524b196cf 100644 --- a/mmv1/templates/terraform/custom_expand/computed_subscription_topic.tmpl +++ b/mmv1/templates/terraform/custom_expand/computed_subscription_topic.tmpl @@ -1,18 +1,16 @@ -<%# # the license inside this if block pertains to this file - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { project, err := tpgresource.GetProject(d, config) if err != nil { return "", err diff --git a/mmv1/templates/terraform/custom_expand/container_analysis_note.tmpl b/mmv1/templates/terraform/custom_expand/container_analysis_note.tmpl index 7ea8366d927f..e613350a9020 100644 --- a/mmv1/templates/terraform/custom_expand/container_analysis_note.tmpl +++ b/mmv1/templates/terraform/custom_expand/container_analysis_note.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { r := regexp.MustCompile("projects/(.+)/notes/(.+)") if r.MatchString(v.(string)) { return v.(string), nil diff --git a/mmv1/templates/terraform/custom_expand/containerattached_cluster_authorization_user.go.tmpl b/mmv1/templates/terraform/custom_expand/containerattached_cluster_authorization_user.go.tmpl index 6b837990ea41..4d3eba6ea01b 100644 --- a/mmv1/templates/terraform/custom_expand/containerattached_cluster_authorization_user.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/containerattached_cluster_authorization_user.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} type attachedClusterUser struct { Username string `json:"username"` @@ -43,7 +41,7 @@ type attachedClusterGroup struct { // "group2" // ], // } -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { return nil, nil diff --git a/mmv1/templates/terraform/custom_expand/containerattached_cluster_empty_logging.go.tmpl b/mmv1/templates/terraform/custom_expand/containerattached_cluster_empty_logging.go.tmpl index cc8331ec5c53..6714aa99383f 100644 --- a/mmv1/templates/terraform/custom_expand/containerattached_cluster_empty_logging.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/containerattached_cluster_empty_logging.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { transformed := make(map[string]interface{}) diff --git a/mmv1/templates/terraform/custom_expand/data_catalog_tag.go.tmpl b/mmv1/templates/terraform/custom_expand/data_catalog_tag.go.tmpl index 410130f690d1..cd2e2bde8c67 100644 --- a/mmv1/templates/terraform/custom_expand/data_catalog_tag.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/data_catalog_tag.go.tmpl @@ -1,18 +1,16 @@ -<%# # the license inside this if block pertains to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { // we flattened the original["enum_value"]["display_name"] object to be just original["enum_value"] so here, // v is the value we want from the config transformed := make(map[string]interface{}) diff --git a/mmv1/templates/terraform/custom_expand/datastream_stream_dataset_id.go.tmpl b/mmv1/templates/terraform/custom_expand/datastream_stream_dataset_id.go.tmpl index efd70c739d52..58b5fc887c66 100644 --- a/mmv1/templates/terraform/custom_expand/datastream_stream_dataset_id.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/datastream_stream_dataset_id.go.tmpl @@ -1,18 +1,16 @@ -<%# # the license inside this if block pertains to this file - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { s := v.(string) re := regexp.MustCompile(`projects/(.+)/datasets/([^\.\?\#]+)`) paths := re.FindStringSubmatch(s) diff --git a/mmv1/templates/terraform/custom_expand/days_to_duration_string.go.tmpl b/mmv1/templates/terraform/custom_expand/days_to_duration_string.go.tmpl index b58397cfbbd6..e07883db9d16 100644 --- a/mmv1/templates/terraform/custom_expand/days_to_duration_string.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/days_to_duration_string.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_expand/default_to_project.go.tmpl b/mmv1/templates/terraform/custom_expand/default_to_project.go.tmpl index ace152221c17..f87a2056ccd1 100644 --- a/mmv1/templates/terraform/custom_expand/default_to_project.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/default_to_project.go.tmpl @@ -1,19 +1,17 @@ -<%# # the license inside this if block pertains to this file - # Copyright 2019 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. -#%> +{{/* + 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. +*/ -}} // If the property hasn't been explicitly set in config use the project defined by the provider or env. -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if v == nil { project, err := tpgresource.GetProject(d, config) if err != nil { diff --git a/mmv1/templates/terraform/custom_expand/disk_consistency_group_policy.tmpl b/mmv1/templates/terraform/custom_expand/disk_consistency_group_policy.tmpl index 8e758566a4bc..4aa4b5ead7e2 100644 --- a/mmv1/templates/terraform/custom_expand/disk_consistency_group_policy.tmpl +++ b/mmv1/templates/terraform/custom_expand/disk_consistency_group_policy.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { diff --git a/mmv1/templates/terraform/custom_expand/dns_managed_zone_private_visibility_config.go.tmpl b/mmv1/templates/terraform/custom_expand/dns_managed_zone_private_visibility_config.go.tmpl index 76e6035c79e5..18cb76ef57ca 100644 --- a/mmv1/templates/terraform/custom_expand/dns_managed_zone_private_visibility_config.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/dns_managed_zone_private_visibility_config.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { // The API won't remove the the field unless an empty network array is sent. @@ -42,7 +40,7 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t return transformed, nil } -func expand<%= prefix -%><%= titlelize_property(property) -%>Networks(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}Networks(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { v = v.(*schema.Set).List() l := v.([]interface{}) req := make([]interface{}, 0, len(l)) @@ -65,7 +63,7 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>Networks(v interfac return req, nil } -func expand<%= prefix -%><%= titlelize_property(property) -%>GkeClusters(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}GkeClusters(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { l := v.([]interface{}) req := make([]interface{}, 0, len(l)) for _, raw := range l { @@ -87,13 +85,13 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>GkeClusters(v inter return req, nil } -func expand<%= prefix -%><%= titlelize_property(property) -%>NetworksNetworkUrl(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}NetworksNetworkUrl(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if v == nil || v.(string) == "" { return "", nil } else if strings.HasPrefix(v.(string), "https://") { return v, nil } - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}"+v.(string)) + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}"+v.(string)) if err != nil { return "", err } diff --git a/mmv1/templates/terraform/custom_expand/empty_object_if_set.go.tmpl b/mmv1/templates/terraform/custom_expand/empty_object_if_set.go.tmpl index ec3e7c192cc1..7bd0c2ac381c 100644 --- a/mmv1/templates/terraform/custom_expand/empty_object_if_set.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/empty_object_if_set.go.tmpl @@ -6,7 +6,7 @@ * This is unique from send_empty_value, which will send an explicit null value * for empty configuration blocks. */ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if v == nil { return nil, nil } diff --git a/mmv1/templates/terraform/custom_expand/enum_bool.go.tmpl b/mmv1/templates/terraform/custom_expand/enum_bool.go.tmpl index e8153ccee90e..0c5d3853da14 100644 --- a/mmv1/templates/terraform/custom_expand/enum_bool.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/enum_bool.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2021 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_expand/firestore_field_index_config.go.tmpl b/mmv1/templates/terraform/custom_expand/firestore_field_index_config.go.tmpl index 7b0a5363c4f8..f12f6770e897 100644 --- a/mmv1/templates/terraform/custom_expand/firestore_field_index_config.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/firestore_field_index_config.go.tmpl @@ -1,4 +1,4 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { // We drop all output only fields as they are unnecessary. if v == nil { return nil, nil diff --git a/mmv1/templates/terraform/custom_expand/firewall_log_config.go.tmpl b/mmv1/templates/terraform/custom_expand/firewall_log_config.go.tmpl index 9c575bf9450e..32f3feb64713 100644 --- a/mmv1/templates/terraform/custom_expand/firewall_log_config.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/firewall_log_config.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { l := v.([]interface{}) transformed := make(map[string]interface{}) diff --git a/mmv1/templates/terraform/custom_expand/gke_hub_membership.tmpl b/mmv1/templates/terraform/custom_expand/gke_hub_membership.tmpl index cfe5896090fe..21f522d77dbc 100644 --- a/mmv1/templates/terraform/custom_expand/gke_hub_membership.tmpl +++ b/mmv1/templates/terraform/custom_expand/gke_hub_membership.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2021 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 strings.HasPrefix(v.(string), "//") { return v, nil } else { diff --git a/mmv1/templates/terraform/custom_expand/go/apphub_service_project.go.tmpl b/mmv1/templates/terraform/custom_expand/go/apphub_service_project.go.tmpl deleted file mode 100644 index a08ddcf1f866..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/apphub_service_project.go.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - - service_project := "projects/" + d.Get("service_project_attachment_id").(string) - - return service_project, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/array_resourceref_with_validation.go.tmpl b/mmv1/templates/terraform/custom_expand/go/array_resourceref_with_validation.go.tmpl deleted file mode 100644 index 3493454ce2e5..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/array_resourceref_with_validation.go.tmpl +++ /dev/null @@ -1,30 +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 $.IsSet }} - v = v.(*schema.Set).List() -{{- end }} - l := v.([]interface{}) - req := make([]interface{}, 0, len(l)) - for _, raw := range l { - if raw == nil { - return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: nil") - } - f, err := {{ template "expandResourceRef" dict "VarName" "raw.(string)" "ResourceRef" $.ItemType.ResourceRef "ResourceType" $.ItemType.ResourceType}} - if err != nil { - return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: %s", err) - } - req = append(req, f.RelativeLink()) - } - return req, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/base64.go.tmpl b/mmv1/templates/terraform/custom_expand/go/base64.go.tmpl deleted file mode 100644 index d8a4241f722a..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/base64.go.tmpl +++ /dev/null @@ -1,19 +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 - } - - return base64.StdEncoding.EncodeToString([]byte(v.(string))), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/bigquery_access_role.go.tmpl b/mmv1/templates/terraform/custom_expand/go/bigquery_access_role.go.tmpl deleted file mode 100644 index d789edc7091e..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/bigquery_access_role.go.tmpl +++ /dev/null @@ -1,22 +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 - } - - if primitiveRole, ok := bigqueryAccessRoleToPrimitiveMap[v.(string)]; ok { - return primitiveRole, nil - } - return v, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/bigquery_dataset_ref.go.tmpl b/mmv1/templates/terraform/custom_expand/go/bigquery_dataset_ref.go.tmpl deleted file mode 100644 index bb63a9cf7784..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/bigquery_dataset_ref.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. -*/ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - l := v.([]interface{}) - if len(l) == 0 || l[0] == nil { - return nil, nil - } - raw := l[0] - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - - transformedProjectId := original["project_id"] - if val := reflect.ValueOf(transformedProjectId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["projectId"] = transformedProjectId - } - - transformedDatasetId := original["dataset_id"] - if val := reflect.ValueOf(transformedDatasetId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["datasetId"] = transformedDatasetId - } - - if parts := bigqueryDatasetRegexp.FindStringSubmatch(transformedDatasetId.(string)); parts != nil { - transformed["projectId"] = parts[1] - transformed["datasetId"] = parts[2] - } - - return transformed, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/bigquery_routine_ref.go.tmpl b/mmv1/templates/terraform/custom_expand/go/bigquery_routine_ref.go.tmpl deleted file mode 100644 index d80397e9e9e6..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/bigquery_routine_ref.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -func expandBigQueryRoutineRoutineReference(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - - transformed := make(map[string]interface{}) - transformed["datasetId"] = d.Get("dataset_id") - project, _ := tpgresource.GetProject(d, config) - transformed["projectId"] = project - transformed["routineId"] = d.Get("routine_id") - - return transformed, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/bigquery_table_ref.go.tmpl b/mmv1/templates/terraform/custom_expand/go/bigquery_table_ref.go.tmpl deleted file mode 100644 index 2cee71c3a8ec..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/bigquery_table_ref.go.tmpl +++ /dev/null @@ -1,44 +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) { - l := v.([]interface{}) - if len(l) == 0 || l[0] == nil { - return nil, nil - } - raw := l[0] - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - - transformedProjectId := original["project_id"] - if val := reflect.ValueOf(transformedProjectId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["projectId"] = transformedProjectId - } - - transformedDatasetId := original["dataset_id"] - if val := reflect.ValueOf(transformedDatasetId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["datasetId"] = transformedDatasetId - } - - transformedTableId := original["table_id"] - if val := reflect.ValueOf(transformedTableId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["tableId"] = transformedTableId - } - - if parts := bigqueryTableRegexp.FindStringSubmatch(transformedTableId.(string)); parts != nil { - transformed["projectId"] = parts[1] - transformed["datasetId"] = parts[2] - transformed["tableId"] = parts[3] - } - - return transformed, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/bigquery_table_ref_array.go.tmpl b/mmv1/templates/terraform/custom_expand/go/bigquery_table_ref_array.go.tmpl deleted file mode 100644 index 19fb689a348c..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/bigquery_table_ref_array.go.tmpl +++ /dev/null @@ -1,48 +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) { - l := v.([]interface{}) - req := make([]interface{}, 0, len(l)) - for _, raw := range l { - if raw == nil { - continue - } - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - - transformedProjectId := original["project_id"] - if val := reflect.ValueOf(transformedProjectId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["projectId"] = transformedProjectId - } - - transformedDatasetId := original["dataset_id"] - if val := reflect.ValueOf(transformedDatasetId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["datasetId"] = transformedDatasetId - } - - transformedTableId := original["table_id"] - if val := reflect.ValueOf(transformedTableId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["tableId"] = transformedTableId - } - - tableRef := regexp.MustCompile("projects/(.+)/datasets/(.+)/tables/(.+)") - if parts := tableRef.FindStringSubmatch(transformedTableId.(string)); parts != nil { - transformed["projectId"] = parts[1] - transformed["datasetId"] = parts[2] - transformed["tableId"] = parts[3] - } - - req = append(req, transformed) - } - return req, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/bigtable_app_profile_routing.tmpl b/mmv1/templates/terraform/custom_expand/go/bigtable_app_profile_routing.tmpl deleted file mode 100644 index ec33a04d251c..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/bigtable_app_profile_routing.tmpl +++ /dev/null @@ -1,27 +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 || !v.(bool) { - return nil, nil - } - - obj := bigtableadmin.MultiClusterRoutingUseAny{} - - clusterIds := d.Get("multi_cluster_routing_cluster_ids").([]interface{}) - - for _, id := range clusterIds { - obj.ClusterIds = append(obj.ClusterIds, id.(string)) - } - - return obj, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/billing_budget_budget_filter_labels.tmpl b/mmv1/templates/terraform/custom_expand/go/billing_budget_budget_filter_labels.tmpl deleted file mode 100644 index cb6a11a28db7..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/billing_budget_budget_filter_labels.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string][]string, error) { - if v == nil { - return map[string][]string{}, nil - } - m := make(map[string][]string) - for k, val := range v.(map[string]interface{}) { - m[k] = []string{val.(string)} - } - return m, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/binaryauthorization_attestors.tmpl b/mmv1/templates/terraform/custom_expand/go/binaryauthorization_attestors.tmpl deleted file mode 100644 index 2c871906f019..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/binaryauthorization_attestors.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. -*/ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - r := regexp.MustCompile("projects/(.+)/attestors/(.+)") - - // It's possible that all entries in the list will specify a project, in - // which case the user wouldn't necessarily have to specify a provider - // project. - var project string - var err error - for _, s := range v.(*schema.Set).List() { - if !r.MatchString(s.(string)) { - project, err = tpgresource.GetProject(d, config) - if err != nil { - return []interface{}{}, err - } - break - } - } - - return tpgresource.ConvertAndMapStringArr(v.(*schema.Set).List(), func(s string) string { - if r.MatchString(s) { - return s - } - - return fmt.Sprintf("projects/%s/attestors/%s", project, s) - }), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/bool_to_object.go.tmpl b/mmv1/templates/terraform/custom_expand/go/bool_to_object.go.tmpl deleted file mode 100644 index ce0c8bfd5895..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/bool_to_object.go.tmpl +++ /dev/null @@ -1,19 +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 || !v.(bool) { - return nil, nil - } - - return struct{}{}, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/bool_to_upper_string.tmpl b/mmv1/templates/terraform/custom_expand/go/bool_to_upper_string.tmpl deleted file mode 100644 index 100af9c9d271..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/bool_to_upper_string.tmpl +++ /dev/null @@ -1,19 +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 - } - - return strings.ToUpper(strconv.FormatBool(v.(bool))), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/certificate_manager_certificate_construct_full_url.go.tmpl b/mmv1/templates/terraform/custom_expand/go/certificate_manager_certificate_construct_full_url.go.tmpl deleted file mode 100644 index fabce69a7f41..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/certificate_manager_certificate_construct_full_url.go.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 expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil { - return nil, nil - } - l := v.([]interface{}) - req := make([]interface{}, 0, len(l)) - for _, raw := range l { - if raw == nil { - return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: nil") - } - if strings.HasPrefix(raw.(string), "//") || strings.HasPrefix(raw.(string), "https://") { - // Any full URL will be passed to the API request (regardless of the resource type). This is to allow self_links of CertificateManagerCeritificate resources. - // If the full URL is an invalid reference, that should be handled by the API. - req = append(req, raw.(string)) - } else if reg,_ := regexp.Compile("projects/(.*)/locations/(.*)/certificates/(.*)") ; reg.MatchString(raw.(string)) { - // If the input is the id pattern of CertificateManagerCertificate resource, a prefix will be added to construct the full URL before constructing the API request. - self_link := "https://certificatemanager.googleapis.com/v1/" + raw.(string) - req = append(req, self_link) - } else { - return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: %v is an invalid format for a certificateManagerCertificate resource", raw.(string)) - } - } - return req, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/cloud_run_service_revision_name.tmpl b/mmv1/templates/terraform/custom_expand/go/cloud_run_service_revision_name.tmpl deleted file mode 100644 index 2d22f0215d33..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/cloud_run_service_revision_name.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if d.Get("autogenerate_revision_name") == true { - return nil, nil - } - return v, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/cloudquotas_quota_preference_trace_id.go.tmpl b/mmv1/templates/terraform/custom_expand/go/cloudquotas_quota_preference_trace_id.go.tmpl deleted file mode 100644 index 1518e1014a61..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/cloudquotas_quota_preference_trace_id.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return nil, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/compute_full_url.tmpl b/mmv1/templates/terraform/custom_expand/go/compute_full_url.tmpl deleted file mode 100644 index 1e1d3dd1fd32..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/compute_full_url.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 expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil || v.(string) == "" { - return "", nil - } - f, err := {{ template "expandResourceRef" dict "VarName" "v.(string)" "ResourceRef" $.ResourceRef "ResourceType" $.ResourceType}} - if err != nil { - return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: %s", err) - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}"+f.RelativeLink()) - if err != nil { - return nil, err - } - - return url, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/compute_instance_settings_fingerprint.tmpl b/mmv1/templates/terraform/custom_expand/go/compute_instance_settings_fingerprint.tmpl deleted file mode 100644 index f98f54248e63..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/compute_instance_settings_fingerprint.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, err - } - - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return nil, err - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceSettings/{{"{{"}}name{{"}}"}}") - if err != nil { - return nil, err - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: userAgent, - }) - - if err != nil { - return nil, err - } - - return res["fingerprint"], nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/computed_lite_subscription_topic.tmpl b/mmv1/templates/terraform/custom_expand/go/computed_lite_subscription_topic.tmpl deleted file mode 100644 index 548fc4d52118..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/computed_lite_subscription_topic.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. -*/ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - project, err := tpgresource.GetProject(d, config) - if err != nil { - return "", err - } - - zone, err := tpgresource.GetZone(d, config) - if err != nil { - return nil, err - } - - if zone == "" { - return nil, fmt.Errorf("zone must be non-empty - set in resource or at provider-level") - } - - topic := d.Get("topic").(string) - - re := regexp.MustCompile(`projects\/(.*)\/locations\/(.*)\/topics\/(.*)`) - match := re.FindStringSubmatch(topic) - if len(match) == 4 { - return topic, nil - } else { - // If no full topic given, we expand it to a full topic on the same project - fullTopic := fmt.Sprintf("projects/%s/locations/%s/topics/%s", project, zone, topic) - if err := d.Set("topic", fullTopic); err != nil { - return nil, fmt.Errorf("Error setting topic: %s", err) - } - return fullTopic, nil - } -} diff --git a/mmv1/templates/terraform/custom_expand/go/computed_subscription_topic.tmpl b/mmv1/templates/terraform/custom_expand/go/computed_subscription_topic.tmpl deleted file mode 100644 index 940524b196cf..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/computed_subscription_topic.tmpl +++ /dev/null @@ -1,33 +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) { - project, err := tpgresource.GetProject(d, config) - if err != nil { - return "", err - } - - topic := d.Get("topic").(string) - - re := regexp.MustCompile(`projects\/(.*)\/topics\/(.*)`) - match := re.FindStringSubmatch(topic) - if len(match) == 3 { - return topic, nil - } else { - // If no full topic given, we expand it to a full topic on the same project - fullTopic := fmt.Sprintf("projects/%s/topics/%s", project, topic) - if err := d.Set("topic", fullTopic); err != nil { - return nil, fmt.Errorf("Error setting topic: %s", err) - } - return fullTopic, nil - } -} diff --git a/mmv1/templates/terraform/custom_expand/go/container_analysis_note.tmpl b/mmv1/templates/terraform/custom_expand/go/container_analysis_note.tmpl deleted file mode 100644 index e613350a9020..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/container_analysis_note.tmpl +++ /dev/null @@ -1,25 +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) { - r := regexp.MustCompile("projects/(.+)/notes/(.+)") - if r.MatchString(v.(string)) { - return v.(string), nil - } - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, err - } - - return fmt.Sprintf("projects/%s/notes/%s", project, v.(string)), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/containerattached_cluster_authorization_user.go.tmpl b/mmv1/templates/terraform/custom_expand/go/containerattached_cluster_authorization_user.go.tmpl deleted file mode 100644 index 4d3eba6ea01b..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/containerattached_cluster_authorization_user.go.tmpl +++ /dev/null @@ -1,66 +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. -*/ -}} - -type attachedClusterUser struct { - Username string `json:"username"` -} - -type attachedClusterGroup struct { - Group string `json:"group"` -} - -// The custom expander transforms input into something like this: -// authorization { -// admin_users [ -// { username = "user1" }, -// { username = "user2" } -// ] -// admin_groups [ -// { group = "group1" }, -// { group = "group2" }, -// ] -// } -// The custom flattener transforms input back into something like this: -// authorization { -// admin_users = [ -// "user1", -// "user2" -// ] -// admin_groups = [ -// "group1", -// "group2" -// ], -// } -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - l := v.([]interface{}) - if len(l) == 0 || l[0] == nil { - return nil, nil - } - raw := l[0] - orig := raw.(map[string]interface{})["admin_users"].([]interface{}) - transformed := make(map[string][]interface{}) - transformed["admin_users"] = make([]interface{}, len(orig)) - for i, u := range orig { - if u != nil { - transformed["admin_users"][i] = attachedClusterUser{ Username: u.(string) } - } - } - orig = raw.(map[string]interface{})["admin_groups"].([]interface{}) - transformed["admin_groups"] = make([]interface{}, len(orig)) - for i, u := range orig { - if u != nil { - transformed["admin_groups"][i] = attachedClusterGroup{ Group: u.(string) } - } - } - return transformed, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/containerattached_cluster_empty_logging.go.tmpl b/mmv1/templates/terraform/custom_expand/go/containerattached_cluster_empty_logging.go.tmpl deleted file mode 100644 index 6714aa99383f..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/containerattached_cluster_empty_logging.go.tmpl +++ /dev/null @@ -1,60 +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) { - l := v.([]interface{}) - if len(l) == 0 || l[0] == nil { - transformed := make(map[string]interface{}) - return transformed, nil - } - raw := l[0] - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - - transformedComponentConfig, err := expandContainerAttachedClusterLoggingConfigComponentConfig(original["component_config"], d, config) - if err != nil { - return nil, err - } else { - transformed["componentConfig"] = transformedComponentConfig - } - - return transformed, nil -} - -func expandContainerAttachedClusterLoggingConfigComponentConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - l := v.([]interface{}) - if len(l) == 0 { - return nil, nil - } - - if l[0] == nil { - transformed := make(map[string]interface{}) - return transformed, nil - } - raw := l[0] - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - - transformedEnableComponents, err := expandContainerAttachedClusterLoggingConfigComponentConfigEnableComponents(original["enable_components"], d, config) - if err != nil { - return nil, err - } else { - transformed["enableComponents"] = transformedEnableComponents - } - - return transformed, nil -} - -func expandContainerAttachedClusterLoggingConfigComponentConfigEnableComponents(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/data_catalog_tag.go.tmpl b/mmv1/templates/terraform/custom_expand/go/data_catalog_tag.go.tmpl deleted file mode 100644 index cd2e2bde8c67..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/data_catalog_tag.go.tmpl +++ /dev/null @@ -1,22 +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) { - // we flattened the original["enum_value"]["display_name"] object to be just original["enum_value"] so here, - // v is the value we want from the config - transformed := make(map[string]interface{}) - if val := reflect.ValueOf(v); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["displayName"] = v - } - - return transformed, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/datastream_stream_dataset_id.go.tmpl b/mmv1/templates/terraform/custom_expand/go/datastream_stream_dataset_id.go.tmpl deleted file mode 100644 index 58b5fc887c66..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/datastream_stream_dataset_id.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. -*/ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - s := v.(string) - re := regexp.MustCompile(`projects/(.+)/datasets/([^\.\?\#]+)`) - paths := re.FindStringSubmatch(s) - if len(paths) == 3 { - project := paths[1] - datasetId := paths[2] - return fmt.Sprintf("%s:%s", project, datasetId), nil - } - - return s, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/days_to_duration_string.go.tmpl b/mmv1/templates/terraform/custom_expand/go/days_to_duration_string.go.tmpl deleted file mode 100644 index e07883db9d16..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/days_to_duration_string.go.tmpl +++ /dev/null @@ -1,26 +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 - } - i, ok := v.(int) - if !ok { - return nil, fmt.Errorf("unexpected value is not int: %v", v) - } - if i == 0 { - return "", nil - } - // Day = 86400s - return fmt.Sprintf("%ds", i * 86400), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/default_to_project.go.tmpl b/mmv1/templates/terraform/custom_expand/go/default_to_project.go.tmpl deleted file mode 100644 index f87a2056ccd1..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/default_to_project.go.tmpl +++ /dev/null @@ -1,22 +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. -*/ -}} -// If the property hasn't been explicitly set in config use the project defined by the provider or env. -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil { - project, err := tpgresource.GetProject(d, config) - if err != nil { - return project, nil - } - } - return v, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/disk_consistency_group_policy.tmpl b/mmv1/templates/terraform/custom_expand/go/disk_consistency_group_policy.tmpl deleted file mode 100644 index 4aa4b5ead7e2..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/disk_consistency_group_policy.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 expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - l := v.([]interface{}) - - if len(l) == 0 || l[0] == nil { - return nil, nil - } - raw := l[0] - original := raw.(map[string]interface{}) - if isEnabled, ok := original["enabled"]; ok { - if !isEnabled.(bool) { - return nil, nil - } - } - transformed := make(map[string]interface{}) - return transformed, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/dns_managed_zone_private_visibility_config.go.tmpl b/mmv1/templates/terraform/custom_expand/go/dns_managed_zone_private_visibility_config.go.tmpl deleted file mode 100644 index 18cb76ef57ca..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/dns_managed_zone_private_visibility_config.go.tmpl +++ /dev/null @@ -1,103 +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) { - l := v.([]interface{}) - if len(l) == 0 || l[0] == nil { - // The API won't remove the the field unless an empty network array is sent. - transformed := make(map[string]interface{}) - emptyNetwork := make([]interface{}, 0) - transformed["networks"] = emptyNetwork - return transformed, nil - } - raw := l[0] - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - - transformedGkeClusters, err := expandDNSManagedZonePrivateVisibilityConfigGkeClusters(original["gke_clusters"], d, config) - if err != nil { - return nil, err - } else if val := reflect.ValueOf(transformedGkeClusters); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["gkeClusters"] = transformedGkeClusters - } - - transformedNetworks, err := expandDNSManagedZonePrivateVisibilityConfigNetworks(original["networks"], d, config) - if err != nil { - return nil, err - } else if val := reflect.ValueOf(transformedNetworks); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["networks"] = transformedNetworks - } - - return transformed, nil -} - -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}Networks(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - v = v.(*schema.Set).List() - l := v.([]interface{}) - req := make([]interface{}, 0, len(l)) - for _, raw := range l { - if raw == nil { - continue - } - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - - transformedNetworkUrl, err := expandDNSManagedZonePrivateVisibilityConfigNetworksNetworkUrl(original["network_url"], d, config) - if err != nil { - return nil, err - } else if val := reflect.ValueOf(transformedNetworkUrl); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["networkUrl"] = transformedNetworkUrl - } - - req = append(req, transformed) - } - return req, nil -} - -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}GkeClusters(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - l := v.([]interface{}) - req := make([]interface{}, 0, len(l)) - for _, raw := range l { - if raw == nil { - continue - } - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - - transformedGkeClusterName, err := expandDNSManagedZonePrivateVisibilityConfigGkeClustersGkeClusterName(original["gke_cluster_name"], d, config) - if err != nil { - return nil, err - } else if val := reflect.ValueOf(transformedGkeClusterName); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["gkeClusterName"] = transformedGkeClusterName - } - - req = append(req, transformed) - } - return req, nil -} - -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}NetworksNetworkUrl(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil || v.(string) == "" { - return "", nil - } else if strings.HasPrefix(v.(string), "https://") { - return v, nil - } - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}"+v.(string)) - if err != nil { - return "", err - } - return tpgresource.ConvertSelfLinkToV1(url), nil -} - -func expandDNSManagedZonePrivateVisibilityConfigGkeClustersGkeClusterName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/empty_object_if_set.go.tmpl b/mmv1/templates/terraform/custom_expand/go/empty_object_if_set.go.tmpl deleted file mode 100644 index 7bd0c2ac381c..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/empty_object_if_set.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Expands an empty terraform config into an empty object. - * - * Used to differentate a user specifying an empty block versus a null/unset block. - * - * This is unique from send_empty_value, which will send an explicit null value - * for empty configuration blocks. - */ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil { - return nil, nil - } - - l := v.([]interface{}) - if len(l) == 0 { - return nil, nil - } - // A set, but empty object. - return struct{}{}, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/enum_bool.go.tmpl b/mmv1/templates/terraform/custom_expand/go/enum_bool.go.tmpl deleted file mode 100644 index 0c5d3853da14..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/enum_bool.go.tmpl +++ /dev/null @@ -1,23 +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 - } - - b, err := strconv.ParseBool(v.(string)) - if err != nil { - return nil, nil - } - return b, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/firestore_field_index_config.go.tmpl b/mmv1/templates/terraform/custom_expand/go/firestore_field_index_config.go.tmpl deleted file mode 100644 index f12f6770e897..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/firestore_field_index_config.go.tmpl +++ /dev/null @@ -1,52 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - // We drop all output only fields as they are unnecessary. - if v == nil { - return nil, nil - } - - l := v.([]interface{}) - if len(l) == 0 { - return nil, nil - } - - transformedIndexConfig := make(map[string]interface{}) - - // A configured, but empty, index_config block should be sent. This is how a user would remove all indexes. - if l[0] == nil { - return transformedIndexConfig, nil - } - - indexConfig := l[0].(map[string]interface{}) - - // For Single field indexes, we put the field configuration on the index to avoid forced nesting. - // Push all order/arrayConfig down into a single element fields list. - l = indexConfig["indexes"].(*schema.Set).List() - transformedIndexes := make([]interface{}, 0, len(l)) - for _, raw := range l { - if raw == nil { - continue - } - original := raw.(map[string]interface{}) - transformed := make(map[string]interface{}) - transformedField := make(map[string]interface{}) - - if val := reflect.ValueOf(original["query_scope"]); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["queryScope"] = original["query_scope"] - } - - if val := reflect.ValueOf(original["order"]); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformedField["order"] = original["order"] - } - - if val := reflect.ValueOf(original["array_config"]); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformedField["arrayConfig"] = original["array_config"] - } - transformed["fields"] = [1]interface{}{ - transformedField, - } - - transformedIndexes = append(transformedIndexes, transformed) - } - transformedIndexConfig["indexes"] = transformedIndexes - return transformedIndexConfig, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/firewall_log_config.go.tmpl b/mmv1/templates/terraform/custom_expand/go/firewall_log_config.go.tmpl deleted file mode 100644 index 32f3feb64713..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/firewall_log_config.go.tmpl +++ /dev/null @@ -1,31 +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) { - l := v.([]interface{}) - transformed := make(map[string]interface{}) - - if len(l) == 0 || l[0] == nil { - // send enable = enable_logging value to ensure correct logging status if there is no config - transformed["enable"] = d.Get("enable_logging").(bool) - return transformed, nil - } - - raw := l[0] - original := raw.(map[string]interface{}) - - // The log_config block is specified, so logging should be enabled - transformed["enable"] = true - transformed["metadata"] = original["metadata"] - - return transformed, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/gke_hub_membership.tmpl b/mmv1/templates/terraform/custom_expand/go/gke_hub_membership.tmpl deleted file mode 100644 index 21f522d77dbc..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/gke_hub_membership.tmpl +++ /dev/null @@ -1,20 +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 strings.HasPrefix(v.(string), "//") { - return v, nil - } else { - v = "//container.googleapis.com/" + v.(string) - return v, nil - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/json_schema.tmpl b/mmv1/templates/terraform/custom_expand/go/json_schema.tmpl deleted file mode 100644 index 47d4ad2420f5..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/json_schema.tmpl +++ /dev/null @@ -1,23 +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) { - b := []byte(v.(string)) - if len(b) == 0 { - return nil, nil - } - m := make(map[string]interface{}) - if err := json.Unmarshal(b, &m); err != nil { - return nil, err - } - return m, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/json_value.tmpl b/mmv1/templates/terraform/custom_expand/go/json_value.tmpl deleted file mode 100644 index 5402fe154bd7..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/json_value.tmpl +++ /dev/null @@ -1,23 +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) { - b := []byte(v.(string)) - if len(b) == 0 { - return nil, nil - } - var j interface{} - if err := json.Unmarshal(b, &j); err != nil { - return nil, err - } - return j, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/name_or_name_prefix.go.tmpl b/mmv1/templates/terraform/custom_expand/go/name_or_name_prefix.go.tmpl deleted file mode 100644 index 7f57f25f3d02..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/name_or_name_prefix.go.tmpl +++ /dev/null @@ -1,34 +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) { - var certName string - if v, ok := d.GetOk("name"); ok { - certName = v.(string) - } else if v, ok := d.GetOk("name_prefix"); ok { - prefix := v.(string) - if len(prefix) > 37 { - certName = tpgresource.ReducedPrefixedUniqueId(prefix) - } else { - certName = id.PrefixedUniqueId(prefix) - } - } else { - certName = id.UniqueId() - } - - // We need to get the {{"{{"}}name{{"}}"}} into schema to set the ID using tpgresource.ReplaceVars - if err := d.Set("name", certName); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - - return certName, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/network_full_url.tmpl b/mmv1/templates/terraform/custom_expand/go/network_full_url.tmpl deleted file mode 100644 index 4920bdc72a82..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/network_full_url.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil || v.(string) == "" { - return "", nil - } else if strings.HasPrefix(v.(string), "https://") { - return v, nil - } - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}" + v.(string)) - if err != nil { - return "", err - } - return tpgresource.ConvertSelfLinkToV1(url), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/network_management_connectivity_test_name.go.tmpl b/mmv1/templates/terraform/custom_expand/go/network_management_connectivity_test_name.go.tmpl deleted file mode 100644 index 895be69be76c..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/network_management_connectivity_test_name.go.tmpl +++ /dev/null @@ -1,20 +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) { - // projects/X/tests/Y - note not "connectivityTests" - f, err := tpgresource.ParseGlobalFieldValue("tests", v.(string), "project", d, config, true) - if err != nil { - return nil, fmt.Errorf("Invalid value for zone: %s", err) - } - return f.RelativeLink(), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/preserved_state_disks.go.tmpl b/mmv1/templates/terraform/custom_expand/go/preserved_state_disks.go.tmpl deleted file mode 100644 index 99354e968cd4..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/preserved_state_disks.go.tmpl +++ /dev/null @@ -1,41 +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 map[string]interface{}{}, nil - } - l := v.(*schema.Set).List() - req := make(map[string]interface{}) - for _, raw := range l { - if raw == nil { - continue - } - original := raw.(map[string]interface{}) - deviceName := original["device_name"].(string) - diskObj := make(map[string]interface{}) - deleteRule := original["delete_rule"].(string) - if deleteRule != "" { - diskObj["autoDelete"] = deleteRule - } - source := original["source"] - if source != "" { - diskObj["source"] = source - } - mode := original["mode"] - if source != "" { - diskObj["mode"] = mode - } - req[deviceName] = diskObj - } - return req, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/privateca_certificate_509_config.go.tmpl b/mmv1/templates/terraform/custom_expand/go/privateca_certificate_509_config.go.tmpl deleted file mode 100644 index deb1179b7cee..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/privateca_certificate_509_config.go.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -{{/* See mmv1/third_party/terraform/utils/privateca_utils.go for the sub-expanders and explanation */}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil { - return v, nil - } - l := v.([]interface{}) - if len(l) == 0 || l[0] == nil { - return nil, nil - } - raw := l[0] - original := raw.(map[string]interface{}) - if len(original) == 0 { - return nil, nil - } - transformed := make(map[string]interface{}) - - caOptions, err := expandPrivatecaCertificateConfigX509ConfigCaOptions(original["ca_options"], d, config) - if err != nil { - return nil, err - } - transformed["caOptions"] = caOptions - - keyUsage, err := expandPrivatecaCertificateConfigX509ConfigKeyUsage(original["key_usage"], d, config) - if err != nil { - return nil, err - } - transformed["keyUsage"] = keyUsage - - policyIds, err := expandPrivatecaCertificateConfigX509ConfigPolicyIds(original["policy_ids"], d, config) - if err != nil { - return nil, err - } - transformed["policyIds"] = policyIds - - aiaOcspServers, err := expandPrivatecaCertificateConfigX509ConfigAiaOcspServers(original["aia_ocsp_servers"], d, config) - if err != nil { - return nil, err - } - transformed["aiaOcspServers"] = aiaOcspServers - - addExts, err := expandPrivatecaCertificateConfigX509ConfigAdditionalExtensions(original["additional_extensions"], d, config) - if err != nil { - return nil, err - } - transformed["additionalExtensions"] = addExts - - nameConstraints, err := expandPrivatecaCertificateConfigX509ConfigNameConstraints(original["name_constraints"], d, config) - if err != nil { - return nil, err - } - transformed["nameConstraints"] = nameConstraints - return transformed, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/pubsublite_topic_reservation_config_throughput_reservation.go.tmpl b/mmv1/templates/terraform/custom_expand/go/pubsublite_topic_reservation_config_throughput_reservation.go.tmpl deleted file mode 100644 index 94203257c486..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/pubsublite_topic_reservation_config_throughput_reservation.go.tmpl +++ /dev/null @@ -1,20 +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) { - f, err := tpgresource.ParseRegionalFieldValue("reservations", v.(string), "project", "region", "zone", d, config, true) - if err != nil { - return nil, fmt.Errorf("Invalid value for throughput_reservation: %s", err) - } - // Custom due to "locations" rather than "regions". - return fmt.Sprintf("projects/%s/locations/%s/reservations/%s", f.Project, f.Region, f.Name), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/qualify_queue_name.go.tmpl b/mmv1/templates/terraform/custom_expand/go/qualify_queue_name.go.tmpl deleted file mode 100644 index fad52fe80fac..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/qualify_queue_name.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/queues/{{"{{"}}name{{"}}"}}") -} diff --git a/mmv1/templates/terraform/custom_expand/go/redis_instance_authorized_network.tmpl b/mmv1/templates/terraform/custom_expand/go/redis_instance_authorized_network.tmpl deleted file mode 100644 index 34c8043fb995..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/redis_instance_authorized_network.tmpl +++ /dev/null @@ -1,19 +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) { - fv, err := tpgresource.ParseNetworkFieldValue(v.(string), d, config) - if err != nil { - return nil, err - } - return fv.RelativeLink(), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/reference_to_backend.tmpl b/mmv1/templates/terraform/custom_expand/go/reference_to_backend.tmpl deleted file mode 100644 index dac33816188e..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/reference_to_backend.tmpl +++ /dev/null @@ -1,55 +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. -*/ -}} -{{/* This provides the best long-form self link possible given the input. - If the input is a full URL including scheme, we return it unmodified - https://compute.googleapis.com/v1/projects/foo/regions/bar/backendBuckets/baz -> (the same) - If the input is a partial self-link, we return it with the compute base path in front. - projects/foo/regions/bar/backendServices/baz -> https://compute.googleapis.com/v1/projects/foo/regions/bar/backendServices/baz - If the input is an even-more-partial link (not including projects), we return it with the compute base path - and the specified project in front - regions/bar/backendServices/baz -> https://compute.googleapis.com/v1/projects/provider-project/regions/bar/backendServices/baz - If the input is just project/region/name, region/name, or just name, we treat it like a backendService. - baz -> https://compute.googleapis.com/v1/projects/provider-project/regions/provider-region/backendServices/baz - bar/baz -> https://compute.googleapis.com/v1/projects/provider-project/regions/bar/backendServices/baz - foo/bar/baz -> https://compute.googleapis.com/v1/projects/foo/regions/bar/backendServices/baz */ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - // This method returns a full self link from whatever the input is. - if v == nil || v.(string) == "" { - // It does not try to construct anything from empty. - return "", nil - } else if strings.HasPrefix(v.(string), "https://") { - // Anything that starts with a URL scheme is assumed to be a self link worth using. - return v, nil - } else if strings.HasPrefix(v.(string), "projects/") { - // If the self link references a project, we'll just stuck the compute prefix on it - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}" + v.(string)) - if err != nil { - return "", err - } - return url, nil - } else if strings.HasPrefix(v.(string), "regions/") || strings.HasPrefix(v.(string), "zones/") { - // For regional or zonal resources which include their region or zone, just put the project in front. - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/") - if err != nil { - return nil, err - } - return url + v.(string), nil - } - // Anything else is assumed to be a reference to a global backend service. - f, err := tpgresource.ParseGlobalFieldValue("backendServices", v.(string), "project", d, config, true) - if err != nil { - return "", err - } - - return f.RelativeLink(), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/resource_from_self_link.go.tmpl b/mmv1/templates/terraform/custom_expand/go/resource_from_self_link.go.tmpl deleted file mode 100644 index 24432fe6f0ae..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/resource_from_self_link.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return tpgresource.GetResourceNameFromSelfLink(v.(string)), nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/resourceref_with_validation.go.tmpl b/mmv1/templates/terraform/custom_expand/go/resourceref_with_validation.go.tmpl deleted file mode 100644 index 973e737d8467..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/resourceref_with_validation.go.tmpl +++ /dev/null @@ -1,19 +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) { - f, err := {{ template "expandResourceRef" dict "VarName" "v.(string)" "ResourceRef" $.ResourceRef "ResourceType" $.ResourceType}} - if err != nil { - return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: %s", err) - } - return f.RelativeLink(), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/route_gateway.tmpl b/mmv1/templates/terraform/custom_expand/go/route_gateway.tmpl deleted file mode 100644 index b9d2602e8a4b..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/route_gateway.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == "default-internet-gateway" { - return tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/global/gateways/default-internet-gateway") - } else { - return v, nil - } -} diff --git a/mmv1/templates/terraform/custom_expand/go/route_instance.tmpl b/mmv1/templates/terraform/custom_expand/go/route_instance.tmpl deleted file mode 100644 index a8a987311501..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/route_instance.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == "" { - return v, nil - } - val, err := tpgresource.ParseZonalFieldValue("instances", v.(string), "project", "next_hop_instance_zone", d, config, true) - if err != nil { - return nil, err - } - - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return nil, err - } - - nextInstance, err := config.NewComputeClient(userAgent).Instances.Get(val.Project, val.Zone, val.Name).Do() - if err != nil { - return nil, err - } - return nextInstance.SelfLink, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/sd_full_url.tmpl b/mmv1/templates/terraform/custom_expand/go/sd_full_url.tmpl deleted file mode 100644 index 3cb26b0eb83a..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/sd_full_url.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil || v.(string) == "" { - return "", nil - } else if strings.HasPrefix(v.(string), "https://") { - return v, nil - } - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ServiceDirectoryBasePath{{"}}"}}" + v.(string)) - if err != nil { - return "", err - } - return url, nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/secret_version_enable.go.tmpl b/mmv1/templates/terraform/custom_expand/go/secret_version_enable.go.tmpl deleted file mode 100644 index f1bd48c68a16..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/secret_version_enable.go.tmpl +++ /dev/null @@ -1,50 +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) { - name := d.Get("name").(string) - if name == "" { - return "", nil - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SecretManagerBasePath{{"}}"}}{{"{{"}}name{{"}}"}}") - if err != nil { - return nil, err - } - - if v == true { - url = fmt.Sprintf("%s:enable", url) - } else { - url = fmt.Sprintf("%s:disable", url) - } - - parts := strings.Split(name, "/") - project := parts[1] - - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return nil, err - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return nil, err - } - - return nil, nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/go/secret_version_secret_data.go.tmpl b/mmv1/templates/terraform/custom_expand/go/secret_version_secret_data.go.tmpl deleted file mode 100644 index d9bb2b8f6045..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/secret_version_secret_data.go.tmpl +++ /dev/null @@ -1,22 +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 - } - - if d.Get("is_secret_data_base64").(bool) { - return v, nil - } - return base64.StdEncoding.EncodeToString([]byte(v.(string))), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/self_link_from_name.tmpl b/mmv1/templates/terraform/custom_expand/go/self_link_from_name.tmpl deleted file mode 100644 index 5b26c6437d99..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/self_link_from_name.tmpl +++ /dev/null @@ -1,44 +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) { - // This method returns a full self link from a partial self link. - if v == nil || v.(string) == "" { - // It does not try to construct anything from empty. - return "", nil - } else if strings.HasPrefix(v.(string), "https://") { - // Anything that starts with a URL scheme is assumed to be a self link worth using. - return v, nil - } else if strings.HasPrefix(v.(string), "projects/") { - // If the self link references a project, we'll just stuck the compute prefix on it - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}" + v.(string)) - if err != nil { - return "", err - } - return url, nil - } else if strings.HasPrefix(v.(string), "regions/") || strings.HasPrefix(v.(string), "zones/") { - // For regional or zonal resources which include their region or zone, just put the project in front. - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/") - if err != nil { - return nil, err - } - return url + v.(string), nil - } - // Anything else is assumed to be a regional resource, with a partial link that begins with the resource name. - // This isn't very likely - it's a last-ditch effort to extract something useful here. We can do a better job - // as soon as MultiResourceRefs are working since we'll know the types that this field is supposed to point to. - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/") - if err != nil { - return nil, err - } - return url + v.(string), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/set_to_list.tmpl b/mmv1/templates/terraform/custom_expand/go/set_to_list.tmpl deleted file mode 100644 index 1e47f3889c55..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/set_to_list.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v.(*schema.Set).List(), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/shortname_to_url.go.tmpl b/mmv1/templates/terraform/custom_expand/go/shortname_to_url.go.tmpl deleted file mode 100644 index fd1532722ff6..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/shortname_to_url.go.tmpl +++ /dev/null @@ -1,15 +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) { - return tpgresource.ReplaceVars(d, config, "{{$.GetIdFormat}}") -} diff --git a/mmv1/templates/terraform/custom_expand/go/spanner_instance_config.go.tmpl b/mmv1/templates/terraform/custom_expand/go/spanner_instance_config.go.tmpl deleted file mode 100644 index 693581a253f4..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/spanner_instance_config.go.tmpl +++ /dev/null @@ -1,25 +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) { - r := regexp.MustCompile("projects/(.+)/instanceConfigs/(.+)") - if r.MatchString(v.(string)) { - return v.(string), nil - } - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, err - } - - return fmt.Sprintf("projects/%s/instanceConfigs/%s", project, v.(string)), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/string_to_lower_case.go.tmpl b/mmv1/templates/terraform/custom_expand/go/string_to_lower_case.go.tmpl deleted file mode 100644 index 5b419947c9ca..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/string_to_lower_case.go.tmpl +++ /dev/null @@ -1,19 +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 - } - - return strings.ToLower(v.(string)), nil -} diff --git a/mmv1/templates/terraform/custom_expand/go/subnetwork_log_config.go.tmpl b/mmv1/templates/terraform/custom_expand/go/subnetwork_log_config.go.tmpl deleted file mode 100644 index f545370b60c1..000000000000 --- a/mmv1/templates/terraform/custom_expand/go/subnetwork_log_config.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. -*/ -}} -func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - l := v.([]interface{}) - transformed := make(map[string]interface{}) - if len(l) == 0 || l[0] == nil { - purpose, ok := d.GetOkExists("purpose") - - if ok &&(purpose.(string) == "REGIONAL_MANAGED_PROXY" || purpose.(string) == "GLOBAL_MANAGED_PROXY" || purpose.(string) == "INTERNAL_HTTPS_LOAD_BALANCER") { - // Subnetworks for regional L7 ILB/XLB or cross-regional L7 ILB do not accept any values for logConfig - return nil, nil - } - // send enable = false to ensure logging is disabled if there is no config - transformed["enable"] = false - return transformed, nil - } - - raw := l[0] - original := raw.(map[string]interface{}) - - // The log_config block is specified, so logging should be enabled - transformed["enable"] = true - transformed["aggregationInterval"] = original["aggregation_interval"] - transformed["flowSampling"] = original["flow_sampling"] - transformed["metadata"] = original["metadata"] - transformed["filterExpr"] = original["filter_expr"] - - // make it JSON marshallable - transformed["metadataFields"] = original["metadata_fields"].(*schema.Set).List() - - return transformed, nil -} diff --git a/mmv1/templates/terraform/custom_expand/json_schema.tmpl b/mmv1/templates/terraform/custom_expand/json_schema.tmpl index edd3267214d4..47d4ad2420f5 100644 --- a/mmv1/templates/terraform/custom_expand/json_schema.tmpl +++ b/mmv1/templates/terraform/custom_expand/json_schema.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { b := []byte(v.(string)) if len(b) == 0 { return nil, nil diff --git a/mmv1/templates/terraform/custom_expand/json_value.tmpl b/mmv1/templates/terraform/custom_expand/json_value.tmpl index ef93275e22ae..5402fe154bd7 100644 --- a/mmv1/templates/terraform/custom_expand/json_value.tmpl +++ b/mmv1/templates/terraform/custom_expand/json_value.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { b := []byte(v.(string)) if len(b) == 0 { return nil, nil diff --git a/mmv1/templates/terraform/custom_expand/name_or_name_prefix.go.tmpl b/mmv1/templates/terraform/custom_expand/name_or_name_prefix.go.tmpl index eef5ae03a552..7f57f25f3d02 100644 --- a/mmv1/templates/terraform/custom_expand/name_or_name_prefix.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/name_or_name_prefix.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { var certName string if v, ok := d.GetOk("name"); ok { certName = v.(string) @@ -27,7 +25,7 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t certName = id.UniqueId() } - // We need to get the {{name}} into schema to set the ID using tpgresource.ReplaceVars + // We need to get the {{"{{"}}name{{"}}"}} into schema to set the ID using tpgresource.ReplaceVars if err := d.Set("name", certName); err != nil { return nil, fmt.Errorf("Error setting name: %s", err) } diff --git a/mmv1/templates/terraform/custom_expand/network_full_url.tmpl b/mmv1/templates/terraform/custom_expand/network_full_url.tmpl index e56940514f9a..4920bdc72a82 100644 --- a/mmv1/templates/terraform/custom_expand/network_full_url.tmpl +++ b/mmv1/templates/terraform/custom_expand/network_full_url.tmpl @@ -1,10 +1,10 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if v == nil || v.(string) == "" { return "", nil } else if strings.HasPrefix(v.(string), "https://") { return v, nil } - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}" + v.(string)) + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}" + v.(string)) if err != nil { return "", err } diff --git a/mmv1/templates/terraform/custom_expand/network_management_connectivity_test_name.go.tmpl b/mmv1/templates/terraform/custom_expand/network_management_connectivity_test_name.go.tmpl index 15aa5144d0da..895be69be76c 100644 --- a/mmv1/templates/terraform/custom_expand/network_management_connectivity_test_name.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/network_management_connectivity_test_name.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { // projects/X/tests/Y - note not "connectivityTests" f, err := tpgresource.ParseGlobalFieldValue("tests", v.(string), "project", d, config, true) if err != nil { diff --git a/mmv1/templates/terraform/custom_expand/preserved_state_disks.go.tmpl b/mmv1/templates/terraform/custom_expand/preserved_state_disks.go.tmpl index 91be38146e18..99354e968cd4 100644 --- a/mmv1/templates/terraform/custom_expand/preserved_state_disks.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/preserved_state_disks.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 map[string]interface{}{}, nil } diff --git a/mmv1/templates/terraform/custom_expand/privateca_certificate_509_config.go.tmpl b/mmv1/templates/terraform/custom_expand/privateca_certificate_509_config.go.tmpl index a48f813ef15e..deb1179b7cee 100644 --- a/mmv1/templates/terraform/custom_expand/privateca_certificate_509_config.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/privateca_certificate_509_config.go.tmpl @@ -1,5 +1,5 @@ -<%# See mmv1/third_party/terraform/utils/privateca_utils.go for the sub-expanders and explanation %> -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* See mmv1/third_party/terraform/utils/privateca_utils.go for the sub-expanders and explanation */}} +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if v == nil { return v, nil } diff --git a/mmv1/templates/terraform/custom_expand/pubsublite_topic_reservation_config_throughput_reservation.go.tmpl b/mmv1/templates/terraform/custom_expand/pubsublite_topic_reservation_config_throughput_reservation.go.tmpl index 7264f96554aa..94203257c486 100644 --- a/mmv1/templates/terraform/custom_expand/pubsublite_topic_reservation_config_throughput_reservation.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/pubsublite_topic_reservation_config_throughput_reservation.go.tmpl @@ -1,18 +1,16 @@ -<%# # the license inside this if block pertains to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { f, err := tpgresource.ParseRegionalFieldValue("reservations", v.(string), "project", "region", "zone", d, config, true) if err != nil { return nil, fmt.Errorf("Invalid value for throughput_reservation: %s", err) diff --git a/mmv1/templates/terraform/custom_expand/qualify_queue_name.go.tmpl b/mmv1/templates/terraform/custom_expand/qualify_queue_name.go.tmpl index 3861cefcb01c..fad52fe80fac 100644 --- a/mmv1/templates/terraform/custom_expand/qualify_queue_name.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/qualify_queue_name.go.tmpl @@ -1,3 +1,3 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/queues/{{name}}") +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/queues/{{"{{"}}name{{"}}"}}") } diff --git a/mmv1/templates/terraform/custom_expand/redis_instance_authorized_network.tmpl b/mmv1/templates/terraform/custom_expand/redis_instance_authorized_network.tmpl index c4a465ca3cef..34c8043fb995 100644 --- a/mmv1/templates/terraform/custom_expand/redis_instance_authorized_network.tmpl +++ b/mmv1/templates/terraform/custom_expand/redis_instance_authorized_network.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { fv, err := tpgresource.ParseNetworkFieldValue(v.(string), d, config) if err != nil { return nil, err diff --git a/mmv1/templates/terraform/custom_expand/reference_to_backend.tmpl b/mmv1/templates/terraform/custom_expand/reference_to_backend.tmpl index e236d5b86fd2..dac33816188e 100644 --- a/mmv1/templates/terraform/custom_expand/reference_to_backend.tmpl +++ b/mmv1/templates/terraform/custom_expand/reference_to_backend.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -<%# This provides the best long-form self link possible given the input. +{{/* + 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. +*/ -}} +{{/* This provides the best long-form self link possible given the input. If the input is a full URL including scheme, we return it unmodified https://compute.googleapis.com/v1/projects/foo/regions/bar/backendBuckets/baz -> (the same) If the input is a partial self-link, we return it with the compute base path in front. @@ -23,9 +21,8 @@ If the input is just project/region/name, region/name, or just name, we treat it like a backendService. baz -> https://compute.googleapis.com/v1/projects/provider-project/regions/provider-region/backendServices/baz bar/baz -> https://compute.googleapis.com/v1/projects/provider-project/regions/bar/backendServices/baz - foo/bar/baz -> https://compute.googleapis.com/v1/projects/foo/regions/bar/backendServices/baz --%> -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + foo/bar/baz -> https://compute.googleapis.com/v1/projects/foo/regions/bar/backendServices/baz */ -}} +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { // This method returns a full self link from whatever the input is. if v == nil || v.(string) == "" { // It does not try to construct anything from empty. @@ -35,14 +32,14 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t return v, nil } else if strings.HasPrefix(v.(string), "projects/") { // If the self link references a project, we'll just stuck the compute prefix on it - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}" + v.(string)) + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}" + v.(string)) if err != nil { return "", err } return url, nil } else if strings.HasPrefix(v.(string), "regions/") || strings.HasPrefix(v.(string), "zones/") { // For regional or zonal resources which include their region or zone, just put the project in front. - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/custom_expand/resource_from_self_link.go.tmpl b/mmv1/templates/terraform/custom_expand/resource_from_self_link.go.tmpl index d9496ae2f292..24432fe6f0ae 100644 --- a/mmv1/templates/terraform/custom_expand/resource_from_self_link.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/resource_from_self_link.go.tmpl @@ -1,3 +1,3 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return tpgresource.GetResourceNameFromSelfLink(v.(string)), nil } \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_expand/resourceref_with_validation.go.tmpl b/mmv1/templates/terraform/custom_expand/resourceref_with_validation.go.tmpl index 555dc5b8e827..973e737d8467 100644 --- a/mmv1/templates/terraform/custom_expand/resourceref_with_validation.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/resourceref_with_validation.go.tmpl @@ -1,21 +1,19 @@ -<%# The license inside this block applies to this file. -# Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - f, err := <%= build_expand_resource_ref('v.(string)', property, pwd) %> +{{/* + 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) { + f, err := {{ template "expandResourceRef" dict "VarName" "v.(string)" "ResourceRef" $.ResourceRef "ResourceType" $.ResourceType}} if err != nil { - return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: %s", err) + return nil, fmt.Errorf("Invalid value for {{underscore $.Name}}: %s", err) } return f.RelativeLink(), nil } diff --git a/mmv1/templates/terraform/custom_expand/route_gateway.tmpl b/mmv1/templates/terraform/custom_expand/route_gateway.tmpl index 9a054c46ed71..b9d2602e8a4b 100644 --- a/mmv1/templates/terraform/custom_expand/route_gateway.tmpl +++ b/mmv1/templates/terraform/custom_expand/route_gateway.tmpl @@ -1,6 +1,6 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if v == "default-internet-gateway" { - return tpgresource.ReplaceVars(d, config, "projects/{{project}}/global/gateways/default-internet-gateway") + return tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/global/gateways/default-internet-gateway") } else { return v, nil } diff --git a/mmv1/templates/terraform/custom_expand/route_instance.tmpl b/mmv1/templates/terraform/custom_expand/route_instance.tmpl index 08e14f0d8010..a8a987311501 100644 --- a/mmv1/templates/terraform/custom_expand/route_instance.tmpl +++ b/mmv1/templates/terraform/custom_expand/route_instance.tmpl @@ -1,4 +1,4 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if v == "" { return v, nil } diff --git a/mmv1/templates/terraform/custom_expand/sd_full_url.tmpl b/mmv1/templates/terraform/custom_expand/sd_full_url.tmpl index 1ea5e504f4a7..3cb26b0eb83a 100644 --- a/mmv1/templates/terraform/custom_expand/sd_full_url.tmpl +++ b/mmv1/templates/terraform/custom_expand/sd_full_url.tmpl @@ -1,10 +1,10 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { if v == nil || v.(string) == "" { return "", nil } else if strings.HasPrefix(v.(string), "https://") { return v, nil } - url, err := tpgresource.ReplaceVars(d, config, "{{ServiceDirectoryBasePath}}" + v.(string)) + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ServiceDirectoryBasePath{{"}}"}}" + v.(string)) if err != nil { return "", err } diff --git a/mmv1/templates/terraform/custom_expand/secret_version_enable.go.tmpl b/mmv1/templates/terraform/custom_expand/secret_version_enable.go.tmpl index 93d5a429b039..f1bd48c68a16 100644 --- a/mmv1/templates/terraform/custom_expand/secret_version_enable.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/secret_version_enable.go.tmpl @@ -1,24 +1,22 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { name := d.Get("name").(string) if name == "" { return "", nil } - url, err := tpgresource.ReplaceVars(d, config, "{{SecretManagerBasePath}}{{name}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SecretManagerBasePath{{"}}"}}{{"{{"}}name{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/custom_expand/secret_version_secret_data.go.tmpl b/mmv1/templates/terraform/custom_expand/secret_version_secret_data.go.tmpl index 1ac3a0450046..d9bb2b8f6045 100644 --- a/mmv1/templates/terraform/custom_expand/secret_version_secret_data.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/secret_version_secret_data.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_expand/self_link_from_name.tmpl b/mmv1/templates/terraform/custom_expand/self_link_from_name.tmpl index b870e0781075..5b26c6437d99 100644 --- a/mmv1/templates/terraform/custom_expand/self_link_from_name.tmpl +++ b/mmv1/templates/terraform/custom_expand/self_link_from_name.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { // This method returns a full self link from a partial self link. if v == nil || v.(string) == "" { // It does not try to construct anything from empty. @@ -22,14 +20,14 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t return v, nil } else if strings.HasPrefix(v.(string), "projects/") { // If the self link references a project, we'll just stuck the compute prefix on it - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}" + v.(string)) + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}" + v.(string)) if err != nil { return "", err } return url, nil } else if strings.HasPrefix(v.(string), "regions/") || strings.HasPrefix(v.(string), "zones/") { // For regional or zonal resources which include their region or zone, just put the project in front. - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/") if err != nil { return nil, err } @@ -38,7 +36,7 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t // Anything else is assumed to be a regional resource, with a partial link that begins with the resource name. // This isn't very likely - it's a last-ditch effort to extract something useful here. We can do a better job // as soon as MultiResourceRefs are working since we'll know the types that this field is supposed to point to. - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/custom_expand/set_to_list.tmpl b/mmv1/templates/terraform/custom_expand/set_to_list.tmpl index 186dd757eb9d..1e47f3889c55 100644 --- a/mmv1/templates/terraform/custom_expand/set_to_list.tmpl +++ b/mmv1/templates/terraform/custom_expand/set_to_list.tmpl @@ -1,3 +1,3 @@ -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v.(*schema.Set).List(), nil } diff --git a/mmv1/templates/terraform/custom_expand/shortname_to_url.go.tmpl b/mmv1/templates/terraform/custom_expand/shortname_to_url.go.tmpl index de17e56c274c..fd1532722ff6 100644 --- a/mmv1/templates/terraform/custom_expand/shortname_to_url.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/shortname_to_url.go.tmpl @@ -1,17 +1,15 @@ -<%# # the license inside this if block pertains to this file - # Copyright 2019 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return tpgresource.ReplaceVars(d, config, "<%= id_format(object) -%>") +{{/* + 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) { + return tpgresource.ReplaceVars(d, config, "{{$.GetIdFormat}}") } diff --git a/mmv1/templates/terraform/custom_expand/spanner_instance_config.go.tmpl b/mmv1/templates/terraform/custom_expand/spanner_instance_config.go.tmpl index cbd958e46284..693581a253f4 100644 --- a/mmv1/templates/terraform/custom_expand/spanner_instance_config.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/spanner_instance_config.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { r := regexp.MustCompile("projects/(.+)/instanceConfigs/(.+)") if r.MatchString(v.(string)) { return v.(string), nil diff --git a/mmv1/templates/terraform/custom_expand/string_to_lower_case.go.tmpl b/mmv1/templates/terraform/custom_expand/string_to_lower_case.go.tmpl index f15345a0e229..5b419947c9ca 100644 --- a/mmv1/templates/terraform/custom_expand/string_to_lower_case.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/string_to_lower_case.go.tmpl @@ -1,18 +1,16 @@ -<%- # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_expand/subnetwork_log_config.go.tmpl b/mmv1/templates/terraform/custom_expand/subnetwork_log_config.go.tmpl index ba30a64eb5c7..f545370b60c1 100644 --- a/mmv1/templates/terraform/custom_expand/subnetwork_log_config.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/subnetwork_log_config.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +{{/* + 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) { l := v.([]interface{}) transformed := make(map[string]interface{}) if len(l) == 0 || l[0] == 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 acd645f8d830..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 @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v } diff --git a/mmv1/templates/terraform/custom_flatten/alloydb_cluster_input_automated_backup_policy_start_times_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/alloydb_cluster_input_automated_backup_policy_start_times_flatten.go.tmpl index 6a7aeea1f4c5..5f6683e17f4c 100644 --- a/mmv1/templates/terraform/custom_flatten/alloydb_cluster_input_automated_backup_policy_start_times_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/alloydb_cluster_input_automated_backup_policy_start_times_flatten.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/alloydb_cluster_input_user_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/alloydb_cluster_input_user_flatten.go.tmpl index 3b0355ee67a2..ff16cc4b1143 100644 --- a/mmv1/templates/terraform/custom_flatten/alloydb_cluster_input_user_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/alloydb_cluster_input_user_flatten.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return []interface{}{ map[string]interface{}{ "user": d.Get("initial_user.0.user"), diff --git a/mmv1/templates/terraform/custom_flatten/apigee_organization_property.go.tmpl b/mmv1/templates/terraform/custom_flatten/apigee_organization_property.go.tmpl index 0f75532bbe1c..50d88829e20f 100644 --- a/mmv1/templates/terraform/custom_flatten/apigee_organization_property.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/apigee_organization_property.go.tmpl @@ -1,18 +1,16 @@ -<%# 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/appengine_standardappversion_automatic_scaling_handlenil.go.tmpl b/mmv1/templates/terraform/custom_flatten/appengine_standardappversion_automatic_scaling_handlenil.go.tmpl index f79aa1ff1596..1037f7555d69 100644 --- a/mmv1/templates/terraform/custom_flatten/appengine_standardappversion_automatic_scaling_handlenil.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/appengine_standardappversion_automatic_scaling_handlenil.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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 flattenAppEngineStandardAppVersionAutomaticScaling(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil diff --git a/mmv1/templates/terraform/custom_flatten/apphub_service_project.go.tmpl b/mmv1/templates/terraform/custom_flatten/apphub_service_project.go.tmpl index 05cb8d57c1d5..fe2bcdd0c44a 100644 --- a/mmv1/templates/terraform/custom_flatten/apphub_service_project.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/apphub_service_project.go.tmpl @@ -1,3 +1,3 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return nil } diff --git a/mmv1/templates/terraform/custom_flatten/artifactregistry_rr_disable_upstream_validation.go.tmpl b/mmv1/templates/terraform/custom_flatten/artifactregistry_rr_disable_upstream_validation.go.tmpl index 197ec87c1b13..878dcbc33bcc 100644 --- a/mmv1/templates/terraform/custom_flatten/artifactregistry_rr_disable_upstream_validation.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/artifactregistry_rr_disable_upstream_validation.go.tmpl @@ -1,3 +1,3 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("remote_repository_config.0.disable_upstream_validation") } diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_connection_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_connection_flatten.go.tmpl index b680c22ffa63..a9920df36c10 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_connection_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_connection_flatten.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return []interface{}{ map[string]interface{}{ "username": d.Get("cloud_sql.0.credential.0.username"), diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_dataset_location.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_dataset_location.go.tmpl index ac9ae9619fde..b38e659db266 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_dataset_location.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_dataset_location.go.tmpl @@ -1,21 +1,19 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // Older Datasets in BigQuery have no Location set in the API response. This may be an issue when importing // datasets created before BigQuery was available in multiple zones. We can safely assume that these datasets // are in the US, as this was the default at the time. -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return "US" } diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_dataset_ref.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_dataset_ref.go.tmpl index 5b1a4532b4b0..2a8191828c01 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_dataset_ref.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_dataset_ref.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_kms_version.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_kms_version.go.tmpl index 76eda8ef5d5e..5ac2e603d8bf 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_kms_version.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_kms_version.go.tmpl @@ -1,20 +1,18 @@ -<%# The license inside this block applies to this file. - # Copyright 2021 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. --%> +{{/* + 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. +*/ -}} // KmsKeyName switched from using a key name to a key version, this will separate the key name from the key version and save them // separately in state. https://github.com/hashicorp/terraform-provider-google/issues/9208 -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return []map[string]interface{}{} } @@ -33,6 +31,6 @@ func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d } // The key name was returned, no need to set the version - return []map[string]interface{}{{"kms_key_name": kmsKeyName, "kms_key_version": ""}} + return []map[string]interface{}{{"{{"}}"kms_key_name": kmsKeyName, "kms_key_version": ""{{"}}"}} } diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref.go.tmpl index 0cedffc26ac1..19b040c8cc5e 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref.go.tmpl @@ -1,18 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{- define "bigqueryTableRegexp"}} +{{- /* + 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 } @@ -25,9 +24,10 @@ func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d transformed["dataset_id"] = original["datasetId"] transformed["table_id"] = original["tableId"] - if bigqueryTableRegexp.MatchString(d.Get("<%= prop_path -%>").(string)) { + if bigqueryTableRegexp.MatchString(d.Get("{{$.PropPath}}").(string)) { // The user specified the table_id as a URL, so store it in state that way transformed["table_id"] = fmt.Sprintf("projects/%s/datasets/%s/tables/%s", transformed["project_id"], transformed["dataset_id"], transformed["table_id"]) } return []interface{}{transformed} } +{{- end}} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_copy_destinationtable.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_copy_destinationtable.go.tmpl index fc4d6f3f55bc..ec6d1a68ee35 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_copy_destinationtable.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_copy_destinationtable.go.tmpl @@ -1,18 +1,13 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> -<%= lines(compile_template(pwd + '/templates/terraform/custom_flatten/bigquery_table_ref.go.erb', - prefix: prefix, - property: property, - prop_path: 'copy.0.destination_table.0.table_id')) -%> +{{- /* + 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. +*/}} +{{- template "bigqueryTableRegexp" dict "PropPath" "copy.0.destination_table.0.table_id" "GetPrefix" $.GetPrefix "TitlelizeProperty" $.TitlelizeProperty}} diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_copy_sourcetables.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_copy_sourcetables.go.tmpl index 53713db5c910..1e0934965e9d 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_copy_sourcetables.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_copy_sourcetables.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_extract_sourcetable.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_extract_sourcetable.go.tmpl index 702bd0f39ac7..19f1aaddc784 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_extract_sourcetable.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_extract_sourcetable.go.tmpl @@ -1,18 +1,13 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> -<%= lines(compile_template(pwd + '/templates/terraform/custom_flatten/bigquery_table_ref.go.erb', - prefix: prefix, - property: property, - prop_path: 'extract.0.source_table.0.table_id')) -%> +{{- /* + 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. +*/}} +{{- template "bigqueryTableRegexp" dict "PropPath" "extract.0.source_table.0.table_id" "GetPrefix" $.GetPrefix "TitlelizeProperty" $.TitlelizeProperty}} diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_load_destinationtable.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_load_destinationtable.go.tmpl index 5d258fd07710..ee5e9e53aebf 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_load_destinationtable.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_load_destinationtable.go.tmpl @@ -1,18 +1,13 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> -<%= lines(compile_template(pwd + '/templates/terraform/custom_flatten/bigquery_table_ref.go.erb', - prefix: prefix, - property: property, - prop_path: 'load.0.destination_table.0.table_id')) -%> +{{- /* + 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. +*/}} +{{- template "bigqueryTableRegexp" dict "PropPath" "load.0.destination_table.0.table_id" "GetPrefix" $.GetPrefix "TitlelizeProperty" $.TitlelizeProperty}} diff --git a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_query_destinationtable.go.tmpl b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_query_destinationtable.go.tmpl index c70252648382..b4ce17ad8aed 100644 --- a/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_query_destinationtable.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigquery_table_ref_query_destinationtable.go.tmpl @@ -1,18 +1,13 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> -<%= lines(compile_template(pwd + '/templates/terraform/custom_flatten/bigquery_table_ref.go.erb', - prefix: prefix, - property: property, - prop_path: 'query.0.destination_table.0.table_id')) -%> +{{- /* + 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. +*/}} +{{- template "bigqueryTableRegexp" dict "PropPath" "query.0.destination_table.0.table_id" "GetPrefix" $.GetPrefix "TitlelizeProperty" $.TitlelizeProperty}} diff --git a/mmv1/templates/terraform/custom_flatten/bigtable_app_profile_routing.tmpl b/mmv1/templates/terraform/custom_flatten/bigtable_app_profile_routing.tmpl index 7fc43277cbab..510165a22154 100644 --- a/mmv1/templates/terraform/custom_flatten/bigtable_app_profile_routing.tmpl +++ b/mmv1/templates/terraform/custom_flatten/bigtable_app_profile_routing.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 false } diff --git a/mmv1/templates/terraform/custom_flatten/billing_budget_budget_filter_labels.tmpl b/mmv1/templates/terraform/custom_flatten/billing_budget_budget_filter_labels.tmpl index 725f53cf01b1..9eec6328db3d 100644 --- a/mmv1/templates/terraform/custom_flatten/billing_budget_budget_filter_labels.tmpl +++ b/mmv1/templates/terraform/custom_flatten/billing_budget_budget_filter_labels.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { /* note: api only accepts below format. Also only takes a single element in the array labels = { diff --git a/mmv1/templates/terraform/custom_flatten/cloud_scheduler_paused.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloud_scheduler_paused.go.tmpl index 1872d984f99b..8ee8c6524dc9 100644 --- a/mmv1/templates/terraform/custom_flatten/cloud_scheduler_paused.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloud_scheduler_paused.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { state := d.Get("state"); if state == "PAUSED" { return true diff --git a/mmv1/templates/terraform/custom_flatten/cloudbuild_approval_required.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloudbuild_approval_required.go.tmpl index 37cce011e7d6..a50dfe88b47f 100644 --- a/mmv1/templates/terraform/custom_flatten/cloudbuild_approval_required.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloudbuild_approval_required.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { transformed := make(map[string]interface{}) if v == nil { // Disabled by default, but API will not return object if value is false diff --git a/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_admin.go.tmpl b/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_admin.go.tmpl index 775865de6963..ef5c426a2141 100644 --- a/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_admin.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_admin.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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 flattenClouddomainsRegistrationContactSettingsAdminContact(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil diff --git a/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_registrant.go.tmpl b/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_registrant.go.tmpl index 0a4c5922b97d..cfa9cd3d9f55 100644 --- a/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_registrant.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_registrant.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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 flattenClouddomainsRegistrationContactSettingsRegistrantContact(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil diff --git a/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_technical.go.tmpl b/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_technical.go.tmpl index 77a60e7d7574..6b1bff930e59 100644 --- a/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_technical.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/clouddomains_ignore_numbers_technical.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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 flattenClouddomainsRegistrationContactSettingsTechnicalContact(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil diff --git a/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_bucket.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_bucket.go.tmpl index 89490535f551..81a6e12e495a 100644 --- a/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_bucket.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_bucket.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. -# Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { // This flatten function is shared between the resource and the datasource. // TF Input format: {bucket-name} // GET Response format: gcf-v2-sources-{Project-number}-{location} diff --git a/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_generation.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_generation.go.tmpl index 529f82bad4d4..ffdee7b68523 100644 --- a/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_generation.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_generation.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { // This flatten function is shared between the resource and the datasource. // TF Input will use the generation from the source object // GET Response will use the generation from the automatically created object diff --git a/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_object.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_object.go.tmpl index 94048c2bb5be..e0fe7cbe43ac 100644 --- a/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_object.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloudfunctions2_function_source_object.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { // This flatten function is shared between the resource and the datasource. // TF Input format: {object-name} // GET Response format: {function-name}/{object-name} diff --git a/mmv1/templates/terraform/custom_flatten/cloudquotas_quota_preference_annotations.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloudquotas_quota_preference_annotations.go.tmpl index 6ace95aae077..dd0b44bfb93f 100644 --- a/mmv1/templates/terraform/custom_flatten/cloudquotas_quota_preference_annotations.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloudquotas_quota_preference_annotations.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { // ignore read on this field return d.Get("quota_config.0.annotations") } \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.tmpl index 9f5d58b79dfc..3ec5347a2c72 100644 --- a/mmv1/templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { // We want to ignore read on this field, but cannot because it is nested return d.Get("spec.0.force_override") } \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/cloudscheduler_job_appenginerouting.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloudscheduler_job_appenginerouting.go.tmpl index 205484e551c1..23ee53ece4eb 100644 --- a/mmv1/templates/terraform/custom_flatten/cloudscheduler_job_appenginerouting.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloudscheduler_job_appenginerouting.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // An `appEngineRouting` in API response is useless, so we set config values rather than api response to state. -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil } diff --git a/mmv1/templates/terraform/custom_flatten/cloudtasks_queue_appenginerouting.go.tmpl b/mmv1/templates/terraform/custom_flatten/cloudtasks_queue_appenginerouting.go.tmpl index 4be2d37acafa..8ff917aed00d 100644 --- a/mmv1/templates/terraform/custom_flatten/cloudtasks_queue_appenginerouting.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/cloudtasks_queue_appenginerouting.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // service, version, and instance are input-only. host is output-only. -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil } diff --git a/mmv1/templates/terraform/custom_flatten/go/compute_backend_service_iap_oauth2_client_secret.go.tmpl b/mmv1/templates/terraform/custom_flatten/compute_backend_service_iap_oauth2_client_secret.go.tmpl similarity index 100% rename from mmv1/templates/terraform/custom_flatten/go/compute_backend_service_iap_oauth2_client_secret.go.tmpl rename to mmv1/templates/terraform/custom_flatten/compute_backend_service_iap_oauth2_client_secret.go.tmpl diff --git a/mmv1/templates/terraform/custom_flatten/compute_router_range.go.tmpl b/mmv1/templates/terraform/custom_flatten/compute_router_range.go.tmpl index d1de877cd166..a4afe3f63d8a 100644 --- a/mmv1/templates/terraform/custom_flatten/compute_router_range.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/compute_router_range.go.tmpl @@ -1,18 +1,16 @@ -<%# 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/compute_snapshot_snapshot_encryption_raw_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/compute_snapshot_snapshot_encryption_raw_key.go.tmpl index 4aef96a08330..cfd37d6dec6c 100644 --- a/mmv1/templates/terraform/custom_flatten/compute_snapshot_snapshot_encryption_raw_key.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/compute_snapshot_snapshot_encryption_raw_key.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("snapshot_encryption_key.0.raw_key") } diff --git a/mmv1/templates/terraform/custom_flatten/consumer_quote_override_override_value.go.tmpl b/mmv1/templates/terraform/custom_flatten/consumer_quote_override_override_value.go.tmpl index 8af0f1f66ffb..e019df6cddab 100644 --- a/mmv1/templates/terraform/custom_flatten/consumer_quote_override_override_value.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/consumer_quote_override_override_value.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2021 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 "0" } diff --git a/mmv1/templates/terraform/custom_flatten/containerattached_cluster_authorization_user.go.tmpl b/mmv1/templates/terraform/custom_flatten/containerattached_cluster_authorization_user.go.tmpl index 149cd64b2b7c..7a145d0ade70 100644 --- a/mmv1/templates/terraform/custom_flatten/containerattached_cluster_authorization_user.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/containerattached_cluster_authorization_user.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} // The custom expander transforms input into something like this: // authorization { @@ -35,7 +33,7 @@ // "group2" // ], // } -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil || len(v.(map[string]interface{})) == 0 { return nil } diff --git a/mmv1/templates/terraform/custom_flatten/data_catalog_tag.go.tmpl b/mmv1/templates/terraform/custom_flatten/data_catalog_tag.go.tmpl index 5691eee5286d..7a3a3c7efb03 100644 --- a/mmv1/templates/terraform/custom_flatten/data_catalog_tag.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/data_catalog_tag.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.tmpl index f195587d25ee..4781b335b4dc 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("alloydb.0.settings.0.initial_user.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.tmpl index 49b2f957cd99..e5ad4fb53244 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("cloudsql.0.settings.0.root_password") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.tmpl index 0ad1b94ef1a5..4da22b3453b5 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("mysql.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.tmpl index 33648e980347..0f98aebf4469 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("mysql.0.ssl.0.ca_certificate") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.tmpl index 12642c3eee91..613153fcf0ac 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("mysql.0.ssl.0.client_certificate") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.tmpl index cfb8e4e179bb..40bfb2fed102 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("mysql.0.ssl.0.client_key") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_forward_ssh_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_forward_ssh_password.go.tmpl index 774e9f17e76b..6e7a408a3b84 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_forward_ssh_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_forward_ssh_password.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("oracle.0.forward_ssh_connectivity.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_forward_ssh_private_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_forward_ssh_private_key.go.tmpl index 16cf92af8fac..55b25a952269 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_forward_ssh_private_key.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_forward_ssh_private_key.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("oracle.0.forward_ssh_connectivity.0.private_key") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_password.go.tmpl index 4d9c6d1a0fcc..05f0399cf243 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_password.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("oracle.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_ca_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_ca_certificate.go.tmpl index 0d31e81f2f6d..2dc49161499f 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_ca_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_ca_certificate.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("oracle.0.ssl.0.ca_certificate") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_client_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_client_certificate.go.tmpl index fbe627f6f98e..e990ab44bada 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_client_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_client_certificate.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("oracle.0.ssl.0.client_certificate") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_client_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_client_key.go.tmpl index 9fec3ce7e75b..35f46ad59a02 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_client_key.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_oracle_ssl_client_key.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("oracle.0.ssl.0.client_key") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.tmpl index 5419875c1185..a3a3597a8005 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("postgresql.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.tmpl index 1f4163c5c3fe..a6ee3a208f81 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("postgresql.0.ssl.0.ca_certificate") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.tmpl index 3cba545eb312..51a56266b40c 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("postgresql.0.ssl.0.client_certificate") } diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.tmpl index 7b2a10501360..0890ed843a19 100644 --- a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("postgresql.0.ssl.0.client_key") } diff --git a/mmv1/templates/terraform/custom_flatten/dataplex_datascan_ignore_profile_result.go.tmpl b/mmv1/templates/terraform/custom_flatten/dataplex_datascan_ignore_profile_result.go.tmpl index facbad6df5ce..377720040b0c 100644 --- a/mmv1/templates/terraform/custom_flatten/dataplex_datascan_ignore_profile_result.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/dataplex_datascan_ignore_profile_result.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { // We want to ignore read on this field, but cannot because it is nested return nil } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_password.go.tmpl index bab24e3a65f5..3d39974fbfe2 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_password.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("forward_ssh_connectivity.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_private_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_private_key.go.tmpl index 22e6d5ddc78b..e78406acd183 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_private_key.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_forward_ssh_connectivity_private_key.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("forward_ssh_connectivity.0.private_key") } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_password.go.tmpl index a039a15c4bc2..6b9fa6fdb940 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_password.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("mysql_profile.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_ca_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_ca_certificate.go.tmpl index ce18cf20c952..16045abdbd41 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_ca_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_ca_certificate.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("mysql_profile.0.ssl_config.0.ca_certificate") } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_certificate.go.tmpl index 6bc2cb9475fa..27439273695b 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_certificate.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_certificate.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("mysql_profile.0.ssl_config.0.client_certificate") } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_key.go.tmpl index acd24274e01d..d20130e621a5 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_key.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_mysql_profile_ssl_config_client_key.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("mysql_profile.0.ssl_config.0.client_key") } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_oracle_profile_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_oracle_profile_password.go.tmpl index bc09e22c0584..dfd854d7a631 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_oracle_profile_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_oracle_profile_password.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("oracle_profile.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_postgresql_profile_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_postgresql_profile_password.go.tmpl index 3309928e6302..b4c7ac7f58da 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_postgresql_profile_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_postgresql_profile_password.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("postgresql_profile.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_sql_server_profile_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_sql_server_profile_password.go.tmpl index ec1b45435cf8..dfb1adb3079a 100644 --- a/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_sql_server_profile_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/datastream_connection_profile_sql_server_profile_password.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> -<%# Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("sql_server_profile.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/default_if_empty.tmpl b/mmv1/templates/terraform/custom_flatten/default_if_empty.tmpl index d78b3fc4b48c..f68ee25c1e23 100644 --- a/mmv1/templates/terraform/custom_flatten/default_if_empty.tmpl +++ b/mmv1/templates/terraform/custom_flatten/default_if_empty.tmpl @@ -1,28 +1,26 @@ -<%# 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. --%> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{- /* + 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 || tpgresource.IsEmptyValue(reflect.ValueOf(v)) { - return <%= go_literal(property.default_value) -%> + return {{$.GoLiteral $.DefaultValue}} } -<%- if property.is_a?(Api::Type::Integer) -%> +{{ if $.IsA "Integer" -}} // Handles the string fixed64 format if strVal, ok := v.(string); ok { if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { return intVal } // let terraform core handle it if we can't convert the string to an int. } -<%- end %> +{{ end }} return v } diff --git a/mmv1/templates/terraform/custom_flatten/dialogflowcx_agent_git_integration_settings_github_settings.go.tmpl b/mmv1/templates/terraform/custom_flatten/dialogflowcx_agent_git_integration_settings_github_settings.go.tmpl index bf689e0f2566..80840c50a804 100644 --- a/mmv1/templates/terraform/custom_flatten/dialogflowcx_agent_git_integration_settings_github_settings.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/dialogflowcx_agent_git_integration_settings_github_settings.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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 flattenDialogflowCXAgentGitIntegrationSettingsGithubSettings(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil diff --git a/mmv1/templates/terraform/custom_flatten/discoveryengine_schema_json_schema.go.tmpl b/mmv1/templates/terraform/custom_flatten/discoveryengine_schema_json_schema.go.tmpl index d0c6a9d7a30f..7eb7c54775a2 100644 --- a/mmv1/templates/terraform/custom_flatten/discoveryengine_schema_json_schema.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/discoveryengine_schema_json_schema.go.tmpl @@ -1,19 +1,17 @@ -<%# 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. --%> +{{/* + 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil } diff --git a/mmv1/templates/terraform/custom_flatten/disk_consistency_group_policy.tmpl b/mmv1/templates/terraform/custom_flatten/disk_consistency_group_policy.tmpl index a0d4e4124f9d..5cf7420ee985 100644 --- a/mmv1/templates/terraform/custom_flatten/disk_consistency_group_policy.tmpl +++ b/mmv1/templates/terraform/custom_flatten/disk_consistency_group_policy.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/duration_string_to_days.go.tmpl b/mmv1/templates/terraform/custom_flatten/duration_string_to_days.go.tmpl index ed675ca3a611..cf0d58b309fe 100644 --- a/mmv1/templates/terraform/custom_flatten/duration_string_to_days.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/duration_string_to_days.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/enum_bool.go.tmpl b/mmv1/templates/terraform/custom_flatten/enum_bool.go.tmpl index ef3917b5f086..4a47f1d6b392 100644 --- a/mmv1/templates/terraform/custom_flatten/enum_bool.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/enum_bool.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return "" } diff --git a/mmv1/templates/terraform/custom_flatten/filestore_instance_networks_reserved_ip_range.go.tmpl b/mmv1/templates/terraform/custom_flatten/filestore_instance_networks_reserved_ip_range.go.tmpl index fbeda7892254..5197a4ac8970 100644 --- a/mmv1/templates/terraform/custom_flatten/filestore_instance_networks_reserved_ip_range.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/filestore_instance_networks_reserved_ip_range.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("networks.0.reserved_ip_range") } diff --git a/mmv1/templates/terraform/custom_flatten/firestore_field_index_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/firestore_field_index_config.go.tmpl index e928a5d40703..826438e12e62 100644 --- a/mmv1/templates/terraform/custom_flatten/firestore_field_index_config.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/firestore_field_index_config.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}) { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}) { if v == nil { return v } diff --git a/mmv1/templates/terraform/custom_flatten/firewall_log_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/firewall_log_config.go.tmpl index d6a7555cd66c..028b752dc260 100644 --- a/mmv1/templates/terraform/custom_flatten/firewall_log_config.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/firewall_log_config.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/float64_to_int.go.tmpl b/mmv1/templates/terraform/custom_flatten/float64_to_int.go.tmpl index 45c174c11cb7..2571835abb2e 100644 --- a/mmv1/templates/terraform/custom_flatten/float64_to_int.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/float64_to_int.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { // Handles int given in float64 format if floatVal, ok := v.(float64); ok { return int(floatVal) diff --git a/mmv1/templates/terraform/custom_flatten/float64_to_int_to_string.go.tmpl b/mmv1/templates/terraform/custom_flatten/float64_to_int_to_string.go.tmpl old mode 100755 new mode 100644 index a364e8b468f7..b97dadbf439f --- a/mmv1/templates/terraform/custom_flatten/float64_to_int_to_string.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/float64_to_int_to_string.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { // Handles int given in float64 format if floatVal, ok := v.(float64); ok { return fmt.Sprintf("%d", int(floatVal)) diff --git a/mmv1/templates/terraform/custom_flatten/float64_to_string.go.tmpl b/mmv1/templates/terraform/custom_flatten/float64_to_string.go.tmpl old mode 100755 new mode 100644 index 199f7c3aa09d..952ac413870d --- a/mmv1/templates/terraform/custom_flatten/float64_to_string.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/float64_to_string.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData) interface{} { transformed := make(map[string]string) data := v.(map[string]interface{}) for key := range data { diff --git a/mmv1/templates/terraform/custom_flatten/full_to_relative_path.tmpl b/mmv1/templates/terraform/custom_flatten/full_to_relative_path.tmpl index 4f6bf053cd9f..d12b8a6c52a1 100644 --- a/mmv1/templates/terraform/custom_flatten/full_to_relative_path.tmpl +++ b/mmv1/templates/terraform/custom_flatten/full_to_relative_path.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v } diff --git a/mmv1/templates/terraform/custom_flatten/go/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl deleted file mode 100644 index 231fc3f35c04..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl +++ /dev/null @@ -1,811 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - l := v.([]interface{}) - apiData := make([]map[string]interface{}, 0, len(l)) - for _, raw := range l { - original := raw.(map[string]interface{}) - if len(original) < 1 { - continue - } - apiData = append(apiData, map[string]interface{}{ - "name": flattenAccessContextManagerServicePerimetersServicePerimetersName(original["name"], d, config), - "title": flattenAccessContextManagerServicePerimetersServicePerimetersTitle(original["title"], d, config), - "description": flattenAccessContextManagerServicePerimetersServicePerimetersDescription(original["description"], d, config), - "create_time": flattenAccessContextManagerServicePerimetersServicePerimetersCreateTime(original["createTime"], d, config), - "update_time": flattenAccessContextManagerServicePerimetersServicePerimetersUpdateTime(original["updateTime"], d, config), - "perimeter_type": flattenAccessContextManagerServicePerimetersServicePerimetersPerimeterType(original["perimeterType"], d, config), - "status": flattenAccessContextManagerServicePerimetersServicePerimetersStatus(original["status"], d, config), - "spec": flattenAccessContextManagerServicePerimetersServicePerimetersSpec(original["spec"], d, config), - "use_explicit_dry_run_spec": flattenAccessContextManagerServicePerimetersServicePerimetersUseExplicitDryRunSpec(original["useExplicitDryRunSpec"], d, config), - }) - } - configData := []map[string]interface{}{} - for _, item := range d.Get("service_perimeters").([]interface{}) { - configData = append(configData, item.(map[string]interface{})) - } - sorted, err := tpgresource.SortMapsByConfigOrder(configData, apiData, "name") - if err != nil { - log.Printf("[ERROR] Could not sort API response value: %s", err) - return v - } - - return sorted -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersTitle(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersDescription(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersCreateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersUpdateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersPerimeterType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil || tpgresource.IsEmptyValue(reflect.ValueOf(v)) { - return "PERIMETER_TYPE_REGULAR" - } - - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatus(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["resources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusResources(original["resources"], d, config) - transformed["access_levels"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusAccessLevels(original["accessLevels"], d, config) - transformed["restricted_services"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusRestrictedServices(original["restrictedServices"], d, config) - transformed["vpc_accessible_services"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusVpcAccessibleServices(original["vpcAccessibleServices"], d, config) - transformed["ingress_policies"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPolicies(original["ingressPolicies"], d, config) - transformed["egress_policies"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPolicies(original["egressPolicies"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusAccessLevels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusRestrictedServices(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusVpcAccessibleServices(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["enable_restriction"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusVpcAccessibleServicesEnableRestriction(original["enableRestriction"], d, config) - transformed["allowed_services"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusVpcAccessibleServicesAllowedServices(original["allowedServices"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusVpcAccessibleServicesEnableRestriction(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusVpcAccessibleServicesAllowedServices(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPolicies(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - l := v.([]interface{}) - transformed := schema.NewSet(schema.HashResource(accesscontextmanagerServicePerimetersServicePerimetersServicePerimetersStatusIngressPoliciesSchema()), []interface{}{}) - 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.Add(map[string]interface{}{ - "ingress_from": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFrom(original["ingressFrom"], d, config), - "ingress_to": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressTo(original["ingressTo"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFrom(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["identity_type"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromIdentityType(original["identityType"], d, config) - transformed["identities"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromIdentities(original["identities"], d, config) - transformed["sources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromSources(original["sources"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromIdentityType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromIdentities(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromSources(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{}{ - "access_level": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromSourcesAccessLevel(original["accessLevel"], d, config), - "resource": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromSourcesResource(original["resource"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromSourcesAccessLevel(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressFromSourcesResource(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressTo(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["resources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToResources(original["resources"], d, config) - transformed["operations"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperations(original["operations"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperations(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{}{ - "service_name": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperationsServiceName(original["serviceName"], d, config), - "method_selectors": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperationsMethodSelectors(original["methodSelectors"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperationsServiceName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperationsMethodSelectors(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{}{ - "method": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperationsMethodSelectorsMethod(original["method"], d, config), - "permission": flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperationsMethodSelectorsPermission(original["permission"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperationsMethodSelectorsMethod(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusIngressPoliciesIngressToOperationsMethodSelectorsPermission(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 - } - 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{}{ - "egress_from": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFrom(original["egressFrom"], d, config), - "egress_to": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressTo(original["egressTo"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFrom(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["identity_type"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromIdentityType(original["identityType"], d, config) - transformed["identities"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromIdentities(original["identities"], d, config) - transformed["sources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSources(original["sources"], d, config) - transformed["source_restriction"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSourceRestriction(original["sourceRestriction"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromIdentityType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromIdentities(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSources(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{}{ - "access_level": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSourcesAccessLevel(original["accessLevel"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressFromSourcesAccessLevel(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 -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressTo(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["resources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToResources(original["resources"], d, config) - transformed["external_resources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToExternalResources(original["externalResources"], d, config) - transformed["operations"] = - flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperations(original["operations"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToExternalResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperations(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{}{ - "service_name": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperationsServiceName(original["serviceName"], d, config), - "method_selectors": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperationsMethodSelectors(original["methodSelectors"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperationsServiceName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperationsMethodSelectors(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{}{ - "method": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperationsMethodSelectorsMethod(original["method"], d, config), - "permission": flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperationsMethodSelectorsPermission(original["permission"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperationsMethodSelectorsMethod(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersStatusEgressPoliciesEgressToOperationsMethodSelectorsPermission(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 - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["resources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecResources(original["resources"], d, config) - transformed["access_levels"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecAccessLevels(original["accessLevels"], d, config) - transformed["restricted_services"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecRestrictedServices(original["restrictedServices"], d, config) - transformed["vpc_accessible_services"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecVpcAccessibleServices(original["vpcAccessibleServices"], d, config) - transformed["ingress_policies"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPolicies(original["ingressPolicies"], d, config) - transformed["egress_policies"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPolicies(original["egressPolicies"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecAccessLevels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecRestrictedServices(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecVpcAccessibleServices(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["enable_restriction"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecVpcAccessibleServicesEnableRestriction(original["enableRestriction"], d, config) - transformed["allowed_services"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecVpcAccessibleServicesAllowedServices(original["allowedServices"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecVpcAccessibleServicesEnableRestriction(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecVpcAccessibleServicesAllowedServices(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPolicies(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{}{ - "ingress_from": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFrom(original["ingressFrom"], d, config), - "ingress_to": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressTo(original["ingressTo"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFrom(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["identity_type"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromIdentityType(original["identityType"], d, config) - transformed["identities"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromIdentities(original["identities"], d, config) - transformed["sources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromSources(original["sources"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromIdentityType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromIdentities(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromSources(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{}{ - "access_level": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromSourcesAccessLevel(original["accessLevel"], d, config), - "resource": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromSourcesResource(original["resource"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromSourcesAccessLevel(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressFromSourcesResource(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressTo(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["resources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToResources(original["resources"], d, config) - transformed["operations"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperations(original["operations"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperations(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{}{ - "service_name": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperationsServiceName(original["serviceName"], d, config), - "method_selectors": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperationsMethodSelectors(original["methodSelectors"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperationsServiceName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperationsMethodSelectors(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{}{ - "method": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperationsMethodSelectorsMethod(original["method"], d, config), - "permission": flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperationsMethodSelectorsPermission(original["permission"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperationsMethodSelectorsMethod(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecIngressPoliciesIngressToOperationsMethodSelectorsPermission(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 - } - 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{}{ - "egress_from": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFrom(original["egressFrom"], d, config), - "egress_to": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressTo(original["egressTo"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFrom(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["identity_type"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromIdentityType(original["identityType"], d, config) - transformed["identities"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromIdentities(original["identities"], d, config) - transformed["sources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSources(original["sources"], d, config) - transformed["source_restriction"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSourceRestriction(original["sourceRestriction"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromIdentityType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromIdentities(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSources(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{}{ - "access_level": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSourcesAccessLevel(original["accessLevel"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressFromSourcesAccessLevel(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 -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressTo(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["resources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToResources(original["resources"], d, config) - transformed["external_resources"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToExternalResources(original["externalResources"], d, config) - transformed["operations"] = - flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperations(original["operations"], d, config) - return []interface{}{transformed} -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToExternalResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(schema.HashString, v.([]interface{})) -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperations(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{}{ - "service_name": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperationsServiceName(original["serviceName"], d, config), - "method_selectors": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperationsMethodSelectors(original["methodSelectors"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperationsServiceName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperationsMethodSelectors(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{}{ - "method": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperationsMethodSelectorsMethod(original["method"], d, config), - "permission": flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperationsMethodSelectorsPermission(original["permission"], d, config), - }) - } - return transformed -} -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperationsMethodSelectorsMethod(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAccessContextManagerServicePerimetersServicePerimetersSpecEgressPoliciesEgressToOperationsMethodSelectorsPermission(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/go/alloydb_cluster_input_automated_backup_policy_start_times_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/alloydb_cluster_input_automated_backup_policy_start_times_flatten.go.tmpl deleted file mode 100644 index 5f6683e17f4c..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/alloydb_cluster_input_automated_backup_policy_start_times_flatten.go.tmpl +++ /dev/null @@ -1,101 +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 v - } - l := v.([]interface{}) - transformed := make([]interface{}, 0, len(l)) - for _, raw := range l { - original := raw.(map[string]interface{}) - if len(original) < 1 { - // If no start times exist, that means we take backups at midnight. This is represented as 0's all around. - return append(transformed, map[string]interface{}{}) - } - transformed = append(transformed, map[string]interface{}{ - "hours": flattenAlloydbClusterAutomatedBackupPolicyWeeklyScheduleStartTimesHours(original["hours"], d, config), - "minutes": flattenAlloydbClusterAutomatedBackupPolicyWeeklyScheduleStartTimesMinutes(original["minutes"], d, config), - "seconds": flattenAlloydbClusterAutomatedBackupPolicyWeeklyScheduleStartTimesSeconds(original["seconds"], d, config), - "nanos": flattenAlloydbClusterAutomatedBackupPolicyWeeklyScheduleStartTimesNanos(original["nanos"], d, config), - }) - } - return transformed -} - -func flattenAlloydbClusterAutomatedBackupPolicyWeeklyScheduleStartTimesHours(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenAlloydbClusterAutomatedBackupPolicyWeeklyScheduleStartTimesMinutes(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenAlloydbClusterAutomatedBackupPolicyWeeklyScheduleStartTimesSeconds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenAlloydbClusterAutomatedBackupPolicyWeeklyScheduleStartTimesNanos(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/alloydb_cluster_input_user_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/alloydb_cluster_input_user_flatten.go.tmpl deleted file mode 100644 index ff16cc4b1143..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/alloydb_cluster_input_user_flatten.go.tmpl +++ /dev/null @@ -1,20 +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{} { - return []interface{}{ - map[string]interface{}{ - "user": d.Get("initial_user.0.user"), - "password": d.Get("initial_user.0.password"), - }, - } -} diff --git a/mmv1/templates/terraform/custom_flatten/go/apigee_organization_property.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/apigee_organization_property.go.tmpl deleted file mode 100644 index 50d88829e20f..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/apigee_organization_property.go.tmpl +++ /dev/null @@ -1,40 +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 v - } - l := v.([]interface{}) - apiData := make([]map[string]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 - } - apiData = append(apiData, map[string]interface{}{ - "name": original["name"], - "value": original["value"], - }) - } - configData := []map[string]interface{}{} - for _, item := range d.Get("properties.0.property").([]interface{}) { - configData = append(configData, item.(map[string]interface{})) - } - sorted, err := tpgresource.SortMapsByConfigOrder(configData, apiData, "name") - if err != nil { - log.Printf("[ERROR] Could not support API response for properties.0.property: %s", err) - return apiData - } - return sorted -} diff --git a/mmv1/templates/terraform/custom_flatten/go/appengine_standardappversion_automatic_scaling_handlenil.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/appengine_standardappversion_automatic_scaling_handlenil.go.tmpl deleted file mode 100644 index 1037f7555d69..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/appengine_standardappversion_automatic_scaling_handlenil.go.tmpl +++ /dev/null @@ -1,183 +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 flattenAppEngineStandardAppVersionAutomaticScaling(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["max_concurrent_requests"] = - flattenAppEngineStandardAppVersionAutomaticScalingMaxConcurrentRequests(original["maxConcurrentRequests"], d, config) - transformed["max_idle_instances"] = - flattenAppEngineStandardAppVersionAutomaticScalingMaxIdleInstances(original["maxIdleInstances"], d, config) - transformed["max_pending_latency"] = - flattenAppEngineStandardAppVersionAutomaticScalingMaxPendingLatency(original["maxPendingLatency"], d, config) - transformed["min_idle_instances"] = - flattenAppEngineStandardAppVersionAutomaticScalingMinIdleInstances(original["minIdleInstances"], d, config) - transformed["min_pending_latency"] = - flattenAppEngineStandardAppVersionAutomaticScalingMinPendingLatency(original["minPendingLatency"], d, config) - transformed["standard_scheduler_settings"] = - flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettings(original["standardSchedulerSettings"], d, config) - - // begin handwritten code (all other parts of this file are forked from generated code) - // solve for the following diff when no scaling settings are configured: - // - // - automatic_scaling { - // - max_concurrent_requests = 0 -> null - // - max_idle_instances = 0 -> null - // - min_idle_instances = 0 -> null - // } - // - // this happens because the field is returned as: - // - //"automaticScaling": { - // "standardSchedulerSettings": {} - // }, - // - // this is hacky but avoids marking the field as computed, since it's in a oneof - // if any new fields are added to the block or explicit defaults start getting - // returned, it will need to be updated - if transformed["max_concurrent_requests"] == nil && // even primitives are nil at this stage if they're not returned by the API - transformed["max_idle_instances"] == nil && - transformed["max_pending_latency"] == nil && - transformed["min_idle_instances"] == nil && - transformed["min_pending_latency"] == nil && - transformed["standard_scheduler_settings"] == nil { - return nil - } - // end handwritten code - - return []interface{}{transformed} -} -func flattenAppEngineStandardAppVersionAutomaticScalingMaxConcurrentRequests(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenAppEngineStandardAppVersionAutomaticScalingMaxIdleInstances(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenAppEngineStandardAppVersionAutomaticScalingMaxPendingLatency(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAppEngineStandardAppVersionAutomaticScalingMinIdleInstances(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenAppEngineStandardAppVersionAutomaticScalingMinPendingLatency(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettings(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["target_cpu_utilization"] = - flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettingsTargetCpuUtilization(original["targetCpuUtilization"], d, config) - transformed["target_throughput_utilization"] = - flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettingsTargetThroughputUtilization(original["targetThroughputUtilization"], d, config) - transformed["min_instances"] = - flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettingsMinInstances(original["minInstances"], d, config) - transformed["max_instances"] = - flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettingsMaxInstances(original["maxInstances"], d, config) - return []interface{}{transformed} -} -func flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettingsTargetCpuUtilization(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettingsTargetThroughputUtilization(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettingsMinInstances(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettingsMaxInstances(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} diff --git a/mmv1/templates/terraform/custom_flatten/go/apphub_service_project.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/apphub_service_project.go.tmpl deleted file mode 100644 index fe2bcdd0c44a..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/apphub_service_project.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return nil -} diff --git a/mmv1/templates/terraform/custom_flatten/go/artifactregistry_rr_disable_upstream_validation.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/artifactregistry_rr_disable_upstream_validation.go.tmpl deleted file mode 100644 index 878dcbc33bcc..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/artifactregistry_rr_disable_upstream_validation.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("remote_repository_config.0.disable_upstream_validation") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_connection_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_connection_flatten.go.tmpl deleted file mode 100644 index a9920df36c10..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_connection_flatten.go.tmpl +++ /dev/null @@ -1,20 +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{} { - return []interface{}{ - map[string]interface{}{ - "username": d.Get("cloud_sql.0.credential.0.username"), - "password": d.Get("cloud_sql.0.credential.0.password"), - }, - } -} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_dataset_location.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_dataset_location.go.tmpl deleted file mode 100644 index b38e659db266..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_dataset_location.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// Older Datasets in BigQuery have no Location set in the API response. This may be an issue when importing -// datasets created before BigQuery was available in multiple zones. We can safely assume that these datasets -// are in the US, as this was the default at the time. -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return "US" - } - return v -} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_dataset_ref.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_dataset_ref.go.tmpl deleted file mode 100644 index 2a8191828c01..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_dataset_ref.go.tmpl +++ /dev/null @@ -1,30 +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{}) - transformed["project_id"] = original["projectId"] - transformed["dataset_id"] = original["datasetId"] - - if bigqueryDatasetRegexp.MatchString(d.Get("query.0.default_dataset.0.dataset_id").(string)) { - // The user specified the dataset_id as a URL, so store it in state that way - transformed["dataset_id"] = fmt.Sprintf("projects/%s/datasets/%s", transformed["project_id"], transformed["dataset_id"]) - } - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_kms_version.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_kms_version.go.tmpl deleted file mode 100644 index 5ac2e603d8bf..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_kms_version.go.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. -*/ -}} -// KmsKeyName switched from using a key name to a key version, this will separate the key name from the key version and save them -// separately in state. https://github.com/hashicorp/terraform-provider-google/issues/9208 -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return []map[string]interface{}{} - } - - kmsKeyName := v.(map[string]interface{})["kmsKeyName"].(string) - re := regexp.MustCompile(`(projects/.*/locations/.*/keyRings/.*/cryptoKeys/.*)/cryptoKeyVersions/.*`) - paths := re.FindStringSubmatch(kmsKeyName) - - if len(paths) > 0 { - return []map[string]interface{}{ - { - "kms_key_name": paths[1], - "kms_key_version": kmsKeyName, - }, - } - } - - // The key name was returned, no need to set the version - return []map[string]interface{}{{"{{"}}"kms_key_name": kmsKeyName, "kms_key_version": ""{{"}}"}} - -} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref.go.tmpl deleted file mode 100644 index 19b040c8cc5e..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref.go.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -{{- define "bigqueryTableRegexp"}} -{{- /* - 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{}) - transformed["project_id"] = original["projectId"] - transformed["dataset_id"] = original["datasetId"] - transformed["table_id"] = original["tableId"] - - if bigqueryTableRegexp.MatchString(d.Get("{{$.PropPath}}").(string)) { - // The user specified the table_id as a URL, so store it in state that way - transformed["table_id"] = fmt.Sprintf("projects/%s/datasets/%s/tables/%s", transformed["project_id"], transformed["dataset_id"], transformed["table_id"]) - } - return []interface{}{transformed} -} -{{- end}} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_copy_destinationtable.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_copy_destinationtable.go.tmpl deleted file mode 100644 index ec6d1a68ee35..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_copy_destinationtable.go.tmpl +++ /dev/null @@ -1,13 +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. -*/}} -{{- template "bigqueryTableRegexp" dict "PropPath" "copy.0.destination_table.0.table_id" "GetPrefix" $.GetPrefix "TitlelizeProperty" $.TitlelizeProperty}} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_copy_sourcetables.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_copy_sourcetables.go.tmpl deleted file mode 100644 index 1e0934965e9d..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_copy_sourcetables.go.tmpl +++ /dev/null @@ -1,39 +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 v - } - l := v.([]interface{}) - transformed := make([]interface{}, 0, len(l)) - for i, raw := range l { - original := raw.(map[string]interface{}) - if len(original) < 1 { - // Do not include empty json objects coming back from the api - continue - } - t := map[string]interface{}{ - "project_id": original["projectId"], - "dataset_id": original["datasetId"], - "table_id": original["tableId"], - } - - if bigqueryTableRegexp.MatchString(d.Get(fmt.Sprintf("copy.0.source_tables.%d.table_id", i)).(string)) { - // The user specified the table_id as a URL, so store it in state that way - t["table_id"] = fmt.Sprintf("projects/%s/datasets/%s/tables/%s", t["project_id"], t["dataset_id"], t["table_id"]) - } - transformed = append(transformed, t) - } - - return transformed -} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_extract_sourcetable.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_extract_sourcetable.go.tmpl deleted file mode 100644 index 19f1aaddc784..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_extract_sourcetable.go.tmpl +++ /dev/null @@ -1,13 +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. -*/}} -{{- template "bigqueryTableRegexp" dict "PropPath" "extract.0.source_table.0.table_id" "GetPrefix" $.GetPrefix "TitlelizeProperty" $.TitlelizeProperty}} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_load_destinationtable.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_load_destinationtable.go.tmpl deleted file mode 100644 index ee5e9e53aebf..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_load_destinationtable.go.tmpl +++ /dev/null @@ -1,13 +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. -*/}} -{{- template "bigqueryTableRegexp" dict "PropPath" "load.0.destination_table.0.table_id" "GetPrefix" $.GetPrefix "TitlelizeProperty" $.TitlelizeProperty}} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_query_destinationtable.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_query_destinationtable.go.tmpl deleted file mode 100644 index b4ce17ad8aed..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigquery_table_ref_query_destinationtable.go.tmpl +++ /dev/null @@ -1,13 +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. -*/}} -{{- template "bigqueryTableRegexp" dict "PropPath" "query.0.destination_table.0.table_id" "GetPrefix" $.GetPrefix "TitlelizeProperty" $.TitlelizeProperty}} diff --git a/mmv1/templates/terraform/custom_flatten/go/bigtable_app_profile_routing.tmpl b/mmv1/templates/terraform/custom_flatten/go/bigtable_app_profile_routing.tmpl deleted file mode 100644 index 510165a22154..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/bigtable_app_profile_routing.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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return false - } - - if v.(map[string]interface{})["clusterIds"] == nil { - return true - } - - if len(v.(map[string]interface{})["clusterIds"].([]interface{})) > 0 { - if err := d.Set("multi_cluster_routing_cluster_ids", v.(map[string]interface{})["clusterIds"]); err != nil { - return true - } - } - - return true -} diff --git a/mmv1/templates/terraform/custom_flatten/go/billing_budget_budget_filter_labels.tmpl b/mmv1/templates/terraform/custom_flatten/go/billing_budget_budget_filter_labels.tmpl deleted file mode 100644 index 9eec6328db3d..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/billing_budget_budget_filter_labels.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - /* - note: api only accepts below format. Also only takes a single element in the array - labels = { - foo = ["bar"] - } - until now, sdk does not take array for the map value - */ - if v == nil { - return nil - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - for key, val := range original { - l := val.([]interface{}) - for _, v := range l { - transformed[key] = v.(string) - } - } - return transformed -} diff --git a/mmv1/templates/terraform/custom_flatten/go/cloud_scheduler_paused.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloud_scheduler_paused.go.tmpl deleted file mode 100644 index 8ee8c6524dc9..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloud_scheduler_paused.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - state := d.Get("state"); - if state == "PAUSED" { - return true - } - if state == "ENABLED" { - return false - } - return false // Job has an error state that's not paused or enabled -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/cloudbuild_approval_required.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloudbuild_approval_required.go.tmpl deleted file mode 100644 index a50dfe88b47f..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloudbuild_approval_required.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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - transformed := make(map[string]interface{}) - if v == nil { - // Disabled by default, but API will not return object if value is false - transformed["approval_required"] = false - return []interface{}{transformed} - } - - original := v.(map[string]interface{}) - transformed["approval_required"] = original["approvalRequired"] - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_admin.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_admin.go.tmpl deleted file mode 100644 index ef5c426a2141..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_admin.go.tmpl +++ /dev/null @@ -1,31 +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 flattenClouddomainsRegistrationContactSettingsAdminContact(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{}) - - // Skip reading the following due to ambiguous accept vs return values - transformed["phone_number"] = d.Get("contact_settings.0.admin_contact.0.phone_number") - transformed["fax_number"] = d.Get("contact_settings.0.admin_contact.0.fax_number") - transformed["postal_address"] = d.Get("contact_settings.0.admin_contact.0.postal_address") - - // Don't skip email as it is not normalized - transformed["email"] = original["email"] - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_registrant.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_registrant.go.tmpl deleted file mode 100644 index cfa9cd3d9f55..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_registrant.go.tmpl +++ /dev/null @@ -1,31 +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 flattenClouddomainsRegistrationContactSettingsRegistrantContact(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{}) - - // Skip reading the following due to ambiguous accept vs return values - transformed["phone_number"] = d.Get("contact_settings.0.registrant_contact.0.phone_number") - transformed["fax_number"] = d.Get("contact_settings.0.registrant_contact.0.fax_number") - transformed["postal_address"] = d.Get("contact_settings.0.registrant_contact.0.postal_address") - - // Don't skip email as it is not normalized - transformed["email"] = original["email"] - return []interface{}{transformed} -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_technical.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_technical.go.tmpl deleted file mode 100644 index 6b1bff930e59..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/clouddomains_ignore_numbers_technical.go.tmpl +++ /dev/null @@ -1,31 +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 flattenClouddomainsRegistrationContactSettingsTechnicalContact(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{}) - - // Skip reading the following due to ambiguous accept vs return values - transformed["phone_number"] = d.Get("contact_settings.0.technical_contact.0.phone_number") - transformed["fax_number"] = d.Get("contact_settings.0.technical_contact.0.fax_number") - transformed["postal_address"] = d.Get("contact_settings.0.technical_contact.0.postal_address") - - // Don't skip email as it is not normalized - transformed["email"] = original["email"] - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_bucket.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_bucket.go.tmpl deleted file mode 100644 index 81a6e12e495a..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_bucket.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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // This flatten function is shared between the resource and the datasource. - // TF Input format: {bucket-name} - // GET Response format: gcf-v2-sources-{Project-number}-{location} - // As TF Input and GET response values have different format, - // we will return TF Input value to prevent state drift. - - if bVal, ok := d.GetOk("build_config.0.source.0.storage_source.0.bucket"); ok { - return bVal - } - - // For the datasource, there is no prior TF Input for this attribute. - // Hence, GET Response value is returned. - - return v -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_generation.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_generation.go.tmpl deleted file mode 100644 index ffdee7b68523..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_generation.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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // This flatten function is shared between the resource and the datasource. - // TF Input will use the generation from the source object - // GET Response will use the generation from the automatically created object - // As TF Input and GET response values have different format, - // we will return TF Input value to prevent state drift. - - if genVal, ok := d.GetOk("build_config.0.source.0.storage_source.0.generation"); ok { - v = genVal - } - - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} diff --git a/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_object.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_object.go.tmpl deleted file mode 100644 index e0fe7cbe43ac..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloudfunctions2_function_source_object.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{} { - // This flatten function is shared between the resource and the datasource. - // TF Input format: {object-name} - // GET Response format: {function-name}/{object-name} - // As TF Input and GET response values have different format, - // we will return TF Input value to prevent state drift. - - if ObjVal, ok := d.GetOk("build_config.0.source.0.storage_source.0.object"); ok { - return ObjVal - } - - // For the datasource, there is no prior TF Input for this attribute. - // Hence, GET Response value is returned. - - return v -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/cloudquotas_quota_preference_annotations.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloudquotas_quota_preference_annotations.go.tmpl deleted file mode 100644 index dd0b44bfb93f..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloudquotas_quota_preference_annotations.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // ignore read on this field - return d.Get("quota_config.0.annotations") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/cloudrun_ignore_force_override.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloudrun_ignore_force_override.go.tmpl deleted file mode 100644 index 3ec5347a2c72..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloudrun_ignore_force_override.go.tmpl +++ /dev/null @@ -1,16 +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{} { - // We want to ignore read on this field, but cannot because it is nested - return d.Get("spec.0.force_override") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/cloudscheduler_job_appenginerouting.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloudscheduler_job_appenginerouting.go.tmpl deleted file mode 100644 index 23ee53ece4eb..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloudscheduler_job_appenginerouting.go.tmpl +++ /dev/null @@ -1,30 +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. -*/ -}} -// An `appEngineRouting` in API response is useless, so we set config values rather than api response to state. -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - if stateV, ok := d.GetOk("app_engine_http_target"); ok && len(stateV.([]interface{})) > 0 { - return d.Get("app_engine_http_target.0.app_engine_routing") - } - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["service"] = original["service"] - transformed["version"] = original["version"] - transformed["instance"] = original["instance"] - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/cloudtasks_queue_appenginerouting.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/cloudtasks_queue_appenginerouting.go.tmpl deleted file mode 100644 index 8ff917aed00d..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/cloudtasks_queue_appenginerouting.go.tmpl +++ /dev/null @@ -1,30 +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. -*/ -}} -// service, version, and instance are input-only. host is output-only. -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{}) - transformed["host"] = original["host"] - if override, ok := d.GetOk("app_engine_routing_override"); ok && len(override.([]interface{})) > 0 { - transformed["service"] = d.Get("app_engine_routing_override.0.service") - transformed["version"] = d.Get("app_engine_routing_override.0.version") - transformed["instance"] = d.Get("app_engine_routing_override.0.instance") - } - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/compute_router_range.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/compute_router_range.go.tmpl deleted file mode 100644 index a4afe3f63d8a..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/compute_router_range.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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - l := v.([]interface{}) - apiData := make([]map[string]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 - } - apiData = append(apiData, map[string]interface{}{ - "description": original["description"], - "range": original["range"], - }) - } - configData := []map[string]interface{}{} - if v, ok := d.GetOk("bgp.0.advertised_ip_ranges"); ok { - for _, item := range v.([]interface{}) { - configData = append(configData, item.(map[string]interface{})) - } - } - sorted, err := tpgresource.SortMapsByConfigOrder(configData, apiData, "range") - if err != nil { - log.Printf("[ERROR] Could not support API response for advertisedIpRanges.0.range: %s", err) - return apiData - } - return sorted -} diff --git a/mmv1/templates/terraform/custom_flatten/go/compute_snapshot_snapshot_encryption_raw_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/compute_snapshot_snapshot_encryption_raw_key.go.tmpl deleted file mode 100644 index cfd37d6dec6c..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/compute_snapshot_snapshot_encryption_raw_key.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("snapshot_encryption_key.0.raw_key") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/consumer_quote_override_override_value.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/consumer_quote_override_override_value.go.tmpl deleted file mode 100644 index e019df6cddab..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/consumer_quote_override_override_value.go.tmpl +++ /dev/null @@ -1,18 +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 "0" - } - return v -} diff --git a/mmv1/templates/terraform/custom_flatten/go/containerattached_cluster_authorization_user.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/containerattached_cluster_authorization_user.go.tmpl deleted file mode 100644 index 7a145d0ade70..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/containerattached_cluster_authorization_user.go.tmpl +++ /dev/null @@ -1,62 +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. -*/ -}} - -// The custom expander transforms input into something like this: -// authorization { -// admin_users [ -// { username = "user1" }, -// { username = "user2" } -// ] -// admin_groups [ -// { group = "group1" }, -// { group = "group2" }, -// ] -// } -// The custom flattener transforms input back into something like this: -// authorization { -// admin_users = [ -// "user1", -// "user2" -// ] -// admin_groups = [ -// "group1", -// "group2" -// ], -// } -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil || len(v.(map[string]interface{})) == 0 { - return nil - } - - transformed := make(map[string][]string) - if v.(map[string]interface{})["adminUsers"] != nil { - orig := v.(map[string]interface{})["adminUsers"].([]interface{}) - transformed["admin_users"] = make([]string, len(orig)) - for i, u := range orig { - if u != nil { - transformed["admin_users"][i] = u.(map[string]interface{})["username"].(string) - } - } - } - if v.(map[string]interface{})["adminGroups"] != nil { - orig := v.(map[string]interface{})["adminGroups"].([]interface{}) - transformed["admin_groups"] = make([]string, len(orig)) - for i, u := range orig { - if u != nil { - transformed["admin_groups"][i] = u.(map[string]interface{})["group"].(string) - } - } - } - - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/data_catalog_tag.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/data_catalog_tag.go.tmpl deleted file mode 100644 index 7a3a3c7efb03..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/data_catalog_tag.go.tmpl +++ /dev/null @@ -1,19 +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 - } - - return v.(map[string]interface{})["displayName"] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.tmpl deleted file mode 100644 index 4781b335b4dc..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("alloydb.0.settings.0.initial_user.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_cloudsql_settings_root_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_cloudsql_settings_root_password.go.tmpl deleted file mode 100644 index e5ad4fb53244..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_cloudsql_settings_root_password.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("cloudsql.0.settings.0.root_password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_password.go.tmpl deleted file mode 100644 index 4da22b3453b5..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_password.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("mysql.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.tmpl deleted file mode 100644 index 0f98aebf4469..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("mysql.0.ssl.0.ca_certificate") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.tmpl deleted file mode 100644 index 613153fcf0ac..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("mysql.0.ssl.0.client_certificate") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_client_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_client_key.go.tmpl deleted file mode 100644 index 40bfb2fed102..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_mysql_ssl_client_key.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("mysql.0.ssl.0.client_key") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_forward_ssh_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_forward_ssh_password.go.tmpl deleted file mode 100644 index 6e7a408a3b84..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_forward_ssh_password.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("oracle.0.forward_ssh_connectivity.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_forward_ssh_private_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_forward_ssh_private_key.go.tmpl deleted file mode 100644 index 55b25a952269..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_forward_ssh_private_key.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("oracle.0.forward_ssh_connectivity.0.private_key") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_password.go.tmpl deleted file mode 100644 index 05f0399cf243..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_password.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("oracle.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_ca_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_ca_certificate.go.tmpl deleted file mode 100644 index 2dc49161499f..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_ca_certificate.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("oracle.0.ssl.0.ca_certificate") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_client_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_client_certificate.go.tmpl deleted file mode 100644 index e990ab44bada..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_client_certificate.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("oracle.0.ssl.0.client_certificate") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_client_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_client_key.go.tmpl deleted file mode 100644 index 35f46ad59a02..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_oracle_ssl_client_key.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("oracle.0.ssl.0.client_key") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_password.go.tmpl deleted file mode 100644 index a3a3597a8005..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_password.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("postgresql.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.tmpl deleted file mode 100644 index a6ee3a208f81..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("postgresql.0.ssl.0.ca_certificate") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.tmpl deleted file mode 100644 index 51a56266b40c..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("postgresql.0.ssl.0.client_certificate") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_client_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_client_key.go.tmpl deleted file mode 100644 index 0890ed843a19..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/database_migration_service_connection_profile_postgresql_ssl_client_key.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("postgresql.0.ssl.0.client_key") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/dataplex_datascan_ignore_profile_result.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/dataplex_datascan_ignore_profile_result.go.tmpl deleted file mode 100644 index 377720040b0c..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/dataplex_datascan_ignore_profile_result.go.tmpl +++ /dev/null @@ -1,16 +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{} { - // We want to ignore read on this field, but cannot because it is nested - return nil -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_forward_ssh_connectivity_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_forward_ssh_connectivity_password.go.tmpl deleted file mode 100644 index 3d39974fbfe2..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_forward_ssh_connectivity_password.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("forward_ssh_connectivity.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_forward_ssh_connectivity_private_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_forward_ssh_connectivity_private_key.go.tmpl deleted file mode 100644 index e78406acd183..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_forward_ssh_connectivity_private_key.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("forward_ssh_connectivity.0.private_key") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_password.go.tmpl deleted file mode 100644 index 6b9fa6fdb940..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_password.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("mysql_profile.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_ca_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_ca_certificate.go.tmpl deleted file mode 100644 index 16045abdbd41..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_ca_certificate.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("mysql_profile.0.ssl_config.0.ca_certificate") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_client_certificate.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_client_certificate.go.tmpl deleted file mode 100644 index 27439273695b..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_client_certificate.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("mysql_profile.0.ssl_config.0.client_certificate") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_client_key.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_client_key.go.tmpl deleted file mode 100644 index d20130e621a5..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_mysql_profile_ssl_config_client_key.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("mysql_profile.0.ssl_config.0.client_key") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_oracle_profile_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_oracle_profile_password.go.tmpl deleted file mode 100644 index dfd854d7a631..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_oracle_profile_password.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("oracle_profile.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_postgresql_profile_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_postgresql_profile_password.go.tmpl deleted file mode 100644 index b4c7ac7f58da..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_postgresql_profile_password.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("postgresql_profile.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_sql_server_profile_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_sql_server_profile_password.go.tmpl deleted file mode 100644 index dfb1adb3079a..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/datastream_connection_profile_sql_server_profile_password.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -{{/* Workaround for https://github.com/hashicorp/terraform-provider-google/issues/12410 */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("sql_server_profile.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/default_if_empty.tmpl b/mmv1/templates/terraform/custom_flatten/go/default_if_empty.tmpl deleted file mode 100644 index f68ee25c1e23..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/default_if_empty.tmpl +++ /dev/null @@ -1,26 +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 || tpgresource.IsEmptyValue(reflect.ValueOf(v)) { - return {{$.GoLiteral $.DefaultValue}} - } -{{ if $.IsA "Integer" -}} - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } // let terraform core handle it if we can't convert the string to an int. - } -{{ end }} - return v -} diff --git a/mmv1/templates/terraform/custom_flatten/go/dialogflowcx_agent_git_integration_settings_github_settings.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/dialogflowcx_agent_git_integration_settings_github_settings.go.tmpl deleted file mode 100644 index 80840c50a804..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/dialogflowcx_agent_git_integration_settings_github_settings.go.tmpl +++ /dev/null @@ -1,30 +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 flattenDialogflowCXAgentGitIntegrationSettingsGithubSettings(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - original := v.(map[string]interface{}) - // ignore access_token, which is always returned as REDACTED - delete(original, "access_token"); - if len(original) == 0 { - return nil - } - transformed := make(map[string]interface{}) - transformed["display_name"] = original["displayName"] - transformed["repository_uri"] = original["repositoryUri"] - transformed["tracking_branch"] = original["trackingBranch"] - transformed["access_token"] = d.Get("git_integration_settings.0.github_settings.0.access_token") - transformed["branches"] = original["branches"] - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/discoveryengine_schema_json_schema.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/discoveryengine_schema_json_schema.go.tmpl deleted file mode 100644 index 7eb7c54775a2..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/discoveryengine_schema_json_schema.go.tmpl +++ /dev/null @@ -1,23 +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 - } - s, err := structure.NormalizeJsonString(v) - if err != nil { - log.Printf("[ERROR] failed to normalize JSON string: %v", err) - } - return s -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/disk_consistency_group_policy.tmpl b/mmv1/templates/terraform/custom_flatten/go/disk_consistency_group_policy.tmpl deleted file mode 100644 index 5cf7420ee985..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/disk_consistency_group_policy.tmpl +++ /dev/null @@ -1,20 +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 - } - transformed := make(map[string]interface{}) - transformed["enabled"] = true - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/duration_string_to_days.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/duration_string_to_days.go.tmpl deleted file mode 100644 index cf0d58b309fe..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/duration_string_to_days.go.tmpl +++ /dev/null @@ -1,25 +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 - } - if v.(string) == "" { - return nil - } - dur, err := time.ParseDuration(v.(string)) - if err != nil { - return nil - } - return int(dur/(time.Hour*24)) -} diff --git a/mmv1/templates/terraform/custom_flatten/go/enum_bool.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/enum_bool.go.tmpl deleted file mode 100644 index 4a47f1d6b392..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/enum_bool.go.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return "" - } - return strings.ToUpper(strconv.FormatBool(v.(bool))) -} diff --git a/mmv1/templates/terraform/custom_flatten/go/filestore_instance_networks_reserved_ip_range.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/filestore_instance_networks_reserved_ip_range.go.tmpl deleted file mode 100644 index 5197a4ac8970..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/filestore_instance_networks_reserved_ip_range.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("networks.0.reserved_ip_range") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/firestore_field_index_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/firestore_field_index_config.go.tmpl deleted file mode 100644 index 826438e12e62..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/firestore_field_index_config.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}) { - if v == nil { - return v - } - indexConfig := v.(map[string]interface{}) - - usesAncestorConfig := false - if indexConfig["usesAncestorConfig"] != nil { - usesAncestorConfig = indexConfig["usesAncestorConfig"].(bool) - } - - if usesAncestorConfig { - // The intent when uses_ancestor_config is no config. - return []interface{}{} - } - - if indexConfig["indexes"] == nil { - // No indexes, return an existing, but empty index config. - return [1]interface{}{nil} - } - - // For Single field indexes, we put the field configuration on the index to avoid forced nesting. - l := indexConfig["indexes"].([]interface{}) - transformed := make(map[string]interface{}) - transformedIndexes := 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 - } - fields := original["fields"].([]interface{}) - sfi := fields[0].(map[string]interface{}) - transformedIndexes = append(transformedIndexes, map[string]interface{}{ - "query_scope": original["queryScope"], - "order": sfi["order"], - "array_config": sfi["arrayConfig"], - }) - } - transformed["indexes"] = transformedIndexes - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/firewall_log_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/firewall_log_config.go.tmpl deleted file mode 100644 index 028b752dc260..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/firewall_log_config.go.tmpl +++ /dev/null @@ -1,30 +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 - } - - v, ok := original["enable"] - if ok && !v.(bool) { - return nil - } - - transformed := make(map[string]interface{}) - transformed["metadata"] = original["metadata"] - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/float64_to_int.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/float64_to_int.go.tmpl deleted file mode 100644 index 2571835abb2e..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/float64_to_int.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles int given in float64 format - if floatVal, ok := v.(float64); ok { - return int(floatVal) - } - return v -} diff --git a/mmv1/templates/terraform/custom_flatten/go/float64_to_int_to_string.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/float64_to_int_to_string.go.tmpl deleted file mode 100644 index b97dadbf439f..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/float64_to_int_to_string.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles int given in float64 format - if floatVal, ok := v.(float64); ok { - return fmt.Sprintf("%d", int(floatVal)) - } - return v -} diff --git a/mmv1/templates/terraform/custom_flatten/go/float64_to_string.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/float64_to_string.go.tmpl deleted file mode 100644 index 952ac413870d..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/float64_to_string.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData) interface{} { - transformed := make(map[string]string) - data := v.(map[string]interface{}) - for key := range data { - transformed[key] = fmt.Sprintf("%f", data[key]) - } - log.Printf("transformed = %#v", transformed) - return transformed -} diff --git a/mmv1/templates/terraform/custom_flatten/go/full_to_relative_path.tmpl b/mmv1/templates/terraform/custom_flatten/go/full_to_relative_path.tmpl deleted file mode 100644 index d12b8a6c52a1..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/full_to_relative_path.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - relative, err := tpgresource.GetRelativePath(v.(string)) - if err != nil { - return v - } - return relative -} diff --git a/mmv1/templates/terraform/custom_flatten/go/group_id_to_name.tmpl b/mmv1/templates/terraform/custom_flatten/go/group_id_to_name.tmpl deleted file mode 100644 index 63c8bf2dff25..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/group_id_to_name.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -func flattenMonitoringUptimeCheckConfigResourceGroupGroupId(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - project := d.Get("project").(string) - return fmt.Sprintf("projects/%s/groups/%s", project, v) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/guard_self_link.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/guard_self_link.go.tmpl deleted file mode 100644 index ebdfcd113dd2..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/guard_self_link.go.tmpl +++ /dev/null @@ -1,20 +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. -*/ -}} -{{/* Not all self links behave like ResourceRef expects, eg they may expect a fully qualified url. In those - cases, we need to manually define this flattener. */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return tpgresource.ConvertSelfLinkToV1(v.(string)) -} diff --git a/mmv1/templates/terraform/custom_flatten/go/guard_self_link_array.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/guard_self_link_array.go.tmpl deleted file mode 100644 index 991d78e9eb36..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/guard_self_link_array.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} -{{/* This should be used for multi-resource ref fields that can't be made to real resource refs yet */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return tpgresource.ConvertAndMapStringArr(v.([]interface{}), tpgresource.ConvertSelfLinkToV1) -} diff --git a/mmv1/templates/terraform/custom_flatten/go/health_check_log_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/health_check_log_config.go.tmpl deleted file mode 100644 index 055964af6c86..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/health_check_log_config.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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - transformed := make(map[string]interface{}) - if v == nil { - // Disabled by default, but API will not return object if value is false - transformed["enable"] = false - return []interface{}{transformed} - } - - original := v.(map[string]interface{}) - transformed["enable"] = original["enable"] - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/http_headers.tmpl b/mmv1/templates/terraform/custom_flatten/go/http_headers.tmpl deleted file mode 100644 index 7ca9a567feb9..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/http_headers.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{}) { - var headers = v.(map[string]interface{}) - if v, ok := headers["User-Agent"]; ok { - if v.(string) == "AppEngine-Google; (+http://code.google.com/appengine)" { - delete(headers, "User-Agent") - } else if v.(string) == "Google-Cloud-Scheduler" { - delete(headers, "User-Agent") - } else { - headers["User-Agent"] = strings.TrimSpace(strings.Replace(v.(string), "AppEngine-Google; (+http://code.google.com/appengine)","", -1)) - } - } - if v, ok := headers["Content-Type"]; ok { - if v.(string) == "application/octet-stream" { - delete(headers, "Content-Type") - } - } - r := regexp.MustCompile(`(X-Google-|X-AppEngine-|Content-Length).*`) - for key := range headers { - if r.MatchString(key) { - delete(headers, key) - } - } - return headers -} diff --git a/mmv1/templates/terraform/custom_flatten/go/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_secret_value.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_secret_value.go.tmpl deleted file mode 100644 index 6ddc09d748dd..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_secret_value.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. -*/ -}} -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{}) - transformed["thumbprint"] = original["thumbprint"] - // Trigger a diff based on the plain_text if there is no change in the thumbprint, - // otherwise leave plain_text empty to always trigger a diff. - if original["thumbprint"].(string) == d.Get("extra_attributes_oauth2_client.0.client_secret.0.value.0.thumbprint").(string) { - transformed["plain_text"] = d.Get("extra_attributes_oauth2_client.0.client_secret.0.value.0.plain_text") - } - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/iam_workforce_pool_provider_oidc_client_secret_value.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/iam_workforce_pool_provider_oidc_client_secret_value.go.tmpl deleted file mode 100644 index 3cff63c1ac6e..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/iam_workforce_pool_provider_oidc_client_secret_value.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. -*/ -}} -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{}) - transformed["thumbprint"] = original["thumbprint"] - // Trigger a diff based on the plain_text if there is no change in the thumbprint, - // otherwise leave plain_text empty to always trigger a diff. - if original["thumbprint"].(string) == d.Get("oidc.0.client_secret.0.value.0.thumbprint").(string) { - transformed["plain_text"] = d.Get("oidc.0.client_secret.0.value.0.plain_text") - } - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/id_from_name.tmpl b/mmv1/templates/terraform/custom_flatten/go/id_from_name.tmpl deleted file mode 100644 index 9e5840e1f524..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/id_from_name.tmpl +++ /dev/null @@ -1,16 +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{} { - parts := strings.Split(d.Get("name").(string), "/") - return parts[len(parts)-1] -} diff --git a/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_anonymous.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_anonymous.go.tmpl deleted file mode 100644 index f49bc93d2d0b..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_anonymous.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - - if original["enabled"] == nil { - transformed["enabled"] = false - } else { - transformed["enabled"] = original["enabled"] - } - - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_client_permissions.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_client_permissions.go.tmpl deleted file mode 100644 index 7a7af98c6111..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_client_permissions.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - - if original["disabledUserSignup"] == nil { - transformed["disabled_user_signup"] = false - } else { - transformed["disabled_user_signup"] = original["disabledUserSignup"] - } - - if original["disabledUserDeletion"] == nil { - transformed["disabled_user_deletion"] = false - } else { - transformed["disabled_user_deletion"] = original["disabledUserDeletion"] - } - - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_logging.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_logging.go.tmpl deleted file mode 100644 index f49bc93d2d0b..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/identity_platform_config_logging.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return nil - } - - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - - if original["enabled"] == nil { - transformed["enabled"] = false - } else { - transformed["enabled"] = original["enabled"] - } - - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/image_kms_key_name.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/image_kms_key_name.go.tmpl deleted file mode 100644 index c5987badbb27..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/image_kms_key_name.go.tmpl +++ /dev/null @@ -1,19 +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 v - } - vStr := v.(string) - return strings.Split(vStr, "/cryptoKeyVersions/")[0] -} diff --git a/mmv1/templates/terraform/custom_flatten/go/json_schema.tmpl b/mmv1/templates/terraform/custom_flatten/go/json_schema.tmpl deleted file mode 100644 index ab1c9cfb42ee..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/json_schema.tmpl +++ /dev/null @@ -1,23 +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 - } - b, err := json.Marshal(v) - if err != nil { - // TODO: return error once https://github.com/GoogleCloudPlatform/magic-modules/issues/3257 is fixed. - log.Printf("[ERROR] failed to marshal schema to JSON: %v", err) - } - return string(b) -} diff --git a/mmv1/templates/terraform/custom_flatten/go/json_to_string_map.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/json_to_string_map.go.tmpl deleted file mode 100644 index 8d4b32b0b7bb..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/json_to_string_map.go.tmpl +++ /dev/null @@ -1,25 +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 v - } - - kv := v.(map[string]interface{}) - - res := make(map[string]string) - for key, value := range kv { - res[key] = fmt.Sprintf("%v", value) - } - return res -} diff --git a/mmv1/templates/terraform/custom_flatten/go/monitoring_slo_availability_sli.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/monitoring_slo_availability_sli.go.tmpl deleted file mode 100644 index 41393fc0d5bd..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/monitoring_slo_availability_sli.go.tmpl +++ /dev/null @@ -1,20 +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 - } - transformed := make(map[string]interface{}) - transformed["enabled"] = true - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/name_from_self_link.tmpl b/mmv1/templates/terraform/custom_flatten/go/name_from_self_link.tmpl deleted file mode 100644 index 24b2086d705e..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/name_from_self_link.tmpl +++ /dev/null @@ -1,18 +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 v - } - return tpgresource.NameFromSelfLinkStateFunc(v) -} diff --git a/mmv1/templates/terraform/custom_flatten/go/nat_rules_ip_set.tmpl b/mmv1/templates/terraform/custom_flatten/go/nat_rules_ip_set.tmpl deleted file mode 100644 index 6d245519e802..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/nat_rules_ip_set.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(computeRouterNatIPsHash, tpgresource.ConvertStringArrToInterface(tpgresource.ConvertAndMapStringArr(v.([]interface{}), tpgresource.ConvertSelfLinkToV1))) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/nat_rules_subnets_set.tmpl b/mmv1/templates/terraform/custom_flatten/go/nat_rules_subnets_set.tmpl deleted file mode 100644 index d3dcd6a35fbc..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/nat_rules_subnets_set.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - return schema.NewSet(computeRouterNatRulesSubnetHash, tpgresource.ConvertStringArrToInterface(tpgresource.ConvertAndMapStringArr(v.([]interface{}), tpgresource.ConvertSelfLinkToV1))) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/netapp_volume_replicaton_mirror_state.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/netapp_volume_replicaton_mirror_state.go.tmpl deleted file mode 100644 index 7ac83da1080a..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/netapp_volume_replicaton_mirror_state.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Actual state of replication_enabled depends on mirrorState. let's update it. - // This is to pickup manual user STOP/RESUME operations on the replication. - if v == nil { - return v - } - - if v.(string) == "STOPPED" { - if err := d.Set("replication_enabled", false); err != nil { - return fmt.Errorf("Error setting replication_enabled: %s", err) - } - } else { - if err := d.Set("replication_enabled", true); err != nil { - return fmt.Errorf("Error setting replication_enabled: %s", err) - } - } - log.Printf("[DEBUG] value of replication_state : %v", d.Get("replication_enabled")) - - return v -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/network_services_timeout_mirror.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/network_services_timeout_mirror.go.tmpl deleted file mode 100644 index dde4bac022fa..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/network_services_timeout_mirror.go.tmpl +++ /dev/null @@ -1,35 +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{} { - out := make(map[string]string) - - if v == nil { - return nil - } - - in := v.(map[string]interface{}) - if e, ok := in["connectTimeout"]; ok { - out["connect_timeout"] = e.(string) - } - if e, ok := in["maxAttemptsTimeout"]; ok { - out["max_attempts_timeout"] = e.(string) - } - if e, ok := in["responseTimeout"]; ok { - out["response_timeout"] = e.(string) - } - if e, ok := in["readTimeout"]; ok { - out["read_timeout"] = e.(string) - } - - return []interface{}{out} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/object_to_bool.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/object_to_bool.go.tmpl deleted file mode 100644 index 387434d8af56..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/object_to_bool.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return v != nil -} diff --git a/mmv1/templates/terraform/custom_flatten/go/os_config_patch_deployment_recurring_schedule_time_of_day.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/os_config_patch_deployment_recurring_schedule_time_of_day.go.tmpl deleted file mode 100644 index 8f58473b844b..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/os_config_patch_deployment_recurring_schedule_time_of_day.go.tmpl +++ /dev/null @@ -1,96 +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{}) - transformed := make(map[string]interface{}) - transformed["hours"] = - flattenOSConfigPatchDeploymentRecurringScheduleTimeOfDayHours(original["hours"], d, config) - transformed["minutes"] = - flattenOSConfigPatchDeploymentRecurringScheduleTimeOfDayMinutes(original["minutes"], d, config) - transformed["seconds"] = - flattenOSConfigPatchDeploymentRecurringScheduleTimeOfDaySeconds(original["seconds"], d, config) - transformed["nanos"] = - flattenOSConfigPatchDeploymentRecurringScheduleTimeOfDayNanos(original["nanos"], d, config) - return []interface{}{transformed} -} - -func flattenOSConfigPatchDeploymentRecurringScheduleTimeOfDayHours(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenOSConfigPatchDeploymentRecurringScheduleTimeOfDayMinutes(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenOSConfigPatchDeploymentRecurringScheduleTimeOfDaySeconds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} - -func flattenOSConfigPatchDeploymentRecurringScheduleTimeOfDayNanos(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := tpgresource.StringToFixed64(strVal); err == nil { - return intVal - } - } - - // number values are represented as float64 - if floatVal, ok := v.(float64); ok { - intVal := int(floatVal) - return intVal - } - - return v // let terraform core handle it otherwise -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/preserved_state_disks.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/preserved_state_disks.go.tmpl deleted file mode 100644 index fe9c3ddaec37..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/preserved_state_disks.go.tmpl +++ /dev/null @@ -1,33 +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 v - } - disks := v.(map[string]interface{}) - transformed := make([]interface{}, 0, len(disks)) - for devName, deleteRuleRaw := range disks { - diskObj := deleteRuleRaw.(map[string]interface{}) - source, err := tpgresource.GetRelativePath(diskObj["source"].(string)) - if err != nil { - source = diskObj["source"].(string) - } - transformed = append(transformed, map[string]interface{}{ - "device_name": devName, - "delete_rule": diskObj["autoDelete"], - "source": source, - "mode": diskObj["mode"], - }) - } - return transformed -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/privateca_certificate_509_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/privateca_certificate_509_config.go.tmpl deleted file mode 100644 index c08addd0f5e3..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/privateca_certificate_509_config.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -{{/* See mmv1/third_party/terraform/utils/privateca_utils.go for the sub-expanders and explanation */}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - v = make(map[string]interface{}) - } - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - transformed["additional_extensions"] = - flattenPrivatecaCertificateConfigX509ConfigAdditionalExtensions(original["additionalExtensions"], d, config) - transformed["policy_ids"] = - flattenPrivatecaCertificateConfigX509ConfigPolicyIds(original["policyIds"], d, config) - transformed["aia_ocsp_servers"] = flattenPrivatecaCertificateConfigX509ConfigAiaOcspServers(original["aiaOcspServers"], d, config) - transformed["ca_options"] = - flattenPrivatecaCertificateConfigX509ConfigCaOptions(original["caOptions"], d, config) - transformed["key_usage"] = - flattenPrivatecaCertificateConfigX509ConfigKeyUsage(original["keyUsage"], d, config) - transformed["name_constraints"] = - flattenPrivatecaCertificateConfigX509ConfigNameConstraints(original["nameConstraints"], d, config) - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/privateca_certificate_authority_subordinate_config_certificate_authority.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/privateca_certificate_authority_subordinate_config_certificate_authority.go.tmpl deleted file mode 100644 index 037485ed89aa..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/privateca_certificate_authority_subordinate_config_certificate_authority.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("subordinate_config.0.certificate_authority") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/pubsub_no_wrapper_write_metadata_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/pubsub_no_wrapper_write_metadata_flatten.go.tmpl deleted file mode 100644 index e41bf88fdde2..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/pubsub_no_wrapper_write_metadata_flatten.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{}) - transformed := make(map[string]interface{}) - - if original["writeMetadata"] == nil { - transformed["write_metadata"] = false - } else { - transformed["write_metadata"] = original["writeMetadata"] - } - - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/repository_short_name_from_name.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/repository_short_name_from_name.go.tmpl deleted file mode 100644 index 320ff3d2744a..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/repository_short_name_from_name.go.tmpl +++ /dev/null @@ -1,21 +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 v - } - - // We can't use a standard name_from_self_link because the name can include /'s - parts := strings.SplitAfterN(v.(string), "/", 4) - return parts[3] -} diff --git a/mmv1/templates/terraform/custom_flatten/go/scan_config_auth_custom_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/scan_config_auth_custom_password.go.tmpl deleted file mode 100644 index b4d6ae45d9d0..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/scan_config_auth_custom_password.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("authentication.0.custom_account.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/scan_config_auth_google_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/scan_config_auth_google_password.go.tmpl deleted file mode 100644 index 0b29948e4868..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/scan_config_auth_google_password.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("authentication.0.google_account.0.password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/secret_version_access.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/secret_version_access.go.tmpl deleted file mode 100644 index 96648c12a922..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/secret_version_access.go.tmpl +++ /dev/null @@ -1,56 +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{} { - transformed := make(map[string]interface{}) - - // if this secret version is disabled, the api will return an error, as the value cannot be accessed, return what we have - if d.Get("enabled").(bool) == false { - transformed["secret_data"] = d.Get("secret_data") - return []interface{}{transformed} - } - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SecretManagerBasePath{{"}}"}}{{"{{"}}name{{"}}"}}:access") - if err != nil { - return err - } - - parts := strings.Split(d.Get("name").(string), "/") - project := parts[1] - - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - accessRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return err - } - - if d.Get("is_secret_data_base64").(bool) { - transformed["secret_data"] = accessRes["payload"].(map[string]interface{})["data"].(string) - } else { - data, err := base64.StdEncoding.DecodeString(accessRes["payload"].(map[string]interface{})["data"].(string)) - if err != nil { - return err - } - transformed["secret_data"] = string(data) - } - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/secret_version_enable.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/secret_version_enable.go.tmpl deleted file mode 100644 index 7181f6359ee1..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/secret_version_enable.go.tmpl +++ /dev/null @@ -1,19 +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.(string) == "ENABLED" { - return true - } - - return false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/secret_version_version.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/secret_version_version.go.tmpl deleted file mode 100644 index a9a0c57977c6..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/secret_version_version.go.tmpl +++ /dev/null @@ -1,23 +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{} { - name := d.Get("name").(string) - secretRegex := regexp.MustCompile("projects/(.+)/secrets/(.+)/versions/(.+)$") - - parts := secretRegex.FindStringSubmatch(name) - if len(parts) != 4 { - panic(fmt.Sprintf("Version name does not fit the format `projects/{{"{{"}}project{{"}}"}}/secrets/{{"{{"}}secret{{"}}"}}/versions/{{"{{"}}version{{"}}"}}`")) - } - - return parts[3] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/securityposture_custom_constraint_name.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/securityposture_custom_constraint_name.go.tmpl deleted file mode 100644 index f57b9e3dc050..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/securityposture_custom_constraint_name.go.tmpl +++ /dev/null @@ -1,23 +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 v - } - - revisionIdLength := 8 - name := v.(string) - name = name[:len(name)-revisionIdLength] - - return name -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/set_to_project.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/set_to_project.go.tmpl deleted file mode 100644 index d40f11d84181..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/set_to_project.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("project") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/sha256.tmpl b/mmv1/templates/terraform/custom_flatten/go/sha256.tmpl deleted file mode 100644 index 856f66f4e0c1..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/sha256.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return hex.EncodeToString(sha256.New().Sum([]byte(v.(string)))) -} diff --git a/mmv1/templates/terraform/custom_flatten/go/source_representation_instance_configuration_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/source_representation_instance_configuration_password.go.tmpl deleted file mode 100644 index 5a23337cfd9d..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/source_representation_instance_configuration_password.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("password") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/string_to_bool.tmpl b/mmv1/templates/terraform/custom_flatten/go/string_to_bool.tmpl deleted file mode 100644 index d14ad0743f66..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/string_to_bool.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return v - } - b, err := strconv.ParseBool(v.(string)) - if err != nil { - // If we can't convert it into a bool return value as is and let caller handle it - return v - } - return b -} diff --git a/mmv1/templates/terraform/custom_flatten/go/string_to_bool_default_true.tmpl b/mmv1/templates/terraform/custom_flatten/go/string_to_bool_default_true.tmpl deleted file mode 100644 index 1c18228427da..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/string_to_bool_default_true.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if v == nil { - return true - } - b, err := strconv.ParseBool(v.(string)) - if err != nil { - // If we can't convert it into a bool return value as is and let caller handle it - return v - } - return b -} diff --git a/mmv1/templates/terraform/custom_flatten/go/subnetwork_log_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/subnetwork_log_config.go.tmpl deleted file mode 100644 index 31a086e3c263..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/subnetwork_log_config.go.tmpl +++ /dev/null @@ -1,44 +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 - } - - v, ok := original["enable"] - if ok && !v.(bool) { - return nil - } - - transformed := make(map[string]interface{}) - transformed["flow_sampling"] = original["flowSampling"] - transformed["aggregation_interval"] = original["aggregationInterval"] - transformed["metadata"] = original["metadata"] - if original["metadata"].(string) == "CUSTOM_METADATA" { - transformed["metadata_fields"] = original["metadataFields"] - } else { - // MetadataFields can only be set when metadata is CUSTOM_METADATA. However, when updating - // from custom to include/exclude, the API will return the previous values of the metadata fields, - // despite not actually having any custom fields at the moment. The API team has confirmed - // this as WAI (b/162771344), so we work around it by clearing the response if metadata is - // not custom. - transformed["metadata_fields"] = nil - } - transformed["filter_expr"] = original["filterExpr"] - - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/tags_tag_binding_name.tmpl b/mmv1/templates/terraform/custom_flatten/go/tags_tag_binding_name.tmpl deleted file mode 100644 index 5555c41dbf53..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/tags_tag_binding_name.tmpl +++ /dev/null @@ -1,19 +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 v - } - parts := strings.Split(v.(string), "/") - return strings.Join(parts[len(parts)-3:], "/") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/uptime_check_http_password.tmpl b/mmv1/templates/terraform/custom_flatten/go/uptime_check_http_password.tmpl deleted file mode 100644 index 6a791880f65c..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/uptime_check_http_password.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return d.Get("http_check.0.auth_info.0.password") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_feature_group_ignore_description.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/vertex_ai_feature_group_ignore_description.go.tmpl deleted file mode 100644 index 52ee7a82a028..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_feature_group_ignore_description.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("description") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_feature_view_ignore_project_number.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/vertex_ai_feature_view_ignore_project_number.go.tmpl deleted file mode 100644 index 8f68845fe2ea..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_feature_view_ignore_project_number.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("feature_registry_source.0.project_number") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_endpoint_private_service_connect_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_endpoint_private_service_connect_config.go.tmpl deleted file mode 100644 index be921aead132..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_endpoint_private_service_connect_config.go.tmpl +++ /dev/null @@ -1,40 +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{} { - transformed := make(map[string]interface{}) - - if v == nil { - // Disabled by default, but API will not return object if value is false - transformed["enable_private_service_connect"] = false - return []interface{}{transformed} - } - - original := v.(map[string]interface{}) - if len(original) == 0 { - return nil - } - - transformed["enable_private_service_connect"] = - flattenVertexAIIndexEndpointPrivateServiceConnectConfigEnablePrivateServiceConnect(original["enablePrivateServiceConnect"], d, config) - transformed["project_allowlist"] = - flattenVertexAIIndexEndpointPrivateServiceConnectConfigProjectAllowlist(original["projectAllowlist"], d, config) - return []interface{}{transformed} -} - -func flattenVertexAIIndexEndpointPrivateServiceConnectConfigEnablePrivateServiceConnect(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenVertexAIIndexEndpointPrivateServiceConnectConfigProjectAllowlist(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} diff --git a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_ignore_contents_delta_uri.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_ignore_contents_delta_uri.go.tmpl deleted file mode 100644 index 571033c66459..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_ignore_contents_delta_uri.go.tmpl +++ /dev/null @@ -1,16 +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{} { - // We want to ignore read on this field, but cannot because it is nested - return d.Get("metadata.0.contents_delta_uri") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_ignore_is_complete_overwrite.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_ignore_is_complete_overwrite.go.tmpl deleted file mode 100644 index 0aab2cee1386..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/vertex_ai_index_ignore_is_complete_overwrite.go.tmpl +++ /dev/null @@ -1,16 +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{} { - // We want to ignore read on this field, but cannot because it is nested - return d.Get("metadata.0.is_complete_overwrite") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/workbench_instance_boot_disk_type_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/workbench_instance_boot_disk_type_flatten.go.tmpl deleted file mode 100644 index a66fbf78d002..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/workbench_instance_boot_disk_type_flatten.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("gce_setup.0.boot_disk.0.disk_type") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/workbench_instance_data_disk_type_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/workbench_instance_data_disk_type_flatten.go.tmpl deleted file mode 100644 index b144903bffc6..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/workbench_instance_data_disk_type_flatten.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("gce_setup.0.data_disks.0.disk_type") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/workbench_instance_vm_image_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/workbench_instance_vm_image_flatten.go.tmpl deleted file mode 100644 index fe4419e18d00..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/workbench_instance_vm_image_flatten.go.tmpl +++ /dev/null @@ -1,15 +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{} { - return d.Get("gce_setup.0.vm_image") -} diff --git a/mmv1/templates/terraform/custom_flatten/go/workstations_config_confidential_instance.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/workstations_config_confidential_instance.go.tmpl deleted file mode 100644 index 2deeb14ca8fc..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/workstations_config_confidential_instance.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. -*/ -}} -func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - transformed := make(map[string]interface{}) - - // Defaults for when no value is provided by API. - transformed["enable_confidential_compute"] = false - - if v == nil { - return []interface{}{transformed} - } - - original := v.(map[string]interface{}) - if original["enableConfidentialCompute"] != nil { - transformed["enable_confidential_compute"] = original["enableConfidentialCompute"] - } - - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/go/workstations_config_shielded_instance.go.tmpl b/mmv1/templates/terraform/custom_flatten/go/workstations_config_shielded_instance.go.tmpl deleted file mode 100644 index 9a1f51712fc5..000000000000 --- a/mmv1/templates/terraform/custom_flatten/go/workstations_config_shielded_instance.go.tmpl +++ /dev/null @@ -1,37 +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{} { - transformed := make(map[string]interface{}) - - // Defaults for when no value is provided by API. - transformed["enable_secure_boot"] = false - transformed["enable_vtpm"] = false - transformed["enable_integrity_monitoring"] = false - - if v == nil { - return []interface{}{transformed} - } - - original := v.(map[string]interface{}) - if original["enableSecureBoot"] != nil { - transformed["enable_secure_boot"] = original["enableSecureBoot"] - } - if original["enableVtpm"] != nil { - transformed["enable_vtpm"] = original["enableVtpm"] - } - if original["enableIntegrityMonitoring"] != nil { - transformed["enable_integrity_monitoring"] = original["enableIntegrityMonitoring"] - } - - return []interface{}{transformed} -} diff --git a/mmv1/templates/terraform/custom_flatten/guard_self_link.go.tmpl b/mmv1/templates/terraform/custom_flatten/guard_self_link.go.tmpl index dff344f960f2..ebdfcd113dd2 100644 --- a/mmv1/templates/terraform/custom_flatten/guard_self_link.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/guard_self_link.go.tmpl @@ -1,20 +1,18 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> -<%# Not all self links behave like ResourceRef expects, eg they may expect a fully qualified url. In those - cases, we need to manually define this flattener. %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* Not all self links behave like ResourceRef expects, eg they may expect a fully qualified url. In those + cases, we need to manually define this flattener. */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v } diff --git a/mmv1/templates/terraform/custom_flatten/guard_self_link_array.go.tmpl b/mmv1/templates/terraform/custom_flatten/guard_self_link_array.go.tmpl index 0e925671ba7f..991d78e9eb36 100644 --- a/mmv1/templates/terraform/custom_flatten/guard_self_link_array.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/guard_self_link_array.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> -<%# This should be used for multi-resource ref fields that can't be made to real resource refs yet %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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. +*/ -}} +{{/* This should be used for multi-resource ref fields that can't be made to real resource refs yet */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v } diff --git a/mmv1/templates/terraform/custom_flatten/health_check_log_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/health_check_log_config.go.tmpl index b64dcf10657b..055964af6c86 100644 --- a/mmv1/templates/terraform/custom_flatten/health_check_log_config.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/health_check_log_config.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2021 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { transformed := make(map[string]interface{}) if v == nil { // Disabled by default, but API will not return object if value is false diff --git a/mmv1/templates/terraform/custom_flatten/http_headers.tmpl b/mmv1/templates/terraform/custom_flatten/http_headers.tmpl index e46fad37416d..7ca9a567feb9 100644 --- a/mmv1/templates/terraform/custom_flatten/http_headers.tmpl +++ b/mmv1/templates/terraform/custom_flatten/http_headers.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) (interface{}) { +{{/* + 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{}) { var headers = v.(map[string]interface{}) if v, ok := headers["User-Agent"]; ok { if v.(string) == "AppEngine-Google; (+http://code.google.com/appengine)" { diff --git a/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_secret_value.go.tmpl b/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_secret_value.go.tmpl index 9ff979a95c91..6ddc09d748dd 100644 --- a/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_secret_value.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_secret_value.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.tmpl b/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.tmpl index 23cb2279fa8d..3cff63c1ac6e 100644 --- a/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/iam_workforce_pool_provider_oidc_client_secret_value.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/id_from_name.tmpl b/mmv1/templates/terraform/custom_flatten/id_from_name.tmpl index b900a9d86134..9e5840e1f524 100644 --- a/mmv1/templates/terraform/custom_flatten/id_from_name.tmpl +++ b/mmv1/templates/terraform/custom_flatten/id_from_name.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { parts := strings.Split(d.Get("name").(string), "/") return parts[len(parts)-1] } diff --git a/mmv1/templates/terraform/custom_flatten/identity_platform_config_anonymous.go.tmpl b/mmv1/templates/terraform/custom_flatten/identity_platform_config_anonymous.go.tmpl index 5487fd8a8ba1..f49bc93d2d0b 100644 --- a/mmv1/templates/terraform/custom_flatten/identity_platform_config_anonymous.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/identity_platform_config_anonymous.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil } diff --git a/mmv1/templates/terraform/custom_flatten/identity_platform_config_client_permissions.go.tmpl b/mmv1/templates/terraform/custom_flatten/identity_platform_config_client_permissions.go.tmpl index 26b4cbdd7fe8..7a7af98c6111 100644 --- a/mmv1/templates/terraform/custom_flatten/identity_platform_config_client_permissions.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/identity_platform_config_client_permissions.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil } diff --git a/mmv1/templates/terraform/custom_flatten/identity_platform_config_logging.go.tmpl b/mmv1/templates/terraform/custom_flatten/identity_platform_config_logging.go.tmpl index 5487fd8a8ba1..f49bc93d2d0b 100644 --- a/mmv1/templates/terraform/custom_flatten/identity_platform_config_logging.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/identity_platform_config_logging.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return nil } diff --git a/mmv1/templates/terraform/custom_flatten/image_kms_key_name.go.tmpl b/mmv1/templates/terraform/custom_flatten/image_kms_key_name.go.tmpl index d8cc1a4bf6cf..c5987badbb27 100644 --- a/mmv1/templates/terraform/custom_flatten/image_kms_key_name.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/image_kms_key_name.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/json_schema.tmpl b/mmv1/templates/terraform/custom_flatten/json_schema.tmpl index 5f26c9695d09..ab1c9cfb42ee 100644 --- a/mmv1/templates/terraform/custom_flatten/json_schema.tmpl +++ b/mmv1/templates/terraform/custom_flatten/json_schema.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/json_to_string_map.go.tmpl b/mmv1/templates/terraform/custom_flatten/json_to_string_map.go.tmpl index 4a477eb63bf5..8d4b32b0b7bb 100644 --- a/mmv1/templates/terraform/custom_flatten/json_to_string_map.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/json_to_string_map.go.tmpl @@ -1,18 +1,16 @@ -<%- # the license inside this block applies to this file - # Copyright 2019 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/monitoring_slo_availability_sli.go.tmpl b/mmv1/templates/terraform/custom_flatten/monitoring_slo_availability_sli.go.tmpl index 83e9941fec57..41393fc0d5bd 100644 --- a/mmv1/templates/terraform/custom_flatten/monitoring_slo_availability_sli.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/monitoring_slo_availability_sli.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/name_from_self_link.tmpl b/mmv1/templates/terraform/custom_flatten/name_from_self_link.tmpl index 509649b667c4..24b2086d705e 100644 --- a/mmv1/templates/terraform/custom_flatten/name_from_self_link.tmpl +++ b/mmv1/templates/terraform/custom_flatten/name_from_self_link.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/nat_rules_ip_set.tmpl b/mmv1/templates/terraform/custom_flatten/nat_rules_ip_set.tmpl index f943b72efa9c..6d245519e802 100644 --- a/mmv1/templates/terraform/custom_flatten/nat_rules_ip_set.tmpl +++ b/mmv1/templates/terraform/custom_flatten/nat_rules_ip_set.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v } diff --git a/mmv1/templates/terraform/custom_flatten/nat_rules_subnets_set.tmpl b/mmv1/templates/terraform/custom_flatten/nat_rules_subnets_set.tmpl index e792b115351d..d3dcd6a35fbc 100644 --- a/mmv1/templates/terraform/custom_flatten/nat_rules_subnets_set.tmpl +++ b/mmv1/templates/terraform/custom_flatten/nat_rules_subnets_set.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v } diff --git a/mmv1/templates/terraform/custom_flatten/netapp_volume_replicaton_mirror_state.go.tmpl b/mmv1/templates/terraform/custom_flatten/netapp_volume_replicaton_mirror_state.go.tmpl index 90881e839b6e..7ac83da1080a 100644 --- a/mmv1/templates/terraform/custom_flatten/netapp_volume_replicaton_mirror_state.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/netapp_volume_replicaton_mirror_state.go.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { // Actual state of replication_enabled depends on mirrorState. let's update it. // This is to pickup manual user STOP/RESUME operations on the replication. if v == nil { diff --git a/mmv1/templates/terraform/custom_flatten/network_services_timeout_mirror.go.tmpl b/mmv1/templates/terraform/custom_flatten/network_services_timeout_mirror.go.tmpl index ddaef364748a..dde4bac022fa 100644 --- a/mmv1/templates/terraform/custom_flatten/network_services_timeout_mirror.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/network_services_timeout_mirror.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2021 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { out := make(map[string]string) if v == nil { diff --git a/mmv1/templates/terraform/custom_flatten/object_to_bool.go.tmpl b/mmv1/templates/terraform/custom_flatten/object_to_bool.go.tmpl index 712f4bef2e8e..387434d8af56 100644 --- a/mmv1/templates/terraform/custom_flatten/object_to_bool.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/object_to_bool.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return v != nil } diff --git a/mmv1/templates/terraform/custom_flatten/os_config_patch_deployment_recurring_schedule_time_of_day.go.tmpl b/mmv1/templates/terraform/custom_flatten/os_config_patch_deployment_recurring_schedule_time_of_day.go.tmpl index 5eda6def7d10..8f58473b844b 100644 --- a/mmv1/templates/terraform/custom_flatten/os_config_patch_deployment_recurring_schedule_time_of_day.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/os_config_patch_deployment_recurring_schedule_time_of_day.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/preserved_state_disks.go.tmpl b/mmv1/templates/terraform/custom_flatten/preserved_state_disks.go.tmpl index 24227c158267..fe9c3ddaec37 100644 --- a/mmv1/templates/terraform/custom_flatten/preserved_state_disks.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/preserved_state_disks.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/privateca_certificate_509_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/privateca_certificate_509_config.go.tmpl index 9d007f897481..c08addd0f5e3 100644 --- a/mmv1/templates/terraform/custom_flatten/privateca_certificate_509_config.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/privateca_certificate_509_config.go.tmpl @@ -1,5 +1,5 @@ -<%# See mmv1/third_party/terraform/utils/privateca_utils.go for the sub-expanders and explanation %> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* See mmv1/third_party/terraform/utils/privateca_utils.go for the sub-expanders and explanation */}} +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { v = make(map[string]interface{}) } diff --git a/mmv1/templates/terraform/custom_flatten/privateca_certificate_authority_subordinate_config_certificate_authority.go.tmpl b/mmv1/templates/terraform/custom_flatten/privateca_certificate_authority_subordinate_config_certificate_authority.go.tmpl index ef71fb55908c..037485ed89aa 100644 --- a/mmv1/templates/terraform/custom_flatten/privateca_certificate_authority_subordinate_config_certificate_authority.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/privateca_certificate_authority_subordinate_config_certificate_authority.go.tmpl @@ -1,3 +1,3 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("subordinate_config.0.certificate_authority") } diff --git a/mmv1/templates/terraform/custom_flatten/pubsub_no_wrapper_write_metadata_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/pubsub_no_wrapper_write_metadata_flatten.go.tmpl index 19f0d71ab1b6..e41bf88fdde2 100644 --- a/mmv1/templates/terraform/custom_flatten/pubsub_no_wrapper_write_metadata_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/pubsub_no_wrapper_write_metadata_flatten.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/repository_short_name_from_name.go.tmpl b/mmv1/templates/terraform/custom_flatten/repository_short_name_from_name.go.tmpl index 2c3fd68b72cf..320ff3d2744a 100644 --- a/mmv1/templates/terraform/custom_flatten/repository_short_name_from_name.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/repository_short_name_from_name.go.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/scan_config_auth_custom_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/scan_config_auth_custom_password.go.tmpl index b83c16448a75..b4d6ae45d9d0 100644 --- a/mmv1/templates/terraform/custom_flatten/scan_config_auth_custom_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/scan_config_auth_custom_password.go.tmpl @@ -1,3 +1,3 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("authentication.0.custom_account.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/scan_config_auth_google_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/scan_config_auth_google_password.go.tmpl index 78db7c6ae6bd..0b29948e4868 100644 --- a/mmv1/templates/terraform/custom_flatten/scan_config_auth_google_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/scan_config_auth_google_password.go.tmpl @@ -1,3 +1,3 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("authentication.0.google_account.0.password") } diff --git a/mmv1/templates/terraform/custom_flatten/secret_version_access.go.tmpl b/mmv1/templates/terraform/custom_flatten/secret_version_access.go.tmpl index fbfc706d5242..96648c12a922 100644 --- a/mmv1/templates/terraform/custom_flatten/secret_version_access.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/secret_version_access.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { transformed := make(map[string]interface{}) // if this secret version is disabled, the api will return an error, as the value cannot be accessed, return what we have @@ -21,7 +19,7 @@ func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d return []interface{}{transformed} } - url, err := tpgresource.ReplaceVars(d, config, "{{SecretManagerBasePath}}{{name}}:access") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SecretManagerBasePath{{"}}"}}{{"{{"}}name{{"}}"}}:access") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_flatten/secret_version_enable.go.tmpl b/mmv1/templates/terraform/custom_flatten/secret_version_enable.go.tmpl index 2e790462c6c1..7181f6359ee1 100644 --- a/mmv1/templates/terraform/custom_flatten/secret_version_enable.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/secret_version_enable.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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.(string) == "ENABLED" { return true } diff --git a/mmv1/templates/terraform/custom_flatten/secret_version_version.go.tmpl b/mmv1/templates/terraform/custom_flatten/secret_version_version.go.tmpl index 09094379b900..a9a0c57977c6 100644 --- a/mmv1/templates/terraform/custom_flatten/secret_version_version.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/secret_version_version.go.tmpl @@ -1,24 +1,22 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { name := d.Get("name").(string) secretRegex := regexp.MustCompile("projects/(.+)/secrets/(.+)/versions/(.+)$") parts := secretRegex.FindStringSubmatch(name) if len(parts) != 4 { - panic(fmt.Sprintf("Version name does not fit the format `projects/{{project}}/secrets/{{secret}}/versions/{{version}}`")) + panic(fmt.Sprintf("Version name does not fit the format `projects/{{"{{"}}project{{"}}"}}/secrets/{{"{{"}}secret{{"}}"}}/versions/{{"{{"}}version{{"}}"}}`")) } return parts[3] diff --git a/mmv1/templates/terraform/custom_flatten/securityposture_custom_constraint_name.go.tmpl b/mmv1/templates/terraform/custom_flatten/securityposture_custom_constraint_name.go.tmpl index 41b79b24a58d..f57b9e3dc050 100644 --- a/mmv1/templates/terraform/custom_flatten/securityposture_custom_constraint_name.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/securityposture_custom_constraint_name.go.tmpl @@ -1,18 +1,16 @@ -<%# 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/set_to_project.go.tmpl b/mmv1/templates/terraform/custom_flatten/set_to_project.go.tmpl index 463e7f74d1de..d40f11d84181 100644 --- a/mmv1/templates/terraform/custom_flatten/set_to_project.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/set_to_project.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("project") } diff --git a/mmv1/templates/terraform/custom_flatten/sha256.tmpl b/mmv1/templates/terraform/custom_flatten/sha256.tmpl index a4728bdc42a6..856f66f4e0c1 100644 --- a/mmv1/templates/terraform/custom_flatten/sha256.tmpl +++ b/mmv1/templates/terraform/custom_flatten/sha256.tmpl @@ -1,3 +1,3 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return hex.EncodeToString(sha256.New().Sum([]byte(v.(string)))) } diff --git a/mmv1/templates/terraform/custom_flatten/source_representation_instance_configuration_password.go.tmpl b/mmv1/templates/terraform/custom_flatten/source_representation_instance_configuration_password.go.tmpl index 80707a1756ff..5a23337cfd9d 100644 --- a/mmv1/templates/terraform/custom_flatten/source_representation_instance_configuration_password.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/source_representation_instance_configuration_password.go.tmpl @@ -1,3 +1,3 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("password") } diff --git a/mmv1/templates/terraform/custom_flatten/string_to_bool.tmpl b/mmv1/templates/terraform/custom_flatten/string_to_bool.tmpl index 6006682bcea1..d14ad0743f66 100644 --- a/mmv1/templates/terraform/custom_flatten/string_to_bool.tmpl +++ b/mmv1/templates/terraform/custom_flatten/string_to_bool.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v } diff --git a/mmv1/templates/terraform/custom_flatten/string_to_bool_default_true.tmpl b/mmv1/templates/terraform/custom_flatten/string_to_bool_default_true.tmpl index 7b108f6b6e33..1c18228427da 100644 --- a/mmv1/templates/terraform/custom_flatten/string_to_bool_default_true.tmpl +++ b/mmv1/templates/terraform/custom_flatten/string_to_bool_default_true.tmpl @@ -1,4 +1,4 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return true } diff --git a/mmv1/templates/terraform/custom_flatten/subnetwork_log_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/subnetwork_log_config.go.tmpl index b62a9e5202d5..31a086e3c263 100644 --- a/mmv1/templates/terraform/custom_flatten/subnetwork_log_config.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/subnetwork_log_config.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 } diff --git a/mmv1/templates/terraform/custom_flatten/tags_tag_binding_name.tmpl b/mmv1/templates/terraform/custom_flatten/tags_tag_binding_name.tmpl index f6ccef4ec292..5555c41dbf53 100644 --- a/mmv1/templates/terraform/custom_flatten/tags_tag_binding_name.tmpl +++ b/mmv1/templates/terraform/custom_flatten/tags_tag_binding_name.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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 v } diff --git a/mmv1/templates/terraform/custom_flatten/uptime_check_http_password.tmpl b/mmv1/templates/terraform/custom_flatten/uptime_check_http_password.tmpl index be03f8906938..6a791880f65c 100644 --- a/mmv1/templates/terraform/custom_flatten/uptime_check_http_password.tmpl +++ b/mmv1/templates/terraform/custom_flatten/uptime_check_http_password.tmpl @@ -1,3 +1,3 @@ -func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return d.Get("http_check.0.auth_info.0.password") } \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_group_ignore_description.go.tmpl b/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_group_ignore_description.go.tmpl index 61f2aa0d8915..52ee7a82a028 100644 --- a/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_group_ignore_description.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_group_ignore_description.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("description") } diff --git a/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_view_ignore_project_number.go.tmpl b/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_view_ignore_project_number.go.tmpl index f932939c0ab2..8f68845fe2ea 100644 --- a/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_view_ignore_project_number.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_view_ignore_project_number.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("feature_registry_source.0.project_number") } diff --git a/mmv1/templates/terraform/custom_flatten/vertex_ai_index_endpoint_private_service_connect_config.go.tmpl b/mmv1/templates/terraform/custom_flatten/vertex_ai_index_endpoint_private_service_connect_config.go.tmpl index f934d1922ab0..be921aead132 100644 --- a/mmv1/templates/terraform/custom_flatten/vertex_ai_index_endpoint_private_service_connect_config.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/vertex_ai_index_endpoint_private_service_connect_config.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { transformed := make(map[string]interface{}) if v == nil { diff --git a/mmv1/templates/terraform/custom_flatten/vertex_ai_index_ignore_contents_delta_uri.go.tmpl b/mmv1/templates/terraform/custom_flatten/vertex_ai_index_ignore_contents_delta_uri.go.tmpl index b6a78d8b2942..571033c66459 100644 --- a/mmv1/templates/terraform/custom_flatten/vertex_ai_index_ignore_contents_delta_uri.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/vertex_ai_index_ignore_contents_delta_uri.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { // We want to ignore read on this field, but cannot because it is nested return d.Get("metadata.0.contents_delta_uri") } diff --git a/mmv1/templates/terraform/custom_flatten/vertex_ai_index_ignore_is_complete_overwrite.go.tmpl b/mmv1/templates/terraform/custom_flatten/vertex_ai_index_ignore_is_complete_overwrite.go.tmpl index 4e895e663a4e..0aab2cee1386 100644 --- a/mmv1/templates/terraform/custom_flatten/vertex_ai_index_ignore_is_complete_overwrite.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/vertex_ai_index_ignore_is_complete_overwrite.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { // We want to ignore read on this field, but cannot because it is nested return d.Get("metadata.0.is_complete_overwrite") } diff --git a/mmv1/templates/terraform/custom_flatten/workbench_instance_boot_disk_type_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/workbench_instance_boot_disk_type_flatten.go.tmpl index 05092c33d46c..a66fbf78d002 100644 --- a/mmv1/templates/terraform/custom_flatten/workbench_instance_boot_disk_type_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/workbench_instance_boot_disk_type_flatten.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("gce_setup.0.boot_disk.0.disk_type") } diff --git a/mmv1/templates/terraform/custom_flatten/workbench_instance_data_disk_type_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/workbench_instance_data_disk_type_flatten.go.tmpl index b23aa34b41e3..b144903bffc6 100644 --- a/mmv1/templates/terraform/custom_flatten/workbench_instance_data_disk_type_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/workbench_instance_data_disk_type_flatten.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("gce_setup.0.data_disks.0.disk_type") } diff --git a/mmv1/templates/terraform/custom_flatten/workbench_instance_vm_image_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/workbench_instance_vm_image_flatten.go.tmpl index 24a7978041e5..fe4419e18d00 100644 --- a/mmv1/templates/terraform/custom_flatten/workbench_instance_vm_image_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/workbench_instance_vm_image_flatten.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { return d.Get("gce_setup.0.vm_image") } diff --git a/mmv1/templates/terraform/custom_flatten/workstations_config_confidential_instance.go.tmpl b/mmv1/templates/terraform/custom_flatten/workstations_config_confidential_instance.go.tmpl index d4e9ad6f7083..2deeb14ca8fc 100644 --- a/mmv1/templates/terraform/custom_flatten/workstations_config_confidential_instance.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/workstations_config_confidential_instance.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { transformed := make(map[string]interface{}) // Defaults for when no value is provided by API. diff --git a/mmv1/templates/terraform/custom_flatten/workstations_config_shielded_instance.go.tmpl b/mmv1/templates/terraform/custom_flatten/workstations_config_shielded_instance.go.tmpl index a71fb22922d6..9a1f51712fc5 100644 --- a/mmv1/templates/terraform/custom_flatten/workstations_config_shielded_instance.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/workstations_config_shielded_instance.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { +{{/* + 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{} { transformed := make(map[string]interface{}) // Defaults for when no value is provided by API. 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 269d4812fbdd..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 @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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 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 269d4812fbdd..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 @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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 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 ca296eb49259..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 @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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 diff --git a/mmv1/templates/terraform/custom_import/alloydb_instance.go.tmpl b/mmv1/templates/terraform/custom_import/alloydb_instance.go.tmpl index 3bf164604013..177c9f1f3e35 100644 --- a/mmv1/templates/terraform/custom_import/alloydb_instance.go.tmpl +++ b/mmv1/templates/terraform/custom_import/alloydb_instance.go.tmpl @@ -8,7 +8,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{cluster}}/instances/{{instance_id}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}cluster{{"}}"}}/instances/{{"{{"}}instance_id{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/alloydb_user.go.tmpl b/mmv1/templates/terraform/custom_import/alloydb_user.go.tmpl index 188d9e27a5da..3beaa7454e21 100644 --- a/mmv1/templates/terraform/custom_import/alloydb_user.go.tmpl +++ b/mmv1/templates/terraform/custom_import/alloydb_user.go.tmpl @@ -8,7 +8,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{cluster}}/users/{{user_id}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}cluster{{"}}"}}/users/{{"{{"}}user_id{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_addons.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_addons.go.tmpl index 1c09d8c09a07..4cefb8fa8373 100644 --- a/mmv1/templates/terraform/custom_import/apigee_addons.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_addons.go.tmpl @@ -17,8 +17,8 @@ switch len(parts) { return nil, fmt.Errorf( "Saw %s when the org is expected to have shape %s or %s", d.Get("org"), - "{{org}}", - "organizations/{{org}}", + "{{"{{"}}org{{"}}"}}", + "organizations/{{"{{"}}org{{"}}"}}", ) } @@ -27,7 +27,7 @@ if err := d.Set("org", projectId); err != nil { } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "organizations/{{org}}") +id, err := tpgresource.ReplaceVars(d, config, "organizations/{{"{{"}}org{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_endpoint_attachment.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_endpoint_attachment.go.tmpl index 9bfc3aeab667..6685ea3bd72b 100644 --- a/mmv1/templates/terraform/custom_import/apigee_endpoint_attachment.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_endpoint_attachment.go.tmpl @@ -7,7 +7,7 @@ if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nameParts := strings.Split(d.Get("name").(string), "/") if len(nameParts) == 4 { - // `organizations/{{org_name}}/endpointAttachment/{{endpoint_attachment_id}}` + // `organizations/{{"{{"}}org_name{{"}}"}}/endpointAttachment/{{"{{"}}endpoint_attachment_id{{"}}"}}` orgId := fmt.Sprintf("organizations/%s", nameParts[1]) if err := d.Set("org_id", orgId); err != nil { return nil, fmt.Errorf("Error setting org_id: %s", err) @@ -19,11 +19,11 @@ if len(nameParts) == 4 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s", d.Get("name"), - "organizations/{{org_name}}/environments/{{name}}") + "organizations/{{"{{"}}org_name{{"}}"}}/environments/{{"{{"}}name{{"}}"}}") } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_env_keystore_alias_self_signed_cert.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_env_keystore_alias_self_signed_cert.go.tmpl index 9373b1e45644..9f4fad4c441d 100644 --- a/mmv1/templates/terraform/custom_import/apigee_env_keystore_alias_self_signed_cert.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_env_keystore_alias_self_signed_cert.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "organizations/{{org_id}}/environments/{{environment}}/keystores/{{keystore}}/aliases/{{alias}}") +id, err := tpgresource.ReplaceVars(d, config, "organizations/{{"{{"}}org_id{{"}}"}}/environments/{{"{{"}}environment{{"}}"}}/keystores/{{"{{"}}keystore{{"}}"}}/aliases/{{"{{"}}alias{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_environment.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_environment.go.tmpl index 692b487836e8..bf637ce84657 100644 --- a/mmv1/templates/terraform/custom_import/apigee_environment.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_environment.go.tmpl @@ -7,7 +7,7 @@ if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nameParts := strings.Split(d.Get("name").(string), "/") if len(nameParts) == 4 { - // `organizations/{{org_name}}/environments/{{name}}` + // `organizations/{{"{{"}}org_name{{"}}"}}/environments/{{"{{"}}name{{"}}"}}` orgId := fmt.Sprintf("organizations/%s", nameParts[1]) if err := d.Set("org_id", orgId); err != nil { return nil, fmt.Errorf("Error setting org_id: %s", err) @@ -16,7 +16,7 @@ if len(nameParts) == 4 { return nil, fmt.Errorf("Error setting name: %s", err) } } else if len(nameParts) == 3 { - // `organizations/{{org_name}}/{{name}}` + // `organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}` orgId := fmt.Sprintf("organizations/%s", nameParts[1]) if err := d.Set("org_id", orgId); err != nil { return nil, fmt.Errorf("Error setting org_id: %s", err) @@ -28,12 +28,12 @@ if len(nameParts) == 4 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s or %s", d.Get("name"), - "organizations/{{org_name}}/environments/{{name}}", - "organizations/{{org_name}}/{{name}}") + "organizations/{{"{{"}}org_name{{"}}"}}/environments/{{"{{"}}name{{"}}"}}", + "organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}") } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{org_id}}/environments/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}org_id{{"}}"}}/environments/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_environment_group.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_environment_group.go.tmpl index 1151e4aa1903..1afb318c6f34 100644 --- a/mmv1/templates/terraform/custom_import/apigee_environment_group.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_environment_group.go.tmpl @@ -7,7 +7,7 @@ if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nameParts := strings.Split(d.Get("name").(string), "/") if len(nameParts) == 4 { - // `organizations/{{org_name}}/envgroups/{{name}}` + // `organizations/{{"{{"}}org_name{{"}}"}}/envgroups/{{"{{"}}name{{"}}"}}` orgId := fmt.Sprintf("organizations/%s", nameParts[1]) if err := d.Set("org_id", orgId); err != nil { return nil, fmt.Errorf("Error setting org_id: %s", err) @@ -16,7 +16,7 @@ if len(nameParts) == 4 { return nil, fmt.Errorf("Error setting name: %s", err) } } else if len(nameParts) == 3 { - // `organizations/{{org_name}}/{{name}}` + // `organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}` orgId := fmt.Sprintf("organizations/%s", nameParts[1]) if err := d.Set("org_id", orgId); err != nil { return nil, fmt.Errorf("Error setting org_id: %s", err) @@ -28,12 +28,12 @@ if len(nameParts) == 4 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s or %s", d.Get("name"), - "organizations/{{org_name}}/envgroups/{{name}}", - "organizations/{{org_name}}/{{name}}") + "organizations/{{"{{"}}org_name{{"}}"}}/envgroups/{{"{{"}}name{{"}}"}}", + "organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}") } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{org_id}}/envgroups/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}org_id{{"}}"}}/envgroups/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_environment_group_attachment.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_environment_group_attachment.go.tmpl index a5eefd0ebde6..24bfa13ebca4 100644 --- a/mmv1/templates/terraform/custom_import/apigee_environment_group_attachment.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_environment_group_attachment.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{envgroup_id}}/attachments/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}envgroup_id{{"}}"}}/attachments/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_environment_keystore.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_environment_keystore.go.tmpl index 46dc70cf49b6..05adf74c9a42 100644 --- a/mmv1/templates/terraform/custom_import/apigee_environment_keystore.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_environment_keystore.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{env_id}}/keystores/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_id{{"}}"}}/keystores/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_environment_keyvaluemaps.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_environment_keyvaluemaps.go.tmpl index 873a7d5f8b98..7c9f168d706a 100644 --- a/mmv1/templates/terraform/custom_import/apigee_environment_keyvaluemaps.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_environment_keyvaluemaps.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{env_id}}/keyvaluemaps/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_id{{"}}"}}/keyvaluemaps/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_environment_keyvaluemaps_entries.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_environment_keyvaluemaps_entries.go.tmpl index 43fe2de5a983..b54471e2db28 100644 --- a/mmv1/templates/terraform/custom_import/apigee_environment_keyvaluemaps_entries.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_environment_keyvaluemaps_entries.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{env_keyvaluemap_id}}/entries/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_keyvaluemap_id{{"}}"}}/entries/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_environment_reference.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_environment_reference.go.tmpl index 4bc6f8c86380..37eb0dfaa1d1 100644 --- a/mmv1/templates/terraform/custom_import/apigee_environment_reference.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_environment_reference.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{env_id}}/references/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_id{{"}}"}}/references/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_instance.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_instance.go.tmpl index af9c8d6e2b71..a06fe9353325 100644 --- a/mmv1/templates/terraform/custom_import/apigee_instance.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_instance.go.tmpl @@ -7,7 +7,7 @@ if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nameParts := strings.Split(d.Get("name").(string), "/") if len(nameParts) == 4 { - // `organizations/{{org_name}}/instances/{{name}}` + // `organizations/{{"{{"}}org_name{{"}}"}}/instances/{{"{{"}}name{{"}}"}}` orgId := fmt.Sprintf("organizations/%s", nameParts[1]) if err := d.Set("org_id", orgId); err != nil { return nil, fmt.Errorf("Error setting org_id: %s", err) @@ -16,7 +16,7 @@ if len(nameParts) == 4 { return nil, fmt.Errorf("Error setting name: %s", err) } } else if len(nameParts) == 3 { - // `organizations/{{org_name}}/{{name}}` + // `organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}` orgId := fmt.Sprintf("organizations/%s", nameParts[1]) if err := d.Set("org_id", orgId); err != nil { return nil, fmt.Errorf("Error setting org_id: %s", err) @@ -28,12 +28,12 @@ if len(nameParts) == 4 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s or %s", d.Get("name"), - "organizations/{{org_name}}/instances/{{name}}", - "organizations/{{org_name}}/{{name}}") + "organizations/{{"{{"}}org_name{{"}}"}}/instances/{{"{{"}}name{{"}}"}}", + "organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}") } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{org_id}}/instances/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}org_id{{"}}"}}/instances/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_instance_attachment.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_instance_attachment.go.tmpl index 3cabdf0231f7..ef29ac333c5f 100644 --- a/mmv1/templates/terraform/custom_import/apigee_instance_attachment.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_instance_attachment.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{instance_id}}/attachments/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}instance_id{{"}}"}}/attachments/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_nat_address.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_nat_address.go.tmpl index 15f633405237..cbf60f11f90b 100644 --- a/mmv1/templates/terraform/custom_import/apigee_nat_address.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_nat_address.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{instance_id}}/natAddresses/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}instance_id{{"}}"}}/natAddresses/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_organization.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_organization.go.tmpl index ab77a521f4ad..ffcad2c9c2fc 100644 --- a/mmv1/templates/terraform/custom_import/apigee_organization.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_organization.go.tmpl @@ -17,8 +17,8 @@ switch len(parts) { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s or %s", d.Get("name"), - "{{name}}", - "organizations/{{name}}", + "{{"{{"}}name{{"}}"}}", + "organizations/{{"{{"}}name{{"}}"}}", ) } @@ -31,7 +31,7 @@ if err := d.Set("project_id", projectId); err != nil { } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "organizations/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "organizations/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/apigee_target_server.go.tmpl b/mmv1/templates/terraform/custom_import/apigee_target_server.go.tmpl index b9710b364f3b..890c263a23de 100644 --- a/mmv1/templates/terraform/custom_import/apigee_target_server.go.tmpl +++ b/mmv1/templates/terraform/custom_import/apigee_target_server.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{env_id}}/targetservers/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_id{{"}}"}}/targetservers/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/bigquery_data_transfer_self_link_as_name_set_location.go.tmpl b/mmv1/templates/terraform/custom_import/bigquery_data_transfer_self_link_as_name_set_location.go.tmpl index d145b5201a08..315ffb1dc13e 100644 --- a/mmv1/templates/terraform/custom_import/bigquery_data_transfer_self_link_as_name_set_location.go.tmpl +++ b/mmv1/templates/terraform/custom_import/bigquery_data_transfer_self_link_as_name_set_location.go.tmpl @@ -6,7 +6,7 @@ if err := tpgresource.ParseImportId([]string{"(?P[^ ]+) (?P[^ ]+) return nil, err } -// import location if the name format follows: projects/{{project}}/locations/{{location}}/transferConfigs/{{config_id}} +// import location if the name format follows: projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/transferConfigs/{{"{{"}}config_id{{"}}"}} name := d.Get("name").(string) stringParts := strings.Split(name, "/") if len(stringParts) == 6 { diff --git a/mmv1/templates/terraform/custom_import/bigquery_reservation_capacity_commitment_set_id.go.tmpl b/mmv1/templates/terraform/custom_import/bigquery_reservation_capacity_commitment_set_id.go.tmpl index 0f3665a4d3df..a50db3aec431 100644 --- a/mmv1/templates/terraform/custom_import/bigquery_reservation_capacity_commitment_set_id.go.tmpl +++ b/mmv1/templates/terraform/custom_import/bigquery_reservation_capacity_commitment_set_id.go.tmpl @@ -8,7 +8,7 @@ if err := tpgresource.ParseImportId([]string{ } // Set name based on the components -if err := d.Set("name", "projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}"); err != nil { +if err := d.Set("name", "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/capacityCommitments/{{"{{"}}capacity_commitment_id{{"}}"}}"); err != nil { return nil, fmt.Errorf("Error setting name: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/compute_global_network_endpoint.go.tmpl b/mmv1/templates/terraform/custom_import/compute_global_network_endpoint.go.tmpl index 2a2813bf62a0..d18acbeeb4d0 100644 --- a/mmv1/templates/terraform/custom_import/compute_global_network_endpoint.go.tmpl +++ b/mmv1/templates/terraform/custom_import/compute_global_network_endpoint.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{project}}/{{global_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}global_network_endpoint_group{{"}}"}}/{{"{{"}}ip_address{{"}}"}}/{{"{{"}}fqdn{{"}}"}}/{{"{{"}}port{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/compute_instance_group_membership.go.tmpl b/mmv1/templates/terraform/custom_import/compute_instance_group_membership.go.tmpl index b2e4193ad5fc..30bab333777d 100644 --- a/mmv1/templates/terraform/custom_import/compute_instance_group_membership.go.tmpl +++ b/mmv1/templates/terraform/custom_import/compute_instance_group_membership.go.tmpl @@ -10,7 +10,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{project}}/{{zone}}/{{instance_group}}/{{instance}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}instance_group{{"}}"}}/{{"{{"}}instance{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/compute_network_endpoint.go.tmpl b/mmv1/templates/terraform/custom_import/compute_network_endpoint.go.tmpl index c43108e26870..600a834818eb 100644 --- a/mmv1/templates/terraform/custom_import/compute_network_endpoint.go.tmpl +++ b/mmv1/templates/terraform/custom_import/compute_network_endpoint.go.tmpl @@ -10,7 +10,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{project}}/{{zone}}/{{network_endpoint_group}}/{{instance}}/{{ip_address}}/{{port}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}network_endpoint_group{{"}}"}}/{{"{{"}}instance{{"}}"}}/{{"{{"}}ip_address{{"}}"}}/{{"{{"}}port{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/compute_region_network_endpoint.go.tmpl b/mmv1/templates/terraform/custom_import/compute_region_network_endpoint.go.tmpl index 8ac588f44c50..1b7094a9dc09 100644 --- a/mmv1/templates/terraform/custom_import/compute_region_network_endpoint.go.tmpl +++ b/mmv1/templates/terraform/custom_import/compute_region_network_endpoint.go.tmpl @@ -10,7 +10,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{project}}/{{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}region{{"}}"}}/{{"{{"}}region_network_endpoint_group{{"}}"}}/{{"{{"}}ip_address{{"}}"}}/{{"{{"}}fqdn{{"}}"}}/{{"{{"}}port{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/dialogflowcx_entity_type.go.tmpl b/mmv1/templates/terraform/custom_import/dialogflowcx_entity_type.go.tmpl index 5043bda6057d..f9d25f996f68 100644 --- a/mmv1/templates/terraform/custom_import/dialogflowcx_entity_type.go.tmpl +++ b/mmv1/templates/terraform/custom_import/dialogflowcx_entity_type.go.tmpl @@ -9,7 +9,7 @@ } // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{parent}}/entityTypes/{{name}}") + id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/entityTypes/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/dialogflowcx_environment.go.tmpl b/mmv1/templates/terraform/custom_import/dialogflowcx_environment.go.tmpl index 1a38edae1619..6b747275df25 100644 --- a/mmv1/templates/terraform/custom_import/dialogflowcx_environment.go.tmpl +++ b/mmv1/templates/terraform/custom_import/dialogflowcx_environment.go.tmpl @@ -9,7 +9,7 @@ } // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{parent}}/environments/{{name}}") + id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/environments/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/dialogflowcx_flow.go.tmpl b/mmv1/templates/terraform/custom_import/dialogflowcx_flow.go.tmpl index 6deca14d0d1c..a69dac07a32a 100644 --- a/mmv1/templates/terraform/custom_import/dialogflowcx_flow.go.tmpl +++ b/mmv1/templates/terraform/custom_import/dialogflowcx_flow.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{parent}}/flows/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/flows/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/dialogflowcx_intent.go.tmpl b/mmv1/templates/terraform/custom_import/dialogflowcx_intent.go.tmpl index bf26d2f2de3d..50535d725ace 100644 --- a/mmv1/templates/terraform/custom_import/dialogflowcx_intent.go.tmpl +++ b/mmv1/templates/terraform/custom_import/dialogflowcx_intent.go.tmpl @@ -9,7 +9,7 @@ } // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{parent}}/intents/{{name}}") + id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/intents/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/dialogflowcx_page.go.tmpl b/mmv1/templates/terraform/custom_import/dialogflowcx_page.go.tmpl index c8edb98935ca..2ed9dd7a0409 100644 --- a/mmv1/templates/terraform/custom_import/dialogflowcx_page.go.tmpl +++ b/mmv1/templates/terraform/custom_import/dialogflowcx_page.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{parent}}/pages/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/pages/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/dialogflowcx_version.go.tmpl b/mmv1/templates/terraform/custom_import/dialogflowcx_version.go.tmpl index 643e166f53b0..b5f2069f0193 100644 --- a/mmv1/templates/terraform/custom_import/dialogflowcx_version.go.tmpl +++ b/mmv1/templates/terraform/custom_import/dialogflowcx_version.go.tmpl @@ -9,7 +9,7 @@ } // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{parent}}/versions/{{name}}") + id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/versions/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/dialogflowcx_webhook.go.tmpl b/mmv1/templates/terraform/custom_import/dialogflowcx_webhook.go.tmpl index ac5f6e131671..443ee07879da 100644 --- a/mmv1/templates/terraform/custom_import/dialogflowcx_webhook.go.tmpl +++ b/mmv1/templates/terraform/custom_import/dialogflowcx_webhook.go.tmpl @@ -9,7 +9,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{parent}}/webhooks/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/webhooks/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/discoveryengine_targetsite_set_id.go.tmpl b/mmv1/templates/terraform/custom_import/discoveryengine_targetsite_set_id.go.tmpl index 5a6ad471b9e4..cb84fa6f09b1 100644 --- a/mmv1/templates/terraform/custom_import/discoveryengine_targetsite_set_id.go.tmpl +++ b/mmv1/templates/terraform/custom_import/discoveryengine_targetsite_set_id.go.tmpl @@ -6,7 +6,7 @@ if err := tpgresource.ParseImportId([]string{ } // Set name based on the components -if err := d.Set("name", "projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}/siteSearchEngine/targetSites/{{target_site_id}}"); err != nil { +if err := d.Set("name", "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/collections/default_collection/dataStores/{{"{{"}}data_store_id{{"}}"}}/siteSearchEngine/targetSites/{{"{{"}}target_site_id{{"}}"}}"); err != nil { return nil, fmt.Errorf("Error setting name: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/dlp_import.go.tmpl b/mmv1/templates/terraform/custom_import/dlp_import.go.tmpl index 387417e18760..73547fda9ced 100644 --- a/mmv1/templates/terraform/custom_import/dlp_import.go.tmpl +++ b/mmv1/templates/terraform/custom_import/dlp_import.go.tmpl @@ -14,16 +14,16 @@ return nil, fmt.Errorf("Error setting name: %s", err) } } else { - return nil, fmt.Errorf("Unexpected import id: %s, expected form {{parent}}/<%= object.name.camelize(:lower) -%>/{{name}}", d.Get("name").(string)) + return nil, fmt.Errorf("Unexpected import id: %s, expected form {{"{{"}}parent{{"}}"}}/{{camelize $.Name "lower"}}/{{"{{"}}name{{"}}"}}", d.Get("name").(string)) } - // Remove "/<%= object.name.camelize(:lower) -%>/{{name}}" from the id + // Remove "/{{camelize $.Name "lower"}}/{{"{{"}}name{{"}}"}}" from the id parts = parts[:len(parts)-2] if err := d.Set("parent", strings.Join(parts, "/")); err != nil { return nil, fmt.Errorf("Error setting parent: %s", err) } // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{parent}}/<%= object.name.camelize(:lower) -%>s/{{name}}") + id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/{{camelize $.Name "lower"}}s/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_egress_policy.go.tmpl b/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_egress_policy.go.tmpl deleted file mode 100644 index 121f2ee42714..000000000000 --- a/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_egress_policy.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. -*/ -}} - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value - parts, err := tpgresource.GetImportIdQualifiers([]string{"accessPolicies/(?P[^/]+)/servicePerimeters/(?P[^/]+)"}, d, config, d.Id()) - if err != nil { - return nil, 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) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_ingress_policy.go.tmpl b/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_ingress_policy.go.tmpl deleted file mode 100644 index 121f2ee42714..000000000000 --- a/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_ingress_policy.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. -*/ -}} - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value - parts, err := tpgresource.GetImportIdQualifiers([]string{"accessPolicies/(?P[^/]+)/servicePerimeters/(?P[^/]+)"}, d, config, d.Id()) - if err != nil { - return nil, 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) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_resource.go.tmpl b/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_resource.go.tmpl deleted file mode 100644 index 77b57820573e..000000000000 --- a/mmv1/templates/terraform/custom_import/go/access_context_manager_service_perimeter_resource.go.tmpl +++ /dev/null @@ -1,27 +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 - parts, err := tpgresource.GetImportIdQualifiers([]string{"accessPolicies/(?P[^/]+)/servicePerimeters/(?P[^/]+)/(?P.+)"}, d, config, d.Id()) - if err != nil { - return nil, 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) - } - if err := d.Set("resource", parts["resource"]); err != nil { - return nil, fmt.Errorf("Error setting resource: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/alloydb_instance.go.tmpl b/mmv1/templates/terraform/custom_import/go/alloydb_instance.go.tmpl deleted file mode 100644 index 177c9f1f3e35..000000000000 --- a/mmv1/templates/terraform/custom_import/go/alloydb_instance.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats can't import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/instances/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}cluster{{"}}"}}/instances/{{"{{"}}instance_id{{"}}"}}") -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/go/alloydb_user.go.tmpl b/mmv1/templates/terraform/custom_import/go/alloydb_user.go.tmpl deleted file mode 100644 index 3beaa7454e21..000000000000 --- a/mmv1/templates/terraform/custom_import/go/alloydb_user.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats can't import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/users/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}cluster{{"}}"}}/users/{{"{{"}}user_id{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_addons.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_addons.go.tmpl deleted file mode 100644 index 4cefb8fa8373..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_addons.go.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -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 -} - -parts := strings.Split(d.Get("org").(string), "/") - -var projectId string -switch len(parts) { - case 1: - projectId = parts[0] - case 2: - projectId = parts[1] - default: - return nil, fmt.Errorf( - "Saw %s when the org is expected to have shape %s or %s", - d.Get("org"), - "{{"{{"}}org{{"}}"}}", - "organizations/{{"{{"}}org{{"}}"}}", - ) -} - -if err := d.Set("org", projectId); err != nil { - return nil, fmt.Errorf("Error setting organization: %s", err) -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "organizations/{{"{{"}}org{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_endpoint_attachment.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_endpoint_attachment.go.tmpl deleted file mode 100644 index 6685ea3bd72b..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_endpoint_attachment.go.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err -} - -nameParts := strings.Split(d.Get("name").(string), "/") -if len(nameParts) == 4 { - // `organizations/{{"{{"}}org_name{{"}}"}}/endpointAttachment/{{"{{"}}endpoint_attachment_id{{"}}"}}` - orgId := fmt.Sprintf("organizations/%s", nameParts[1]) - if err := d.Set("org_id", orgId); err != nil { - return nil, fmt.Errorf("Error setting org_id: %s", err) - } - if err := d.Set("endpoint_attachment_id", nameParts[3]); err != nil { - return nil, fmt.Errorf("Error setting endpoint_attachment_id: %s", err) - } -} else { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s", - d.Get("name"), - "organizations/{{"{{"}}org_name{{"}}"}}/environments/{{"{{"}}name{{"}}"}}") -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_env_keystore_alias_self_signed_cert.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_env_keystore_alias_self_signed_cert.go.tmpl deleted file mode 100644 index 9f4fad4c441d..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_env_keystore_alias_self_signed_cert.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "organizations/(?P[^/]+)/environments/(?P[^/]+)/keystores/(?P[^/]+)/aliases/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "organizations/{{"{{"}}org_id{{"}}"}}/environments/{{"{{"}}environment{{"}}"}}/keystores/{{"{{"}}keystore{{"}}"}}/aliases/{{"{{"}}alias{{"}}"}}") -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/go/apigee_environment.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_environment.go.tmpl deleted file mode 100644 index bf637ce84657..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_environment.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err -} - -nameParts := strings.Split(d.Get("name").(string), "/") -if len(nameParts) == 4 { - // `organizations/{{"{{"}}org_name{{"}}"}}/environments/{{"{{"}}name{{"}}"}}` - orgId := fmt.Sprintf("organizations/%s", nameParts[1]) - if err := d.Set("org_id", orgId); err != nil { - return nil, fmt.Errorf("Error setting org_id: %s", err) - } - if err := d.Set("name", nameParts[3]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } -} else if len(nameParts) == 3 { - // `organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}` - orgId := fmt.Sprintf("organizations/%s", nameParts[1]) - if err := d.Set("org_id", orgId); err != nil { - return nil, fmt.Errorf("Error setting org_id: %s", err) - } - if err := d.Set("name", nameParts[2]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } -} else { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s or %s", - d.Get("name"), - "organizations/{{"{{"}}org_name{{"}}"}}/environments/{{"{{"}}name{{"}}"}}", - "organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}") -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}org_id{{"}}"}}/environments/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_environment_group.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_environment_group.go.tmpl deleted file mode 100644 index 1afb318c6f34..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_environment_group.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err -} - -nameParts := strings.Split(d.Get("name").(string), "/") -if len(nameParts) == 4 { - // `organizations/{{"{{"}}org_name{{"}}"}}/envgroups/{{"{{"}}name{{"}}"}}` - orgId := fmt.Sprintf("organizations/%s", nameParts[1]) - if err := d.Set("org_id", orgId); err != nil { - return nil, fmt.Errorf("Error setting org_id: %s", err) - } - if err := d.Set("name", nameParts[3]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } -} else if len(nameParts) == 3 { - // `organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}` - orgId := fmt.Sprintf("organizations/%s", nameParts[1]) - if err := d.Set("org_id", orgId); err != nil { - return nil, fmt.Errorf("Error setting org_id: %s", err) - } - if err := d.Set("name", nameParts[2]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } -} else { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s or %s", - d.Get("name"), - "organizations/{{"{{"}}org_name{{"}}"}}/envgroups/{{"{{"}}name{{"}}"}}", - "organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}") -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}org_id{{"}}"}}/envgroups/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_environment_group_attachment.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_environment_group_attachment.go.tmpl deleted file mode 100644 index 24bfa13ebca4..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_environment_group_attachment.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/attachments/(?P.+)", - "(?P.+)/(?P.+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}envgroup_id{{"}}"}}/attachments/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_environment_keystore.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_environment_keystore.go.tmpl deleted file mode 100644 index 05adf74c9a42..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_environment_keystore.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/keystores/(?P.+)", - "(?P.+)/(?P.+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_id{{"}}"}}/keystores/{{"{{"}}name{{"}}"}}") -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/go/apigee_environment_keyvaluemaps.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_environment_keyvaluemaps.go.tmpl deleted file mode 100644 index 7c9f168d706a..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_environment_keyvaluemaps.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/keyvaluemaps/(?P.+)", - "(?P.+)/(?P.+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_id{{"}}"}}/keyvaluemaps/{{"{{"}}name{{"}}"}}") -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/go/apigee_environment_keyvaluemaps_entries.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_environment_keyvaluemaps_entries.go.tmpl deleted file mode 100644 index b54471e2db28..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_environment_keyvaluemaps_entries.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/entries/(?P.+)", - "(?P.+)/(?P.+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_keyvaluemap_id{{"}}"}}/entries/{{"{{"}}name{{"}}"}}") -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/go/apigee_environment_reference.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_environment_reference.go.tmpl deleted file mode 100644 index 37eb0dfaa1d1..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_environment_reference.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/references/(?P.+)", - "(?P.+)/(?P.+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_id{{"}}"}}/references/{{"{{"}}name{{"}}"}}") -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/go/apigee_instance.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_instance.go.tmpl deleted file mode 100644 index a06fe9353325..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_instance.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err -} - -nameParts := strings.Split(d.Get("name").(string), "/") -if len(nameParts) == 4 { - // `organizations/{{"{{"}}org_name{{"}}"}}/instances/{{"{{"}}name{{"}}"}}` - orgId := fmt.Sprintf("organizations/%s", nameParts[1]) - if err := d.Set("org_id", orgId); err != nil { - return nil, fmt.Errorf("Error setting org_id: %s", err) - } - if err := d.Set("name", nameParts[3]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } -} else if len(nameParts) == 3 { - // `organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}` - orgId := fmt.Sprintf("organizations/%s", nameParts[1]) - if err := d.Set("org_id", orgId); err != nil { - return nil, fmt.Errorf("Error setting org_id: %s", err) - } - if err := d.Set("name", nameParts[2]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } -} else { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s or %s", - d.Get("name"), - "organizations/{{"{{"}}org_name{{"}}"}}/instances/{{"{{"}}name{{"}}"}}", - "organizations/{{"{{"}}org_name{{"}}"}}/{{"{{"}}name{{"}}"}}") -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}org_id{{"}}"}}/instances/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_instance_attachment.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_instance_attachment.go.tmpl deleted file mode 100644 index ef29ac333c5f..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_instance_attachment.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/attachments/(?P.+)", - "(?P.+)/(?P.+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}instance_id{{"}}"}}/attachments/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_nat_address.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_nat_address.go.tmpl deleted file mode 100644 index cbf60f11f90b..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_nat_address.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/natAddresses/(?P.+)", - "(?P.+)/(?P.+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}instance_id{{"}}"}}/natAddresses/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_organization.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_organization.go.tmpl deleted file mode 100644 index ffcad2c9c2fc..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_organization.go.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -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 -} - -parts := strings.Split(d.Get("name").(string), "/") - -var projectId string -switch len(parts) { - case 1: - projectId = parts[0] - case 2: - projectId = parts[1] - default: - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s or %s", - d.Get("name"), - "{{"{{"}}name{{"}}"}}", - "organizations/{{"{{"}}name{{"}}"}}", - ) -} - -if err := d.Set("name", projectId); err != nil { - return nil, fmt.Errorf("Error setting organization: %s", err) -} - -if err := d.Set("project_id", projectId); err != nil { - return nil, fmt.Errorf("Error setting organization: %s", err) -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "organizations/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/apigee_target_server.go.tmpl b/mmv1/templates/terraform/custom_import/go/apigee_target_server.go.tmpl deleted file mode 100644 index 890c263a23de..000000000000 --- a/mmv1/templates/terraform/custom_import/go/apigee_target_server.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/targetservers/(?P.+)", - "(?P.+)/(?P.+)", - }, d, config); err != nil { - return nil, err - } - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}env_id{{"}}"}}/targetservers/{{"{{"}}name{{"}}"}}") -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/go/bigquery_data_transfer_self_link_as_name_set_location.go.tmpl b/mmv1/templates/terraform/custom_import/go/bigquery_data_transfer_self_link_as_name_set_location.go.tmpl deleted file mode 100644 index 315ffb1dc13e..000000000000 --- a/mmv1/templates/terraform/custom_import/go/bigquery_data_transfer_self_link_as_name_set_location.go.tmpl +++ /dev/null @@ -1,21 +0,0 @@ - -config := meta.(*transport_tpg.Config) - -// current import_formats can't import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { - return nil, err -} - -// import location if the name format follows: projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/transferConfigs/{{"{{"}}config_id{{"}}"}} -name := d.Get("name").(string) -stringParts := strings.Split(name, "/") -if len(stringParts) == 6 { - if err := d.Set("location", stringParts[3]); err != nil { - return nil, fmt.Errorf("Error setting location: %s", err) - } -} else { - log.Printf("[INFO] Transfer config location not imported as it is not included in the name: %s", name) -} - - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/bigquery_reservation_capacity_commitment_set_id.go.tmpl b/mmv1/templates/terraform/custom_import/go/bigquery_reservation_capacity_commitment_set_id.go.tmpl deleted file mode 100644 index a50db3aec431..000000000000 --- a/mmv1/templates/terraform/custom_import/go/bigquery_reservation_capacity_commitment_set_id.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -config := meta.(*transport_tpg.Config) -if err := tpgresource.ParseImportId([]string{ - "^projects/(?P[^/]+)/locations/(?P[^/]+)/capacityCommitments/(?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{{"}}"}}/capacityCommitments/{{"{{"}}capacity_commitment_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/go/cloud_asset_feed.go.tmpl b/mmv1/templates/terraform/custom_import/go/cloud_asset_feed.go.tmpl deleted file mode 100644 index a089f93aee9a..000000000000 --- a/mmv1/templates/terraform/custom_import/go/cloud_asset_feed.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -if err := d.Set("name", d.Id()); err != nil { - return nil, err -} -return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/go/cloud_identity_group_import.go.tmpl b/mmv1/templates/terraform/custom_import/go/cloud_identity_group_import.go.tmpl deleted file mode 100644 index 91b8528c1980..000000000000 --- a/mmv1/templates/terraform/custom_import/go/cloud_identity_group_import.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -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) - -if d.Get("initial_group_config") == nil { - d.Set("initial_group_config", "EMPTY") -} - -if err := d.Set("name", name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) -} -d.SetId(name) -return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/go/compute_global_network_endpoint.go.tmpl b/mmv1/templates/terraform/custom_import/go/compute_global_network_endpoint.go.tmpl deleted file mode 100644 index d18acbeeb4d0..000000000000 --- a/mmv1/templates/terraform/custom_import/go/compute_global_network_endpoint.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) -// FQDN, port and ip_address are optional, so use * instead of + when reading the import id -if err := tpgresource.ParseImportId([]string{ - "projects/(?P[^/]+)/global/networkEndpointGroups/(?P[^/]+)/(?P[^/]*)/(?P[^/]*)/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]*)/(?P[^/]*)", - "(?P[^/]+)/(?P[^/]*)/(?P[^/]*)/(?P[^/]*)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}global_network_endpoint_group{{"}}"}}/{{"{{"}}ip_address{{"}}"}}/{{"{{"}}fqdn{{"}}"}}/{{"{{"}}port{{"}}"}}") -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/go/compute_instance_group_membership.go.tmpl b/mmv1/templates/terraform/custom_import/go/compute_instance_group_membership.go.tmpl deleted file mode 100644 index 30bab333777d..000000000000 --- a/mmv1/templates/terraform/custom_import/go/compute_instance_group_membership.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -config := meta.(*transport_tpg.Config) - -if err := tpgresource.ParseImportId([]string{ - "projects/(?P[^/]+)/zones/(?P[^/]+)/instanceGroups/(?P[^/]+)/(?P.+)", - "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P.+)", - "(?P[^/]+)/(?P[^/]+)/(?P.+)", - "(?P[^/]+)/(?P.+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}instance_group{{"}}"}}/{{"{{"}}instance{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/compute_network_endpoint.go.tmpl b/mmv1/templates/terraform/custom_import/go/compute_network_endpoint.go.tmpl deleted file mode 100644 index 600a834818eb..000000000000 --- a/mmv1/templates/terraform/custom_import/go/compute_network_endpoint.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -config := meta.(*transport_tpg.Config) -// instance is optional, so use * instead of + when reading the import id -if err := tpgresource.ParseImportId([]string{ - "projects/(?P[^/]+)/zones/(?P[^/]+)/networkEndpointGroups/(?P[^/]+)/(?P[^/]*)/(?P[^/]+)/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]+)/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]+)/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]*)/(?P[^/]+)/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}zone{{"}}"}}/{{"{{"}}network_endpoint_group{{"}}"}}/{{"{{"}}instance{{"}}"}}/{{"{{"}}ip_address{{"}}"}}/{{"{{"}}port{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/compute_region_network_endpoint.go.tmpl b/mmv1/templates/terraform/custom_import/go/compute_region_network_endpoint.go.tmpl deleted file mode 100644 index 1b7094a9dc09..000000000000 --- a/mmv1/templates/terraform/custom_import/go/compute_region_network_endpoint.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -config := meta.(*transport_tpg.Config) -// instance is optional, so use * instead of + when reading the import id -if err := tpgresource.ParseImportId([]string{ - "projects/(?P[^/]+)/regions/(?P[^/]+)/networkEndpointGroups/(?P[^/]+)/(?P[^/]*)/(?P[^/]*)/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]*)/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]*)/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]*)/(?P[^/]*)/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}region{{"}}"}}/{{"{{"}}region_network_endpoint_group{{"}}"}}/{{"{{"}}ip_address{{"}}"}}/{{"{{"}}fqdn{{"}}"}}/{{"{{"}}port{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/data_catalog_entry.go.tmpl b/mmv1/templates/terraform/custom_import/go/data_catalog_entry.go.tmpl deleted file mode 100644 index f05ad3b9ac1a..000000000000 --- a/mmv1/templates/terraform/custom_import/go/data_catalog_entry.go.tmpl +++ /dev/null @@ -1,21 +0,0 @@ - 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) - egRegex := regexp.MustCompile("(projects/.+/locations/.+/entryGroups/.+)/entries/(.+)") - - parts := egRegex.FindStringSubmatch(name) - if len(parts) != 3 { - return nil, fmt.Errorf("entry name does not fit the format %s", egRegex) - } - if err := d.Set("entry_group", parts[1]); err != nil { - return nil, fmt.Errorf("Error setting entry_group: %s", err) - } - if err := d.Set("entry_id", parts[2]); err != nil { - return nil, fmt.Errorf("Error setting entry_id: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/data_catalog_entry_group.go.tmpl b/mmv1/templates/terraform/custom_import/go/data_catalog_entry_group.go.tmpl deleted file mode 100644 index 440c83396f2a..000000000000 --- a/mmv1/templates/terraform/custom_import/go/data_catalog_entry_group.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ - 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) - egRegex := regexp.MustCompile("projects/(.+)/locations/(.+)/entryGroups/(.+)") - - parts := egRegex.FindStringSubmatch(name) - if len(parts) != 4 { - return nil, fmt.Errorf("entry group name does not fit the format %s", egRegex) - } - if err := d.Set("project", parts[1]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("region", parts[2]); err != nil { - return nil, fmt.Errorf("Error setting region: %s", err) - } - if err := d.Set("entry_group_id", parts[3]); err != nil { - return nil, fmt.Errorf("Error setting entry_group_id: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/data_catalog_tag.go.tmpl b/mmv1/templates/terraform/custom_import/go/data_catalog_tag.go.tmpl deleted file mode 100644 index cf427c3b5b55..000000000000 --- a/mmv1/templates/terraform/custom_import/go/data_catalog_tag.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ - 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) - egRegex := regexp.MustCompile("(.+)/tags") - - parts := egRegex.FindStringSubmatch(name) - if len(parts) != 2 { - return nil, fmt.Errorf("entry name does not fit the format %s", egRegex) - } - - if err := d.Set("parent", parts[1]); err != nil { - return nil, fmt.Errorf("Error setting parent: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/data_catalog_tag_template.go.tmpl b/mmv1/templates/terraform/custom_import/go/data_catalog_tag_template.go.tmpl deleted file mode 100644 index 753503ef6649..000000000000 --- a/mmv1/templates/terraform/custom_import/go/data_catalog_tag_template.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ - 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) - egRegex := regexp.MustCompile("projects/(.+)/locations/(.+)/tagTemplates/(.+)") - - parts := egRegex.FindStringSubmatch(name) - if len(parts) != 4 { - return nil, fmt.Errorf("tag template name does not fit the format %s", egRegex) - } - if err := d.Set("project", parts[1]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("region", parts[2]); err != nil { - return nil, fmt.Errorf("Error setting region: %s", err) - } - if err := d.Set("tag_template_id", parts[3]); err != nil { - return nil, fmt.Errorf("Error setting tag_template_id: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/data_catalog_taxonomy.go.tmpl b/mmv1/templates/terraform/custom_import/go/data_catalog_taxonomy.go.tmpl deleted file mode 100644 index 1450c6fa00c7..000000000000 --- a/mmv1/templates/terraform/custom_import/go/data_catalog_taxonomy.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ - 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) - d.SetId(name) - - re := regexp.MustCompile("projects/(.+)/(?:locations|regions)/(.+)/taxonomies/(.+)") - if matches := re.FindStringSubmatch(name); matches != nil { - d.Set("project", matches[1]) - d.Set("region", matches[2]) - } - - return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/go/dialogflowcx_entity_type.go.tmpl b/mmv1/templates/terraform/custom_import/go/dialogflowcx_entity_type.go.tmpl deleted file mode 100644 index f9d25f996f68..000000000000 --- a/mmv1/templates/terraform/custom_import/go/dialogflowcx_entity_type.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value and parent contains slashes - if err := tpgresource.ParseImportId([]string{ - "(?P.+)/entityTypes/(?P[^/]+)", - "(?P.+)/(?P[^/]+)", - }, d, config); err != nil { - return nil, err - } - - // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/entityTypes/{{"{{"}}name{{"}}"}}") - 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/go/dialogflowcx_environment.go.tmpl b/mmv1/templates/terraform/custom_import/go/dialogflowcx_environment.go.tmpl deleted file mode 100644 index 6b747275df25..000000000000 --- a/mmv1/templates/terraform/custom_import/go/dialogflowcx_environment.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value and parent contains slashes - if err := tpgresource.ParseImportId([]string{ - "(?P.+)/environments/(?P[^/]+)", - "(?P.+)/(?P[^/]+)", - }, d, config); err != nil { - return nil, err - } - - // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/environments/{{"{{"}}name{{"}}"}}") - 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/go/dialogflowcx_flow.go.tmpl b/mmv1/templates/terraform/custom_import/go/dialogflowcx_flow.go.tmpl deleted file mode 100644 index a69dac07a32a..000000000000 --- a/mmv1/templates/terraform/custom_import/go/dialogflowcx_flow.go.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats can't import fields with forward slashes in their value and parent contains slashes -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/flows/(?P[^/]+)", - "(?P.+)/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/flows/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -// Set is_default_start_flow if the resource is actually the Default Start Flow -if d.Get("name").(string) == "00000000-0000-0000-0000-000000000000" { - d.Set("is_default_start_flow", true) -} - -return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/go/dialogflowcx_intent.go.tmpl b/mmv1/templates/terraform/custom_import/go/dialogflowcx_intent.go.tmpl deleted file mode 100644 index 50535d725ace..000000000000 --- a/mmv1/templates/terraform/custom_import/go/dialogflowcx_intent.go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value and parent contains slashes - if err := tpgresource.ParseImportId([]string{ - "(?P.+)/intents/(?P[^/]+)", - "(?P.+)/(?P[^/]+)", - }, d, config); err != nil { - return nil, err - } - - // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/intents/{{"{{"}}name{{"}}"}}") - if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - // Set is_default_X if the resource is actually a Default Intent - if d.Get("name").(string) == "00000000-0000-0000-0000-000000000000" { - d.Set("is_default_welcome_intent", true) - } - if d.Get("name").(string) == "00000000-0000-0000-0000-000000000001" { - d.Set("is_default_negative_intent", true) - } - - return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/go/dialogflowcx_page.go.tmpl b/mmv1/templates/terraform/custom_import/go/dialogflowcx_page.go.tmpl deleted file mode 100644 index 2ed9dd7a0409..000000000000 --- a/mmv1/templates/terraform/custom_import/go/dialogflowcx_page.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats can't import fields with forward slashes in their value and parent contains slashes -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/pages/(?P[^/]+)", - "(?P.+)/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/pages/{{"{{"}}name{{"}}"}}") -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/go/dialogflowcx_version.go.tmpl b/mmv1/templates/terraform/custom_import/go/dialogflowcx_version.go.tmpl deleted file mode 100644 index b5f2069f0193..000000000000 --- a/mmv1/templates/terraform/custom_import/go/dialogflowcx_version.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value and parent contains slashes - if err := tpgresource.ParseImportId([]string{ - "(?P.+)/versions/(?P[^/]+)", - "(?P.+)/(?P[^/]+)", - }, d, config); err != nil { - return nil, err - } - - // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/versions/{{"{{"}}name{{"}}"}}") - 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/go/dialogflowcx_webhook.go.tmpl b/mmv1/templates/terraform/custom_import/go/dialogflowcx_webhook.go.tmpl deleted file mode 100644 index 443ee07879da..000000000000 --- a/mmv1/templates/terraform/custom_import/go/dialogflowcx_webhook.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats can't import fields with forward slashes in their value and parent contains slashes -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/webhooks/(?P[^/]+)", - "(?P.+)/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/webhooks/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/discoveryengine_targetsite_set_id.go.tmpl b/mmv1/templates/terraform/custom_import/go/discoveryengine_targetsite_set_id.go.tmpl deleted file mode 100644 index cb84fa6f09b1..000000000000 --- a/mmv1/templates/terraform/custom_import/go/discoveryengine_targetsite_set_id.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -config := meta.(*transport_tpg.Config) -if err := tpgresource.ParseImportId([]string{ - "^projects/(?P[^/]+)/locations/(?P[^/]+)/collections/default_collection/dataStores/(?P[^/]+)/siteSearchEngine/targetSites/(?P[^/]+)$", -}, d, config); err != nil { - return nil, err -} - -// Set name based on the components -if err := d.Set("name", "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/collections/default_collection/dataStores/{{"{{"}}data_store_id{{"}}"}}/siteSearchEngine/targetSites/{{"{{"}}target_site_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/go/dlp_import.go.tmpl b/mmv1/templates/terraform/custom_import/go/dlp_import.go.tmpl deleted file mode 100644 index 73547fda9ced..000000000000 --- a/mmv1/templates/terraform/custom_import/go/dlp_import.go.tmpl +++ /dev/null @@ -1,32 +0,0 @@ - config := meta.(*transport_tpg.Config) - - // Custom import to handle parent possibilities - if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err - } - parts := strings.Split(d.Get("name").(string), "/") - if len(parts) == 6 { - if err := d.Set("name", parts[5]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - } else if len(parts) == 4 { - if err := d.Set("name", parts[3]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - } else { - return nil, fmt.Errorf("Unexpected import id: %s, expected form {{"{{"}}parent{{"}}"}}/{{camelize $.Name "lower"}}/{{"{{"}}name{{"}}"}}", d.Get("name").(string)) - } - // Remove "/{{camelize $.Name "lower"}}/{{"{{"}}name{{"}}"}}" from the id - parts = parts[:len(parts)-2] - if err := d.Set("parent", strings.Join(parts, "/")); err != nil { - return nil, fmt.Errorf("Error setting parent: %s", err) - } - - // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}parent{{"}}"}}/{{camelize $.Name "lower"}}s/{{"{{"}}name{{"}}"}}") - if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/document_ai_warehouse_document_schema.go.tmpl b/mmv1/templates/terraform/custom_import/go/document_ai_warehouse_document_schema.go.tmpl deleted file mode 100644 index f24c80976052..000000000000 --- a/mmv1/templates/terraform/custom_import/go/document_ai_warehouse_document_schema.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -config := meta.(*transport_tpg.Config) - -if err := tpgresource.ParseImportId([]string{ - "projects/(?P[^/]+)/locations/(?P[^/]+)/documentSchemas/(?P[^/]+)"}, d, config); err != nil { - return nil, err -} - -originalName := d.Get("name").(string) -originalLocation := d.Get("location").(string) -originalProject := d.Get("project_number").(string) -name := fmt.Sprintf("projects/%s/locations/%s/documentSchemas/%s", originalProject, originalLocation, originalName) - -if err := d.Set("name", name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) -} -d.SetId(name) -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/extract_taxonomy.go.tmpl b/mmv1/templates/terraform/custom_import/go/extract_taxonomy.go.tmpl deleted file mode 100644 index c99cf546f939..000000000000 --- a/mmv1/templates/terraform/custom_import/go/extract_taxonomy.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ - config := meta.(*transport_tpg.Config) - - if err := tpgresource.ParseImportId([]string{ - "(?Pprojects/[^/]+/locations/[^/]+/taxonomies/[^/]+)/policyTags/(?P.+)"}, d, config); err != nil { - return nil, err - } - - originalName := d.Get("name").(string) - originalTaxonomy := d.Get("taxonomy").(string) - name := fmt.Sprintf("%s/policyTags/%s", originalTaxonomy, originalName) - - if err := d.Set("name", name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - d.SetId(name) - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/firestore_document.go.tmpl b/mmv1/templates/terraform/custom_import/go/firestore_document.go.tmpl deleted file mode 100644 index b484f459092e..000000000000 --- a/mmv1/templates/terraform/custom_import/go/firestore_document.go.tmpl +++ /dev/null @@ -1,28 +0,0 @@ - - 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 - } - - re := regexp.MustCompile("^projects/([^/]+)/databases/([^/]+)/documents/(.+)/([^/]+)$") - match := re.FindStringSubmatch(d.Get("name").(string)) - if len(match) > 0{ - if err := d.Set("project", match[1]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("database", match[2]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("collection", match[3]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("document_id", match[4]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - } else { - return nil, fmt.Errorf("import did not match the regex ^projects/([^/]+)/databases/([^/]+)/documents/(.+)/([^/]+)$") - } - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/firestore_field.go.tmpl b/mmv1/templates/terraform/custom_import/go/firestore_field.go.tmpl deleted file mode 100644 index b15d8131060d..000000000000 --- a/mmv1/templates/terraform/custom_import/go/firestore_field.go.tmpl +++ /dev/null @@ -1,29 +0,0 @@ - -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 -} - -// Re-populate split fields from the name. -re := regexp.MustCompile("^projects/([^/]+)/databases/([^/]+)/collectionGroups/([^/]+)/fields/(.+)$") -match := re.FindStringSubmatch(d.Get("name").(string)) -if len(match) > 0 { - if err := d.Set("project", match[1]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("database", match[2]); err != nil { - return nil, fmt.Errorf("Error setting database: %s", err) - } - if err := d.Set("collection", match[3]); err != nil { - return nil, fmt.Errorf("Error setting collection: %s", err) - } - if err := d.Set("field", match[4]); err != nil { - return nil, fmt.Errorf("Error setting field: %s", err) - } -} else { - return nil, fmt.Errorf("import did not match the regex ^projects/([^/]+)/databases/([^/]+)/collectionGroups/([^/]+)/fields/(.+)$") -} - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/healthcare_dicom_store.go.tmpl b/mmv1/templates/terraform/custom_import/go/healthcare_dicom_store.go.tmpl deleted file mode 100644 index a2c0fabce7ba..000000000000 --- a/mmv1/templates/terraform/custom_import/go/healthcare_dicom_store.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ - - config := meta.(*transport_tpg.Config) - - dicomStoreId, err := ParseHealthcareDicomStoreId(d.Id(), config) - if err != nil { - return nil, err - } - - if err := d.Set("dataset", dicomStoreId.DatasetId.DatasetId()); err != nil { - return nil, fmt.Errorf("Error setting dataset: %s", err) - } - if err := d.Set("name", dicomStoreId.Name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/healthcare_fhir_store.go.tmpl b/mmv1/templates/terraform/custom_import/go/healthcare_fhir_store.go.tmpl deleted file mode 100644 index f3e7ed477669..000000000000 --- a/mmv1/templates/terraform/custom_import/go/healthcare_fhir_store.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ - - config := meta.(*transport_tpg.Config) - - fhirStoreId, err := ParseHealthcareFhirStoreId(d.Id(), config) - if err != nil { - return nil, err - } - - if err := d.Set("dataset", fhirStoreId.DatasetId.DatasetId()); err != nil { - return nil, fmt.Errorf("Error setting dataset: %s", err) - } - if err := d.Set("name", fhirStoreId.Name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/healthcare_hl7_v2_store.go.tmpl b/mmv1/templates/terraform/custom_import/go/healthcare_hl7_v2_store.go.tmpl deleted file mode 100644 index 86768ee920a6..000000000000 --- a/mmv1/templates/terraform/custom_import/go/healthcare_hl7_v2_store.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ - - config := meta.(*transport_tpg.Config) - - hl7v2StoreId, err := ParseHealthcareHl7V2StoreId(d.Id(), config) - if err != nil { - return nil, err - } - - if err := d.Set("dataset", hl7v2StoreId.DatasetId.DatasetId()); err != nil { - return nil, fmt.Errorf("Error setting dataset: %s", err) - } - if err := d.Set("name", hl7v2StoreId.Name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/iap_brand.go.tmpl b/mmv1/templates/terraform/custom_import/go/iap_brand.go.tmpl deleted file mode 100644 index e31def29c84b..000000000000 --- a/mmv1/templates/terraform/custom_import/go/iap_brand.go.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -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 -} - -nameParts := strings.Split(d.Get("name").(string), "/") -if len(nameParts) != 4 && len(nameParts) != 2 { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have either shape %s or %s", - d.Get("name"), - "projects/{{"{{"}}project{{"}}"}}/brands/{{"{{"}}name{{"}}"}}", - "{{"{{"}}project{{"}}"}}/{{"{{"}}name{{"}}"}}", - ) -} - -var project string -if len(nameParts) == 4 { - project = nameParts[1] -} -if len(nameParts) == 2 { - project = nameParts[0] // Different index - - // Set `name` (and `id`) as a 4-part format so Read func produces valid URL - brand := nameParts[1] - name := fmt.Sprintf("projects/%s/brands/%s", project, brand) - if err := d.Set("name", name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - d.SetId(name) -} - -if err := d.Set("project", project); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) -} -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/iap_client.go.tmpl b/mmv1/templates/terraform/custom_import/go/iap_client.go.tmpl deleted file mode 100644 index e3be84e350b0..000000000000 --- a/mmv1/templates/terraform/custom_import/go/iap_client.go.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -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 -} - -nameParts := strings.Split(d.Get("brand").(string), "/") -if len(nameParts) != 6 { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s", - d.Get("brand").(string), - "projects/{{"{{"}}project_number{{"}}"}}/brands/{{"{{"}}brand_id{{"}}"}}/identityAwareProxyClients/{{"{{"}}client_id{{"}}"}}", - ) -} - -if err := d.Set("brand", fmt.Sprintf("projects/%s/brands/%s", nameParts[1], nameParts[3])); err != nil { - return nil, fmt.Errorf("Error setting brand: %s", err) -} -if err := d.Set("client_id", nameParts[5]); err != nil { - return nil, fmt.Errorf("Error setting client_id: %s", err) -} -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/index_self_link_as_name_set_project.go.tmpl b/mmv1/templates/terraform/custom_import/go/index_self_link_as_name_set_project.go.tmpl deleted file mode 100644 index 3fa636cbf14a..000000000000 --- a/mmv1/templates/terraform/custom_import/go/index_self_link_as_name_set_project.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ - - 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 - } - - stringParts := strings.Split(d.Get("name").(string), "/") - if len(stringParts) != 8 { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s", - d.Get("name"), - "projects/{{"{{"}}project{{"}}"}}/databases/{{"{{"}}database{{"}}"}}/collectionGroups/{{"{{"}}collection{{"}}"}}/indexes/{{"{{"}}server_generated_id{{"}}"}}", - ) - } - - if err := d.Set("project", stringParts[1]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("database", stringParts[3]); err != nil { - return nil, fmt.Errorf("Error setting database: %s", err) - } - if err := d.Set("collection", stringParts[5]); err != nil { - return nil, fmt.Errorf("Error setting collection: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/kms_crypto_key.go.tmpl b/mmv1/templates/terraform/custom_import/go/kms_crypto_key.go.tmpl deleted file mode 100644 index db6e302250d3..000000000000 --- a/mmv1/templates/terraform/custom_import/go/kms_crypto_key.go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ - - config := meta.(*transport_tpg.Config) - - cryptoKeyId, err := ParseKmsCryptoKeyId(d.Id(), config) - if err != nil { - return nil, err - } - - if err := d.Set("key_ring", cryptoKeyId.KeyRingId.KeyRingId()); err != nil { - return nil, fmt.Errorf("Error setting key_ring: %s", err) - } - if err := d.Set("name", cryptoKeyId.Name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - - if err := d.Set("skip_initial_version_creation", false); err != nil { - return nil, fmt.Errorf("Error setting skip_initial_version_creation: %s", err) - } - - id, err := tpgresource.ReplaceVars(d, config, "{{$.GetIdFormat}}") - if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/kms_crypto_key_version.go.tmpl b/mmv1/templates/terraform/custom_import/go/kms_crypto_key_version.go.tmpl deleted file mode 100644 index f29594e126b2..000000000000 --- a/mmv1/templates/terraform/custom_import/go/kms_crypto_key_version.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ - - config := meta.(*transport_tpg.Config) - - cryptoKeyVersionId, err := parseKmsCryptoKeyVersionId(d.Id(), config) - if err != nil { - return nil, err - } - if err := d.Set("crypto_key", cryptoKeyVersionId.CryptoKeyId.CryptoKeyId()); err != nil { - return nil, fmt.Errorf("Error setting key_ring: %s", err) - } - if err := d.Set("name", cryptoKeyVersionId.Name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - id, err := tpgresource.ReplaceVars(d, config, "{{$.GetIdFormat}}") - if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/kms_key_ring_import_job.go.tmpl b/mmv1/templates/terraform/custom_import/go/kms_key_ring_import_job.go.tmpl deleted file mode 100644 index 875780ed2ca8..000000000000 --- a/mmv1/templates/terraform/custom_import/go/kms_key_ring_import_job.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ - - 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 - } - - stringParts := strings.Split(d.Get("name").(string), "/") - if len(stringParts) != 8 { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s", - d.Get("name"), - "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/keyRings/{{"{{"}}keyRing{{"}}"}}/importJobs/{{"{{"}}importJobId{{"}}"}}", - ) - } - - if err := d.Set("key_ring", stringParts[3]); err != nil { - return nil, fmt.Errorf("Error setting key_ring: %s", err) - } - if err := d.Set("import_job_id", stringParts[5]); err != nil { - return nil, fmt.Errorf("Error setting import_job_id: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/custom_import/go/monitoring_monitored_project.go.tmpl deleted file mode 100644 index abe689a1e68b..000000000000 --- a/mmv1/templates/terraform/custom_import/go/monitoring_monitored_project.go.tmpl +++ /dev/null @@ -1,35 +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 := d.Get("name").(string) -name = tpgresource.GetResourceNameFromSelfLink(name) -d.Set("name", name) -metricsScope := d.Get("metrics_scope").(string) -metricsScope = tpgresource.GetResourceNameFromSelfLink(metricsScope) -d.Set("metrics_scope", metricsScope) -config := meta.(*transport_tpg.Config) -if err := tpgresource.ParseImportId([]string{ - "locations/global/metricsScopes/(?P[^/]+)/projects/(?P[^/]+)", - "v1/locations/global/metricsScopes/(?P[^/]+)/projects/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "locations/global/metricsScopes/{{"{{"}}metrics_scope{{"}}"}}/projects/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/scc_mute_config.go.tmpl b/mmv1/templates/terraform/custom_import/go/scc_mute_config.go.tmpl deleted file mode 100644 index 9f00fba3e2cb..000000000000 --- a/mmv1/templates/terraform/custom_import/go/scc_mute_config.go.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -config := meta.(*transport_tpg.Config) - -if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err -} - -// current import_formats can't import fields with forward slashes in their value -name := d.Get("name").(string) - -matched, err := regexp.MatchString("(organizations|folders|projects)/.+/muteConfigs/.+", name) -if err != nil { - return nil, fmt.Errorf("error validating import name: %s", err) -} - -if !matched { - return nil, fmt.Errorf("error validating import name: %s does not fit naming for muteConfigs. Expected %s", - name, "organizations/{organization}/muteConfigs/{configId}, folders/{folder}/muteConfigs/{configId} or projects/{project}/muteConfigs/{configId}") -} - -if err := d.Set("name", name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) -} - -// mute_config_id and parent are not returned by the API and therefore need to be set manually -stringParts := strings.Split(d.Get("name").(string), "/") -if err := d.Set("mute_config_id", stringParts[3]); err != nil { - return nil, fmt.Errorf("Error setting mute_config_id: %s", err) -} - -if err := d.Set("parent", fmt.Sprintf("%s/%s", stringParts[0], stringParts[1])); err != nil { - return nil, fmt.Errorf("Error setting mute_config_id: %s", err) -} - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/scc_source_self_link_as_name_set_organization.go.tmpl b/mmv1/templates/terraform/custom_import/go/scc_source_self_link_as_name_set_organization.go.tmpl deleted file mode 100644 index bd54b46f70d8..000000000000 --- a/mmv1/templates/terraform/custom_import/go/scc_source_self_link_as_name_set_organization.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -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 -} - -stringParts := strings.Split(d.Get("name").(string), "/") -if len(stringParts) != 4 { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s", - d.Get("name"), - "organizations/{{"{{"}}organization{{"}}"}}/sources/{{"{{"}}source{{"}}"}}", - ) -} - -if err := d.Set("organization", stringParts[1]); err != nil { - return nil, fmt.Errorf("Error setting organization: %s", err) -} -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/scc_v2_source_self_link_as_name_set_organization.go.tmpl b/mmv1/templates/terraform/custom_import/go/scc_v2_source_self_link_as_name_set_organization.go.tmpl deleted file mode 100644 index 71dee0f9828a..000000000000 --- a/mmv1/templates/terraform/custom_import/go/scc_v2_source_self_link_as_name_set_organization.go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -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 -} - -stringParts := strings.Split(d.Get("name").(string), "/") -if len(stringParts) != 6 { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s", - d.Get("name"), - "organizations/{{"{{"}}organization{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/notificationConfigs/{{"{{"}}config_id{{"}}"}}", - ) -} - -if err := d.Set("organization", stringParts[1]); err != nil { - return nil, fmt.Errorf("Error setting organization: %s", err) -} -if err := d.Set("location", stringParts[3]); err != nil { - return nil, fmt.Errorf("Error setting location: %s", err) -} -if err := d.Set("config_id", stringParts[5]); err != nil { - return nil, fmt.Errorf("Error setting config_id: %s", err) -} -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/secret_version.go.tmpl b/mmv1/templates/terraform/custom_import/go/secret_version.go.tmpl deleted file mode 100644 index 0c5ab7aee59f..000000000000 --- a/mmv1/templates/terraform/custom_import/go/secret_version.go.tmpl +++ /dev/null @@ -1,31 +0,0 @@ - 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) - secretRegex := regexp.MustCompile("(projects/.+/secrets/.+)/versions/.+$") - versionRegex := regexp.MustCompile("projects/(.+)/secrets/(.+)/versions/(.+)$") - - parts := secretRegex.FindStringSubmatch(name) - if len(parts) != 2 { - return nil, fmt.Errorf("Version name does not fit the format `projects/{{"{{"}}project{{"}}"}}/secrets/{{"{{"}}secret{{"}}"}}/versions/{{"{{"}}version{{"}}"}}`") - } - if err := d.Set("secret", parts[1]); err != nil { - return nil, fmt.Errorf("Error setting secret: %s", err) - } - - parts = versionRegex.FindStringSubmatch(name) - - if err := d.Set("version", parts[3]); err != nil { - return nil, fmt.Errorf("Error setting version: %s", err) - } - - // Explicitly set virtual fields to default values on import - if err := d.Set("deletion_policy", "DELETE"); err != nil { - return nil, fmt.Errorf("Error setting version: %s", err) - } - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/self_link_as_name.tmpl b/mmv1/templates/terraform/custom_import/go/self_link_as_name.tmpl deleted file mode 100644 index d83bf4faa636..000000000000 --- a/mmv1/templates/terraform/custom_import/go/self_link_as_name.tmpl +++ /dev/null @@ -1,9 +0,0 @@ - - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value - if err := tpgresource.ParseImportId([]string{"(?P[^ ]+) (?P[^ ]+)", "(?P[^ ]+)"}, d, config); err != nil { - return nil, err - } - - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/self_link_as_name_set_project.go.tmpl b/mmv1/templates/terraform/custom_import/go/self_link_as_name_set_project.go.tmpl deleted file mode 100644 index c2de0c59fbfb..000000000000 --- a/mmv1/templates/terraform/custom_import/go/self_link_as_name_set_project.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ - - 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 - } - - stringParts := strings.Split(d.Get("name").(string), "/") - if len(stringParts) < 2 { - return nil, fmt.Errorf( - "Could not split project from name: %s", - d.Get("name"), - ) - } - - if err := d.Set("project", stringParts[1]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/service_directory_endpoint.go.tmpl b/mmv1/templates/terraform/custom_import/go/service_directory_endpoint.go.tmpl deleted file mode 100644 index 4d070d0c250f..000000000000 --- a/mmv1/templates/terraform/custom_import/go/service_directory_endpoint.go.tmpl +++ /dev/null @@ -1,55 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err -} - -nameParts := strings.Split(d.Get("name").(string), "/") -if len(nameParts) == 10 { - // `projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}/services/{{"{{"}}service_id{{"}}"}}/endpoints/{{"{{"}}endpoint_id{{"}}"}}` - if err := d.Set("service", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s", nameParts[1], nameParts[3], nameParts[5], nameParts[7])); err != nil { - return nil, fmt.Errorf("Error setting service: %s", err) - } - if err := d.Set("endpoint_id", nameParts[9]); err != nil { - return nil, fmt.Errorf("Error setting endpoint_id: %s", err) - } -} else if len(nameParts) == 5 { - // `{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}/{{"{{"}}endpoint_id{{"}}"}}` - if err := d.Set("service", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s", nameParts[0], nameParts[1], nameParts[2], nameParts[3])); err != nil { - return nil, fmt.Errorf("Error setting service: %s", err) - } - if err := d.Set("endpoint_id", nameParts[4]); err != nil { - return nil, fmt.Errorf("Error setting endpoint_id: %s", err) - } - id := fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s/endpoints/%s", nameParts[0], nameParts[1], nameParts[2], nameParts[3], nameParts[4]) - if err := d.Set("name", id); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - d.SetId(id) -} else if len(nameParts) == 4 { - // `{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}/{{"{{"}}endpoint_id{{"}}"}}` - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, err - } - if err := d.Set("service", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s", project, nameParts[0], nameParts[1], nameParts[2])); err != nil { - return nil, fmt.Errorf("Error setting service: %s", err) - } - if err := d.Set("endpoint_id", nameParts[3]); err != nil { - return nil, fmt.Errorf("Error setting endpoint_id: %s", err) - } - id := fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s/endpoints/%s", project, nameParts[0], nameParts[1], nameParts[2], nameParts[3]) - if err := d.Set("name", id); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - d.SetId(id) -} else { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s, %s or %s", - d.Get("name"), - "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}/services/{{"{{"}}service_id{{"}}"}}/endpoints/{{"{{"}}endpoint_id{{"}}"}}", - "{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}/{{"{{"}}endpoint_id{{"}}"}}", - "{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}/{{"{{"}}endpoint_id{{"}}"}}") -} -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/service_directory_namespace.go.tmpl b/mmv1/templates/terraform/custom_import/go/service_directory_namespace.go.tmpl deleted file mode 100644 index a76f6793f51a..000000000000 --- a/mmv1/templates/terraform/custom_import/go/service_directory_namespace.go.tmpl +++ /dev/null @@ -1,64 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err -} - -nameParts := strings.Split(d.Get("name").(string), "/") -if len(nameParts) == 6 { - // `projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}` - if err := d.Set("project", nameParts[1]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("location", nameParts[3]); err != nil { - return nil, fmt.Errorf("Error setting location: %s", err) - } - if err := d.Set("namespace_id", nameParts[5]); err != nil { - return nil, fmt.Errorf("Error setting namespace_id: %s", err) - } -} else if len(nameParts) == 3 { - // `{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}` - if err := d.Set("project", nameParts[0]); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("location", nameParts[1]); err != nil { - return nil, fmt.Errorf("Error setting location: %s", err) - } - if err := d.Set("namespace_id", nameParts[2]); err != nil { - return nil, fmt.Errorf("Error setting namespace_id: %s", err) - } - id := fmt.Sprintf("projects/%s/locations/%s/namespaces/%s", nameParts[0], nameParts[1], nameParts[2]) - if err := d.Set("name", id); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - d.SetId(id) -} else if len(nameParts) == 2 { - // `{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}` - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, err - } - if err := d.Set("project", project); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } - if err := d.Set("location", nameParts[0]); err != nil { - return nil, fmt.Errorf("Error setting location: %s", err) - } - if err := d.Set("namespace_id", nameParts[1]); err != nil { - return nil, fmt.Errorf("Error setting namespace_id: %s", err) - } - id := fmt.Sprintf("projects/%s/locations/%s/namespaces/%s", project, nameParts[0], nameParts[1]) - if err := d.Set("name", id); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - d.SetId(id) -} else { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s, %s or %s", - d.Get("name"), - "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}", - "{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}", - "{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}") -} -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/service_directory_service.go.tmpl b/mmv1/templates/terraform/custom_import/go/service_directory_service.go.tmpl deleted file mode 100644 index 54e6d0f587d0..000000000000 --- a/mmv1/templates/terraform/custom_import/go/service_directory_service.go.tmpl +++ /dev/null @@ -1,56 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats cannot import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nil { - return nil, err -} - -nameParts := strings.Split(d.Get("name").(string), "/") -if len(nameParts) == 8 { - // `projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}/services/{{"{{"}}service_id{{"}}"}}` - if err := d.Set("namespace", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s", nameParts[1], nameParts[3], nameParts[5])); err != nil { - return nil, fmt.Errorf("Error setting namespace: %s", err) - } - if err := d.Set("service_id", nameParts[7]); err != nil { - return nil, fmt.Errorf("Error setting service_id: %s", err) - } -} else if len(nameParts) == 4 { - // `{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}` - if err := d.Set("namespace", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s", nameParts[0], nameParts[1], nameParts[2])); err != nil { - return nil, fmt.Errorf("Error setting namespace: %s", err) - } - if err := d.Set("service_id", nameParts[3]); err != nil { - return nil, fmt.Errorf("Error setting service_id: %s", err) - } - id := fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s", nameParts[0], nameParts[1], nameParts[2], nameParts[3]) - if err := d.Set("name", id); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - d.SetId(id) -} else if len(nameParts) == 3 { - // `{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}` - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, err - } - if err := d.Set("namespace", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s", project, nameParts[0], nameParts[1])); err != nil { - return nil, fmt.Errorf("Error setting namespace: %s", err) - } - if err := d.Set("service_id", nameParts[2]); err != nil { - return nil, fmt.Errorf("Error setting service_id: %s", err) - } - id := fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s", project, nameParts[0], nameParts[1], nameParts[2]) - if err := d.Set("name", id); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - d.SetId(id) -} else { - return nil, fmt.Errorf( - "Saw %s when the name is expected to have shape %s, %s or %s", - d.Get("name"), - "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}/services/{{"{{"}}service_id{{"}}"}}", - "{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}", - "{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}") -} -return []*schema.ResourceData{d}, nil - diff --git a/mmv1/templates/terraform/custom_import/go/set_access_policy_parent_from_access_policy.go.tmpl b/mmv1/templates/terraform/custom_import/go/set_access_policy_parent_from_access_policy.go.tmpl deleted file mode 100644 index de48dc2505b1..000000000000 --- a/mmv1/templates/terraform/custom_import/go/set_access_policy_parent_from_access_policy.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. -*/ -}} - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value - parts, err := tpgresource.GetImportIdQualifiers([]string{"accessPolicies/(?P[^/]+)/(.+)"}, d, config, d.Id()) - if err != nil { - return nil, err - } - - if err := d.Set("parent", fmt.Sprintf("accessPolicies/%s", parts["accessPolicy"])); err != nil { - return nil, fmt.Errorf("Error setting parent: %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/set_access_policy_parent_from_self_link.go.tmpl b/mmv1/templates/terraform/custom_import/go/set_access_policy_parent_from_self_link.go.tmpl deleted file mode 100644 index 490f76b3484f..000000000000 --- a/mmv1/templates/terraform/custom_import/go/set_access_policy_parent_from_self_link.go.tmpl +++ /dev/null @@ -1,26 +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 - } - stringParts := strings.Split(d.Get("name").(string), "/") - if len(stringParts) < 2 { - return nil, fmt.Errorf("Error parsing parent name. Should be in form accessPolicies/{{"{{"}}policy_id{{"}}"}}/{{camelize (plural $.Name) "lower"}}/{{"{{"}}short_name{{"}}"}}") - } - if err := d.Set("parent", fmt.Sprintf("%s/%s", stringParts[0], stringParts[1])); err != nil { - return nil, fmt.Errorf("Error setting parent, %s", err) - } - return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/set_id_name_with_slashes.go.tmpl b/mmv1/templates/terraform/custom_import/go/set_id_name_with_slashes.go.tmpl deleted file mode 100644 index 244fc59d8bd8..000000000000 --- a/mmv1/templates/terraform/custom_import/go/set_id_name_with_slashes.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -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) - -if err := d.Set("name", name); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) -} -d.SetId(name) -return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/go/tags_tag_binding.go.tmpl b/mmv1/templates/terraform/custom_import/go/tags_tag_binding.go.tmpl deleted file mode 100644 index df9ea77c0aff..000000000000 --- a/mmv1/templates/terraform/custom_import/go/tags_tag_binding.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ - config := meta.(*transport_tpg.Config) - - // current import_formats can't import fields with forward slashes in their value - if err := tpgresource.ParseImportId([]string{ - "tagBindings/(?P.+)", - "(?P.+)", - }, d, config); err != nil { - return nil, err - } - - stringParts := strings.Split(d.Get("name").(string), "/") - if len(stringParts) < 3 { - return nil, fmt.Errorf("Error parsing parent name. Should be in form {{"{{"}}parent{{"}}"}}/tagValues/{{"{{"}}tag_value{{"}}"}}") - } - if err := d.Set("parent", stringParts[0]); err != nil { - return nil, fmt.Errorf("Error setting parent, %s", err) - } - - name := d.Get("name").(string) - d.SetId(name) - - return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/go/vertex_ai_featurestore_entitytype.go.tmpl b/mmv1/templates/terraform/custom_import/go/vertex_ai_featurestore_entitytype.go.tmpl deleted file mode 100644 index 01b58abc78ba..000000000000 --- a/mmv1/templates/terraform/custom_import/go/vertex_ai_featurestore_entitytype.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -config := meta.(*transport_tpg.Config) -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/entityTypes/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}featurestore{{"}}"}}/entityTypes/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -featurestore := d.Get("featurestore").(string) - -re := regexp.MustCompile("^projects/(.+)/locations/(.+)/featurestores/(.+)$") -if parts := re.FindStringSubmatch(featurestore); parts != nil { - d.Set("region", parts[2]) -} - -return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/go/vertex_ai_featurestore_entitytype_feature.go.tmpl b/mmv1/templates/terraform/custom_import/go/vertex_ai_featurestore_entitytype_feature.go.tmpl deleted file mode 100644 index e4b84a1b5aaf..000000000000 --- a/mmv1/templates/terraform/custom_import/go/vertex_ai_featurestore_entitytype_feature.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -config := meta.(*transport_tpg.Config) -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/features/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}entitytype{{"}}"}}/features/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -entitytype := d.Get("entitytype").(string) - -re := regexp.MustCompile("^projects/(.+)/locations/(.+)/featurestores/(.+)/entityTypes/(.+)$") -if parts := re.FindStringSubmatch(entitytype); parts != nil { - d.Set("region", parts[2]) -} - -return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/go/vertex_ai_index_endpoint_deployed_index.go.tmpl b/mmv1/templates/terraform/custom_import/go/vertex_ai_index_endpoint_deployed_index.go.tmpl deleted file mode 100644 index 529fe042e33f..000000000000 --- a/mmv1/templates/terraform/custom_import/go/vertex_ai_index_endpoint_deployed_index.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -config := meta.(*transport_tpg.Config) - -// current import_formats can't import fields with forward slashes in their value -if err := tpgresource.ParseImportId([]string{ - "(?P.+)/deployedIndex/(?P[^/]+)", -}, d, config); err != nil { - return nil, err -} - -// Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}index_endpoint{{"}}"}}/deployedIndex/{{"{{"}}deployed_index_id{{"}}"}}") -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/go/vertex_ai_tensorboard_import.go.tmpl b/mmv1/templates/terraform/custom_import/go/vertex_ai_tensorboard_import.go.tmpl deleted file mode 100644 index be6cd588a588..000000000000 --- a/mmv1/templates/terraform/custom_import/go/vertex_ai_tensorboard_import.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ - config := meta.(*transport_tpg.Config) - if err := tpgresource.ParseImportId([]string{ - "projects/(?P[^/]+)/locations/(?P[^/]+)/tensorboards/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)", - "(?P[^/]+)", - }, d, config); err != nil { - return nil, err - } - - // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/tensorboards/{{"{{"}}name{{"}}"}}") - if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - if err := d.Set("name", id); err != nil { - return nil, fmt.Errorf("Error setting name for import: %s", err) - } - - return []*schema.ResourceData{d}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_import/iap_brand.go.tmpl b/mmv1/templates/terraform/custom_import/iap_brand.go.tmpl index f7e30e03dfa0..e31def29c84b 100644 --- a/mmv1/templates/terraform/custom_import/iap_brand.go.tmpl +++ b/mmv1/templates/terraform/custom_import/iap_brand.go.tmpl @@ -10,8 +10,8 @@ if len(nameParts) != 4 && len(nameParts) != 2 { return nil, fmt.Errorf( "Saw %s when the name is expected to have either shape %s or %s", d.Get("name"), - "projects/{{project}}/brands/{{name}}", - "{{project}}/{{name}}", + "projects/{{"{{"}}project{{"}}"}}/brands/{{"{{"}}name{{"}}"}}", + "{{"{{"}}project{{"}}"}}/{{"{{"}}name{{"}}"}}", ) } diff --git a/mmv1/templates/terraform/custom_import/iap_client.go.tmpl b/mmv1/templates/terraform/custom_import/iap_client.go.tmpl index 40e72cd2c6d7..e3be84e350b0 100644 --- a/mmv1/templates/terraform/custom_import/iap_client.go.tmpl +++ b/mmv1/templates/terraform/custom_import/iap_client.go.tmpl @@ -10,7 +10,7 @@ if len(nameParts) != 6 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s", d.Get("brand").(string), - "projects/{{project_number}}/brands/{{brand_id}}/identityAwareProxyClients/{{client_id}}", + "projects/{{"{{"}}project_number{{"}}"}}/brands/{{"{{"}}brand_id{{"}}"}}/identityAwareProxyClients/{{"{{"}}client_id{{"}}"}}", ) } diff --git a/mmv1/templates/terraform/custom_import/index_self_link_as_name_set_project.go.tmpl b/mmv1/templates/terraform/custom_import/index_self_link_as_name_set_project.go.tmpl index 1b258d729c5b..3fa636cbf14a 100644 --- a/mmv1/templates/terraform/custom_import/index_self_link_as_name_set_project.go.tmpl +++ b/mmv1/templates/terraform/custom_import/index_self_link_as_name_set_project.go.tmpl @@ -11,7 +11,7 @@ return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s", d.Get("name"), - "projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}", + "projects/{{"{{"}}project{{"}}"}}/databases/{{"{{"}}database{{"}}"}}/collectionGroups/{{"{{"}}collection{{"}}"}}/indexes/{{"{{"}}server_generated_id{{"}}"}}", ) } diff --git a/mmv1/templates/terraform/custom_import/kms_crypto_key.go.tmpl b/mmv1/templates/terraform/custom_import/kms_crypto_key.go.tmpl index 55d168f3deea..db6e302250d3 100644 --- a/mmv1/templates/terraform/custom_import/kms_crypto_key.go.tmpl +++ b/mmv1/templates/terraform/custom_import/kms_crypto_key.go.tmpl @@ -17,7 +17,7 @@ return nil, fmt.Errorf("Error setting skip_initial_version_creation: %s", err) } - id, err := tpgresource.ReplaceVars(d, config, "<%= id_format(object) -%>") + id, err := tpgresource.ReplaceVars(d, config, "{{$.GetIdFormat}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/kms_crypto_key_version.go.tmpl b/mmv1/templates/terraform/custom_import/kms_crypto_key_version.go.tmpl index c34e581bfc4d..f29594e126b2 100644 --- a/mmv1/templates/terraform/custom_import/kms_crypto_key_version.go.tmpl +++ b/mmv1/templates/terraform/custom_import/kms_crypto_key_version.go.tmpl @@ -11,7 +11,7 @@ if err := d.Set("name", cryptoKeyVersionId.Name); err != nil { return nil, fmt.Errorf("Error setting name: %s", err) } - id, err := tpgresource.ReplaceVars(d, config, "<%= id_format(object) -%>") + id, err := tpgresource.ReplaceVars(d, config, "{{$.GetIdFormat}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/kms_key_ring_import_job.go.tmpl b/mmv1/templates/terraform/custom_import/kms_key_ring_import_job.go.tmpl index b01c13b3315e..875780ed2ca8 100644 --- a/mmv1/templates/terraform/custom_import/kms_key_ring_import_job.go.tmpl +++ b/mmv1/templates/terraform/custom_import/kms_key_ring_import_job.go.tmpl @@ -11,7 +11,7 @@ return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s", d.Get("name"), - "projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}/importJobs/{{importJobId}}", + "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/keyRings/{{"{{"}}keyRing{{"}}"}}/importJobs/{{"{{"}}importJobId{{"}}"}}", ) } diff --git a/mmv1/templates/terraform/custom_import/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/custom_import/monitoring_monitored_project.go.tmpl index 8510dd4817ef..abe689a1e68b 100644 --- a/mmv1/templates/terraform/custom_import/monitoring_monitored_project.go.tmpl +++ b/mmv1/templates/terraform/custom_import/monitoring_monitored_project.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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 := d.Get("name").(string) name = tpgresource.GetResourceNameFromSelfLink(name) d.Set("name", name) @@ -28,7 +26,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "locations/global/metricsScopes/{{metrics_scope}}/projects/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "locations/global/metricsScopes/{{"{{"}}metrics_scope{{"}}"}}/projects/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/scc_source_self_link_as_name_set_organization.go.tmpl b/mmv1/templates/terraform/custom_import/scc_source_self_link_as_name_set_organization.go.tmpl index 824256d1e8ae..bd54b46f70d8 100644 --- a/mmv1/templates/terraform/custom_import/scc_source_self_link_as_name_set_organization.go.tmpl +++ b/mmv1/templates/terraform/custom_import/scc_source_self_link_as_name_set_organization.go.tmpl @@ -10,7 +10,7 @@ if len(stringParts) != 4 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s", d.Get("name"), - "organizations/{{organization}}/sources/{{source}}", + "organizations/{{"{{"}}organization{{"}}"}}/sources/{{"{{"}}source{{"}}"}}", ) } diff --git a/mmv1/templates/terraform/custom_import/scc_v2_source_self_link_as_name_set_organization.go.tmpl b/mmv1/templates/terraform/custom_import/scc_v2_source_self_link_as_name_set_organization.go.tmpl index b74ffa3fd24d..71dee0f9828a 100644 --- a/mmv1/templates/terraform/custom_import/scc_v2_source_self_link_as_name_set_organization.go.tmpl +++ b/mmv1/templates/terraform/custom_import/scc_v2_source_self_link_as_name_set_organization.go.tmpl @@ -10,7 +10,7 @@ if len(stringParts) != 6 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s", d.Get("name"), - "organizations/{{organization}}/locations/{{location}}/notificationConfigs/{{config_id}}", + "organizations/{{"{{"}}organization{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/notificationConfigs/{{"{{"}}config_id{{"}}"}}", ) } diff --git a/mmv1/templates/terraform/custom_import/secret_version.go.tmpl b/mmv1/templates/terraform/custom_import/secret_version.go.tmpl index 2119c44884c5..0c5ab7aee59f 100644 --- a/mmv1/templates/terraform/custom_import/secret_version.go.tmpl +++ b/mmv1/templates/terraform/custom_import/secret_version.go.tmpl @@ -11,7 +11,7 @@ parts := secretRegex.FindStringSubmatch(name) if len(parts) != 2 { - return nil, fmt.Errorf("Version name does not fit the format `projects/{{project}}/secrets/{{secret}}/versions/{{version}}`") + return nil, fmt.Errorf("Version name does not fit the format `projects/{{"{{"}}project{{"}}"}}/secrets/{{"{{"}}secret{{"}}"}}/versions/{{"{{"}}version{{"}}"}}`") } if err := d.Set("secret", parts[1]); err != nil { return nil, fmt.Errorf("Error setting secret: %s", err) diff --git a/mmv1/templates/terraform/custom_import/service_directory_endpoint.go.tmpl b/mmv1/templates/terraform/custom_import/service_directory_endpoint.go.tmpl index b4e11108725b..4d070d0c250f 100644 --- a/mmv1/templates/terraform/custom_import/service_directory_endpoint.go.tmpl +++ b/mmv1/templates/terraform/custom_import/service_directory_endpoint.go.tmpl @@ -7,7 +7,7 @@ if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nameParts := strings.Split(d.Get("name").(string), "/") if len(nameParts) == 10 { - // `projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}/endpoints/{{endpoint_id}}` + // `projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}/services/{{"{{"}}service_id{{"}}"}}/endpoints/{{"{{"}}endpoint_id{{"}}"}}` if err := d.Set("service", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s", nameParts[1], nameParts[3], nameParts[5], nameParts[7])); err != nil { return nil, fmt.Errorf("Error setting service: %s", err) } @@ -15,7 +15,7 @@ if len(nameParts) == 10 { return nil, fmt.Errorf("Error setting endpoint_id: %s", err) } } else if len(nameParts) == 5 { - // `{{project}}/{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}` + // `{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}/{{"{{"}}endpoint_id{{"}}"}}` if err := d.Set("service", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s/services/%s", nameParts[0], nameParts[1], nameParts[2], nameParts[3])); err != nil { return nil, fmt.Errorf("Error setting service: %s", err) } @@ -28,7 +28,7 @@ if len(nameParts) == 10 { } d.SetId(id) } else if len(nameParts) == 4 { - // `{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}` + // `{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}/{{"{{"}}endpoint_id{{"}}"}}` project, err := tpgresource.GetProject(d, config) if err != nil { return nil, err @@ -48,8 +48,8 @@ if len(nameParts) == 10 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s, %s or %s", d.Get("name"), - "projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}/endpoints/{{endpoint_id}}", - "{{project}}/{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}", - "{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}") + "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}/services/{{"{{"}}service_id{{"}}"}}/endpoints/{{"{{"}}endpoint_id{{"}}"}}", + "{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}/{{"{{"}}endpoint_id{{"}}"}}", + "{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}/{{"{{"}}endpoint_id{{"}}"}}") } return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/service_directory_namespace.go.tmpl b/mmv1/templates/terraform/custom_import/service_directory_namespace.go.tmpl index d651f8dc72ca..a76f6793f51a 100644 --- a/mmv1/templates/terraform/custom_import/service_directory_namespace.go.tmpl +++ b/mmv1/templates/terraform/custom_import/service_directory_namespace.go.tmpl @@ -7,7 +7,7 @@ if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nameParts := strings.Split(d.Get("name").(string), "/") if len(nameParts) == 6 { - // `projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}` + // `projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}` if err := d.Set("project", nameParts[1]); err != nil { return nil, fmt.Errorf("Error setting project: %s", err) } @@ -18,7 +18,7 @@ if len(nameParts) == 6 { return nil, fmt.Errorf("Error setting namespace_id: %s", err) } } else if len(nameParts) == 3 { - // `{{project}}/{{location}}/{{namespace_id}}` + // `{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}` if err := d.Set("project", nameParts[0]); err != nil { return nil, fmt.Errorf("Error setting project: %s", err) } @@ -34,7 +34,7 @@ if len(nameParts) == 6 { } d.SetId(id) } else if len(nameParts) == 2 { - // `{{location}}/{{namespace_id}}` + // `{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}` project, err := tpgresource.GetProject(d, config) if err != nil { return nil, err @@ -57,8 +57,8 @@ if len(nameParts) == 6 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s, %s or %s", d.Get("name"), - "projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}", - "{{project}}/{{location}}/{{namespace_id}}", - "{{location}}/{{namespace_id}}") + "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}", + "{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}", + "{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}") } return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/service_directory_service.go.tmpl b/mmv1/templates/terraform/custom_import/service_directory_service.go.tmpl index eb50768eec65..54e6d0f587d0 100644 --- a/mmv1/templates/terraform/custom_import/service_directory_service.go.tmpl +++ b/mmv1/templates/terraform/custom_import/service_directory_service.go.tmpl @@ -7,7 +7,7 @@ if err := tpgresource.ParseImportId([]string{"(?P.+)"}, d, config); err != nameParts := strings.Split(d.Get("name").(string), "/") if len(nameParts) == 8 { - // `projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}` + // `projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}/services/{{"{{"}}service_id{{"}}"}}` if err := d.Set("namespace", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s", nameParts[1], nameParts[3], nameParts[5])); err != nil { return nil, fmt.Errorf("Error setting namespace: %s", err) } @@ -15,7 +15,7 @@ if len(nameParts) == 8 { return nil, fmt.Errorf("Error setting service_id: %s", err) } } else if len(nameParts) == 4 { - // `{{project}}/{{location}}/{{namespace_id}}/{{service_id}}` + // `{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}` if err := d.Set("namespace", fmt.Sprintf("projects/%s/locations/%s/namespaces/%s", nameParts[0], nameParts[1], nameParts[2])); err != nil { return nil, fmt.Errorf("Error setting namespace: %s", err) } @@ -28,7 +28,7 @@ if len(nameParts) == 8 { } d.SetId(id) } else if len(nameParts) == 3 { - // `{{location}}/{{namespace_id}}/{{service_id}}` + // `{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}` project, err := tpgresource.GetProject(d, config) if err != nil { return nil, err @@ -48,9 +48,9 @@ if len(nameParts) == 8 { return nil, fmt.Errorf( "Saw %s when the name is expected to have shape %s, %s or %s", d.Get("name"), - "projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}", - "{{project}}/{{location}}/{{namespace_id}}/{{service_id}}", - "{{location}}/{{namespace_id}}/{{service_id}}") + "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/namespaces/{{"{{"}}namespace_id{{"}}"}}/services/{{"{{"}}service_id{{"}}"}}", + "{{"{{"}}project{{"}}"}}/{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}", + "{{"{{"}}location{{"}}"}}/{{"{{"}}namespace_id{{"}}"}}/{{"{{"}}service_id{{"}}"}}") } return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/custom_import/set_access_policy_parent_from_access_policy.go.tmpl b/mmv1/templates/terraform/custom_import/set_access_policy_parent_from_access_policy.go.tmpl index 8d8423f23988..de48dc2505b1 100644 --- a/mmv1/templates/terraform/custom_import/set_access_policy_parent_from_access_policy.go.tmpl +++ b/mmv1/templates/terraform/custom_import/set_access_policy_parent_from_access_policy.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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 diff --git a/mmv1/templates/terraform/custom_import/set_access_policy_parent_from_self_link.go.tmpl b/mmv1/templates/terraform/custom_import/set_access_policy_parent_from_self_link.go.tmpl index 55cebd95a812..490f76b3484f 100644 --- a/mmv1/templates/terraform/custom_import/set_access_policy_parent_from_self_link.go.tmpl +++ b/mmv1/templates/terraform/custom_import/set_access_policy_parent_from_self_link.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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 @@ -20,7 +18,7 @@ } stringParts := strings.Split(d.Get("name").(string), "/") if len(stringParts) < 2 { - return nil, fmt.Errorf("Error parsing parent name. Should be in form accessPolicies/{{policy_id}}/<%= object.name.plural.camelize(:lower) -%>/{{short_name}}") + return nil, fmt.Errorf("Error parsing parent name. Should be in form accessPolicies/{{"{{"}}policy_id{{"}}"}}/{{camelize (plural $.Name) "lower"}}/{{"{{"}}short_name{{"}}"}}") } if err := d.Set("parent", fmt.Sprintf("%s/%s", stringParts[0], stringParts[1])); err != nil { return nil, fmt.Errorf("Error setting parent, %s", err) diff --git a/mmv1/templates/terraform/custom_import/tags_tag_binding.go.tmpl b/mmv1/templates/terraform/custom_import/tags_tag_binding.go.tmpl index b3219fa4a23e..df9ea77c0aff 100644 --- a/mmv1/templates/terraform/custom_import/tags_tag_binding.go.tmpl +++ b/mmv1/templates/terraform/custom_import/tags_tag_binding.go.tmpl @@ -10,7 +10,7 @@ stringParts := strings.Split(d.Get("name").(string), "/") if len(stringParts) < 3 { - return nil, fmt.Errorf("Error parsing parent name. Should be in form {{parent}}/tagValues/{{tag_value}}") + return nil, fmt.Errorf("Error parsing parent name. Should be in form {{"{{"}}parent{{"}}"}}/tagValues/{{"{{"}}tag_value{{"}}"}}") } if err := d.Set("parent", stringParts[0]); err != nil { return nil, fmt.Errorf("Error setting parent, %s", err) diff --git a/mmv1/templates/terraform/custom_import/vertex_ai_featurestore_entitytype.go.tmpl b/mmv1/templates/terraform/custom_import/vertex_ai_featurestore_entitytype.go.tmpl index b78c1f3be0f9..01b58abc78ba 100644 --- a/mmv1/templates/terraform/custom_import/vertex_ai_featurestore_entitytype.go.tmpl +++ b/mmv1/templates/terraform/custom_import/vertex_ai_featurestore_entitytype.go.tmpl @@ -6,7 +6,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{featurestore}}/entityTypes/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}featurestore{{"}}"}}/entityTypes/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/vertex_ai_featurestore_entitytype_feature.go.tmpl b/mmv1/templates/terraform/custom_import/vertex_ai_featurestore_entitytype_feature.go.tmpl index f0e2a695facc..e4b84a1b5aaf 100644 --- a/mmv1/templates/terraform/custom_import/vertex_ai_featurestore_entitytype_feature.go.tmpl +++ b/mmv1/templates/terraform/custom_import/vertex_ai_featurestore_entitytype_feature.go.tmpl @@ -6,7 +6,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{entitytype}}/features/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}entitytype{{"}}"}}/features/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/vertex_ai_index_endpoint_deployed_index.go.tmpl b/mmv1/templates/terraform/custom_import/vertex_ai_index_endpoint_deployed_index.go.tmpl index a34536fb307c..529fe042e33f 100644 --- a/mmv1/templates/terraform/custom_import/vertex_ai_index_endpoint_deployed_index.go.tmpl +++ b/mmv1/templates/terraform/custom_import/vertex_ai_index_endpoint_deployed_index.go.tmpl @@ -8,7 +8,7 @@ if err := tpgresource.ParseImportId([]string{ } // Replace import id for the resource id -id, err := tpgresource.ReplaceVars(d, config, "{{index_endpoint}}/deployedIndex/{{deployed_index_id}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}index_endpoint{{"}}"}}/deployedIndex/{{"{{"}}deployed_index_id{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_import/vertex_ai_tensorboard_import.go.tmpl b/mmv1/templates/terraform/custom_import/vertex_ai_tensorboard_import.go.tmpl index eb27ae10ec6b..be6cd588a588 100644 --- a/mmv1/templates/terraform/custom_import/vertex_ai_tensorboard_import.go.tmpl +++ b/mmv1/templates/terraform/custom_import/vertex_ai_tensorboard_import.go.tmpl @@ -9,7 +9,7 @@ } // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{region}}/tensorboards/{{name}}") + id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/tensorboards/{{"{{"}}name{{"}}"}}") if err != nil { return nil, fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/custom_update/cloud_identity_group_membership.go.tmpl b/mmv1/templates/terraform/custom_update/cloud_identity_group_membership.go.tmpl index b2320d173b6d..f606f1b0fec3 100644 --- a/mmv1/templates/terraform/custom_update/cloud_identity_group_membership.go.tmpl +++ b/mmv1/templates/terraform/custom_update/cloud_identity_group_membership.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) if err != nil { return err @@ -22,7 +20,7 @@ d.Partial(true) if d.HasChange("roles") { - url, err := tpgresource.ReplaceVars(d, config, "{{CloudIdentityBasePath}}{{name}}:modifyMembershipRoles") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudIdentityBasePath{{"}}"}}{{"{{"}}name{{"}}"}}:modifyMembershipRoles") if err != nil { return err } diff --git a/mmv1/templates/terraform/custom_update/go/cloud_identity_group_membership.go.tmpl b/mmv1/templates/terraform/custom_update/go/cloud_identity_group_membership.go.tmpl deleted file mode 100644 index f606f1b0fec3..000000000000 --- a/mmv1/templates/terraform/custom_update/go/cloud_identity_group_membership.go.tmpl +++ /dev/null @@ -1,137 +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. -*/ -}} - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return err - } - - billingProject := "" - - d.Partial(true) - - if d.HasChange("roles") { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudIdentityBasePath{{"}}"}}{{"{{"}}name{{"}}"}}:modifyMembershipRoles") - 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 - } - - // Return object for modifyMembershipRoles (we build request object from scratch, without using `obj`) - b, a := d.GetChange("roles") - before := b.(*schema.Set) - after := a.(*schema.Set) - - ignoreUpdateR := make(map[string]struct{}) - addRoleList := after.Difference(before).List() - removeRoleList := before.Difference(after).List() - - var updateRolesParams []map[string]interface{} - for _, addR := range addRoleList { - ar := addR.(map[string]interface{})["name"].(string) - ae := addR.(map[string]interface{})["expiry_detail"].([]interface {}) - for _, removeR := range removeRoleList { - if ar == removeR.(map[string]interface{})["name"].(string) { - ignoreUpdateR[ar] = struct{}{} - var updateR map[string]interface{} - if len(ae) == 0 { - updateR = map[string]interface{}{"name": ar} - } else { - updateR = map[string]interface{}{"name": ar, "expiry_detail": ae[0]} - } - updateP := map[string]interface{}{"field_mask": "expiryDetail.expire_time", "membership_role": updateR} - updateRolesParams = append(updateRolesParams, updateP) - } - } - } - - var addRoles []map[string]interface{} - for _, r := range addRoleList { - name := r.(map[string]interface{})["name"].(string) - if _, ignore := ignoreUpdateR[name]; ignore { - continue - } - expiryDetail := r.(map[string]interface{})["expiry_detail"].([]interface {}) - if len(expiryDetail) == 0 { - addRoles = append(addRoles, map[string]interface{}{"name": name}) - } else { - addRoles = append(addRoles, map[string]interface{}{"name": name, "expiry_detail": expiryDetail[0]}) - } - } - var removeRoles []string - for _, r := range removeRoleList { - name := r.(map[string]interface{})["name"].(string) - if _, ignore := ignoreUpdateR[name]; ignore { - continue - } - removeRoles = append(removeRoles, name) - } - - // ref: https://cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/modifyMembershipRoles#request-body - // Only single operation per request is allowed. - if len(removeRoles) > 0 { - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: map[string]interface{}{"removeRoles": removeRoles}, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - if err != nil { - return fmt.Errorf("Error removing GroupMembership %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished removing GroupMembership %q: %#v", d.Id(), res) - } - } - if len(updateRolesParams) > 0 { - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: map[string]interface{}{"updateRolesParams": updateRolesParams}, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - if err != nil { - return fmt.Errorf("Error updating GroupMembership %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished updating GroupMembership %q: %#v", d.Id(), res) - } - } - if len(addRoles) > 0 { - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: map[string]interface{}{"addRoles": addRoles}, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - if err != nil { - return fmt.Errorf("Error adding GroupMembership %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished adding GroupMembership %q: %#v", d.Id(), res) - } - } - } - - d.Partial(false) - - return resourceCloudIdentityGroupMembershipRead(d, meta) diff --git a/mmv1/templates/terraform/custom_update/go/secret_version.go.tmpl b/mmv1/templates/terraform/custom_update/go/secret_version.go.tmpl deleted file mode 100644 index 4f5dce983088..000000000000 --- a/mmv1/templates/terraform/custom_update/go/secret_version.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -_, err := expandSecretManagerSecretVersionEnabled(d.Get("enabled"), d, config) -if err != nil { - return err -} - -return resourceSecretManagerSecretVersionRead(d, meta) \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_update/go/storage_managed_folder.go.tmpl b/mmv1/templates/terraform/custom_update/go/storage_managed_folder.go.tmpl deleted file mode 100644 index 417b7b924566..000000000000 --- a/mmv1/templates/terraform/custom_update/go/storage_managed_folder.go.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -_ = config - -// we can only get here if force_destroy was updated -if d.Get("force_destroy") != nil { - if err := d.Set("force_destroy", d.Get("force_destroy")); err != nil { - return fmt.Errorf("Error updating force_destroy: %s", err) - } -} - -// all other fields are immutable, don't do anything else -return nil diff --git a/mmv1/templates/terraform/custom_update/go/vertex_ai_index.go.tmpl b/mmv1/templates/terraform/custom_update/go/vertex_ai_index.go.tmpl deleted file mode 100644 index 047f88f50aa8..000000000000 --- a/mmv1/templates/terraform/custom_update/go/vertex_ai_index.go.tmpl +++ /dev/null @@ -1,143 +0,0 @@ -userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) -if err != nil { - return err -} - -billingProject := "" - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return fmt.Errorf("Error fetching project for Index: %s", err) -} -billingProject = project - -obj := make(map[string]interface{}) -displayNameProp, err := expandVertexAIIndexDisplayName(d.Get("display_name"), d, config) -if err != nil { - return err -} else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, displayNameProp)) { - obj["displayName"] = displayNameProp -} -descriptionProp, err := expandVertexAIIndexDescription(d.Get("description"), d, config) -if err != nil { - return err -} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { - obj["description"] = descriptionProp -} -metadataProp, err := expandVertexAIIndexMetadata(d.Get("metadata"), d, config) -if err != nil { - return err -} else if v, ok := d.GetOkExists("metadata"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, metadataProp)) { - obj["metadata"] = metadataProp -} -labelsProp, err := expandVertexAIIndexEffectiveLabels(d.Get("effective_labels"), d, config) -if err != nil { - return err -} else if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) { - obj["labels"] = labelsProp -} - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}VertexAIBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/indexes/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} - -log.Printf("[DEBUG] Updating Index %q: %#v", d.Id(), obj) -headers := make(http.Header) -updateMask := []string{} - -if d.HasChange("display_name") { - updateMask = append(updateMask, "displayName") -} - -if d.HasChange("description") { - updateMask = append(updateMask, "description") -} - -if d.HasChange("effective_labels") { - updateMask = append(updateMask, "labels") -} - -// err == nil indicates that the billing_project value was found -if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp -} - -// if updateMask is empty we are not updating anything so skip the post -if len(updateMask) > 0 { - log.Printf("[DEBUG] Updating first Index with updateMask: %#v", updateMask) - // 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 - } - 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 first Index %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished updating first Index %q: %#v", d.Id(), res) - } - - err = VertexAIOperationWaitTime( - config, res, project, "Updating Index", userAgent, - d.Timeout(schema.TimeoutUpdate)) - - if err != nil { - return err - } -} - -secondUpdateMask := []string{} -// 'If `contents_delta_gcs_uri` is set as part of `index.metadata`, -// then no other Index fields can be also updated as part of the same update call.' -// Metadata update need to be done in a separate update call. -if d.HasChange("metadata") { - secondUpdateMask = append(secondUpdateMask, "metadata") -} - -// if secondUpdateMask is empty we are not updating anything so skip the post -if len(secondUpdateMask) > 0 { - log.Printf("[DEBUG] Updating second Index with updateMask: %#v", secondUpdateMask) - // Override updateMask with secondUpdateMask - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(secondUpdateMask, ",")}) - if err != nil { - return err - } - 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 second Index %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished Updating second Index %q: %#v", d.Id(), res) - } - - err = VertexAIOperationWaitTime( - config, res, project, "Updating Index", userAgent, - d.Timeout(schema.TimeoutUpdate)) - - if err != nil { - return err - } -} - -return resourceVertexAIIndexRead(d, meta) diff --git a/mmv1/templates/terraform/custom_update/secret_version.go.tmpl b/mmv1/templates/terraform/custom_update/secret_version.go.tmpl index 82de0d487efb..4f5dce983088 100644 --- a/mmv1/templates/terraform/custom_update/secret_version.go.tmpl +++ b/mmv1/templates/terraform/custom_update/secret_version.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} _, err := expandSecretManagerSecretVersionEnabled(d.Get("enabled"), d, config) if err != nil { return err diff --git a/mmv1/templates/terraform/custom_update/vertex_ai_index.go.tmpl b/mmv1/templates/terraform/custom_update/vertex_ai_index.go.tmpl index 5cc8a2c70e5d..047f88f50aa8 100644 --- a/mmv1/templates/terraform/custom_update/vertex_ai_index.go.tmpl +++ b/mmv1/templates/terraform/custom_update/vertex_ai_index.go.tmpl @@ -37,7 +37,7 @@ if err != nil { obj["labels"] = labelsProp } -url, err := tpgresource.ReplaceVars(d, config, "{{VertexAIBasePath}}projects/{{project}}/locations/{{region}}/indexes/{{name}}") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}VertexAIBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/indexes/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/decoders/apigee_environment_keyvaluemaps.go.tmpl b/mmv1/templates/terraform/decoders/apigee_environment_keyvaluemaps.go.tmpl index 50674a259175..6c293583b57f 100644 --- a/mmv1/templates/terraform/decoders/apigee_environment_keyvaluemaps.go.tmpl +++ b/mmv1/templates/terraform/decoders/apigee_environment_keyvaluemaps.go.tmpl @@ -1,5 +1,5 @@ config := meta.(*transport_tpg.Config) -name, err := tpgresource.ReplaceVars(d, config, "{{name}}") +name, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}name{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/decoders/backend_service.go.tmpl b/mmv1/templates/terraform/decoders/backend_service.go.tmpl index 2916928ce9bd..3b9f86dd0fb4 100644 --- a/mmv1/templates/terraform/decoders/backend_service.go.tmpl +++ b/mmv1/templates/terraform/decoders/backend_service.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // Requests with consistentHash will error for specific values of // localityLbPolicy. However, the API will not remove it if the backend // service is updated to from supporting to non-supporting localityLbPolicy diff --git a/mmv1/templates/terraform/decoders/bigquery_data_transfer.go.tmpl b/mmv1/templates/terraform/decoders/bigquery_data_transfer.go.tmpl index e14052c091da..f674806c302a 100644 --- a/mmv1/templates/terraform/decoders/bigquery_data_transfer.go.tmpl +++ b/mmv1/templates/terraform/decoders/bigquery_data_transfer.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} if paramMap, ok := res["params"]; ok { params := paramMap.(map[string]interface{}) for _, sp := range sensitiveParams { diff --git a/mmv1/templates/terraform/decoders/cloud_run.go.tmpl b/mmv1/templates/terraform/decoders/cloud_run.go.tmpl index 220359af307e..38aa801f7644 100644 --- a/mmv1/templates/terraform/decoders/cloud_run.go.tmpl +++ b/mmv1/templates/terraform/decoders/cloud_run.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // metadata is not present if the API returns an error if obj, ok := res["metadata"]; ok { if meta, ok := obj.(map[string]interface{}); ok { diff --git a/mmv1/templates/terraform/decoders/containeranalysis_attestation_field_name.go.tmpl b/mmv1/templates/terraform/decoders/containeranalysis_attestation_field_name.go.tmpl index 0b50ee1ad1fb..5f7a2b81a812 100644 --- a/mmv1/templates/terraform/decoders/containeranalysis_attestation_field_name.go.tmpl +++ b/mmv1/templates/terraform/decoders/containeranalysis_attestation_field_name.go.tmpl @@ -1,23 +1,21 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> -<% if version == 'ga' -%> +{{/* + 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. +*/ -}} +{{- if eq $.TargetVersionName "ga" -}} // Field was renamed in GA API res["attestationAuthority"] = res["attestation"] delete(res, "attestation") -<% else -%> +{{- else -}} // decoder logic only in GA provider -<% end -%> +{{- end }} return res, nil diff --git a/mmv1/templates/terraform/decoders/containeranalysis_occurrence.go.tmpl b/mmv1/templates/terraform/decoders/containeranalysis_occurrence.go.tmpl index 0b7dbc5c91bc..bbc7b1b69e6d 100644 --- a/mmv1/templates/terraform/decoders/containeranalysis_occurrence.go.tmpl +++ b/mmv1/templates/terraform/decoders/containeranalysis_occurrence.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> -<% unless version == 'ga' -%> +{{/* + 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. +*/ -}} +{{- if ne $.TargetVersionName "ga" -}} // Resource object was flattened in GA API if nestedResource, ok := res["resource"]; ok { if resObj, ok := nestedResource.(map[string]interface{}); ok { @@ -36,8 +34,8 @@ if attV, ok := res["attestation"]; ok && attV != nil { } } } - -<% else -%> +{{""}} +{{- else -}} // encoder logic only in non-GA version -<% end -%> +{{- end }} return res, nil diff --git a/mmv1/templates/terraform/decoders/dlp_job_trigger.go.tmpl b/mmv1/templates/terraform/decoders/dlp_job_trigger.go.tmpl index c7d985b92d0e..80f3609b00ae 100644 --- a/mmv1/templates/terraform/decoders/dlp_job_trigger.go.tmpl +++ b/mmv1/templates/terraform/decoders/dlp_job_trigger.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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) -if err := d.Set("trigger_id", flattenDataLossPrevention<%= object.name -%>Name(res["name"], d, config)); err != nil { - return nil, fmt.Errorf("Error reading <%= object.name -%>: %s", err) +if err := d.Set("trigger_id", flattenDataLossPrevention{{$.Name}}Name(res["name"], d, config)); err != nil { + return nil, fmt.Errorf("Error reading {{$.Name}}: %s", err) } return res, nil diff --git a/mmv1/templates/terraform/decoders/dlp_template_id.go.tmpl b/mmv1/templates/terraform/decoders/dlp_template_id.go.tmpl index dad4696aca4e..45f394202ead 100644 --- a/mmv1/templates/terraform/decoders/dlp_template_id.go.tmpl +++ b/mmv1/templates/terraform/decoders/dlp_template_id.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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) -if err := d.Set("template_id", flattenDataLossPrevention<%= object.name -%>Name(res["name"], d, config)); err != nil { - return nil, fmt.Errorf("Error reading <%= object.name -%>: %s", err) +if err := d.Set("template_id", flattenDataLossPrevention{{$.Name}}Name(res["name"], d, config)); err != nil { + return nil, fmt.Errorf("Error reading {{$.Name}}: %s", err) } return res, nil diff --git a/mmv1/templates/terraform/decoders/firestore_document.go.tmpl b/mmv1/templates/terraform/decoders/firestore_document.go.tmpl index 1ad7637b672c..6099067a5a58 100644 --- a/mmv1/templates/terraform/decoders/firestore_document.go.tmpl +++ b/mmv1/templates/terraform/decoders/firestore_document.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // We use this decoder to add the path field if name, ok := res["name"]; ok { re := regexp.MustCompile("^projects/[^/]+/databases/[^/]+/documents/(.+)$") diff --git a/mmv1/templates/terraform/decoders/go/apigee_environment_keyvaluemaps.go.tmpl b/mmv1/templates/terraform/decoders/go/apigee_environment_keyvaluemaps.go.tmpl deleted file mode 100644 index 6c293583b57f..000000000000 --- a/mmv1/templates/terraform/decoders/go/apigee_environment_keyvaluemaps.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -config := meta.(*transport_tpg.Config) -name, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, err -} -res["name"] = name -// "encrypted" field is retained for backward compatibility and the value of encrypted will always be true. Apigee X and hybrid do not support unencrypted key value maps. -res["encrypted"] = true - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/app_engine_domain_mapping.go.tmpl b/mmv1/templates/terraform/decoders/go/app_engine_domain_mapping.go.tmpl deleted file mode 100644 index 0d20873e2439..000000000000 --- a/mmv1/templates/terraform/decoders/go/app_engine_domain_mapping.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -// sslManagementType does not get returned with the beta endpoint. Hence, if sslSettings is set -// and sslManagementType is set, we return that value. Otherwise, we carry over the old value -// from state by calling d.Get("ssl_settings.0.ssl_management_type") -if v, ok := res["sslSettings"]; ok { - original := v.(map[string]interface{}) - if _, ok := original["sslManagementType"]; !ok { - original["sslManagementType"] = d.Get("ssl_settings.0.ssl_management_type") - } - res["sslSettings"] = original -} else { - // If ssl_settings is not set, we call d.Get("ssl_settings.0.ssl_management_type"), create sslSettings, - // and store the retrieved value in sslManagementType - transformed := make(map[string]interface{}) - transformed["sslManagementType"] = d.Get("ssl_settings.0.ssl_management_type") - res["sslSettings"] = transformed -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/avoid_meaningless_project_update.tmpl b/mmv1/templates/terraform/decoders/go/avoid_meaningless_project_update.tmpl deleted file mode 100644 index 533c57ce50fb..000000000000 --- a/mmv1/templates/terraform/decoders/go/avoid_meaningless_project_update.tmpl +++ /dev/null @@ -1,60 +0,0 @@ - // The problem we're trying to solve here is that this property is a Project, - // and there are a lot of ways to specify a Project, including the ID vs - // Number, which is something that we can't address in a diffsuppress. - // Since we can't enforce a particular method of entering the project, - // we're just going to have to use whatever the user entered, whether - // it's project/projectName, project/12345, projectName, or 12345. - // The normal behavior of this method would be 'return res' - and that's - // what we'll fall back to if any of our conditions aren't met. Those - // conditions are: - // 1) if the new or old values contain '/', the prefix of that is 'projects'. - // 2) if either is non-numeric, a project with that ID exists. - // 3) the project IDs represented by both the new and old values are the same. - config := meta.(*transport_tpg.Config) - - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return nil, err - } - - new := res["parent"].(string) - old := d.Get("parent").(string) - if strings.HasPrefix(new, "projects/") { - new = strings.Split(new, "/")[1] - } - if strings.HasPrefix(old, "projects/") { - old = strings.Split(old, "/")[1] - } - log.Printf("[DEBUG] Trying to figure out whether to use %s or %s", old, new) - // If there's still a '/' in there, the value must not be a project ID. - if strings.Contains(old, "/") || strings.Contains(new, "/") { - return res, nil - } - // If 'old' isn't entirely numeric, let's assume it's a project ID. - // If it's a project ID - var oldProjId int64 - var newProjId int64 - if oldVal, err := tpgresource.StringToFixed64(old); err == nil { - log.Printf("[DEBUG] The old value was a real number: %d", oldVal) - oldProjId = oldVal - } else { - pOld, err := config.NewResourceManagerClient(userAgent).Projects.Get(old).Do() - if err != nil { - return res, nil - } - oldProjId = pOld.ProjectNumber - } - if newVal, err := tpgresource.StringToFixed64(new); err == nil { - log.Printf("[DEBUG] The new value was a real number: %d", newVal) - newProjId = newVal - } else { - pNew, err := config.NewResourceManagerClient(userAgent).Projects.Get(new).Do() - if err != nil { - return res, nil - } - newProjId = pNew.ProjectNumber - } - if newProjId == oldProjId { - res["parent"] = d.Get("parent") - } - return res, nil diff --git a/mmv1/templates/terraform/decoders/go/backend_service.go.tmpl b/mmv1/templates/terraform/decoders/go/backend_service.go.tmpl deleted file mode 100644 index 3b9f86dd0fb4..000000000000 --- a/mmv1/templates/terraform/decoders/go/backend_service.go.tmpl +++ /dev/null @@ -1,26 +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. -*/ -}} -// Requests with consistentHash will error for specific values of -// localityLbPolicy. However, the API will not remove it if the backend -// service is updated to from supporting to non-supporting localityLbPolicy -// (e.g. RING_HASH to RANDOM), which causes an error on subsequent update. -// In order to prevent errors, we ignore any consistentHash returned -// from the API when the localityLbPolicy doesn't support it. -if v, ok := res["localityLbPolicy"]; ok { - lbPolicy := v.(string) - if lbPolicy != "MAGLEV" && lbPolicy != "RING_HASH" { - delete(res, "consistentHash") - } -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/bigquery_data_transfer.go.tmpl b/mmv1/templates/terraform/decoders/go/bigquery_data_transfer.go.tmpl deleted file mode 100644 index f674806c302a..000000000000 --- a/mmv1/templates/terraform/decoders/go/bigquery_data_transfer.go.tmpl +++ /dev/null @@ -1,39 +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. -*/ -}} -if paramMap, ok := res["params"]; ok { - params := paramMap.(map[string]interface{}) - for _, sp := range sensitiveParams { - if _, apiOk := params[sp]; apiOk { - if _, exists := d.GetOkExists("sensitive_params.0." + sp); exists { - delete(params, sp) - } else { - params[sp] = d.Get("params." + sp) - } - } - } - for k, v := range params { - switch v.(type) { - case []interface{}, map[string]interface{}: - value, err := json.Marshal(v) - if err != nil { - return nil, err - } - params[k] = string(value) - default: - params[k] = v - } - } - res["params"] = params -} - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/billing_project_info.go.tmpl b/mmv1/templates/terraform/decoders/go/billing_project_info.go.tmpl deleted file mode 100644 index 1d00154311e8..000000000000 --- a/mmv1/templates/terraform/decoders/go/billing_project_info.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -res["billing_account"] = strings.TrimPrefix(res["billingAccountName"].(string), "billingAccounts/") -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/cloud_run.go.tmpl b/mmv1/templates/terraform/decoders/go/cloud_run.go.tmpl deleted file mode 100644 index 38aa801f7644..000000000000 --- a/mmv1/templates/terraform/decoders/go/cloud_run.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// metadata is not present if the API returns an error -if obj, ok := res["metadata"]; ok { - if meta, ok := obj.(map[string]interface{}); ok { - res["name"] = meta["name"] - } else { - return nil, fmt.Errorf("Unable to decode 'metadata' block from API response.") - } -} -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/compute_disk_resource_policies_attachment.go.tmpl b/mmv1/templates/terraform/decoders/go/compute_disk_resource_policies_attachment.go.tmpl deleted file mode 100644 index 206b7ef48b3d..000000000000 --- a/mmv1/templates/terraform/decoders/go/compute_disk_resource_policies_attachment.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -res["name"] = tpgresource.GetResourceNameFromSelfLink(res["name"].(string)) -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/compute_network.go.tmpl b/mmv1/templates/terraform/decoders/go/compute_network.go.tmpl deleted file mode 100644 index d1dfb685ae0b..000000000000 --- a/mmv1/templates/terraform/decoders/go/compute_network.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -res["numericId"] = res["id"] // stores unique id into numericId attribute before it's changed to path format -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/compute_region_target_https_proxy.go.tmpl b/mmv1/templates/terraform/decoders/go/compute_region_target_https_proxy.go.tmpl deleted file mode 100644 index 0a72fe1c476a..000000000000 --- a/mmv1/templates/terraform/decoders/go/compute_region_target_https_proxy.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -// Since both sslCertificates and certificateManagerCertificates maps to the same API field (sslCertificates), we need to check the types -// of certificates that exist in the array and decide whether to change the field to certificateManagerCertificate or not. -// The decoder logic depends on the fact that the API does not allow mixed type of certificates and it returns -// certificate manager certificates in the format of //certificatemanager.googleapis.com/projects/*/locations/*/certificates/* -if sslCertificates, ok := res["sslCertificates"].([]interface{}); ok && len(sslCertificates) > 0 { - regPat, _ := regexp.Compile("//certificatemanager.googleapis.com/projects/(.*)/locations/(.*)/certificates/(.*)") - - if regPat.MatchString(sslCertificates[0].(string)) { - // It is enough to check only the type of one of the provided certificates beacuse all the certificates should be the same type. - log.Printf("[DEBUG] The field sslCertificates contains certificateManagerCertificates, the field name will be converted to certificateManagerCertificates") - res["certificateManagerCertificates"] = res["sslCertificates"] - delete(res, "sslCertificates") - } -} -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/compute_target_https_proxy.go.tmpl b/mmv1/templates/terraform/decoders/go/compute_target_https_proxy.go.tmpl deleted file mode 100644 index 0a72fe1c476a..000000000000 --- a/mmv1/templates/terraform/decoders/go/compute_target_https_proxy.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -// Since both sslCertificates and certificateManagerCertificates maps to the same API field (sslCertificates), we need to check the types -// of certificates that exist in the array and decide whether to change the field to certificateManagerCertificate or not. -// The decoder logic depends on the fact that the API does not allow mixed type of certificates and it returns -// certificate manager certificates in the format of //certificatemanager.googleapis.com/projects/*/locations/*/certificates/* -if sslCertificates, ok := res["sslCertificates"].([]interface{}); ok && len(sslCertificates) > 0 { - regPat, _ := regexp.Compile("//certificatemanager.googleapis.com/projects/(.*)/locations/(.*)/certificates/(.*)") - - if regPat.MatchString(sslCertificates[0].(string)) { - // It is enough to check only the type of one of the provided certificates beacuse all the certificates should be the same type. - log.Printf("[DEBUG] The field sslCertificates contains certificateManagerCertificates, the field name will be converted to certificateManagerCertificates") - res["certificateManagerCertificates"] = res["sslCertificates"] - delete(res, "sslCertificates") - } -} -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/containeranalysis_attestation_field_name.go.tmpl b/mmv1/templates/terraform/decoders/go/containeranalysis_attestation_field_name.go.tmpl deleted file mode 100644 index 5f7a2b81a812..000000000000 --- a/mmv1/templates/terraform/decoders/go/containeranalysis_attestation_field_name.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -{{- if eq $.TargetVersionName "ga" -}} -// Field was renamed in GA API -res["attestationAuthority"] = res["attestation"] -delete(res, "attestation") -{{- else -}} -// decoder logic only in GA provider -{{- end }} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/containeranalysis_occurrence.go.tmpl b/mmv1/templates/terraform/decoders/go/containeranalysis_occurrence.go.tmpl deleted file mode 100644 index bbc7b1b69e6d..000000000000 --- a/mmv1/templates/terraform/decoders/go/containeranalysis_occurrence.go.tmpl +++ /dev/null @@ -1,41 +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. -*/ -}} -{{- if ne $.TargetVersionName "ga" -}} -// Resource object was flattened in GA API -if nestedResource, ok := res["resource"]; ok { - if resObj, ok := nestedResource.(map[string]interface{}); ok { - res["resourceUri"] = resObj["uri"] - delete(res, "resource") - } -} - -// Beta attestation.attestation.genericSignedAttestation -// => GA attestation -if attV, ok := res["attestation"]; ok && attV != nil { - att := attV.(map[string]interface{}) - if nestedAttV, ok := att["attestation"]; ok && nestedAttV != nil { - nestedAtt := nestedAttV.(map[string]interface{}) - if genericV, ok := nestedAtt["genericSignedAttestation"]; ok { - genericAtt := genericV.(map[string]interface{}) - res["attestation"] = map[string]interface{}{ - "serializedPayload": genericAtt["serializedPayload"], - "signatures": genericAtt["signatures"], - } - } - } -} -{{""}} -{{- else -}} -// encoder logic only in non-GA version -{{- end }} -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/disk.tmpl b/mmv1/templates/terraform/decoders/go/disk.tmpl deleted file mode 100644 index a5f33263f5c3..000000000000 --- a/mmv1/templates/terraform/decoders/go/disk.tmpl +++ /dev/null @@ -1,62 +0,0 @@ -if v, ok := res["diskEncryptionKey"]; ok { - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - // The raw key won't be returned, so we need to use the original. - transformed["rawKey"] = d.Get("disk_encryption_key.0.raw_key") - transformed["rsaEncryptedKey"] = d.Get("disk_encryption_key.0.rsa_encrypted_key") - transformed["sha256"] = original["sha256"] - - if kmsKeyName, ok := original["kmsKeyName"]; ok { - // The response for crypto keys often includes the version of the key which needs to be removed - // format: projects//locations//keyRings//cryptoKeys//cryptoKeyVersions/1 - transformed["kmsKeyName"] = strings.Split(kmsKeyName.(string), "/cryptoKeyVersions")[0] - } - - if kmsKeyServiceAccount, ok := original["kmsKeyServiceAccount"]; ok { - transformed["kmsKeyServiceAccount"] = kmsKeyServiceAccount - } - - res["diskEncryptionKey"] = transformed -} - -if v, ok := res["sourceImageEncryptionKey"]; ok { - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - // The raw key won't be returned, so we need to use the original. - transformed["rawKey"] = d.Get("source_image_encryption_key.0.raw_key") - transformed["sha256"] = original["sha256"] - - if kmsKeyName, ok := original["kmsKeyName"]; ok { - // The response for crypto keys often includes the version of the key which needs to be removed - // format: projects//locations//keyRings//cryptoKeys//cryptoKeyVersions/1 - transformed["kmsKeyName"] = strings.Split(kmsKeyName.(string), "/cryptoKeyVersions")[0] - } - - if kmsKeyServiceAccount, ok := original["kmsKeyServiceAccount"]; ok { - transformed["kmsKeyServiceAccount"] = kmsKeyServiceAccount - } - - res["sourceImageEncryptionKey"] = transformed -} - -if v, ok := res["sourceSnapshotEncryptionKey"]; ok { - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - // The raw key won't be returned, so we need to use the original. - transformed["rawKey"] = d.Get("source_snapshot_encryption_key.0.raw_key") - transformed["sha256"] = original["sha256"] - - if kmsKeyName, ok := original["kmsKeyName"]; ok { - // The response for crypto keys often includes the version of the key which needs to be removed - // format: projects//locations//keyRings//cryptoKeys//cryptoKeyVersions/1 - transformed["kmsKeyName"] = strings.Split(kmsKeyName.(string), "/cryptoKeyVersions")[0] - } - - if kmsKeyServiceAccount, ok := original["kmsKeyServiceAccount"]; ok { - transformed["kmsKeyServiceAccount"] = kmsKeyServiceAccount - } - - res["sourceSnapshotEncryptionKey"] = transformed -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/dlp_job_trigger.go.tmpl b/mmv1/templates/terraform/decoders/go/dlp_job_trigger.go.tmpl deleted file mode 100644 index 80f3609b00ae..000000000000 --- a/mmv1/templates/terraform/decoders/go/dlp_job_trigger.go.tmpl +++ /dev/null @@ -1,17 +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) -if err := d.Set("trigger_id", flattenDataLossPrevention{{$.Name}}Name(res["name"], d, config)); err != nil { - return nil, fmt.Errorf("Error reading {{$.Name}}: %s", err) -} -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/dlp_stored_info_type.go.tmpl b/mmv1/templates/terraform/decoders/go/dlp_stored_info_type.go.tmpl deleted file mode 100644 index 65407883b9b8..000000000000 --- a/mmv1/templates/terraform/decoders/go/dlp_stored_info_type.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -// Stored info types come back nested with previous versions. We only want the current -// version in the unwrapped form -name := res["name"].(string) -v, ok := res["currentVersion"] -if !ok || v == nil { - return nil, nil -} - -current := v.(map[string]interface{}) -configRaw, ok := current["config"] -if !ok || configRaw == nil { - return nil, nil -} - -config := configRaw.(map[string]interface{}) -// Name comes back on the top level, so set here -config["name"] = name - -configMeta := meta.(*transport_tpg.Config) -if err := d.Set("stored_info_type_id", flattenDataLossPreventionStoredInfoTypeName(res["name"], d, configMeta)); err != nil { - return nil, fmt.Errorf("Error reading StoredInfoType: %s", err) -} - -return config, nil diff --git a/mmv1/templates/terraform/decoders/go/dlp_template_id.go.tmpl b/mmv1/templates/terraform/decoders/go/dlp_template_id.go.tmpl deleted file mode 100644 index 45f394202ead..000000000000 --- a/mmv1/templates/terraform/decoders/go/dlp_template_id.go.tmpl +++ /dev/null @@ -1,17 +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) -if err := d.Set("template_id", flattenDataLossPrevention{{$.Name}}Name(res["name"], d, config)); err != nil { - return nil, fmt.Errorf("Error reading {{$.Name}}: %s", err) -} -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/decoders/go/firebase_database_instance.go.tmpl deleted file mode 100644 index efb6a838e9b9..000000000000 --- a/mmv1/templates/terraform/decoders/go/firebase_database_instance.go.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -if v := res["state"]; v == "DELETED" { - return nil, nil -} -res["desired_state"] = res["state"] - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/firebasehosting_release.go.tmpl b/mmv1/templates/terraform/decoders/go/firebasehosting_release.go.tmpl deleted file mode 100644 index b6b262279b9f..000000000000 --- a/mmv1/templates/terraform/decoders/go/firebasehosting_release.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -if err := d.Set("release_id", tpgresource.GetResourceNameFromSelfLink(res["name"].(string))); err != nil { - return nil, err -} - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/firebasehosting_version.go.tmpl b/mmv1/templates/terraform/decoders/go/firebasehosting_version.go.tmpl deleted file mode 100644 index 85885fe5909e..000000000000 --- a/mmv1/templates/terraform/decoders/go/firebasehosting_version.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -if err := d.Set("version_id", tpgresource.GetResourceNameFromSelfLink(res["name"].(string))); err != nil { - return nil, err -} - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/firestore_document.go.tmpl b/mmv1/templates/terraform/decoders/go/firestore_document.go.tmpl deleted file mode 100644 index 6099067a5a58..000000000000 --- a/mmv1/templates/terraform/decoders/go/firestore_document.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// We use this decoder to add the path field -if name, ok := res["name"]; ok { - re := regexp.MustCompile("^projects/[^/]+/databases/[^/]+/documents/(.+)$") - match := re.FindStringSubmatch(name.(string)) - if len(match) > 0{ - res["path"] = match[1] - } -} -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/integrations_client.go.tmpl b/mmv1/templates/terraform/decoders/go/integrations_client.go.tmpl deleted file mode 100644 index f0a1abfd8804..000000000000 --- a/mmv1/templates/terraform/decoders/go/integrations_client.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// Since Client resource doesnt have any properties, -// Adding this decoder as placeholder else the linter will -// complain that the returned `res` is never used afterwards. -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/kms.go.tmpl b/mmv1/templates/terraform/decoders/go/kms.go.tmpl deleted file mode 100644 index 9d543f3845a9..000000000000 --- a/mmv1/templates/terraform/decoders/go/kms.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} - // Modify the name to be the user specified form. - // We can't just ignore_read on `name` as the linter will - // complain that the returned `res` is never used afterwards. - // Some field needs to be actually set, and we chose `name`. - res["name"] = d.Get("name").(string) -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/long_name_to_self_link.go.tmpl b/mmv1/templates/terraform/decoders/go/long_name_to_self_link.go.tmpl deleted file mode 100644 index d689f6e3e4b0..000000000000 --- a/mmv1/templates/terraform/decoders/go/long_name_to_self_link.go.tmpl +++ /dev/null @@ -1,22 +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. -*/ -}} - // Take the returned long form of the name and use it as `self_link`. - // Then modify the name to be the user specified form. - // We can't just ignore_read on `name` as the linter will - // complain that the returned `res` is never used afterwards. - // Some field needs to be actually set, and we chose `name`. - if err := d.Set("self_link", res["name"].(string)); err != nil { - return nil, fmt.Errorf("Error setting self_link: %s", err) - } - res["name"] = d.Get("name").(string) -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/memorystore_instance.go.tmpl b/mmv1/templates/terraform/decoders/go/memorystore_instance.go.tmpl deleted file mode 100644 index 96061ee6d183..000000000000 --- a/mmv1/templates/terraform/decoders/go/memorystore_instance.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -// Retrieve pscAutoConnections from API response -v, ok := res["pscAutoConnections"] -if !ok { - return nil, fmt.Errorf("pscAutoConnections field not found in API response") -} - -connections, ok := v.([]interface{}) -if !ok { - return nil, fmt.Errorf("pscAutoConnections is not an array") -} - -transformed := make([]interface{}, 0, len(connections)) -uniqueConnections := make(map[string]bool) // Track unique project+network combos - -for _, raw := range connections { - connectionData, ok := raw.(map[string]interface{}) - if !ok || len(connectionData) < 1 { - return nil, fmt.Errorf("Invalid or empty psc connection data: %v", raw) - } - - projectID, ok := connectionData["projectId"].(string) - if !ok { - return nil, fmt.Errorf("invalid project ID in psc connection: %v", connectionData) - } - - networkID, ok := connectionData["network"].(string) - if !ok { - return nil, fmt.Errorf("invalid network ID in psc connection: %v", connectionData) - } - - uniqueKey := projectID + networkID - if !uniqueConnections[uniqueKey] { // Check for uniqueness - uniqueConnections[uniqueKey] = true - transformed = append(transformed, map[string]interface{}{ - "project_id": projectID, - "network": networkID, - }) - } -} - -d.Set("desired_psc_auto_connections", transformed) -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/decoders/go/monitoring_monitored_project.go.tmpl deleted file mode 100644 index 793b3a55200e..000000000000 --- a/mmv1/templates/terraform/decoders/go/monitoring_monitored_project.go.tmpl +++ /dev/null @@ -1,48 +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. -*/ -}} -// terraform resource config -config := meta.(*transport_tpg.Config) - -// The API returns all monitored projects -monitoredProjects, _ := res["monitoredProjects"].([]interface{}) - -// Convert configured terraform monitored_project resource name to a ProjectNumber -expectedProject, configProjectErr := config.NewResourceManagerClient(config.UserAgent).Projects.Get(d.Get("name").(string)).Do() -if configProjectErr != nil { - return nil, configProjectErr -} -expectedProjectNumber := strconv.FormatInt(expectedProject.ProjectNumber, 10) - -log.Printf("[DEBUG] Scanning for ProjectNumber: %s.", expectedProjectNumber) - -// Iterate through the list of monitoredProjects to make sure one matches the configured monitored_project -for _, monitoredProjectRaw := range monitoredProjects { - if monitoredProjectRaw == nil { - continue - } - monitoredProject := monitoredProjectRaw.(map[string]interface{}) - - // MonitoredProject names have the format locations/global/metricsScopes/[metricScopeProjectNumber]/projects/[projectNumber] - monitoredProjectName := monitoredProject["name"] - - // `res` contains the MonitoredProjects of the relevant metrics scope - log.Printf("[DEBUG] Matching ProjectNumbers: %s to %s.", expectedProjectNumber, monitoredProjectName) - if strings.HasSuffix(monitoredProjectName.(string), fmt.Sprintf("/%s", expectedProjectNumber)) { - // Match found - set response object name to match - res["name"] = monitoredProjectName - log.Printf("[DEBUG] Matched ProjectNumbers: %s and %s.", expectedProjectNumber, monitoredProjectName) - return res, nil - } -} -log.Printf("[DEBUG] MonitoringMonitoredProject couldn't be matched.") -return nil, nil diff --git a/mmv1/templates/terraform/decoders/go/monitoring_notification_channel.go.tmpl b/mmv1/templates/terraform/decoders/go/monitoring_notification_channel.go.tmpl deleted file mode 100644 index 9298b2d12435..000000000000 --- a/mmv1/templates/terraform/decoders/go/monitoring_notification_channel.go.tmpl +++ /dev/null @@ -1,26 +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. -*/ -}} -if labelmap, ok := res["labels"]; ok { - labels := labelmap.(map[string]interface{}) - for _, sl := range sensitiveLabels { - if _, apiOk := labels[sl]; apiOk { - if _, exists := d.GetOkExists("sensitive_labels.0." + sl); exists { - delete(labels, sl) - } else { - labels[sl] = d.Get("labels." + sl) - } - } - } -} - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/network_endpoint.go.tmpl b/mmv1/templates/terraform/decoders/go/network_endpoint.go.tmpl deleted file mode 100644 index ba825b656de2..000000000000 --- a/mmv1/templates/terraform/decoders/go/network_endpoint.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -v, ok := res["networkEndpoint"] -if !ok || v == nil { - return res, nil -} - -return v.(map[string]interface{}), nil diff --git a/mmv1/templates/terraform/decoders/go/network_endpoints.go.tmpl b/mmv1/templates/terraform/decoders/go/network_endpoints.go.tmpl deleted file mode 100644 index 9a7b210030e7..000000000000 --- a/mmv1/templates/terraform/decoders/go/network_endpoints.go.tmpl +++ /dev/null @@ -1,54 +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) -userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) -if err != nil { - return nil, err -} - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/networkEndpointGroups/{{"{{"}}network_endpoint_group{{"}}"}}/listNetworkEndpoints") -if err != nil { - return nil, err -} - -billingProject := "" - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return nil, fmt.Errorf("Error fetching project for NetworkEndpoint: %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 -} -// Read past the first page to get all endpoints. -pt, _ := res["nextPageToken"].(string) -allEndpoints, err := networkEndpointsPaginatedRead(d, config, userAgent, url, project, billingProject, pt) -if err != nil { - // networkEndpointsPaginatedRead already adds error description - return nil, err -} -firstPage := res["items"].([]interface{}) -allEndpoints = append(firstPage, allEndpoints...) - -// listNetworkEndpoints returns data in a different structure, so we need to -// convert to the Terraform schema. -var transformed []interface{} -for _, e := range allEndpoints { - t := e.(map[string]interface{})["networkEndpoint"] - transformed = append(transformed, t) -} - -return map[string]interface{}{"networkEndpoints": transformed}, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/noop.go.tmpl b/mmv1/templates/terraform/decoders/go/noop.go.tmpl deleted file mode 100644 index 5bbb7131eb35..000000000000 --- a/mmv1/templates/terraform/decoders/go/noop.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/os_config_patch_deployment.go.tmpl b/mmv1/templates/terraform/decoders/go/os_config_patch_deployment.go.tmpl deleted file mode 100644 index fce9e9366fc3..000000000000 --- a/mmv1/templates/terraform/decoders/go/os_config_patch_deployment.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -if res["patchConfig"] != nil { - patchConfig := res["patchConfig"].(map[string]interface{}) - if patchConfig["goo"] != nil { - patchConfig["goo"].(map[string]interface{})["enabled"] = true - res["patchConfig"] = patchConfig - } -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/private_cloud.go.tmpl b/mmv1/templates/terraform/decoders/go/private_cloud.go.tmpl deleted file mode 100644 index 99bb7f71b831..000000000000 --- a/mmv1/templates/terraform/decoders/go/private_cloud.go.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -config := meta.(*transport_tpg.Config) - -userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) -if err != nil { - return nil, err -} - -url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}VmwareengineBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/privateClouds/{{"{{"}}name{{"}}"}}/clusters") -if err != nil { - return nil, err -} - -url, err = transport_tpg.AddQueryParams(url, map[string]string{"filter": "management=true"}) -if err != nil { - return nil, err -} - -billingProject := "" - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return nil, fmt.Errorf("Error fetching project for Instance: %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 -} - -clusterResponse, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, -}) - -if err != nil { - return nil, fmt.Errorf("Error reading management cluster of PrivateCloud: %s", err) -} - -// There can only be 1 management cluster and if the PC read is successfuly and -// we got response from cluster API then it should be present. -mgmtClusterObj := clusterResponse["clusters"].([]interface{})[0].(map[string]interface{}) -clusterName := mgmtClusterObj["name"].(string) -// get clusterId from the full name, clusterName is "projects/project/locations/location/privateClouds/pc/clusters/cls" -// then clusterId will be "cls" -mgmtClusterObj["clusterId"] = clusterName[strings.LastIndex(clusterName, "/")+1:] - -res["managementCluster"] = mgmtClusterObj - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/redis_instance.go.tmpl b/mmv1/templates/terraform/decoders/go/redis_instance.go.tmpl deleted file mode 100644 index 148c3a0efd42..000000000000 --- a/mmv1/templates/terraform/decoders/go/redis_instance.go.tmpl +++ /dev/null @@ -1,50 +0,0 @@ -config := meta.(*transport_tpg.Config) - -userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) -if err != nil { - return nil, err -} - -if v, ok := res["authEnabled"].(bool); ok { - if v { - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}RedisBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/instances/{{"{{"}}name{{"}}"}}/authString") - if err != nil { - return nil, err - } - - billingProject := "" - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, fmt.Errorf("Error fetching project for Instance: %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 - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return nil, fmt.Errorf("Error reading AuthString: %s", err) - } - - if err := d.Set("auth_string", res["authString"]); err != nil { - return nil, fmt.Errorf("Error reading Instance: %s", err) - } - } -} else { - if err := d.Set("auth_string", ""); err != nil { - return nil, fmt.Errorf("Error reading Instance: %s", err) - } -} - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/region_backend_service.go.tmpl b/mmv1/templates/terraform/decoders/go/region_backend_service.go.tmpl deleted file mode 100644 index e105509f502c..000000000000 --- a/mmv1/templates/terraform/decoders/go/region_backend_service.go.tmpl +++ /dev/null @@ -1,40 +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. -*/ -}} - -{{ if ne $.TargetVersionName `ga` -}} -// Since we add in a NONE subsetting policy, we need to remove it in some -// cases for backwards compatibility with the config -v, ok := res["subsetting"] -if ok && v != nil { - subsetting := v.(map[string]interface{}) - policy, ok := subsetting["policy"] - if ok && policy == "NONE" { - delete(res, "subsetting") - } -} -{{- end }} - -// Requests with consistentHash will error for specific values of -// localityLbPolicy. However, the API will not remove it if the backend -// service is updated to from supporting to non-supporting localityLbPolicy -// (e.g. RING_HASH to RANDOM), which causes an error on subsequent update. -// In order to prevent errors, we ignore any consistentHash returned -// from the API when the localityLbPolicy doesn't support it. -if v, ok := res["localityLbPolicy"]; ok { - lbPolicy := v.(string) - if lbPolicy != "MAGLEV" && lbPolicy != "RING_HASH" { - delete(res, "consistentHash") - } -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/resource_compute_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/decoders/go/resource_compute_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index 6d09c0cac422..000000000000 --- a/mmv1/templates/terraform/decoders/go/resource_compute_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -rules, predefinedRules, err := firewallPolicyWithRulesSplitPredefinedRules(res["rules"].([]interface{})) - -if err != nil { - return nil, fmt.Errorf("Error occurred while splitting pre-defined rules: %s", err) -} - -res["rules"] = rules -res["predefinedRules"] = predefinedRules - -config := meta.(*transport_tpg.Config) - -if err := d.Set("predefined_rules", flattenComputeFirewallPolicyWithRulesPredefinedRules(predefinedRules, d, config)); err != nil { - return nil, fmt.Errorf("Error occurred while setting pre-defined rules: %s", err) -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/resource_compute_network_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/decoders/go/resource_compute_network_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index e702145fec61..000000000000 --- a/mmv1/templates/terraform/decoders/go/resource_compute_network_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -rules, predefinedRules, err := networkFirewallPolicyWithRulesSplitPredefinedRules(res["rules"].([]interface{})) - -if err != nil { - return nil, fmt.Errorf("Error occurred while splitting pre-defined rules: %s", err) -} - -res["rules"] = rules -res["predefinedRules"] = predefinedRules - -config := meta.(*transport_tpg.Config) - -if err := d.Set("predefined_rules", flattenComputeNetworkFirewallPolicyWithRulesPredefinedRules(predefinedRules, d, config)); err != nil { - return nil, fmt.Errorf("Error occurred while setting pre-defined rules: %s", err) -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/route.tmpl b/mmv1/templates/terraform/decoders/go/route.tmpl deleted file mode 100644 index a2eef2bc1f43..000000000000 --- a/mmv1/templates/terraform/decoders/go/route.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -if v, ok := res["nextHopInstance"]; ok { - val, err := tpgresource.ParseZonalFieldValue("instances", v.(string), "project", "next_hop_instance_zone", d, meta.(*transport_tpg.Config), true) - if err != nil { - return nil, err - } - if err := d.Set("next_hop_instance_zone", val.Zone); err != nil { - return nil, fmt.Errorf("Error setting next_hop_instance_zone: %s", err) - } - res["nextHopInstance"] = val.RelativeLink() -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/snapshot.go.tmpl b/mmv1/templates/terraform/decoders/go/snapshot.go.tmpl deleted file mode 100644 index 2334a81ef893..000000000000 --- a/mmv1/templates/terraform/decoders/go/snapshot.go.tmpl +++ /dev/null @@ -1,53 +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. -*/ -}} -if v, ok := res["snapshotEncryptionKey"]; ok { - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - // The raw key won't be returned, so we need to use the original. - transformed["rawKey"] = d.Get("snapshot_encryption_key.0.raw_key") - transformed["sha256"] = original["sha256"] - - if kmsKeyName, ok := original["kmsKeyName"]; ok { - // The response for crypto keys often includes the version of the key which needs to be removed - // format: projects//locations//keyRings//cryptoKeys//cryptoKeyVersions/1 - transformed["kmsKeyName"] = strings.Split(kmsKeyName.(string), "/cryptoKeyVersions")[0] - } - - if kmsKeyServiceAccount, ok := original["kmsKeyServiceAccount"]; ok { - transformed["kmsKeyServiceAccount"] = kmsKeyServiceAccount - } - - res["snapshotEncryptionKey"] = transformed -} - -if v, ok := res["sourceDiskEncryptionKey"]; ok { - original := v.(map[string]interface{}) - transformed := make(map[string]interface{}) - // The raw key won't be returned, so we need to use the original. - transformed["rawKey"] = d.Get("source_disk_encryption_key.0.raw_key") - transformed["sha256"] = original["sha256"] - - if kmsKeyName, ok := original["kmsKeyName"]; ok { - // The response for crypto keys often includes the version of the key which needs to be removed - // format: projects//locations//keyRings//cryptoKeys//cryptoKeyVersions/1 - transformed["kmsKeyName"] = strings.Split(kmsKeyName.(string), "/cryptoKeyVersions")[0] - } - - if kmsKeyServiceAccount, ok := original["kmsKeyServiceAccount"]; ok { - transformed["kmsKeyServiceAccount"] = kmsKeyServiceAccount - } - - res["sourceDiskEncryptionKey"] = transformed -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/spanner_database.go.tmpl b/mmv1/templates/terraform/decoders/go/spanner_database.go.tmpl deleted file mode 100644 index c1b4cba3b249..000000000000 --- a/mmv1/templates/terraform/decoders/go/spanner_database.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -config := meta.(*transport_tpg.Config) -d.SetId(res["name"].(string)) -if err := tpgresource.ParseImportId([]string{"projects/(?P[^/]+)/instances/(?P[^/]+)/databases/(?P[^/]+)"}, d, config); err != nil { - return nil, err -} -res["project"] = d.Get("project").(string) -res["instance"] = d.Get("instance").(string) -res["name"] = d.Get("name").(string) -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}instance{{"}}"}}/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, err -} -d.SetId(id) -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/spanner_instance.go.tmpl b/mmv1/templates/terraform/decoders/go/spanner_instance.go.tmpl deleted file mode 100644 index ee871f377d2a..000000000000 --- a/mmv1/templates/terraform/decoders/go/spanner_instance.go.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -config := meta.(*transport_tpg.Config) -d.SetId(res["name"].(string)) -if err := tpgresource.ParseImportId([]string{"projects/(?P[^/]+)/instances/(?P[^/]+)"}, d, config); err != nil { - return nil, err -} -res["project"] = d.Get("project").(string) -res["name"] = d.Get("name").(string) -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, err -} -d.SetId(id) -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/spanner_instance_config.go.tmpl b/mmv1/templates/terraform/decoders/go/spanner_instance_config.go.tmpl deleted file mode 100644 index 23a57a340b34..000000000000 --- a/mmv1/templates/terraform/decoders/go/spanner_instance_config.go.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -config := meta.(*transport_tpg.Config) -d.SetId(res["name"].(string)) -if err := tpgresource.ParseImportId([]string{"projects/(?P[^/]+)/instanceConfigs/(?P[^/]+)"}, d, config); err != nil { - return nil, err -} -res["project"] = d.Get("project").(string) -res["name"] = d.Get("name").(string) -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}name{{"}}"}}") -if err != nil { -return nil, err -} -baseReplicas, err := getBaseInstanceConfigReplicas(d, config, res["baseConfig"], res["project"].(string), config.UserAgent) -if err != nil { - return nil, err -} -customReplica := make(map[int]interface{}) -for _, b := range baseReplicas { - customReplica[replicasHash(b)] = b -} -var cR []interface{} -for _, r := range res["replicas"].([]interface{}) { - if _, ok := customReplica[replicasHash(r)]; !ok { - cR = append(cR, r) - } -} -res["replicas"] = cR -d.SetId(id) -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/spanner_schedule_backup.go.tmpl b/mmv1/templates/terraform/decoders/go/spanner_schedule_backup.go.tmpl deleted file mode 100644 index 03da6fad4e75..000000000000 --- a/mmv1/templates/terraform/decoders/go/spanner_schedule_backup.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -config := meta.(*transport_tpg.Config) -d.SetId(res["name"].(string)) -if err := tpgresource.ParseImportId([]string{"projects/(?P[^/]+)/instances/(?P[^/]+)/databases/(?P[^/]+)/backupSchedules/(?P[^/]+)"}, d, config); err != nil { - return nil, err -} -res["project"] = d.Get("project").(string) -res["instance"] = d.Get("instance").(string) -res["database"] = d.Get("database").(string) -res["name"] = d.Get("name").(string) -id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}instance{{"}}"}}/{{"{{"}}database{{"}}"}}/{{"{{"}}name{{"}}"}}") -if err != nil { - return nil, err -} -d.SetId(id) -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/sql_source_representation_instance.go.tmpl b/mmv1/templates/terraform/decoders/go/sql_source_representation_instance.go.tmpl deleted file mode 100644 index 6744476686d9..000000000000 --- a/mmv1/templates/terraform/decoders/go/sql_source_representation_instance.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. -*/ -}} -if v, ok := res["onPremisesConfiguration"]; ok { - opc := v.(map[string]interface{}) - hostPort := opc["hostPort"] - spl := strings.Split(hostPort.(string), ":") - if len(spl) != 2 { - return nil, fmt.Errorf("unexpected value for hostPort, expected [host]:[port], got %q", hostPort) - } - opc["host"] = spl[0] - p, err := strconv.Atoi(spl[1]) - if err != nil { - return nil, fmt.Errorf("error converting port %q to int: %v", spl[1], err) - } - opc["port"] = p - delete(opc, "hostPort") -} -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/treat_deleted_state_as_gone.go.tmpl b/mmv1/templates/terraform/decoders/go/treat_deleted_state_as_gone.go.tmpl deleted file mode 100644 index 85855239db2d..000000000000 --- a/mmv1/templates/terraform/decoders/go/treat_deleted_state_as_gone.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -if v := res["state"]; v == "DELETED" { - return nil, nil -} - -return res, nil diff --git a/mmv1/templates/terraform/decoders/go/treat_destroyed_state_as_gone.tmpl b/mmv1/templates/terraform/decoders/go/treat_destroyed_state_as_gone.tmpl deleted file mode 100644 index 0fab45e22849..000000000000 --- a/mmv1/templates/terraform/decoders/go/treat_destroyed_state_as_gone.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} -if v := res["state"]; v == "DESTROYED" { - return nil, nil -} - -return res, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/go/unwrap_global_neg.go.tmpl b/mmv1/templates/terraform/decoders/go/unwrap_global_neg.go.tmpl deleted file mode 100644 index ba825b656de2..000000000000 --- a/mmv1/templates/terraform/decoders/go/unwrap_global_neg.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -v, ok := res["networkEndpoint"] -if !ok || v == nil { - return res, nil -} - -return v.(map[string]interface{}), nil diff --git a/mmv1/templates/terraform/decoders/go/unwrap_resource.go.tmpl b/mmv1/templates/terraform/decoders/go/unwrap_resource.go.tmpl deleted file mode 100644 index de8f898e5c8a..000000000000 --- a/mmv1/templates/terraform/decoders/go/unwrap_resource.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -v, ok := res["{{camelize $.Name "lower"}}"] -if !ok || v == nil { - return res, nil -} - -return v.(map[string]interface{}), nil diff --git a/mmv1/templates/terraform/decoders/go/unwrap_route_policy_resource.go.tmpl b/mmv1/templates/terraform/decoders/go/unwrap_route_policy_resource.go.tmpl deleted file mode 100644 index bf2a58b12ba4..000000000000 --- a/mmv1/templates/terraform/decoders/go/unwrap_route_policy_resource.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -v, ok := res["resource"] -if !ok || v == nil { - return res, nil -} - -return v.(map[string]interface{}), nil diff --git a/mmv1/templates/terraform/decoders/go/vertex_ai_index_endpoint_deployed_index.go.tmpl b/mmv1/templates/terraform/decoders/go/vertex_ai_index_endpoint_deployed_index.go.tmpl deleted file mode 100644 index 4775b5119c94..000000000000 --- a/mmv1/templates/terraform/decoders/go/vertex_ai_index_endpoint_deployed_index.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -v, ok := res["deployedIndexes"] -if !ok || v == nil { // CREATE - res["name"] = res["deployedIndexId"] - delete(res, "deployedIndexId") - return res, nil -} -dpIndex := make(map[string]interface{}) -for _, v := range v.([]interface{}) { - dpI := v.(map[string]interface{}) - if dpI["id"] == d.Get("deployed_index_id").(string) { - dpI["indexEndpoint"] = d.Get("index_endpoint") - dpI["deployedIndexId"] = d.Get("deployed_index_id") - dpIndex = dpI - break - } -} -if dpIndex == nil { - return nil, fmt.Errorf("Error: Deployment Index not Found") -} -return dpIndex, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/decoders/kms.go.tmpl b/mmv1/templates/terraform/decoders/kms.go.tmpl index 985876d43175..9d543f3845a9 100644 --- a/mmv1/templates/terraform/decoders/kms.go.tmpl +++ b/mmv1/templates/terraform/decoders/kms.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} // Modify the name to be the user specified form. // We can't just ignore_read on `name` as the linter will // complain that the returned `res` is never used afterwards. diff --git a/mmv1/templates/terraform/decoders/long_name_to_self_link.go.tmpl b/mmv1/templates/terraform/decoders/long_name_to_self_link.go.tmpl index 698290b39c66..d689f6e3e4b0 100644 --- a/mmv1/templates/terraform/decoders/long_name_to_self_link.go.tmpl +++ b/mmv1/templates/terraform/decoders/long_name_to_self_link.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} // Take the returned long form of the name and use it as `self_link`. // Then modify the name to be the user specified form. // We can't just ignore_read on `name` as the linter will diff --git a/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.tmpl index 68afb6097983..793b3a55200e 100644 --- a/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.tmpl +++ b/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} // terraform resource config config := meta.(*transport_tpg.Config) diff --git a/mmv1/templates/terraform/decoders/monitoring_notification_channel.go.tmpl b/mmv1/templates/terraform/decoders/monitoring_notification_channel.go.tmpl index 5ca0d9e77232..9298b2d12435 100644 --- a/mmv1/templates/terraform/decoders/monitoring_notification_channel.go.tmpl +++ b/mmv1/templates/terraform/decoders/monitoring_notification_channel.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} if labelmap, ok := res["labels"]; ok { labels := labelmap.(map[string]interface{}) for _, sl := range sensitiveLabels { diff --git a/mmv1/templates/terraform/decoders/network_endpoint.go.tmpl b/mmv1/templates/terraform/decoders/network_endpoint.go.tmpl index 20fe5d4526e8..ba825b656de2 100644 --- a/mmv1/templates/terraform/decoders/network_endpoint.go.tmpl +++ b/mmv1/templates/terraform/decoders/network_endpoint.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} v, ok := res["networkEndpoint"] if !ok || v == nil { return res, nil diff --git a/mmv1/templates/terraform/decoders/network_endpoints.go.tmpl b/mmv1/templates/terraform/decoders/network_endpoints.go.tmpl index 0d37ba123d32..9a7b210030e7 100644 --- a/mmv1/templates/terraform/decoders/network_endpoints.go.tmpl +++ b/mmv1/templates/terraform/decoders/network_endpoints.go.tmpl @@ -1,24 +1,22 @@ -<%# 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. --%> +{{/* + 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) userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) if err != nil { return nil, err } -url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/listNetworkEndpoints") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/networkEndpointGroups/{{"{{"}}network_endpoint_group{{"}}"}}/listNetworkEndpoints") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/decoders/private_cloud.go.tmpl b/mmv1/templates/terraform/decoders/private_cloud.go.tmpl index 416fc03698e8..99bb7f71b831 100644 --- a/mmv1/templates/terraform/decoders/private_cloud.go.tmpl +++ b/mmv1/templates/terraform/decoders/private_cloud.go.tmpl @@ -5,7 +5,7 @@ if err != nil { return nil, err } -url, err := tpgresource.ReplaceVars(d, config, "{{VmwareengineBasePath}}projects/{{project}}/locations/{{location}}/privateClouds/{{name}}/clusters") +url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}VmwareengineBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/privateClouds/{{"{{"}}name{{"}}"}}/clusters") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/decoders/redis_instance.go.tmpl b/mmv1/templates/terraform/decoders/redis_instance.go.tmpl index 7f18b10e131a..148c3a0efd42 100644 --- a/mmv1/templates/terraform/decoders/redis_instance.go.tmpl +++ b/mmv1/templates/terraform/decoders/redis_instance.go.tmpl @@ -7,7 +7,7 @@ if err != nil { if v, ok := res["authEnabled"].(bool); ok { if v { - url, err := tpgresource.ReplaceVars(d, config, "{{RedisBasePath}}projects/{{project}}/locations/{{region}}/instances/{{name}}/authString") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}RedisBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/instances/{{"{{"}}name{{"}}"}}/authString") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/decoders/region_backend_service.go.tmpl b/mmv1/templates/terraform/decoders/region_backend_service.go.tmpl index 517866dd216e..e105509f502c 100644 --- a/mmv1/templates/terraform/decoders/region_backend_service.go.tmpl +++ b/mmv1/templates/terraform/decoders/region_backend_service.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} // Since we add in a NONE subsetting policy, we need to remove it in some // cases for backwards compatibility with the config v, ok := res["subsetting"] @@ -24,7 +22,7 @@ if ok && v != nil { delete(res, "subsetting") } } -<% end -%> +{{- end }} // Requests with consistentHash will error for specific values of // localityLbPolicy. However, the API will not remove it if the backend diff --git a/mmv1/templates/terraform/decoders/snapshot.go.tmpl b/mmv1/templates/terraform/decoders/snapshot.go.tmpl index 6d7e88aebbf6..2334a81ef893 100644 --- a/mmv1/templates/terraform/decoders/snapshot.go.tmpl +++ b/mmv1/templates/terraform/decoders/snapshot.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} if v, ok := res["snapshotEncryptionKey"]; ok { original := v.(map[string]interface{}) transformed := make(map[string]interface{}) diff --git a/mmv1/templates/terraform/decoders/spanner_database.go.tmpl b/mmv1/templates/terraform/decoders/spanner_database.go.tmpl index ef35d7aff739..c1b4cba3b249 100644 --- a/mmv1/templates/terraform/decoders/spanner_database.go.tmpl +++ b/mmv1/templates/terraform/decoders/spanner_database.go.tmpl @@ -6,7 +6,7 @@ if err := tpgresource.ParseImportId([]string{"projects/(?P[^/]+)/instan res["project"] = d.Get("project").(string) res["instance"] = d.Get("instance").(string) res["name"] = d.Get("name").(string) -id, err := tpgresource.ReplaceVars(d, config, "{{instance}}/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}instance{{"}}"}}/{{"{{"}}name{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/decoders/spanner_instance.go.tmpl b/mmv1/templates/terraform/decoders/spanner_instance.go.tmpl index 4e18214e7d10..ee871f377d2a 100644 --- a/mmv1/templates/terraform/decoders/spanner_instance.go.tmpl +++ b/mmv1/templates/terraform/decoders/spanner_instance.go.tmpl @@ -5,7 +5,7 @@ if err := tpgresource.ParseImportId([]string{"projects/(?P[^/]+)/instan } res["project"] = d.Get("project").(string) res["name"] = d.Get("name").(string) -id, err := tpgresource.ReplaceVars(d, config, "{{project}}/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}name{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/decoders/spanner_instance_config.go.tmpl b/mmv1/templates/terraform/decoders/spanner_instance_config.go.tmpl index 6324f8f3da38..23a57a340b34 100644 --- a/mmv1/templates/terraform/decoders/spanner_instance_config.go.tmpl +++ b/mmv1/templates/terraform/decoders/spanner_instance_config.go.tmpl @@ -5,7 +5,7 @@ if err := tpgresource.ParseImportId([]string{"projects/(?P[^/]+)/instan } res["project"] = d.Get("project").(string) res["name"] = d.Get("name").(string) -id, err := tpgresource.ReplaceVars(d, config, "{{project}}/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}project{{"}}"}}/{{"{{"}}name{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/decoders/spanner_schedule_backup.go.tmpl b/mmv1/templates/terraform/decoders/spanner_schedule_backup.go.tmpl index d1982436f24f..03da6fad4e75 100644 --- a/mmv1/templates/terraform/decoders/spanner_schedule_backup.go.tmpl +++ b/mmv1/templates/terraform/decoders/spanner_schedule_backup.go.tmpl @@ -7,7 +7,7 @@ res["project"] = d.Get("project").(string) res["instance"] = d.Get("instance").(string) res["database"] = d.Get("database").(string) res["name"] = d.Get("name").(string) -id, err := tpgresource.ReplaceVars(d, config, "{{instance}}/{{database}}/{{name}}") +id, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}instance{{"}}"}}/{{"{{"}}database{{"}}"}}/{{"{{"}}name{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/decoders/sql_source_representation_instance.go.tmpl b/mmv1/templates/terraform/decoders/sql_source_representation_instance.go.tmpl index f4341063bcb6..6744476686d9 100644 --- a/mmv1/templates/terraform/decoders/sql_source_representation_instance.go.tmpl +++ b/mmv1/templates/terraform/decoders/sql_source_representation_instance.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} if v, ok := res["onPremisesConfiguration"]; ok { opc := v.(map[string]interface{}) hostPort := opc["hostPort"] diff --git a/mmv1/templates/terraform/decoders/treat_destroyed_state_as_gone.tmpl b/mmv1/templates/terraform/decoders/treat_destroyed_state_as_gone.tmpl index 298862ddca05..0fab45e22849 100644 --- a/mmv1/templates/terraform/decoders/treat_destroyed_state_as_gone.tmpl +++ b/mmv1/templates/terraform/decoders/treat_destroyed_state_as_gone.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} if v := res["state"]; v == "DESTROYED" { return nil, nil } diff --git a/mmv1/templates/terraform/decoders/unwrap_global_neg.go.tmpl b/mmv1/templates/terraform/decoders/unwrap_global_neg.go.tmpl index 20fe5d4526e8..ba825b656de2 100644 --- a/mmv1/templates/terraform/decoders/unwrap_global_neg.go.tmpl +++ b/mmv1/templates/terraform/decoders/unwrap_global_neg.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} v, ok := res["networkEndpoint"] if !ok || v == nil { return res, nil diff --git a/mmv1/templates/terraform/decoders/unwrap_resource.go.tmpl b/mmv1/templates/terraform/decoders/unwrap_resource.go.tmpl index 92bb21dccb35..de8f898e5c8a 100644 --- a/mmv1/templates/terraform/decoders/unwrap_resource.go.tmpl +++ b/mmv1/templates/terraform/decoders/unwrap_resource.go.tmpl @@ -1,18 +1,16 @@ -<%# 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. --%> -v, ok := res["<%= object.name.camelize(:lower) %>"] +{{/* + 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. +*/ -}} +v, ok := res["{{camelize $.Name "lower"}}"] if !ok || v == nil { return res, nil } diff --git a/mmv1/templates/terraform/decoders/unwrap_route_policy_resource.go.tmpl b/mmv1/templates/terraform/decoders/unwrap_route_policy_resource.go.tmpl index d471a7910064..bf2a58b12ba4 100644 --- a/mmv1/templates/terraform/decoders/unwrap_route_policy_resource.go.tmpl +++ b/mmv1/templates/terraform/decoders/unwrap_route_policy_resource.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. -# 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 -# -# 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. --%> +{{/* + 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. +*/ -}} v, ok := res["resource"] if !ok || v == nil { return res, nil diff --git a/mmv1/templates/terraform/encoders/access_level_never_send_parent.go.tmpl b/mmv1/templates/terraform/encoders/access_level_never_send_parent.go.tmpl index 70f2c440dac7..5d980ea2427f 100644 --- a/mmv1/templates/terraform/encoders/access_level_never_send_parent.go.tmpl +++ b/mmv1/templates/terraform/encoders/access_level_never_send_parent.go.tmpl @@ -1,16 +1,14 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} delete(obj, "parent") return obj, nil diff --git a/mmv1/templates/terraform/encoders/active_directory_domain_trust.go.tmpl b/mmv1/templates/terraform/encoders/active_directory_domain_trust.go.tmpl index 2c0b939820eb..38872710d8e3 100644 --- a/mmv1/templates/terraform/encoders/active_directory_domain_trust.go.tmpl +++ b/mmv1/templates/terraform/encoders/active_directory_domain_trust.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} wrappedReq := map[string]interface{}{ "trust": obj, } diff --git a/mmv1/templates/terraform/encoders/backend_service.go.tmpl b/mmv1/templates/terraform/encoders/backend_service.go.tmpl index b018972bd0b2..f92c155ea246 100644 --- a/mmv1/templates/terraform/encoders/backend_service.go.tmpl +++ b/mmv1/templates/terraform/encoders/backend_service.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} backendsRaw, ok := obj["backends"] if !ok { return obj, nil diff --git a/mmv1/templates/terraform/encoders/bigquery_data_transfer.go.tmpl b/mmv1/templates/terraform/encoders/bigquery_data_transfer.go.tmpl index c77a927533c6..631b88f55ff6 100644 --- a/mmv1/templates/terraform/encoders/bigquery_data_transfer.go.tmpl +++ b/mmv1/templates/terraform/encoders/bigquery_data_transfer.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} paramMap, ok := obj["params"] if !ok { paramMap = make(map[string]string) diff --git a/mmv1/templates/terraform/encoders/bigquery_job.go.tmpl b/mmv1/templates/terraform/encoders/bigquery_job.go.tmpl index d020a4a6f90a..df0560b27ab5 100644 --- a/mmv1/templates/terraform/encoders/bigquery_job.go.tmpl +++ b/mmv1/templates/terraform/encoders/bigquery_job.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} project, err := tpgresource.GetProject(d, meta.(*transport_tpg.Config)) if err != nil { return nil, err diff --git a/mmv1/templates/terraform/encoders/bigtable_app_profile.go.tmpl b/mmv1/templates/terraform/encoders/bigtable_app_profile.go.tmpl index a3f7770f8a2f..848352f99c92 100644 --- a/mmv1/templates/terraform/encoders/bigtable_app_profile.go.tmpl +++ b/mmv1/templates/terraform/encoders/bigtable_app_profile.go.tmpl @@ -1,20 +1,18 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> -<%# Because instance is a URL param only, it does not get expanded and +{{/* + 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. +*/ -}} +{{/* Because instance is a URL param only, it does not get expanded and the URL is constructed from ResourceData. Set it in - state and use a encoder instead of a field expander -%> + state and use a encoder instead of a field expander */ -}} // Instance is a URL parameter only, so replace self-link/path with resource name only. if err := d.Set("instance", tpgresource.GetResourceNameFromSelfLink(d.Get("instance").(string))); err != nil { return nil, fmt.Errorf("Error setting instance: %s", err) diff --git a/mmv1/templates/terraform/encoders/cloud_run_domain_mapping.go.tmpl b/mmv1/templates/terraform/encoders/cloud_run_domain_mapping.go.tmpl index b368b7f79990..151918f12fdb 100644 --- a/mmv1/templates/terraform/encoders/cloud_run_domain_mapping.go.tmpl +++ b/mmv1/templates/terraform/encoders/cloud_run_domain_mapping.go.tmpl @@ -1,22 +1,20 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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 := d.Get("name").(string) metadata := obj["metadata"].(map[string]interface{}) metadata["name"] = name // The only acceptable version/kind right now obj["apiVersion"] = "domains.cloudrun.com/v1" -obj["kind"] = "<%= object.name -%>" +obj["kind"] = "{{$.Name}}" return obj, nil diff --git a/mmv1/templates/terraform/encoders/cloud_run_service.go.tmpl b/mmv1/templates/terraform/encoders/cloud_run_service.go.tmpl index 213cfcf7cb43..8b7acfe865b4 100644 --- a/mmv1/templates/terraform/encoders/cloud_run_service.go.tmpl +++ b/mmv1/templates/terraform/encoders/cloud_run_service.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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 := d.Get("name").(string) if obj["metadata"] == nil { obj["metadata"] = make(map[string]interface{}) diff --git a/mmv1/templates/terraform/encoders/cloudbuildv2_repository.go.tmpl b/mmv1/templates/terraform/encoders/cloudbuildv2_repository.go.tmpl index dd1bfd8558c1..baf759264b04 100644 --- a/mmv1/templates/terraform/encoders/cloudbuildv2_repository.go.tmpl +++ b/mmv1/templates/terraform/encoders/cloudbuildv2_repository.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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) // Extract any empty fields from the parent_connection field. project, err := tpgresource.GetProject(d, config) diff --git a/mmv1/templates/terraform/encoders/clouddomains_registration.go.tmpl b/mmv1/templates/terraform/encoders/clouddomains_registration.go.tmpl index fb8da3010477..5d2fadaa53df 100644 --- a/mmv1/templates/terraform/encoders/clouddomains_registration.go.tmpl +++ b/mmv1/templates/terraform/encoders/clouddomains_registration.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // Request body is registration object with additional fields // See https://cloud.google.com/domains/docs/reference/rest/v1beta1/projects.locations.registrations/register diff --git a/mmv1/templates/terraform/encoders/compute_global_network_endpoint.go.tmpl b/mmv1/templates/terraform/encoders/compute_global_network_endpoint.go.tmpl index 4ef5e49feb5c..7e295d87c61a 100644 --- a/mmv1/templates/terraform/encoders/compute_global_network_endpoint.go.tmpl +++ b/mmv1/templates/terraform/encoders/compute_global_network_endpoint.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only. if err := d.Set("global_network_endpoint_group", tpgresource.GetResourceNameFromSelfLink(d.Get("global_network_endpoint_group").(string))); err != nil { return nil, fmt.Errorf("Error setting global_network_endpoint_group: %s", err) diff --git a/mmv1/templates/terraform/encoders/compute_instance_group_membership.go.tmpl b/mmv1/templates/terraform/encoders/compute_instance_group_membership.go.tmpl index a9bfa7420085..b6a74238b067 100644 --- a/mmv1/templates/terraform/encoders/compute_instance_group_membership.go.tmpl +++ b/mmv1/templates/terraform/encoders/compute_instance_group_membership.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // Instance Group is a URL parameter only, so replace self-link/path with resource name only. if err := d.Set("instance_group", tpgresource.GetResourceNameFromSelfLink(d.Get("instance_group").(string))); err != nil { return nil, fmt.Errorf("Error setting instance_group: %s", err) diff --git a/mmv1/templates/terraform/encoders/compute_network_endpoint.go.tmpl b/mmv1/templates/terraform/encoders/compute_network_endpoint.go.tmpl index ba9a9d5cec92..011148ae7a10 100644 --- a/mmv1/templates/terraform/encoders/compute_network_endpoint.go.tmpl +++ b/mmv1/templates/terraform/encoders/compute_network_endpoint.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only. if err := d.Set("network_endpoint_group", tpgresource.GetResourceNameFromSelfLink(d.Get("network_endpoint_group").(string))); err != nil { return nil, fmt.Errorf("Error setting network_endpoint_group: %s", err) diff --git a/mmv1/templates/terraform/encoders/compute_network_endpoints.go.tmpl b/mmv1/templates/terraform/encoders/compute_network_endpoints.go.tmpl index b251e3129703..6f7c098c903e 100644 --- a/mmv1/templates/terraform/encoders/compute_network_endpoints.go.tmpl +++ b/mmv1/templates/terraform/encoders/compute_network_endpoints.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only. if err := d.Set("network_endpoint_group", tpgresource.GetResourceNameFromSelfLink(d.Get("network_endpoint_group").(string))); err != nil { return nil, fmt.Errorf("Error setting network_endpoint_group: %s", err) diff --git a/mmv1/templates/terraform/encoders/compute_per_instance_config.go.tmpl b/mmv1/templates/terraform/encoders/compute_per_instance_config.go.tmpl index 6daa41778f8a..03816a6bf6af 100644 --- a/mmv1/templates/terraform/encoders/compute_per_instance_config.go.tmpl +++ b/mmv1/templates/terraform/encoders/compute_per_instance_config.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} wrappedReq := map[string]interface{}{ "instances": []interface{}{obj}, } diff --git a/mmv1/templates/terraform/encoders/compute_region_network_endpoint.go.tmpl b/mmv1/templates/terraform/encoders/compute_region_network_endpoint.go.tmpl index a762ba68fccc..e6e5ada15728 100644 --- a/mmv1/templates/terraform/encoders/compute_region_network_endpoint.go.tmpl +++ b/mmv1/templates/terraform/encoders/compute_region_network_endpoint.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only. if err := d.Set("region_network_endpoint_group", tpgresource.GetResourceNameFromSelfLink(d.Get("region_network_endpoint_group").(string))); err != nil { return nil, fmt.Errorf("Error setting region_network_endpoint_group: %s", err) diff --git a/mmv1/templates/terraform/encoders/containeranalysis_attestation_field_name.go.tmpl b/mmv1/templates/terraform/encoders/containeranalysis_attestation_field_name.go.tmpl index 90cd7954858e..73cc6d34a7d7 100644 --- a/mmv1/templates/terraform/encoders/containeranalysis_attestation_field_name.go.tmpl +++ b/mmv1/templates/terraform/encoders/containeranalysis_attestation_field_name.go.tmpl @@ -1,23 +1,21 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> -<% if version == 'ga' -%> +{{/* + 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. +*/ -}} +{{- if eq $.TargetVersionName "ga" -}} // Field was renamed in GA API obj["attestation"] = obj["attestationAuthority"] delete(obj, "attestationAuthority") -<% else -%> +{{- else -}} // encoder logic only in GA provider -<% end -%> +{{- end }} return obj, nil diff --git a/mmv1/templates/terraform/encoders/containeranalysis_occurrence.go.tmpl b/mmv1/templates/terraform/encoders/containeranalysis_occurrence.go.tmpl index 5697d9c8fa66..738f9a5f4cfe 100644 --- a/mmv1/templates/terraform/encoders/containeranalysis_occurrence.go.tmpl +++ b/mmv1/templates/terraform/encoders/containeranalysis_occurrence.go.tmpl @@ -1,18 +1,16 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> -<% unless version == 'ga' -%> +{{/* + 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. +*/ -}} +{{- if ne $.TargetVersionName "ga" -}} // Resource object was flattened in GA API if resourceuri, ok := obj["resourceUri"]; ok { obj["resource"] = map[string]interface{}{ @@ -36,8 +34,8 @@ if v, ok := obj["attestation"]; ok && v != nil { }, } } -<% else -%> +{{- else -}} // encoder logic only in non-GA versions -<% end -%> +{{- end }} return obj, nil diff --git a/mmv1/templates/terraform/encoders/datastream_stream.go.tmpl b/mmv1/templates/terraform/encoders/datastream_stream.go.tmpl index beeb16c84801..ac0b53608cb7 100644 --- a/mmv1/templates/terraform/encoders/datastream_stream.go.tmpl +++ b/mmv1/templates/terraform/encoders/datastream_stream.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} if d.HasChange("desired_state") { obj["state"] = d.Get("desired_state") } diff --git a/mmv1/templates/terraform/encoders/disk.tmpl b/mmv1/templates/terraform/encoders/disk.tmpl index ec80bb4a000a..51901dcbf237 100644 --- a/mmv1/templates/terraform/encoders/disk.tmpl +++ b/mmv1/templates/terraform/encoders/disk.tmpl @@ -10,7 +10,7 @@ if err != nil { return nil, err } -<% if object.name == 'Disk' -%> +{{ if eq $.Name "Disk" -}} if v, ok := d.GetOk("type"); ok { log.Printf("[DEBUG] Loading disk type: %s", v.(string)) diskType, err := readDiskType(config, d, v.(string)) @@ -22,7 +22,7 @@ if v, ok := d.GetOk("type"); ok { obj["type"] = diskType.RelativeLink() } -<% elsif object.name == 'RegionDisk' -%> +{{- else if eq $.Name "RegionDisk" }} if v, ok := d.GetOk("type"); ok { log.Printf("[DEBUG] Loading disk type: %s", v.(string)) diskType, err := readRegionDiskType(config, d, v.(string)) @@ -34,9 +34,9 @@ if v, ok := d.GetOk("type"); ok { obj["type"] = diskType.RelativeLink() } -<% else -%> - raise 'disk.erb included in non-disk type <%= object.name -%>' -<% end -%> +{{- else }} + raise 'disk.tmpl included in non-disk type {{$.Name}}' +{{- end }} if v, ok := d.GetOk("image"); ok { log.Printf("[DEBUG] Resolving image name: %s", v.(string)) diff --git a/mmv1/templates/terraform/encoders/dlp_job_trigger.go.tmpl b/mmv1/templates/terraform/encoders/dlp_job_trigger.go.tmpl index 6edebd5621e3..f1fbc96879a1 100644 --- a/mmv1/templates/terraform/encoders/dlp_job_trigger.go.tmpl +++ b/mmv1/templates/terraform/encoders/dlp_job_trigger.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) - newObj["<%= object.name.camelize(:lower) -%>"] = obj + newObj["{{camelize $.Name "lower"}}"] = obj triggerIdProp, ok := d.GetOk("trigger_id") if ok && triggerIdProp != nil { newObj["triggerId"] = triggerIdProp diff --git a/mmv1/templates/terraform/encoders/dlp_stored_info_type.go.tmpl b/mmv1/templates/terraform/encoders/dlp_stored_info_type.go.tmpl index 03d85bbd04ce..69e3e192cd60 100644 --- a/mmv1/templates/terraform/encoders/dlp_stored_info_type.go.tmpl +++ b/mmv1/templates/terraform/encoders/dlp_stored_info_type.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) newObj["config"] = obj storedInfoTypeIdProp, ok := d.GetOk("stored_info_type_id") diff --git a/mmv1/templates/terraform/encoders/go/access_level_never_send_parent.go.tmpl b/mmv1/templates/terraform/encoders/go/access_level_never_send_parent.go.tmpl deleted file mode 100644 index 5d980ea2427f..000000000000 --- a/mmv1/templates/terraform/encoders/go/access_level_never_send_parent.go.tmpl +++ /dev/null @@ -1,14 +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. -*/ -}} -delete(obj, "parent") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/active_directory_domain_trust.go.tmpl b/mmv1/templates/terraform/encoders/go/active_directory_domain_trust.go.tmpl deleted file mode 100644 index 38872710d8e3..000000000000 --- a/mmv1/templates/terraform/encoders/go/active_directory_domain_trust.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -wrappedReq := map[string]interface{}{ - "trust": obj, -} -return wrappedReq, nil diff --git a/mmv1/templates/terraform/encoders/go/alloydb_backup.tmpl b/mmv1/templates/terraform/encoders/go/alloydb_backup.tmpl deleted file mode 100644 index 9152c151078f..000000000000 --- a/mmv1/templates/terraform/encoders/go/alloydb_backup.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -// The only other available type is AUTOMATED which cannot be set manually -obj["type"] = "ON_DEMAND" -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/api_config.go.tmpl b/mmv1/templates/terraform/encoders/go/api_config.go.tmpl deleted file mode 100644 index c23df7b7a721..000000000000 --- a/mmv1/templates/terraform/encoders/go/api_config.go.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -var apiConfigId string -if v, ok := d.GetOk("api_config_id"); ok { - apiConfigId = v.(string) -} else if v, ok := d.GetOk("api_config_id_prefix"); ok { - apiConfigId = id.PrefixedUniqueId(v.(string)) -} else { - apiConfigId = id.UniqueId() -} - -if err := d.Set("api_config_id", apiConfigId); err != nil { - return nil, fmt.Errorf("Error setting api_config_id: %s", err) -} -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/apigee_organization.go.tmpl b/mmv1/templates/terraform/encoders/go/apigee_organization.go.tmpl deleted file mode 100644 index 03c99cada236..000000000000 --- a/mmv1/templates/terraform/encoders/go/apigee_organization.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -obj["name"] = d.Get("project_id").(string) -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/backend_service.go.tmpl b/mmv1/templates/terraform/encoders/go/backend_service.go.tmpl deleted file mode 100644 index f92c155ea246..000000000000 --- a/mmv1/templates/terraform/encoders/go/backend_service.go.tmpl +++ /dev/null @@ -1,67 +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. -*/ -}} -backendsRaw, ok := obj["backends"] -if !ok { - return obj, nil -} -backends := backendsRaw.([]interface{}) -for _, backendRaw := range backends { - backend := backendRaw.(map[string]interface{}) - - if isNegBackend(backend) { - // Remove `max_utilization` from any backend that belongs to an NEG. This field - // has a default value and causes API validation errors - backend["maxUtilization"] = nil - } -} - -// This custom encoding helps prevent sending 0 for clientTtl, defaultTtl and -// maxTtl in API calls to update these values when unset in the provider -// (doing so results in an API level error) -c, cdnPolicyOk := d.GetOk("cdn_policy") - -// Only apply during updates -if !cdnPolicyOk || obj["cdnPolicy"] == nil { - return obj, nil -} - -currentCdnPolicies := c.([]interface{}) - -// state does not contain cdnPolicy, so we can return early here as well -if len(currentCdnPolicies) == 0 { - return obj, nil -} - -futureCdnPolicy := obj["cdnPolicy"].(map[string]interface{}) -currentCdnPolicy := currentCdnPolicies[0].(map[string]interface{}) - -cacheMode, ok := futureCdnPolicy["cache_mode"].(string) -// Fallback to state if doesn't exist in object -if !ok { - cacheMode = currentCdnPolicy["cache_mode"].(string) -} - -switch cacheMode { -case "USE_ORIGIN_HEADERS": - if _, ok := futureCdnPolicy["clientTtl"]; ok { - delete(futureCdnPolicy, "clientTtl") - } - if _, ok := futureCdnPolicy["defaultTtl"]; ok { - delete(futureCdnPolicy, "defaultTtl") - } - if _, ok := futureCdnPolicy["maxTtl"]; ok { - delete(futureCdnPolicy, "maxTtl") - } -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/bigquery_connection.go.tmpl b/mmv1/templates/terraform/encoders/go/bigquery_connection.go.tmpl deleted file mode 100644 index 13bb5b3f7cff..000000000000 --- a/mmv1/templates/terraform/encoders/go/bigquery_connection.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ - // connection_id is needed to qualify the URL but cannot be sent in the body - delete(obj, "connection_id") - return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/bigquery_data_transfer.go.tmpl b/mmv1/templates/terraform/encoders/go/bigquery_data_transfer.go.tmpl deleted file mode 100644 index 631b88f55ff6..000000000000 --- a/mmv1/templates/terraform/encoders/go/bigquery_data_transfer.go.tmpl +++ /dev/null @@ -1,45 +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. -*/ -}} -paramMap, ok := obj["params"] -if !ok { - paramMap = make(map[string]string) -} - -params := map[string]interface{}{} - -for k, v := range paramMap.(map[string]string) { - var value interface{} - if err := json.Unmarshal([]byte(v), &value); err != nil { - // If the value is a string, don't convert it to anything. - params[k] = v - } else { - switch value.(type) { - case float64: - // If the value is a number, keep the string representation. - params[k] = v - default: - // If the value is another JSON type, keep the unmarshalled type as is. - params[k] = value - } - } -} - -for _, sp := range sensitiveParams { - if auth, _ := d.GetOkExists("sensitive_params.0." + sp); auth != "" { - params[sp] = auth.(string) - } -} - -obj["params"] = params - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/bigquery_job.go.tmpl b/mmv1/templates/terraform/encoders/go/bigquery_job.go.tmpl deleted file mode 100644 index df0560b27ab5..000000000000 --- a/mmv1/templates/terraform/encoders/go/bigquery_job.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -project, err := tpgresource.GetProject(d, meta.(*transport_tpg.Config)) -if err != nil { - return nil, err -} -obj["jobReference"].(map[string]interface{})["project"] = project -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/bigtable_app_profile.go.tmpl b/mmv1/templates/terraform/encoders/go/bigtable_app_profile.go.tmpl deleted file mode 100644 index 848352f99c92..000000000000 --- a/mmv1/templates/terraform/encoders/go/bigtable_app_profile.go.tmpl +++ /dev/null @@ -1,20 +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. -*/ -}} -{{/* Because instance is a URL param only, it does not get expanded and - the URL is constructed from ResourceData. Set it in - state and use a encoder instead of a field expander */ -}} -// Instance is a URL parameter only, so replace self-link/path with resource name only. -if err := d.Set("instance", tpgresource.GetResourceNameFromSelfLink(d.Get("instance").(string))); err != nil { - return nil, fmt.Errorf("Error setting instance: %s", err) -} -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/billing_project_info.go.tmpl b/mmv1/templates/terraform/encoders/go/billing_project_info.go.tmpl deleted file mode 100644 index 1928c246a990..000000000000 --- a/mmv1/templates/terraform/encoders/go/billing_project_info.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -ba := d.Get("billing_account").(string) -if ba == "" { - obj["billingAccountName"] = "" -} else { - obj["billingAccountName"] = "billingAccounts/" + ba -} -delete(obj, "billing_account") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/cloud_asset_feed.go.tmpl b/mmv1/templates/terraform/encoders/go/cloud_asset_feed.go.tmpl deleted file mode 100644 index f18150458cb5..000000000000 --- a/mmv1/templates/terraform/encoders/go/cloud_asset_feed.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -// Remove the "folders/" prefix from the folder ID -if folder, ok := d.GetOkExists("folder"); ok { - if err := d.Set("folder_id", strings.TrimPrefix(folder.(string), "folders/")); err != nil { - return nil, fmt.Errorf("Error setting folder_id: %s", err) - } -} -// The feed object must be under the "feed" attribute on the request. -newObj := make(map[string]interface{}) -newObj["feed"] = obj -return newObj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/cloud_run_domain_mapping.go.tmpl b/mmv1/templates/terraform/encoders/go/cloud_run_domain_mapping.go.tmpl deleted file mode 100644 index 151918f12fdb..000000000000 --- a/mmv1/templates/terraform/encoders/go/cloud_run_domain_mapping.go.tmpl +++ /dev/null @@ -1,20 +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 := d.Get("name").(string) -metadata := obj["metadata"].(map[string]interface{}) -metadata["name"] = name - -// The only acceptable version/kind right now -obj["apiVersion"] = "domains.cloudrun.com/v1" -obj["kind"] = "{{$.Name}}" -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/cloud_run_service.go.tmpl b/mmv1/templates/terraform/encoders/go/cloud_run_service.go.tmpl deleted file mode 100644 index 8b7acfe865b4..000000000000 --- a/mmv1/templates/terraform/encoders/go/cloud_run_service.go.tmpl +++ /dev/null @@ -1,23 +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 := d.Get("name").(string) -if obj["metadata"] == nil { - obj["metadata"] = make(map[string]interface{}) -} -metadata := obj["metadata"].(map[string]interface{}) -metadata["name"] = name - -// The only acceptable version/kind right now -obj["apiVersion"] = "serving.knative.dev/v1" -obj["kind"] = "Service" -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/cloud_scheduler.go.tmpl b/mmv1/templates/terraform/encoders/go/cloud_scheduler.go.tmpl deleted file mode 100644 index 8a9b4e7e9da9..000000000000 --- a/mmv1/templates/terraform/encoders/go/cloud_scheduler.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -delete(obj, "paused") // Field doesn't exist in API -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/cloudbuild_bitbucketserver_config.go.tmpl b/mmv1/templates/terraform/encoders/go/cloudbuild_bitbucketserver_config.go.tmpl deleted file mode 100644 index 5b34ac221e68..000000000000 --- a/mmv1/templates/terraform/encoders/go/cloudbuild_bitbucketserver_config.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -// connectedRepositories is needed for batchCreate on the config after creation. -delete(obj, "connectedRepositories") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/cloudbuildv2_repository.go.tmpl b/mmv1/templates/terraform/encoders/go/cloudbuildv2_repository.go.tmpl deleted file mode 100644 index baf759264b04..000000000000 --- a/mmv1/templates/terraform/encoders/go/cloudbuildv2_repository.go.tmpl +++ /dev/null @@ -1,35 +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) -// Extract any empty fields from the parent_connection field. -project, err := tpgresource.GetProject(d, config) -if err != nil { - return nil, fmt.Errorf("error getting project: %s", err) -} -parent_connection := d.Get("parent_connection").(string) -project, err = tpgresource.ExtractFieldByPattern("project", project, parent_connection, "projects/([a-z0-9A-Z-]*)/locations/.*") -if err != nil { - return nil, fmt.Errorf("error extracting project field: %s", err) -} -location := d.Get("location").(string) -location, err = tpgresource.ExtractFieldByPattern("location", location, parent_connection, "projects/[a-z0-9A-Z-]*/locations/([a-z0-9-]*)/connections/.*") -if err != nil { - return nil, fmt.Errorf("error extracting location field: %s", err) -} -// Set project to the extracted value. -d.Set("project", project) -// Set all the other fields to their short forms before forming url and setting ID. -name := d.Get("name").(string) -d.Set("location", location) -d.Set("name", name) -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/clouddomains_registration.go.tmpl b/mmv1/templates/terraform/encoders/go/clouddomains_registration.go.tmpl deleted file mode 100644 index 5d2fadaa53df..000000000000 --- a/mmv1/templates/terraform/encoders/go/clouddomains_registration.go.tmpl +++ /dev/null @@ -1,27 +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. -*/ -}} -// Request body is registration object with additional fields -// See https://cloud.google.com/domains/docs/reference/rest/v1beta1/projects.locations.registrations/register - -newObj := make(map[string]interface{}) - -newObj["domainNotices"] = obj["domainNotices"] -delete(obj, "domainNotices") -newObj["contactNotices"] = obj["contactNotices"] -delete(obj, "contactNotices") -newObj["yearlyPrice"] = obj["yearlyPrice"] -delete(obj, "yearlyPrice") - -newObj["registration"] = obj - -return newObj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/cloudfunctions2_runtime_update_policy.go.tmpl b/mmv1/templates/terraform/encoders/go/cloudfunctions2_runtime_update_policy.go.tmpl deleted file mode 100644 index db4ef3e273ee..000000000000 --- a/mmv1/templates/terraform/encoders/go/cloudfunctions2_runtime_update_policy.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -if obj == nil || obj["buildConfig"] == nil { - return obj, nil -} - -build_config := obj["buildConfig"].(map[string]interface{}) - -// Automatic Update policy is the default from API, unset it if the data -// contains the on-deploy policy. -if build_config["onDeployUpdatePolicy"] != nil { - delete(build_config, "automaticUpdatePolicy") -} - -obj["buildConfig"] = build_config - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_backend_bucket.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_backend_bucket.go.tmpl deleted file mode 100644 index 57e75f87adcd..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_backend_bucket.go.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -// This custom encoder helps prevent sending 0 for clientTtl, defaultTtl and -// maxTtl in API calls to update these values when unset in the provider -// (doing so results in an API level error) -c, cdnPolicyOk := d.GetOk("cdn_policy") - -// Only apply during updates -if !cdnPolicyOk || obj["cdnPolicy"] == nil { - return obj, nil -} - -currentCdnPolicies := c.([]interface{}) - -// state does not contain cdnPolicy, so we can return early here as well -if len(currentCdnPolicies) == 0 { - return obj, nil -} - -futureCdnPolicy := obj["cdnPolicy"].(map[string]interface{}) -currentCdnPolicy := currentCdnPolicies[0].(map[string]interface{}) - -cacheMode, ok := futureCdnPolicy["cache_mode"].(string) -// Fallback to state if doesn't exist in object -if !ok { - cacheMode = currentCdnPolicy["cache_mode"].(string) -} - -switch cacheMode { -case "USE_ORIGIN_HEADERS": - if _, ok := futureCdnPolicy["clientTtl"]; ok { - delete(futureCdnPolicy, "clientTtl") - } - if _, ok := futureCdnPolicy["defaultTtl"]; ok { - delete(futureCdnPolicy, "defaultTtl") - } - if _, ok := futureCdnPolicy["maxTtl"]; ok { - delete(futureCdnPolicy, "maxTtl") - } -case "FORCE_CACHE_ALL": - if _, ok := futureCdnPolicy["maxTtl"]; ok { - delete(futureCdnPolicy, "maxTtl") - } -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_disk_resource_policies_attachment.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_disk_resource_policies_attachment.go.tmpl deleted file mode 100644 index 3f9adbc0e159..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_disk_resource_policies_attachment.go.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -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 must be non-empty - set in resource or at provider-level") -} - -// resourcePolicies are referred to by region but affixed to zonal disks. -// We construct the regional name from the zone: -// projects/{project}/regions/{region}/resourcePolicies/{resourceId} -region := tpgresource.GetRegionFromZone(zone) -if region == "" { - return nil, fmt.Errorf("invalid zone %q, unable to infer region from zone", zone) -} - -obj["resourcePolicies"] = []interface{}{fmt.Sprintf("projects/%s/regions/%s/resourcePolicies/%s", project, region, obj["name"])} -delete(obj, "name") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_global_network_endpoint.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_global_network_endpoint.go.tmpl deleted file mode 100644 index 7e295d87c61a..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_global_network_endpoint.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only. -if err := d.Set("global_network_endpoint_group", tpgresource.GetResourceNameFromSelfLink(d.Get("global_network_endpoint_group").(string))); err != nil { - return nil, fmt.Errorf("Error setting global_network_endpoint_group: %s", err) -} - -wrappedReq := map[string]interface{}{ - "networkEndpoints": []interface{}{obj}, -} -return wrappedReq, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_instance_group_membership.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_instance_group_membership.go.tmpl deleted file mode 100644 index b6a74238b067..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_instance_group_membership.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// Instance Group is a URL parameter only, so replace self-link/path with resource name only. -if err := d.Set("instance_group", tpgresource.GetResourceNameFromSelfLink(d.Get("instance_group").(string))); err != nil { - return nil, fmt.Errorf("Error setting instance_group: %s", err) -} - -wrappedReq := map[string]interface{}{ - "instances": []interface{}{obj}, -} -return wrappedReq, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_network.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_network.go.tmpl deleted file mode 100644 index 084107f2772e..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_network.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -delete(obj, "numeric_id") // Field doesn't exist in the API -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_network_endpoint.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_network_endpoint.go.tmpl deleted file mode 100644 index 011148ae7a10..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_network_endpoint.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only. -if err := d.Set("network_endpoint_group", tpgresource.GetResourceNameFromSelfLink(d.Get("network_endpoint_group").(string))); err != nil { - return nil, fmt.Errorf("Error setting network_endpoint_group: %s", err) -} - -wrappedReq := map[string]interface{}{ - "networkEndpoints": []interface{}{obj}, -} -return wrappedReq, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_network_endpoints.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_network_endpoints.go.tmpl deleted file mode 100644 index 6f7c098c903e..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_network_endpoints.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -// Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only. -if err := d.Set("network_endpoint_group", tpgresource.GetResourceNameFromSelfLink(d.Get("network_endpoint_group").(string))); err != nil { - return nil, fmt.Errorf("Error setting network_endpoint_group: %s", err) -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_per_instance_config.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_per_instance_config.go.tmpl deleted file mode 100644 index 03816a6bf6af..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_per_instance_config.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -wrappedReq := map[string]interface{}{ - "instances": []interface{}{obj}, -} -return wrappedReq, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_region_disk_resource_policies_attachment.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_region_disk_resource_policies_attachment.go.tmpl deleted file mode 100644 index d1dce38c2f08..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_region_disk_resource_policies_attachment.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -config := meta.(*transport_tpg.Config) -project, err := tpgresource.GetProject(d, config) -if err != nil { - return nil, err -} - -region, err := tpgresource.GetRegion(d, config) -if err != nil { - return nil, err -} -if region == "" { - return nil, fmt.Errorf("region must be non-empty - set in resource or at provider-level") -} - -obj["resourcePolicies"] = []interface{}{fmt.Sprintf("projects/%s/regions/%s/resourcePolicies/%s", project, region, obj["name"])} -delete(obj, "name") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_region_network_endpoint.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_region_network_endpoint.go.tmpl deleted file mode 100644 index e6e5ada15728..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_region_network_endpoint.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// Network Endpoint Group is a URL parameter only, so replace self-link/path with resource name only. -if err := d.Set("region_network_endpoint_group", tpgresource.GetResourceNameFromSelfLink(d.Get("region_network_endpoint_group").(string))); err != nil { - return nil, fmt.Errorf("Error setting region_network_endpoint_group: %s", err) -} - -wrappedReq := map[string]interface{}{ - "networkEndpoints": []interface{}{obj}, -} -return wrappedReq, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_region_target_https_proxy.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_region_target_https_proxy.go.tmpl deleted file mode 100644 index bcf2aa79977f..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_region_target_https_proxy.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ - -if _, ok := obj["certificateManagerCertificates"]; ok { - // The field certificateManagerCertificates should not be included in the API request, and it should be renamed to `sslCertificates` - // The API does not allow using both certificate manager certificates and sslCertificates. If that changes - // in the future, the encoder logic should change accordingly because this will mean that both fields are no longer mutual exclusive. - log.Printf("[DEBUG] converting the field CertificateManagerCertificates to sslCertificates before sending the request") - obj["sslCertificates"] = obj["certificateManagerCertificates"] - delete(obj, "certificateManagerCertificates") -} - -// Send null if serverTlsPolicy is not set. Without this, Terraform would not send any value for `serverTlsPolicy` -// in the "PATCH" payload so if you were to remove a server TLS policy from a target HTTPS proxy, it would NOT remove -// the association. -if _, ok := obj["serverTlsPolicy"]; !ok { - obj["serverTlsPolicy"] = nil -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/compute_target_https_proxy.go.tmpl b/mmv1/templates/terraform/encoders/go/compute_target_https_proxy.go.tmpl deleted file mode 100644 index bcf2aa79977f..000000000000 --- a/mmv1/templates/terraform/encoders/go/compute_target_https_proxy.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ - -if _, ok := obj["certificateManagerCertificates"]; ok { - // The field certificateManagerCertificates should not be included in the API request, and it should be renamed to `sslCertificates` - // The API does not allow using both certificate manager certificates and sslCertificates. If that changes - // in the future, the encoder logic should change accordingly because this will mean that both fields are no longer mutual exclusive. - log.Printf("[DEBUG] converting the field CertificateManagerCertificates to sslCertificates before sending the request") - obj["sslCertificates"] = obj["certificateManagerCertificates"] - delete(obj, "certificateManagerCertificates") -} - -// Send null if serverTlsPolicy is not set. Without this, Terraform would not send any value for `serverTlsPolicy` -// in the "PATCH" payload so if you were to remove a server TLS policy from a target HTTPS proxy, it would NOT remove -// the association. -if _, ok := obj["serverTlsPolicy"]; !ok { - obj["serverTlsPolicy"] = nil -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/containeranalysis_attestation_field_name.go.tmpl b/mmv1/templates/terraform/encoders/go/containeranalysis_attestation_field_name.go.tmpl deleted file mode 100644 index 73cc6d34a7d7..000000000000 --- a/mmv1/templates/terraform/encoders/go/containeranalysis_attestation_field_name.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -{{- if eq $.TargetVersionName "ga" -}} -// Field was renamed in GA API -obj["attestation"] = obj["attestationAuthority"] -delete(obj, "attestationAuthority") -{{- else -}} -// encoder logic only in GA provider -{{- end }} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/containeranalysis_occurrence.go.tmpl b/mmv1/templates/terraform/encoders/go/containeranalysis_occurrence.go.tmpl deleted file mode 100644 index 738f9a5f4cfe..000000000000 --- a/mmv1/templates/terraform/encoders/go/containeranalysis_occurrence.go.tmpl +++ /dev/null @@ -1,41 +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. -*/ -}} -{{- if ne $.TargetVersionName "ga" -}} -// Resource object was flattened in GA API -if resourceuri, ok := obj["resourceUri"]; ok { - obj["resource"] = map[string]interface{}{ - "uri": resourceuri, - } - delete(obj, "resourceUri") -} - - -// Beta `attestation.genericSignedAttestation` was flattened to just -// `attestation` (no contentType) in GA -if v, ok := obj["attestation"]; ok && v != nil { - gaAtt := v.(map[string]interface{}) - obj["attestation"] = map[string]interface{}{ - "attestation": map[string]interface{}{ - "genericSignedAttestation": map[string]interface{}{ - "contentType": "SIMPLE_SIGNING_JSON", - "serializedPayload": gaAtt["serializedPayload"], - "signatures": gaAtt["signatures"], - }, - }, - } -} -{{- else -}} -// encoder logic only in non-GA versions -{{- end }} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/data_catalog_tag.go.tmpl b/mmv1/templates/terraform/encoders/go/data_catalog_tag.go.tmpl deleted file mode 100644 index 1d99fcf41f9d..000000000000 --- a/mmv1/templates/terraform/encoders/go/data_catalog_tag.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ - if obj["fields"] != nil { - // IsEmptyValue() does not work for a boolean as it shows - // false when it is 'empty'. Filter boolValue here based on - // the rule api does not take more than 1 'value' - fields := obj["fields"].(map[string]interface{}) - for _, elements := range fields { - values := elements.(map[string]interface{}) - if len(values) > 1 { - for val := range values { - if val == "boolValue" { - delete(values, "boolValue") - } - } - } - } - } - return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/datastream_stream.go.tmpl b/mmv1/templates/terraform/encoders/go/datastream_stream.go.tmpl deleted file mode 100644 index ac0b53608cb7..000000000000 --- a/mmv1/templates/terraform/encoders/go/datastream_stream.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -if d.HasChange("desired_state") { - obj["state"] = d.Get("desired_state") -} -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/discovery_engine_chat_engine_hardcode_solution_type.go.tmpl b/mmv1/templates/terraform/encoders/go/discovery_engine_chat_engine_hardcode_solution_type.go.tmpl deleted file mode 100644 index 244741f478bc..000000000000 --- a/mmv1/templates/terraform/encoders/go/discovery_engine_chat_engine_hardcode_solution_type.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -// hard code solutionType to "SOLUTION_TYPE_CHAT" for chat engine resource -obj["solutionType"] = "SOLUTION_TYPE_CHAT" -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/discovery_engine_search_engine_hardcode_solution_type.go.tmpl b/mmv1/templates/terraform/encoders/go/discovery_engine_search_engine_hardcode_solution_type.go.tmpl deleted file mode 100644 index fb2cf72a32af..000000000000 --- a/mmv1/templates/terraform/encoders/go/discovery_engine_search_engine_hardcode_solution_type.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -// hard code solutionType to "SOLUTION_TYPE_SEARCH" for search engine resource -obj["solutionType"] = "SOLUTION_TYPE_SEARCH" -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/disk.tmpl b/mmv1/templates/terraform/encoders/go/disk.tmpl deleted file mode 100644 index 51901dcbf237..000000000000 --- a/mmv1/templates/terraform/encoders/go/disk.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -config := meta.(*transport_tpg.Config) - -project, err := tpgresource.GetProject(d, config) -if err != nil { - return nil, err -} - -userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) -if err != nil { - return nil, err -} - -{{ if eq $.Name "Disk" -}} -if v, ok := d.GetOk("type"); ok { - log.Printf("[DEBUG] Loading disk type: %s", v.(string)) - diskType, err := readDiskType(config, d, v.(string)) - if err != nil { - return nil, fmt.Errorf( - "Error loading disk type '%s': %s", - v.(string), err) - } - - obj["type"] = diskType.RelativeLink() -} -{{- else if eq $.Name "RegionDisk" }} -if v, ok := d.GetOk("type"); ok { - log.Printf("[DEBUG] Loading disk type: %s", v.(string)) - diskType, err := readRegionDiskType(config, d, v.(string)) - if err != nil { - return nil, fmt.Errorf( - "Error loading disk type '%s': %s", - v.(string), err) - } - - obj["type"] = diskType.RelativeLink() -} -{{- else }} - raise 'disk.tmpl included in non-disk type {{$.Name}}' -{{- end }} - -if v, ok := d.GetOk("image"); ok { - log.Printf("[DEBUG] Resolving image name: %s", v.(string)) - imageUrl, err := ResolveImage(config, project, v.(string), userAgent) - if err != nil { - return nil, fmt.Errorf( - "Error resolving image name '%s': %s", - v.(string), err) - } - - obj["sourceImage"] = imageUrl - log.Printf("[DEBUG] Image name resolved to: %s", imageUrl) -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/dlp_job_trigger.go.tmpl b/mmv1/templates/terraform/encoders/go/dlp_job_trigger.go.tmpl deleted file mode 100644 index f1fbc96879a1..000000000000 --- a/mmv1/templates/terraform/encoders/go/dlp_job_trigger.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["{{camelize $.Name "lower"}}"] = obj - triggerIdProp, ok := d.GetOk("trigger_id") - if ok && triggerIdProp != nil { - newObj["triggerId"] = triggerIdProp - } - return newObj, nil diff --git a/mmv1/templates/terraform/encoders/go/dlp_stored_info_type.go.tmpl b/mmv1/templates/terraform/encoders/go/dlp_stored_info_type.go.tmpl deleted file mode 100644 index 69e3e192cd60..000000000000 --- a/mmv1/templates/terraform/encoders/go/dlp_stored_info_type.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["config"] = obj - storedInfoTypeIdProp, ok := d.GetOk("stored_info_type_id") - if ok && storedInfoTypeIdProp != nil { - newObj["storedInfoTypeId"] = storedInfoTypeIdProp - } - return newObj, nil diff --git a/mmv1/templates/terraform/encoders/go/firestore_field.go.tmpl b/mmv1/templates/terraform/encoders/go/firestore_field.go.tmpl deleted file mode 100644 index 96383af29f6e..000000000000 --- a/mmv1/templates/terraform/encoders/go/firestore_field.go.tmpl +++ /dev/null @@ -1,9 +0,0 @@ - -// We've added project / database / collection / field as split fields of the name, but -// the API doesn't expect them. Make sure we remove them from any requests. - -delete(obj, "project") -delete(obj, "database") -delete(obj, "collection") -delete(obj, "field") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/flex_app_version.go.tmpl b/mmv1/templates/terraform/encoders/go/flex_app_version.go.tmpl deleted file mode 100644 index ff55a1d59361..000000000000 --- a/mmv1/templates/terraform/encoders/go/flex_app_version.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -obj["env"] = "flex" -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/health_check_type.tmpl b/mmv1/templates/terraform/encoders/go/health_check_type.tmpl deleted file mode 100644 index e5d7cdae36b6..000000000000 --- a/mmv1/templates/terraform/encoders/go/health_check_type.tmpl +++ /dev/null @@ -1,99 +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. -*/ -}} -if _, ok := d.GetOk("http_health_check"); ok { - hc := d.Get("http_health_check").([]interface{})[0] - ps := hc.(map[string]interface{})["port_specification"] - pn := hc.(map[string]interface{})["port_name"] - - if ps == "USE_FIXED_PORT" || (ps == "" && pn == "") { - m := obj["httpHealthCheck"].(map[string]interface{}) - if m["port"] == nil { - m["port"] = 80 - } - } - obj["type"] = "HTTP" - return obj, nil -} -if _, ok := d.GetOk("https_health_check"); ok { - hc := d.Get("https_health_check").([]interface{})[0] - ps := hc.(map[string]interface{})["port_specification"] - pn := hc.(map[string]interface{})["port_name"] - - if ps == "USE_FIXED_PORT" || (ps == "" && pn == "") { - m := obj["httpsHealthCheck"].(map[string]interface{}) - if m["port"] == nil { - m["port"] = 443 - } - } - obj["type"] = "HTTPS" - return obj, nil -} -if _, ok := d.GetOk("http2_health_check"); ok { - hc := d.Get("http2_health_check").([]interface{})[0] - ps := hc.(map[string]interface{})["port_specification"] - pn := hc.(map[string]interface{})["port_name"] - - if ps == "USE_FIXED_PORT" || (ps == "" && pn == "") { - m := obj["http2HealthCheck"].(map[string]interface{}) - if m["port"] == nil { - m["port"] = 443 - } - } - obj["type"] = "HTTP2" - return obj, nil -} -if _, ok := d.GetOk("tcp_health_check"); ok { - hc := d.Get("tcp_health_check").([]interface{})[0] - ps := hc.(map[string]interface{})["port_specification"] - pn := hc.(map[string]interface{})["port_name"] - - if ps == "USE_FIXED_PORT" || (ps == "" && pn == "") { - m := obj["tcpHealthCheck"].(map[string]interface{}) - if m["port"] == nil { - m["port"] = 80 - } - } - obj["type"] = "TCP" - return obj, nil -} -if _, ok := d.GetOk("ssl_health_check"); ok { - hc := d.Get("ssl_health_check").([]interface{})[0] - ps := hc.(map[string]interface{})["port_specification"] - pn := hc.(map[string]interface{})["port_name"] - - if ps == "USE_FIXED_PORT" || (ps == "" && pn == "") { - m := obj["sslHealthCheck"].(map[string]interface{}) - if m["port"] == nil { - m["port"] = 443 - } - } - obj["type"] = "SSL" - return obj, nil -} - -if _, ok := d.GetOk("grpc_health_check"); ok { - hc := d.Get("grpc_health_check").([]interface{})[0] - ps := hc.(map[string]interface{})["port_specification"] - pn := hc.(map[string]interface{})["port_name"] - - if ps == "USE_FIXED_PORT" || (ps == "" && pn == "") { - m := obj["grpcHealthCheck"].(map[string]interface{}) - if m["port"] == nil { - return nil, fmt.Errorf("error in HealthCheck %s: `port` must be set for GRPC health checks`.", d.Get("name").(string)) - } - } - obj["type"] = "GRPC" - return obj, nil -} - -return nil, fmt.Errorf("error in HealthCheck %s: No health check block specified.", d.Get("name").(string)) diff --git a/mmv1/templates/terraform/encoders/go/index.go.tmpl b/mmv1/templates/terraform/encoders/go/index.go.tmpl deleted file mode 100644 index fd2d80feda0e..000000000000 --- a/mmv1/templates/terraform/encoders/go/index.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} -// We've added project / database / collection as split fields of the name, but -// the API doesn't expect them. Make sure we remove them from any requests. - -delete(obj, "project") -delete(obj, "database") -delete(obj, "collection") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/kms_crypto_key.go.tmpl b/mmv1/templates/terraform/encoders/go/kms_crypto_key.go.tmpl deleted file mode 100644 index dfb4a6af809e..000000000000 --- a/mmv1/templates/terraform/encoders/go/kms_crypto_key.go.tmpl +++ /dev/null @@ -1,32 +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. -*/ -}} - // if rotationPeriod is set, nextRotationTime must also be set. - if d.Get("rotation_period") != "" { - rotationPeriod := d.Get("rotation_period").(string) - nextRotation, err := kmsCryptoKeyNextRotation(time.Now(), rotationPeriod) - - if err != nil { - return nil, fmt.Errorf("Error setting CryptoKey rotation period: %s", err.Error()) - } - - obj["nextRotationTime"] = nextRotation - } - - // set to false if it is not true explicitly - if !(d.Get("skip_initial_version_creation").(bool)) { - if err := d.Set("skip_initial_version_creation", false); err != nil { - return nil, fmt.Errorf("Error setting skip_initial_version_creation: %s", err) - } - } - - return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/location_from_region.go.tmpl b/mmv1/templates/terraform/encoders/go/location_from_region.go.tmpl deleted file mode 100644 index 316a14641ca7..000000000000 --- a/mmv1/templates/terraform/encoders/go/location_from_region.go.tmpl +++ /dev/null @@ -1,23 +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) -if _, ok := d.GetOk("location"); !ok { - location, err := tpgresource.GetRegionFromSchema("region", "zone", d, config) - if err != nil { - return nil, fmt.Errorf("Cannot determine location: set in this resource, or set provider-level 'region' or 'zone'.") - } - if err := d.Set("location", location); err != nil { - return nil, fmt.Errorf("Error setting location: %s", err) - } -} -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/logging_linked_dataset.go.tmpl b/mmv1/templates/terraform/encoders/go/logging_linked_dataset.go.tmpl deleted file mode 100644 index 1bf305d148e2..000000000000 --- a/mmv1/templates/terraform/encoders/go/logging_linked_dataset.go.tmpl +++ /dev/null @@ -1,34 +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. -*/ -}} -// Extract any empty fields from the bucket field. -parent := d.Get("parent").(string) -bucket := d.Get("bucket").(string) -parent, err := tpgresource.ExtractFieldByPattern("parent", parent, bucket, "((projects|folders|organizations|billingAccounts)/[a-z0-9A-Z-]*)/locations/.*") -if err != nil { - return nil, fmt.Errorf("error extracting parent field: %s", err) -} -location := d.Get("location").(string) -location, err = tpgresource.ExtractFieldByPattern("location", location, bucket, "[a-zA-Z]*/[a-z0-9A-Z-]*/locations/([a-z0-9-]*)/buckets/.*") -if err != nil { - return nil, fmt.Errorf("error extracting location field: %s", err) -} -// Set parent to the extracted value. -d.Set("parent", parent) -// Set all the other fields to their short forms before forming url and setting ID. -bucket = tpgresource.GetResourceNameFromSelfLink(bucket) -name := d.Get("name").(string) -name = tpgresource.GetResourceNameFromSelfLink(name) -d.Set("location", location) -d.Set("bucket", bucket) -d.Set("name", name) -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/logging_log_view.go.tmpl b/mmv1/templates/terraform/encoders/go/logging_log_view.go.tmpl deleted file mode 100644 index 1bf305d148e2..000000000000 --- a/mmv1/templates/terraform/encoders/go/logging_log_view.go.tmpl +++ /dev/null @@ -1,34 +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. -*/ -}} -// Extract any empty fields from the bucket field. -parent := d.Get("parent").(string) -bucket := d.Get("bucket").(string) -parent, err := tpgresource.ExtractFieldByPattern("parent", parent, bucket, "((projects|folders|organizations|billingAccounts)/[a-z0-9A-Z-]*)/locations/.*") -if err != nil { - return nil, fmt.Errorf("error extracting parent field: %s", err) -} -location := d.Get("location").(string) -location, err = tpgresource.ExtractFieldByPattern("location", location, bucket, "[a-zA-Z]*/[a-z0-9A-Z-]*/locations/([a-z0-9-]*)/buckets/.*") -if err != nil { - return nil, fmt.Errorf("error extracting location field: %s", err) -} -// Set parent to the extracted value. -d.Set("parent", parent) -// Set all the other fields to their short forms before forming url and setting ID. -bucket = tpgresource.GetResourceNameFromSelfLink(bucket) -name := d.Get("name").(string) -name = tpgresource.GetResourceNameFromSelfLink(name) -d.Set("location", location) -d.Set("bucket", bucket) -d.Set("name", name) -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/memorystore_instance.go.tmpl b/mmv1/templates/terraform/encoders/go/memorystore_instance.go.tmpl deleted file mode 100644 index b6ab1daf78a5..000000000000 --- a/mmv1/templates/terraform/encoders/go/memorystore_instance.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -v, ok := d.GetOk("desired_psc_auto_connections") -if !ok { - return obj, nil // No desired connections, nothing to update -} -l := v.([]interface{}) -req := make([]interface{}, 0, len(l)) -for _, raw := range l { - if raw == nil { - continue - } - desiredConnection := raw.(map[string]interface{}) - connectionReq := make(map[string]interface{}) - - projectId := desiredConnection["project_id"] - if val := reflect.ValueOf(projectId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - connectionReq["projectId"] = projectId - } - - network := desiredConnection["network"] - if val := reflect.ValueOf(network); val.IsValid() && !tpgresource.IsEmptyValue(val) { - connectionReq["network"] = network - } - - req = append(req, connectionReq) -} -obj["pscAutoConnections"] = req -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/encoders/go/monitoring_monitored_project.go.tmpl deleted file mode 100644 index 2dbbbcafe017..000000000000 --- a/mmv1/templates/terraform/encoders/go/monitoring_monitored_project.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 := d.Get("name").(string) -log.Printf("[DEBUG] Encoded monitored project name: %s", name) -name = tpgresource.GetResourceNameFromSelfLink(name) -log.Printf("[DEBUG] Encoded monitored project resource name: %s", name) -d.Set("name", name) -metricsScope := d.Get("metrics_scope").(string) -log.Printf("[DEBUG] Encoded monitored project metricsScope: %s", metricsScope) -metricsScope = tpgresource.GetResourceNameFromSelfLink(metricsScope) -log.Printf("[DEBUG] Encoded monitored project metricsScope resource name: %s", metricsScope) -d.Set("metrics_scope", metricsScope) -obj["name"] = fmt.Sprintf("locations/global/metricsScopes/%s/projects/%s", metricsScope, name) -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/monitoring_notification_channel.go.tmpl b/mmv1/templates/terraform/encoders/go/monitoring_notification_channel.go.tmpl deleted file mode 100644 index 4a4fbc8502d3..000000000000 --- a/mmv1/templates/terraform/encoders/go/monitoring_notification_channel.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. -*/ -}} -labelmap, ok := obj["labels"] -if !ok { - labelmap = make(map[string]string) -} - -var labels map[string]string -labels = labelmap.(map[string]string) - -for _, sl := range sensitiveLabels { - if auth, _ := d.GetOkExists("sensitive_labels.0." + sl); auth != "" { - labels[sl] = auth.(string) - } -} - -obj["labels"] = labels - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/monitoring_service.go.tmpl b/mmv1/templates/terraform/encoders/go/monitoring_service.go.tmpl deleted file mode 100644 index b27fe821f566..000000000000 --- a/mmv1/templates/terraform/encoders/go/monitoring_service.go.tmpl +++ /dev/null @@ -1,22 +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. -*/ -}} -// Currently only CUSTOM service types can be created, but the -// custom identifier block does not actually have fields right now. -// Set to empty to indicate manually-created service type is CUSTOM. -if _, ok := obj["custom"]; !ok { - obj["custom"] = map[string]interface{}{} -} -// Name/Service ID is a query parameter only -delete(obj, "name") - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/monitoring_slo.go.tmpl b/mmv1/templates/terraform/encoders/go/monitoring_slo.go.tmpl deleted file mode 100644 index d135a3426c0b..000000000000 --- a/mmv1/templates/terraform/encoders/go/monitoring_slo.go.tmpl +++ /dev/null @@ -1,40 +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/Service Level Objective ID is a query parameter and cannot -// be given in data -delete(obj, "sloId") -Sli := obj["serviceLevelIndicator"].(map[string]interface{}) -if basicSli, ok := Sli["basicSli"].(map[string]interface{}); ok { - //Removing the dummy `enabled` attribute - if availability, ok := basicSli["availability"]; ok { - transAvailability := availability.(map[string]interface{}) - delete(transAvailability, "enabled") - basicSli["availability"] = transAvailability - } -} - -if windowBasedSli, ok := Sli["windowsBased"].(map[string]interface{}); ok { - if goodTotalRatioThreshold, ok := windowBasedSli["goodTotalRatioThreshold"].(map[string]interface{}); ok { - if basicSli, ok := goodTotalRatioThreshold["basicSliPerformance"].(map[string]interface{}); ok { - //Removing the dummy `enabled` attribute - if availability, ok := basicSli["availability"]; ok { - transAvailability := availability.(map[string]interface{}) - delete(transAvailability, "enabled") - basicSli["availability"] = transAvailability - } - } - } -} - -return obj, nil - diff --git a/mmv1/templates/terraform/encoders/go/network_peering_routes_config.go.tmpl b/mmv1/templates/terraform/encoders/go/network_peering_routes_config.go.tmpl deleted file mode 100644 index f52b45c6a4da..000000000000 --- a/mmv1/templates/terraform/encoders/go/network_peering_routes_config.go.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} - // Stick request in a networkPeering block as in - // https://cloud.google.com/compute/docs/reference/rest/v1/networks/updatePeering - newObj := make(map[string]interface{}) - newObj["networkPeering"] = obj - return newObj, nil diff --git a/mmv1/templates/terraform/encoders/go/no_send_name.go.tmpl b/mmv1/templates/terraform/encoders/go/no_send_name.go.tmpl deleted file mode 100644 index 8fa3b1ba6c68..000000000000 --- a/mmv1/templates/terraform/encoders/go/no_send_name.go.tmpl +++ /dev/null @@ -1,14 +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. -*/ -}} -delete(obj, "name") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/normalize_group.go.tmpl b/mmv1/templates/terraform/encoders/go/normalize_group.go.tmpl deleted file mode 100644 index 1412175a174e..000000000000 --- a/mmv1/templates/terraform/encoders/go/normalize_group.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -config := meta.(*transport_tpg.Config) -ig, err := tpgresource.ParseInstanceGroupFieldValue(d.Get("group").(string), d, config) -if err != nil { - return nil, err -} - -if err := d.Set("group", ig.Name); err != nil { - return nil, fmt.Errorf("Error setting group: %s", err) -} -if err := d.Set("zone", ig.Zone); err != nil { - return nil, fmt.Errorf("Error setting zone: %s", err) -} -if err := d.Set("project", ig.Project); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/org_policy_policy.go.tmpl b/mmv1/templates/terraform/encoders/go/org_policy_policy.go.tmpl deleted file mode 100644 index 39137b874958..000000000000 --- a/mmv1/templates/terraform/encoders/go/org_policy_policy.go.tmpl +++ /dev/null @@ -1,15 +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 := d.Get("name").(string) -d.Set("name", tpgresource.GetResourceNameFromSelfLink(name)) -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/os_config_patch_deployment.go.tmpl b/mmv1/templates/terraform/encoders/go/os_config_patch_deployment.go.tmpl deleted file mode 100644 index a5660782d606..000000000000 --- a/mmv1/templates/terraform/encoders/go/os_config_patch_deployment.go.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -if obj["recurringSchedule"] != nil { - schedule := obj["recurringSchedule"].(map[string]interface{}) - if schedule["monthly"] != nil { - obj["recurringSchedule"].(map[string]interface{})["frequency"] = "MONTHLY" - } else if schedule["weekly"] != nil { - obj["recurringSchedule"].(map[string]interface{})["frequency"] = "WEEKLY" - } else { - obj["recurringSchedule"].(map[string]interface{})["frequency"] = "DAILY" - } -} - -if obj["patchConfig"] != nil { - patchConfig := obj["patchConfig"].(map[string]interface{}) - if patchConfig["goo"] != nil { - goo := patchConfig["goo"].(map[string]interface{}) - - if goo["enabled"] == true { - delete(goo, "enabled") - patchConfig["goo"] = goo - } else { - delete(patchConfig, "goo") - } - - obj["patchConfig"] = patchConfig - } -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/pubsub_lite.tmpl b/mmv1/templates/terraform/encoders/go/pubsub_lite.tmpl deleted file mode 100644 index c7a37c217324..000000000000 --- a/mmv1/templates/terraform/encoders/go/pubsub_lite.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -config := meta.(*transport_tpg.Config) - -zone, err := tpgresource.GetZone(d, config) -if err != nil { - return nil, err -} - -if zone == "" { - return nil, fmt.Errorf("zone must be non-empty - set in resource or at provider-level") -} - -// API Endpoint requires region in the URL. We infer it from the zone. - -region := tpgresource.GetRegionFromZone(zone) - -if region == "" { - return nil, fmt.Errorf("invalid zone %q, unable to infer region from zone", zone) -} - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/redis_location_id_for_fallback_zone.go.tmpl b/mmv1/templates/terraform/encoders/go/redis_location_id_for_fallback_zone.go.tmpl deleted file mode 100644 index 0c045875af48..000000000000 --- a/mmv1/templates/terraform/encoders/go/redis_location_id_for_fallback_zone.go.tmpl +++ /dev/null @@ -1,21 +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) -region, err := tpgresource.GetRegionFromSchema("region", "location_id", d, config) -if err != nil { - return nil, err -} -if err := d.Set("region", region); err != nil { - return nil, fmt.Errorf("Error setting region: %s", err) -} -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/region_backend_service.go.tmpl b/mmv1/templates/terraform/encoders/go/region_backend_service.go.tmpl deleted file mode 100644 index d1ce18c4fa21..000000000000 --- a/mmv1/templates/terraform/encoders/go/region_backend_service.go.tmpl +++ /dev/null @@ -1,62 +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. -*/ -}} -if d.Get("load_balancing_scheme").(string) == "EXTERNAL_MANAGED" || d.Get("load_balancing_scheme").(string) == "INTERNAL_MANAGED" { - return obj, nil -} - -{{ if ne $.TargetVersionName `ga` -}} -// To remove subsetting on an ILB, "NONE" must be specified. If subsetting -// isn't specified, we set the value to NONE to make this use case work. -_, ok := obj["subsetting"] -if !ok { - loadBalancingScheme, ok := obj["loadBalancingScheme"] - // External load balancing scheme does not support subsetting - if !ok || loadBalancingScheme.(string) != "EXTERNAL" { - data := map[string]interface{}{} - data["policy"] = "NONE" - obj["subsetting"] = data - } -} -{{- end }} - -backendServiceOnlyManagedApiFieldNames := []string{ - "capacityScaler", - "maxConnections", - "maxConnectionsPerInstance", - "maxConnectionsPerEndpoint", - "maxRate", - "maxRatePerInstance", - "maxRatePerEndpoint", - "maxUtilization", -} - -var backends []interface{} -if lsV := obj["backends"]; lsV != nil { - backends = lsV.([]interface{}) -} -for idx, v := range backends { - if v == nil { - continue - } - backend := v.(map[string]interface{}) - // Remove fields from backends that cannot be sent for non-managed - // backend services - for _, k := range backendServiceOnlyManagedApiFieldNames { - log.Printf("[DEBUG] Removing field %q for request for non-managed backend service %s", k, d.Get("name")) - delete(backend, k) - } - backends[idx] = backend -} - -obj["backends"] = backends -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/resource_compute_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/encoders/go/resource_compute_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index 939b22280811..000000000000 --- a/mmv1/templates/terraform/encoders/go/resource_compute_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -delete(obj, "rules") // Rules are not supported in the create API -return obj, nil - diff --git a/mmv1/templates/terraform/encoders/go/resource_compute_network_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/encoders/go/resource_compute_network_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index 939b22280811..000000000000 --- a/mmv1/templates/terraform/encoders/go/resource_compute_network_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -delete(obj, "rules") // Rules are not supported in the create API -return obj, nil - diff --git a/mmv1/templates/terraform/encoders/go/send_nil_body.go.tmpl b/mmv1/templates/terraform/encoders/go/send_nil_body.go.tmpl deleted file mode 100644 index 83c186327a3d..000000000000 --- a/mmv1/templates/terraform/encoders/go/send_nil_body.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -return nil, nil diff --git a/mmv1/templates/terraform/encoders/go/service_connection_policy.go.tmpl b/mmv1/templates/terraform/encoders/go/service_connection_policy.go.tmpl deleted file mode 100644 index 0a3866b9aca9..000000000000 --- a/mmv1/templates/terraform/encoders/go/service_connection_policy.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -obj["network"] = d.Get("network").(string) -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/spanner_database.go.tmpl b/mmv1/templates/terraform/encoders/go/spanner_database.go.tmpl deleted file mode 100644 index 78cd8aba964d..000000000000 --- a/mmv1/templates/terraform/encoders/go/spanner_database.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -obj["createStatement"] = fmt.Sprintf("CREATE DATABASE `%s`", obj["name"]) -if dialect, ok := obj["databaseDialect"]; ok && dialect == "POSTGRESQL" { - obj["createStatement"] = fmt.Sprintf("CREATE DATABASE \"%s\"", obj["name"]) -} - -// Extra DDL statements are removed from the create request and instead applied to the database in -// a post-create action, to accommodate retrictions when creating PostgreSQL-enabled databases. -// https://cloud.google.com/spanner/docs/create-manage-databases#create_a_database -log.Printf("[DEBUG] Preparing to create new Database. Any extra DDL statements will be applied to the Database in a separate API call") - -delete(obj, "name") -delete(obj, "instance") -{{/* These are added back in post-create, but do not remove for Validator. */}} -{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} -delete(obj, "versionRetentionPeriod") -delete(obj, "extraStatements") -delete(obj, "enableDropProtection") -{{- end }} -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/spanner_instance.go.tmpl b/mmv1/templates/terraform/encoders/go/spanner_instance.go.tmpl deleted file mode 100644 index fdda9c430a47..000000000000 --- a/mmv1/templates/terraform/encoders/go/spanner_instance.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -// Temp Logic to accommodate autoscaling_config, processing_units and num_nodes -if obj["processingUnits"] == nil && obj["nodeCount"] == nil && obj["autoscalingConfig"] == nil { - obj["nodeCount"] = 1 -} -newObj := make(map[string]interface{}) -newObj["instance"] = obj -if obj["name"] == nil { - if err := d.Set("name", id.PrefixedUniqueId("tfgen-spanid-")[:30]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } - newObj["instanceId"] = d.Get("name").(string) -} else { - newObj["instanceId"] = obj["name"] -} -delete(obj, "name") -return newObj, nil diff --git a/mmv1/templates/terraform/encoders/go/spanner_instance_config.go.tmpl b/mmv1/templates/terraform/encoders/go/spanner_instance_config.go.tmpl deleted file mode 100644 index b12071a83112..000000000000 --- a/mmv1/templates/terraform/encoders/go/spanner_instance_config.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -config := meta.(*transport_tpg.Config) -project, err := tpgresource.GetProject(d, config) -if err != nil { - return nil, err -} -newObj := make(map[string]interface{}) -if obj["name"] == nil { - return nil, fmt.Errorf("Error setting instance config name") -} -newObj["instanceConfigId"] = obj["name"] -obj["name"] = fmt.Sprintf("projects/%s/instanceConfigs/%s", project, obj["name"]) -baseReplicas, err := getBaseInstanceConfigReplicas(d, config, obj["baseConfig"], project, meta.(*transport_tpg.Config).UserAgent) -if err != nil { - return nil, err -} -r := obj["replicas"].([]interface{}) -obj["replicas"] = append(r, baseReplicas...) -newObj["instanceConfig"] = obj -return newObj, nil diff --git a/mmv1/templates/terraform/encoders/go/spanner_instance_update.go.tmpl b/mmv1/templates/terraform/encoders/go/spanner_instance_update.go.tmpl deleted file mode 100644 index 5c07336b6775..000000000000 --- a/mmv1/templates/terraform/encoders/go/spanner_instance_update.go.tmpl +++ /dev/null @@ -1,52 +0,0 @@ -project, err := tpgresource.GetProject(d, meta.(*transport_tpg.Config)) -if err != nil { - return nil, err -} -obj["name"] = fmt.Sprintf("projects/%s/instances/%s", project, obj["name"]) -newObj := make(map[string]interface{}) -newObj["instance"] = obj -updateMask := make([]string, 0) -if d.HasChange("edition") { - updateMask = append(updateMask, "edition") -} -if d.HasChange("num_nodes") { - updateMask = append(updateMask, "nodeCount") -} -if d.HasChange("display_name") { - updateMask = append(updateMask, "displayName") -} -if d.HasChange("labels") { - updateMask = append(updateMask, "labels") -} -if d.HasChange("processing_units") { - updateMask = append(updateMask, "processingUnits") -} -if d.HasChange("autoscaling_config") { - old, new := d.GetChange("autoscaling_config") - oldSlice := old.([]interface{}) - newSlice := new.([]interface{}) - if len(oldSlice) == 0 || len(newSlice) == 0 { - updateMask = append(updateMask, "autoscalingConfig") - } else { - if d.HasChange("autoscaling_config.0.autoscaling_limits.0.max_processing_units") { - updateMask = append(updateMask, "autoscalingConfig.autoscalingLimits.maxProcessingUnits") - } - if d.HasChange("autoscaling_config.0.autoscaling_limits.0.min_processing_units") { - updateMask = append(updateMask, "autoscalingConfig.autoscalingLimits.minProcessingUnits") - } - if d.HasChange("autoscaling_config.0.autoscaling_limits.0.max_nodes") { - updateMask = append(updateMask, "autoscalingConfig.autoscalingLimits.maxNodes") - } - if d.HasChange("autoscaling_config.0.autoscaling_limits.0.min_nodes") { - updateMask = append(updateMask, "autoscalingConfig.autoscalingLimits.minNodes") - } - if d.HasChange("autoscaling_config.0.autoscaling_targets.0.high_priority_cpu_utilization_percent") { - updateMask = append(updateMask, "autoscalingConfig.autoscalingTargets.highPriorityCpuUtilizationPercent") - } - if d.HasChange("autoscaling_config.0.autoscaling_targets.0.storage_utilization_percent") { - updateMask = append(updateMask, "autoscalingConfig.autoscalingTargets.storageUtilizationPercent") - } - } -} -newObj["fieldMask"] = strings.Join(updateMask, ",") -return newObj, nil diff --git a/mmv1/templates/terraform/encoders/go/spanner_schedule_backup.go.tmpl b/mmv1/templates/terraform/encoders/go/spanner_schedule_backup.go.tmpl deleted file mode 100644 index edf64f73b189..000000000000 --- a/mmv1/templates/terraform/encoders/go/spanner_schedule_backup.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -obj["name"] = d.Get("name").(string) -if obj["name"] == nil || obj["name"] == "" { - if err := d.Set("name", id.PrefixedUniqueId("tfgen-spanid-")[:30]); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) - } -} -config := meta.(*transport_tpg.Config) -var err error -obj["name"], err = tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/instances/{{"{{"}}instance{{"}}"}}/databases/{{"{{"}}database{{"}}"}}/backupSchedules/{{"{{"}}name{{"}}"}}") -if err != nil { - return obj, err -} -delete(obj, "instance") -delete(obj, "database") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/sql_source_representation_instance.go.tmpl b/mmv1/templates/terraform/encoders/go/sql_source_representation_instance.go.tmpl deleted file mode 100644 index 3897db08efdb..000000000000 --- a/mmv1/templates/terraform/encoders/go/sql_source_representation_instance.go.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} -opc := obj["onPremisesConfiguration"].(map[string]interface{}) -opc["hostPort"] = fmt.Sprintf("%v:%v", opc["host"], opc["port"]) -delete(opc, "host") -delete(opc, "port") -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/vertex_ai_featurestore_entitytype.go.tmpl b/mmv1/templates/terraform/encoders/go/vertex_ai_featurestore_entitytype.go.tmpl deleted file mode 100644 index 69ac8d6d84ad..000000000000 --- a/mmv1/templates/terraform/encoders/go/vertex_ai_featurestore_entitytype.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -if v, ok := d.GetOk("featurestore"); ok { - re := regexp.MustCompile("projects/(.+)/locations/(.+)/featurestores/(.+)$") - if parts := re.FindStringSubmatch(v.(string)); parts != nil { - d.Set("region", parts[2]) - } -} - -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/vertex_ai_featurestore_entitytype_feature.go.tmpl b/mmv1/templates/terraform/encoders/go/vertex_ai_featurestore_entitytype_feature.go.tmpl deleted file mode 100644 index 450c499ba865..000000000000 --- a/mmv1/templates/terraform/encoders/go/vertex_ai_featurestore_entitytype_feature.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -if v, ok := d.GetOk("entitytype"); ok { - re := regexp.MustCompile("^projects/(.+)/locations/(.+)/featurestores/(.+)/entityTypes/(.+)$") - if parts := re.FindStringSubmatch(v.(string)); parts != nil { - d.Set("region", parts[2]) - } -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/vertex_ai_index_endpoint_deployed_index.go.tmpl b/mmv1/templates/terraform/encoders/go/vertex_ai_index_endpoint_deployed_index.go.tmpl deleted file mode 100644 index 487a61305df4..000000000000 --- a/mmv1/templates/terraform/encoders/go/vertex_ai_index_endpoint_deployed_index.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -req := make(map[string]interface{}) -obj["id"] = d.Get("deployed_index_id") -delete(obj, "deployedIndexId") -delete(obj, "name") -delete(obj, "indexEndpoint") -req["deployedIndex"] = obj -return req, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/encoders/go/vpn_tunnel.go.tmpl b/mmv1/templates/terraform/encoders/go/vpn_tunnel.go.tmpl deleted file mode 100644 index 24eeb8cbbd15..000000000000 --- a/mmv1/templates/terraform/encoders/go/vpn_tunnel.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -config := meta.(*transport_tpg.Config) -f, err := tpgresource.ParseRegionalFieldValue("targetVpnGateways", d.Get("target_vpn_gateway").(string), "project", "region", "zone", d, config, true) -if err != nil { - return nil, err -} -if _, ok := d.GetOk("project"); !ok { - if err := d.Set("project", f.Project); err != nil { - return nil, fmt.Errorf("Error setting project: %s", err) - } -} -if _, ok := d.GetOk("region"); !ok { - if err := d.Set("region", f.Region); err != nil { - return nil, fmt.Errorf("Error setting region: %s", err) - } -} -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/workflow.go.tmpl b/mmv1/templates/terraform/encoders/go/workflow.go.tmpl deleted file mode 100644 index 511fde357259..000000000000 --- a/mmv1/templates/terraform/encoders/go/workflow.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -var ResName string -if v, ok := d.GetOk("name"); ok { - ResName = v.(string) -} else if v, ok := d.GetOk("name_prefix"); ok { - prefix := v.(string) - if len(prefix) > 37 { - ResName = tpgresource.ReducedPrefixedUniqueId(prefix) - } else { - ResName = id.PrefixedUniqueId(prefix) - } -} else { - ResName = id.UniqueId() -} - -if err := d.Set("name", ResName); err != nil { - return nil, fmt.Errorf("Error setting name: %s", err) -} - -return obj, nil diff --git a/mmv1/templates/terraform/encoders/go/wrap_object.go.tmpl b/mmv1/templates/terraform/encoders/go/wrap_object.go.tmpl deleted file mode 100644 index 6ac0bbe4e8ac..000000000000 --- a/mmv1/templates/terraform/encoders/go/wrap_object.go.tmpl +++ /dev/null @@ -1,15 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["{{camelize $.Name "lower"}}"] = obj - return newObj, nil diff --git a/mmv1/templates/terraform/encoders/go/wrap_object_with_deployment_resource_pool_id.go.tmpl b/mmv1/templates/terraform/encoders/go/wrap_object_with_deployment_resource_pool_id.go.tmpl deleted file mode 100644 index 1a05fac6eb84..000000000000 --- a/mmv1/templates/terraform/encoders/go/wrap_object_with_deployment_resource_pool_id.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["deploymentResourcePool"] = obj - nameProp, ok := d.GetOk("name") - if ok && nameProp != nil { - newObj["deploymentResourcePoolId"] = nameProp - } - return newObj, nil diff --git a/mmv1/templates/terraform/encoders/go/wrap_object_with_template_id.go.tmpl b/mmv1/templates/terraform/encoders/go/wrap_object_with_template_id.go.tmpl deleted file mode 100644 index 45728664d213..000000000000 --- a/mmv1/templates/terraform/encoders/go/wrap_object_with_template_id.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["{{camelize $.Name "lower"}}"] = obj - templateIdProp, ok := d.GetOk("template_id") - if ok && templateIdProp != nil { - newObj["templateId"] = templateIdProp - } - return newObj, nil diff --git a/mmv1/templates/terraform/encoders/health_check_type.tmpl b/mmv1/templates/terraform/encoders/health_check_type.tmpl index a3efcd50d134..e5d7cdae36b6 100644 --- a/mmv1/templates/terraform/encoders/health_check_type.tmpl +++ b/mmv1/templates/terraform/encoders/health_check_type.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} if _, ok := d.GetOk("http_health_check"); ok { hc := d.Get("http_health_check").([]interface{})[0] ps := hc.(map[string]interface{})["port_specification"] diff --git a/mmv1/templates/terraform/encoders/index.go.tmpl b/mmv1/templates/terraform/encoders/index.go.tmpl index 608bef7f41ef..fd2d80feda0e 100644 --- a/mmv1/templates/terraform/encoders/index.go.tmpl +++ b/mmv1/templates/terraform/encoders/index.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // We've added project / database / collection as split fields of the name, but // the API doesn't expect them. Make sure we remove them from any requests. diff --git a/mmv1/templates/terraform/encoders/kms_crypto_key.go.tmpl b/mmv1/templates/terraform/encoders/kms_crypto_key.go.tmpl index 4428efb90a86..dfb4a6af809e 100644 --- a/mmv1/templates/terraform/encoders/kms_crypto_key.go.tmpl +++ b/mmv1/templates/terraform/encoders/kms_crypto_key.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} // if rotationPeriod is set, nextRotationTime must also be set. if d.Get("rotation_period") != "" { rotationPeriod := d.Get("rotation_period").(string) diff --git a/mmv1/templates/terraform/encoders/location_from_region.go.tmpl b/mmv1/templates/terraform/encoders/location_from_region.go.tmpl index b9c4d6c7be29..316a14641ca7 100644 --- a/mmv1/templates/terraform/encoders/location_from_region.go.tmpl +++ b/mmv1/templates/terraform/encoders/location_from_region.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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) if _, ok := d.GetOk("location"); !ok { location, err := tpgresource.GetRegionFromSchema("region", "zone", d, config) diff --git a/mmv1/templates/terraform/encoders/logging_linked_dataset.go.tmpl b/mmv1/templates/terraform/encoders/logging_linked_dataset.go.tmpl index 93df72a8682a..1bf305d148e2 100644 --- a/mmv1/templates/terraform/encoders/logging_linked_dataset.go.tmpl +++ b/mmv1/templates/terraform/encoders/logging_linked_dataset.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} // Extract any empty fields from the bucket field. parent := d.Get("parent").(string) bucket := d.Get("bucket").(string) diff --git a/mmv1/templates/terraform/encoders/logging_log_view.go.tmpl b/mmv1/templates/terraform/encoders/logging_log_view.go.tmpl index 93df72a8682a..1bf305d148e2 100644 --- a/mmv1/templates/terraform/encoders/logging_log_view.go.tmpl +++ b/mmv1/templates/terraform/encoders/logging_log_view.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} // Extract any empty fields from the bucket field. parent := d.Get("parent").(string) bucket := d.Get("bucket").(string) diff --git a/mmv1/templates/terraform/encoders/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/encoders/monitoring_monitored_project.go.tmpl index 1dc444ecb132..2dbbbcafe017 100644 --- a/mmv1/templates/terraform/encoders/monitoring_monitored_project.go.tmpl +++ b/mmv1/templates/terraform/encoders/monitoring_monitored_project.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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 := d.Get("name").(string) log.Printf("[DEBUG] Encoded monitored project name: %s", name) name = tpgresource.GetResourceNameFromSelfLink(name) diff --git a/mmv1/templates/terraform/encoders/monitoring_notification_channel.go.tmpl b/mmv1/templates/terraform/encoders/monitoring_notification_channel.go.tmpl index cd7e992f6194..4a4fbc8502d3 100644 --- a/mmv1/templates/terraform/encoders/monitoring_notification_channel.go.tmpl +++ b/mmv1/templates/terraform/encoders/monitoring_notification_channel.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} labelmap, ok := obj["labels"] if !ok { labelmap = make(map[string]string) diff --git a/mmv1/templates/terraform/encoders/monitoring_service.go.tmpl b/mmv1/templates/terraform/encoders/monitoring_service.go.tmpl index 38aa50f02d9d..b27fe821f566 100644 --- a/mmv1/templates/terraform/encoders/monitoring_service.go.tmpl +++ b/mmv1/templates/terraform/encoders/monitoring_service.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // Currently only CUSTOM service types can be created, but the // custom identifier block does not actually have fields right now. // Set to empty to indicate manually-created service type is CUSTOM. diff --git a/mmv1/templates/terraform/encoders/monitoring_slo.go.tmpl b/mmv1/templates/terraform/encoders/monitoring_slo.go.tmpl index 5f5b99f900ed..d135a3426c0b 100644 --- a/mmv1/templates/terraform/encoders/monitoring_slo.go.tmpl +++ b/mmv1/templates/terraform/encoders/monitoring_slo.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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/Service Level Objective ID is a query parameter and cannot // be given in data delete(obj, "sloId") diff --git a/mmv1/templates/terraform/encoders/network_peering_routes_config.go.tmpl b/mmv1/templates/terraform/encoders/network_peering_routes_config.go.tmpl index 10895424ae0f..f52b45c6a4da 100644 --- a/mmv1/templates/terraform/encoders/network_peering_routes_config.go.tmpl +++ b/mmv1/templates/terraform/encoders/network_peering_routes_config.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // Stick request in a networkPeering block as in // https://cloud.google.com/compute/docs/reference/rest/v1/networks/updatePeering newObj := make(map[string]interface{}) diff --git a/mmv1/templates/terraform/encoders/no_send_name.go.tmpl b/mmv1/templates/terraform/encoders/no_send_name.go.tmpl index 44343e30d86d..8fa3b1ba6c68 100644 --- a/mmv1/templates/terraform/encoders/no_send_name.go.tmpl +++ b/mmv1/templates/terraform/encoders/no_send_name.go.tmpl @@ -1,16 +1,14 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} delete(obj, "name") return obj, nil diff --git a/mmv1/templates/terraform/encoders/org_policy_policy.go.tmpl b/mmv1/templates/terraform/encoders/org_policy_policy.go.tmpl index 249fa5ab61c7..39137b874958 100644 --- a/mmv1/templates/terraform/encoders/org_policy_policy.go.tmpl +++ b/mmv1/templates/terraform/encoders/org_policy_policy.go.tmpl @@ -1,17 +1,15 @@ -<%- # 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. --%> +{{/* + 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 := d.Get("name").(string) d.Set("name", tpgresource.GetResourceNameFromSelfLink(name)) return obj, nil diff --git a/mmv1/templates/terraform/encoders/redis_location_id_for_fallback_zone.go.tmpl b/mmv1/templates/terraform/encoders/redis_location_id_for_fallback_zone.go.tmpl index 64e3a075fdf1..0c045875af48 100644 --- a/mmv1/templates/terraform/encoders/redis_location_id_for_fallback_zone.go.tmpl +++ b/mmv1/templates/terraform/encoders/redis_location_id_for_fallback_zone.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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) region, err := tpgresource.GetRegionFromSchema("region", "location_id", d, config) if err != nil { diff --git a/mmv1/templates/terraform/encoders/region_backend_service.go.tmpl b/mmv1/templates/terraform/encoders/region_backend_service.go.tmpl index 20502d6b8358..d1ce18c4fa21 100644 --- a/mmv1/templates/terraform/encoders/region_backend_service.go.tmpl +++ b/mmv1/templates/terraform/encoders/region_backend_service.go.tmpl @@ -1,22 +1,20 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} if d.Get("load_balancing_scheme").(string) == "EXTERNAL_MANAGED" || d.Get("load_balancing_scheme").(string) == "INTERNAL_MANAGED" { return obj, nil } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} // To remove subsetting on an ILB, "NONE" must be specified. If subsetting // isn't specified, we set the value to NONE to make this use case work. _, ok := obj["subsetting"] @@ -29,7 +27,7 @@ if !ok { obj["subsetting"] = data } } -<% end -%> +{{- end }} backendServiceOnlyManagedApiFieldNames := []string{ "capacityScaler", diff --git a/mmv1/templates/terraform/encoders/spanner_database.go.tmpl b/mmv1/templates/terraform/encoders/spanner_database.go.tmpl index 59cc52a59c32..78cd8aba964d 100644 --- a/mmv1/templates/terraform/encoders/spanner_database.go.tmpl +++ b/mmv1/templates/terraform/encoders/spanner_database.go.tmpl @@ -10,10 +10,10 @@ log.Printf("[DEBUG] Preparing to create new Database. Any extra DDL statements w delete(obj, "name") delete(obj, "instance") -<%# These are added back in post-create, but do not remove for Validator. %> -<% unless compiler == "terraformgoogleconversion-codegen" -%> +{{/* These are added back in post-create, but do not remove for Validator. */}} +{{- if ne $.Compiler "terraformgoogleconversion-codegen" }} delete(obj, "versionRetentionPeriod") delete(obj, "extraStatements") delete(obj, "enableDropProtection") -<% end -%> +{{- end }} return obj, nil diff --git a/mmv1/templates/terraform/encoders/spanner_schedule_backup.go.tmpl b/mmv1/templates/terraform/encoders/spanner_schedule_backup.go.tmpl index 0810ad7d9a15..edf64f73b189 100644 --- a/mmv1/templates/terraform/encoders/spanner_schedule_backup.go.tmpl +++ b/mmv1/templates/terraform/encoders/spanner_schedule_backup.go.tmpl @@ -6,7 +6,7 @@ if obj["name"] == nil || obj["name"] == "" { } config := meta.(*transport_tpg.Config) var err error -obj["name"], err = tpgresource.ReplaceVars(d, config, "projects/{{project}}/instances/{{instance}}/databases/{{database}}/backupSchedules/{{name}}") +obj["name"], err = tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/instances/{{"{{"}}instance{{"}}"}}/databases/{{"{{"}}database{{"}}"}}/backupSchedules/{{"{{"}}name{{"}}"}}") if err != nil { return obj, err } diff --git a/mmv1/templates/terraform/encoders/sql_source_representation_instance.go.tmpl b/mmv1/templates/terraform/encoders/sql_source_representation_instance.go.tmpl index 771a5b405f15..3897db08efdb 100644 --- a/mmv1/templates/terraform/encoders/sql_source_representation_instance.go.tmpl +++ b/mmv1/templates/terraform/encoders/sql_source_representation_instance.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} opc := obj["onPremisesConfiguration"].(map[string]interface{}) opc["hostPort"] = fmt.Sprintf("%v:%v", opc["host"], opc["port"]) delete(opc, "host") diff --git a/mmv1/templates/terraform/encoders/wrap_object.go.tmpl b/mmv1/templates/terraform/encoders/wrap_object.go.tmpl index 3963e58da31b..6ac0bbe4e8ac 100644 --- a/mmv1/templates/terraform/encoders/wrap_object.go.tmpl +++ b/mmv1/templates/terraform/encoders/wrap_object.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) - newObj["<%= object.name.camelize(:lower) -%>"] = obj + newObj["{{camelize $.Name "lower"}}"] = obj return newObj, nil diff --git a/mmv1/templates/terraform/encoders/wrap_object_with_deployment_resource_pool_id.go.tmpl b/mmv1/templates/terraform/encoders/wrap_object_with_deployment_resource_pool_id.go.tmpl index 8c769120bd19..1a05fac6eb84 100644 --- a/mmv1/templates/terraform/encoders/wrap_object_with_deployment_resource_pool_id.go.tmpl +++ b/mmv1/templates/terraform/encoders/wrap_object_with_deployment_resource_pool_id.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) newObj["deploymentResourcePool"] = obj nameProp, ok := d.GetOk("name") diff --git a/mmv1/templates/terraform/encoders/wrap_object_with_template_id.go.tmpl b/mmv1/templates/terraform/encoders/wrap_object_with_template_id.go.tmpl index 97c9513d6ad8..45728664d213 100644 --- a/mmv1/templates/terraform/encoders/wrap_object_with_template_id.go.tmpl +++ b/mmv1/templates/terraform/encoders/wrap_object_with_template_id.go.tmpl @@ -1,19 +1,17 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) - newObj["<%= object.name.camelize(:lower) -%>"] = obj + newObj["{{camelize $.Name "lower"}}"] = obj templateIdProp, ok := d.GetOk("template_id") if ok && templateIdProp != nil { newObj["templateId"] = templateIdProp diff --git a/mmv1/templates/terraform/examples/Storage_pool_create.tf.tmpl b/mmv1/templates/terraform/examples/Storage_pool_create.tf.tmpl index 7919a9ee9dbf..1d219ce86ea6 100644 --- a/mmv1/templates/terraform/examples/Storage_pool_create.tf.tmpl +++ b/mmv1/templates/terraform/examples/Storage_pool_create.tf.tmpl @@ -1,12 +1,12 @@ # Create a network or use datasource to reference existing network resource "google_compute_network" "peering_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } # Reserve a CIDR for NetApp Volumes to use # When using shared-VPCs, this resource needs to be created in host project resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['global_name'] %>" + name = "{{index $.Vars "global_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 @@ -33,8 +33,8 @@ resource "google_compute_network_peering_routes_config" "route_updates" { # Create a storage pool # Create this resource in the project which is expected to own the volumes -resource "google_netapp_storage_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['pool_name'] %>" +resource "google_netapp_storage_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "pool_name"}}" # project = location = "us-central1" service_level = "PREMIUM" diff --git a/mmv1/templates/terraform/examples/access_context_manager_access_level_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_access_level_basic.tf.tmpl index ec6e32c0cf45..ec4ce3eb9cc4 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_access_level_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_access_level_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_access_context_manager_access_level" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_access_level" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name'] %>" - title = "<%= ctx[:vars]['access_level_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" + title = "{{index $.Vars "access_level_name"}}" basic { conditions { device_policy { diff --git a/mmv1/templates/terraform/examples/access_context_manager_access_level_condition_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_access_level_condition_basic.tf.tmpl index f4bc167bc564..4d1b2310a494 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_access_level_condition_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_access_level_condition_basic.tf.tmpl @@ -1,7 +1,7 @@ resource "google_access_context_manager_access_level" "access-level-service-account" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name'] %>" - title = "<%= ctx[:vars]['access_level_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" + title = "{{index $.Vars "access_level_name"}}" basic { conditions { device_policy { @@ -24,7 +24,7 @@ resource "google_access_context_manager_access_level" "access-level-service-acco } resource "google_service_account" "created-later" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" } resource "google_access_context_manager_access_level_condition" "access-level-conditions" { diff --git a/mmv1/templates/terraform/examples/access_context_manager_access_level_with_vpc_network_sources.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_access_level_with_vpc_network_sources.tf.tmpl index d80fe1a6c9ad..850fa022a305 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_access_level_with_vpc_network_sources.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_access_level_with_vpc_network_sources.tf.tmpl @@ -2,10 +2,10 @@ resource "google_compute_network" "vpc_network" { name = "tf-test" } -resource "google_access_context_manager_access_level" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_access_level" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name'] %>" - title = "<%= ctx[:vars]['access_level_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" + title = "{{index $.Vars "access_level_name"}}" basic { conditions { vpc_network_sources { diff --git a/mmv1/templates/terraform/examples/access_context_manager_access_levels_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_access_levels_basic.tf.tmpl index b1ec2715cf22..d195e704f687 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_access_levels_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_access_levels_basic.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_access_context_manager_access_levels" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_access_levels" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" access_levels { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name1'] %>" - title = "<%= ctx[:vars]['access_level_name1'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name1"}}" + title = "{{index $.Vars "access_level_name1"}}" basic { conditions { device_policy { @@ -21,8 +21,8 @@ resource "google_access_context_manager_access_levels" "<%= ctx[:primary_resourc } access_levels { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name2'] %>" - title = "<%= ctx[:vars]['access_level_name2'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name2"}}" + title = "{{index $.Vars "access_level_name2"}}" basic { conditions { device_policy { diff --git a/mmv1/templates/terraform/examples/access_context_manager_access_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_access_policy_basic.tf.tmpl index a870f29e514c..8c7f81101207 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_access_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_access_policy_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_access_context_manager_access_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_access_policy" "{{$.PrimaryResourceId}}" { parent = "organizations/123456789" title = "Org Access Policy" } diff --git a/mmv1/templates/terraform/examples/access_context_manager_access_policy_scoped.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_access_policy_scoped.tf.tmpl index 46a72ae67517..b031c076fddc 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_access_policy_scoped.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_access_policy_scoped.tf.tmpl @@ -1,12 +1,12 @@ resource "google_project" "project" { - project_id = "<%= ctx[:test_env_vars]['project'] %>" - name = "<%= ctx[:test_env_vars]['project'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.TestEnvVars "project"}}" + name = "{{index $.TestEnvVars "project"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } -resource "google_access_context_manager_access_policy" "<%= ctx[:primary_resource_id] %>" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_access_context_manager_access_policy" "{{$.PrimaryResourceId}}" { + parent = "organizations/{{index $.TestEnvVars "org_id"}}" title = "Scoped Access Policy" scopes = ["projects/${google_project.project.number}"] } diff --git a/mmv1/templates/terraform/examples/access_context_manager_authorized_orgs_desc_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_authorized_orgs_desc_basic.tf.tmpl index 4158f7b60b00..021fbf11b097 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_authorized_orgs_desc_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_authorized_orgs_desc_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_access_context_manager_authorized_orgs_desc" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_authorized_orgs_desc" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}" name = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}/authorizedOrgsDescs/fakeDescName" authorization_type = "AUTHORIZATION_TYPE_TRUST" @@ -8,6 +8,6 @@ resource "google_access_context_manager_authorized_orgs_desc" "<%= ctx[:primary_ } resource "google_access_context_manager_access_policy" "test-access" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" title = "my policy" } diff --git a/mmv1/templates/terraform/examples/access_context_manager_gcp_user_access_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_gcp_user_access_binding_basic.tf.tmpl index de2f04919eff..75e4ab34af05 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_gcp_user_access_binding_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_gcp_user_access_binding_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_cloud_identity_group" "group" { - display_name = "<%= ctx[:vars]['group_id'] %>" + display_name = "{{index $.Vars "group_id"}}" - parent = "customers/<%= ctx[:test_env_vars]['cust_id'] %>" + parent = "customers/{{index $.TestEnvVars "cust_id"}}" group_key { - id = "<%= ctx[:vars]['group_id'] %>@<%= ctx[:test_env_vars]['org_domain'] %>" + id = "{{index $.Vars "group_id"}}@{{index $.TestEnvVars "org_domain"}}" } labels = { @@ -12,10 +12,10 @@ resource "google_cloud_identity_group" "group" { } } -resource "google_access_context_manager_access_level" "<%= ctx[:vars]['access_level_id'] %>" { +resource "google_access_context_manager_access_level" "{{index $.Vars "access_level_id"}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name'] %>" - title = "<%= ctx[:vars]['access_level_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" + title = "{{index $.Vars "access_level_name"}}" basic { conditions { device_policy { @@ -32,16 +32,16 @@ resource "google_access_context_manager_access_level" "<%= ctx[:vars]['access_le } resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" title = "my policy" } -resource "google_access_context_manager_gcp_user_access_binding" "<%= ctx[:primary_resource_id] %>" { - organization_id = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_access_context_manager_gcp_user_access_binding" "{{$.PrimaryResourceId}}" { + organization_id = "{{index $.TestEnvVars "org_id"}}" group_key = trimprefix(google_cloud_identity_group.group.id, "groups/") access_levels = [ - google_access_context_manager_access_level.<%= ctx[:vars]['access_level_id'] %>.name, + google_access_context_manager_access_level.{{index $.Vars "access_level_id"}}.name, ] } diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_basic.tf.tmpl index 2bbc01492ebb..60a0e34bd3ed 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_access_context_manager_service_perimeter" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_service_perimeter" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/<%= ctx[:vars]['service_perimeter_name'] %>" - title = "<%= ctx[:vars]['service_perimeter_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name"}}" + title = "{{index $.Vars "service_perimeter_name"}}" status { restricted_services = ["storage.googleapis.com"] } @@ -9,8 +9,8 @@ resource "google_access_context_manager_service_perimeter" "<%= ctx[:primary_res resource "google_access_context_manager_access_level" "access-level" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name'] %>" - title = "<%= ctx[:vars]['access_level_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" + title = "{{index $.Vars "access_level_name"}}" basic { conditions { device_policy { diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry-run.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry-run.tf.tmpl index db0ae5397152..49c5470bff20 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry-run.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry-run.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_access_context_manager_service_perimeter" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_service_perimeter" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/<%= ctx[:vars]['service_perimeter_name'] %>" - title = "<%= ctx[:vars]['service_perimeter_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name"}}" + title = "{{index $.Vars "service_perimeter_name"}}" # Service 'bigquery.googleapis.com' will be restricted. status { diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_resource_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_resource_basic.tf.tmpl index 04b6ebfbb10e..6237c635567e 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_resource_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_dry_run_resource_basic.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_access_context_manager_service_perimeter_dry_run_resource" "<%= ctx[:primary_resource_id] %>" { - perimeter_name = google_access_context_manager_service_perimeter.<%= ctx[:primary_resource_id] %>.name +resource "google_access_context_manager_service_perimeter_dry_run_resource" "{{$.PrimaryResourceId}}" { + perimeter_name = google_access_context_manager_service_perimeter.{{$.PrimaryResourceId}}.name resource = "projects/987654321" } -resource "google_access_context_manager_service_perimeter" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_service_perimeter" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/<%= ctx[:vars]['service_perimeter_name'] %>" - title = "<%= ctx[:vars]['service_perimeter_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name"}}" + title = "{{index $.Vars "service_perimeter_name"}}" spec { restricted_services = ["storage.googleapis.com"] } diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_granular_controls.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_granular_controls.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_granular_controls.tf.tmpl rename to mmv1/templates/terraform/examples/access_context_manager_service_perimeter_granular_controls.tf.tmpl diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_resource_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_resource_basic.tf.tmpl index b893591fc932..5644cb7b5b4d 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_resource_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_resource_basic.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_access_context_manager_service_perimeter_resource" "<%= ctx[:primary_resource_id] %>" { - perimeter_name = google_access_context_manager_service_perimeter.<%= ctx[:primary_resource_id] %>.name +resource "google_access_context_manager_service_perimeter_resource" "{{$.PrimaryResourceId}}" { + perimeter_name = google_access_context_manager_service_perimeter.{{$.PrimaryResourceId}}.name resource = "projects/987654321" } -resource "google_access_context_manager_service_perimeter" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_service_perimeter" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/<%= ctx[:vars]['service_perimeter_name'] %>" - title = "<%= ctx[:vars]['service_perimeter_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name"}}" + title = "{{index $.Vars "service_perimeter_name"}}" status { restricted_services = ["storage.googleapis.com"] } diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_secure_data_exchange.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_secure_data_exchange.tf.tmpl index c0322ecd7d67..25d2dd77a041 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_secure_data_exchange.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeter_secure_data_exchange.tf.tmpl @@ -1,17 +1,17 @@ -resource "google_access_context_manager_service_perimeters" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_service_perimeters" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" service_perimeters { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/<%= ctx[:vars]['service_perimeter_name1'] %>" - title = "<%= ctx[:vars]['service_perimeter_name1'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name1"}}" + title = "{{index $.Vars "service_perimeter_name1"}}" status { restricted_services = ["storage.googleapis.com"] } } service_perimeters { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/<%= ctx[:vars]['service_perimeter_name2'] %>" - title = "<%= ctx[:vars]['service_perimeter_name2'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name2"}}" + title = "{{index $.Vars "service_perimeter_name2"}}" status { restricted_services = ["bigtable.googleapis.com"] vpcAccessibleServices = { @@ -24,8 +24,8 @@ resource "google_access_context_manager_service_perimeters" "<%= ctx[:primary_re resource "google_access_context_manager_access_level" "access-level" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name'] %>" - title = "<%= ctx[:vars]['access_level_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" + title = "{{index $.Vars "access_level_name"}}" basic { conditions { device_policy { diff --git a/mmv1/templates/terraform/examples/access_context_manager_service_perimeters_basic.tf.tmpl b/mmv1/templates/terraform/examples/access_context_manager_service_perimeters_basic.tf.tmpl index 7fc86677dc07..c127f9b8fca8 100644 --- a/mmv1/templates/terraform/examples/access_context_manager_service_perimeters_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/access_context_manager_service_perimeters_basic.tf.tmpl @@ -1,17 +1,17 @@ -resource "google_access_context_manager_service_perimeters" "<%= ctx[:primary_resource_id] %>" { +resource "google_access_context_manager_service_perimeters" "{{$.PrimaryResourceId}}" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" service_perimeters { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/<%= ctx[:vars]['service_perimeter_name1'] %>" - title = "<%= ctx[:vars]['service_perimeter_name1'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name1"}}" + title = "{{index $.Vars "service_perimeter_name1"}}" status { restricted_services = ["storage.googleapis.com"] } } service_perimeters { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/<%= ctx[:vars]['service_perimeter_name2'] %>" - title = "<%= ctx[:vars]['service_perimeter_name2'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name2"}}" + title = "{{index $.Vars "service_perimeter_name2"}}" status { restricted_services = ["bigtable.googleapis.com"] } @@ -20,8 +20,8 @@ resource "google_access_context_manager_service_perimeters" "<%= ctx[:primary_re resource "google_access_context_manager_access_level" "access-level" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]['access_level_name'] %>" - title = "<%= ctx[:vars]['access_level_name'] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" + title = "{{index $.Vars "access_level_name"}}" basic { conditions { device_policy { diff --git a/mmv1/templates/terraform/examples/active_directory_domain_basic.tf.tmpl b/mmv1/templates/terraform/examples/active_directory_domain_basic.tf.tmpl index e970996dd9be..665ad26f8754 100644 --- a/mmv1/templates/terraform/examples/active_directory_domain_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/active_directory_domain_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_active_directory_domain" "ad-domain" { - domain_name = "<%= ctx[:vars]['domain_name'] %>.org.com" + domain_name = "{{index $.Vars "domain_name"}}.org.com" locations = ["us-central1"] reserved_ip_range = "192.168.255.0/24" deletion_protection = false diff --git a/mmv1/templates/terraform/examples/active_directory_peering_basic.tf.tmpl b/mmv1/templates/terraform/examples/active_directory_peering_basic.tf.tmpl index c68e7fb75b9b..e18ce41918ff 100644 --- a/mmv1/templates/terraform/examples/active_directory_peering_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/active_directory_peering_basic.tf.tmpl @@ -11,7 +11,7 @@ resource "google_active_directory_peering" "ad-domain-peering" { resource "google_active_directory_domain" "ad-domain" { provider = google-beta - domain_name = "<%= ctx[:vars]['domain_name'] %>" + domain_name = "{{index $.Vars "domain_name"}}" locations = ["us-central1"] reserved_ip_range = "192.168.255.0/24" authorized_networks = [google_compute_network.source-network.id] @@ -37,9 +37,9 @@ resource "google_project_service" "compute" { resource "google_project" "peered-project" { provider = google-beta - name = "<%= ctx[:vars]['project_id'] %>" - project_id = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + name = "{{index $.Vars "project_id"}}" + project_id = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/address_basic.tf.tmpl b/mmv1/templates/terraform/examples/address_basic.tf.tmpl index 4a6dabc8c629..b2ad4d9779c4 100644 --- a/mmv1/templates/terraform/examples/address_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/address_basic.tf.tmpl @@ -1,3 +1,3 @@ -resource "google_compute_address" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['address_name'] %>" +resource "google_compute_address" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "address_name"}}" } diff --git a/mmv1/templates/terraform/examples/address_with_gce_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/address_with_gce_endpoint.tf.tmpl index 406162e4694f..75d52bf10795 100644 --- a/mmv1/templates/terraform/examples/address_with_gce_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/address_with_gce_endpoint.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_address" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['address_name'] %>" +resource "google_compute_address" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "address_name"}}" address_type = "INTERNAL" purpose = "GCE_ENDPOINT" } diff --git a/mmv1/templates/terraform/examples/address_with_shared_loadbalancer_vip.tf.tmpl b/mmv1/templates/terraform/examples/address_with_shared_loadbalancer_vip.tf.tmpl index 759ab00ce354..1737f885cd9c 100644 --- a/mmv1/templates/terraform/examples/address_with_shared_loadbalancer_vip.tf.tmpl +++ b/mmv1/templates/terraform/examples/address_with_shared_loadbalancer_vip.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_address" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['address_name'] %>" +resource "google_compute_address" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "address_name"}}" address_type = "INTERNAL" purpose = "SHARED_LOADBALANCER_VIP" } diff --git a/mmv1/templates/terraform/examples/address_with_subnetwork.tf.tmpl b/mmv1/templates/terraform/examples/address_with_subnetwork.tf.tmpl index 139248617b6a..4e6eb8049ba8 100644 --- a/mmv1/templates/terraform/examples/address_with_subnetwork.tf.tmpl +++ b/mmv1/templates/terraform/examples/address_with_subnetwork.tf.tmpl @@ -1,16 +1,16 @@ resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.default.id } -resource "google_compute_address" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['address_name'] %>" +resource "google_compute_address" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "address_name"}}" subnetwork = google_compute_subnetwork.default.id address_type = "INTERNAL" address = "10.0.42.42" diff --git a/mmv1/templates/terraform/examples/agent_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/agent_pool_basic.tf.tmpl index 0e0a4a6a266a..88f8b8c2c3a8 100644 --- a/mmv1/templates/terraform/examples/agent_pool_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/agent_pool_basic.tf.tmpl @@ -1,15 +1,15 @@ data "google_storage_transfer_project_service_account" "default" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" } resource "google_project_iam_member" "pubsub_editor_role" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" role = "roles/pubsub.editor" member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" } -resource "google_storage_transfer_agent_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['agent-pool-name'] %>" +resource "google_storage_transfer_agent_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "agent-pool-name"}}" display_name = "Source A to destination Z" bandwidth_limit { limit_mbps = "120" diff --git a/mmv1/templates/terraform/examples/alloydb_backup_basic.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_backup_basic.tf.tmpl index 5481211958ec..a78ce7463f6a 100644 --- a/mmv1/templates/terraform/examples/alloydb_backup_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_backup_basic.tf.tmpl @@ -1,29 +1,29 @@ -resource "google_alloydb_backup" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { location = "us-central1" - backup_id = "<%= ctx[:vars]['alloydb_backup_id'] %>" - cluster_name = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name + backup_id = "{{index $.Vars "alloydb_backup_id"}}" + cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - depends_on = [google_alloydb_instance.<%= ctx[:primary_resource_id] %>] + depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = google_compute_network.default.id } } -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" depends_on = [google_service_networking_connection.vpc_connection] } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + name = "{{index $.Vars "alloydb_cluster_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -37,5 +37,5 @@ resource "google_service_networking_connection" "vpc_connection" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/alloydb_backup_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_backup_basic_test.tf.tmpl index e4b3d7b578c2..b09d5a4be7ef 100644 --- a/mmv1/templates/terraform/examples/alloydb_backup_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_backup_basic_test.tf.tmpl @@ -1,25 +1,25 @@ -resource "google_alloydb_backup" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { location = "us-central1" - backup_id = "<%= ctx[:vars]['alloydb_backup_id'] %>" - cluster_name = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name + backup_id = "{{index $.Vars "alloydb_backup_id"}}" + cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - depends_on = [google_alloydb_instance.<%= ctx[:primary_resource_id] %>] + depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id } } -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" } data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/alloydb_backup_full.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_backup_full.tf.tmpl index 3b084fe31a62..563fdcbac298 100644 --- a/mmv1/templates/terraform/examples/alloydb_backup_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_backup_full.tf.tmpl @@ -1,34 +1,34 @@ -resource "google_alloydb_backup" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { location = "us-central1" - backup_id = "<%= ctx[:vars]['alloydb_backup_id'] %>" - cluster_name = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name + backup_id = "{{index $.Vars "alloydb_backup_id"}}" + cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name description = "example description" type = "ON_DEMAND" labels = { "label" = "key" } - depends_on = [google_alloydb_instance.<%= ctx[:primary_resource_id] %>] + depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = google_compute_network.default.id } } -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" depends_on = [google_service_networking_connection.vpc_connection] } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + name = "{{index $.Vars "alloydb_cluster_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -42,5 +42,5 @@ resource "google_service_networking_connection" "vpc_connection" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/alloydb_backup_full_test.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_backup_full_test.tf.tmpl index d9e436c7fcba..218bc7ee3bed 100644 --- a/mmv1/templates/terraform/examples/alloydb_backup_full_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_backup_full_test.tf.tmpl @@ -1,30 +1,30 @@ -resource "google_alloydb_backup" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { location = "us-central1" - backup_id = "<%= ctx[:vars]['alloydb_backup_id'] %>" - cluster_name = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name + backup_id = "{{index $.Vars "alloydb_backup_id"}}" + cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name description = "example description" type = "ON_DEMAND" labels = { "label" = "key" } - depends_on = [google_alloydb_instance.<%= ctx[:primary_resource_id] %>] + depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id } } -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" } data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/alloydb_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_cluster_basic.tf.tmpl index cc5418e2ee5a..c9bab8098b43 100644 --- a/mmv1/templates/terraform/examples/alloydb_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_cluster_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = google_compute_network.default.id @@ -9,5 +9,5 @@ resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { data "google_project" "project" {} resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + name = "{{index $.Vars "alloydb_cluster_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/alloydb_cluster_full.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_cluster_full.tf.tmpl index 94fe1eddcd1d..2b0c9e4c9f63 100644 --- a/mmv1/templates/terraform/examples/alloydb_cluster_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_cluster_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = google_compute_network.default.id @@ -7,8 +7,8 @@ resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { database_version = "POSTGRES_15" initial_user { - user = "<%= ctx[:vars]['alloydb_cluster_name'] %>" - password = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + user = "{{index $.Vars "alloydb_cluster_name"}}" + password = "{{index $.Vars "alloydb_cluster_name"}}" } continuous_backup_config { @@ -37,17 +37,17 @@ resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { } labels = { - test = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + test = "{{index $.Vars "alloydb_cluster_name"}}" } } labels = { - test = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + test = "{{index $.Vars "alloydb_cluster_name"}}" } } data "google_project" "project" {} resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + name = "{{index $.Vars "alloydb_cluster_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/alloydb_cluster_restore.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_cluster_restore.tf.tmpl index 4d6d0bff435c..7713276440e6 100644 --- a/mmv1/templates/terraform/examples/alloydb_cluster_restore.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_cluster_restore.tf.tmpl @@ -1,16 +1,16 @@ -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network = data.google_compute_network.default.id initial_user { - password = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + password = "{{index $.Vars "alloydb_cluster_name"}}" } } -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" machine_config { @@ -20,33 +20,33 @@ resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { depends_on = [google_service_networking_connection.vpc_connection] } -resource "google_alloydb_backup" "<%= ctx[:primary_resource_id] %>" { - backup_id = "<%= ctx[:vars]['alloydb_backup_id'] %>" +resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { + backup_id = "{{index $.Vars "alloydb_backup_id"}}" location = "us-central1" - cluster_name = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name + cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - depends_on = [google_alloydb_instance.<%= ctx[:primary_resource_id] %>] + depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] } resource "google_alloydb_cluster" "restored_from_backup" { - cluster_id = "<%= ctx[:vars]['alloydb_backup_restored_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_backup_restored_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id } restore_backup_source { - backup_name = google_alloydb_backup.<%= ctx[:primary_resource_id] %>.name + backup_name = google_alloydb_backup.{{$.PrimaryResourceId}}.name } } resource "google_alloydb_cluster" "restored_via_pitr" { - cluster_id = "<%= ctx[:vars]['alloydb_pitr_restored_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_pitr_restored_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id } restore_continuous_backup_source { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name point_in_time = "2023-08-03T19:19:00.094Z" } } @@ -54,11 +54,11 @@ resource "google_alloydb_cluster" "restored_via_pitr" { data "google_project" "project" {} data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + name = "{{index $.Vars "alloydb_cluster_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 diff --git a/mmv1/templates/terraform/examples/alloydb_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_instance_basic.tf.tmpl index 5427d3c2ff1e..575c2a6ed790 100644 --- a/mmv1/templates/terraform/examples/alloydb_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_instance_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" machine_config { @@ -10,26 +10,26 @@ resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { depends_on = [google_service_networking_connection.vpc_connection] } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = google_compute_network.default.id } initial_user { - password = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + password = "{{index $.Vars "alloydb_cluster_name"}}" } } data "google_project" "project" {} resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + name = "{{index $.Vars "alloydb_cluster_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 diff --git a/mmv1/templates/terraform/examples/alloydb_instance_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_instance_basic_test.tf.tmpl index 5f7e2e325289..0ca5146f0ac8 100644 --- a/mmv1/templates/terraform/examples/alloydb_instance_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_instance_basic_test.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" machine_config { @@ -8,19 +8,19 @@ resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id } initial_user { - password = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + password = "{{index $.Vars "alloydb_cluster_name"}}" } } data "google_project" "project" {} data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/alloydb_instance_psc_test.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_instance_psc_test.tf.tmpl index 6b1743e63b75..d2d4712d0ae7 100644 --- a/mmv1/templates/terraform/examples/alloydb_instance_psc_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_instance_psc_test.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { - cluster = google_alloydb_cluster.<%= ctx[:primary_resource_id] %>.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { + cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" machine_config { @@ -8,12 +8,12 @@ resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" initial_user { - password = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + password = "{{index $.Vars "alloydb_cluster_name"}}" } psc_config { psc_enabled = true diff --git a/mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic.tf.tmpl index 7cfb78817983..6911d955d778 100644 --- a/mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_alloydb_cluster" "primary" { - cluster_id = "<%= ctx[:vars]['alloydb_primary_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_primary_cluster_name"}}" location = "us-central1" network_config { network = google_compute_network.default.id @@ -8,7 +8,7 @@ resource "google_alloydb_cluster" "primary" { resource "google_alloydb_instance" "primary" { cluster = google_alloydb_cluster.primary.name - instance_id = "<%= ctx[:vars]['alloydb_primary_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_primary_instance_name"}}" instance_type = "PRIMARY" machine_config { @@ -18,8 +18,8 @@ resource "google_alloydb_instance" "primary" { depends_on = [google_service_networking_connection.vpc_connection] } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_secondary_cluster_name"}}" location = "us-east1" network_config { network = google_compute_network.default.id @@ -40,11 +40,11 @@ resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { data "google_project" "project" {} resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" + name = "{{index $.Vars "alloydb_secondary_cluster_name"}}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" + name = "{{index $.Vars "alloydb_secondary_cluster_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 diff --git a/mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic_test.tf.tmpl index 6796ce112847..9b04de5953d4 100644 --- a/mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic_test.tf.tmpl @@ -1,5 +1,5 @@ resource "google_alloydb_cluster" "primary" { - cluster_id = "<%= ctx[:vars]['alloydb_primary_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_primary_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id @@ -8,7 +8,7 @@ resource "google_alloydb_cluster" "primary" { resource "google_alloydb_instance" "primary" { cluster = google_alloydb_cluster.primary.name - instance_id = "<%= ctx[:vars]['alloydb_primary_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_primary_instance_name"}}" instance_type = "PRIMARY" machine_config { @@ -16,8 +16,8 @@ resource "google_alloydb_instance" "primary" { } } -resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" +resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "alloydb_secondary_cluster_name"}}" location = "us-east1" network_config { network = data.google_compute_network.default.id @@ -38,5 +38,5 @@ resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { data "google_project" "project" {} data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/alloydb_secondary_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_secondary_instance_basic.tf.tmpl index 7472347360a3..8e2eeb44e88d 100644 --- a/mmv1/templates/terraform/examples/alloydb_secondary_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_secondary_instance_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_alloydb_cluster" "primary" { - cluster_id = "<%= ctx[:vars]['alloydb_primary_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_primary_cluster_name"}}" location = "us-central1" network_config { network = google_compute_network.default.id @@ -8,7 +8,7 @@ resource "google_alloydb_cluster" "primary" { resource "google_alloydb_instance" "primary" { cluster = google_alloydb_cluster.primary.name - instance_id = "<%= ctx[:vars]['alloydb_primary_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_primary_instance_name"}}" instance_type = "PRIMARY" machine_config { @@ -19,7 +19,7 @@ resource "google_alloydb_instance" "primary" { } resource "google_alloydb_cluster" "secondary" { - cluster_id = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_secondary_cluster_name"}}" location = "us-east1" network_config { network = data.google_compute_network.default.id @@ -46,9 +46,9 @@ resource "google_alloydb_cluster" "secondary" { depends_on = [google_alloydb_instance.primary] } -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { cluster = google_alloydb_cluster.secondary.name - instance_id = "<%= ctx[:vars]['alloydb_secondary_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_secondary_instance_name"}}" instance_type = google_alloydb_cluster.secondary.cluster_type machine_config { @@ -61,11 +61,11 @@ resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { data "google_project" "project" {} resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['alloydb_secondary_instance_name'] %>" + name = "{{index $.Vars "alloydb_secondary_instance_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 diff --git a/mmv1/templates/terraform/examples/alloydb_secondary_instance_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_secondary_instance_basic_test.tf.tmpl index dc7c5e0a5f4a..432fd4d91e80 100644 --- a/mmv1/templates/terraform/examples/alloydb_secondary_instance_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_secondary_instance_basic_test.tf.tmpl @@ -1,5 +1,5 @@ resource "google_alloydb_cluster" "primary" { - cluster_id = "<%= ctx[:vars]['alloydb_primary_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_primary_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id @@ -8,7 +8,7 @@ resource "google_alloydb_cluster" "primary" { resource "google_alloydb_instance" "primary" { cluster = google_alloydb_cluster.primary.name - instance_id = "<%= ctx[:vars]['alloydb_primary_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_primary_instance_name"}}" instance_type = "PRIMARY" machine_config { @@ -17,7 +17,7 @@ resource "google_alloydb_instance" "primary" { } resource "google_alloydb_cluster" "secondary" { - cluster_id = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_secondary_cluster_name"}}" location = "us-east1" network_config { network = data.google_compute_network.default.id @@ -37,9 +37,9 @@ resource "google_alloydb_cluster" "secondary" { depends_on = [google_alloydb_instance.primary] } -resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { cluster = google_alloydb_cluster.secondary.name - instance_id = "<%= ctx[:vars]['alloydb_secondary_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_secondary_instance_name"}}" instance_type = google_alloydb_cluster.secondary.cluster_type machine_config { @@ -50,5 +50,5 @@ resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" { data "google_project" "project" {} data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/alloydb_user_builtin.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_user_builtin.tf.tmpl index 63e63c83fefa..b91e92abddce 100644 --- a/mmv1/templates/terraform/examples/alloydb_user_builtin.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_user_builtin.tf.tmpl @@ -1,30 +1,30 @@ resource "google_alloydb_instance" "default" { cluster = google_alloydb_cluster.default.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" depends_on = [google_service_networking_connection.vpc_connection] } resource "google_alloydb_cluster" "default" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id } initial_user { - password = "<%= ctx[:vars]['alloydb_cluster_pass'] %>" + password = "{{index $.Vars "alloydb_cluster_pass"}}" } } data "google_project" "project" {} resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + name = "{{index $.Vars "alloydb_cluster_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -37,12 +37,12 @@ resource "google_service_networking_connection" "vpc_connection" { reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] } -resource "google_alloydb_user" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_user" "{{$.PrimaryResourceId}}" { cluster = google_alloydb_cluster.default.name - user_id = "<%= ctx[:vars]['alloydb_user_name'] %>" + user_id = "{{index $.Vars "alloydb_user_name"}}" user_type = "ALLOYDB_BUILT_IN" - password = "<%= ctx[:vars]['alloydb_user_pass'] %>" + password = "{{index $.Vars "alloydb_user_pass"}}" database_roles = ["alloydbsuperuser"] depends_on = [google_alloydb_instance.default] } diff --git a/mmv1/templates/terraform/examples/alloydb_user_builtin_test.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_user_builtin_test.tf.tmpl index 101167eec80b..01d0f92dd77c 100644 --- a/mmv1/templates/terraform/examples/alloydb_user_builtin_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_user_builtin_test.tf.tmpl @@ -1,33 +1,33 @@ resource "google_alloydb_instance" "default" { cluster = google_alloydb_cluster.default.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" } resource "google_alloydb_cluster" "default" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id } initial_user { - password = "<%= ctx[:vars]['alloydb_cluster_pass'] %>" + password = "{{index $.Vars "alloydb_cluster_pass"}}" } } data "google_project" "project" {} data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } -resource "google_alloydb_user" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_user" "{{$.PrimaryResourceId}}" { cluster = google_alloydb_cluster.default.name - user_id = "<%= ctx[:vars]['alloydb_user_name'] %>" + user_id = "{{index $.Vars "alloydb_user_name"}}" user_type = "ALLOYDB_BUILT_IN" - password = "<%= ctx[:vars]['alloydb_user_pass'] %>" + password = "{{index $.Vars "alloydb_user_pass"}}" database_roles = ["alloydbsuperuser"] depends_on = [google_alloydb_instance.default] } diff --git a/mmv1/templates/terraform/examples/alloydb_user_iam.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_user_iam.tf.tmpl index 1d57cef6d4d5..107cdaf25b3f 100644 --- a/mmv1/templates/terraform/examples/alloydb_user_iam.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_user_iam.tf.tmpl @@ -1,31 +1,31 @@ resource "google_alloydb_instance" "default" { cluster = google_alloydb_cluster.default.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" depends_on = [google_service_networking_connection.vpc_connection] } resource "google_alloydb_cluster" "default" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = google_compute_network.default.id } initial_user { - password = "<%= ctx[:vars]['alloydb_cluster_pass'] %>" + password = "{{index $.Vars "alloydb_cluster_pass"}}" } } data "google_project" "project" {} resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + name = "{{index $.Vars "alloydb_cluster_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -38,9 +38,9 @@ resource "google_service_networking_connection" "vpc_connection" { reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] } -resource "google_alloydb_user" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_user" "{{$.PrimaryResourceId}}" { cluster = google_alloydb_cluster.default.name - user_id = "<%= ctx[:vars]['alloydb_user_name'] %>" + user_id = "{{index $.Vars "alloydb_user_name"}}" user_type = "ALLOYDB_IAM_USER" database_roles = ["alloydbiamuser"] diff --git a/mmv1/templates/terraform/examples/alloydb_user_iam_test.tf.tmpl b/mmv1/templates/terraform/examples/alloydb_user_iam_test.tf.tmpl index 59296f25840f..eebb03454761 100644 --- a/mmv1/templates/terraform/examples/alloydb_user_iam_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/alloydb_user_iam_test.tf.tmpl @@ -1,29 +1,29 @@ resource "google_alloydb_instance" "default" { cluster = google_alloydb_cluster.default.name - instance_id = "<%= ctx[:vars]['alloydb_instance_name'] %>" + instance_id = "{{index $.Vars "alloydb_instance_name"}}" instance_type = "PRIMARY" } resource "google_alloydb_cluster" "default" { - cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>" + cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" location = "us-central1" network_config { network = data.google_compute_network.default.id } initial_user { - password = "<%= ctx[:vars]['alloydb_cluster_pass'] %>" + password = "{{index $.Vars "alloydb_cluster_pass"}}" } } data "google_project" "project" {} data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } -resource "google_alloydb_user" "<%= ctx[:primary_resource_id] %>" { +resource "google_alloydb_user" "{{$.PrimaryResourceId}}" { cluster = google_alloydb_cluster.default.name - user_id = "<%= ctx[:vars]['alloydb_user_name'] %>" + user_id = "{{index $.Vars "alloydb_user_name"}}" user_type = "ALLOYDB_IAM_USER" database_roles = ["alloydbiamuser"] diff --git a/mmv1/templates/terraform/examples/apigateway_api_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigateway_api_basic.tf.tmpl index df68d8cf1c51..f045b9b085e3 100644 --- a/mmv1/templates/terraform/examples/apigateway_api_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigateway_api_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_api_gateway_api" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { provider = google-beta - api_id = "<%= ctx[:vars]['api_id'] %>" + api_id = "{{index $.Vars "api_id"}}" } diff --git a/mmv1/templates/terraform/examples/apigateway_api_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigateway_api_config_basic.tf.tmpl index 80184f8bf138..e0c35f8cb8a6 100644 --- a/mmv1/templates/terraform/examples/apigateway_api_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigateway_api_config_basic.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_api_gateway_api" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { provider = google-beta - api_id = "<%= ctx[:vars]['api_id'] %>" + api_id = "{{index $.Vars "api_id"}}" } -resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { provider = google-beta - api = google_api_gateway_api.<%= ctx[:primary_resource_id] %>.api_id - api_config_id = "<%= ctx[:vars]['config_id'] %>" + api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id + api_config_id = "{{index $.Vars "config_id"}}" openapi_documents { document { diff --git a/mmv1/templates/terraform/examples/apigateway_api_config_full.tf.tmpl b/mmv1/templates/terraform/examples/apigateway_api_config_full.tf.tmpl index 59db36349c00..c0d7a1b90193 100644 --- a/mmv1/templates/terraform/examples/apigateway_api_config_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigateway_api_config_full.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_api_gateway_api" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { provider = google-beta - api_id = "<%= ctx[:vars]['api_id'] %>" + api_id = "{{index $.Vars "api_id"}}" } -resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { provider = google-beta - api = google_api_gateway_api.<%= ctx[:primary_resource_id] %>.api_id - api_config_id = "<%= ctx[:vars]['config_id'] %>" + api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id + api_config_id = "{{index $.Vars "config_id"}}" display_name = "MM Dev API Config" labels = { environment = "dev" diff --git a/mmv1/templates/terraform/examples/apigateway_api_config_grpc.tf.tmpl b/mmv1/templates/terraform/examples/apigateway_api_config_grpc.tf.tmpl index 6daa9393aeab..d6828333f17c 100644 --- a/mmv1/templates/terraform/examples/apigateway_api_config_grpc.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigateway_api_config_grpc.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_api_gateway_api" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { provider = google-beta - api_id = "<%= ctx[:vars]['api_id'] %>" + api_id = "{{index $.Vars "api_id"}}" } -resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { provider = google-beta - api = google_api_gateway_api.<%= ctx[:primary_resource_id] %>.api_id - api_config_id = "<%= ctx[:vars]['config_id'] %>" + api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id + api_config_id = "{{index $.Vars "config_id"}}" grpc_services { file_descriptor_set { @@ -19,7 +19,7 @@ resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { contents = base64encode(<<-EOF type: google.api.Service config_version: 3 - name: ${google_api_gateway_api.<%= ctx[:primary_resource_id] %>.managed_service} + name: ${google_api_gateway_api.{{$.PrimaryResourceId}}.managed_service} title: gRPC API example apis: - name: endpoints.examples.bookstore.Bookstore diff --git a/mmv1/templates/terraform/examples/apigateway_api_config_grpc_full.tf.tmpl b/mmv1/templates/terraform/examples/apigateway_api_config_grpc_full.tf.tmpl index ac2efbd222a0..edd4b4799227 100644 --- a/mmv1/templates/terraform/examples/apigateway_api_config_grpc_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigateway_api_config_grpc_full.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_api_gateway_api" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { provider = google-beta - api_id = "<%= ctx[:vars]['api_id'] %>" + api_id = "{{index $.Vars "api_id"}}" } -resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { provider = google-beta - api = google_api_gateway_api.<%= ctx[:primary_resource_id] %>.api_id - api_config_id = "<%= ctx[:vars]['config_id'] %>" + api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id + api_config_id = "{{index $.Vars "config_id"}}" grpc_services { file_descriptor_set { @@ -23,7 +23,7 @@ resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { contents = base64encode(<<-EOF type: google.api.Service config_version: 3 - name: ${google_api_gateway_api.<%= ctx[:primary_resource_id] %>.managed_service} + name: ${google_api_gateway_api.{{$.PrimaryResourceId}}.managed_service} title: gRPC API example apis: - name: endpoints.examples.bookstore.Bookstore diff --git a/mmv1/templates/terraform/examples/apigateway_api_full.tf.tmpl b/mmv1/templates/terraform/examples/apigateway_api_full.tf.tmpl index adb5985e34e8..fa8d669d4e06 100644 --- a/mmv1/templates/terraform/examples/apigateway_api_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigateway_api_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_api_gateway_api" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { provider = google-beta - api_id = "<%= ctx[:vars]['api_id'] %>" + api_id = "{{index $.Vars "api_id"}}" display_name = "MM Dev API" labels = { environment = "dev" diff --git a/mmv1/templates/terraform/examples/apigateway_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigateway_gateway_basic.tf.tmpl index a8136f22c8b9..eec7f80440b9 100644 --- a/mmv1/templates/terraform/examples/apigateway_gateway_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigateway_gateway_basic.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_api_gateway_api" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { provider = google-beta - api_id = "<%= ctx[:vars]['api_id'] %>" + api_id = "{{index $.Vars "api_id"}}" } -resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { provider = google-beta - api = google_api_gateway_api.<%= ctx[:primary_resource_id] %>.api_id - api_config_id = "<%= ctx[:vars]['config_id'] %>" + api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id + api_config_id = "{{index $.Vars "config_id"}}" openapi_documents { document { @@ -19,8 +19,8 @@ resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_api_gateway_gateway" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_gateway" "{{$.PrimaryResourceId}}" { provider = google-beta - api_config = google_api_gateway_api_config.<%= ctx[:primary_resource_id] %>.id - gateway_id = "<%= ctx[:vars]['gateway_id'] %>" + api_config = google_api_gateway_api_config.{{$.PrimaryResourceId}}.id + gateway_id = "{{index $.Vars "gateway_id"}}" } diff --git a/mmv1/templates/terraform/examples/apigateway_gateway_full.tf.tmpl b/mmv1/templates/terraform/examples/apigateway_gateway_full.tf.tmpl index db10e468806d..acb4c7f689e2 100644 --- a/mmv1/templates/terraform/examples/apigateway_gateway_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigateway_gateway_full.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_api_gateway_api" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { provider = google-beta - api_id = "<%= ctx[:vars]['api_id'] %>" + api_id = "{{index $.Vars "api_id"}}" } -resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { provider = google-beta - api = google_api_gateway_api.<%= ctx[:primary_resource_id] %>.api_id - api_config_id = "<%= ctx[:vars]['config_id'] %>" + api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id + api_config_id = "{{index $.Vars "config_id"}}" openapi_documents { document { @@ -16,11 +16,11 @@ resource "google_api_gateway_api_config" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_api_gateway_gateway" "<%= ctx[:primary_resource_id] %>" { +resource "google_api_gateway_gateway" "{{$.PrimaryResourceId}}" { provider = google-beta region = "us-central1" - api_config = google_api_gateway_api_config.<%= ctx[:primary_resource_id] %>.id - gateway_id = "<%= ctx[:vars]['gateway_id'] %>" + api_config = google_api_gateway_api_config.{{$.PrimaryResourceId}}.id + gateway_id = "{{index $.Vars "gateway_id"}}" display_name = "MM Dev API Gateway" labels = { environment = "dev" diff --git a/mmv1/templates/terraform/examples/apigee_addons_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_addons_test.tf.tmpl index 813ec9a80487..7dd26447e516 100644 --- a/mmv1/templates/terraform/examples/apigee_addons_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_addons_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test-%{random_suffix}" name = "tf-test-%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -55,7 +55,7 @@ resource "google_apigee_organization" "org" { ] } -resource "google_apigee_addons_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_addons_config" "{{$.PrimaryResourceId}}" { org = google_apigee_organization.org.name addons_config { diff --git a/mmv1/templates/terraform/examples/apigee_endpoint_attachment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_endpoint_attachment_basic_test.tf.tmpl index 6f0af483c2d5..613a4a98606f 100644 --- a/mmv1/templates/terraform/examples/apigee_endpoint_attachment_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_endpoint_attachment_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -153,7 +153,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_endpoint_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_endpoint_attachment" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id endpoint_attachment_id = "test1" location = "us-west2" diff --git a/mmv1/templates/terraform/examples/apigee_env_keystore_alias_self_signed_cert.tf.tmpl b/mmv1/templates/terraform/examples/apigee_env_keystore_alias_self_signed_cert.tf.tmpl index 452bb5e6015f..4cffd3f021e3 100644 --- a/mmv1/templates/terraform/examples/apigee_env_keystore_alias_self_signed_cert.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_env_keystore_alias_self_signed_cert.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -55,15 +55,15 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id - name = "<%= ctx[:vars]['environment_name'] %>" + name = "{{index $.Vars "environment_name"}}" description = "Apigee Environment" display_name = "environment-1" } resource "google_apigee_env_keystore" "apigee_environment_keystore_alias" { - name = "<%= ctx[:vars]['keystore_name'] %>" + name = "{{index $.Vars "keystore_name"}}" env_id = google_apigee_environment.apigee_environment_keystore_ss_alias.id } @@ -71,7 +71,7 @@ resource "google_apigee_keystores_aliases_self_signed_cert" "apigee_environment_ environment = google_apigee_environment.apigee_environment_keystore_ss_alias.name org_id = google_apigee_organization.apigee_org.name keystore = google_apigee_env_keystore.apigee_environment_keystore_alias.name - alias = "<%= ctx[:vars]['keystores_alias'] %>" + alias = "{{index $.Vars "keystores_alias"}}" key_size = 1024 sig_alg = "SHA512withRSA" cert_validity_in_days = 4 diff --git a/mmv1/templates/terraform/examples/apigee_environment_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_basic.tf.tmpl index 8e05a3605599..df9c2ea7b320 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_basic.tf.tmpl @@ -26,7 +26,7 @@ resource "google_apigee_organization" "apigee_org" { } resource "google_apigee_environment" "env" { - name = "<%= ctx[:vars]['environment_name'] %>" + name = "{{index $.Vars "environment_name"}}" description = "Apigee Environment" display_name = "environment-1" org_id = google_apigee_organization.apigee_org.id diff --git a/mmv1/templates/terraform/examples/apigee_environment_basic_deployment_apiproxy_type_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_basic_deployment_apiproxy_type_test.tf.tmpl index 213e707861d5..c1e4045d48c5 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_basic_deployment_apiproxy_type_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_basic_deployment_apiproxy_type_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -55,7 +55,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id name = "tf-test%{random_suffix}" description = "Apigee Environment" diff --git a/mmv1/templates/terraform/examples/apigee_environment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_basic_test.tf.tmpl index 162ad65e0b68..ff63f69ed691 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -55,7 +55,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id name = "tf-test%{random_suffix}" description = "Apigee Environment" diff --git a/mmv1/templates/terraform/examples/apigee_environment_group_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_group_attachment_basic.tf.tmpl index 653bf99a83a7..d008def35c06 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_group_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_group_attachment_basic.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -55,18 +55,18 @@ resource "google_apigee_organization" "apigee_org" { resource "google_apigee_envgroup" "apigee_envgroup" { org_id = google_apigee_organization.apigee_org.id - name = "<%= ctx[:vars]['envgroup_name'] %>" + name = "{{index $.Vars "envgroup_name"}}" hostnames = ["abc.foo.com"] } resource "google_apigee_environment" "apigee_env" { org_id = google_apigee_organization.apigee_org.id - name = "<%= ctx[:vars]['environment_name'] %>" + name = "{{index $.Vars "environment_name"}}" description = "Apigee Environment" - display_name = "<%= ctx[:vars]['environment_name'] %>" + display_name = "{{index $.Vars "environment_name"}}" } -resource "google_apigee_envgroup_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_envgroup_attachment" "{{$.PrimaryResourceId}}" { envgroup_id = google_apigee_envgroup.apigee_envgroup.id environment = google_apigee_environment.apigee_env.name } diff --git a/mmv1/templates/terraform/examples/apigee_environment_group_attachment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_group_attachment_basic_test.tf.tmpl index f82569b5495e..611e1a31136f 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_group_attachment_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_group_attachment_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -66,7 +66,7 @@ resource "google_apigee_environment" "apigee_env" { display_name = "tf-test%{random_suffix}" } -resource "google_apigee_envgroup_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_envgroup_attachment" "{{$.PrimaryResourceId}}" { envgroup_id = google_apigee_envgroup.apigee_envgroup.id environment = google_apigee_environment.apigee_env.name } diff --git a/mmv1/templates/terraform/examples/apigee_environment_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_group_basic.tf.tmpl index 6fcca78764dc..2e6eb4630b01 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_group_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_group_basic.tf.tmpl @@ -26,7 +26,7 @@ resource "google_apigee_organization" "apigee_org" { } resource "google_apigee_envgroup" "env_grp" { - name = "<%= ctx[:vars]['envgroup_name'] %>" + name = "{{index $.Vars "envgroup_name"}}" hostnames = ["abc.foo.com"] org_id = google_apigee_organization.apigee_org.id } diff --git a/mmv1/templates/terraform/examples/apigee_environment_group_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_group_basic_test.tf.tmpl index 65af6e2b206e..6118cc0b6c98 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_group_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_group_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -53,7 +53,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_envgroup" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_envgroup" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id name = "tf-test%{random_suffix}" hostnames = ["abc.foo.com"] diff --git a/mmv1/templates/terraform/examples/apigee_environment_keystore_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_keystore_test.tf.tmpl index c0c6c8455bdc..3806673a0c61 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_keystore_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_keystore_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -55,7 +55,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id name = "tf-test%{random_suffix}" description = "Apigee Environment" @@ -64,5 +64,5 @@ resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" { resource "google_apigee_env_keystore" "apigee_environment_keystore" { name = "tf-test-keystore%{random_suffix}" - env_id = google_apigee_environment.<%= ctx[:primary_resource_id] %>.id + env_id = google_apigee_environment.{{$.PrimaryResourceId}}.id } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_basic.tf.tmpl index b1d659831ecb..522dcf1a3d13 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_basic.tf.tmpl @@ -43,7 +43,7 @@ resource "google_apigee_instance_attachment" "apigee_instance_attachment" { environment = google_apigee_environment.apigee_environment.name } -resource "google_apigee_environment_keyvaluemaps" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment_keyvaluemaps" "{{$.PrimaryResourceId}}" { env_id = google_apigee_environment.apigee_environment.id name = "tf-test-env-kvms" depends_on = [ diff --git a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_beta_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_beta_test.tf.tmpl index 7213832df9da..aa204c22c688 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_beta_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_beta_test.tf.tmpl @@ -3,8 +3,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -161,7 +161,7 @@ resource "google_apigee_instance_attachment" "apigee_instance_attachment" { environment = google_apigee_environment.apigee_environment.name } -resource "google_apigee_environment_keyvaluemaps" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment_keyvaluemaps" "{{$.PrimaryResourceId}}" { provider = google-beta env_id = google_apigee_environment.apigee_environment.id diff --git a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_basic.tf.tmpl index 2eaac2c37cf7..ce759adf46ed 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_basic.tf.tmpl @@ -54,7 +54,7 @@ resource "google_apigee_environment_keyvaluemaps" "apigee_environment_keyvaluema ] } -resource "google_apigee_environment_keyvaluemaps_entries" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment_keyvaluemaps_entries" "{{$.PrimaryResourceId}}" { env_keyvaluemap_id = google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps.id name = "testName" value = "testValue" diff --git a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_beta_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_beta_test.tf.tmpl index 72ca49b02b26..c7b3f6bf134c 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_beta_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_beta_test.tf.tmpl @@ -3,8 +3,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -174,7 +174,7 @@ resource "google_apigee_environment_keyvaluemaps" "apigee_environment_keyvaluema ] } -resource "google_apigee_environment_keyvaluemaps_entries" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment_keyvaluemaps_entries" "{{$.PrimaryResourceId}}" { provider = google-beta env_keyvaluemap_id = google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps.id diff --git a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_test.tf.tmpl index f6bbb38cc7ae..f70f639f2a54 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_entries_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test-%{random_suffix}" name = "tf-test-%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -96,7 +96,7 @@ resource "google_apigee_environment_keyvaluemaps" "apigee_environment_keyvaluema ] } -resource "google_apigee_environment_keyvaluemaps_entries" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment_keyvaluemaps_entries" "{{$.PrimaryResourceId}}" { env_keyvaluemap_id = google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps.id name = "testName" diff --git a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_test.tf.tmpl index 717e510bef4b..4265a85236f8 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_keyvaluemaps_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test-%{random_suffix}" name = "tf-test-%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -85,7 +85,7 @@ resource "google_apigee_instance_attachment" "apigee_instance_attachment" { environment = google_apigee_environment.apigee_environment.name } -resource "google_apigee_environment_keyvaluemaps" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment_keyvaluemaps" "{{$.PrimaryResourceId}}" { env_id = google_apigee_environment.apigee_environment.id name = "tf-test-env-kvms%{random_suffix}" depends_on = [ diff --git a/mmv1/templates/terraform/examples/apigee_environment_patch_update_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_patch_update_test.tf.tmpl index 0b1c825be8eb..d2bb56710d93 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_patch_update_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_patch_update_test.tf.tmpl @@ -3,8 +3,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -112,7 +112,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment" "{{$.PrimaryResourceId}}" { provider = google-beta org_id = google_apigee_organization.apigee_org.id diff --git a/mmv1/templates/terraform/examples/apigee_environment_reference_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_reference_test.tf.tmpl index 859a687b6c70..2acd802bba19 100644 --- a/mmv1/templates/terraform/examples/apigee_environment_reference_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_environment_reference_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -55,7 +55,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_environment" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id name = "tf-test%{random_suffix}" description = "Apigee Environment" @@ -64,11 +64,11 @@ resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" { resource "google_apigee_env_keystore" "apigee_environment_keystore_1" { name = "tf-test-keystore%{random_suffix}" - env_id = google_apigee_environment.<%= ctx[:primary_resource_id] %>.id + env_id = google_apigee_environment.{{$.PrimaryResourceId}}.id } resource "google_apigee_env_references" "apigee_environment_reference" { - env_id = google_apigee_environment.<%= ctx[:primary_resource_id] %>.id + env_id = google_apigee_environment.{{$.PrimaryResourceId}}.id name = "reference_test" resource_type = "KeyStore" refers = google_apigee_env_keystore.apigee_environment_keystore_1.name diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_type_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_environment_type_test.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/apigee_environment_type_test.tf.tmpl rename to mmv1/templates/terraform/examples/apigee_environment_type_test.tf.tmpl diff --git a/mmv1/templates/terraform/examples/apigee_instance_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_attachment_basic.tf.tmpl index 03566655e653..9c535fae47c7 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_attachment_basic.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -54,19 +54,19 @@ resource "google_apigee_organization" "apigee_org" { } resource "google_apigee_instance" "apigee_ins" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-central1" org_id = google_apigee_organization.apigee_org.id } resource "google_apigee_environment" "apigee_env" { org_id = google_apigee_organization.apigee_org.id - name = "<%= ctx[:vars]['environment_name'] %>" + name = "{{index $.Vars "environment_name"}}" description = "Apigee Environment" display_name = "environment-1" } -resource "google_apigee_instance_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_instance_attachment" "{{$.PrimaryResourceId}}" { instance_id = google_apigee_instance.apigee_instance.id environment = google_apigee_environment.apigee_env.name } diff --git a/mmv1/templates/terraform/examples/apigee_instance_attachment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_attachment_basic_test.tf.tmpl index 3366148622b8..b70cf9d4d3b4 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_attachment_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_attachment_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -73,12 +73,12 @@ resource "google_apigee_environment" "apigee_env_2" { display_name = "tf-test-2-%{random_suffix}" } -resource "google_apigee_instance_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_instance_attachment" "{{$.PrimaryResourceId}}" { instance_id = google_apigee_instance.apigee_instance.id environment = google_apigee_environment.apigee_env.name } -resource "google_apigee_instance_attachment" "<%= ctx[:primary_resource_id] %>_2" { +resource "google_apigee_instance_attachment" "{{$.PrimaryResourceId}}_2" { instance_id = google_apigee_instance.apigee_instance.id environment = google_apigee_environment.apigee_env_2.name } diff --git a/mmv1/templates/terraform/examples/apigee_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_basic.tf.tmpl index f89ac77cd892..72b2b4fe3e6f 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_basic.tf.tmpl @@ -26,7 +26,7 @@ resource "google_apigee_organization" "apigee_org" { } resource "google_apigee_instance" "apigee_instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-central1" org_id = google_apigee_organization.apigee_org.id } diff --git a/mmv1/templates/terraform/examples/apigee_instance_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_basic_test.tf.tmpl index c436664a2c42..2c8e0d988950 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -53,7 +53,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_instance" "{{$.PrimaryResourceId}}" { name = "tf-test%{random_suffix}" location = "us-central1" org_id = google_apigee_organization.apigee_org.id diff --git a/mmv1/templates/terraform/examples/apigee_instance_cidr_range.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_cidr_range.tf.tmpl index e09da5576ee4..4c7a9812c093 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_cidr_range.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_cidr_range.tf.tmpl @@ -26,7 +26,7 @@ resource "google_apigee_organization" "apigee_org" { } resource "google_apigee_instance" "apigee_instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-central1" org_id = google_apigee_organization.apigee_org.id peering_cidr_range = "SLASH_22" diff --git a/mmv1/templates/terraform/examples/apigee_instance_cidr_range_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_cidr_range_test.tf.tmpl index e470b82dbd12..6136c01baeac 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_cidr_range_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_cidr_range_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -53,7 +53,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_instance" "{{$.PrimaryResourceId}}" { name = "tf-test%{random_suffix}" location = "us-central1" org_id = google_apigee_organization.apigee_org.id diff --git a/mmv1/templates/terraform/examples/apigee_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_full.tf.tmpl index 0caead6e431c..068787dd7c7f 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_full.tf.tmpl @@ -60,10 +60,10 @@ resource "google_apigee_organization" "apigee_org" { } resource "google_apigee_instance" "apigee_instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-central1" description = "Terraform-managed Apigee Runtime Instance" - display_name = "<%= ctx[:vars]['instance_name'] %>" + display_name = "{{index $.Vars "instance_name"}}" org_id = google_apigee_organization.apigee_org.id disk_encryption_key_name = google_kms_crypto_key.apigee_key.id } diff --git a/mmv1/templates/terraform/examples/apigee_instance_full_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_full_test.tf.tmpl index 3dd881c9781a..80ee6da8ae87 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_full_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_full_test.tf.tmpl @@ -3,8 +3,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -112,7 +112,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_instance" "{{$.PrimaryResourceId}}" { provider = google-beta name = "tf-test%{random_suffix}" diff --git a/mmv1/templates/terraform/examples/apigee_instance_ip_range.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_ip_range.tf.tmpl index c20eed1b929d..8b7a21079971 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_ip_range.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_ip_range.tf.tmpl @@ -26,7 +26,7 @@ resource "google_apigee_organization" "apigee_org" { } resource "google_apigee_instance" "apigee_instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-central1" org_id = google_apigee_organization.apigee_org.id ip_range = "10.87.8.0/22" diff --git a/mmv1/templates/terraform/examples/apigee_instance_ip_range_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_ip_range_test.tf.tmpl index 15a898bab0fc..edb467cc02f5 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_ip_range_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_ip_range_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -53,7 +53,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_instance" "{{$.PrimaryResourceId}}" { name = "tf-test%{random_suffix}" location = "us-central1" org_id = google_apigee_organization.apigee_org.id diff --git a/mmv1/templates/terraform/examples/apigee_instance_service_attachment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_instance_service_attachment_basic_test.tf.tmpl index e77470b96ec7..22304c65b5f9 100644 --- a/mmv1/templates/terraform/examples/apigee_instance_service_attachment_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_instance_service_attachment_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -153,7 +153,7 @@ resource "google_apigee_organization" "apigee_org" { ] } -resource "google_apigee_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_instance" "{{$.PrimaryResourceId}}" { name = "tf-test%{random_suffix}" location = "us-central1" org_id = google_apigee_organization.apigee_org.id diff --git a/mmv1/templates/terraform/examples/apigee_nat_address_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_nat_address_basic.tf.tmpl index 5cae72d63b9d..c9a6f727ae24 100644 --- a/mmv1/templates/terraform/examples/apigee_nat_address_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_nat_address_basic.tf.tmpl @@ -69,6 +69,6 @@ resource "google_apigee_instance" "apigee_instance" { } resource "google_apigee_nat_address" "apigee-nat" { - name = "<%= ctx[:vars]['nat_address_name'] %>" + name = "{{index $.Vars "nat_address_name"}}" instance_id = google_apigee_instance.apigee_instance.id } diff --git a/mmv1/templates/terraform/examples/apigee_nat_address_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_nat_address_basic_test.tf.tmpl index 7169dabb6715..ce2a4f9206f8 100644 --- a/mmv1/templates/terraform/examples/apigee_nat_address_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_nat_address_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -59,7 +59,7 @@ resource "google_apigee_instance" "apigee_instance" { org_id = google_apigee_organization.apigee_org.id } -resource "google_apigee_nat_address" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_nat_address" "{{$.PrimaryResourceId}}" { name = "tf-test%{random_suffix}" instance_id = google_apigee_instance.apigee_instance.id } diff --git a/mmv1/templates/terraform/examples/apigee_organization_cloud_basic_disable_vpc_peering_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_organization_cloud_basic_disable_vpc_peering_test.tf.tmpl index e9851e1d711a..5b5b6adf8ea2 100644 --- a/mmv1/templates/terraform/examples/apigee_organization_cloud_basic_disable_vpc_peering_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_organization_cloud_basic_disable_vpc_peering_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -11,7 +11,7 @@ resource "google_project_service" "apigee" { service = "apigee.googleapis.com" } -resource "google_apigee_organization" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { description = "Terraform-provisioned basic Apigee Org without VPC Peering." analytics_region = "us-central1" project_id = google_project.project.project_id diff --git a/mmv1/templates/terraform/examples/apigee_organization_cloud_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_organization_cloud_basic_test.tf.tmpl index 632e6fad3f69..508d8899f826 100644 --- a/mmv1/templates/terraform/examples/apigee_organization_cloud_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_organization_cloud_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -43,7 +43,7 @@ resource "google_service_networking_connection" "apigee_vpc_connection" { depends_on = [google_project_service.servicenetworking] } -resource "google_apigee_organization" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { analytics_region = "us-central1" project_id = google_project.project.project_id authorized_network = google_compute_network.apigee_network.id diff --git a/mmv1/templates/terraform/examples/apigee_organization_cloud_full_disable_vpc_peering_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_organization_cloud_full_disable_vpc_peering_test.tf.tmpl index 861e1df05af0..457d32a0aefa 100644 --- a/mmv1/templates/terraform/examples/apigee_organization_cloud_full_disable_vpc_peering_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_organization_cloud_full_disable_vpc_peering_test.tf.tmpl @@ -3,8 +3,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -61,7 +61,7 @@ resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { member = google_project_service_identity.apigee_sa.member } -resource "google_apigee_organization" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { provider = google-beta display_name = "apigee-org" diff --git a/mmv1/templates/terraform/examples/apigee_organization_cloud_full_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_organization_cloud_full_test.tf.tmpl index e6269351d3b7..4e193a9658bc 100644 --- a/mmv1/templates/terraform/examples/apigee_organization_cloud_full_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_organization_cloud_full_test.tf.tmpl @@ -3,8 +3,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -96,7 +96,7 @@ resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { member = google_project_service_identity.apigee_sa.member } -resource "google_apigee_organization" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { provider = google-beta display_name = "apigee-org" diff --git a/mmv1/templates/terraform/examples/apigee_organization_drz_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_organization_drz_test.tf.tmpl index 80579ecccf43..269b2bfe70ba 100644 --- a/mmv1/templates/terraform/examples/apigee_organization_drz_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_organization_drz_test.tf.tmpl @@ -7,8 +7,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -100,7 +100,7 @@ resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { member = google_project_service_identity.apigee_sa.member } -resource "google_apigee_organization" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { provider = google-beta api_consumer_data_location = "europe-central2" diff --git a/mmv1/templates/terraform/examples/apigee_organization_retention_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_organization_retention_test.tf.tmpl index b03974bb8eb1..95f5f38fb758 100644 --- a/mmv1/templates/terraform/examples/apigee_organization_retention_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_organization_retention_test.tf.tmpl @@ -3,8 +3,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -96,7 +96,7 @@ resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { member = google_project_service_identity.apigee_sa.member } -resource "google_apigee_organization" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { provider = google-beta analytics_region = "us-central1" diff --git a/mmv1/templates/terraform/examples/apigee_sync_authorization_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_sync_authorization_basic_test.tf.tmpl index 1f7f12db331d..277bdf85022e 100644 --- a/mmv1/templates/terraform/examples/apigee_sync_authorization_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_sync_authorization_basic_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -20,7 +20,7 @@ resource "google_apigee_organization" "apigee_org" { } resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Service Account" } @@ -30,7 +30,7 @@ resource "google_project_iam_member" "synchronizer-iam" { member = "serviceAccount:${google_service_account.service_account.email}" } -resource "google_apigee_sync_authorization" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_sync_authorization" "{{$.PrimaryResourceId}}" { name = google_apigee_organization.apigee_org.name identities = [ "serviceAccount:${google_service_account.service_account.email}", diff --git a/mmv1/templates/terraform/examples/apigee_target_server_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_target_server_test.tf.tmpl index 130e609676d4..3930cc27ff5a 100644 --- a/mmv1/templates/terraform/examples/apigee_target_server_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_target_server_test.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -62,7 +62,7 @@ resource "google_apigee_environment" "apigee_environment" { display_name = "environment-1" } -resource "google_apigee_target_server" "<%= ctx[:primary_resource_id] %>" { +resource "google_apigee_target_server" "{{$.PrimaryResourceId}}" { name = "tf-test-target-server%{random_suffix}" description = "Apigee Target Server" protocol = "HTTP" diff --git a/mmv1/templates/terraform/examples/apigee_target_server_test_basic.tf.tmpl b/mmv1/templates/terraform/examples/apigee_target_server_test_basic.tf.tmpl index d27abfb85d91..f5d53555ed45 100644 --- a/mmv1/templates/terraform/examples/apigee_target_server_test_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_target_server_test_basic.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -57,13 +57,13 @@ resource "google_apigee_organization" "apigee_org" { resource "google_apigee_environment" "apigee_environment" { org_id = google_apigee_organization.apigee_org.id - name = "<%= ctx[:vars]['environment_name'] %>" + name = "{{index $.Vars "environment_name"}}" description = "Apigee Environment" display_name = "environment-1" } -resource "google_apigee_target_server" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target_server'] %>" +resource "google_apigee_target_server" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target_server"}}" description = "Apigee Target Server" protocol = "HTTP" host = "abc.foo.com" diff --git a/mmv1/templates/terraform/examples/app_engine_application_url_dispatch_rules_basic.tf.tmpl b/mmv1/templates/terraform/examples/app_engine_application_url_dispatch_rules_basic.tf.tmpl index 2bda703ff567..7007e1669cb0 100644 --- a/mmv1/templates/terraform/examples/app_engine_application_url_dispatch_rules_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/app_engine_application_url_dispatch_rules_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_app_engine_application_url_dispatch_rules" "<%= ctx[:primary_resource_id] %>" { +resource "google_app_engine_application_url_dispatch_rules" "{{$.PrimaryResourceId}}" { dispatch_rules { domain = "*" path = "/*" @@ -35,7 +35,7 @@ resource "google_app_engine_standard_app_version" "admin_v3" { } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/app_engine_domain_mapping_basic.tf.tmpl b/mmv1/templates/terraform/examples/app_engine_domain_mapping_basic.tf.tmpl index 30a9c862f290..772894a6a0ee 100644 --- a/mmv1/templates/terraform/examples/app_engine_domain_mapping_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/app_engine_domain_mapping_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_app_engine_domain_mapping" "<%= ctx[:primary_resource_id] %>" { +resource "google_app_engine_domain_mapping" "{{$.PrimaryResourceId}}" { domain_name = "verified-domain.com" ssl_settings { diff --git a/mmv1/templates/terraform/examples/app_engine_firewall_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/app_engine_firewall_rule_basic.tf.tmpl index 07820c92a6c5..65ff5428d7bb 100644 --- a/mmv1/templates/terraform/examples/app_engine_firewall_rule_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/app_engine_firewall_rule_basic.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "my_project" { name = "tf-test-project" - project_id = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/app_engine_flexible_app_version.tf.tmpl b/mmv1/templates/terraform/examples/app_engine_flexible_app_version.tf.tmpl index 032373d7cf44..242bdbd85d13 100644 --- a/mmv1/templates/terraform/examples/app_engine_flexible_app_version.tf.tmpl +++ b/mmv1/templates/terraform/examples/app_engine_flexible_app_version.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "my_project" { - name = "<%= ctx[:vars]['project'] %>" - project_id = "<%= ctx[:vars]['project'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + name = "{{index $.Vars "project"}}" + project_id = "{{index $.Vars "project"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -20,7 +20,7 @@ resource "google_project_service" "service" { resource "google_service_account" "custom_service_account" { project = google_project_service.service.project - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Custom Service Account" } @@ -42,7 +42,7 @@ resource "google_project_iam_member" "storage_viewer" { member = "serviceAccount:${google_service_account.custom_service_account.email}" } -resource "google_app_engine_flexible_app_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_app_engine_flexible_app_version" "{{$.PrimaryResourceId}}" { version_id = "v1" project = google_project_iam_member.gae_api.project service = "default" @@ -99,7 +99,7 @@ resource "google_app_engine_flexible_app_version" "<%= ctx[:primary_resource_id] resource "google_storage_bucket" "bucket" { project = google_project.my_project.project_id - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/app_engine_service_network_settings.tf.tmpl b/mmv1/templates/terraform/examples/app_engine_service_network_settings.tf.tmpl index 3bef5a62a6ef..7491bb7cb3b4 100644 --- a/mmv1/templates/terraform/examples/app_engine_service_network_settings.tf.tmpl +++ b/mmv1/templates/terraform/examples/app_engine_service_network_settings.tf.tmpl @@ -1,5 +1,5 @@ resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } @@ -28,7 +28,7 @@ resource "google_app_engine_standard_app_version" "internalapp" { } } -resource "google_app_engine_service_network_settings" "<%= ctx[:primary_resource_id] %>" { +resource "google_app_engine_service_network_settings" "{{$.PrimaryResourceId}}" { service = google_app_engine_standard_app_version.internalapp.service network_settings { ingress_traffic_allowed = "INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY" diff --git a/mmv1/templates/terraform/examples/app_engine_service_split_traffic.tf.tmpl b/mmv1/templates/terraform/examples/app_engine_service_split_traffic.tf.tmpl index 8e2ff3ecbece..1a52f549116c 100644 --- a/mmv1/templates/terraform/examples/app_engine_service_split_traffic.tf.tmpl +++ b/mmv1/templates/terraform/examples/app_engine_service_split_traffic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } @@ -47,7 +47,7 @@ resource "google_app_engine_standard_app_version" "liveapp_v2" { } } -resource "google_app_engine_service_split_traffic" "<%= ctx[:primary_resource_id] %>" { +resource "google_app_engine_service_split_traffic" "{{$.PrimaryResourceId}}" { service = google_app_engine_standard_app_version.liveapp_v2.service migrate_traffic = false diff --git a/mmv1/templates/terraform/examples/app_engine_standard_app_version.tf.tmpl b/mmv1/templates/terraform/examples/app_engine_standard_app_version.tf.tmpl index 75696c694955..bcbdc13d7683 100644 --- a/mmv1/templates/terraform/examples/app_engine_standard_app_version.tf.tmpl +++ b/mmv1/templates/terraform/examples/app_engine_standard_app_version.tf.tmpl @@ -1,5 +1,5 @@ resource "google_service_account" "custom_service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Custom Service Account" } @@ -15,7 +15,7 @@ resource "google_project_iam_member" "storage_viewer" { member = "serviceAccount:${google_service_account.custom_service_account.email}" } -resource "google_app_engine_standard_app_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_app_engine_standard_app_version" "{{$.PrimaryResourceId}}" { version_id = "v1" service = "myapp" runtime = "nodejs20" @@ -81,7 +81,7 @@ resource "google_app_engine_standard_app_version" "myapp_v2" { } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/apphub_application_basic.tf.tmpl b/mmv1/templates/terraform/examples/apphub_application_basic.tf.tmpl index 7b7c50231dca..1e48d362718a 100644 --- a/mmv1/templates/terraform/examples/apphub_application_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apphub_application_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_apphub_application" "<%= ctx[:primary_resource_id] %>" { +resource "google_apphub_application" "{{$.PrimaryResourceId}}" { location = "us-east1" - application_id = "<%= ctx[:vars]['application_id'] %>" + application_id = "{{index $.Vars "application_id"}}" scope { type = "REGIONAL" } diff --git a/mmv1/templates/terraform/examples/apphub_application_full.tf.tmpl b/mmv1/templates/terraform/examples/apphub_application_full.tf.tmpl index be22ec1d0b4d..daf707b451c5 100644 --- a/mmv1/templates/terraform/examples/apphub_application_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apphub_application_full.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_apphub_application" "<%= ctx[:primary_resource_id] %>" { +resource "google_apphub_application" "{{$.PrimaryResourceId}}" { location = "us-east1" - application_id = "<%= ctx[:vars]['application_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" + application_id = "{{index $.Vars "application_id"}}" + display_name = "{{index $.Vars "display_name"}}" scope { type = "REGIONAL" } - description = "<%= ctx[:vars]['desc'] %>" + description = "{{index $.Vars "desc"}}" attributes { environment { type = "STAGING" @@ -14,16 +14,16 @@ resource "google_apphub_application" "<%= ctx[:primary_resource_id] %>" { type = "MISSION_CRITICAL" } business_owners { - display_name = "<%= ctx[:vars]['business_name'] %>" - email = "<%= ctx[:vars]['business_email'] %>" + display_name = "{{index $.Vars "business_name"}}" + email = "{{index $.Vars "business_email"}}" } developer_owners { - display_name = "<%= ctx[:vars]['developer_name'] %>" - email = "<%= ctx[:vars]['developer_email'] %>" + display_name = "{{index $.Vars "developer_name"}}" + email = "{{index $.Vars "developer_email"}}" } operator_owners { - display_name = "<%= ctx[:vars]['operator_name'] %>" - email = "<%= ctx[:vars]['operator_email'] %>" + display_name = "{{index $.Vars "operator_name"}}" + email = "{{index $.Vars "operator_email"}}" } } } diff --git a/mmv1/templates/terraform/examples/apphub_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/apphub_service_basic.tf.tmpl index 869f7001d19b..0c11196256e0 100644 --- a/mmv1/templates/terraform/examples/apphub_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apphub_service_basic.tf.tmpl @@ -1,16 +1,16 @@ resource "google_apphub_application" "application" { location = "us-central1" - application_id = "<%= ctx[:vars]['application_id'] %>" + application_id = "{{index $.Vars "application_id"}}" scope { type = "REGIONAL" } } resource "google_project" "service_project" { - project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + project_id ="{{index $.Vars "service_project_attachment_id"}}" name = "Service Project" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -44,7 +44,7 @@ resource "time_sleep" "wait_120s_for_resource_ingestion" { create_duration = "120s" } -resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_apphub_service" "{{$.PrimaryResourceId}}" { location = "us-central1" application_id = google_apphub_application.application.application_id service_id = google_compute_forwarding_rule.forwarding_rule.name @@ -57,7 +57,7 @@ resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" { # VPC network resource "google_compute_network" "ilb_network" { - name = "<%= ctx[:vars]['ilb_network'] %>" + name = "{{index $.Vars "ilb_network"}}" project = google_project.service_project.project_id auto_create_subnetworks = false depends_on = [time_sleep.wait_120s] @@ -66,7 +66,7 @@ resource "google_compute_network" "ilb_network" { # backend subnet resource "google_compute_subnetwork" "ilb_subnet" { - name = "<%= ctx[:vars]['ilb_subnet'] %>" + name = "{{index $.Vars "ilb_subnet"}}" project = google_project.service_project.project_id ip_cidr_range = "10.0.1.0/24" region = "us-central1" @@ -75,7 +75,7 @@ resource "google_compute_subnetwork" "ilb_subnet" { # forwarding rule resource "google_compute_forwarding_rule" "forwarding_rule" { - name ="<%= ctx[:vars]['forwarding_rule'] %>" + name ="{{index $.Vars "forwarding_rule"}}" project = google_project.service_project.project_id region = "us-central1" ip_version = "IPV4" @@ -90,7 +90,7 @@ resource "google_compute_forwarding_rule" "forwarding_rule" { # backend service resource "google_compute_region_backend_service" "backend" { - name = "<%= ctx[:vars]['backend_service'] %>" + name = "{{index $.Vars "backend_service"}}" project = google_project.service_project.project_id region = "us-central1" health_checks = [google_compute_health_check.default.id] @@ -98,7 +98,7 @@ resource "google_compute_region_backend_service" "backend" { # health check resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check'] %>" + name = "{{index $.Vars "health_check"}}" project = google_project.service_project.project_id check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/apphub_service_full.tf.tmpl b/mmv1/templates/terraform/examples/apphub_service_full.tf.tmpl index 0a8403c3fbf7..31a52f86769e 100644 --- a/mmv1/templates/terraform/examples/apphub_service_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apphub_service_full.tf.tmpl @@ -1,16 +1,16 @@ resource "google_apphub_application" "application" { location = "us-central1" - application_id = "<%= ctx[:vars]['application_id'] %>" + application_id = "{{index $.Vars "application_id"}}" scope { type = "REGIONAL" } } resource "google_project" "service_project" { - project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + project_id ="{{index $.Vars "service_project_attachment_id"}}" name = "Service Project" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -44,13 +44,13 @@ resource "time_sleep" "wait_120s_for_resource_ingestion" { create_duration = "120s" } -resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_apphub_service" "{{$.PrimaryResourceId}}" { location = "us-central1" application_id = google_apphub_application.application.application_id service_id = google_compute_forwarding_rule.forwarding_rule.name discovered_service = data.google_apphub_discovered_service.catalog-service.name - display_name = "<%= ctx[:vars]['display_name'] %>" - description = "<%= ctx[:vars]['desc'] %>" + display_name = "{{index $.Vars "display_name"}}" + description = "{{index $.Vars "desc"}}" attributes { environment { type = "STAGING" @@ -59,16 +59,16 @@ resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" { type = "MISSION_CRITICAL" } business_owners { - display_name = "<%= ctx[:vars]['business_name'] %>" - email = "<%= ctx[:vars]['business_email'] %>" + display_name = "{{index $.Vars "business_name"}}" + email = "{{index $.Vars "business_email"}}" } developer_owners { - display_name = "<%= ctx[:vars]['developer_name'] %>" - email = "<%= ctx[:vars]['developer_email'] %>" + display_name = "{{index $.Vars "developer_name"}}" + email = "{{index $.Vars "developer_email"}}" } operator_owners { - display_name = "<%= ctx[:vars]['operator_name'] %>" - email = "<%= ctx[:vars]['operator_email'] %>" + display_name = "{{index $.Vars "operator_name"}}" + email = "{{index $.Vars "operator_email"}}" } } } @@ -79,7 +79,7 @@ resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" { # VPC network resource "google_compute_network" "ilb_network" { - name = "<%= ctx[:vars]['ilb_network'] %>" + name = "{{index $.Vars "ilb_network"}}" project = google_project.service_project.project_id auto_create_subnetworks = false depends_on = [time_sleep.wait_120s] @@ -88,7 +88,7 @@ resource "google_compute_network" "ilb_network" { # backend subnet resource "google_compute_subnetwork" "ilb_subnet" { - name = "<%= ctx[:vars]['ilb_subnet'] %>" + name = "{{index $.Vars "ilb_subnet"}}" project = google_project.service_project.project_id ip_cidr_range = "10.0.1.0/24" region = "us-central1" @@ -97,7 +97,7 @@ resource "google_compute_subnetwork" "ilb_subnet" { # forwarding rule resource "google_compute_forwarding_rule" "forwarding_rule" { - name ="<%= ctx[:vars]['forwarding_rule'] %>" + name ="{{index $.Vars "forwarding_rule"}}" project = google_project.service_project.project_id region = "us-central1" ip_version = "IPV4" @@ -112,7 +112,7 @@ resource "google_compute_forwarding_rule" "forwarding_rule" { # backend service resource "google_compute_region_backend_service" "backend" { - name = "<%= ctx[:vars]['backend_service'] %>" + name = "{{index $.Vars "backend_service"}}" project = google_project.service_project.project_id region = "us-central1" health_checks = [google_compute_health_check.default.id] @@ -120,7 +120,7 @@ resource "google_compute_region_backend_service" "backend" { # health check resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check'] %>" + name = "{{index $.Vars "health_check"}}" project = google_project.service_project.project_id check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/apphub_service_project_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/apphub_service_project_attachment_basic.tf.tmpl index 71eb1d7af699..f70836d2f6bb 100644 --- a/mmv1/templates/terraform/examples/apphub_service_project_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apphub_service_project_attachment_basic.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_apphub_service_project_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apphub_service_project_attachment" "{{$.PrimaryResourceId}}" { service_project_attachment_id = google_project.service_project.project_id depends_on = [time_sleep.wait_120s] } resource "google_project" "service_project" { - project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + project_id ="{{index $.Vars "service_project_attachment_id"}}" name = "Service Project" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/apphub_service_project_attachment_full.tf.tmpl b/mmv1/templates/terraform/examples/apphub_service_project_attachment_full.tf.tmpl index bffe2753f026..080cc3ff9072 100644 --- a/mmv1/templates/terraform/examples/apphub_service_project_attachment_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apphub_service_project_attachment_full.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_apphub_service_project_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_apphub_service_project_attachment" "{{$.PrimaryResourceId}}" { service_project_attachment_id = google_project.service_project_full.project_id service_project = google_project.service_project_full.project_id depends_on = [time_sleep.wait_120s] } resource "google_project" "service_project_full" { - project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + project_id ="{{index $.Vars "service_project_attachment_id"}}" name = "Service Project Full" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/apphub_workload_basic.tf.tmpl b/mmv1/templates/terraform/examples/apphub_workload_basic.tf.tmpl index 23ccc6a2e1a0..392395e8017e 100644 --- a/mmv1/templates/terraform/examples/apphub_workload_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/apphub_workload_basic.tf.tmpl @@ -1,16 +1,16 @@ resource "google_apphub_application" "application" { location = "us-central1" - application_id = "<%= ctx[:vars]['application_id'] %>" + application_id = "{{index $.Vars "application_id"}}" scope { type = "REGIONAL" } } resource "google_project" "service_project" { - project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + project_id ="{{index $.Vars "service_project_attachment_id"}}" name = "Service Project" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -44,7 +44,7 @@ resource "time_sleep" "wait_120s_for_resource_ingestion" { create_duration = "120s" } -resource "google_apphub_workload" "<%= ctx[:primary_resource_id] %>" { +resource "google_apphub_workload" "{{$.PrimaryResourceId}}" { location = "us-central1" application_id = google_apphub_application.application.application_id workload_id = google_compute_region_instance_group_manager.mig.name @@ -56,7 +56,7 @@ resource "google_apphub_workload" "<%= ctx[:primary_resource_id] %>" { # VPC network resource "google_compute_network" "ilb_network" { - name = "<%= ctx[:vars]['ilb_network'] %>" + name = "{{index $.Vars "ilb_network"}}" project = google_project.service_project.project_id auto_create_subnetworks = false depends_on = [time_sleep.wait_120s] @@ -64,7 +64,7 @@ resource "google_compute_network" "ilb_network" { # backend subnet resource "google_compute_subnetwork" "ilb_subnet" { - name = "<%= ctx[:vars]['ilb_subnet'] %>" + name = "{{index $.Vars "ilb_subnet"}}" project = google_project.service_project.project_id ip_cidr_range = "10.0.1.0/24" region = "us-central1" @@ -73,7 +73,7 @@ resource "google_compute_subnetwork" "ilb_subnet" { # instance template resource "google_compute_instance_template" "instance_template" { - name = "<%= ctx[:vars]['instance_template'] %>" + name = "{{index $.Vars "instance_template"}}" project = google_project.service_project.project_id machine_type = "e2-small" tags = ["http-server"] @@ -115,7 +115,7 @@ resource "google_compute_instance_template" "instance_template" { } resource "google_compute_region_instance_group_manager" "mig" { - name = "<%= ctx[:vars]['mig'] %>" + name = "{{index $.Vars "mig"}}" project = google_project.service_project.project_id region = "us-central1" version { diff --git a/mmv1/templates/terraform/examples/apphub_workload_full.tf.tmpl b/mmv1/templates/terraform/examples/apphub_workload_full.tf.tmpl index ffc71316e1b5..2a51cfb09d59 100644 --- a/mmv1/templates/terraform/examples/apphub_workload_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/apphub_workload_full.tf.tmpl @@ -1,16 +1,16 @@ resource "google_apphub_application" "application" { location = "us-central1" - application_id = "<%= ctx[:vars]['application_id'] %>" + application_id = "{{index $.Vars "application_id"}}" scope { type = "REGIONAL" } } resource "google_project" "service_project" { - project_id ="<%= ctx[:vars]['service_project_attachment_id'] %>" + project_id ="{{index $.Vars "service_project_attachment_id"}}" name = "Service Project" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -43,13 +43,13 @@ resource "time_sleep" "wait_120s_for_resource_ingestion" { create_duration = "120s" } -resource "google_apphub_workload" "<%= ctx[:primary_resource_id] %>" { +resource "google_apphub_workload" "{{$.PrimaryResourceId}}" { location = "us-central1" application_id = google_apphub_application.application.application_id workload_id = google_compute_region_instance_group_manager.mig.name discovered_workload = data.google_apphub_discovered_workload.catalog-workload.name - display_name = "<%= ctx[:vars]['display_name'] %>" - description = "<%= ctx[:vars]['desc'] %>" + display_name = "{{index $.Vars "display_name"}}" + description = "{{index $.Vars "desc"}}" attributes { environment { type = "STAGING" @@ -58,16 +58,16 @@ resource "google_apphub_workload" "<%= ctx[:primary_resource_id] %>" { type = "MISSION_CRITICAL" } business_owners { - display_name = "<%= ctx[:vars]['business_name'] %>" - email = "<%= ctx[:vars]['business_email'] %>" + display_name = "{{index $.Vars "business_name"}}" + email = "{{index $.Vars "business_email"}}" } developer_owners { - display_name = "<%= ctx[:vars]['developer_name'] %>" - email = "<%= ctx[:vars]['developer_email'] %>" + display_name = "{{index $.Vars "developer_name"}}" + email = "{{index $.Vars "developer_email"}}" } operator_owners { - display_name = "<%= ctx[:vars]['operator_name'] %>" - email = "<%= ctx[:vars]['operator_email'] %>" + display_name = "{{index $.Vars "operator_name"}}" + email = "{{index $.Vars "operator_email"}}" } } } @@ -77,7 +77,7 @@ resource "google_apphub_workload" "<%= ctx[:primary_resource_id] %>" { # VPC network resource "google_compute_network" "ilb_network" { - name = "<%= ctx[:vars]['ilb_network'] %>" + name = "{{index $.Vars "ilb_network"}}" project = google_project.service_project.project_id auto_create_subnetworks = false depends_on = [time_sleep.wait_120s] @@ -85,7 +85,7 @@ resource "google_compute_network" "ilb_network" { # backend subnet resource "google_compute_subnetwork" "ilb_subnet" { - name = "<%= ctx[:vars]['ilb_subnet'] %>" + name = "{{index $.Vars "ilb_subnet"}}" project = google_project.service_project.project_id ip_cidr_range = "10.0.1.0/24" region = "us-central1" @@ -94,7 +94,7 @@ resource "google_compute_subnetwork" "ilb_subnet" { # instance template resource "google_compute_instance_template" "instance_template" { - name = "<%= ctx[:vars]['instance_template'] %>" + name = "{{index $.Vars "instance_template"}}" project = google_project.service_project.project_id machine_type = "e2-small" tags = ["http-server"] @@ -136,7 +136,7 @@ resource "google_compute_instance_template" "instance_template" { } resource "google_compute_region_instance_group_manager" "mig" { - name = "<%= ctx[:vars]['mig'] %>" + name = "{{index $.Vars "mig"}}" project = google_project.service_project.project_id region = "us-central1" version { diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_basic.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_basic.tf.tmpl index 5d0145d426f7..37687acc6960 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "DOCKER" } 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 21b61833f8de..8853964941e1 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_cleanup.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_cleanup.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "DOCKER" cleanup_policy_dry_run = false cleanup_policies { diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_cmek.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_cmek.tf.tmpl index a8a5cfa4230b..872bc29043ab 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_cmek.tf.tmpl @@ -1,16 +1,16 @@ -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" + repository_id = "{{index $.Vars "repository_id"}}" description = "example docker repository with cmek" format = "DOCKER" - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" depends_on = [ google_kms_crypto_key_iam_member.crypto_key ] } resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" } diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_docker.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_docker.tf.tmpl index e718d64f9b29..b7c1bd729542 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_docker.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_docker.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "DOCKER" docker_config { diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote.tf.tmpl index 3ec0b7b3aa5b..a91876f75950 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_remote.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "DOCKER" mode = "REMOTE_REPOSITORY" remote_repository_config { diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_apt.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_apt.tf.tmpl index e1810d2357b8..ddffa4d557c1 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_apt.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_apt.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "APT" mode = "REMOTE_REPOSITORY" remote_repository_config { diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_custom.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_custom.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_custom.tf.tmpl rename to mmv1/templates/terraform/examples/artifact_registry_repository_remote_custom.tf.tmpl diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_docker_custom_with_auth.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_docker_custom_with_auth.tf.tmpl index 94942ac8d073..17a3951db7f6 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_docker_custom_with_auth.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_docker_custom_with_auth.tf.tmpl @@ -1,27 +1,27 @@ data "google_project" "project" {} -resource "google_secret_manager_secret" "<%= ctx[:vars]['secret_resource_id'] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } } -resource "google_secret_manager_secret_version" "<%= ctx[:vars]['secret_resource_id'] %>_version" { - secret = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id - secret_data = "<%= ctx[:vars]['secret_data'] %>" +resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { + secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id + secret_data = "{{index $.Vars "secret_data"}}" } resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id + secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id role = "roles/secretmanager.secretAccessor" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" } -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "DOCKER" mode = "REMOTE_REPOSITORY" remote_repository_config { @@ -34,8 +34,8 @@ resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %> } upstream_credentials { username_password_credentials { - username = "<%= ctx[:vars]['username'] %>" - password_secret_version = google_secret_manager_secret_version.<%= ctx[:vars]['secret_resource_id'] %>_version.name + username = "{{index $.Vars "username"}}" + password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name } } } diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_dockerhub_auth.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_dockerhub_auth.tf.tmpl index fe47b73a605d..e005c0e8ed59 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_dockerhub_auth.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_dockerhub_auth.tf.tmpl @@ -1,27 +1,27 @@ data "google_project" "project" {} -resource "google_secret_manager_secret" "<%= ctx[:vars]['secret_resource_id'] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } } -resource "google_secret_manager_secret_version" "<%= ctx[:vars]['secret_resource_id'] %>_version" { - secret = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id - secret_data = "<%= ctx[:vars]['secret_data'] %>" +resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { + secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id + secret_data = "{{index $.Vars "secret_data"}}" } resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id + secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id role = "roles/secretmanager.secretAccessor" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" } -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "DOCKER" mode = "REMOTE_REPOSITORY" remote_repository_config { @@ -32,8 +32,8 @@ resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %> } upstream_credentials { username_password_credentials { - username = "<%= ctx[:vars]['username'] %>" - password_secret_version = google_secret_manager_secret_version.<%= ctx[:vars]['secret_resource_id'] %>_version.name + username = "{{index $.Vars "username"}}" + password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name } } } diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_maven_custom_with_auth.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_maven_custom_with_auth.tf.tmpl index e6f31910b16b..e259ae40a08e 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_maven_custom_with_auth.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_maven_custom_with_auth.tf.tmpl @@ -1,27 +1,27 @@ data "google_project" "project" {} -resource "google_secret_manager_secret" "<%= ctx[:vars]['secret_resource_id'] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } } -resource "google_secret_manager_secret_version" "<%= ctx[:vars]['secret_resource_id'] %>_version" { - secret = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id - secret_data = "<%= ctx[:vars]['secret_data'] %>" +resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { + secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id + secret_data = "{{index $.Vars "secret_data"}}" } resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id + secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id role = "roles/secretmanager.secretAccessor" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" } -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "MAVEN" mode = "REMOTE_REPOSITORY" remote_repository_config { @@ -34,8 +34,8 @@ resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %> } upstream_credentials { username_password_credentials { - username = "<%= ctx[:vars]['username'] %>" - password_secret_version = google_secret_manager_secret_version.<%= ctx[:vars]['secret_resource_id'] %>_version.name + username = "{{index $.Vars "username"}}" + password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name } } } diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_npm_custom_with_auth.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_npm_custom_with_auth.tf.tmpl index cde2d86b8336..8606714a3644 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_npm_custom_with_auth.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_npm_custom_with_auth.tf.tmpl @@ -1,27 +1,27 @@ data "google_project" "project" {} -resource "google_secret_manager_secret" "<%= ctx[:vars]['secret_resource_id'] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } } -resource "google_secret_manager_secret_version" "<%= ctx[:vars]['secret_resource_id'] %>_version" { - secret = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id - secret_data = "<%= ctx[:vars]['secret_data'] %>" +resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { + secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id + secret_data = "{{index $.Vars "secret_data"}}" } resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id + secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id role = "roles/secretmanager.secretAccessor" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" } -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "NPM" mode = "REMOTE_REPOSITORY" remote_repository_config { @@ -34,8 +34,8 @@ resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %> } upstream_credentials { username_password_credentials { - username = "<%= ctx[:vars]['username'] %>" - password_secret_version = google_secret_manager_secret_version.<%= ctx[:vars]['secret_resource_id'] %>_version.name + username = "{{index $.Vars "username"}}" + password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name } } } diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_python_custom_with_auth.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_python_custom_with_auth.tf.tmpl index dd633f41199c..fa58182a7b44 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_python_custom_with_auth.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_python_custom_with_auth.tf.tmpl @@ -1,27 +1,27 @@ data "google_project" "project" {} -resource "google_secret_manager_secret" "<%= ctx[:vars]['secret_resource_id'] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } } -resource "google_secret_manager_secret_version" "<%= ctx[:vars]['secret_resource_id'] %>_version" { - secret = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id - secret_data = "<%= ctx[:vars]['secret_data'] %>" +resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { + secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id + secret_data = "{{index $.Vars "secret_data"}}" } resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.<%= ctx[:vars]['secret_resource_id'] %>.id + secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id role = "roles/secretmanager.secretAccessor" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" } -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "PYTHON" mode = "REMOTE_REPOSITORY" remote_repository_config { @@ -34,8 +34,8 @@ resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %> } upstream_credentials { username_password_credentials { - username = "<%= ctx[:vars]['username'] %>" - password_secret_version = google_secret_manager_secret_version.<%= ctx[:vars]['secret_resource_id'] %>_version.name + username = "{{index $.Vars "username"}}" + password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name } } } diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_yum.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_yum.tf.tmpl index 0896665e8af0..dd2bba09cf8f 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_yum.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_yum.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "YUM" mode = "REMOTE_REPOSITORY" remote_repository_config { diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_virtual.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_virtual.tf.tmpl index 35440ca93937..88ce7362dafb 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_repository_virtual.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_virtual.tf.tmpl @@ -1,33 +1,33 @@ -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>-upstream-1" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}-upstream-1" { location = "us-central1" - repository_id = "<%= ctx[:vars]['upstream_repository_id'] %>-1" - description = "<%= ctx[:vars]['upstream_desc'] %> 1" + repository_id = "{{index $.Vars "upstream_repository_id"}}-1" + description = "{{index $.Vars "upstream_desc"}} 1" format = "DOCKER" } -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>-upstream-2" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}-upstream-2" { location = "us-central1" - repository_id = "<%= ctx[:vars]['upstream_repository_id'] %>-2" - description = "<%= ctx[:vars]['upstream_desc'] %> 2" + repository_id = "{{index $.Vars "upstream_repository_id"}}-2" + description = "{{index $.Vars "upstream_desc"}} 2" format = "DOCKER" } -resource "google_artifact_registry_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { depends_on = [] location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" format = "DOCKER" mode = "VIRTUAL_REPOSITORY" virtual_repository_config { upstream_policies { - id = "<%= ctx[:vars]['upstream_policy_id'] %>-1" - repository = google_artifact_registry_repository.<%= ctx[:primary_resource_id] %>-upstream-1.id + id = "{{index $.Vars "upstream_policy_id"}}-1" + repository = google_artifact_registry_repository.{{$.PrimaryResourceId}}-upstream-1.id priority = 20 } upstream_policies { - id = "<%= ctx[:vars]['upstream_policy_id'] %>-2" - repository = google_artifact_registry_repository.<%= ctx[:primary_resource_id] %>-upstream-2.id + id = "{{index $.Vars "upstream_policy_id"}}-2" + repository = google_artifact_registry_repository.{{$.PrimaryResourceId}}-upstream-2.id priority = 10 } } diff --git a/mmv1/templates/terraform/examples/artifact_registry_vpcsc_config.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_vpcsc_config.tf.tmpl index 171b8b725d61..431fb79c9c90 100644 --- a/mmv1/templates/terraform/examples/artifact_registry_vpcsc_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/artifact_registry_vpcsc_config.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_artifact_registry_vpcsc_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_artifact_registry_vpcsc_config" "{{$.PrimaryResourceId}}" { provider = google-beta location = "us-central1" vpcsc_policy = "ALLOW" diff --git a/mmv1/templates/terraform/examples/autoscaler_basic.tf.tmpl b/mmv1/templates/terraform/examples/autoscaler_basic.tf.tmpl index 4fa3e5936652..d9854df5960b 100644 --- a/mmv1/templates/terraform/examples/autoscaler_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/autoscaler_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_autoscaler" "foobar" { - name = "<%= ctx[:vars]['autoscaler_name'] %>" + name = "{{index $.Vars "autoscaler_name"}}" zone = "us-central1-f" target = google_compute_instance_group_manager.foobar.id @@ -15,7 +15,7 @@ resource "google_compute_autoscaler" "foobar" { } resource "google_compute_instance_template" "foobar" { - name = "<%= ctx[:vars]['instance_template_name'] %>" + name = "{{index $.Vars "instance_template_name"}}" machine_type = "e2-medium" can_ip_forward = false @@ -39,11 +39,11 @@ resource "google_compute_instance_template" "foobar" { } resource "google_compute_target_pool" "foobar" { - name = "<%= ctx[:vars]['target_pool_name'] %>" + name = "{{index $.Vars "target_pool_name"}}" } resource "google_compute_instance_group_manager" "foobar" { - name = "<%= ctx[:vars]['igm_name'] %>" + name = "{{index $.Vars "igm_name"}}" zone = "us-central1-f" version { diff --git a/mmv1/templates/terraform/examples/autoscaler_single_instance.tf.tmpl b/mmv1/templates/terraform/examples/autoscaler_single_instance.tf.tmpl index a2662d72ba3b..728f2e2416d2 100644 --- a/mmv1/templates/terraform/examples/autoscaler_single_instance.tf.tmpl +++ b/mmv1/templates/terraform/examples/autoscaler_single_instance.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_autoscaler" "<%= ctx[:primary_resource_id] %>" { - provider = <%= ctx[:vars]['provider_name']%> +resource "google_compute_autoscaler" "{{$.PrimaryResourceId}}" { + provider = {{index $.Vars "provider_name"}} - name = "<%= ctx[:vars]['autoscaler_name'] %>" + name = "{{index $.Vars "autoscaler_name"}}" zone = "us-central1-f" target = google_compute_instance_group_manager.default.id @@ -19,9 +19,9 @@ resource "google_compute_autoscaler" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_instance_template" "default" { - provider = <%= ctx[:vars]['provider_name']%> + provider = {{index $.Vars "provider_name"}} - name = "<%= ctx[:vars]['instance_template_name'] %>" + name = "{{index $.Vars "instance_template_name"}}" machine_type = "e2-medium" can_ip_forward = false @@ -45,15 +45,15 @@ resource "google_compute_instance_template" "default" { } resource "google_compute_target_pool" "default" { - provider = <%= ctx[:vars]['provider_name']%> + provider = {{index $.Vars "provider_name"}} - name = "<%= ctx[:vars]['target_pool_name'] %>" + name = "{{index $.Vars "target_pool_name"}}" } resource "google_compute_instance_group_manager" "default" { - provider = <%= ctx[:vars]['provider_name']%> + provider = {{index $.Vars "provider_name"}} - name = "<%= ctx[:vars]['igm_name'] %>" + name = "{{index $.Vars "igm_name"}}" zone = "us-central1-f" version { @@ -66,7 +66,7 @@ resource "google_compute_instance_group_manager" "default" { } data "google_compute_image" "debian_9" { - provider = <%= ctx[:vars]['provider_name']%> + provider = {{index $.Vars "provider_name"}} family = "debian-11" project = "debian-cloud" @@ -75,5 +75,5 @@ data "google_compute_image" "debian_9" { provider "google-beta" { region = "us-central1" zone = "us-central1-a" - <%= ctx[:vars]['provider_alias']%> + {{index $.Vars "provider_alias"}} } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/backend_bucket_basic.tf.tmpl b/mmv1/templates/terraform/examples/backend_bucket_basic.tf.tmpl index 06496f64bbb3..fa229adbef50 100644 --- a/mmv1/templates/terraform/examples/backend_bucket_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_bucket_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_backend_bucket" "image_backend" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" + name = "{{index $.Vars "backend_bucket_name"}}" description = "Contains beautiful images" bucket_name = google_storage_bucket.image_bucket.name enable_cdn = true } resource "google_storage_bucket" "image_bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "EU" } diff --git a/mmv1/templates/terraform/examples/backend_bucket_bypass_cache.tf.tmpl b/mmv1/templates/terraform/examples/backend_bucket_bypass_cache.tf.tmpl index 7220ea0e41c2..0c1072b209ac 100644 --- a/mmv1/templates/terraform/examples/backend_bucket_bypass_cache.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_bucket_bypass_cache.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" +resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_bucket_name"}}" description = "Contains beautiful images" bucket_name = google_storage_bucket.image_bucket.name enable_cdn = true @@ -11,6 +11,6 @@ resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { } resource "google_storage_bucket" "image_bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "EU" } diff --git a/mmv1/templates/terraform/examples/backend_bucket_coalescing.tf.tmpl b/mmv1/templates/terraform/examples/backend_bucket_coalescing.tf.tmpl index e9ccedf5d231..aedcc7568d37 100644 --- a/mmv1/templates/terraform/examples/backend_bucket_coalescing.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_bucket_coalescing.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" +resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_bucket_name"}}" description = "Contains beautiful images" bucket_name = google_storage_bucket.image_bucket.name enable_cdn = true @@ -9,6 +9,6 @@ resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { } resource "google_storage_bucket" "image_bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "EU" } diff --git a/mmv1/templates/terraform/examples/backend_bucket_full.tf.tmpl b/mmv1/templates/terraform/examples/backend_bucket_full.tf.tmpl index 8b8dcdae7e6b..83fa0b7c308b 100644 --- a/mmv1/templates/terraform/examples/backend_bucket_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_bucket_full.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" +resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_bucket_name"}}" description = "Contains beautiful beta mages" - bucket_name = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket_name = google_storage_bucket.{{$.PrimaryResourceId}}.name enable_cdn = true cdn_policy { cache_mode = "CACHE_ALL_STATIC" @@ -16,7 +16,7 @@ resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { ] } -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['bucket_name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "bucket_name"}}" location = "EU" } diff --git a/mmv1/templates/terraform/examples/backend_bucket_include_http_headers.tf.tmpl b/mmv1/templates/terraform/examples/backend_bucket_include_http_headers.tf.tmpl index 2845d5a61708..476c03f35ca4 100644 --- a/mmv1/templates/terraform/examples/backend_bucket_include_http_headers.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_bucket_include_http_headers.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" +resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_bucket_name"}}" description = "Contains beautiful images" bucket_name = google_storage_bucket.image_bucket.name enable_cdn = true @@ -11,6 +11,6 @@ resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { } resource "google_storage_bucket" "image_bucket" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" + name = "{{index $.Vars "backend_bucket_name"}}" location = "EU" } diff --git a/mmv1/templates/terraform/examples/backend_bucket_query_string_whitelist.tf.tmpl b/mmv1/templates/terraform/examples/backend_bucket_query_string_whitelist.tf.tmpl index f4151212ec95..7a424d5b1729 100644 --- a/mmv1/templates/terraform/examples/backend_bucket_query_string_whitelist.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_bucket_query_string_whitelist.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" +resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_bucket_name"}}" description = "Contains beautiful images" bucket_name = google_storage_bucket.image_bucket.name enable_cdn = true @@ -11,6 +11,6 @@ resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { } resource "google_storage_bucket" "image_bucket" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" + name = "{{index $.Vars "backend_bucket_name"}}" location = "EU" } diff --git a/mmv1/templates/terraform/examples/backend_bucket_security_policy.tf.tmpl b/mmv1/templates/terraform/examples/backend_bucket_security_policy.tf.tmpl index 652b91e7f3aa..6b1f2962dc3c 100644 --- a/mmv1/templates/terraform/examples/backend_bucket_security_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_bucket_security_policy.tf.tmpl @@ -1,18 +1,18 @@ -resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" +resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_bucket_name"}}" description = "Contains beautiful images" - bucket_name = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket_name = google_storage_bucket.{{$.PrimaryResourceId}}.name enable_cdn = true edge_security_policy = google_compute_security_policy.policy.id } -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['bucket_name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "bucket_name"}}" location = "EU" } resource "google_compute_security_policy" "policy" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" description = "basic security policy" type = "CLOUD_ARMOR_EDGE" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/backend_bucket_signed_url_key.tf.tmpl b/mmv1/templates/terraform/examples/backend_bucket_signed_url_key.tf.tmpl index 86219d88c941..7f936cd2164b 100644 --- a/mmv1/templates/terraform/examples/backend_bucket_signed_url_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_bucket_signed_url_key.tf.tmpl @@ -3,19 +3,19 @@ resource "random_id" "url_signature" { } resource "google_compute_backend_bucket_signed_url_key" "backend_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_value = random_id.url_signature.b64_url backend_bucket = google_compute_backend_bucket.test_backend.name } resource "google_compute_backend_bucket" "test_backend" { - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" description = "Contains beautiful images" bucket_name = google_storage_bucket.bucket.name enable_cdn = true } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "EU" } diff --git a/mmv1/templates/terraform/examples/backend_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_basic.tf.tmpl index f46281cdb9ce..bdd4e9cf799f 100644 --- a/mmv1/templates/terraform/examples/backend_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_basic.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/backend_service_cache.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_cache.tf.tmpl index 7d5cabb2a390..6ad4c2c26738 100644 --- a/mmv1/templates/terraform/examples/backend_service_cache.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_cache.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] enable_cdn = true cdn_policy { @@ -13,7 +13,7 @@ resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/backend_service_cache_bypass_cache_on_request_headers.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_cache_bypass_cache_on_request_headers.tf.tmpl index 5ff4ee1e6c75..63b1a6000463 100644 --- a/mmv1/templates/terraform/examples/backend_service_cache_bypass_cache_on_request_headers.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_cache_bypass_cache_on_request_headers.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] enable_cdn = true cdn_policy { @@ -21,7 +21,7 @@ resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/backend_service_cache_include_http_headers.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_cache_include_http_headers.tf.tmpl index 8080268b4b80..b1b74eef6997 100644 --- a/mmv1/templates/terraform/examples/backend_service_cache_include_http_headers.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_cache_include_http_headers.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" enable_cdn = true cdn_policy { cache_mode = "USE_ORIGIN_HEADERS" diff --git a/mmv1/templates/terraform/examples/backend_service_cache_include_named_cookies.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_cache_include_named_cookies.tf.tmpl index ba32f5dff289..13bb8966b56b 100644 --- a/mmv1/templates/terraform/examples/backend_service_cache_include_named_cookies.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_cache_include_named_cookies.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" enable_cdn = true cdn_policy { cache_mode = "CACHE_ALL_STATIC" diff --git a/mmv1/templates/terraform/examples/backend_service_cache_simple.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_cache_simple.tf.tmpl index 3e1f168e1d58..8d9d34d1cc54 100644 --- a/mmv1/templates/terraform/examples/backend_service_cache_simple.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_cache_simple.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] enable_cdn = true cdn_policy { @@ -8,7 +8,7 @@ resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/backend_service_external_iap.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_external_iap.tf.tmpl index cf264f8565ca..f2da2681ca83 100644 --- a/mmv1/templates/terraform/examples/backend_service_external_iap.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_external_iap.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" protocol = "HTTP" load_balancing_scheme = "EXTERNAL" iap { diff --git a/mmv1/templates/terraform/examples/backend_service_external_managed.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_external_managed.tf.tmpl index 4b66fbbea881..800fcf72bb71 100644 --- a/mmv1/templates/terraform/examples/backend_service_external_managed.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_external_managed.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_health_check.default.id] load_balancing_scheme = "EXTERNAL_MANAGED" } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/backend_service_network_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_network_endpoint.tf.tmpl index 5d408ed4bea3..395b563567ed 100644 --- a/mmv1/templates/terraform/examples/backend_service_network_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_network_endpoint.tf.tmpl @@ -1,6 +1,6 @@ resource "google_compute_global_network_endpoint_group" "external_proxy" { provider = google-beta - name = "<%= ctx[:vars]['neg_name'] %>" + name = "{{index $.Vars "neg_name"}}" network_endpoint_type = "INTERNET_FQDN_PORT" default_port = "443" } @@ -12,9 +12,9 @@ resource "google_compute_global_network_endpoint" "proxy" { port = google_compute_global_network_endpoint_group.external_proxy.default_port } -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" enable_cdn = true timeout_sec = 10 connection_draining_timeout_sec = 10 diff --git a/mmv1/templates/terraform/examples/backend_service_signed_url_key.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_signed_url_key.tf.tmpl index afdca1cc464d..0e27e701055d 100644 --- a/mmv1/templates/terraform/examples/backend_service_signed_url_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_signed_url_key.tf.tmpl @@ -3,13 +3,13 @@ resource "random_id" "url_signature" { } resource "google_compute_backend_service_signed_url_key" "backend_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_value = random_id.url_signature.b64_url backend_service = google_compute_backend_service.example_backend.name } resource "google_compute_backend_service" "example_backend" { - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" description = "Our company website" port_name = "http" protocol = "HTTP" @@ -24,7 +24,7 @@ resource "google_compute_backend_service" "example_backend" { } resource "google_compute_instance_group_manager" "webservers" { - name = "<%= ctx[:vars]['igm_name'] %>" + name = "{{index $.Vars "igm_name"}}" version { instance_template = google_compute_instance_template.webserver.id diff --git a/mmv1/templates/terraform/examples/backend_service_traffic_director_ring_hash.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_traffic_director_ring_hash.tf.tmpl index d8409f7aed23..f40a7b76345c 100644 --- a/mmv1/templates/terraform/examples/backend_service_traffic_director_ring_hash.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_traffic_director_ring_hash.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_health_check.health_check.id] load_balancing_scheme = "INTERNAL_SELF_MANAGED" locality_lb_policy = "RING_HASH" @@ -34,7 +34,7 @@ resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_health_check" "health_check" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/backend_service_traffic_director_round_robin.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_traffic_director_round_robin.tf.tmpl index e45e8f354ba8..7645808bc4cc 100644 --- a/mmv1/templates/terraform/examples/backend_service_traffic_director_round_robin.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_traffic_director_round_robin.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_health_check.health_check.id] load_balancing_scheme = "INTERNAL_SELF_MANAGED" locality_lb_policy = "ROUND_ROBIN" @@ -10,7 +10,7 @@ resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_health_check" "health_check" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/backend_service_unspecified_protocol_simple.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_unspecified_protocol_simple.tf.tmpl index 7eae6686236a..4cb46f314166 100644 --- a/mmv1/templates/terraform/examples/backend_service_unspecified_protocol_simple.tf.tmpl +++ b/mmv1/templates/terraform/examples/backend_service_unspecified_protocol_simple.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backend_service_name'] %>" +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] protocol = "UNSPECIFIED" region = "us-central1" @@ -8,7 +8,7 @@ resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl b/mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl index 58e1aaff5519..a2bf023066c1 100644 --- a/mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_backup_dr_backup_vault" "<%= ctx[:primary_resource_id] %>" { +resource "google_backup_dr_backup_vault" "{{$.PrimaryResourceId}}" { provider = google-beta location = "us-central1" - backup_vault_id = "<%= ctx[:vars]['backup_vault_id'] %>" + backup_vault_id = "{{index $.Vars "backup_vault_id"}}" description = "This is a second backup vault built by Terraform." backup_minimum_enforced_retention_duration = "100000s" labels = { diff --git a/mmv1/templates/terraform/examples/backup_dr_management_server.tf.tmpl b/mmv1/templates/terraform/examples/backup_dr_management_server.tf.tmpl index e0e9425eafd1..d5187f9a7a7a 100644 --- a/mmv1/templates/terraform/examples/backup_dr_management_server.tf.tmpl +++ b/mmv1/templates/terraform/examples/backup_dr_management_server.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "private_ip_address" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 20 @@ -19,10 +19,10 @@ resource "google_service_networking_connection" "default" { reserved_peering_ranges = [google_compute_global_address.private_ip_address.name] } -resource "google_backup_dr_management_server" "<%= ctx[:primary_resource_id] %>" { +resource "google_backup_dr_management_server" "{{$.PrimaryResourceId}}" { provider = google-beta location = "us-central1" - name = "<%= ctx[:vars]['managementserver_name'] %>" + name = "{{index $.Vars "managementserver_name"}}" type = "BACKUP_RESTORE" networks { network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/backup_dr_management_server_test.tf.tmpl b/mmv1/templates/terraform/examples/backup_dr_management_server_test.tf.tmpl index eb2c1c8a3ce4..482af3421f94 100644 --- a/mmv1/templates/terraform/examples/backup_dr_management_server_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/backup_dr_management_server_test.tf.tmpl @@ -1,12 +1,12 @@ data "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } -resource "google_backup_dr_management_server" "<%= ctx[:primary_resource_id] %>" { +resource "google_backup_dr_management_server" "{{$.PrimaryResourceId}}" { provider = google-beta location = "us-central1" - name = "<%= ctx[:vars]['managementserver_name'] %>" + name = "{{index $.Vars "managementserver_name"}}" type = "BACKUP_RESTORE" networks { network = data.google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/beyondcorp_app_connection_basic.tf.tmpl b/mmv1/templates/terraform/examples/beyondcorp_app_connection_basic.tf.tmpl index d38c298bf2db..1a995efb4be7 100644 --- a/mmv1/templates/terraform/examples/beyondcorp_app_connection_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/beyondcorp_app_connection_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Test Service Account" } resource "google_beyondcorp_app_connector" "app_connector" { - name = "<%= ctx[:vars]['app_connector_name'] %>" + name = "{{index $.Vars "app_connector_name"}}" principal_info { service_account { email = google_service_account.service_account.email @@ -12,8 +12,8 @@ resource "google_beyondcorp_app_connector" "app_connector" { } } -resource "google_beyondcorp_app_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['app_connection_name'] %>" +resource "google_beyondcorp_app_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "app_connection_name"}}" type = "TCP_PROXY" application_endpoint { host = "foo-host" diff --git a/mmv1/templates/terraform/examples/beyondcorp_app_connection_full.tf.tmpl b/mmv1/templates/terraform/examples/beyondcorp_app_connection_full.tf.tmpl index de3700ffbfbe..9224d30b34ef 100644 --- a/mmv1/templates/terraform/examples/beyondcorp_app_connection_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/beyondcorp_app_connection_full.tf.tmpl @@ -1,16 +1,16 @@ resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Test Service Account" } resource "google_beyondcorp_app_gateway" "app_gateway" { - name = "<%= ctx[:vars]['app_gateway_name'] %>" + name = "{{index $.Vars "app_gateway_name"}}" type = "TCP_PROXY" host_type = "GCP_REGIONAL_MIG" } resource "google_beyondcorp_app_connector" "app_connector" { - name = "<%= ctx[:vars]['app_connector_name'] %>" + name = "{{index $.Vars "app_connector_name"}}" principal_info { service_account { email = google_service_account.service_account.email @@ -18,10 +18,10 @@ resource "google_beyondcorp_app_connector" "app_connector" { } } -resource "google_beyondcorp_app_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['app_connection_name'] %>" +resource "google_beyondcorp_app_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "app_connection_name"}}" type = "TCP_PROXY" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" application_endpoint { host = "foo-host" port = 8080 diff --git a/mmv1/templates/terraform/examples/beyondcorp_app_connector_basic.tf.tmpl b/mmv1/templates/terraform/examples/beyondcorp_app_connector_basic.tf.tmpl index 7283a1e85895..c789654397f2 100644 --- a/mmv1/templates/terraform/examples/beyondcorp_app_connector_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/beyondcorp_app_connector_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Test Service Account" } -resource "google_beyondcorp_app_connector" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['app_connector_name'] %>" +resource "google_beyondcorp_app_connector" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "app_connector_name"}}" principal_info { service_account { email = google_service_account.service_account.email diff --git a/mmv1/templates/terraform/examples/beyondcorp_app_connector_full.tf.tmpl b/mmv1/templates/terraform/examples/beyondcorp_app_connector_full.tf.tmpl index 0c7b0ec7f9f6..2db536b85952 100644 --- a/mmv1/templates/terraform/examples/beyondcorp_app_connector_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/beyondcorp_app_connector_full.tf.tmpl @@ -1,12 +1,12 @@ resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Test Service Account" } -resource "google_beyondcorp_app_connector" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['app_connector_name'] %>" +resource "google_beyondcorp_app_connector" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "app_connector_name"}}" region = "us-central1" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" principal_info { service_account { email = google_service_account.service_account.email diff --git a/mmv1/templates/terraform/examples/beyondcorp_app_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/beyondcorp_app_gateway_basic.tf.tmpl index d2fc02495768..cd1efb307100 100644 --- a/mmv1/templates/terraform/examples/beyondcorp_app_gateway_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/beyondcorp_app_gateway_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_beyondcorp_app_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['app_gateway_name'] %>" +resource "google_beyondcorp_app_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "app_gateway_name"}}" type = "TCP_PROXY" region = "us-central1" host_type = "GCP_REGIONAL_MIG" diff --git a/mmv1/templates/terraform/examples/beyondcorp_app_gateway_full.tf.tmpl b/mmv1/templates/terraform/examples/beyondcorp_app_gateway_full.tf.tmpl index dc12eba23422..64ab719c2693 100644 --- a/mmv1/templates/terraform/examples/beyondcorp_app_gateway_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/beyondcorp_app_gateway_full.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_beyondcorp_app_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['app_gateway_name'] %>" +resource "google_beyondcorp_app_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "app_gateway_name"}}" type = "TCP_PROXY" region = "us-central1" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" labels = { foo = "bar" bar = "baz" diff --git a/mmv1/templates/terraform/examples/biglake_database.tf.tmpl b/mmv1/templates/terraform/examples/biglake_database.tf.tmpl index 26ebfb26d95b..bfeed43c4997 100644 --- a/mmv1/templates/terraform/examples/biglake_database.tf.tmpl +++ b/mmv1/templates/terraform/examples/biglake_database.tf.tmpl @@ -1,10 +1,10 @@ resource "google_biglake_catalog" "catalog" { - name = "<%= ctx[:vars]['catalog_id'] %>" + name = "{{index $.Vars "catalog_id"}}" location = "US" } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_id'] %>" + name = "{{index $.Vars "bucket_id"}}" location = "US" force_destroy = true uniform_bucket_level_access = true @@ -16,8 +16,8 @@ resource "google_storage_bucket_object" "metadata_folder" { bucket = google_storage_bucket.bucket.name } -resource "google_biglake_database" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_biglake_database" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" catalog = google_biglake_catalog.catalog.id type = "HIVE" hive_options { diff --git a/mmv1/templates/terraform/examples/biglake_table.tf.tmpl b/mmv1/templates/terraform/examples/biglake_table.tf.tmpl index e64af6fbf2b0..69c554130d00 100644 --- a/mmv1/templates/terraform/examples/biglake_table.tf.tmpl +++ b/mmv1/templates/terraform/examples/biglake_table.tf.tmpl @@ -1,10 +1,10 @@ resource "google_biglake_catalog" "catalog" { - name = "<%= ctx[:vars]['catalog'] %>" + name = "{{index $.Vars "catalog"}}" location = "US" } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket'] %>" + name = "{{index $.Vars "bucket"}}" location = "US" force_destroy = true uniform_bucket_level_access = true @@ -24,7 +24,7 @@ resource "google_storage_bucket_object" "data_folder" { } resource "google_biglake_database" "database" { - name = "<%= ctx[:vars]['database'] %>" + name = "{{index $.Vars "database"}}" catalog = google_biglake_catalog.catalog.id type = "HIVE" hive_options { @@ -35,8 +35,8 @@ resource "google_biglake_database" "database" { } } -resource "google_biglake_table" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_biglake_table" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" database = google_biglake_database.database.id type = "HIVE" hive_options { diff --git a/mmv1/templates/terraform/examples/bigquery_analyticshub_data_exchange_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_analyticshub_data_exchange_basic.tf.tmpl index 691eddb35fe1..54cb026c6177 100644 --- a/mmv1/templates/terraform/examples/bigquery_analyticshub_data_exchange_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_analyticshub_data_exchange_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_bigquery_analytics_hub_data_exchange" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_analytics_hub_data_exchange" "{{$.PrimaryResourceId}}" { location = "US" - data_exchange_id = "<%= ctx[:vars]['data_exchange_id'] %>" - display_name = "<%= ctx[:vars]['data_exchange_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + data_exchange_id = "{{index $.Vars "data_exchange_id"}}" + display_name = "{{index $.Vars "data_exchange_id"}}" + description = "{{index $.Vars "desc"}}" } diff --git a/mmv1/templates/terraform/examples/bigquery_analyticshub_data_exchange_dcr.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_analyticshub_data_exchange_dcr.tf.tmpl index 456ba8a564ed..bc26d58a9a52 100644 --- a/mmv1/templates/terraform/examples/bigquery_analyticshub_data_exchange_dcr.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_analyticshub_data_exchange_dcr.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_bigquery_analytics_hub_data_exchange" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_analytics_hub_data_exchange" "{{$.PrimaryResourceId}}" { location = "US" - data_exchange_id = "<%= ctx[:vars]['data_exchange_id'] %>" - display_name = "<%= ctx[:vars]['data_exchange_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + data_exchange_id = "{{index $.Vars "data_exchange_id"}}" + display_name = "{{index $.Vars "data_exchange_id"}}" + description = "{{index $.Vars "desc"}}" sharing_environment_config { dcr_exchange_config {} } diff --git a/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_basic.tf.tmpl index 3c6fefab4b50..b9900df469f8 100644 --- a/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_basic.tf.tmpl @@ -1,25 +1,25 @@ -resource "google_bigquery_analytics_hub_data_exchange" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_analytics_hub_data_exchange" "{{$.PrimaryResourceId}}" { location = "US" - data_exchange_id = "<%= ctx[:vars]['data_exchange_id'] %>" - display_name = "<%= ctx[:vars]['data_exchange_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + 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" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_analytics_hub_listing" "{{$.PrimaryResourceId}}" { location = "US" - data_exchange_id = google_bigquery_analytics_hub_data_exchange.<%= ctx[:primary_resource_id] %>.data_exchange_id - listing_id = "<%= ctx[:vars]['listing_id'] %>" - display_name = "<%= ctx[:vars]['listing_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + 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.<%= ctx[:primary_resource_id] %>.id + dataset = google_bigquery_dataset.{{$.PrimaryResourceId}}.id } } -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['listing_id'] %>" - friendly_name = "<%= ctx[:vars]['listing_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "listing_id"}}" + friendly_name = "{{index $.Vars "listing_id"}}" + description = "{{index $.Vars "desc"}}" location = "US" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_dcr.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_dcr.tf.tmpl index afa60930cc38..1dbf2705cf73 100644 --- a/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_dcr.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_analyticshub_listing_dcr.tf.tmpl @@ -1,24 +1,24 @@ -resource "google_bigquery_analytics_hub_data_exchange" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_analytics_hub_data_exchange" "{{$.PrimaryResourceId}}" { location = "US" - data_exchange_id = "<%= ctx[:vars]['data_exchange_id'] %>" - display_name = "<%= ctx[:vars]['data_exchange_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + data_exchange_id = "{{index $.Vars "data_exchange_id"}}" + display_name = "{{index $.Vars "data_exchange_id"}}" + description = "{{index $.Vars "desc"}}" sharing_environment_config { dcr_exchange_config {} } } -resource "google_bigquery_analytics_hub_listing" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_analytics_hub_listing" "{{$.PrimaryResourceId}}" { location = "US" - data_exchange_id = google_bigquery_analytics_hub_data_exchange.<%= ctx[:primary_resource_id] %>.data_exchange_id - listing_id = "<%= ctx[:vars]['listing_id'] %>" - display_name = "<%= ctx[:vars]['listing_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + 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.<%= ctx[:primary_resource_id] %>.id + dataset = google_bigquery_dataset.{{$.PrimaryResourceId}}.id selected_resources { - table = google_bigquery_table.<%= ctx[:primary_resource_id] %>.id + table = google_bigquery_table.{{$.PrimaryResourceId}}.id } } @@ -27,17 +27,17 @@ resource "google_bigquery_analytics_hub_listing" "<%= ctx[:primary_resource_id] } } -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['listing_id'] %>" - friendly_name = "<%= ctx[:vars]['listing_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" +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_table" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_table" "{{$.PrimaryResourceId}}" { deletion_protection = false - table_id = "<%= ctx[:vars]['listing_id'] %>" - dataset_id = google_bigquery_dataset.<%= ctx[:primary_resource_id] %>.dataset_id + table_id = "{{index $.Vars "listing_id"}}" + dataset_id = google_bigquery_dataset.{{$.PrimaryResourceId}}.dataset_id schema = <" { +resource "google_bigquery_analytics_hub_data_exchange" "{{$.PrimaryResourceId}}" { location = "US" - data_exchange_id = "<%= ctx[:vars]['data_exchange_id'] %>" - display_name = "<%= ctx[:vars]['data_exchange_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + 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" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_analytics_hub_listing" "{{$.PrimaryResourceId}}" { location = "US" - data_exchange_id = google_bigquery_analytics_hub_data_exchange.<%= ctx[:primary_resource_id] %>.data_exchange_id - listing_id = "<%= ctx[:vars]['listing_id'] %>" - display_name = "<%= ctx[:vars]['listing_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" + 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.<%= ctx[:primary_resource_id] %>.id + dataset = google_bigquery_dataset.{{$.PrimaryResourceId}}.id } restricted_export_config { @@ -22,9 +22,9 @@ resource "google_bigquery_analytics_hub_listing" "<%= ctx[:primary_resource_id] } } -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['listing_id'] %>" - friendly_name = "<%= ctx[:vars]['listing_id'] %>" - description = "<%= ctx[:vars]['desc'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "listing_id"}}" + friendly_name = "{{index $.Vars "listing_id"}}" + description = "{{index $.Vars "desc"}}" location = "US" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_biglake_catalog.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_biglake_catalog.tf.tmpl index 0dc494588c9a..10fa62e152b1 100644 --- a/mmv1/templates/terraform/examples/bigquery_biglake_catalog.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_biglake_catalog.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_biglake_catalog" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_biglake_catalog" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/bigquery_bigquery_table.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_bigquery_table.tf.tmpl index b4c15cfa7dd1..7509f607d4ff 100644 --- a/mmv1/templates/terraform/examples/bigquery_bigquery_table.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_bigquery_table.tf.tmpl @@ -1,10 +1,10 @@ resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_table" "test" { deletion_protection = false - table_id = "<%= ctx[:vars]['table_id'] %>" + table_id = "{{index $.Vars "table_id"}}" dataset_id = google_bigquery_dataset.test.dataset_id time_partitioning { type = "DAY" diff --git a/mmv1/templates/terraform/examples/bigquery_connection_aws.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_aws.tf.tmpl index 98a6a46ad1b6..fa54fb8627cf 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_aws.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_aws.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { + connection_id = "{{index $.Vars "connection_id"}}" location = "aws-us-east-1" friendly_name = "👋" description = "a riveting description" aws { access_role { - iam_role_id = "<%= ctx[:vars]['iam_role_id'] %>" + iam_role_id = "{{index $.Vars "iam_role_id"}}" } } } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_connection_azure.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_azure.tf.tmpl index e5986a713085..bc8efa75e904 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_azure.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_azure.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { + connection_id = "{{index $.Vars "connection_id"}}" location = "azure-eastus2" friendly_name = "👋" description = "a riveting description" azure { - customer_tenant_id = "<%= ctx[:vars]['customer_tenant_id'] %>" - federated_application_client_id = "<%= ctx[:vars]['federated_application_client_id'] %>" + customer_tenant_id = "{{index $.Vars "customer_tenant_id"}}" + federated_application_client_id = "{{index $.Vars "federated_application_client_id"}}" } } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_connection_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_basic.tf.tmpl index 4a41cb2f95e1..66ba793e0082 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_basic.tf.tmpl @@ -1,12 +1,12 @@ resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "POSTGRES_11" region = "us-central1" settings { tier = "db-f1-micro" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_database" "db" { @@ -20,12 +20,12 @@ resource "random_password" "pwd" { } resource "google_sql_user" "user" { - name = "<%= ctx[:vars]['username'] %>" + name = "{{index $.Vars "username"}}" instance = google_sql_database_instance.instance.name password = random_password.pwd.result } -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { friendly_name = "👋" description = "a riveting description" location = "US" diff --git a/mmv1/templates/terraform/examples/bigquery_connection_cloud_resource.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_cloud_resource.tf.tmpl index 89454e8f0e29..bbf566f52951 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_cloud_resource.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_cloud_resource.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { + connection_id = "{{index $.Vars "connection_id"}}" location = "US" friendly_name = "👋" description = "a riveting description" diff --git a/mmv1/templates/terraform/examples/bigquery_connection_cloudspanner.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_cloudspanner.tf.tmpl index 6108d5c6152b..13f25c226444 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_cloudspanner.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_cloudspanner.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { + connection_id = "{{index $.Vars "connection_id"}}" location = "US" friendly_name = "👋" description = "a riveting description" cloud_spanner { - database = "<%= ctx[:vars]['database'] %>" - database_role = "<%= ctx[:vars]['database_role'] %>" + database = "{{index $.Vars "database"}}" + database_role = "{{index $.Vars "database_role"}}" } } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_connection_cloudspanner_databoost.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_cloudspanner_databoost.tf.tmpl index dbdf60ff63dc..3960f8e167ac 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_cloudspanner_databoost.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_cloudspanner_databoost.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { + connection_id = "{{index $.Vars "connection_id"}}" location = "US" friendly_name = "👋" description = "a riveting description" cloud_spanner { - database = "<%= ctx[:vars]['database'] %>" + database = "{{index $.Vars "database"}}" use_parallelism = true use_data_boost = true max_parallelism = 100 diff --git a/mmv1/templates/terraform/examples/bigquery_connection_full.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_full.tf.tmpl index d65ecd3b09d9..6e4af5276440 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_full.tf.tmpl @@ -1,12 +1,12 @@ resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "POSTGRES_11" region = "us-central1" settings { tier = "db-f1-micro" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_database" "db" { @@ -20,13 +20,13 @@ resource "random_password" "pwd" { } resource "google_sql_user" "user" { - name = "<%= ctx[:vars]['username'] %>" + name = "{{index $.Vars "username"}}" instance = google_sql_database_instance.instance.name password = random_password.pwd.result } -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { + connection_id = "{{index $.Vars "connection_id"}}" location = "US" friendly_name = "👋" description = "a riveting description" diff --git a/mmv1/templates/terraform/examples/bigquery_connection_kms.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_kms.tf.tmpl index a53b248ad2f0..622ce618e863 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_kms.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_kms.tf.tmpl @@ -1,12 +1,12 @@ resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "POSTGRES_11" region = "us-central1" settings { tier = "db-f1-micro" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_database" "db" { @@ -15,7 +15,7 @@ resource "google_sql_database" "db" { } resource "google_sql_user" "user" { - name = "<%= ctx[:vars]['username'] %>" + name = "{{index $.Vars "username"}}" instance = google_sql_database_instance.instance.name password = "tf-test-my-password%{random_suffix}" } @@ -30,11 +30,11 @@ resource "google_project_iam_member" "key_sa_user" { member = "serviceAccount:${data.google_bigquery_default_service_account.bq_sa.email}" } -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { friendly_name = "👋" description = "a riveting description" location = "US" - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" cloud_sql { instance_id = google_sql_database_instance.instance.connection_name database = google_sql_database.db.name diff --git a/mmv1/templates/terraform/examples/bigquery_connection_spark.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_connection_spark.tf.tmpl index 18fcff706402..c29e54325ff0 100644 --- a/mmv1/templates/terraform/examples/bigquery_connection_spark.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_connection_spark.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" +resource "google_bigquery_connection" "{{$.PrimaryResourceId}}" { + connection_id = "{{index $.Vars "connection_id"}}" location = "US" friendly_name = "👋" description = "a riveting description" @@ -11,7 +11,7 @@ resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" { } resource "google_dataproc_cluster" "basic" { - name = "<%= ctx[:vars]['connection_id'] %>" + name = "{{index $.Vars "connection_id"}}" region = "us-central1" cluster_config { diff --git a/mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_basic.tf.tmpl index 395e8fbac5b3..1a33fae00881 100644 --- a/mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_bigquery_datapolicy_data_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_datapolicy_data_policy" "{{$.PrimaryResourceId}}" { location = "us-central1" - data_policy_id = "<%= ctx[:vars]['data_policy_id'] %>" + data_policy_id = "{{index $.Vars "data_policy_id"}}" policy_tag = google_data_catalog_policy_tag.policy_tag.name data_policy_type = "COLUMN_LEVEL_SECURITY_POLICY" } @@ -13,7 +13,7 @@ resource "google_data_catalog_policy_tag" "policy_tag" { resource "google_data_catalog_taxonomy" "taxonomy" { region = "us-central1" - display_name = "<%= ctx[:vars]['taxonomy'] %>" + display_name = "{{index $.Vars "taxonomy"}}" description = "A collection of policy tags" activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"] } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_routine.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_routine.tf.tmpl index a270ebab8188..2fbca829c1fe 100644 --- a/mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_routine.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_routine.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_bigquery_datapolicy_data_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_datapolicy_data_policy" "{{$.PrimaryResourceId}}" { location = "us-central1" - data_policy_id = "<%= ctx[:vars]['data_policy_id'] %>" + data_policy_id = "{{index $.Vars "data_policy_id"}}" policy_tag = google_data_catalog_policy_tag.policy_tag.name data_policy_type = "DATA_MASKING_POLICY" data_masking_policy { @@ -16,13 +16,13 @@ resource "google_data_catalog_policy_tag" "policy_tag" { resource "google_data_catalog_taxonomy" "taxonomy" { region = "us-central1" - display_name = "<%= ctx[:vars]['taxonomy'] %>" + display_name = "{{index $.Vars "taxonomy"}}" description = "A collection of policy tags" activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"] } resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_dataset.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_dataset.tf.tmpl index b5152f4092dd..b5bfc47b60d6 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_dataset.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_dataset.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_bigquery_dataset_access" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_dataset_access" "{{$.PrimaryResourceId}}" { dataset_id = google_bigquery_dataset.private.dataset_id dataset { dataset{ @@ -10,9 +10,9 @@ resource "google_bigquery_dataset_access" "<%= ctx[:primary_resource_id] %>" { } resource "google_bigquery_dataset" "private" { - dataset_id = "<%= ctx[:vars]['private'] %>" + dataset_id = "{{index $.Vars "private"}}" } resource "google_bigquery_dataset" "public" { - dataset_id = "<%= ctx[:vars]['public'] %>" + dataset_id = "{{index $.Vars "public"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_routine.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_routine.tf.tmpl index 5a615de4892f..cf5d87ec2953 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_routine.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_routine.tf.tmpl @@ -1,11 +1,11 @@ resource "google_bigquery_dataset" "public" { - dataset_id = "<%= ctx[:vars]['public_dataset'] %>" + dataset_id = "{{index $.Vars "public_dataset"}}" description = "This dataset is public" } resource "google_bigquery_routine" "public" { dataset_id = google_bigquery_dataset.public.dataset_id - routine_id = "<%= ctx[:vars]['public_routine'] %>" + routine_id = "{{index $.Vars "public_routine"}}" routine_type = "TABLE_VALUED_FUNCTION" language = "SQL" definition_body = <<-EOS @@ -22,7 +22,7 @@ resource "google_bigquery_routine" "public" { } resource "google_bigquery_dataset" "private" { - dataset_id = "<%= ctx[:vars]['private_dataset'] %>" + dataset_id = "{{index $.Vars "private_dataset"}}" description = "This dataset is private" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_access_basic_user.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_access_basic_user.tf.tmpl index 12a505b79bdc..5b528fe67ba3 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_access_basic_user.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_access_basic_user.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_bigquery_dataset_access" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_dataset_access" "{{$.PrimaryResourceId}}" { dataset_id = google_bigquery_dataset.dataset.dataset_id role = "OWNER" user_by_email = google_service_account.bqowner.email } resource "google_bigquery_dataset" "dataset" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_service_account" "bqowner" { - account_id = "<%= ctx[:vars]['account_name'] %>" + account_id = "{{index $.Vars "account_name"}}" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_access_view.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_access_view.tf.tmpl index 269868387183..653e650cb0ca 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_access_view.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_access_view.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_bigquery_dataset_access" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_dataset_access" "{{$.PrimaryResourceId}}" { dataset_id = google_bigquery_dataset.private.dataset_id view { project_id = google_bigquery_table.public.project @@ -8,17 +8,17 @@ resource "google_bigquery_dataset_access" "<%= ctx[:primary_resource_id] %>" { } resource "google_bigquery_dataset" "private" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_dataset" "public" { - dataset_id = "<%= ctx[:vars]['dataset_id2'] %>" + dataset_id = "{{index $.Vars "dataset_id2"}}" } resource "google_bigquery_table" "public" { deletion_protection = false dataset_id = google_bigquery_dataset.public.dataset_id - table_id = "<%= ctx[:vars]['table_id'] %>" + table_id = "{{index $.Vars "table_id"}}" view { query = "SELECT state FROM [lookerdata:cdc.project_tycho_reports]" diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_authorized_dataset.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_authorized_dataset.tf.tmpl index 1cd517fc7337..93f14b52c8da 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_authorized_dataset.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_authorized_dataset.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigquery_dataset" "public" { - dataset_id = "<%= ctx[:vars]['public'] %>" + dataset_id = "{{index $.Vars "public"}}" friendly_name = "test" description = "This dataset is public" location = "EU" @@ -20,8 +20,8 @@ resource "google_bigquery_dataset" "public" { } } -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['private'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "private"}}" friendly_name = "test" description = "This dataset is private" location = "EU" @@ -53,5 +53,5 @@ resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { } resource "google_service_account" "bqowner" { - account_id = "<%= ctx[:vars]['account_name'] %>" + account_id = "{{index $.Vars "account_name"}}" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_authorized_routine.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_authorized_routine.tf.tmpl index 81dc6dead6b6..854fad6ac525 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_authorized_routine.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_authorized_routine.tf.tmpl @@ -1,11 +1,11 @@ resource "google_bigquery_dataset" "public" { - dataset_id = "<%= ctx[:vars]['public_dataset'] %>" + dataset_id = "{{index $.Vars "public_dataset"}}" description = "This dataset is public" } resource "google_bigquery_routine" "public" { dataset_id = google_bigquery_dataset.public.dataset_id - routine_id = "<%= ctx[:vars]['public_routine'] %>" + routine_id = "{{index $.Vars "public_routine"}}" routine_type = "TABLE_VALUED_FUNCTION" language = "SQL" definition_body = <<-EOS @@ -22,11 +22,11 @@ resource "google_bigquery_routine" "public" { } resource "google_bigquery_dataset" "private" { - dataset_id = "<%= ctx[:vars]['private_dataset'] %>" + dataset_id = "{{index $.Vars "private_dataset"}}" description = "This dataset is private" access { role = "OWNER" - user_by_email = "<%= ctx[:test_env_vars]['service_account'] %>" + user_by_email = "{{index $.TestEnvVars "service_account"}}" } access { routine { diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_authorized_view.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_authorized_view.tf.tmpl index bfb10e7a0c71..5cd967c9575c 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_authorized_view.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_authorized_view.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigquery_dataset" "public" { - dataset_id = "<%= ctx[:vars]['grant_dataset_id'] %>" + dataset_id = "{{index $.Vars "grant_dataset_id"}}" friendly_name = "test" description = "This dataset is public" location = "EU" @@ -20,8 +20,8 @@ resource "google_bigquery_dataset" "public" { } } -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This dataset is private" location = "EU" @@ -53,5 +53,5 @@ resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { } resource "google_service_account" "bqowner" { - account_id = "<%= ctx[:vars]['account_name'] %>" + account_id = "{{index $.Vars "account_name"}}" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_basic.tf.tmpl index 5baacae012fb..dd40bc580adb 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "EU" @@ -21,5 +21,5 @@ resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { } resource "google_service_account" "bqowner" { - account_id = "<%= ctx[:vars]['account_name'] %>" + account_id = "{{index $.Vars "account_name"}}" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_case_insensitive_names.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_case_insensitive_names.tf.tmpl index 21eb74f19ea0..c6c847c124b9 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_case_insensitive_names.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_case_insensitive_names.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "EU" @@ -22,5 +22,5 @@ resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { } resource "google_service_account" "bqowner" { - account_id = "<%= ctx[:vars]['account_name'] %>" + account_id = "{{index $.Vars "account_name"}}" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_cmek.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_cmek.tf.tmpl index 589c400ba84b..52f67ff561bd 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_cmek.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -11,11 +11,11 @@ resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "us" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_default_collation_set.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_default_collation_set.tf.tmpl index 545f07fa3c98..f6ffaf1a3963 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_default_collation_set.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_default_collation_set.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "EU" @@ -22,5 +22,5 @@ resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { } resource "google_service_account" "bqowner" { - account_id = "<%= ctx[:vars]['account_name'] %>" + account_id = "{{index $.Vars "account_name"}}" } diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws.tf.tmpl index b407150989e5..3c6263691609 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "aws-us-east-1" diff --git a/mmv1/templates/terraform/examples/go/bigquery_dataset_external_reference_aws_docs.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws_docs.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/bigquery_dataset_external_reference_aws_docs.tf.tmpl rename to mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws_docs.tf.tmpl diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws_test.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws_test.tf.tmpl index 76af83b522f0..909aac1f6f9e 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_external_reference_aws_test.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "aws-us-east-1" diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_resource_tags.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_resource_tags.tf.tmpl index 638790edc733..5d251976c306 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_resource_tags.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_resource_tags.tf.tmpl @@ -3,26 +3,26 @@ data "google_project" "project" { resource "google_tags_tag_key" "tag_key1" { parent = "projects/${data.google_project.project.number}" - short_name = "<%= ctx[:vars]['tag_key1'] %>" + short_name = "{{index $.Vars "tag_key1"}}" } resource "google_tags_tag_value" "tag_value1" { parent = "tagKeys/${google_tags_tag_key.tag_key1.name}" - short_name = "<%= ctx[:vars]['tag_value1'] %>" + short_name = "{{index $.Vars "tag_value1"}}" } resource "google_tags_tag_key" "tag_key2" { parent = "projects/${data.google_project.project.number}" - short_name = "<%= ctx[:vars]['tag_key2'] %>" + short_name = "{{index $.Vars "tag_key2"}}" } resource "google_tags_tag_value" "tag_value2" { parent = "tagKeys/${google_tags_tag_key.tag_key2.name}" - short_name = "<%= ctx[:vars]['tag_value2'] %>" + short_name = "{{index $.Vars "tag_value2"}}" } -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "EU" diff --git a/mmv1/templates/terraform/examples/bigquery_dataset_with_max_time_travel_hours.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_dataset_with_max_time_travel_hours.tf.tmpl index de0b3078377a..ae8fdbebd146 100644 --- a/mmv1/templates/terraform/examples/bigquery_dataset_with_max_time_travel_hours.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_dataset_with_max_time_travel_hours.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" +resource "google_bigquery_dataset" "{{$.PrimaryResourceId}}" { + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "EU" @@ -22,5 +22,5 @@ resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { } resource "google_service_account" "bqowner" { - account_id = "<%= ctx[:vars]['account_name'] %>" + account_id = "{{index $.Vars "account_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_job_copy.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_copy.tf.tmpl index 8025df9b886b..88b2e20502ca 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_copy.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_copy.tf.tmpl @@ -7,7 +7,7 @@ resource "google_bigquery_table" "source" { count = local.count dataset_id = google_bigquery_dataset.source[count.index].dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_${count.index}_table" + table_id = "{{index $.Vars "job_id"}}_${count.index}_table" schema = <" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" copy { source_tables { diff --git a/mmv1/templates/terraform/examples/bigquery_job_copy_table_reference.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_copy_table_reference.tf.tmpl index 6112d5dee125..aa52657f9063 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_copy_table_reference.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_copy_table_reference.tf.tmpl @@ -7,7 +7,7 @@ resource "google_bigquery_table" "source" { count = local.count dataset_id = google_bigquery_dataset.source[count.index].dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_${count.index}_table" + table_id = "{{index $.Vars "job_id"}}_${count.index}_table" schema = <" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" copy { source_tables { diff --git a/mmv1/templates/terraform/examples/bigquery_job_extract.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_extract.tf.tmpl index 27d752a52da7..ff7b3071988c 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_extract.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_extract.tf.tmpl @@ -1,7 +1,7 @@ resource "google_bigquery_table" "source-one" { deletion_protection = false dataset_id = google_bigquery_dataset.source-one.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" schema = <" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" extract { destination_uris = ["${google_storage_bucket.dest.url}/extract"] diff --git a/mmv1/templates/terraform/examples/bigquery_job_extract_table_reference.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_extract_table_reference.tf.tmpl index 79142dceb31d..551f3b45f478 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_extract_table_reference.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_extract_table_reference.tf.tmpl @@ -1,7 +1,7 @@ resource "google_bigquery_table" "source-one" { deletion_protection = false dataset_id = google_bigquery_dataset.source-one.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" schema = <" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" extract { destination_uris = ["${google_storage_bucket.dest.url}/extract"] diff --git a/mmv1/templates/terraform/examples/bigquery_job_load.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_load.tf.tmpl index 80d430ac56e7..e1723d680f04 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_load.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_load.tf.tmpl @@ -1,18 +1,18 @@ resource "google_bigquery_table" "foo" { deletion_protection = false dataset_id = google_bigquery_dataset.bar.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" } resource "google_bigquery_dataset" "bar" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" } -resource "google_bigquery_job" "<%= ctx[:primary_resource_id] %>" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" labels = { "my_job" ="load" diff --git a/mmv1/templates/terraform/examples/bigquery_job_load_geojson.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_load_geojson.tf.tmpl index 9cc67adff9aa..a1482b08a9d1 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_load_geojson.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_load_geojson.tf.tmpl @@ -1,9 +1,9 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_storage_bucket" "bucket" { - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -20,18 +20,18 @@ EOF resource "google_bigquery_table" "foo" { deletion_protection = false dataset_id = google_bigquery_dataset.bar.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" } resource "google_bigquery_dataset" "bar" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" } -resource "google_bigquery_job" "<%= ctx[:primary_resource_id] %>" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" labels = { "my_job" = "load" diff --git a/mmv1/templates/terraform/examples/bigquery_job_load_parquet.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_load_parquet.tf.tmpl index 5cbb974b0db7..364f5c8d5a85 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_load_parquet.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_load_parquet.tf.tmpl @@ -1,17 +1,17 @@ resource "google_storage_bucket" "test" { - name = "<%= ctx[:vars]['job_id'] %>_bucket" + name = "{{index $.Vars "job_id"}}_bucket" location = "US" uniform_bucket_level_access = true } resource "google_storage_bucket_object" "test" { - name = "<%= ctx[:vars]['job_id'] %>_bucket_object" + name = "{{index $.Vars "job_id"}}_bucket_object" source = "./test-fixtures/test.parquet.gzip" bucket = google_storage_bucket.test.name } resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" @@ -19,12 +19,12 @@ resource "google_bigquery_dataset" "test" { resource "google_bigquery_table" "test" { deletion_protection = false - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" dataset_id = google_bigquery_dataset.test.dataset_id } -resource "google_bigquery_job" "<%= ctx[:primary_resource_id] %>" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" labels = { "my_job" ="load" diff --git a/mmv1/templates/terraform/examples/bigquery_job_load_table_reference.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_load_table_reference.tf.tmpl index 24eeb7fc6347..f9dfb7938066 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_load_table_reference.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_load_table_reference.tf.tmpl @@ -1,18 +1,18 @@ resource "google_bigquery_table" "foo" { deletion_protection = false dataset_id = google_bigquery_dataset.bar.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" } resource "google_bigquery_dataset" "bar" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" } -resource "google_bigquery_job" "<%= ctx[:primary_resource_id] %>" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" labels = { "my_job" ="load" diff --git a/mmv1/templates/terraform/examples/bigquery_job_query.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_query.tf.tmpl index e1ed891b8371..e46c6ead31f2 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_query.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_query.tf.tmpl @@ -1,18 +1,18 @@ resource "google_bigquery_table" "foo" { deletion_protection = false dataset_id = google_bigquery_dataset.bar.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" } resource "google_bigquery_dataset" "bar" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" } -resource "google_bigquery_job" "<%= ctx[:primary_resource_id] %>" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" labels = { "example-label" ="example-value" diff --git a/mmv1/templates/terraform/examples/bigquery_job_query_table_reference.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_job_query_table_reference.tf.tmpl index 46de94c81ef7..522f6a6eedb6 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_query_table_reference.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_job_query_table_reference.tf.tmpl @@ -1,18 +1,18 @@ resource "google_bigquery_table" "foo" { deletion_protection = false dataset_id = google_bigquery_dataset.bar.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" } resource "google_bigquery_dataset" "bar" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" } -resource "google_bigquery_job" "<%= ctx[:primary_resource_id] %>" { - job_id = "<%= ctx[:vars]['job_id'] %>" +resource "google_bigquery_job" "{{$.PrimaryResourceId}}" { + job_id = "{{index $.Vars "job_id"}}" labels = { "example-label" ="example-value" diff --git a/mmv1/templates/terraform/examples/bigquery_reservation_assignment_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_reservation_assignment_basic.tf.tmpl index 0aac775c6040..5961e131f26f 100644 --- a/mmv1/templates/terraform/examples/bigquery_reservation_assignment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_reservation_assignment_basic.tf.tmpl @@ -1,13 +1,13 @@ resource "google_bigquery_reservation" "basic" { - name = "<%= ctx[:vars]['reservation_name'] %>" - project = "<%= ctx[:test_env_vars]['project'] %>" + name = "{{index $.Vars "reservation_name"}}" + project = "{{index $.TestEnvVars "project"}}" location = "us-central1" slot_capacity = 0 ignore_idle_slots = false } -resource "google_bigquery_reservation_assignment" "<%= ctx[:primary_resource_id] %>" { - assignee = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_bigquery_reservation_assignment" "{{$.PrimaryResourceId}}" { + assignee = "projects/{{index $.TestEnvVars "project"}}" job_type = "PIPELINE" reservation = google_bigquery_reservation.basic.id } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_reservation_assignment_full.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_reservation_assignment_full.tf.tmpl index 7944dc71ea68..c13722a098b4 100644 --- a/mmv1/templates/terraform/examples/bigquery_reservation_assignment_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_reservation_assignment_full.tf.tmpl @@ -1,13 +1,13 @@ resource "google_bigquery_reservation" "basic" { - name = "<%= ctx[:vars]['reservation_name'] %>" - project = "<%= ctx[:test_env_vars]['project'] %>" + name = "{{index $.Vars "reservation_name"}}" + project = "{{index $.TestEnvVars "project"}}" location = "us-central1" slot_capacity = 0 ignore_idle_slots = false } -resource "google_bigquery_reservation_assignment" "<%= ctx[:primary_resource_id] %>" { - assignee = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_bigquery_reservation_assignment" "{{$.PrimaryResourceId}}" { + assignee = "projects/{{index $.TestEnvVars "project"}}" job_type = "QUERY" location = "us-central1" reservation = google_bigquery_reservation.basic.id diff --git a/mmv1/templates/terraform/examples/bigquery_reservation_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_reservation_basic.tf.tmpl index d8bc22b5c611..7b7c5bada2c9 100644 --- a/mmv1/templates/terraform/examples/bigquery_reservation_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_reservation_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_bigquery_reservation" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_bigquery_reservation" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west2" // Set to 0 for testing purposes // In reality this would be larger than zero diff --git a/mmv1/templates/terraform/examples/bigquery_reservation_bi_reservation_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_reservation_bi_reservation_basic.tf.tmpl index 578b968179fe..521f87a06360 100644 --- a/mmv1/templates/terraform/examples/bigquery_reservation_bi_reservation_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_reservation_bi_reservation_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_bigquery_bi_reservation" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_bi_reservation" "{{$.PrimaryResourceId}}" { location = "us-west2" size = "3000000000" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/bigquery_reservation_bi_reservation_full.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_reservation_bi_reservation_full.tf.tmpl index eaabc5d525a0..417b34608f1e 100644 --- a/mmv1/templates/terraform/examples/bigquery_reservation_bi_reservation_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_reservation_bi_reservation_full.tf.tmpl @@ -24,16 +24,16 @@ resource "google_bigquery_dataset" "bar2" { location = "EU" } -resource "google_bigquery_bi_reservation" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_bi_reservation" "{{$.PrimaryResourceId}}" { location = "EU" size = "2800000000" preferred_tables { - project_id = "<%= ctx[:test_env_vars]['project'] %>" + project_id = "{{index $.TestEnvVars "project"}}" dataset_id = google_bigquery_dataset.bar.dataset_id table_id = google_bigquery_table.foo.table_id } preferred_tables { - project_id = "<%= ctx[:test_env_vars]['project'] %>" + project_id = "{{index $.TestEnvVars "project"}}" dataset_id = google_bigquery_dataset.bar2.dataset_id table_id = google_bigquery_table.foo2.table_id } diff --git a/mmv1/templates/terraform/examples/bigquery_reservation_capacity_commitment_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_reservation_capacity_commitment_basic.tf.tmpl index 5fe23e0a1d31..dff89b9405d4 100644 --- a/mmv1/templates/terraform/examples/bigquery_reservation_capacity_commitment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_reservation_capacity_commitment_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_bigquery_capacity_commitment" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_capacity_commitment" "{{$.PrimaryResourceId}}" { capacity_commitment_id = "capacity-tf-test%{random_suffix}" location = "us-west2" @@ -8,7 +8,7 @@ resource "google_bigquery_capacity_commitment" "<%= ctx[:primary_resource_id] %> } resource "time_sleep" "wait_61_seconds" { - depends_on = [google_bigquery_capacity_commitment.<%= ctx[:primary_resource_id] %>] + depends_on = [google_bigquery_capacity_commitment.{{$.PrimaryResourceId}}] # Only needed for CI tests to be able to tear down the commitment once it's expired create_duration = "61s" diff --git a/mmv1/templates/terraform/examples/bigquery_reservation_capacity_commitment_no_id.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_reservation_capacity_commitment_no_id.tf.tmpl index d6234e8b98dd..60f933861917 100644 --- a/mmv1/templates/terraform/examples/bigquery_reservation_capacity_commitment_no_id.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_reservation_capacity_commitment_no_id.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_bigquery_capacity_commitment" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_capacity_commitment" "{{$.PrimaryResourceId}}" { location = "us-west2" slot_count = 100 plan = "FLEX_FLAT_RATE" @@ -6,7 +6,7 @@ resource "google_bigquery_capacity_commitment" "<%= ctx[:primary_resource_id] %> } resource "time_sleep" "wait_61_seconds" { - depends_on = [google_bigquery_capacity_commitment.<%= ctx[:primary_resource_id] %>] + depends_on = [google_bigquery_capacity_commitment.{{$.PrimaryResourceId}}] # Only needed for CI tests to be able to tear down the commitment once it's expired create_duration = "61s" diff --git a/mmv1/templates/terraform/examples/bigquery_routine_basic.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_routine_basic.tf.tmpl index a9d51d4e8443..1a473f5bc7c8 100644 --- a/mmv1/templates/terraform/examples/bigquery_routine_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_routine_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_routine" "sproc" { dataset_id = google_bigquery_dataset.test.dataset_id - routine_id = "<%= ctx[:vars]['routine_id'] %>" + routine_id = "{{index $.Vars "routine_id"}}" routine_type = "PROCEDURE" language = "SQL" definition_body = "CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);" diff --git a/mmv1/templates/terraform/examples/bigquery_routine_json.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_routine_json.tf.tmpl index cd5fb76aea9b..21f4850371f9 100644 --- a/mmv1/templates/terraform/examples/bigquery_routine_json.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_routine_json.tf.tmpl @@ -1,10 +1,10 @@ resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_routine" "sproc" { dataset_id = google_bigquery_dataset.test.dataset_id - routine_id = "<%= ctx[:vars]['routine_id'] %>" + routine_id = "{{index $.Vars "routine_id"}}" routine_type = "SCALAR_FUNCTION" language = "JAVASCRIPT" definition_body = "CREATE FUNCTION multiplyInputs return x*y;" diff --git a/mmv1/templates/terraform/examples/bigquery_routine_pyspark.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_routine_pyspark.tf.tmpl index f216a2db1517..30850d921036 100644 --- a/mmv1/templates/terraform/examples/bigquery_routine_pyspark.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_routine_pyspark.tf.tmpl @@ -1,16 +1,16 @@ resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_connection" "test" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" + connection_id = "{{index $.Vars "connection_id"}}" location = "US" spark { } } -resource "google_bigquery_routine" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_routine" "{{$.PrimaryResourceId}}" { dataset_id = google_bigquery_dataset.test.dataset_id - routine_id = "<%= ctx[:vars]['routine_id'] %>" + routine_id = "{{index $.Vars "routine_id"}}" routine_type = "PROCEDURE" language = "PYTHON" definition_body = <<-EOS diff --git a/mmv1/templates/terraform/examples/bigquery_routine_pyspark_mainfile.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_routine_pyspark_mainfile.tf.tmpl index dd0302897c20..0d9202103f8d 100644 --- a/mmv1/templates/terraform/examples/bigquery_routine_pyspark_mainfile.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_routine_pyspark_mainfile.tf.tmpl @@ -1,16 +1,16 @@ resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_connection" "test" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" + connection_id = "{{index $.Vars "connection_id"}}" location = "US" spark { } } -resource "google_bigquery_routine" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_routine" "{{$.PrimaryResourceId}}" { dataset_id = google_bigquery_dataset.test.dataset_id - routine_id = "<%= ctx[:vars]['routine_id'] %>" + routine_id = "{{index $.Vars "routine_id"}}" routine_type = "PROCEDURE" language = "PYTHON" definition_body = "" diff --git a/mmv1/templates/terraform/examples/bigquery_routine_remote_function.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_routine_remote_function.tf.tmpl index 9ef5b2a0dd2a..50afe51d289b 100644 --- a/mmv1/templates/terraform/examples/bigquery_routine_remote_function.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_routine_remote_function.tf.tmpl @@ -1,16 +1,16 @@ resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_connection" "test" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" + connection_id = "{{index $.Vars "connection_id"}}" location = "US" cloud_resource { } } -resource "google_bigquery_routine" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_routine" "{{$.PrimaryResourceId}}" { dataset_id = google_bigquery_dataset.test.dataset_id - routine_id = "<%= ctx[:vars]['routine_id'] %>" + routine_id = "{{index $.Vars "routine_id"}}" routine_type = "SCALAR_FUNCTION" definition_body = "" diff --git a/mmv1/templates/terraform/examples/bigquery_routine_spark_jar.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_routine_spark_jar.tf.tmpl index da5014eb996c..f83e0c52559f 100644 --- a/mmv1/templates/terraform/examples/bigquery_routine_spark_jar.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_routine_spark_jar.tf.tmpl @@ -1,16 +1,16 @@ resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_connection" "test" { - connection_id = "<%= ctx[:vars]['connection_id'] %>" + connection_id = "{{index $.Vars "connection_id"}}" location = "US" spark { } } -resource "google_bigquery_routine" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_routine" "{{$.PrimaryResourceId}}" { dataset_id = google_bigquery_dataset.test.dataset_id - routine_id = "<%= ctx[:vars]['routine_id'] %>" + routine_id = "{{index $.Vars "routine_id"}}" routine_type = "PROCEDURE" language = "SCALA" definition_body = "" diff --git a/mmv1/templates/terraform/examples/bigquery_routine_tvf.tf.tmpl b/mmv1/templates/terraform/examples/bigquery_routine_tvf.tf.tmpl index c03f5ca3efcf..3e2706b97224 100644 --- a/mmv1/templates/terraform/examples/bigquery_routine_tvf.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquery_routine_tvf.tf.tmpl @@ -1,10 +1,10 @@ resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_routine" "sproc" { dataset_id = google_bigquery_dataset.test.dataset_id - routine_id = "<%= ctx[:vars]['routine_id'] %>" + routine_id = "{{index $.Vars "routine_id"}}" routine_type = "TABLE_VALUED_FUNCTION" language = "SQL" definition_body = <<-EOS diff --git a/mmv1/templates/terraform/examples/bigquerydatatransfer_config_cmek.tf.tmpl b/mmv1/templates/terraform/examples/bigquerydatatransfer_config_cmek.tf.tmpl index 78f8938f60d1..7a6111b76ff2 100644 --- a/mmv1/templates/terraform/examples/bigquerydatatransfer_config_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquerydatatransfer_config_cmek.tf.tmpl @@ -7,10 +7,10 @@ resource "google_project_iam_member" "permissions" { member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-bigquerydatatransfer.iam.gserviceaccount.com" } -resource "google_bigquery_data_transfer_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_data_transfer_config" "{{$.PrimaryResourceId}}" { depends_on = [google_project_iam_member.permissions] - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" location = "asia-northeast1" data_source_id = "scheduled_query" schedule = "first sunday of quarter 00:00" @@ -29,18 +29,18 @@ resource "google_bigquery_data_transfer_config" "<%= ctx[:primary_resource_id] % resource "google_bigquery_dataset" "my_dataset" { depends_on = [google_project_iam_member.permissions] - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "foo" description = "bar" location = "asia-northeast1" } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "us" } diff --git a/mmv1/templates/terraform/examples/bigquerydatatransfer_config_salesforce.tf.tmpl b/mmv1/templates/terraform/examples/bigquerydatatransfer_config_salesforce.tf.tmpl index 4c1d8d04c16d..ce5832728743 100644 --- a/mmv1/templates/terraform/examples/bigquerydatatransfer_config_salesforce.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquerydatatransfer_config_salesforce.tf.tmpl @@ -2,12 +2,12 @@ data "google_project" "project" { } resource "google_bigquery_dataset" "my_dataset" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" description = "My dataset" location = "asia-northeast1" } -resource "google_bigquery_data_transfer_config" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_bigquery_data_transfer_config" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" location = "asia-northeast1" data_source_id = "salesforce" schedule = "first sunday of quarter 00:00" diff --git a/mmv1/templates/terraform/examples/bigquerydatatransfer_config_scheduled_query.tf.tmpl b/mmv1/templates/terraform/examples/bigquerydatatransfer_config_scheduled_query.tf.tmpl index 7c5a561c0106..26b574da937b 100644 --- a/mmv1/templates/terraform/examples/bigquerydatatransfer_config_scheduled_query.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigquerydatatransfer_config_scheduled_query.tf.tmpl @@ -7,10 +7,10 @@ resource "google_project_iam_member" "permissions" { member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-bigquerydatatransfer.iam.gserviceaccount.com" } -resource "google_bigquery_data_transfer_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_bigquery_data_transfer_config" "{{$.PrimaryResourceId}}" { depends_on = [google_project_iam_member.permissions] - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" location = "asia-northeast1" data_source_id = "scheduled_query" schedule = "first sunday of quarter 00:00" @@ -25,7 +25,7 @@ resource "google_bigquery_data_transfer_config" "<%= ctx[:primary_resource_id] % resource "google_bigquery_dataset" "my_dataset" { depends_on = [google_project_iam_member.permissions] - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "foo" description = "bar" location = "asia-northeast1" diff --git a/mmv1/templates/terraform/examples/bigtable_app_profile_anycluster.tf.tmpl b/mmv1/templates/terraform/examples/bigtable_app_profile_anycluster.tf.tmpl index f065f824c432..7fd3d68aa6f0 100644 --- a/mmv1/templates/terraform/examples/bigtable_app_profile_anycluster.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigtable_app_profile_anycluster.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigtable_instance" "instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" cluster { cluster_id = "cluster-1" zone = "us-central1-a" @@ -19,12 +19,12 @@ resource "google_bigtable_instance" "instance" { storage_type = "HDD" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_bigtable_app_profile" "ap" { instance = google_bigtable_instance.instance.name - app_profile_id = "<%= ctx[:vars]['app_profile_name'] %>" + app_profile_id = "{{index $.Vars "app_profile_name"}}" // Requests will be routed to any of the 3 clusters. multi_cluster_routing_use_any = true diff --git a/mmv1/templates/terraform/examples/bigtable_app_profile_data_boost.tf.tmpl b/mmv1/templates/terraform/examples/bigtable_app_profile_data_boost.tf.tmpl index 96a7f630174c..a25680f8868d 100644 --- a/mmv1/templates/terraform/examples/bigtable_app_profile_data_boost.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigtable_app_profile_data_boost.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigtable_instance" "instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" cluster { cluster_id = "cluster-1" zone = "us-central1-b" @@ -7,12 +7,12 @@ resource "google_bigtable_instance" "instance" { storage_type = "SSD" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_bigtable_app_profile" "ap" { instance = google_bigtable_instance.instance.name - app_profile_id = "<%= ctx[:vars]['app_profile_name'] %>" + app_profile_id = "{{index $.Vars "app_profile_name"}}" // Requests will be routed to the following cluster. single_cluster_routing { diff --git a/mmv1/templates/terraform/examples/bigtable_app_profile_multicluster.tf.tmpl b/mmv1/templates/terraform/examples/bigtable_app_profile_multicluster.tf.tmpl index 4ae29dc3a381..e74f1d76aee1 100644 --- a/mmv1/templates/terraform/examples/bigtable_app_profile_multicluster.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigtable_app_profile_multicluster.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigtable_instance" "instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" cluster { cluster_id = "cluster-1" zone = "us-central1-a" @@ -19,12 +19,12 @@ resource "google_bigtable_instance" "instance" { storage_type = "HDD" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_bigtable_app_profile" "ap" { instance = google_bigtable_instance.instance.name - app_profile_id = "<%= ctx[:vars]['app_profile_name'] %>" + app_profile_id = "{{index $.Vars "app_profile_name"}}" // Requests will be routed to the following 2 clusters. multi_cluster_routing_use_any = true diff --git a/mmv1/templates/terraform/examples/bigtable_app_profile_priority.tf.tmpl b/mmv1/templates/terraform/examples/bigtable_app_profile_priority.tf.tmpl index 5b35117f11e9..4d4f65e336db 100644 --- a/mmv1/templates/terraform/examples/bigtable_app_profile_priority.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigtable_app_profile_priority.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigtable_instance" "instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" cluster { cluster_id = "cluster-1" zone = "us-central1-b" @@ -7,12 +7,12 @@ resource "google_bigtable_instance" "instance" { storage_type = "HDD" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_bigtable_app_profile" "ap" { instance = google_bigtable_instance.instance.name - app_profile_id = "<%= ctx[:vars]['app_profile_name'] %>" + app_profile_id = "{{index $.Vars "app_profile_name"}}" // Requests will be routed to the following cluster. single_cluster_routing { diff --git a/mmv1/templates/terraform/examples/bigtable_app_profile_singlecluster.tf.tmpl b/mmv1/templates/terraform/examples/bigtable_app_profile_singlecluster.tf.tmpl index 575cc1f7dfbc..d0db54cd3a36 100644 --- a/mmv1/templates/terraform/examples/bigtable_app_profile_singlecluster.tf.tmpl +++ b/mmv1/templates/terraform/examples/bigtable_app_profile_singlecluster.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigtable_instance" "instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" cluster { cluster_id = "cluster-1" zone = "us-central1-b" @@ -7,12 +7,12 @@ resource "google_bigtable_instance" "instance" { storage_type = "HDD" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_bigtable_app_profile" "ap" { instance = google_bigtable_instance.instance.name - app_profile_id = "<%= ctx[:vars]['app_profile_name'] %>" + app_profile_id = "{{index $.Vars "app_profile_name"}}" // Requests will be routed to the following cluster. single_cluster_routing { diff --git a/mmv1/templates/terraform/examples/billing_budget_basic.tf.tmpl b/mmv1/templates/terraform/examples/billing_budget_basic.tf.tmpl index e3efa59228c8..a3ff4b750b0c 100644 --- a/mmv1/templates/terraform/examples/billing_budget_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/billing_budget_basic.tf.tmpl @@ -1,10 +1,10 @@ data "google_billing_account" "account" { - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" } -resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { +resource "google_billing_budget" "{{$.PrimaryResourceId}}" { billing_account = data.google_billing_account.account.id - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" amount { specified_amount { currency_code = "USD" diff --git a/mmv1/templates/terraform/examples/billing_budget_customperiod.tf.tmpl b/mmv1/templates/terraform/examples/billing_budget_customperiod.tf.tmpl index c3c26e65d2c0..f1288f179a51 100644 --- a/mmv1/templates/terraform/examples/billing_budget_customperiod.tf.tmpl +++ b/mmv1/templates/terraform/examples/billing_budget_customperiod.tf.tmpl @@ -1,13 +1,13 @@ data "google_billing_account" "account" { - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" } data "google_project" "project" { } -resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { +resource "google_billing_budget" "{{$.PrimaryResourceId}}" { billing_account = data.google_billing_account.account.id - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" budget_filter { projects = ["projects/${data.google_project.project.number}"] diff --git a/mmv1/templates/terraform/examples/billing_budget_filter.tf.tmpl b/mmv1/templates/terraform/examples/billing_budget_filter.tf.tmpl index ef8c8877dde6..2ee97db95378 100644 --- a/mmv1/templates/terraform/examples/billing_budget_filter.tf.tmpl +++ b/mmv1/templates/terraform/examples/billing_budget_filter.tf.tmpl @@ -1,20 +1,20 @@ data "google_billing_account" "account" { - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" } data "google_project" "project" { } -resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { +resource "google_billing_budget" "{{$.PrimaryResourceId}}" { billing_account = data.google_billing_account.account.id - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" budget_filter { projects = ["projects/${data.google_project.project.number}"] credit_types_treatment = "INCLUDE_SPECIFIED_CREDITS" services = ["services/24E6-581D-38E5"] # Bigquery credit_types = ["PROMOTION", "FREE_TIER"] - resource_ancestors = ["organizations/<%= ctx[:test_env_vars]['org_id'] %>"] + resource_ancestors = ["organizations/{{index $.TestEnvVars "org_id"}}"] } amount { diff --git a/mmv1/templates/terraform/examples/billing_budget_lastperiod.tf.tmpl b/mmv1/templates/terraform/examples/billing_budget_lastperiod.tf.tmpl index 3c5573549331..5062933b7311 100644 --- a/mmv1/templates/terraform/examples/billing_budget_lastperiod.tf.tmpl +++ b/mmv1/templates/terraform/examples/billing_budget_lastperiod.tf.tmpl @@ -1,13 +1,13 @@ data "google_billing_account" "account" { - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" } data "google_project" "project" { } -resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { +resource "google_billing_budget" "{{$.PrimaryResourceId}}" { billing_account = data.google_billing_account.account.id - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" budget_filter { projects = ["projects/${data.google_project.project.number}"] diff --git a/mmv1/templates/terraform/examples/billing_budget_notify.tf.tmpl b/mmv1/templates/terraform/examples/billing_budget_notify.tf.tmpl index eb034da5cd02..c12c92830e16 100644 --- a/mmv1/templates/terraform/examples/billing_budget_notify.tf.tmpl +++ b/mmv1/templates/terraform/examples/billing_budget_notify.tf.tmpl @@ -1,13 +1,13 @@ data "google_billing_account" "account" { - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" } data "google_project" "project" { } -resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { +resource "google_billing_budget" "{{$.PrimaryResourceId}}" { billing_account = data.google_billing_account.account.id - display_name = "<%= ctx[:vars]['budget_name'] %>" + display_name = "{{index $.Vars "budget_name"}}" budget_filter { projects = ["projects/${data.google_project.project.number}"] @@ -37,7 +37,7 @@ resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { } resource "google_monitoring_notification_channel" "notification_channel" { - display_name = "<%= ctx[:vars]['channel_name'] %>" + display_name = "{{index $.Vars "channel_name"}}" type = "email" labels = { diff --git a/mmv1/templates/terraform/examples/billing_budget_notify_project_recipient.tf.tmpl b/mmv1/templates/terraform/examples/billing_budget_notify_project_recipient.tf.tmpl index d24ea5ebcb90..88251760bc65 100644 --- a/mmv1/templates/terraform/examples/billing_budget_notify_project_recipient.tf.tmpl +++ b/mmv1/templates/terraform/examples/billing_budget_notify_project_recipient.tf.tmpl @@ -1,13 +1,13 @@ data "google_billing_account" "account" { - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" } data "google_project" "project" { } -resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { +resource "google_billing_budget" "{{$.PrimaryResourceId}}" { billing_account = data.google_billing_account.account.id - display_name = "<%= ctx[:vars]['budget_name'] %>" + display_name = "{{index $.Vars "budget_name"}}" budget_filter { projects = ["projects/${data.google_project.project.number}"] diff --git a/mmv1/templates/terraform/examples/billing_budget_optional.tf.tmpl b/mmv1/templates/terraform/examples/billing_budget_optional.tf.tmpl index 10d17711734d..39ce42f97ff8 100644 --- a/mmv1/templates/terraform/examples/billing_budget_optional.tf.tmpl +++ b/mmv1/templates/terraform/examples/billing_budget_optional.tf.tmpl @@ -1,10 +1,10 @@ data "google_billing_account" "account" { - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" } -resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { +resource "google_billing_budget" "{{$.PrimaryResourceId}}" { billing_account = data.google_billing_account.account.id - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" amount { specified_amount { @@ -15,12 +15,12 @@ resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" { all_updates_rule { disable_default_iam_recipients = true - pubsub_topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id + pubsub_topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id } ownership_scope = "BILLING_ACCOUNT" } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/billing_project_info_basic.tf.tmpl b/mmv1/templates/terraform/examples/billing_project_info_basic.tf.tmpl index 3ca9dea1066f..df607cce8e6f 100644 --- a/mmv1/templates/terraform/examples/billing_project_info_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/billing_project_info_basic.tf.tmpl @@ -1,14 +1,14 @@ resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" lifecycle { ignore_changes = [billing_account] } } -resource "google_billing_project_info" "<%= ctx[:primary_resource_id] %>" { +resource "google_billing_project_info" "{{$.PrimaryResourceId}}" { project = google_project.project.project_id - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + billing_account = "{{index $.TestEnvVars "billing_account"}}" } diff --git a/mmv1/templates/terraform/examples/binary_authorization_attestor_basic.tf.tmpl b/mmv1/templates/terraform/examples/binary_authorization_attestor_basic.tf.tmpl index 8d0fceec2b8d..570dba783d05 100644 --- a/mmv1/templates/terraform/examples/binary_authorization_attestor_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/binary_authorization_attestor_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_binary_authorization_attestor" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["attestor_name"] %>" +resource "google_binary_authorization_attestor" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "attestor_name"}}" attestation_authority_note { note_reference = google_container_analysis_note.note.name public_keys { @@ -26,7 +26,7 @@ EOF } resource "google_container_analysis_note" "note" { - name = "<%= ctx[:vars]["note_name"] %>" + name = "{{index $.Vars "note_name"}}" attestation_authority { hint { human_readable_name = "Attestor Note" diff --git a/mmv1/templates/terraform/examples/binary_authorization_attestor_kms.tf.tmpl b/mmv1/templates/terraform/examples/binary_authorization_attestor_kms.tf.tmpl index 1bc328c09b37..9b506f4f2102 100644 --- a/mmv1/templates/terraform/examples/binary_authorization_attestor_kms.tf.tmpl +++ b/mmv1/templates/terraform/examples/binary_authorization_attestor_kms.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_binary_authorization_attestor" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["attestor_name"] %>" +resource "google_binary_authorization_attestor" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "attestor_name"}}" attestation_authority_note { note_reference = google_container_analysis_note.note.name public_keys { @@ -17,7 +17,7 @@ data "google_kms_crypto_key_version" "version" { } resource "google_container_analysis_note" "note" { - name = "<%= ctx[:vars]["note_name"] %>" + name = "{{index $.Vars "note_name"}}" attestation_authority { hint { human_readable_name = "Attestor Note" @@ -26,7 +26,7 @@ resource "google_container_analysis_note" "note" { } resource "google_kms_crypto_key" "crypto-key" { - name = "<%= ctx[:vars]["key_name"] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.keyring.id purpose = "ASYMMETRIC_SIGN" @@ -40,6 +40,6 @@ resource "google_kms_crypto_key" "crypto-key" { } resource "google_kms_key_ring" "keyring" { - name = "<%= ctx[:vars]["keyring_name"] %>" + name = "{{index $.Vars "keyring_name"}}" location = "global" } diff --git a/mmv1/templates/terraform/examples/binary_authorization_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/binary_authorization_policy_basic.tf.tmpl index eb7d0904a068..d6d1920bc5bc 100644 --- a/mmv1/templates/terraform/examples/binary_authorization_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/binary_authorization_policy_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_binary_authorization_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_binary_authorization_policy" "{{$.PrimaryResourceId}}" { admission_whitelist_patterns { name_pattern = "gcr.io/google_containers/*" } @@ -17,7 +17,7 @@ resource "google_binary_authorization_policy" "<%= ctx[:primary_resource_id] %>" } resource "google_container_analysis_note" "note" { - name = "<%= ctx[:vars]["note_name"] %>" + name = "{{index $.Vars "note_name"}}" attestation_authority { hint { human_readable_name = "My attestor" @@ -26,7 +26,7 @@ resource "google_container_analysis_note" "note" { } resource "google_binary_authorization_attestor" "attestor" { - name = "<%= ctx[:vars]["attestor_name"] %>" + name = "{{index $.Vars "attestor_name"}}" attestation_authority_note { note_reference = google_container_analysis_note.note.name } diff --git a/mmv1/templates/terraform/examples/binary_authorization_policy_global_evaluation.tf.tmpl b/mmv1/templates/terraform/examples/binary_authorization_policy_global_evaluation.tf.tmpl index e96652d0fde8..1464526f891c 100644 --- a/mmv1/templates/terraform/examples/binary_authorization_policy_global_evaluation.tf.tmpl +++ b/mmv1/templates/terraform/examples/binary_authorization_policy_global_evaluation.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_binary_authorization_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_binary_authorization_policy" "{{$.PrimaryResourceId}}" { default_admission_rule { evaluation_mode = "REQUIRE_ATTESTATION" enforcement_mode = "ENFORCED_BLOCK_AND_AUDIT_LOG" @@ -9,7 +9,7 @@ resource "google_binary_authorization_policy" "<%= ctx[:primary_resource_id] %>" } resource "google_container_analysis_note" "note" { - name = "<%= ctx[:vars]["note_name"] %>" + name = "{{index $.Vars "note_name"}}" attestation_authority { hint { human_readable_name = "My attestor" @@ -18,7 +18,7 @@ resource "google_container_analysis_note" "note" { } resource "google_binary_authorization_attestor" "attestor" { - name = "<%= ctx[:vars]["attestor_name"] %>" + name = "{{index $.Vars "attestor_name"}}" attestation_authority_note { note_reference = google_container_analysis_note.note.name } diff --git a/mmv1/templates/terraform/examples/blockchain_nodes_basic.tf.tmpl b/mmv1/templates/terraform/examples/blockchain_nodes_basic.tf.tmpl index 5b2a9cba9a7a..846a0b2f3aea 100644 --- a/mmv1/templates/terraform/examples/blockchain_nodes_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/blockchain_nodes_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_blockchain_node_engine_blockchain_nodes" "<%= ctx[:primary_resource_id] %>" { +resource "google_blockchain_node_engine_blockchain_nodes" "{{$.PrimaryResourceId}}" { location = "us-central1" blockchain_type = "ETHEREUM" - blockchain_node_id = "<%= ctx[:vars]["blockchain_node_id"] %>" + blockchain_node_id = "{{index $.Vars "blockchain_node_id"}}" ethereum_details { api_enable_admin = true api_enable_debug = true diff --git a/mmv1/templates/terraform/examples/blockchain_nodes_geth_details.tf.tmpl b/mmv1/templates/terraform/examples/blockchain_nodes_geth_details.tf.tmpl index 9ef412bbee6f..f57ac83d02d2 100644 --- a/mmv1/templates/terraform/examples/blockchain_nodes_geth_details.tf.tmpl +++ b/mmv1/templates/terraform/examples/blockchain_nodes_geth_details.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_blockchain_node_engine_blockchain_nodes" "<%= ctx[:primary_resource_id] %>" { +resource "google_blockchain_node_engine_blockchain_nodes" "{{$.PrimaryResourceId}}" { location = "us-central1" blockchain_type = "ETHEREUM" - blockchain_node_id = "<%= ctx[:vars]["blockchain_node_id"] %>" + blockchain_node_id = "{{index $.Vars "blockchain_node_id"}}" ethereum_details { api_enable_admin = true api_enable_debug = true diff --git a/mmv1/templates/terraform/examples/certificate_manager_certificate_issuance_config.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_certificate_issuance_config.tf.tmpl index 59452f47737c..8b5c2c51388d 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_certificate_issuance_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_certificate_issuance_config.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate_issuance_config" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["issuance_config_name"] %>" +resource "google_certificate_manager_certificate_issuance_config" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "issuance_config_name"}}" description = "sample description for the certificate issuanceConfigs" certificate_authority_config { certificate_authority_service_config { @@ -15,7 +15,7 @@ resource "google_certificate_manager_certificate_issuance_config" "<%= ctx[:prim } resource "google_privateca_ca_pool" "pool" { - name = "<%= ctx[:vars]["pool_name"] %>" + name = "{{index $.Vars "pool_name"}}" location = "us-central1" tier = "ENTERPRISE" } @@ -23,7 +23,7 @@ resource "google_privateca_ca_pool" "pool" { resource "google_privateca_certificate_authority" "ca_authority" { location = "us-central1" pool = google_privateca_ca_pool.pool.name - certificate_authority_id = "<%= ctx[:vars]["ca_name"] %>" + certificate_authority_id = "{{index $.Vars "ca_name"}}" config { subject_config { subject { diff --git a/mmv1/templates/terraform/examples/certificate_manager_certificate_map_basic.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_certificate_map_basic.tf.tmpl index 159ef913fb9e..f11d1a78a4db 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_certificate_map_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_certificate_map_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_map_name'] %>" +resource "google_certificate_manager_certificate_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_map_name"}}" description = "My acceptance test certificate map" labels = { "terraform" : true, diff --git a/mmv1/templates/terraform/examples/certificate_manager_certificate_map_entry_full.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_certificate_map_entry_full.tf.tmpl index a6e8ceaaa68a..bdee7b6df907 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_certificate_map_entry_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_certificate_map_entry_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_certificate_manager_certificate_map" "certificate_map" { - name = "<%= ctx[:vars]['cert_map_entry_name'] %>" + name = "{{index $.Vars "cert_map_entry_name"}}" description = "My acceptance test certificate map" labels = { "terraform" : true, @@ -7,8 +7,8 @@ resource "google_certificate_manager_certificate_map" "certificate_map" { } } -resource "google_certificate_manager_certificate_map_entry" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_map_entry_name'] %>" +resource "google_certificate_manager_certificate_map_entry" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_map_entry_name"}}" description = "My acceptance test certificate map entry" map = google_certificate_manager_certificate_map.certificate_map.name labels = { @@ -20,7 +20,7 @@ resource "google_certificate_manager_certificate_map_entry" "<%= ctx[:primary_re } resource "google_certificate_manager_certificate" "certificate" { - name = "<%= ctx[:vars]['cert_map_entry_name'] %>" + name = "{{index $.Vars "cert_map_entry_name"}}" description = "The default cert" scope = "DEFAULT" managed { @@ -37,13 +37,13 @@ resource "google_certificate_manager_certificate" "certificate" { resource "google_certificate_manager_dns_authorization" "instance" { - name = "<%= ctx[:vars]['dns_auth_name'] %>" + name = "{{index $.Vars "dns_auth_name"}}" description = "The default dnss" - domain = "<%= ctx[:vars]['dns_auth_subdomain'] %>.hashicorptest.com" + domain = "{{index $.Vars "dns_auth_subdomain"}}.hashicorptest.com" } resource "google_certificate_manager_dns_authorization" "instance2" { - name = "<%= ctx[:vars]['dns_auth_name2'] %>" + name = "{{index $.Vars "dns_auth_name2"}}" description = "The default dnss" - domain = "<%= ctx[:vars]['dns_auth_subdomain2'] %>.hashicorptest.com" + domain = "{{index $.Vars "dns_auth_subdomain2"}}.hashicorptest.com" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/certificate_manager_dns_authorization_basic.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_dns_authorization_basic.tf.tmpl index a63cbe5392b2..b6265df38b29 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_dns_authorization_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_dns_authorization_basic.tf.tmpl @@ -1,18 +1,18 @@ -resource "google_certificate_manager_dns_authorization" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['dns_auth_name'] %>" +resource "google_certificate_manager_dns_authorization" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "dns_auth_name"}}" location = "global" description = "The default dns" - domain = "<%= ctx[:vars]['subdomain'] %>.hashicorptest.com" + domain = "{{index $.Vars "subdomain"}}.hashicorptest.com" } output "record_name_to_insert" { - value = google_certificate_manager_dns_authorization.<%= ctx[:primary_resource_id] %>.dns_resource_record.0.name + value = google_certificate_manager_dns_authorization.{{$.PrimaryResourceId}}.dns_resource_record.0.name } output "record_type_to_insert" { - value = google_certificate_manager_dns_authorization.<%= ctx[:primary_resource_id] %>.dns_resource_record.0.type + value = google_certificate_manager_dns_authorization.{{$.PrimaryResourceId}}.dns_resource_record.0.type } output "record_data_to_insert" { - value = google_certificate_manager_dns_authorization.<%= ctx[:primary_resource_id] %>.dns_resource_record.0.data + value = google_certificate_manager_dns_authorization.{{$.PrimaryResourceId}}.dns_resource_record.0.data } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/certificate_manager_dns_authorization_regional.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_dns_authorization_regional.tf.tmpl index 21df9b21c914..89d6cd883edc 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_dns_authorization_regional.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_dns_authorization_regional.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_certificate_manager_dns_authorization" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['dns_auth_name'] %>" +resource "google_certificate_manager_dns_authorization" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "dns_auth_name"}}" location = "us-central1" description = "reginal dns" type = "PER_PROJECT_RECORD" - domain = "<%= ctx[:vars]['subdomain'] %>.hashicorptest.com" + domain = "{{index $.Vars "subdomain"}}.hashicorptest.com" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns.tf.tmpl index 6e457875fbd2..3ba56109d175 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_name'] %>" +resource "google_certificate_manager_certificate" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_name"}}" description = "The default cert" scope = "EDGE_CACHE" labels = { @@ -19,14 +19,14 @@ resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] resource "google_certificate_manager_dns_authorization" "instance" { - name = "<%= ctx[:vars]['dns_auth_name'] %>" + name = "{{index $.Vars "dns_auth_name"}}" description = "The default dnss" - domain = "<%= ctx[:vars]['dns_auth_subdomain'] %>.hashicorptest.com" + domain = "{{index $.Vars "dns_auth_subdomain"}}.hashicorptest.com" } resource "google_certificate_manager_dns_authorization" "instance2" { - name = "<%= ctx[:vars]['dns_auth_name2'] %>" + name = "{{index $.Vars "dns_auth_name2"}}" description = "The default dnss" - domain = "<%= ctx[:vars]['dns_auth_subdomain2'] %>.hashicorptest.com" + domain = "{{index $.Vars "dns_auth_subdomain2"}}.hashicorptest.com" } diff --git a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns_all_regions.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns_all_regions.tf.tmpl index af70e19ee7c0..662f3d5eb5e7 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns_all_regions.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_dns_all_regions.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_name'] %>" +resource "google_certificate_manager_certificate" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_name"}}" description = "The default cert" scope = "ALL_REGIONS" managed { @@ -16,14 +16,14 @@ resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] resource "google_certificate_manager_dns_authorization" "instance" { - name = "<%= ctx[:vars]['dns_auth_name'] %>" + name = "{{index $.Vars "dns_auth_name"}}" description = "The default dnss" - domain = "<%= ctx[:vars]['dns_auth_subdomain'] %>.hashicorptest.com" + domain = "{{index $.Vars "dns_auth_subdomain"}}.hashicorptest.com" } resource "google_certificate_manager_dns_authorization" "instance2" { - name = "<%= ctx[:vars]['dns_auth_name2'] %>" + name = "{{index $.Vars "dns_auth_name2"}}" description = "The default dnss" - domain = "<%= ctx[:vars]['dns_auth_subdomain2'] %>.hashicorptest.com" + domain = "{{index $.Vars "dns_auth_subdomain2"}}.hashicorptest.com" } diff --git a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config.tf.tmpl index 003daf93222a..8a19547e8db1 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_name'] %>" +resource "google_certificate_manager_certificate" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_name"}}" description = "The default cert" scope = "EDGE_CACHE" managed { @@ -14,7 +14,7 @@ resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] # creating certificate_issuance_config to use it in the managed certificate resource "google_certificate_manager_certificate_issuance_config" "issuanceconfig" { - name = "<%= ctx[:vars]["issuance_config_name"] %>" + name = "{{index $.Vars "issuance_config_name"}}" description = "sample description for the certificate issuanceConfigs" certificate_authority_config { certificate_authority_service_config { @@ -28,7 +28,7 @@ resource "google_certificate_manager_certificate_issuance_config" "issuanceconfi } resource "google_privateca_ca_pool" "pool" { - name = "<%= ctx[:vars]["pool_name"] %>" + name = "{{index $.Vars "pool_name"}}" location = "us-central1" tier = "ENTERPRISE" } @@ -36,7 +36,7 @@ resource "google_privateca_ca_pool" "pool" { resource "google_privateca_certificate_authority" "ca_authority" { location = "us-central1" pool = google_privateca_ca_pool.pool.name - certificate_authority_id = "<%= ctx[:vars]["ca_name"] %>" + certificate_authority_id = "{{index $.Vars "ca_name"}}" config { subject_config { subject { diff --git a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config_all_regions.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config_all_regions.tf.tmpl index 14c0f819ce59..71dd1680f108 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config_all_regions.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_google_managed_certificate_issuance_config_all_regions.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_name'] %>" +resource "google_certificate_manager_certificate" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_name"}}" description = "sample google managed all_regions certificate with issuance config for terraform" scope = "ALL_REGIONS" managed { @@ -14,7 +14,7 @@ resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] # creating certificate_issuance_config to use it in the managed certificate resource "google_certificate_manager_certificate_issuance_config" "issuanceconfig" { - name = "<%= ctx[:vars]["issuance_config_name"] %>" + name = "{{index $.Vars "issuance_config_name"}}" description = "sample description for the certificate issuanceConfigs" certificate_authority_config { certificate_authority_service_config { @@ -28,7 +28,7 @@ resource "google_certificate_manager_certificate_issuance_config" "issuanceconfi } resource "google_privateca_ca_pool" "pool" { - name = "<%= ctx[:vars]["pool_name"] %>" + name = "{{index $.Vars "pool_name"}}" location = "us-central1" tier = "ENTERPRISE" } @@ -36,7 +36,7 @@ resource "google_privateca_ca_pool" "pool" { resource "google_privateca_certificate_authority" "ca_authority" { location = "us-central1" pool = google_privateca_ca_pool.pool.name - certificate_authority_id = "<%= ctx[:vars]["ca_name"] %>" + certificate_authority_id = "{{index $.Vars "ca_name"}}" config { subject_config { subject { diff --git a/mmv1/templates/terraform/examples/certificate_manager_google_managed_regional_certificate_dns_auth.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_google_managed_regional_certificate_dns_auth.tf.tmpl index f49a6cf70d8f..072fb3dbe1ad 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_google_managed_regional_certificate_dns_auth.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_google_managed_regional_certificate_dns_auth.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_name'] %>" +resource "google_certificate_manager_certificate" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_name"}}" description = "regional managed certs" location = "us-central1" managed { @@ -12,8 +12,8 @@ resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] } } resource "google_certificate_manager_dns_authorization" "instance" { - name = "<%= ctx[:vars]['dns_auth_name'] %>" + name = "{{index $.Vars "dns_auth_name"}}" location = "us-central1" description = "The default dnss" - domain = "<%= ctx[:vars]['dns_auth_subdomain'] %>.hashicorptest.com" + domain = "{{index $.Vars "dns_auth_subdomain"}}.hashicorptest.com" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/certificate_manager_self_managed_certificate.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_self_managed_certificate.tf.tmpl index f4386affe096..478474fc9736 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_self_managed_certificate.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_self_managed_certificate.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_name'] %>" +resource "google_certificate_manager_certificate" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_name"}}" description = "Global cert" scope = "ALL_REGIONS" self_managed { diff --git a/mmv1/templates/terraform/examples/certificate_manager_self_managed_certificate_regional.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_self_managed_certificate_regional.tf.tmpl index 8aaed8e2c737..1bf1f4126e7d 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_self_managed_certificate_regional.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_self_managed_certificate_regional.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cert_name'] %>" +resource "google_certificate_manager_certificate" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cert_name"}}" description = "Regional cert" location = "us-central1" self_managed { diff --git a/mmv1/templates/terraform/examples/certificate_manager_trust_config.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_trust_config.tf.tmpl index d9458137fd2d..15fbfde9484a 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_trust_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_trust_config.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_trust_config" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["trust_config_name"] %>" +resource "google_certificate_manager_trust_config" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "trust_config_name"}}" description = "sample description for the trust config" location = "us-central1" diff --git a/mmv1/templates/terraform/examples/certificate_manager_trust_config_allowlisted_certificates.tf.tmpl b/mmv1/templates/terraform/examples/certificate_manager_trust_config_allowlisted_certificates.tf.tmpl index 5b9890dcf018..90dff10f6d3f 100644 --- a/mmv1/templates/terraform/examples/certificate_manager_trust_config_allowlisted_certificates.tf.tmpl +++ b/mmv1/templates/terraform/examples/certificate_manager_trust_config_allowlisted_certificates.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_certificate_manager_trust_config" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["trust_config_name"] %>" +resource "google_certificate_manager_trust_config" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "trust_config_name"}}" description = "A sample trust config resource with allowlisted certificates" location = "global" diff --git a/mmv1/templates/terraform/examples/cloud_asset_folder_feed.tf.tmpl b/mmv1/templates/terraform/examples/cloud_asset_folder_feed.tf.tmpl index 84a8e50b132b..a164c381c778 100644 --- a/mmv1/templates/terraform/examples/cloud_asset_folder_feed.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_asset_folder_feed.tf.tmpl @@ -1,9 +1,9 @@ # Create a feed that sends notifications about network resource updates under a # particular folder. -resource "google_cloud_asset_folder_feed" "<%= ctx[:primary_resource_id] %>" { - billing_project = "<%= ctx[:test_env_vars]["project"] %>" +resource "google_cloud_asset_folder_feed" "{{$.PrimaryResourceId}}" { + billing_project = "{{index $.TestEnvVars "project"}}" folder = google_folder.my_folder.folder_id - feed_id = "<%= ctx[:vars]["feed_id"] %>" + feed_id = "{{index $.Vars "feed_id"}}" content_type = "RESOURCE" asset_types = [ @@ -29,19 +29,19 @@ resource "google_cloud_asset_folder_feed" "<%= ctx[:primary_resource_id] %>" { # The topic where the resource change notifications will be sent. resource "google_pubsub_topic" "feed_output" { - project = "<%= ctx[:test_env_vars]["project"] %>" - name = "<%= ctx[:vars]["feed_id"] %>" + project = "{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "feed_id"}}" } # The folder that will be monitored for resource updates. resource "google_folder" "my_folder" { - display_name = "<%= ctx[:vars]["folder_name"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" + display_name = "{{index $.Vars "folder_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" deletion_protection = false } # Find the project number of the project whose identity will be used for sending # the asset change notifications. data "google_project" "project" { - project_id = "<%= ctx[:test_env_vars]["project"] %>" + project_id = "{{index $.TestEnvVars "project"}}" } diff --git a/mmv1/templates/terraform/examples/cloud_asset_organization_feed.tf.tmpl b/mmv1/templates/terraform/examples/cloud_asset_organization_feed.tf.tmpl index db245be8ce0a..1dd57288b3b3 100644 --- a/mmv1/templates/terraform/examples/cloud_asset_organization_feed.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_asset_organization_feed.tf.tmpl @@ -1,9 +1,9 @@ # Create a feed that sends notifications about network resource updates under a # particular organization. -resource "google_cloud_asset_organization_feed" "<%= ctx[:primary_resource_id] %>" { - billing_project = "<%= ctx[:test_env_vars]["project"] %>" - org_id = "<%= ctx[:test_env_vars]["org_id"] %>" - feed_id = "<%= ctx[:vars]["feed_id"] %>" +resource "google_cloud_asset_organization_feed" "{{$.PrimaryResourceId}}" { + billing_project = "{{index $.TestEnvVars "project"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + feed_id = "{{index $.Vars "feed_id"}}" content_type = "RESOURCE" asset_types = [ @@ -29,12 +29,12 @@ resource "google_cloud_asset_organization_feed" "<%= ctx[:primary_resource_id] % # The topic where the resource change notifications will be sent. resource "google_pubsub_topic" "feed_output" { - project = "<%= ctx[:test_env_vars]["project"] %>" - name = "<%= ctx[:vars]["feed_id"] %>" + project = "{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "feed_id"}}" } # Find the project number of the project whose identity will be used for sending # the asset change notifications. data "google_project" "project" { - project_id = "<%= ctx[:test_env_vars]["project"] %>" + project_id = "{{index $.TestEnvVars "project"}}" } diff --git a/mmv1/templates/terraform/examples/cloud_asset_project_feed.tf.tmpl b/mmv1/templates/terraform/examples/cloud_asset_project_feed.tf.tmpl index 369dd0be713f..529ec85ac991 100644 --- a/mmv1/templates/terraform/examples/cloud_asset_project_feed.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_asset_project_feed.tf.tmpl @@ -1,7 +1,7 @@ # Create a feed that sends notifications about network resource updates. -resource "google_cloud_asset_project_feed" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]["project"] %>" - feed_id = "<%= ctx[:vars]["feed_id"] %>" +resource "google_cloud_asset_project_feed" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project"}}" + feed_id = "{{index $.Vars "feed_id"}}" content_type = "RESOURCE" asset_types = [ @@ -27,12 +27,12 @@ resource "google_cloud_asset_project_feed" "<%= ctx[:primary_resource_id] %>" { # The topic where the resource change notifications will be sent. resource "google_pubsub_topic" "feed_output" { - project = "<%= ctx[:test_env_vars]["project"] %>" - name = "<%= ctx[:vars]["feed_id"] %>" + project = "{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "feed_id"}}" } # Find the project number of the project whose identity will be used for sending # the asset change notifications. data "google_project" "project" { - project_id = "<%= ctx[:test_env_vars]["project"] %>" + project_id = "{{index $.TestEnvVars "project"}}" } diff --git a/mmv1/templates/terraform/examples/cloud_identity_group_membership.tf.tmpl b/mmv1/templates/terraform/examples/cloud_identity_group_membership.tf.tmpl index ce660ca58e69..062f388c90a1 100644 --- a/mmv1/templates/terraform/examples/cloud_identity_group_membership.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_identity_group_membership.tf.tmpl @@ -1,10 +1,10 @@ resource "google_cloud_identity_group" "group" { - display_name = "<%= ctx[:vars]['id_group'] %>" + display_name = "{{index $.Vars "id_group"}}" - parent = "customers/<%= ctx[:test_env_vars]['cust_id'] %>" + parent = "customers/{{index $.TestEnvVars "cust_id"}}" group_key { - id = "<%= ctx[:vars]['id_group'] %>@<%= ctx[:test_env_vars]['org_domain'] %>" + id = "{{index $.Vars "id_group"}}@{{index $.TestEnvVars "org_domain"}}" } labels = { @@ -13,12 +13,12 @@ resource "google_cloud_identity_group" "group" { } resource "google_cloud_identity_group" "child-group" { - display_name = "<%= ctx[:vars]['id_group'] %>-child" + display_name = "{{index $.Vars "id_group"}}-child" - parent = "customers/<%= ctx[:test_env_vars]['cust_id'] %>" + parent = "customers/{{index $.TestEnvVars "cust_id"}}" group_key { - id = "<%= ctx[:vars]['id_group'] %>-child@<%= ctx[:test_env_vars]['org_domain'] %>" + id = "{{index $.Vars "id_group"}}-child@{{index $.TestEnvVars "org_domain"}}" } labels = { @@ -26,7 +26,7 @@ resource "google_cloud_identity_group" "child-group" { } } -resource "google_cloud_identity_group_membership" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_identity_group_membership" "{{$.PrimaryResourceId}}" { group = google_cloud_identity_group.group.id preferred_member_key { diff --git a/mmv1/templates/terraform/examples/cloud_identity_group_membership_user.tf.tmpl b/mmv1/templates/terraform/examples/cloud_identity_group_membership_user.tf.tmpl index 01310c5b6856..f09d481b290a 100644 --- a/mmv1/templates/terraform/examples/cloud_identity_group_membership_user.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_identity_group_membership_user.tf.tmpl @@ -1,10 +1,10 @@ resource "google_cloud_identity_group" "group" { - display_name = "<%= ctx[:vars]['id_group'] %>" + display_name = "{{index $.Vars "id_group"}}" - parent = "customers/<%= ctx[:test_env_vars]['cust_id'] %>" + parent = "customers/{{index $.TestEnvVars "cust_id"}}" group_key { - id = "<%= ctx[:vars]['id_group'] %>@<%= ctx[:test_env_vars]['org_domain'] %>" + id = "{{index $.Vars "id_group"}}@{{index $.TestEnvVars "org_domain"}}" } labels = { @@ -16,7 +16,7 @@ resource "google_cloud_identity_group_membership" "cloud_identity_group_membersh group = google_cloud_identity_group.group.id preferred_member_key { - id = "<%= ctx[:test_env_vars]['identity_user'] %>@<%= ctx[:test_env_vars]['org_domain'] %>" + id = "{{index $.TestEnvVars "identity_user"}}@{{index $.TestEnvVars "org_domain"}}" } roles { diff --git a/mmv1/templates/terraform/examples/cloud_identity_groups_basic.tf.tmpl b/mmv1/templates/terraform/examples/cloud_identity_groups_basic.tf.tmpl index 96b14ca59f26..6dcb0ec9d6be 100644 --- a/mmv1/templates/terraform/examples/cloud_identity_groups_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_identity_groups_basic.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_cloud_identity_group" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['id_group'] %>" +resource "google_cloud_identity_group" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "id_group"}}" initial_group_config = "WITH_INITIAL_OWNER" - parent = "customers/<%= ctx[:test_env_vars]['cust_id'] %>" + parent = "customers/{{index $.TestEnvVars "cust_id"}}" group_key { - id = "<%= ctx[:vars]['id_group'] %>@<%= ctx[:test_env_vars]['org_domain'] %>" + id = "{{index $.Vars "id_group"}}@{{index $.TestEnvVars "org_domain"}}" } labels = { diff --git a/mmv1/templates/terraform/examples/cloud_run_domain_mapping_basic.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_domain_mapping_basic.tf.tmpl index 6d5e31461860..2422ec591b76 100644 --- a/mmv1/templates/terraform/examples/cloud_run_domain_mapping_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_domain_mapping_basic.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" metadata { - namespace = "<%= ctx[:test_env_vars]['namespace'] %>" + namespace = "{{index $.TestEnvVars "namespace"}}" } template { @@ -16,15 +16,15 @@ resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_cloud_run_domain_mapping" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_run_domain_mapping" "{{$.PrimaryResourceId}}" { location = "us-central1" name = "verified-domain.com" metadata { - namespace = "<%= ctx[:test_env_vars]['namespace'] %>" + namespace = "{{index $.TestEnvVars "namespace"}}" } spec { - route_name = google_cloud_run_service.<%= ctx[:primary_resource_id] %>.name + route_name = google_cloud_run_service.{{$.PrimaryResourceId}}.name } } diff --git a/mmv1/templates/terraform/examples/cloud_run_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_service_basic.tf.tmpl index 73d3011c6d68..2e2bf9c1fc51 100644 --- a/mmv1/templates/terraform/examples/cloud_run_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_service_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" template { diff --git a/mmv1/templates/terraform/examples/cloud_run_service_multicontainer.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_service_multicontainer.tf.tmpl index 1281d0422d63..b7c4f9b9196a 100644 --- a/mmv1/templates/terraform/examples/cloud_run_service_multicontainer.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_service_multicontainer.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" provider = google-beta diff --git a/mmv1/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.tmpl index 77048d167128..4a768b1a036a 100644 --- a/mmv1/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_service_multiple_environment_variables.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" template { diff --git a/mmv1/templates/terraform/examples/cloud_run_service_noauth.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_service_noauth.tf.tmpl index f747683286a8..be4c904ef2fe 100644 --- a/mmv1/templates/terraform/examples/cloud_run_service_noauth.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_service_noauth.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" template { diff --git a/mmv1/templates/terraform/examples/cloud_run_service_probes.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_service_probes.tf.tmpl index c3de35060e14..ed54ebdbb763 100644 --- a/mmv1/templates/terraform/examples/cloud_run_service_probes.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_service_probes.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" template { diff --git a/mmv1/templates/terraform/examples/cloud_run_service_secret_environment_variables.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_service_secret_environment_variables.tf.tmpl index da9c2e34b428..93e25d4a9baf 100644 --- a/mmv1/templates/terraform/examples/cloud_run_service_secret_environment_variables.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_service_secret_environment_variables.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_secret_manager_secret" "secret" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } @@ -20,8 +20,8 @@ resource "google_secret_manager_secret_iam_member" "secret-access" { depends_on = [google_secret_manager_secret.secret] } -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" template { diff --git a/mmv1/templates/terraform/examples/cloud_run_service_secret_volumes.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_service_secret_volumes.tf.tmpl index a3ba0b82d169..28db3c3b9c8d 100644 --- a/mmv1/templates/terraform/examples/cloud_run_service_secret_volumes.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_service_secret_volumes.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_secret_manager_secret" "secret" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } @@ -20,8 +20,8 @@ resource "google_secret_manager_secret_iam_member" "secret-access" { depends_on = [google_secret_manager_secret.secret] } -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" template { diff --git a/mmv1/templates/terraform/examples/cloud_run_service_sql.tf.tmpl b/mmv1/templates/terraform/examples/cloud_run_service_sql.tf.tmpl index 900c87507792..61482f577bca 100644 --- a/mmv1/templates/terraform/examples/cloud_run_service_sql.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_run_service_sql.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" template { @@ -21,12 +21,12 @@ resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['cloud_run_sql_name'] %>" + name = "{{index $.Vars "cloud_run_sql_name"}}" region = "us-east1" database_version = "MYSQL_5_7" settings { tier = "db-f1-micro" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/cloud_tasks_queue_advanced.tf.tmpl b/mmv1/templates/terraform/examples/cloud_tasks_queue_advanced.tf.tmpl index 71fc9d23f684..24ded5493c0f 100644 --- a/mmv1/templates/terraform/examples/cloud_tasks_queue_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_tasks_queue_advanced.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_tasks_queue" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_cloud_tasks_queue" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" app_engine_routing_override { diff --git a/mmv1/templates/terraform/examples/cloud_tasks_queue_http_target_oauth.tf.tmpl b/mmv1/templates/terraform/examples/cloud_tasks_queue_http_target_oauth.tf.tmpl index 106d33fc9b78..ab4c7d919a67 100644 --- a/mmv1/templates/terraform/examples/cloud_tasks_queue_http_target_oauth.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_tasks_queue_http_target_oauth.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_tasks_queue" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_cloud_tasks_queue" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" http_target { diff --git a/mmv1/templates/terraform/examples/cloud_tasks_queue_http_target_oidc.tf.tmpl b/mmv1/templates/terraform/examples/cloud_tasks_queue_http_target_oidc.tf.tmpl index 54e80a294f2d..ff90f8718b74 100644 --- a/mmv1/templates/terraform/examples/cloud_tasks_queue_http_target_oidc.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloud_tasks_queue_http_target_oidc.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_tasks_queue" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_cloud_tasks_queue" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" http_target { diff --git a/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config.tf.tmpl index bb1a7c4262f7..82b3fc04777f 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuild_bitbucket_server_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" +resource "google_cloudbuild_bitbucket_server_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" location = "us-central1" host_uri = "https://bbs.com" secrets { diff --git a/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_peered_network.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_peered_network.tf.tmpl index bedb109901ee..190cf5ebd566 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_peered_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_peered_network.tf.tmpl @@ -6,12 +6,12 @@ resource "google_project_service" "servicenetworking" { } resource "google_compute_network" "vpc_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" depends_on = [google_project_service.servicenetworking] } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['global_address_name'] %>" + name = "{{index $.Vars "global_address_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 @@ -25,8 +25,8 @@ resource "google_service_networking_connection" "default" { depends_on = [google_project_service.servicenetworking] } -resource "google_cloudbuild_bitbucket_server_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" +resource "google_cloudbuild_bitbucket_server_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" location = "us-central1" host_uri = "https://bbs.com" secrets { diff --git a/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_repositories.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_repositories.tf.tmpl index b51f6d459399..5c10bb0621bd 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_repositories.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_bitbucket_server_config_repositories.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuild_bitbucket_server_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" +resource "google_cloudbuild_bitbucket_server_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" location = "us-central1" host_uri = "https://bbs.com" secrets { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_allow_exit_codes.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_allow_exit_codes.tf.tmpl index 9343e020cbae..f17badf3c8e9 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_allow_exit_codes.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_allow_exit_codes.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" location = "global" trigger_template { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_allow_failure.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_allow_failure.tf.tmpl index aa6c7c277e95..55cca3a9e6fb 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_allow_failure.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_allow_failure.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" location = "global" trigger_template { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_bitbucket_server_pull_request.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_bitbucket_server_pull_request.tf.tmpl index e3966a739a68..a98bc4402ccd 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_bitbucket_server_pull_request.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_bitbucket_server_pull_request.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" location = "us-central1" bitbucket_server_trigger_config { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_bitbucket_server_push.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_bitbucket_server_push.tf.tmpl index 30b2d311b819..11487060f3a0 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_bitbucket_server_push.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_bitbucket_server_push.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { name = "bbs-push-trigger" location = "us-central1" bitbucket_server_trigger_config { - repo_slug = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" + repo_slug = "{{index $.Vars "cloudbuild_trigger_name"}}" project_key = "STAG" bitbucket_server_config_resource = "projects/123456789/locations/us-central1/bitbucketServerConfigs/myBitbucketConfig" push { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_build.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_build.tf.tmpl index f5d3e8fe4b22..735b33a71ae5 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_build.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_build.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" location = "global" trigger_template { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_filename.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_filename.tf.tmpl index 11ec5d8a971e..5218c2bee823 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_filename.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_filename.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { location = "us-central1" trigger_template { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_github.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_github.tf.tmpl index 1edee21c1985..d587fd23c2e9 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_github.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_github.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { location = "europe-west4" github { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.tmpl index 40bd7c400a8a..2a43e774e92b 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_github_enterprise.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" location = "us-central1" github { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_include_build_logs.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_include_build_logs.tf.tmpl index e5b39624fd51..1bd2505bafa3 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_include_build_logs.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_include_build_logs.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { location = "us-central1" - name = "<%= ctx[:primary_resource_id] %>" + name = "{{$.PrimaryResourceId}}" filename = "cloudbuild.yaml" github { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_manual.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_manual.tf.tmpl index 636686010584..4718b2dba002 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_manual.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_manual.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" source_to_build { uri = "https://hashicorp/terraform-provider-google-beta" diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_manual_bitbucket_server.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_manual_bitbucket_server.tf.tmpl index 186f5ca43de9..a3a7070987a4 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_manual_bitbucket_server.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_manual_bitbucket_server.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { name = "terraform-manual-bbs-trigger" source_to_build { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_manual_github_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_manual_github_enterprise.tf.tmpl index af6ab4cec3cb..599617b52a17 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_manual_github_enterprise.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_manual_github_enterprise.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" source_to_build { uri = "https://hashicorp/terraform-provider-google-beta" diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_config.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_config.tf.tmpl index 6b34b0b2d739..f35402958f4a 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_config.tf.tmpl @@ -1,11 +1,11 @@ resource "google_pubsub_topic" "mytopic" { - name = "<%= ctx[:vars]['pubsub_topic_name'] %>" + name = "{{index $.Vars "pubsub_topic_name"}}" } -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { location = "us-central1" - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" + name = "{{index $.Vars "cloudbuild_trigger_name"}}" description = "acceptance test example pubsub build trigger" pubsub_config { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_with_repo.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_with_repo.tf.tmpl index 795f2735d6a9..58bd1a1ce6b6 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_with_repo.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_pubsub_with_repo.tf.tmpl @@ -1,27 +1,27 @@ resource "google_cloudbuildv2_connection" "my-connection" { location = "us-central1" - name = "<%= ctx[:vars]['cloudbuildv2_connection_name'] %>" + name = "{{index $.Vars "cloudbuildv2_connection_name"}}" github_config { - app_installation_id = <%= ctx[:vars]['installation_id'] %> + app_installation_id = {{index $.Vars "installation_id"}} authorizer_credential { - oauth_token_secret_version = "<%= ctx[:vars]['pat_secret'] %>" + oauth_token_secret_version = "{{index $.Vars "pat_secret"}}" } } } resource "google_cloudbuildv2_repository" "my-repository" { - name = "<%= ctx[:vars]['cloudbuildv2_repo_name'] %>" + name = "{{index $.Vars "cloudbuildv2_repo_name"}}" parent_connection = google_cloudbuildv2_connection.my-connection.id - remote_uri = "<%= ctx[:vars]['repo_uri'] %>" + remote_uri = "{{index $.Vars "repo_uri"}}" } resource "google_pubsub_topic" "mytopic" { - name = "<%= ctx[:vars]['pubsub_topic_name'] %>" + name = "{{index $.Vars "pubsub_topic_name"}}" } -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" location = "us-central1" pubsub_config { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_repo.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_repo.tf.tmpl index 83628908bbaf..aedfed9aaead 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_repo.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_repo.tf.tmpl @@ -1,22 +1,22 @@ resource "google_cloudbuildv2_connection" "my-connection" { location = "us-central1" - name = "<%= ctx[:vars]['cloudbuildv2_connection_name'] %>" + name = "{{index $.Vars "cloudbuildv2_connection_name"}}" github_config { - app_installation_id = <%= ctx[:vars]['installation_id'] %> + app_installation_id = {{index $.Vars "installation_id"}} authorizer_credential { - oauth_token_secret_version = "<%= ctx[:vars]['pat_secret'] %>" + oauth_token_secret_version = "{{index $.Vars "pat_secret"}}" } } } resource "google_cloudbuildv2_repository" "my-repository" { - name = "<%= ctx[:vars]['cloudbuildv2_repo_name'] %>" + name = "{{index $.Vars "cloudbuildv2_repo_name"}}" parent_connection = google_cloudbuildv2_connection.my-connection.id - remote_uri = "<%= ctx[:vars]['repo_uri'] %>" + remote_uri = "{{index $.Vars "repo_uri"}}" } -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { location = "us-central1" repository_event_config { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_service_account.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_service_account.tf.tmpl index bd175c58a764..0fe2aff73297 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_service_account.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_service_account.tf.tmpl @@ -1,6 +1,6 @@ data "google_project" "project" {} -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { trigger_template { branch_name = "main" repo_name = "my-repo" @@ -15,7 +15,7 @@ resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { } resource "google_service_account" "cloudbuild_service_account" { - account_id = "<%= ctx[:vars]['sa_name'] %>" + account_id = "{{index $.Vars "sa_name"}}" } resource "google_project_iam_member" "act_as" { diff --git a/mmv1/templates/terraform/examples/cloudbuild_trigger_webhook_config.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuild_trigger_webhook_config.tf.tmpl index 1f270b706fc6..b82999bf77bd 100644 --- a/mmv1/templates/terraform/examples/cloudbuild_trigger_webhook_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuild_trigger_webhook_config.tf.tmpl @@ -1,6 +1,6 @@ resource "google_secret_manager_secret" "webhook_trigger_secret_key" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { @@ -35,8 +35,8 @@ resource "google_secret_manager_secret_iam_policy" "policy" { } -resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloudbuild_trigger_name'] %>" +resource "google_cloudbuild_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloudbuild_trigger_name"}}" description = "acceptance test example webhook build trigger" webhook_config { diff --git a/mmv1/templates/terraform/examples/cloudbuildv2_connection.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuildv2_connection.tf.tmpl index 041bbf4587e2..ddae31697d22 100644 --- a/mmv1/templates/terraform/examples/cloudbuildv2_connection.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuildv2_connection.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloudbuildv2_connection" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudbuildv2_connection" "{{$.PrimaryResourceId}}" { location = "us-central1" - name = "<%= ctx[:vars]['connection_name'] %>" + name = "{{index $.Vars "connection_name"}}" github_config { app_installation_id = 0 diff --git a/mmv1/templates/terraform/examples/cloudbuildv2_repository_ghe.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuildv2_repository_ghe.tf.tmpl index 0796cc725a2f..2d9f0ca97afb 100644 --- a/mmv1/templates/terraform/examples/cloudbuildv2_repository_ghe.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuildv2_repository_ghe.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloudbuildv2_repository" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['repository_name'] %>" +resource "google_cloudbuildv2_repository" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "repository_name"}}" parent_connection = google_cloudbuildv2_connection.ghe_complete.name remote_uri = "https://ghe.proctor-staging-test.com/proctorteam/regional_test.git" location = "us-central1" @@ -10,7 +10,7 @@ resource "google_cloudbuildv2_repository" "<%= ctx[:primary_resource_id] %>" { resource "google_cloudbuildv2_connection" "ghe_complete" { location = "us-central1" - name = "<%= ctx[:vars]['connection_name'] %>" + name = "{{index $.Vars "connection_name"}}" github_enterprise_config { host_uri = "https://ghe.proctor-staging-test.com" diff --git a/mmv1/templates/terraform/examples/cloudbuildv2_repository_github.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuildv2_repository_github.tf.tmpl index 83dd25360c0d..827b746d3686 100644 --- a/mmv1/templates/terraform/examples/cloudbuildv2_repository_github.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuildv2_repository_github.tf.tmpl @@ -1,5 +1,5 @@ resource "google_cloudbuildv2_repository" "primary" { - name = "<%= ctx[:vars]['repository_name'] %>" + name = "{{index $.Vars "repository_name"}}" parent_connection = google_cloudbuildv2_connection.github_update.name remote_uri = "https://github.com/gcb-repos-robot/tf-demo.git" location = "us-central1" @@ -8,7 +8,7 @@ resource "google_cloudbuildv2_repository" "primary" { resource "google_cloudbuildv2_connection" "github_update" { location = "us-central1" - name = "<%= ctx[:vars]['connection_name'] %>" + name = "{{index $.Vars "connection_name"}}" disabled = false github_config { diff --git a/mmv1/templates/terraform/examples/cloudbuildv2_repository_gle.tf.tmpl b/mmv1/templates/terraform/examples/cloudbuildv2_repository_gle.tf.tmpl index e45eecfa98ce..41ebefc04cb7 100644 --- a/mmv1/templates/terraform/examples/cloudbuildv2_repository_gle.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudbuildv2_repository_gle.tf.tmpl @@ -1,5 +1,5 @@ resource "google_cloudbuildv2_repository" "primary" { - name = "<%= ctx[:vars]['repository_name'] %>" + name = "{{index $.Vars "repository_name"}}" parent_connection = google_cloudbuildv2_connection.gle.name remote_uri = "https://gle-us-central1.gcb-test.com/proctor-test/smoketest.git" location = "us-west1" @@ -11,7 +11,7 @@ resource "google_cloudbuildv2_repository" "primary" { resource "google_cloudbuildv2_connection" "gle" { location = "us-west1" - name = "<%= ctx[:vars]['connection_name'] %>" + name = "{{index $.Vars "connection_name"}}" gitlab_config { authorizer_credential { diff --git a/mmv1/templates/terraform/examples/clouddeploy_automation_basic.tf.tmpl b/mmv1/templates/terraform/examples/clouddeploy_automation_basic.tf.tmpl index 41b460f1aefb..1dfefa1ba89a 100644 --- a/mmv1/templates/terraform/examples/clouddeploy_automation_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddeploy_automation_basic.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_clouddeploy_automation" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['automation'] %>" +resource "google_clouddeploy_automation" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "automation"}}" project = google_clouddeploy_delivery_pipeline.pipeline.project location = google_clouddeploy_delivery_pipeline.pipeline.location delivery_pipeline = google_clouddeploy_delivery_pipeline.pipeline.name - service_account = "<%= ctx[:test_env_vars]['service_account'] %>" + service_account = "{{index $.TestEnvVars "service_account"}}" selector { targets { id = "*" @@ -18,7 +18,7 @@ resource "google_clouddeploy_automation" "<%= ctx[:primary_resource_id] %>" { } resource "google_clouddeploy_delivery_pipeline" "pipeline" { - name = "<%= ctx[:vars]['delivery_pipeline'] %>" + name = "{{index $.Vars "delivery_pipeline"}}" location = "us-central1" serial_pipeline { stages { diff --git a/mmv1/templates/terraform/examples/clouddeploy_automation_full.tf.tmpl b/mmv1/templates/terraform/examples/clouddeploy_automation_full.tf.tmpl index 51bf98d1bca1..40810de2343b 100644 --- a/mmv1/templates/terraform/examples/clouddeploy_automation_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddeploy_automation_full.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_clouddeploy_automation" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['automation'] %>" +resource "google_clouddeploy_automation" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "automation"}}" location = "us-central1" delivery_pipeline = google_clouddeploy_delivery_pipeline.pipeline.name - service_account = "<%= ctx[:test_env_vars]['service_account'] %>" + service_account = "{{index $.TestEnvVars "service_account"}}" annotations = { my_first_annotation = "example-annotation-1" my_second_annotation = "example-annotation-2" @@ -39,7 +39,7 @@ resource "google_clouddeploy_automation" "<%= ctx[:primary_resource_id] %>" { } resource "google_clouddeploy_delivery_pipeline" "pipeline" { - name = "<%= ctx[:vars]['delivery_pipeline'] %>" + name = "{{index $.Vars "delivery_pipeline"}}" location = "us-central1" serial_pipeline { stages { diff --git a/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_basic.tf.tmpl b/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_basic.tf.tmpl index 77e7541f05fb..f4bd68c7d682 100644 --- a/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_clouddeploy_custom_target_type" "<%= ctx[:primary_resource_id] %>" { +resource "google_clouddeploy_custom_target_type" "{{$.PrimaryResourceId}}" { location = "us-central1" - name = "<%= ctx[:vars]['custom_target_type_name'] %>" + name = "{{index $.Vars "custom_target_type_name"}}" description = "My custom target type" annotations = { my_first_annotation = "example-annotation-1" diff --git a/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_gcb_repo_skaffold_modules.tf.tmpl b/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_gcb_repo_skaffold_modules.tf.tmpl index 0c365e781738..51ac301c287a 100644 --- a/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_gcb_repo_skaffold_modules.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_gcb_repo_skaffold_modules.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_clouddeploy_custom_target_type" "<%= ctx[:primary_resource_id] %>" { +resource "google_clouddeploy_custom_target_type" "{{$.PrimaryResourceId}}" { location = "us-central1" - name = "<%= ctx[:vars]['custom_target_type_name'] %>" + name = "{{index $.Vars "custom_target_type_name"}}" description = "My custom target type" custom_actions { render_action = "renderAction" diff --git a/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_gcs_skaffold_modules.tf.tmpl b/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_gcs_skaffold_modules.tf.tmpl index 3dc84a768fdf..fd88be7ca79c 100644 --- a/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_gcs_skaffold_modules.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_gcs_skaffold_modules.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_clouddeploy_custom_target_type" "<%= ctx[:primary_resource_id] %>" { +resource "google_clouddeploy_custom_target_type" "{{$.PrimaryResourceId}}" { location = "us-central1" - name = "<%= ctx[:vars]['custom_target_type_name'] %>" + name = "{{index $.Vars "custom_target_type_name"}}" description = "My custom target type" custom_actions { render_action = "renderAction" diff --git a/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_git_skaffold_modules.tf.tmpl b/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_git_skaffold_modules.tf.tmpl index c5955e2258a0..6d7e70a3402c 100644 --- a/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_git_skaffold_modules.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddeploy_custom_target_type_git_skaffold_modules.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_clouddeploy_custom_target_type" "<%= ctx[:primary_resource_id] %>" { +resource "google_clouddeploy_custom_target_type" "{{$.PrimaryResourceId}}" { location = "us-central1" - name = "<%= ctx[:vars]['custom_target_type_name'] %>" + name = "{{index $.Vars "custom_target_type_name"}}" description = "My custom target type" custom_actions { render_action = "renderAction" diff --git a/mmv1/templates/terraform/examples/clouddeploy_delivery_pipeline_basic.tf.tmpl b/mmv1/templates/terraform/examples/clouddeploy_delivery_pipeline_basic.tf.tmpl index 3dc79dc37bc7..ec24f38fcfb6 100644 --- a/mmv1/templates/terraform/examples/clouddeploy_delivery_pipeline_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddeploy_delivery_pipeline_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_clouddeploy_delivery_pipeline" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['delivery_pipeline'] %>" +resource "google_clouddeploy_delivery_pipeline" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "delivery_pipeline"}}" location = "us-central1" serial_pipeline { stages { diff --git a/mmv1/templates/terraform/examples/clouddeploy_target_basic.tf.tmpl b/mmv1/templates/terraform/examples/clouddeploy_target_basic.tf.tmpl index 5fd51566834c..8b9b21c52fa7 100644 --- a/mmv1/templates/terraform/examples/clouddeploy_target_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddeploy_target_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_clouddeploy_target" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target'] %>" +resource "google_clouddeploy_target" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/clouddomains_registration_full.tf.tmpl b/mmv1/templates/terraform/examples/clouddomains_registration_full.tf.tmpl index 02c5c4c9c803..0e82c1b1b71b 100644 --- a/mmv1/templates/terraform/examples/clouddomains_registration_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/clouddomains_registration_full.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_clouddomains_registration" <%= ctx[:primary_resource_id] %> { +resource "google_clouddomains_registration" {{$.PrimaryResourceId}} { domain_name = "example-domain.com" location = "global" labels = { diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_abiu.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_abiu.tf.tmpl index be7a2a08ac52..b850585bc62c 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_abiu.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_abiu.tf.tmpl @@ -1,21 +1,21 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_service_account" "account" { provider = google-beta - account_id = "<%= ctx[:vars]['service_account'] %>" + account_id = "{{index $.Vars "service_account"}}" display_name = "Test Service Account" } resource "google_pubsub_topic" "topic" { provider = google-beta - name = "<%= ctx[:vars]['topic'] %>" + name = "{{index $.Vars "topic"}}" } resource "google_storage_bucket" "bucket" { provider = google-beta - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -24,12 +24,12 @@ resource "google_storage_bucket_object" "object" { provider = google-beta name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['function'] %>" + name = "{{index $.Vars "function"}}" location = "europe-west6" description = "a new function" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_abiu_on_deploy.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_abiu_on_deploy.tf.tmpl index 61ca7d460ce7..f90f726cfb65 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_abiu_on_deploy.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_abiu_on_deploy.tf.tmpl @@ -1,21 +1,21 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_service_account" "account" { provider = google-beta - account_id = "<%= ctx[:vars]['service_account'] %>" + account_id = "{{index $.Vars "service_account"}}" display_name = "Test Service Account" } resource "google_pubsub_topic" "topic" { provider = google-beta - name = "<%= ctx[:vars]['topic'] %>" + name = "{{index $.Vars "topic"}}" } resource "google_storage_bucket" "bucket" { provider = google-beta - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -24,12 +24,12 @@ resource "google_storage_bucket_object" "object" { provider = google-beta name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['function'] %>" + name = "{{index $.Vars "function"}}" location = "europe-west6" description = "a new function" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_basic.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_basic.tf.tmpl index 58eb2670a74a..4b21e2ea0f35 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_basic.tf.tmpl @@ -1,9 +1,9 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_storage_bucket" "bucket" { - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -11,11 +11,11 @@ resource "google_storage_bucket" "bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['function'] %>" +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "function"}}" location = "us-central1" description = "a new function" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_basic_auditlogs.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_basic_auditlogs.tf.tmpl index c932b60e7de6..3b0382735f58 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_basic_auditlogs.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_basic_auditlogs.tf.tmpl @@ -4,7 +4,7 @@ # https://cloud.google.com/eventarc/docs/path-patterns resource "google_storage_bucket" "source-bucket" { - name = "<%= ctx[:vars]['bucket_name_source'] %>" + name = "{{index $.Vars "bucket_name_source"}}" location = "US" uniform_bucket_level_access = true } @@ -12,11 +12,11 @@ resource "google_storage_bucket" "source-bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.source-bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } resource "google_service_account" "account" { - account_id = "<%= ctx[:vars]['service_account'] %>" + account_id = "{{index $.Vars "service_account"}}" display_name = "Test Service Account - used for both the cloud function and eventarc trigger in the test" } @@ -24,38 +24,38 @@ resource "google_service_account" "account" { # Here we use Audit Logs to monitor the bucket so path patterns can be used in the example of # google_cloudfunctions2_function below (Audit Log events have path pattern support) resource "google_storage_bucket" "audit-log-bucket" { - name = "<%= ctx[:vars]['bucket_name_auditlogs'] %>" + name = "{{index $.Vars "bucket_name_auditlogs"}}" location = "us-central1" # The trigger must be in the same location as the bucket uniform_bucket_level_access = true } # Permissions on the service account used by the function and Eventarc trigger resource "google_project_iam_member" "invoking" { - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" role = "roles/run.invoker" member = "serviceAccount:${google_service_account.account.email}" } resource "google_project_iam_member" "event-receiving" { - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" role = "roles/eventarc.eventReceiver" member = "serviceAccount:${google_service_account.account.email}" depends_on = [google_project_iam_member.invoking] } resource "google_project_iam_member" "artifactregistry-reader" { - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" role = "roles/artifactregistry.reader" member = "serviceAccount:${google_service_account.account.email}" depends_on = [google_project_iam_member.event-receiving] } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { depends_on = [ google_project_iam_member.event-receiving, google_project_iam_member.artifactregistry-reader, ] - name = "<%= ctx[:vars]['function_name'] %>" + name = "{{index $.Vars "function_name"}}" location = "us-central1" description = "a new function" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_basic_builder.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_basic_builder.tf.tmpl index ca5ef36d1eff..4eb4c7b615da 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_basic_builder.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_basic_builder.tf.tmpl @@ -1,9 +1,9 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_service_account" "account" { - account_id = "<%= ctx[:vars]['service_account'] %>" + account_id = "{{index $.Vars "service_account"}}" display_name = "Test Service Account" } @@ -26,7 +26,7 @@ resource "google_project_iam_member" "storage_object_admin" { } resource "google_storage_bucket" "bucket" { - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -34,7 +34,7 @@ resource "google_storage_bucket" "bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } # builder permissions need to stablize before it can pull the source zip @@ -48,8 +48,8 @@ resource "time_sleep" "wait_60s" { ] } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['function'] %>" +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "function"}}" location = "us-central1" description = "a new function" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_basic_gcs.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_basic_gcs.tf.tmpl index 00a11528241d..212e28be09d5 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_basic_gcs.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_basic_gcs.tf.tmpl @@ -1,5 +1,5 @@ resource "google_storage_bucket" "source-bucket" { - name = "<%= ctx[:vars]['bucket_name_source'] %>" + name = "{{index $.Vars "bucket_name_source"}}" location = "US" uniform_bucket_level_access = true } @@ -7,11 +7,11 @@ resource "google_storage_bucket" "source-bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.source-bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } resource "google_storage_bucket" "trigger-bucket" { - name = "<%= ctx[:vars]['bucket_name_trigger'] %>" + name = "{{index $.Vars "bucket_name_trigger"}}" location = "us-central1" # The trigger must be in the same location as the bucket uniform_bucket_level_access = true } @@ -22,44 +22,44 @@ data "google_storage_project_service_account" "gcs_account" { # To use GCS CloudEvent triggers, the GCS service account requires the Pub/Sub Publisher(roles/pubsub.publisher) IAM role in the specified project. # (See https://cloud.google.com/eventarc/docs/run/quickstart-storage#before-you-begin) resource "google_project_iam_member" "gcs-pubsub-publishing" { - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" role = "roles/pubsub.publisher" member = "serviceAccount:${data.google_storage_project_service_account.gcs_account.email_address}" } resource "google_service_account" "account" { - account_id = "<%= ctx[:vars]['service_account'] %>" + account_id = "{{index $.Vars "service_account"}}" display_name = "Test Service Account - used for both the cloud function and eventarc trigger in the test" } # Permissions on the service account used by the function and Eventarc trigger resource "google_project_iam_member" "invoking" { - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" role = "roles/run.invoker" member = "serviceAccount:${google_service_account.account.email}" depends_on = [google_project_iam_member.gcs-pubsub-publishing] } resource "google_project_iam_member" "event-receiving" { - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" role = "roles/eventarc.eventReceiver" member = "serviceAccount:${google_service_account.account.email}" depends_on = [google_project_iam_member.invoking] } resource "google_project_iam_member" "artifactregistry-reader" { - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" role = "roles/artifactregistry.reader" member = "serviceAccount:${google_service_account.account.email}" depends_on = [google_project_iam_member.event-receiving] } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { depends_on = [ google_project_iam_member.event-receiving, google_project_iam_member.artifactregistry-reader, ] - name = "<%= ctx[:vars]['function_name'] %>" + name = "{{index $.Vars "function_name"}}" location = "us-central1" description = "a new function" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_cmek.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_cmek.tf.tmpl index 5b9823300b59..1b49f007b727 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_cmek.tf.tmpl @@ -1,5 +1,5 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } data "google_project" "project" { @@ -9,7 +9,7 @@ data "google_project" "project" { resource "google_storage_bucket" "bucket" { provider = google-beta - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -19,7 +19,7 @@ resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } resource "google_project_service_identity" "ea_sa" { @@ -32,7 +32,7 @@ resource "google_project_service_identity" "ea_sa" { resource "google_artifact_registry_repository" "unencoded-ar-repo" { provider = google-beta - repository_id = "<%= ctx[:vars]['unencoded-ar-repo'] %>" + repository_id = "{{index $.Vars "unencoded-ar-repo"}}" location = "us-central1" format = "DOCKER" } @@ -49,7 +49,7 @@ resource "google_artifact_registry_repository_iam_member" "member" { resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_1" { provider = google-beta - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcf-admin-robot.iam.gserviceaccount.com" @@ -58,7 +58,7 @@ resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_1" { resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_2" { provider = google-beta - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" @@ -67,7 +67,7 @@ resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_2" { resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_3" { provider = google-beta - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gs-project-accounts.iam.gserviceaccount.com" @@ -76,7 +76,7 @@ resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_3" { resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_4" { provider = google-beta - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@serverless-robot-prod.iam.gserviceaccount.com" @@ -85,7 +85,7 @@ resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_4" { resource "google_kms_crypto_key_iam_member" "gcf_cmek_keyuser_5" { provider = google-beta - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = google_project_service_identity.ea_sa.member @@ -95,9 +95,9 @@ resource "google_artifact_registry_repository" "encoded-ar-repo" { provider = google-beta location = "us-central1" - repository_id = "<%= ctx[:vars]['cmek-repo'] %>" + repository_id = "{{index $.Vars "cmek-repo"}}" format = "DOCKER" - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" depends_on = [ google_kms_crypto_key_iam_member.gcf_cmek_keyuser_1, @@ -108,13 +108,13 @@ resource "google_artifact_registry_repository" "encoded-ar-repo" { ] } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['function'] %>" + name = "{{index $.Vars "function"}}" location = "us-central1" description = "CMEK function" - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" build_config { runtime = "nodejs16" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_cmek_docs.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_cmek_docs.tf.tmpl index ce52ea01409e..4186413d2d8a 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_cmek_docs.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_cmek_docs.tf.tmpl @@ -1,5 +1,5 @@ locals { - project = "<%= ctx[:vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.Vars "project"}}" # Google Cloud Platform Project ID } data "google_project" "project" { @@ -9,7 +9,7 @@ data "google_project" "project" { resource "google_storage_bucket" "bucket" { provider = google-beta - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -19,7 +19,7 @@ resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } resource "google_project_service_identity" "ea_sa" { @@ -32,7 +32,7 @@ resource "google_project_service_identity" "ea_sa" { resource "google_artifact_registry_repository" "unencoded-ar-repo" { provider = google-beta - repository_id = "<%= ctx[:vars]['unencoded-ar-repo'] %>" + repository_id = "{{index $.Vars "unencoded-ar-repo"}}" location = "us-central1" format = "DOCKER" } @@ -51,7 +51,7 @@ resource "google_artifact_registry_repository_iam_binding" "binding" { resource "google_kms_crypto_key_iam_binding" "gcf_cmek_keyuser" { provider = google-beta - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" members = [ @@ -71,21 +71,21 @@ resource "google_artifact_registry_repository" "encoded-ar-repo" { provider = google-beta location = "us-central1" - repository_id = "<%= ctx[:vars]['cmek-repo'] %>" + repository_id = "{{index $.Vars "cmek-repo"}}" format = "DOCKER" - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" depends_on = [ google_kms_crypto_key_iam_binding.gcf_cmek_keyuser ] } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['function'] %>" + name = "{{index $.Vars "function"}}" location = "us-central1" description = "CMEK function" - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" build_config { runtime = "nodejs16" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_full.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_full.tf.tmpl index a5222dc3c6c9..c2efd6c2b6f0 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_full.tf.tmpl @@ -1,18 +1,18 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_service_account" "account" { - account_id = "<%= ctx[:vars]['service_account'] %>" + account_id = "{{index $.Vars "service_account"}}" display_name = "Test Service Account" } resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['topic'] %>" + name = "{{index $.Vars "topic"}}" } resource "google_storage_bucket" "bucket" { - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -20,11 +20,11 @@ resource "google_storage_bucket" "bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['function'] %>" +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "function"}}" location = "us-central1" description = "a new function" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_private_workerpool.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_private_workerpool.tf.tmpl index edc2240eacf6..9b684eebe6c2 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_private_workerpool.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_private_workerpool.tf.tmpl @@ -1,9 +1,9 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_storage_bucket" "bucket" { - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -11,11 +11,11 @@ resource "google_storage_bucket" "bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } resource "google_cloudbuild_worker_pool" "pool" { - name = "<%= ctx[:vars]['pool'] %>" + name = "{{index $.Vars "pool"}}" location = "us-central1" worker_config { disk_size_gb = 100 @@ -24,8 +24,8 @@ resource "google_cloudbuild_worker_pool" "pool" { } } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['function'] %>" +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "function"}}" location = "us-central1" description = "a new function" diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_scheduler_auth.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_scheduler_auth.tf.tmpl index a42ab22965b7..0781426cb51a 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_scheduler_auth.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_scheduler_auth.tf.tmpl @@ -1,14 +1,14 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_service_account" "account" { - account_id = "<%= ctx[:vars]['service_account'] %>" + account_id = "{{index $.Vars "service_account"}}" display_name = "Test Service Account" } resource "google_storage_bucket" "bucket" { - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -16,11 +16,11 @@ resource "google_storage_bucket" "bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['function'] %>" # name should use kebab-case so generated Cloud Run service name will be the same +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "function"}}" # name should use kebab-case so generated Cloud Run service name will be the same location = "us-central1" description = "a new function" @@ -44,33 +44,33 @@ resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { } resource "google_cloudfunctions2_function_iam_member" "invoker" { - project = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.project - location = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.location - cloud_function = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.name + project = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.project + location = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.location + cloud_function = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.name role = "roles/cloudfunctions.invoker" member = "serviceAccount:${google_service_account.account.email}" } resource "google_cloud_run_service_iam_member" "cloud_run_invoker" { - project = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.project - location = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.location - service = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.name + project = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.project + location = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.location + service = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.name role = "roles/run.invoker" member = "serviceAccount:${google_service_account.account.email}" } resource "google_cloud_scheduler_job" "invoke_cloud_function" { - name = "invoke-<%= ctx[:vars]['function'] %>" + name = "invoke-{{index $.Vars "function"}}" description = "Schedule the HTTPS trigger for cloud function" schedule = "0 0 * * *" # every day at midnight - project = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.project - region = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.location + project = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.project + region = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.location http_target { - uri = google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.service_config[0].uri + uri = google_cloudfunctions2_function.{{$.PrimaryResourceId}}.service_config[0].uri http_method = "POST" oidc_token { - audience = "${google_cloudfunctions2_function.<%= ctx[:primary_resource_id] %>.service_config[0].uri}/" + audience = "${google_cloudfunctions2_function.{{$.PrimaryResourceId}}.service_config[0].uri}/" service_account_email = google_service_account.account.email } } diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_secret_env.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_secret_env.tf.tmpl index 1c3097219ba0..0a055025be9f 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_secret_env.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_secret_env.tf.tmpl @@ -1,9 +1,9 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_storage_bucket" "bucket" { - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -11,11 +11,11 @@ resource "google_storage_bucket" "bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['function'] %>" +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "function"}}" location = "us-central1" description = "a new function" @@ -46,7 +46,7 @@ resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { } resource "google_secret_manager_secret" "secret" { - secret_id = "<%= ctx[:vars]['secret'] %>" + secret_id = "{{index $.Vars "secret"}}" replication { user_managed { @@ -60,6 +60,6 @@ resource "google_secret_manager_secret" "secret" { resource "google_secret_manager_secret_version" "secret" { secret = google_secret_manager_secret.secret.name - secret_data = "<%= ctx[:vars]['secret'] %>" + secret_data = "{{index $.Vars "secret"}}" enabled = true } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/cloudfunctions2_secret_volume.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions2_secret_volume.tf.tmpl index 96bbdeb62f34..748e703c0898 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions2_secret_volume.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions2_secret_volume.tf.tmpl @@ -1,9 +1,9 @@ locals { - project = "<%= ctx[:test_env_vars]['project'] %>" # Google Cloud Platform Project ID + project = "{{index $.TestEnvVars "project"}}" # Google Cloud Platform Project ID } resource "google_storage_bucket" "bucket" { - name = "${local.project}-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "${local.project}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -11,11 +11,11 @@ resource "google_storage_bucket" "bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } -resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['function'] %>" +resource "google_cloudfunctions2_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "function"}}" location = "us-central1" description = "a new function" @@ -45,7 +45,7 @@ resource "google_cloudfunctions2_function" "<%= ctx[:primary_resource_id] %>" { } resource "google_secret_manager_secret" "secret" { - secret_id = "<%= ctx[:vars]['secret'] %>" + secret_id = "{{index $.Vars "secret"}}" replication { user_managed { @@ -59,6 +59,6 @@ resource "google_secret_manager_secret" "secret" { resource "google_secret_manager_secret_version" "secret" { secret = google_secret_manager_secret.secret.name - secret_data = "<%= ctx[:vars]['secret'] %>" + secret_data = "{{index $.Vars "secret"}}" enabled = true } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/cloudfunctions_cloud_function.tf.tmpl b/mmv1/templates/terraform/examples/cloudfunctions_cloud_function.tf.tmpl index 35b5f53c3f6d..409da0b0b9f7 100644 --- a/mmv1/templates/terraform/examples/cloudfunctions_cloud_function.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudfunctions_cloud_function.tf.tmpl @@ -1,16 +1,16 @@ resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } resource "google_storage_bucket_object" "archive" { name = "index.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" + source = "{{index $.Vars "zip_path"}}" } -resource "google_cloudfunctions_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['function_name'] %>" +resource "google_cloudfunctions_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "function_name"}}" description = "My function" runtime = "nodejs10" diff --git a/mmv1/templates/terraform/examples/cloudids_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/cloudids_endpoint.tf.tmpl index 7ccfcad8ded9..34b6d78e44bb 100644 --- a/mmv1/templates/terraform/examples/cloudids_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudids_endpoint.tf.tmpl @@ -14,7 +14,7 @@ resource "google_service_networking_connection" "private_service_connection" { reserved_peering_ranges = [google_compute_global_address.service_range.name] } -resource "google_cloud_ids_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_ids_endpoint" "{{$.PrimaryResourceId}}" { name = "test" location = "us-central1-f" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/cloudquotas_quota_preference_basic.tf.tmpl b/mmv1/templates/terraform/examples/cloudquotas_quota_preference_basic.tf.tmpl index af168e050e95..920fcb8b2440 100644 --- a/mmv1/templates/terraform/examples/cloudquotas_quota_preference_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudquotas_quota_preference_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloud_quotas_quota_preference" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" - name = "<%= ctx[:vars]['name'] %>" +resource "google_cloud_quotas_quota_preference" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "name"}}" dimensions = { region = "us-east1" } service = "compute.googleapis.com" quota_id = "CPUS-per-project-region" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_job_basic.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_job_basic.tf.tmpl index 5eb48cde2e78..f32711e510d1 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_job_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_job_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_job_name'] %>" +resource "google_cloud_run_v2_job" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_job_name"}}" location = "us-central1" deletion_protection = false diff --git a/mmv1/templates/terraform/examples/cloudrunv2_job_directvpc.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_job_directvpc.tf.tmpl index 805f703159ed..3c8ca197aaef 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_job_directvpc.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_job_directvpc.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_job_name'] %>" +resource "google_cloud_run_v2_job" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_job_name"}}" location = "us-central1" deletion_protection = false launch_stage = "GA" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_job_emptydir.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_job_emptydir.tf.tmpl index 3da094327bf6..fbabbe991fd8 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_job_emptydir.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_job_emptydir.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_run_v2_job" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['cloud_run_job_name'] %>" + name = "{{index $.Vars "cloud_run_job_name"}}" location = "us-central1" deletion_protection = false launch_stage = "BETA" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_job_limits.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_job_limits.tf.tmpl index ced507f858c6..c1ba237176f3 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_job_limits.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_job_limits.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_job_name'] %>" +resource "google_cloud_run_v2_job" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_job_name"}}" location = "us-central1" deletion_protection = false diff --git a/mmv1/templates/terraform/examples/cloudrunv2_job_run_job.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_job_run_job.tf.tmpl index 51d19bb56b3a..438eeab91d8f 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_job_run_job.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_job_run_job.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_run_v2_job" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['cloud_run_job_name'] %>" + name = "{{index $.Vars "cloud_run_job_name"}}" location = "us-central1" deletion_protection = false start_execution_token = "start-once-created" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_job_secret.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_job_secret.tf.tmpl index 325610803de3..520ef2410540 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_job_secret.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_job_secret.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_job_name'] %>" +resource "google_cloud_run_v2_job" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_job_name"}}" location = "us-central1" deletion_protection = false @@ -37,7 +37,7 @@ data "google_project" "project" { } resource "google_secret_manager_secret" "secret" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } diff --git a/mmv1/templates/terraform/examples/cloudrunv2_job_sql.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_job_sql.tf.tmpl index db875e95ecb2..5d3a8c263554 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_job_sql.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_job_sql.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_job_name'] %>" +resource "google_cloud_run_v2_job" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_job_name"}}" location = "us-central1" deletion_protection = false template { @@ -40,7 +40,7 @@ data "google_project" "project" { } resource "google_secret_manager_secret" "secret" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } @@ -59,12 +59,12 @@ resource "google_secret_manager_secret_iam_member" "secret-access" { } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['cloud_run_sql_name'] %>" + name = "{{index $.Vars "cloud_run_sql_name"}}" region = "us-central1" database_version = "MYSQL_5_7" settings { tier = "db-f1-micro" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/cloudrunv2_job_vpcaccess.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_job_vpcaccess.tf.tmpl index 6755d8559ccc..39cbc126eaf9 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_job_vpcaccess.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_job_vpcaccess.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_job_name'] %>" +resource "google_cloud_run_v2_job" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_job_name"}}" location = "us-central1" deletion_protection = false @@ -17,7 +17,7 @@ resource "google_cloud_run_v2_job" "<%= ctx[:primary_resource_id] %>" { } resource "google_vpc_access_connector" "connector" { - name = "<%= ctx[:vars]['vpc_access_connector_name'] %>" + name = "{{index $.Vars "vpc_access_connector_name"}}" subnet { name = google_compute_subnetwork.custom_test.name } @@ -27,12 +27,12 @@ resource "google_vpc_access_connector" "connector" { region = "us-central1" } resource "google_compute_subnetwork" "custom_test" { - name = "<%= ctx[:vars]['vpc_compute_subnetwork_name'] %>" + name = "{{index $.Vars "vpc_compute_subnetwork_name"}}" ip_cidr_range = "10.2.0.0/28" region = "us-central1" network = google_compute_network.custom_test.id } resource "google_compute_network" "custom_test" { - name = "<%= ctx[:vars]['compute_network_name'] %>" + name = "{{index $.Vars "compute_network_name"}}" auto_create_subnetworks = false } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_basic.tf.tmpl index e5ce45478ff6..2949efc82151 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false ingress = "INGRESS_TRAFFIC_ALL" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_custom_audiences.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_custom_audiences.tf.tmpl index d77d23beae67..7530526f6b0c 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_custom_audiences.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_custom_audiences.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false launch_stage = "BETA" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_directvpc.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_directvpc.tf.tmpl index 8460569c6d0f..5fbee602618e 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_directvpc.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_directvpc.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false launch_stage = "GA" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_limits.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_limits.tf.tmpl index 2c166453536f..5929b55b4757 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_limits.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_limits.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false ingress = "INGRESS_TRAFFIC_ALL" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_mesh.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_mesh.tf.tmpl index 58fe085c2284..2cd98fd20a06 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_mesh.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_mesh.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" + name = "{{index $.Vars "cloud_run_service_name"}}" depends_on = [time_sleep.wait_for_mesh] deletion_protection = false @@ -25,5 +25,5 @@ resource "time_sleep" "wait_for_mesh" { resource "google_network_services_mesh" "mesh" { provider = google-beta - name = "<%= ctx[:vars]['mesh_name'] %>" + name = "{{index $.Vars "mesh_name"}}" } diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_mount_gcs.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_mount_gcs.tf.tmpl index 6742950f553f..f3001a8f896c 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_mount_gcs.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_mount_gcs.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false @@ -19,14 +19,14 @@ resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { volumes { name = "bucket" gcs { - bucket = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket = google_storage_bucket.{{$.PrimaryResourceId}}.name read_only = false } } } } -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_mount_nfs.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_mount_nfs.tf.tmpl index 302689328e38..46907ece2e15 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_mount_nfs.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_mount_nfs.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false @@ -32,8 +32,8 @@ resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_filestore_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1-b" tier = "BASIC_HDD" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_multicontainer.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_multicontainer.tf.tmpl index 6696c55c00ba..9ee26f40bda1 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_multicontainer.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_multicontainer.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false launch_stage = "BETA" diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_probes.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_probes.tf.tmpl index 7bab08c7ffa9..7c4adc1f1e6d 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_probes.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_probes.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_secret.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_secret.tf.tmpl index 5c89dbf447f6..6755d1de94d7 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_secret.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_secret.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false ingress = "INGRESS_TRAFFIC_ALL" @@ -31,7 +31,7 @@ data "google_project" "project" { } resource "google_secret_manager_secret" "secret" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_sql.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_sql.tf.tmpl index ff89c69f0a1a..6c873e5696e2 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_sql.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_sql.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false ingress = "INGRESS_TRAFFIC_ALL" @@ -50,7 +50,7 @@ data "google_project" "project" { } resource "google_secret_manager_secret" "secret" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { auto {} } @@ -69,12 +69,12 @@ resource "google_secret_manager_secret_iam_member" "secret-access" { } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['cloud_run_sql_name'] %>" + name = "{{index $.Vars "cloud_run_sql_name"}}" region = "us-central1" database_version = "MYSQL_5_7" settings { tier = "db-f1-micro" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/cloudrunv2_service_vpcaccess.tf.tmpl b/mmv1/templates/terraform/examples/cloudrunv2_service_vpcaccess.tf.tmpl index 6573ae4bbcc2..cc005f756b99 100644 --- a/mmv1/templates/terraform/examples/cloudrunv2_service_vpcaccess.tf.tmpl +++ b/mmv1/templates/terraform/examples/cloudrunv2_service_vpcaccess.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cloud_run_service_name'] %>" +resource "google_cloud_run_v2_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cloud_run_service_name"}}" location = "us-central1" deletion_protection = false @@ -15,7 +15,7 @@ resource "google_cloud_run_v2_service" "<%= ctx[:primary_resource_id] %>" { } resource "google_vpc_access_connector" "connector" { - name = "<%= ctx[:vars]['vpc_access_connector_name'] %>" + name = "{{index $.Vars "vpc_access_connector_name"}}" subnet { name = google_compute_subnetwork.custom_test.name } @@ -25,12 +25,12 @@ resource "google_vpc_access_connector" "connector" { region = "us-central1" } resource "google_compute_subnetwork" "custom_test" { - name = "<%= ctx[:vars]['vpc_compute_subnetwork_name'] %>" + name = "{{index $.Vars "vpc_compute_subnetwork_name"}}" ip_cidr_range = "10.2.0.0/28" region = "us-central1" network = google_compute_network.custom_test.id } resource "google_compute_network" "custom_test" { - name = "<%= ctx[:vars]['compute_network_name'] %>" + name = "{{index $.Vars "compute_network_name"}}" auto_create_subnetworks = false } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl b/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl index 356119c4ed0e..a2641c1bf801 100644 --- a/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl @@ -1,6 +1,6 @@ resource "google_composer_environment" "environment" { provider = google-beta - name = "<%= ctx[:vars]['environment_name'] %>" + name = "{{index $.Vars "environment_name"}}" region = "us-central1" config { software_config { @@ -9,9 +9,9 @@ resource "google_composer_environment" "environment" { } } -resource "google_composer_user_workloads_config_map" "<%= ctx[:primary_resource_id] %>" { +resource "google_composer_user_workloads_config_map" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['config_map_name'] %>" + name = "{{index $.Vars "config_map_name"}}" region = "us-central1" environment = google_composer_environment.environment.name data = { diff --git a/mmv1/templates/terraform/examples/compute_address_ipsec_interconnect.tf.tmpl b/mmv1/templates/terraform/examples/compute_address_ipsec_interconnect.tf.tmpl index 51ee53b2262a..949669704c3c 100644 --- a/mmv1/templates/terraform/examples/compute_address_ipsec_interconnect.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_address_ipsec_interconnect.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_address" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['address_name'] %>" +resource "google_compute_address" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "address_name"}}" address_type = "INTERNAL" purpose = "IPSEC_INTERCONNECT" address = "192.168.1.0" @@ -8,6 +8,6 @@ resource "google_compute_address" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/compute_firewall_policy_with_rules_full.tf.tmpl b/mmv1/templates/terraform/examples/compute_firewall_policy_with_rules_full.tf.tmpl index c6212aab8cbb..9bdc5db96f52 100644 --- a/mmv1/templates/terraform/examples/compute_firewall_policy_with_rules_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_firewall_policy_with_rules_full.tf.tmpl @@ -2,10 +2,10 @@ data "google_project" "project" { provider = google-beta } -resource "google_compute_firewall_policy_with_rules" "<%= ctx[:primary_resource_id] %>" { - short_name = "<%= ctx[:vars]['policy_name'] %>" +resource "google_compute_firewall_policy_with_rules" "{{$.PrimaryResourceId}}" { + short_name = "{{index $.Vars "policy_name"}}" description = "Terraform test" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" provider = google-beta rule { @@ -66,8 +66,8 @@ resource "google_compute_firewall_policy_with_rules" "<%= ctx[:primary_resource_ resource "google_network_security_address_group" "address_group_1" { provider = google-beta - name = "<%= ctx[:vars]['address_group_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + name = "{{index $.Vars "address_group_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" description = "Global address group" location = "global" items = ["208.80.154.224/32"] @@ -77,16 +77,16 @@ resource "google_network_security_address_group" "address_group_1" { resource "google_network_security_security_profile_group" "security_profile_group_1" { provider = google-beta - name = "<%= ctx[:vars]['security_profile_group_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + name = "{{index $.Vars "security_profile_group_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" description = "my description" threat_prevention_profile = google_network_security_security_profile.security_profile_1.id } resource "google_network_security_security_profile" "security_profile_1" { provider = google-beta - name = "<%= ctx[:vars]['security_profile_name'] %>" + name = "{{index $.Vars "security_profile_name"}}" type = "THREAT_PREVENTION" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } diff --git a/mmv1/templates/terraform/examples/compute_ha_vpn_gateway_encrypted_interconnect.tf.tmpl b/mmv1/templates/terraform/examples/compute_ha_vpn_gateway_encrypted_interconnect.tf.tmpl index 47460ed59dff..f0cdb0f6b406 100644 --- a/mmv1/templates/terraform/examples/compute_ha_vpn_gateway_encrypted_interconnect.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_ha_vpn_gateway_encrypted_interconnect.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_ha_vpn_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['ha_vpn_gateway_name'] %>" +resource "google_compute_ha_vpn_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "ha_vpn_gateway_name"}}" network = google_compute_network.network.id vpn_interfaces { id = 0 @@ -12,7 +12,7 @@ resource "google_compute_ha_vpn_gateway" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_interconnect_attachment" "attachment1" { - name = "<%= ctx[:vars]['interconnect_attachment1_name'] %>" + name = "{{index $.Vars "interconnect_attachment1_name"}}" edge_availability_domain = "AVAILABILITY_DOMAIN_1" type = "PARTNER" router = google_compute_router.router.id @@ -23,7 +23,7 @@ resource "google_compute_interconnect_attachment" "attachment1" { } resource "google_compute_interconnect_attachment" "attachment2" { - name = "<%= ctx[:vars]['interconnect_attachment2_name'] %>" + name = "{{index $.Vars "interconnect_attachment2_name"}}" edge_availability_domain = "AVAILABILITY_DOMAIN_2" type = "PARTNER" router = google_compute_router.router.id @@ -34,7 +34,7 @@ resource "google_compute_interconnect_attachment" "attachment2" { } resource "google_compute_address" "address1" { - name = "<%= ctx[:vars]['address1_name'] %>" + name = "{{index $.Vars "address1_name"}}" address_type = "INTERNAL" purpose = "IPSEC_INTERCONNECT" address = "192.168.1.0" @@ -43,7 +43,7 @@ resource "google_compute_address" "address1" { } resource "google_compute_address" "address2" { - name = "<%= ctx[:vars]['address2_name'] %>" + name = "{{index $.Vars "address2_name"}}" address_type = "INTERNAL" purpose = "IPSEC_INTERCONNECT" address = "192.168.2.0" @@ -52,7 +52,7 @@ resource "google_compute_address" "address2" { } resource "google_compute_router" "router" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" network = google_compute_network.network.name encrypted_interconnect_router = true bgp { @@ -61,6 +61,6 @@ resource "google_compute_router" "router" { } resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/compute_health_check_http_source_regions.tf.tmpl b/mmv1/templates/terraform/examples/compute_health_check_http_source_regions.tf.tmpl index 0f73cf3415f8..293b64fd9e09 100644 --- a/mmv1/templates/terraform/examples/compute_health_check_http_source_regions.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_health_check_http_source_regions.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_health_check" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['health_check_name'] %>" +resource "google_compute_health_check" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 30 http_health_check { diff --git a/mmv1/templates/terraform/examples/compute_health_check_https_source_regions.tf.tmpl b/mmv1/templates/terraform/examples/compute_health_check_https_source_regions.tf.tmpl index 2c5105229417..bff48ebfce7c 100644 --- a/mmv1/templates/terraform/examples/compute_health_check_https_source_regions.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_health_check_https_source_regions.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_health_check" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['health_check_name'] %>" +resource "google_compute_health_check" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 30 https_health_check { diff --git a/mmv1/templates/terraform/examples/compute_health_check_tcp_source_regions.tf.tmpl b/mmv1/templates/terraform/examples/compute_health_check_tcp_source_regions.tf.tmpl index b33f3e958f29..9a704f32e6fa 100644 --- a/mmv1/templates/terraform/examples/compute_health_check_tcp_source_regions.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_health_check_tcp_source_regions.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_health_check" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['health_check_name'] %>" +resource "google_compute_health_check" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 30 tcp_health_check { diff --git a/mmv1/templates/terraform/examples/compute_interconnect_attachment_ipsec_encryption.tf.tmpl b/mmv1/templates/terraform/examples/compute_interconnect_attachment_ipsec_encryption.tf.tmpl index bcfcd677bbad..0af7f4c0a98d 100644 --- a/mmv1/templates/terraform/examples/compute_interconnect_attachment_ipsec_encryption.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_interconnect_attachment_ipsec_encryption.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_interconnect_attachment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['interconnect_attachment_name'] %>" +resource "google_compute_interconnect_attachment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "interconnect_attachment_name"}}" edge_availability_domain = "AVAILABILITY_DOMAIN_1" type = "PARTNER" router = google_compute_router.router.id @@ -10,7 +10,7 @@ resource "google_compute_interconnect_attachment" "<%= ctx[:primary_resource_id] } resource "google_compute_address" "address" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" address_type = "INTERNAL" purpose = "IPSEC_INTERCONNECT" address = "192.168.1.0" @@ -19,7 +19,7 @@ resource "google_compute_address" "address" { } resource "google_compute_router" "router" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" network = google_compute_network.network.name encrypted_interconnect_router = true bgp { @@ -28,6 +28,6 @@ resource "google_compute_router" "router" { } resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/compute_interconnect_basic.tf.tmpl b/mmv1/templates/terraform/examples/compute_interconnect_basic.tf.tmpl index 0cafb84bcfc2..cdbf39957e21 100644 --- a/mmv1/templates/terraform/examples/compute_interconnect_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_interconnect_basic.tf.tmpl @@ -1,8 +1,8 @@ data "google_project" "project" {} -resource "google_compute_interconnect" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['interconnect_name'] %>" - customer_name = "<%= ctx[:vars]['customer_name'] %>" +resource "google_compute_interconnect" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "interconnect_name"}}" + customer_name = "{{index $.Vars "customer_name"}}" interconnect_type = "DEDICATED" link_type = "LINK_TYPE_ETHERNET_10G_LR" location = "https://www.googleapis.com/compute/v1/projects/${data.google_project.project.name}/global/interconnectLocations/iad-zone1-1" diff --git a/mmv1/templates/terraform/examples/compute_interconnect_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/compute_interconnect_basic_test.tf.tmpl index 37f9096982be..81ebb5b52019 100644 --- a/mmv1/templates/terraform/examples/compute_interconnect_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_interconnect_basic_test.tf.tmpl @@ -1,7 +1,7 @@ data "google_project" "project" {} -resource "google_compute_interconnect" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['interconnect_name'] %>" +resource "google_compute_interconnect" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "interconnect_name"}}" customer_name = "internal_customer" # Special customer only available for Google testing. interconnect_type = "DEDICATED" link_type = "LINK_TYPE_ETHERNET_10G_LR" diff --git a/mmv1/templates/terraform/examples/compute_machine_image_kms.tf.tmpl b/mmv1/templates/terraform/examples/compute_machine_image_kms.tf.tmpl index f29b00ae9cc1..9b4d1e008f07 100644 --- a/mmv1/templates/terraform/examples/compute_machine_image_kms.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_machine_image_kms.tf.tmpl @@ -1,6 +1,6 @@ resource "google_compute_instance" "vm" { provider = google-beta - name = "<%= ctx[:vars]['vm_name'] %>" + name = "{{index $.Vars "vm_name"}}" machine_type = "e2-medium" boot_disk { @@ -14,9 +14,9 @@ resource "google_compute_instance" "vm" { } } -resource "google_compute_machine_image" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_machine_image" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['image_name'] %>" + name = "{{index $.Vars "image_name"}}" source_instance = google_compute_instance.vm.self_link machine_image_encryption_key { kms_key_name = google_kms_crypto_key.crypto_key.id @@ -25,12 +25,12 @@ resource "google_compute_machine_image" "<%= ctx[:primary_resource_id] %>" { resource "google_kms_crypto_key" "crypto_key" { provider = google-beta - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id } resource "google_kms_key_ring" "key_ring" { provider = google-beta - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "us" } diff --git a/mmv1/templates/terraform/examples/compute_mig_resize_request.tf.tmpl b/mmv1/templates/terraform/examples/compute_mig_resize_request.tf.tmpl index 2731f5fe6c9b..635e8db71532 100644 --- a/mmv1/templates/terraform/examples/compute_mig_resize_request.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_mig_resize_request.tf.tmpl @@ -56,8 +56,8 @@ resource "google_compute_instance_group_manager" "a3_dws" { } -resource "google_compute_resize_request" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resize_request_name'] %>" +resource "google_compute_resize_request" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resize_request_name"}}" instance_group_manager = google_compute_instance_group_manager.a3_dws.name zone = "us-central1-a" description = "Test resize request resource" diff --git a/mmv1/templates/terraform/examples/compute_network_edge_security_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/compute_network_edge_security_service_basic.tf.tmpl index 4a9d01f7d357..fb47bae6f2ff 100644 --- a/mmv1/templates/terraform/examples/compute_network_edge_security_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_network_edge_security_service_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_network_edge_security_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_network_edge_security_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" region = "us-east1" description = "My basic resource" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/compute_network_firewall_policy_with_rules_full.tf.tmpl b/mmv1/templates/terraform/examples/compute_network_firewall_policy_with_rules_full.tf.tmpl index 13957d97b137..57fe2f5bcc1b 100644 --- a/mmv1/templates/terraform/examples/compute_network_firewall_policy_with_rules_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_network_firewall_policy_with_rules_full.tf.tmpl @@ -2,8 +2,8 @@ data "google_project" "project" { provider = google-beta } -resource "google_compute_network_firewall_policy_with_rules" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['policy_name'] %>" +resource "google_compute_network_firewall_policy_with_rules" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "policy_name"}}" description = "Terraform test" provider = google-beta @@ -71,7 +71,7 @@ resource "google_compute_network_firewall_policy_with_rules" "<%= ctx[:primary_r resource "google_network_security_address_group" "address_group_1" { provider = google-beta - name = "<%= ctx[:vars]['address_group_name'] %>" + name = "{{index $.Vars "address_group_name"}}" parent = "projects/${data.google_project.project.name}" description = "Global address group" location = "global" @@ -85,7 +85,7 @@ resource "google_tags_tag_key" "secure_tag_key_1" { description = "Tag key" parent = "projects/${data.google_project.project.name}" purpose = "GCE_FIREWALL" - short_name = "<%= ctx[:vars]['tag_key_name'] %>" + short_name = "{{index $.Vars "tag_key_name"}}" purpose_data = { network = "${data.google_project.project.name}/default" } @@ -95,22 +95,22 @@ resource "google_tags_tag_value" "secure_tag_value_1" { provider = google-beta description = "Tag value" parent = "tagKeys/${google_tags_tag_key.secure_tag_key_1.name}" - short_name = "<%= ctx[:vars]['tag_value_name'] %>" + short_name = "{{index $.Vars "tag_value_name"}}" } resource "google_network_security_security_profile_group" "security_profile_group_1" { provider = google-beta - name = "<%= ctx[:vars]['security_profile_group_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + name = "{{index $.Vars "security_profile_group_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" description = "my description" threat_prevention_profile = google_network_security_security_profile.security_profile_1.id } resource "google_network_security_security_profile" "security_profile_1" { provider = google-beta - name = "<%= ctx[:vars]['security_profile_name'] %>" + name = "{{index $.Vars "security_profile_name"}}" type = "THREAT_PREVENTION" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } diff --git a/mmv1/templates/terraform/examples/compute_packet_mirroring_full.tf.tmpl b/mmv1/templates/terraform/examples/compute_packet_mirroring_full.tf.tmpl index 0c7e388a4109..4a82a492c4cd 100644 --- a/mmv1/templates/terraform/examples/compute_packet_mirroring_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_packet_mirroring_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_instance" "mirror" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" boot_disk { @@ -16,23 +16,23 @@ resource "google_compute_instance" "mirror" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" network = google_compute_network.default.id ip_cidr_range = "10.2.0.0/16" } resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['service_name'] %>" + name = "{{index $.Vars "service_name"}}" health_checks = [google_compute_health_check.default.id] } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['hc_name'] %>" + name = "{{index $.Vars "hc_name"}}" check_interval_sec = 1 timeout_sec = 1 tcp_health_check { @@ -42,7 +42,7 @@ resource "google_compute_health_check" "default" { resource "google_compute_forwarding_rule" "default" { depends_on = [google_compute_subnetwork.default] - name = "<%= ctx[:vars]['ilb_rule_name'] %>" + name = "{{index $.Vars "ilb_rule_name"}}" is_mirroring_collector = true ip_protocol = "TCP" @@ -54,8 +54,8 @@ resource "google_compute_forwarding_rule" "default" { network_tier = "PREMIUM" } -resource "google_compute_packet_mirroring" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mirroring_name'] %>" +resource "google_compute_packet_mirroring" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mirroring_name"}}" description = "bar" network { url = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/compute_project_cloud_armor_tier_basic.tf.tmpl b/mmv1/templates/terraform/examples/compute_project_cloud_armor_tier_basic.tf.tmpl index 7dcf46e41b92..b7ac23580978 100644 --- a/mmv1/templates/terraform/examples/compute_project_cloud_armor_tier_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_project_cloud_armor_tier_basic.tf.tmpl @@ -1,3 +1,3 @@ -resource "google_compute_project_cloud_armor_tier" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_project_cloud_armor_tier" "{{$.PrimaryResourceId}}" { cloud_armor_tier = "CA_STANDARD" } diff --git a/mmv1/templates/terraform/examples/compute_project_cloud_armor_tier_project_set.tf.tmpl b/mmv1/templates/terraform/examples/compute_project_cloud_armor_tier_project_set.tf.tmpl index ecd1950903d0..15afc43b736e 100644 --- a/mmv1/templates/terraform/examples/compute_project_cloud_armor_tier_project_set.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_project_cloud_armor_tier_project_set.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -11,7 +11,7 @@ resource "google_project_service" "compute" { service = "compute.googleapis.com" } -resource "google_compute_project_cloud_armor_tier" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_project_cloud_armor_tier" "{{$.PrimaryResourceId}}" { project = google_project.project.project_id cloud_armor_tier = "CA_STANDARD" depends_on = [google_project_service.compute] diff --git a/mmv1/templates/terraform/examples/compute_region_commitment_basic.tf.tmpl b/mmv1/templates/terraform/examples/compute_region_commitment_basic.tf.tmpl index 55abbb072ff9..ee772cda81bd 100644 --- a/mmv1/templates/terraform/examples/compute_region_commitment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_region_commitment_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_commitment" "foobar" { - name = "<%= ctx[:vars]['region_commitment_name'] %>" + name = "{{index $.Vars "region_commitment_name"}}" plan = "THIRTY_SIX_MONTH" resources { type = "VCPU" diff --git a/mmv1/templates/terraform/examples/compute_region_commitment_full.tf.tmpl b/mmv1/templates/terraform/examples/compute_region_commitment_full.tf.tmpl index e41666d8e2c6..27ae29908ac9 100644 --- a/mmv1/templates/terraform/examples/compute_region_commitment_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_region_commitment_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_commitment" "foobar" { - name = "<%= ctx[:vars]['region_commitment_name'] %>" + name = "{{index $.Vars "region_commitment_name"}}" description = "some description" plan = "THIRTY_SIX_MONTH" type = "MEMORY_OPTIMIZED" diff --git a/mmv1/templates/terraform/examples/compute_reservation.tf.tmpl b/mmv1/templates/terraform/examples/compute_reservation.tf.tmpl index b50b19a1c8ca..c98518869326 100644 --- a/mmv1/templates/terraform/examples/compute_reservation.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_reservation.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_compute_reservation" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['gce_reservation_local'] %>" +resource "google_compute_reservation" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "gce_reservation_local"}}" zone = "us-central1-c" - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" share_settings { share_type = "LOCAL" diff --git a/mmv1/templates/terraform/examples/compute_router_encrypted_interconnect.tf.tmpl b/mmv1/templates/terraform/examples/compute_router_encrypted_interconnect.tf.tmpl index 8e29ec74b42e..0a9e67101f91 100644 --- a/mmv1/templates/terraform/examples/compute_router_encrypted_interconnect.tf.tmpl +++ b/mmv1/templates/terraform/examples/compute_router_encrypted_interconnect.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_router" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['router_name'] %>" +resource "google_compute_router" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "router_name"}}" network = google_compute_network.network.name encrypted_interconnect_router = true bgp { @@ -8,6 +8,6 @@ resource "google_compute_router" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/consumer_quota_override.tf.tmpl b/mmv1/templates/terraform/examples/consumer_quota_override.tf.tmpl index 366c3ca1c90e..95c967625eed 100644 --- a/mmv1/templates/terraform/examples/consumer_quota_override.tf.tmpl +++ b/mmv1/templates/terraform/examples/consumer_quota_override.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "my_project" { provider = google-beta name = "tf-test-project" - project_id = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/consumer_quota_override_custom_dimension.tf.tmpl b/mmv1/templates/terraform/examples/consumer_quota_override_custom_dimension.tf.tmpl index 29542bdec03c..6fd2996027cc 100644 --- a/mmv1/templates/terraform/examples/consumer_quota_override_custom_dimension.tf.tmpl +++ b/mmv1/templates/terraform/examples/consumer_quota_override_custom_dimension.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "my_project" { provider = google-beta name = "tf-test-project" - project_id = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/consumer_quota_override_zero_value.tf.tmpl b/mmv1/templates/terraform/examples/consumer_quota_override_zero_value.tf.tmpl index afab737e5575..7c79a3180b36 100644 --- a/mmv1/templates/terraform/examples/consumer_quota_override_zero_value.tf.tmpl +++ b/mmv1/templates/terraform/examples/consumer_quota_override_zero_value.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "my_project" { provider = google-beta name = "tf-test-project" - project_id = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/container_analysis_note_attestation_full.tf.tmpl b/mmv1/templates/terraform/examples/container_analysis_note_attestation_full.tf.tmpl index 994ec46b55d0..9174223dba9f 100644 --- a/mmv1/templates/terraform/examples/container_analysis_note_attestation_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/container_analysis_note_attestation_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_container_analysis_note" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["note_name"] %>" +resource "google_container_analysis_note" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "note_name"}}" short_description = "test note" long_description = "a longer description of test note" diff --git a/mmv1/templates/terraform/examples/container_analysis_note_basic.tf.tmpl b/mmv1/templates/terraform/examples/container_analysis_note_basic.tf.tmpl index 8d2e9ec6f69d..05bfcc26e027 100644 --- a/mmv1/templates/terraform/examples/container_analysis_note_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/container_analysis_note_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_container_analysis_note" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["note_name"] %>" +resource "google_container_analysis_note" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "note_name"}}" attestation_authority { hint { human_readable_name = "Attestor Note" diff --git a/mmv1/templates/terraform/examples/container_analysis_occurence_attestation.tf.tmpl b/mmv1/templates/terraform/examples/container_analysis_occurence_attestation.tf.tmpl index 8d0fceec2b8d..570dba783d05 100644 --- a/mmv1/templates/terraform/examples/container_analysis_occurence_attestation.tf.tmpl +++ b/mmv1/templates/terraform/examples/container_analysis_occurence_attestation.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_binary_authorization_attestor" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["attestor_name"] %>" +resource "google_binary_authorization_attestor" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "attestor_name"}}" attestation_authority_note { note_reference = google_container_analysis_note.note.name public_keys { @@ -26,7 +26,7 @@ EOF } resource "google_container_analysis_note" "note" { - name = "<%= ctx[:vars]["note_name"] %>" + name = "{{index $.Vars "note_name"}}" attestation_authority { hint { human_readable_name = "Attestor Note" diff --git a/mmv1/templates/terraform/examples/container_analysis_occurrence_kms.tf.tmpl b/mmv1/templates/terraform/examples/container_analysis_occurrence_kms.tf.tmpl index 8d04f6809701..c68d05abdcb4 100644 --- a/mmv1/templates/terraform/examples/container_analysis_occurrence_kms.tf.tmpl +++ b/mmv1/templates/terraform/examples/container_analysis_occurrence_kms.tf.tmpl @@ -1,5 +1,5 @@ resource "google_binary_authorization_attestor" "attestor" { - name = "<%= ctx[:vars]["attestor"] %>" + name = "{{index $.Vars "attestor"}}" attestation_authority_note { note_reference = google_container_analysis_note.note.name public_keys { @@ -13,7 +13,7 @@ resource "google_binary_authorization_attestor" "attestor" { } resource "google_container_analysis_note" "note" { - name = "<%= ctx[:vars]["note_name"] %>" + name = "{{index $.Vars "note_name"}}" attestation_authority { hint { human_readable_name = "Attestor Note" @@ -35,7 +35,7 @@ data "google_kms_crypto_key_version" "version" { crypto_key = data.google_kms_crypto_key.crypto-key.id } -resource "google_container_analysis_occurrence" "<%= ctx[:primary_resource_id] %>" { +resource "google_container_analysis_occurrence" "{{$.PrimaryResourceId}}" { resource_uri = "gcr.io/my-project/my-image" note_name = google_container_analysis_note.note.id diff --git a/mmv1/templates/terraform/examples/container_attached_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/container_attached_cluster_basic.tf.tmpl index 271242951679..644d6934c448 100644 --- a/mmv1/templates/terraform/examples/container_attached_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/container_attached_cluster_basic.tf.tmpl @@ -7,7 +7,7 @@ data "google_container_attached_versions" "versions" { } resource "google_container_attached_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" location = "us-west1" project = data.google_project.project.project_id description = "Test cluster" diff --git a/mmv1/templates/terraform/examples/container_attached_cluster_full.tf.tmpl b/mmv1/templates/terraform/examples/container_attached_cluster_full.tf.tmpl index 13c4c23858bc..46c5c9ba9ec1 100644 --- a/mmv1/templates/terraform/examples/container_attached_cluster_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/container_attached_cluster_full.tf.tmpl @@ -7,7 +7,7 @@ data "google_container_attached_versions" "versions" { } resource "google_container_attached_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" project = data.google_project.project.project_id location = "us-west1" description = "Test cluster" diff --git a/mmv1/templates/terraform/examples/container_attached_cluster_ignore_errors.tf.tmpl b/mmv1/templates/terraform/examples/container_attached_cluster_ignore_errors.tf.tmpl index 1c8bbce35275..256871a99399 100644 --- a/mmv1/templates/terraform/examples/container_attached_cluster_ignore_errors.tf.tmpl +++ b/mmv1/templates/terraform/examples/container_attached_cluster_ignore_errors.tf.tmpl @@ -7,7 +7,7 @@ data "google_container_attached_versions" "versions" { } resource "google_container_attached_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" location = "us-west1" project = data.google_project.project.project_id description = "Test cluster" diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_basic.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_basic.tf.tmpl index b59545415f74..689767408c1f 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_basic.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_data_catalog_entry" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_entry" "{{$.PrimaryResourceId}}" { entry_group = google_data_catalog_entry_group.entry_group.id - entry_id = "<%= ctx[:vars]['entry_id'] %>" + entry_id = "{{index $.Vars "entry_id"}}" user_specified_type = "my_custom_type" user_specified_system = "SomethingExternal" } resource "google_data_catalog_entry_group" "entry_group" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" + entry_group_id = "{{index $.Vars "entry_group_id"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_fileset.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_fileset.tf.tmpl index ad7ea3e213b2..1efcd229ba7b 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_fileset.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_fileset.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_data_catalog_entry" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_entry" "{{$.PrimaryResourceId}}" { entry_group = google_data_catalog_entry_group.entry_group.id - entry_id = "<%= ctx[:vars]['entry_id'] %>" + entry_id = "{{index $.Vars "entry_id"}}" type = "FILESET" @@ -10,5 +10,5 @@ resource "google_data_catalog_entry" "<%= ctx[:primary_resource_id] %>" { } resource "google_data_catalog_entry_group" "entry_group" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" + entry_group_id = "{{index $.Vars "entry_group_id"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_full.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_full.tf.tmpl index 56d995b91bff..0e2bd7603f5f 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_data_catalog_entry" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_entry" "{{$.PrimaryResourceId}}" { entry_group = google_data_catalog_entry_group.entry_group.id - entry_id = "<%= ctx[:vars]['entry_id'] %>" + entry_id = "{{index $.Vars "entry_id"}}" user_specified_type = "my_user_specified_type" user_specified_system = "Something_custom" @@ -50,5 +50,5 @@ EOF } resource "google_data_catalog_entry_group" "entry_group" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" + entry_group_id = "{{index $.Vars "entry_group_id"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_group_basic.tf.tmpl index ecfc9fce2e86..72c1d4e38fa7 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_group_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_group_basic.tf.tmpl @@ -1,3 +1,3 @@ -resource "google_data_catalog_entry_group" "<%= ctx[:primary_resource_id] %>" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" +resource "google_data_catalog_entry_group" "{{$.PrimaryResourceId}}" { + entry_group_id = "{{index $.Vars "entry_group_id"}}" } diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_group_full.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_group_full.tf.tmpl index 0aea77513532..ab58cda578d0 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_group_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_group_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_catalog_entry_group" "<%= ctx[:primary_resource_id] %>" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" +resource "google_data_catalog_entry_group" "{{$.PrimaryResourceId}}" { + entry_group_id = "{{index $.Vars "entry_group_id"}}" display_name = "terraform entry group" description = "entry group created by Terraform" diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_group_tag.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_group_tag.tf.tmpl index 3eddbfe6e767..027ef911f37b 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_group_tag.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_group_tag.tf.tmpl @@ -1,6 +1,6 @@ resource "google_data_catalog_entry" "first_entry" { entry_group = google_data_catalog_entry_group.entry_group.id - entry_id = "<%= ctx[:vars]['first_entry'] %>" + entry_id = "{{index $.Vars "first_entry"}}" user_specified_type = "my_custom_type" user_specified_system = "SomethingExternal" @@ -8,18 +8,18 @@ resource "google_data_catalog_entry" "first_entry" { resource "google_data_catalog_entry" "second_entry" { entry_group = google_data_catalog_entry_group.entry_group.id - entry_id = "<%= ctx[:vars]['second_entry'] %>" + entry_id = "{{index $.Vars "second_entry"}}" user_specified_type = "another_custom_type" user_specified_system = "SomethingElseExternal" } resource "google_data_catalog_entry_group" "entry_group" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" + entry_group_id = "{{index $.Vars "entry_group_id"}}" } resource "google_data_catalog_tag_template" "tag_template" { - tag_template_id = "<%= ctx[:vars]['tag_template_id'] %>" + tag_template_id = "{{index $.Vars "tag_template_id"}}" region = "us-central1" display_name = "Demo Tag Template" @@ -58,10 +58,10 @@ resource "google_data_catalog_tag_template" "tag_template" { } } - force_delete = "<%= ctx[:vars]['force_delete'] %>" + force_delete = "{{index $.Vars "force_delete"}}" } -resource "google_data_catalog_tag" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_tag" "{{$.PrimaryResourceId}}" { parent = google_data_catalog_entry_group.entry_group.id template = google_data_catalog_tag_template.tag_template.id diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_tag_basic.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_tag_basic.tf.tmpl index 162f86409ec1..473b60d8040c 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_tag_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_tag_basic.tf.tmpl @@ -1,17 +1,17 @@ resource "google_data_catalog_entry" "entry" { entry_group = google_data_catalog_entry_group.entry_group.id - entry_id = "<%= ctx[:vars]['entry_id'] %>" + entry_id = "{{index $.Vars "entry_id"}}" user_specified_type = "my_custom_type" user_specified_system = "SomethingExternal" } resource "google_data_catalog_entry_group" "entry_group" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" + entry_group_id = "{{index $.Vars "entry_group_id"}}" } resource "google_data_catalog_tag_template" "tag_template" { - tag_template_id = "<%= ctx[:vars]['tag_template_id'] %>" + tag_template_id = "{{index $.Vars "tag_template_id"}}" region = "us-central1" display_name = "Demo Tag Template" @@ -50,10 +50,10 @@ resource "google_data_catalog_tag_template" "tag_template" { } } - force_delete = "<%= ctx[:vars]['force_delete'] %>" + force_delete = "{{index $.Vars "force_delete"}}" } -resource "google_data_catalog_tag" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_tag" "{{$.PrimaryResourceId}}" { parent = google_data_catalog_entry.entry.id template = google_data_catalog_tag_template.tag_template.id diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_tag_false.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_tag_false.tf.tmpl index bb7344cb0148..f017c1826ec3 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_tag_false.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_tag_false.tf.tmpl @@ -1,17 +1,17 @@ resource "google_data_catalog_entry" "entry" { entry_group = google_data_catalog_entry_group.entry_group.id - entry_id = "<%= ctx[:vars]['entry_id'] %>" + entry_id = "{{index $.Vars "entry_id"}}" user_specified_type = "my_custom_type" user_specified_system = "SomethingExternal" } resource "google_data_catalog_entry_group" "entry_group" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" + entry_group_id = "{{index $.Vars "entry_group_id"}}" } resource "google_data_catalog_tag_template" "tag_template" { - tag_template_id = "<%= ctx[:vars]['tag_template_id'] %>" + tag_template_id = "{{index $.Vars "tag_template_id"}}" region = "us-central1" display_name = "Demo Tag Template" @@ -50,10 +50,10 @@ resource "google_data_catalog_tag_template" "tag_template" { } } - force_delete = "<%= ctx[:vars]['force_delete'] %>" + force_delete = "{{index $.Vars "force_delete"}}" } -resource "google_data_catalog_tag" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_tag" "{{$.PrimaryResourceId}}" { parent = google_data_catalog_entry.entry.id template = google_data_catalog_tag_template.tag_template.id diff --git a/mmv1/templates/terraform/examples/data_catalog_entry_tag_full.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_entry_tag_full.tf.tmpl index 0eae34529a17..4e5358cf2f04 100644 --- a/mmv1/templates/terraform/examples/data_catalog_entry_tag_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_entry_tag_full.tf.tmpl @@ -1,6 +1,6 @@ resource "google_data_catalog_entry" "entry" { entry_group = google_data_catalog_entry_group.entry_group.id - entry_id = "<%= ctx[:vars]['entry_id'] %>" + entry_id = "{{index $.Vars "entry_id"}}" user_specified_type = "my_custom_type" user_specified_system = "SomethingExternal" @@ -46,11 +46,11 @@ EOF } resource "google_data_catalog_entry_group" "entry_group" { - entry_group_id = "<%= ctx[:vars]['entry_group_id'] %>" + entry_group_id = "{{index $.Vars "entry_group_id"}}" } resource "google_data_catalog_tag_template" "tag_template" { - tag_template_id = "<%= ctx[:vars]['tag_template_id'] %>" + tag_template_id = "{{index $.Vars "tag_template_id"}}" region = "us-central1" display_name = "Demo Tag Template" @@ -89,10 +89,10 @@ resource "google_data_catalog_tag_template" "tag_template" { } } - force_delete = "<%= ctx[:vars]['force_delete'] %>" + force_delete = "{{index $.Vars "force_delete"}}" } -resource "google_data_catalog_tag" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_tag" "{{$.PrimaryResourceId}}" { parent = google_data_catalog_entry.entry.id template = google_data_catalog_tag_template.tag_template.id diff --git a/mmv1/templates/terraform/examples/data_catalog_tag_template_basic.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_tag_template_basic.tf.tmpl index 02d0d67c20ab..8df53501f56a 100644 --- a/mmv1/templates/terraform/examples/data_catalog_tag_template_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_tag_template_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_catalog_tag_template" "<%= ctx[:primary_resource_id] %>" { - tag_template_id = "<%= ctx[:vars]['tag_template_id'] %>" +resource "google_data_catalog_tag_template" "{{$.PrimaryResourceId}}" { + tag_template_id = "{{index $.Vars "tag_template_id"}}" region = "us-central1" display_name = "Demo Tag Template" @@ -38,5 +38,5 @@ resource "google_data_catalog_tag_template" "<%= ctx[:primary_resource_id] %>" { } } - force_delete = "<%= ctx[:vars]['force_delete'] %>" + force_delete = "{{index $.Vars "force_delete"}}" } diff --git a/mmv1/templates/terraform/examples/data_catalog_taxonomies_policy_tag_basic.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_taxonomies_policy_tag_basic.tf.tmpl index 3b1b452615bc..29974d4630b0 100644 --- a/mmv1/templates/terraform/examples/data_catalog_taxonomies_policy_tag_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_taxonomies_policy_tag_basic.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_data_catalog_policy_tag" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_policy_tag" "{{$.PrimaryResourceId}}" { taxonomy = google_data_catalog_taxonomy.my_taxonomy.id display_name = "Low security" description = "A policy tag normally associated with low security items" } resource "google_data_catalog_taxonomy" "my_taxonomy" { - display_name = "<%= ctx[:vars]['taxonomy_display_name'] %>" + display_name = "{{index $.Vars "taxonomy_display_name"}}" description = "A collection of policy tags" activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"] } diff --git a/mmv1/templates/terraform/examples/data_catalog_taxonomies_policy_tag_child_policies.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_taxonomies_policy_tag_child_policies.tf.tmpl index e9875997b179..b5b722972913 100644 --- a/mmv1/templates/terraform/examples/data_catalog_taxonomies_policy_tag_child_policies.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_taxonomies_policy_tag_child_policies.tf.tmpl @@ -4,7 +4,7 @@ resource "google_data_catalog_policy_tag" "parent_policy" { description = "A policy tag category used for high security access" } -resource "google_data_catalog_policy_tag" "<%= ctx[:primary_resource_id] %>" { +resource "google_data_catalog_policy_tag" "{{$.PrimaryResourceId}}" { taxonomy = google_data_catalog_taxonomy.my_taxonomy.id display_name = "ssn" description = "A hash of the users ssn" @@ -17,11 +17,11 @@ resource "google_data_catalog_policy_tag" "child_policy2" { description = "The users date of birth" parent_policy_tag = google_data_catalog_policy_tag.parent_policy.id // depends_on to avoid concurrent delete issues - depends_on = [google_data_catalog_policy_tag.<%= ctx[:primary_resource_id] %>] + depends_on = [google_data_catalog_policy_tag.{{$.PrimaryResourceId}}] } resource "google_data_catalog_taxonomy" "my_taxonomy" { - display_name = "<%= ctx[:vars]['taxonomy_display_name'] %>" + display_name = "{{index $.Vars "taxonomy_display_name"}}" description = "A collection of policy tags" activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"] } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/data_catalog_taxonomy_basic.tf.tmpl b/mmv1/templates/terraform/examples/data_catalog_taxonomy_basic.tf.tmpl index 58b51b59ab52..79daa87d6556 100644 --- a/mmv1/templates/terraform/examples/data_catalog_taxonomy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_catalog_taxonomy_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_catalog_taxonomy" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_data_catalog_taxonomy" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" description = "A collection of policy tags" activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"] } diff --git a/mmv1/templates/terraform/examples/data_fusion_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/data_fusion_instance_basic.tf.tmpl index 1dd6c484e934..0d5a1eecaee6 100644 --- a/mmv1/templates/terraform/examples/data_fusion_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_fusion_instance_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_data_fusion_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" region = "us-central1" type = "BASIC" - <%= ctx[:vars]['prober_test_run'] %> + {{index $.Vars "prober_test_run"}} } diff --git a/mmv1/templates/terraform/examples/data_fusion_instance_cmek.tf.tmpl b/mmv1/templates/terraform/examples/data_fusion_instance_cmek.tf.tmpl index 1bb61692283a..05ff63eed8aa 100644 --- a/mmv1/templates/terraform/examples/data_fusion_instance_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_fusion_instance_cmek.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_data_fusion_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" region = "us-central1" type = "BASIC" @@ -11,12 +11,12 @@ resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" key_ring = google_kms_key_ring.key_ring.id } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/data_fusion_instance_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/data_fusion_instance_enterprise.tf.tmpl index 627f9c1f6eb1..4a5ae1137945 100644 --- a/mmv1/templates/terraform/examples/data_fusion_instance_enterprise.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_fusion_instance_enterprise.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_data_fusion_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" region = "us-central1" type = "ENTERPRISE" enable_rbac = true - <%= ctx[:vars]['prober_test_run'] %> + {{index $.Vars "prober_test_run"}} } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/data_fusion_instance_event.tf.tmpl b/mmv1/templates/terraform/examples/data_fusion_instance_event.tf.tmpl index 0d21f1b550d5..3bb9887086f3 100644 --- a/mmv1/templates/terraform/examples/data_fusion_instance_event.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_fusion_instance_event.tf.tmpl @@ -1,14 +1,14 @@ -resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_data_fusion_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" region = "us-central1" type = "BASIC" event_publish_config { enabled = true - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id } } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/data_fusion_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/data_fusion_instance_full.tf.tmpl index 44e3bee0a2c2..1af1365395d7 100644 --- a/mmv1/templates/terraform/examples/data_fusion_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_fusion_instance_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_data_fusion_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" description = "My Data Fusion instance" display_name = "My Data Fusion instance" region = "us-central1" @@ -22,18 +22,18 @@ resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { accelerator_type = "CDC" state = "ENABLED" } - <%= ctx[:vars]['prober_test_run'] %> + {{index $.Vars "prober_test_run"}} } data "google_app_engine_default_service_account" "default" { } resource "google_compute_network" "network" { - name = "<%= ctx[:vars]["network_name"] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]["ip_alloc"] %>" + name = "{{index $.Vars "ip_alloc"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 22 diff --git a/mmv1/templates/terraform/examples/data_fusion_instance_psc.tf.tmpl b/mmv1/templates/terraform/examples/data_fusion_instance_psc.tf.tmpl index 16e25435dfe3..222d89b2f0f9 100644 --- a/mmv1/templates/terraform/examples/data_fusion_instance_psc.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_fusion_instance_psc.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_data_fusion_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" region = "us-central1" type = "BASIC" private_instance = true @@ -12,16 +12,16 @@ resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { } } - <%= ctx[:vars]['prober_test_run'] %> + {{index $.Vars "prober_test_run"}} } resource "google_compute_network" "psc" { - name = "<%= ctx[:vars]["network_name"] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "psc" { - name = "<%= ctx[:vars]["subnet_name"] %>" + name = "{{index $.Vars "subnet_name"}}" region = "us-central1" network = google_compute_network.psc.id @@ -29,7 +29,7 @@ resource "google_compute_subnetwork" "psc" { } resource "google_compute_network_attachment" "psc" { - name = "<%= ctx[:vars]["attachment_name"] %>" + name = "{{index $.Vars "attachment_name"}}" region = "us-central1" connection_preference = "ACCEPT_AUTOMATIC" diff --git a/mmv1/templates/terraform/examples/data_fusion_instance_zone.tf.tmpl b/mmv1/templates/terraform/examples/data_fusion_instance_zone.tf.tmpl index 1d89593497ce..b831a94cc270 100644 --- a/mmv1/templates/terraform/examples/data_fusion_instance_zone.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_fusion_instance_zone.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_fusion_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_data_fusion_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" region = "us-central1" zone = "us-central1-a" type = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/data_pipeline_pipeline.tf.tmpl b/mmv1/templates/terraform/examples/data_pipeline_pipeline.tf.tmpl index 9218d359db2d..0d0c7b1a6ef7 100644 --- a/mmv1/templates/terraform/examples/data_pipeline_pipeline.tf.tmpl +++ b/mmv1/templates/terraform/examples/data_pipeline_pipeline.tf.tmpl @@ -1,10 +1,10 @@ resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Service Account" } resource "google_data_pipeline_pipeline" "primary" { - name = "<%= ctx[:vars]["pipeline_name"] %>" + name = "{{index $.Vars "pipeline_name"}}" display_name = "my-pipeline" type = "PIPELINE_TYPE_BATCH" state = "STATE_ACTIVE" diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.tmpl index 96384e6e4b58..c02149ccd41b 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.tmpl @@ -2,11 +2,11 @@ data "google_project" "project" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['global_address_name'] %>" + name = "{{index $.Vars "global_address_name"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -20,10 +20,10 @@ resource "google_service_networking_connection" "vpc_connection" { } -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_connection_profile" "{{$.PrimaryResourceId}}" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["profile"] %>" - display_name = "<%= ctx[:vars]["profile"] %>_display" + connection_profile_id = "{{index $.Vars "profile"}}" + display_name = "{{index $.Vars "profile"}}_display" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.tmpl index 30f0fc7cb168..4cc705c6f10a 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "cloudsqldb" { - name = "<%= ctx[:vars]["sqldb"] %>" + name = "{{index $.Vars "sqldb"}}" database_version = "MYSQL_5_7" settings { tier = "db-n1-standard-1" @@ -12,26 +12,26 @@ resource "google_sql_database_instance" "cloudsqldb" { } resource "google_sql_ssl_cert" "sql_client_cert" { - common_name = "<%= ctx[:vars]["sqldb_cert"] %>" + common_name = "{{index $.Vars "sqldb_cert"}}" instance = google_sql_database_instance.cloudsqldb.name depends_on = [google_sql_database_instance.cloudsqldb] } resource "google_sql_user" "sqldb_user" { - name = "<%= ctx[:vars]["sqldb_user"] %>" + name = "{{index $.Vars "sqldb_user"}}" instance = google_sql_database_instance.cloudsqldb.name - password = "<%= ctx[:vars]["sqldb_pass"] %>" + password = "{{index $.Vars "sqldb_pass"}}" depends_on = [google_sql_ssl_cert.sql_client_cert] } -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_connection_profile" "{{$.PrimaryResourceId}}" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["from_profile"] %>" - display_name = "<%= ctx[:vars]["from_profile"] %>_display" + connection_profile_id = "{{index $.Vars "from_profile"}}" + display_name = "{{index $.Vars "from_profile"}}_display" labels = { foo = "bar" } @@ -45,17 +45,17 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar client_certificate = google_sql_ssl_cert.sql_client_cert.cert ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert } - cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" + cloud_sql_id = "{{index $.Vars "sqldb"}}" } depends_on = [google_sql_user.sqldb_user] } -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>_destination" { +resource "google_database_migration_service_connection_profile" "{{$.PrimaryResourceId}}_destination" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["to_profile"] %>" - display_name = "<%= ctx[:vars]["to_profile"] %>_displayname" + connection_profile_id = "{{index $.Vars "to_profile"}}" + display_name = "{{index $.Vars "to_profile"}}_displayname" labels = { foo = "bar" } @@ -77,9 +77,9 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar data_disk_type = "PD_HDD" data_disk_size_gb = "11" zone = "us-central1-b" - source_id = "projects/${data.google_project.project.project_id}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["from_profile"] %>" + source_id = "projects/${data.google_project.project.project_id}/locations/us-central1/connectionProfiles/{{index $.Vars "from_profile"}}" root_password = "testpasscloudsql" } } - depends_on = [google_database_migration_service_connection_profile.<%= ctx[:primary_resource_id] %>] + depends_on = [google_database_migration_service_connection_profile.{{$.PrimaryResourceId}}] } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_alloydb.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_alloydb.tf.tmpl index 316e749424ba..10b99197cb48 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_alloydb.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_alloydb.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_alloydb_cluster" "destination_alloydb" { - cluster_id = "<%= ctx[:vars]['destination_alloydb'] %>" + cluster_id = "{{index $.Vars "destination_alloydb"}}" location = "us-central1" network_config { network = google_compute_network.default.id @@ -10,21 +10,21 @@ resource "google_alloydb_cluster" "destination_alloydb" { database_version = "POSTGRES_15" initial_user { - user = "<%= ctx[:vars]['destination_alloydb'] %>" - password = "<%= ctx[:vars]['destination_alloydb'] %>" + user = "{{index $.Vars "destination_alloydb"}}" + password = "{{index $.Vars "destination_alloydb"}}" } } resource "google_alloydb_instance" "destination_alloydb_primary" { cluster = google_alloydb_cluster.destination_alloydb.name - instance_id = "<%= ctx[:vars]['destination_alloydb'] %>-primary" + instance_id = "{{index $.Vars "destination_alloydb"}}-primary" instance_type = "PRIMARY" depends_on = [google_service_networking_connection.vpc_connection] } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['destination_alloydb'] %>" + name = "{{index $.Vars "destination_alloydb"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -38,18 +38,18 @@ resource "google_service_networking_connection" "vpc_connection" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['destination_alloydb'] %>" + name = "{{index $.Vars "destination_alloydb"}}" } -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_connection_profile" "{{$.PrimaryResourceId}}" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["destination_cp"] %>" - display_name = "<%= ctx[:vars]["destination_cp"] %>_display" + connection_profile_id = "{{index $.Vars "destination_cp"}}" + display_name = "{{index $.Vars "destination_cp"}}_display" labels = { foo = "bar" } postgresql { - alloydb_cluster_id = "<%= ctx[:vars]["destination_alloydb"] %>" + alloydb_cluster_id = "{{index $.Vars "destination_alloydb"}}" } depends_on = [google_alloydb_cluster.destination_alloydb, google_alloydb_instance.destination_alloydb_primary] } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_mysql.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_mysql.tf.tmpl index ae325429e54d..42c1f4c72a6d 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_mysql.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_mysql.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "destination_csql" { - name = "<%= ctx[:vars]["destination_csql"] %>" + name = "{{index $.Vars "destination_csql"}}" database_version = "MYSQL_5_7" settings { tier = "db-n1-standard-1" @@ -11,15 +11,15 @@ resource "google_sql_database_instance" "destination_csql" { deletion_protection = false } -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_connection_profile" "{{$.PrimaryResourceId}}" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["destination_cp"] %>" - display_name = "<%= ctx[:vars]["destination_cp"] %>_display" + connection_profile_id = "{{index $.Vars "destination_cp"}}" + display_name = "{{index $.Vars "destination_cp"}}_display" labels = { foo = "bar" } mysql { - cloud_sql_id = "<%= ctx[:vars]["destination_csql"] %>" + cloud_sql_id = "{{index $.Vars "destination_csql"}}" } depends_on = [google_sql_database_instance.destination_csql] } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_postgres.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_postgres.tf.tmpl index d9052adb4c9a..59e943a18786 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_postgres.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_existing_postgres.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "destination_csql" { - name = "<%= ctx[:vars]["destination_csql"] %>" + name = "{{index $.Vars "destination_csql"}}" database_version = "POSTGRES_15" settings { tier = "db-custom-2-13312" @@ -11,15 +11,15 @@ resource "google_sql_database_instance" "destination_csql" { deletion_protection = false } -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_connection_profile" "{{$.PrimaryResourceId}}" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["destination_cp"] %>" - display_name = "<%= ctx[:vars]["destination_cp"] %>_display" + connection_profile_id = "{{index $.Vars "destination_cp"}}" + display_name = "{{index $.Vars "destination_cp"}}_display" labels = { foo = "bar" } postgresql { - cloud_sql_id = "<%= ctx[:vars]["destination_csql"] %>" + cloud_sql_id = "{{index $.Vars "destination_csql"}}" } depends_on = [google_sql_database_instance.destination_csql] } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_oracle.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_oracle.tf.tmpl index 583395fa8012..18e502577c14 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_oracle.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_oracle.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_connection_profile" "{{$.PrimaryResourceId}}" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["profile"] %>" - display_name = "<%= ctx[:vars]["profile"] %>_display" + connection_profile_id = "{{index $.Vars "profile"}}" + display_name = "{{index $.Vars "profile"}}_display" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgres.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgres.tf.tmpl index 632640f4175d..69d8f7d7dbf1 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgres.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgres.tf.tmpl @@ -1,5 +1,5 @@ resource "google_sql_database_instance" "postgresqldb" { - name = "<%= ctx[:vars]["sqldb"] %>" + name = "{{index $.Vars "sqldb"}}" database_version = "POSTGRES_12" settings { tier = "db-custom-2-13312" @@ -8,25 +8,25 @@ resource "google_sql_database_instance" "postgresqldb" { } resource "google_sql_ssl_cert" "sql_client_cert" { - common_name = "<%= ctx[:vars]["sqldb_cert"] %>" + common_name = "{{index $.Vars "sqldb_cert"}}" instance = google_sql_database_instance.postgresqldb.name depends_on = [google_sql_database_instance.postgresqldb] } resource "google_sql_user" "sqldb_user" { - name = "<%= ctx[:vars]["sqldb_user"] %>" + name = "{{index $.Vars "sqldb_user"}}" instance = google_sql_database_instance.postgresqldb.name - password = "<%= ctx[:vars]["sqldb_pass"] %>" + password = "{{index $.Vars "sqldb_pass"}}" depends_on = [google_sql_ssl_cert.sql_client_cert] } -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_connection_profile" "{{$.PrimaryResourceId}}" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["profile"] %>" - display_name = "<%= ctx[:vars]["profile"] %>_display" + connection_profile_id = "{{index $.Vars "profile"}}" + display_name = "{{index $.Vars "profile"}}_display" labels = { foo = "bar" } @@ -40,7 +40,7 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar client_certificate = google_sql_ssl_cert.sql_client_cert.cert ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert } - cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" + cloud_sql_id = "{{index $.Vars "sqldb"}}" } depends_on = [google_sql_user.sqldb_user] } diff --git a/mmv1/templates/terraform/examples/database_migration_service_migration_job_mysql_to_mysql.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_migration_job_mysql_to_mysql.tf.tmpl index b5e93e819231..a685679a6c88 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_migration_job_mysql_to_mysql.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_migration_job_mysql_to_mysql.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "source_csql" { - name = "<%= ctx[:vars]["source_csql"] %>" + name = "{{index $.Vars "source_csql"}}" database_version = "MYSQL_5_7" settings { tier = "db-n1-standard-1" @@ -12,24 +12,24 @@ resource "google_sql_database_instance" "source_csql" { } resource "google_sql_ssl_cert" "source_sql_client_cert" { - common_name = "<%= ctx[:vars]["source_sqldb_cert"] %>" + common_name = "{{index $.Vars "source_sqldb_cert"}}" instance = google_sql_database_instance.source_csql.name depends_on = [google_sql_database_instance.source_csql] } resource "google_sql_user" "source_sqldb_user" { - name = "<%= ctx[:vars]["source_sqldb_user"] %>" + name = "{{index $.Vars "source_sqldb_user"}}" instance = google_sql_database_instance.source_csql.name - password = "<%= ctx[:vars]["source_sqldb_pass"] %>" + password = "{{index $.Vars "source_sqldb_pass"}}" depends_on = [google_sql_ssl_cert.source_sql_client_cert] } resource "google_database_migration_service_connection_profile" "source_cp" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["source_cp"] %>" - display_name = "<%= ctx[:vars]["source_cp"] %>_display" + connection_profile_id = "{{index $.Vars "source_cp"}}" + display_name = "{{index $.Vars "source_cp"}}_display" labels = { foo = "bar" } @@ -43,14 +43,14 @@ resource "google_database_migration_service_connection_profile" "source_cp" { client_certificate = google_sql_ssl_cert.source_sql_client_cert.cert ca_certificate = google_sql_ssl_cert.source_sql_client_cert.server_ca_cert } - cloud_sql_id = "<%= ctx[:vars]["source_csql"] %>" + cloud_sql_id = "{{index $.Vars "source_csql"}}" } depends_on = [google_sql_user.source_sqldb_user] } resource "google_sql_database_instance" "destination_csql" { - name = "<%= ctx[:vars]["destination_csql"] %>" + name = "{{index $.Vars "destination_csql"}}" database_version = "MYSQL_5_7" settings { tier = "db-n1-standard-1" @@ -61,25 +61,25 @@ resource "google_sql_database_instance" "destination_csql" { resource "google_database_migration_service_connection_profile" "destination_cp" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["destination_cp"] %>" - display_name = "<%= ctx[:vars]["destination_cp"] %>_display" + connection_profile_id = "{{index $.Vars "destination_cp"}}" + display_name = "{{index $.Vars "destination_cp"}}_display" labels = { foo = "bar" } mysql { - cloud_sql_id = "<%= ctx[:vars]["destination_csql"] %>" + cloud_sql_id = "{{index $.Vars "destination_csql"}}" } depends_on = [google_sql_database_instance.destination_csql] } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['destination_csql'] %>" + name = "{{index $.Vars "destination_csql"}}" } -resource "google_database_migration_service_migration_job" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_migration_job" "{{$.PrimaryResourceId}}" { location = "us-central1" - migration_job_id = "<%= ctx[:vars]["migration_id"] %>" - display_name = "<%= ctx[:vars]["migration_id"] %>_display" + migration_job_id = "{{index $.Vars "migration_id"}}" + display_name = "{{index $.Vars "migration_id"}}_display" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/database_migration_service_migration_job_postgres_to_alloydb.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_migration_job_postgres_to_alloydb.tf.tmpl index 8017a8647036..4420388f858d 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_migration_job_postgres_to_alloydb.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_migration_job_postgres_to_alloydb.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "source_csql" { - name = "<%= ctx[:vars]["source_csql"] %>" + name = "{{index $.Vars "source_csql"}}" database_version = "POSTGRES_15" settings { tier = "db-custom-2-13312" @@ -12,24 +12,24 @@ resource "google_sql_database_instance" "source_csql" { } resource "google_sql_ssl_cert" "source_sql_client_cert" { - common_name = "<%= ctx[:vars]["source_sqldb_cert"] %>" + common_name = "{{index $.Vars "source_sqldb_cert"}}" instance = google_sql_database_instance.source_csql.name depends_on = [google_sql_database_instance.source_csql] } resource "google_sql_user" "source_sqldb_user" { - name = "<%= ctx[:vars]["source_sqldb_user"] %>" + name = "{{index $.Vars "source_sqldb_user"}}" instance = google_sql_database_instance.source_csql.name - password = "<%= ctx[:vars]["source_sqldb_pass"] %>" + password = "{{index $.Vars "source_sqldb_pass"}}" depends_on = [google_sql_ssl_cert.source_sql_client_cert] } resource "google_database_migration_service_connection_profile" "source_cp" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["source_cp"] %>" - display_name = "<%= ctx[:vars]["source_cp"] %>_display" + connection_profile_id = "{{index $.Vars "source_cp"}}" + display_name = "{{index $.Vars "source_cp"}}_display" labels = { foo = "bar" } @@ -43,14 +43,14 @@ resource "google_database_migration_service_connection_profile" "source_cp" { client_certificate = google_sql_ssl_cert.source_sql_client_cert.cert ca_certificate = google_sql_ssl_cert.source_sql_client_cert.server_ca_cert } - cloud_sql_id = "<%= ctx[:vars]["source_csql"] %>" + cloud_sql_id = "{{index $.Vars "source_csql"}}" } depends_on = [google_sql_user.source_sqldb_user] } resource "google_alloydb_cluster" "destination_alloydb" { - cluster_id = "<%= ctx[:vars]['destination_alloydb'] %>" + cluster_id = "{{index $.Vars "destination_alloydb"}}" location = "us-central1" network_config { network = google_compute_network.default.id @@ -58,21 +58,21 @@ resource "google_alloydb_cluster" "destination_alloydb" { database_version = "POSTGRES_15" initial_user { - user = "<%= ctx[:vars]['destination_alloydb'] %>" - password = "<%= ctx[:vars]['destination_alloydb'] %>" + user = "{{index $.Vars "destination_alloydb"}}" + password = "{{index $.Vars "destination_alloydb"}}" } } resource "google_alloydb_instance" "destination_alloydb_primary" { cluster = google_alloydb_cluster.destination_alloydb.name - instance_id = "<%= ctx[:vars]['destination_alloydb'] %>-primary" + instance_id = "{{index $.Vars "destination_alloydb"}}-primary" instance_type = "PRIMARY" depends_on = [google_service_networking_connection.vpc_connection] } resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['destination_alloydb'] %>" + name = "{{index $.Vars "destination_alloydb"}}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -86,26 +86,26 @@ resource "google_service_networking_connection" "vpc_connection" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['destination_alloydb'] %>" + name = "{{index $.Vars "destination_alloydb"}}" } resource "google_database_migration_service_connection_profile" "destination_cp" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["destination_cp"] %>" - display_name = "<%= ctx[:vars]["destination_cp"] %>_display" + connection_profile_id = "{{index $.Vars "destination_cp"}}" + display_name = "{{index $.Vars "destination_cp"}}_display" labels = { foo = "bar" } postgresql { - alloydb_cluster_id = "<%= ctx[:vars]["destination_alloydb"] %>" + alloydb_cluster_id = "{{index $.Vars "destination_alloydb"}}" } depends_on = [google_alloydb_cluster.destination_alloydb, google_alloydb_instance.destination_alloydb_primary] } -resource "google_database_migration_service_migration_job" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_migration_job" "{{$.PrimaryResourceId}}" { location = "us-central1" - migration_job_id = "<%= ctx[:vars]["migration_id"] %>" - display_name = "<%= ctx[:vars]["migration_id"] %>_display" + migration_job_id = "{{index $.Vars "migration_id"}}" + display_name = "{{index $.Vars "migration_id"}}_display" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/database_migration_service_migration_job_postgres_to_postgres.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_migration_job_postgres_to_postgres.tf.tmpl index 01eff734e21d..fa3d5885adfd 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_migration_job_postgres_to_postgres.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_migration_job_postgres_to_postgres.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "source_csql" { - name = "<%= ctx[:vars]["source_csql"] %>" + name = "{{index $.Vars "source_csql"}}" database_version = "POSTGRES_15" settings { tier = "db-custom-2-13312" @@ -12,24 +12,24 @@ resource "google_sql_database_instance" "source_csql" { } resource "google_sql_ssl_cert" "source_sql_client_cert" { - common_name = "<%= ctx[:vars]["source_sqldb_cert"] %>" + common_name = "{{index $.Vars "source_sqldb_cert"}}" instance = google_sql_database_instance.source_csql.name depends_on = [google_sql_database_instance.source_csql] } resource "google_sql_user" "source_sqldb_user" { - name = "<%= ctx[:vars]["source_sqldb_user"] %>" + name = "{{index $.Vars "source_sqldb_user"}}" instance = google_sql_database_instance.source_csql.name - password = "<%= ctx[:vars]["source_sqldb_pass"] %>" + password = "{{index $.Vars "source_sqldb_pass"}}" depends_on = [google_sql_ssl_cert.source_sql_client_cert] } resource "google_database_migration_service_connection_profile" "source_cp" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["source_cp"] %>" - display_name = "<%= ctx[:vars]["source_cp"] %>_display" + connection_profile_id = "{{index $.Vars "source_cp"}}" + display_name = "{{index $.Vars "source_cp"}}_display" labels = { foo = "bar" } @@ -43,14 +43,14 @@ resource "google_database_migration_service_connection_profile" "source_cp" { client_certificate = google_sql_ssl_cert.source_sql_client_cert.cert ca_certificate = google_sql_ssl_cert.source_sql_client_cert.server_ca_cert } - cloud_sql_id = "<%= ctx[:vars]["source_csql"] %>" + cloud_sql_id = "{{index $.Vars "source_csql"}}" } depends_on = [google_sql_user.source_sqldb_user] } resource "google_sql_database_instance" "destination_csql" { - name = "<%= ctx[:vars]["destination_csql"] %>" + name = "{{index $.Vars "destination_csql"}}" database_version = "POSTGRES_15" settings { tier = "db-custom-2-13312" @@ -61,21 +61,21 @@ resource "google_sql_database_instance" "destination_csql" { resource "google_database_migration_service_connection_profile" "destination_cp" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["destination_cp"] %>" - display_name = "<%= ctx[:vars]["destination_cp"] %>_display" + connection_profile_id = "{{index $.Vars "destination_cp"}}" + display_name = "{{index $.Vars "destination_cp"}}_display" labels = { foo = "bar" } postgresql { - cloud_sql_id = "<%= ctx[:vars]["destination_csql"] %>" + cloud_sql_id = "{{index $.Vars "destination_csql"}}" } depends_on = [google_sql_database_instance.destination_csql] } -resource "google_database_migration_service_migration_job" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_migration_job" "{{$.PrimaryResourceId}}" { location = "us-central1" - migration_job_id = "<%= ctx[:vars]["migration_id"] %>" - display_name = "<%= ctx[:vars]["migration_id"] %>_display" + migration_job_id = "{{index $.Vars "migration_id"}}" + display_name = "{{index $.Vars "migration_id"}}_display" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/database_migration_service_private_connection.tf.tmpl b/mmv1/templates/terraform/examples/database_migration_service_private_connection.tf.tmpl index 71d113df7840..0293220ab696 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_private_connection.tf.tmpl +++ b/mmv1/templates/terraform/examples/database_migration_service_private_connection.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_database_migration_service_private_connection" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_private_connection" "{{$.PrimaryResourceId}}" { display_name = "dbms_pc" location = "us-central1" - private_connection_id = "<%= ctx[:vars]['private_connection_id'] %>" + private_connection_id = "{{index $.Vars "private_connection_id"}}" labels = { key = "value" @@ -14,7 +14,7 @@ resource "google_database_migration_service_private_connection" "<%= ctx[:primar } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/dataform_repository.tf.tmpl b/mmv1/templates/terraform/examples/dataform_repository.tf.tmpl index 2ee2625758bf..afcaa4cbb6bc 100644 --- a/mmv1/templates/terraform/examples/dataform_repository.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataform_repository.tf.tmpl @@ -1,6 +1,6 @@ resource "google_secret_manager_secret" "secret" { provider = google-beta - secret_id = "<%= ctx[:vars]['secret_name'] %>" + secret_id = "{{index $.Vars "secret_name"}}" replication { auto {} @@ -11,20 +11,20 @@ resource "google_secret_manager_secret_version" "secret_version" { provider = google-beta secret = google_secret_manager_secret.secret.id - secret_data = "<%= ctx[:vars]['data'] %>" + secret_data = "{{index $.Vars "data"}}" } resource "google_kms_key_ring" "keyring" { provider = google-beta - name = "<%= ctx[:vars]['key_ring_name'] %>" + name = "{{index $.Vars "key_ring_name"}}" location = "us-central1" } resource "google_kms_crypto_key" "example_key" { provider = google-beta - name = "<%= ctx[:vars]['crypto_key_name'] %>" + name = "{{index $.Vars "crypto_key_name"}}" key_ring = google_kms_key_ring.keyring.id } @@ -39,10 +39,10 @@ resource "google_kms_crypto_key_iam_binding" "crypto_key_binding" { ] } -resource "google_dataform_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataform_repository" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['dataform_repository_name'] %>" - display_name = "<%= ctx[:vars]['dataform_repository_name'] %>" + name = "{{index $.Vars "dataform_repository_name"}}" + display_name = "{{index $.Vars "dataform_repository_name"}}" npmrc_environment_variables_secret_version = google_secret_manager_secret_version.secret_version.id kms_key_name = google_kms_crypto_key.example_key.id diff --git a/mmv1/templates/terraform/examples/dataform_repository_release_config.tf.tmpl b/mmv1/templates/terraform/examples/dataform_repository_release_config.tf.tmpl index e85ae9697814..7c5f01a2b601 100644 --- a/mmv1/templates/terraform/examples/dataform_repository_release_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataform_repository_release_config.tf.tmpl @@ -1,11 +1,11 @@ resource "google_sourcerepo_repository" "git_repository" { provider = google-beta - name = "<%= ctx[:vars]['git_repository_name'] %>" + name = "{{index $.Vars "git_repository_name"}}" } resource "google_secret_manager_secret" "secret" { provider = google-beta - secret_id = "<%= ctx[:vars]['secret_name'] %>" + secret_id = "{{index $.Vars "secret_name"}}" replication { auto {} @@ -16,12 +16,12 @@ resource "google_secret_manager_secret_version" "secret_version" { provider = google-beta secret = google_secret_manager_secret.secret.id - secret_data = "<%= ctx[:vars]['data'] %>" + secret_data = "{{index $.Vars "data"}}" } resource "google_dataform_repository" "repository" { provider = google-beta - name = "<%= ctx[:vars]['dataform_repository_name'] %>" + name = "{{index $.Vars "dataform_repository_name"}}" region = "us-central1" git_remote_settings { @@ -37,14 +37,14 @@ resource "google_dataform_repository" "repository" { } } -resource "google_dataform_repository_release_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataform_repository_release_config" "{{$.PrimaryResourceId}}" { provider = google-beta project = google_dataform_repository.repository.project region = google_dataform_repository.repository.region repository = google_dataform_repository.repository.name - name = "<%= ctx[:vars]['release_name'] %>" + name = "{{index $.Vars "release_name"}}" git_commitish = "main" cron_schedule = "0 7 * * *" time_zone = "America/New_York" diff --git a/mmv1/templates/terraform/examples/dataform_repository_with_cloudsource_repo.tf.tmpl b/mmv1/templates/terraform/examples/dataform_repository_with_cloudsource_repo.tf.tmpl index d4d1d7aee3fa..646b10244cdb 100644 --- a/mmv1/templates/terraform/examples/dataform_repository_with_cloudsource_repo.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataform_repository_with_cloudsource_repo.tf.tmpl @@ -4,12 +4,12 @@ data "google_project" "project" { resource "google_sourcerepo_repository" "git_repository" { provider = google-beta - name = "<%= ctx[:vars]['git_repository_name'] %>" + name = "{{index $.Vars "git_repository_name"}}" } resource "google_secret_manager_secret" "secret" { provider = google-beta - secret_id = "<%= ctx[:vars]['secret_name'] %>" + secret_id = "{{index $.Vars "secret_name"}}" replication { auto {} @@ -20,20 +20,20 @@ resource "google_secret_manager_secret_version" "secret_version" { provider = google-beta secret = google_secret_manager_secret.secret.id - secret_data = "<%= ctx[:vars]['data'] %>" + secret_data = "{{index $.Vars "data"}}" } resource "google_kms_key_ring" "keyring" { provider = google-beta - name = "<%= ctx[:vars]['key_ring_name'] %>" + name = "{{index $.Vars "key_ring_name"}}" location = "us-central1" } resource "google_kms_crypto_key" "example_key" { provider = google-beta - name = "<%= ctx[:vars]['crypto_key_name'] %>" + name = "{{index $.Vars "crypto_key_name"}}" key_ring = google_kms_key_ring.keyring.id } @@ -48,10 +48,10 @@ resource "google_kms_crypto_key_iam_binding" "crypto_key_binding" { ] } -resource "google_dataform_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataform_repository" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['dataform_repository_name'] %>" - display_name = "<%= ctx[:vars]['dataform_repository_name'] %>" + name = "{{index $.Vars "dataform_repository_name"}}" + display_name = "{{index $.Vars "dataform_repository_name"}}" npmrc_environment_variables_secret_version = google_secret_manager_secret_version.secret_version.id kms_key_name = google_kms_crypto_key.example_key.id diff --git a/mmv1/templates/terraform/examples/dataform_repository_with_cloudsource_repo_and_ssh.tf.tmpl b/mmv1/templates/terraform/examples/dataform_repository_with_cloudsource_repo_and_ssh.tf.tmpl index 5d703e6b733e..d68e01f0dc52 100644 --- a/mmv1/templates/terraform/examples/dataform_repository_with_cloudsource_repo_and_ssh.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataform_repository_with_cloudsource_repo_and_ssh.tf.tmpl @@ -1,11 +1,11 @@ resource "google_sourcerepo_repository" "git_repository" { provider = google-beta - name = "<%= ctx[:vars]['git_repository_name'] %>" + name = "{{index $.Vars "git_repository_name"}}" } resource "google_secret_manager_secret" "secret" { provider = google-beta - secret_id = "<%= ctx[:vars]['secret_name'] %>" + secret_id = "{{index $.Vars "secret_name"}}" replication { auto {} @@ -16,12 +16,12 @@ resource "google_secret_manager_secret_version" "secret_version" { provider = google-beta secret = google_secret_manager_secret.secret.id - secret_data = "<%= ctx[:vars]['data'] %>" + secret_data = "{{index $.Vars "data"}}" } -resource "google_dataform_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataform_repository" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['dataform_repository_name'] %>" + name = "{{index $.Vars "dataform_repository_name"}}" git_remote_settings { url = google_sourcerepo_repository.git_repository.url diff --git a/mmv1/templates/terraform/examples/dataform_repository_workflow_config.tf.tmpl b/mmv1/templates/terraform/examples/dataform_repository_workflow_config.tf.tmpl index 5e25f4915b95..450e3b273320 100644 --- a/mmv1/templates/terraform/examples/dataform_repository_workflow_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataform_repository_workflow_config.tf.tmpl @@ -1,11 +1,11 @@ resource "google_sourcerepo_repository" "git_repository" { provider = google-beta - name = "<%= ctx[:vars]['git_repository_name'] %>" + name = "{{index $.Vars "git_repository_name"}}" } resource "google_secret_manager_secret" "secret" { provider = google-beta - secret_id = "<%= ctx[:vars]['secret_name'] %>" + secret_id = "{{index $.Vars "secret_name"}}" replication { auto {} @@ -16,12 +16,12 @@ resource "google_secret_manager_secret_version" "secret_version" { provider = google-beta secret = google_secret_manager_secret.secret.id - secret_data = "<%= ctx[:vars]['data'] %>" + secret_data = "{{index $.Vars "data"}}" } resource "google_dataform_repository" "repository" { provider = google-beta - name = "<%= ctx[:vars]['dataform_repository_name'] %>" + name = "{{index $.Vars "dataform_repository_name"}}" region = "us-central1" git_remote_settings { @@ -44,7 +44,7 @@ resource "google_dataform_repository_release_config" "release_config" { region = google_dataform_repository.repository.region repository = google_dataform_repository.repository.name - name = "<%= ctx[:vars]['release_name'] %>" + name = "{{index $.Vars "release_name"}}" git_commitish = "main" cron_schedule = "0 7 * * *" time_zone = "America/New_York" @@ -65,17 +65,17 @@ resource "google_dataform_repository_release_config" "release_config" { resource "google_service_account" "dataform_sa" { provider = google-beta - account_id = "<%= ctx[:vars]['service_account_name'] %>" + account_id = "{{index $.Vars "service_account_name"}}" display_name = "Dataform Service Account" } -resource "google_dataform_repository_workflow_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataform_repository_workflow_config" "{{$.PrimaryResourceId}}" { provider = google-beta project = google_dataform_repository.repository.project region = google_dataform_repository.repository.region repository = google_dataform_repository.repository.name - name = "<%= ctx[:vars]['workflow_name'] %>" + name = "{{index $.Vars "workflow_name"}}" release_config = google_dataform_repository_release_config.release_config.id invocation_config { diff --git a/mmv1/templates/terraform/examples/dataplex_aspect_type_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_aspect_type_basic.tf.tmpl index d679ad10fd35..7422bb08572b 100644 --- a/mmv1/templates/terraform/examples/dataplex_aspect_type_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_aspect_type_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_dataplex_aspect_type" "<%= ctx[:primary_resource_id] %>" { - aspect_type_id = "<%= ctx[:vars]['aspect_type_name'] %>" - project = "<%= ctx[:test_env_vars]['project_name'] %>" +resource "google_dataplex_aspect_type" "{{$.PrimaryResourceId}}" { + aspect_type_id = "{{index $.Vars "aspect_type_name"}}" + project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" metadata_template = <" { - aspect_type_id = "<%= ctx[:vars]['aspect_type_name'] %>" - project = "<%= ctx[:test_env_vars]['project_name'] %>" +resource "google_dataplex_aspect_type" "{{$.PrimaryResourceId}}" { + aspect_type_id = "{{index $.Vars "aspect_type_name"}}" + project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" labels = { "tag": "test-tf" } diff --git a/mmv1/templates/terraform/examples/dataplex_asset_primary.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_asset_primary.tf.tmpl index 032672dfa89e..62fadd33037b 100644 --- a/mmv1/templates/terraform/examples/dataplex_asset_primary.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_asset_primary.tf.tmpl @@ -8,20 +8,20 @@ resource "google_storage_bucket" "primary_bucket" { ] } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } -resource "google_dataplex_lake" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_lake" "{{$.PrimaryResourceId}}" { name = "tf-test-lake%{random_suffix}" location = "us-central1" - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } -resource "google_dataplex_zone" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_zone" "{{$.PrimaryResourceId}}" { name = "tf-test-zone%{random_suffix}" location = "us-central1" - lake = google_dataplex_lake.<%= ctx[:primary_resource_id] %>.name + lake = google_dataplex_lake.{{$.PrimaryResourceId}}.name type = "RAW" discovery_spec { @@ -33,27 +33,27 @@ resource "google_dataplex_zone" "<%= ctx[:primary_resource_id] %>" { location_type = "SINGLE_REGION" } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } -resource "google_dataplex_asset" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_asset" "{{$.PrimaryResourceId}}" { name = "tf-test-asset%{random_suffix}" location = "us-central1" - lake = google_dataplex_lake.<%= ctx[:primary_resource_id] %>.name - dataplex_zone = google_dataplex_zone.<%= ctx[:primary_resource_id] %>.name + lake = google_dataplex_lake.{{$.PrimaryResourceId}}.name + dataplex_zone = google_dataplex_zone.{{$.PrimaryResourceId}}.name discovery_spec { enabled = false } resource_spec { - name = "projects/<%= ctx[:test_env_vars]['project_name'] %>/buckets/dataplex-bucket-%{random_suffix}" + name = "projects/{{index $.TestEnvVars "project_name"}}/buckets/dataplex-bucket-%{random_suffix}" type = "STORAGE_BUCKET" } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" depends_on = [ google_storage_bucket.primary_bucket ] diff --git a/mmv1/templates/terraform/examples/dataplex_datascan_basic_profile.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_datascan_basic_profile.tf.tmpl index 545f13a16201..3171a4a31eb6 100644 --- a/mmv1/templates/terraform/examples/dataplex_datascan_basic_profile.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_datascan_basic_profile.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_datascan" "{{$.PrimaryResourceId}}" { location = "us-central1" - data_scan_id = "<%= ctx[:vars]['datascan_name'] %>" + data_scan_id = "{{index $.Vars "datascan_name"}}" data { resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare" @@ -14,5 +14,5 @@ resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { data_profile_spec {} - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } diff --git a/mmv1/templates/terraform/examples/dataplex_datascan_basic_quality.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_datascan_basic_quality.tf.tmpl index 91f30f2088a6..c3fbdc805eb4 100644 --- a/mmv1/templates/terraform/examples/dataplex_datascan_basic_quality.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_datascan_basic_quality.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_datascan" "{{$.PrimaryResourceId}}" { location = "us-central1" - data_scan_id = "<%= ctx[:vars]['datascan_name'] %>" + data_scan_id = "{{index $.Vars "datascan_name"}}" data { resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare" @@ -23,5 +23,5 @@ resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { } } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } diff --git a/mmv1/templates/terraform/examples/dataplex_datascan_full_profile.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_datascan_full_profile.tf.tmpl index 9b1e1666f4f0..83ece378a24d 100644 --- a/mmv1/templates/terraform/examples/dataplex_datascan_full_profile.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_datascan_full_profile.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_datascan" "{{$.PrimaryResourceId}}" { location = "us-central1" display_name = "Full Datascan Profile" - data_scan_id = "<%= ctx[:vars]['datascan_name'] %>" + data_scan_id = "{{index $.Vars "datascan_name"}}" description = "Example resource - Full Datascan Profile" labels = { author = "billing" @@ -30,12 +30,12 @@ resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { } post_scan_actions { bigquery_export { - results_table = "//bigquery.googleapis.com/projects/<%= ctx[:test_env_vars]['project_name'] %>/datasets/<%= ctx[:vars]['dataset_name'] %>/tables/profile_export" + results_table = "//bigquery.googleapis.com/projects/{{index $.TestEnvVars "project_name"}}/datasets/{{index $.Vars "dataset_name"}}/tables/profile_export" } } } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" depends_on = [ google_bigquery_dataset.source @@ -43,7 +43,7 @@ resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { } resource "google_bigquery_dataset" "source" { - dataset_id = "<%= ctx[:vars]['dataset_name'] %>" + dataset_id = "{{index $.Vars "dataset_name"}}" friendly_name = "test" description = "This is a test description" location = "US" diff --git a/mmv1/templates/terraform/examples/dataplex_datascan_full_quality.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_datascan_full_quality.tf.tmpl index 54a73f986c39..5fa08827f4bd 100644 --- a/mmv1/templates/terraform/examples/dataplex_datascan_full_quality.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_datascan_full_quality.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_datascan" "{{$.PrimaryResourceId}}" { location = "us-central1" display_name = "Full Datascan Quality" - data_scan_id = "<%= ctx[:vars]['datascan_name'] %>" + data_scan_id = "{{index $.Vars "datascan_name"}}" description = "Example resource - Full Datascan Quality" labels = { author = "billing" @@ -104,5 +104,5 @@ resource "google_dataplex_datascan" "<%= ctx[:primary_resource_id] %>" { } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataplex_entry_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_entry_group_basic.tf.tmpl index 630a820f5d88..2c857f5b76b4 100644 --- a/mmv1/templates/terraform/examples/dataplex_entry_group_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_entry_group_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataplex_entry_group" "<%= ctx[:primary_resource_id] %>" { - entry_group_id = "<%= ctx[:vars]['entry_group_name'] %>" - project = "<%= ctx[:test_env_vars]['project_name'] %>" +resource "google_dataplex_entry_group" "{{$.PrimaryResourceId}}" { + entry_group_id = "{{index $.Vars "entry_group_name"}}" + project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataplex_entry_group_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_entry_group_full.tf.tmpl index 32a1598548d7..bb3a9183793c 100644 --- a/mmv1/templates/terraform/examples/dataplex_entry_group_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_entry_group_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_dataplex_entry_group" "<%= ctx[:primary_resource_id] %>" { - entry_group_id = "<%= ctx[:vars]['entry_group_name'] %>" - project = "<%= ctx[:test_env_vars]['project_name'] %>" +resource "google_dataplex_entry_group" "{{$.PrimaryResourceId}}" { + entry_group_id = "{{index $.Vars "entry_group_name"}}" + project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" labels = { "tag": "test-tf" } diff --git a/mmv1/templates/terraform/examples/dataplex_entry_type_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_entry_type_basic.tf.tmpl index 326bc5068cb8..defdab228218 100644 --- a/mmv1/templates/terraform/examples/dataplex_entry_type_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_entry_type_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataplex_entry_type" "<%= ctx[:primary_resource_id] %>" { - entry_type_id = "<%= ctx[:vars]['entry_type_name'] %>" - project = "<%= ctx[:test_env_vars]['project_name'] %>" +resource "google_dataplex_entry_type" "{{$.PrimaryResourceId}}" { + entry_type_id = "{{index $.Vars "entry_type_name"}}" + project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataplex_entry_type_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_entry_type_full.tf.tmpl index c6363e706f8b..d00d3af5c8f4 100644 --- a/mmv1/templates/terraform/examples/dataplex_entry_type_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_entry_type_full.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_dataplex_aspect_type" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_aspect_type" "{{$.PrimaryResourceId}}" { aspect_type_id = "tf-test-aspect-type%{random_suffix}" location = "us-central1" - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" metadata_template = <" { EOF } -resource "google_dataplex_entry_type" "<%= ctx[:primary_resource_id] %>" { - entry_type_id = "<%= ctx[:vars]['entry_type_name'] %>" - project = "<%= ctx[:test_env_vars]['project_name'] %>" +resource "google_dataplex_entry_type" "{{$.PrimaryResourceId}}" { + entry_type_id = "{{index $.Vars "entry_type_name"}}" + project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" labels = { "tag": "test-tf" } @@ -45,6 +45,6 @@ resource "google_dataplex_entry_type" "<%= ctx[:primary_resource_id] %>" { system = "CloudSQL" required_aspects { - type = google_dataplex_aspect_type.<%= ctx[:primary_resource_id] %>.name + type = google_dataplex_aspect_type.{{$.PrimaryResourceId}}.name } } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataplex_lake_primary.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_lake_primary.tf.tmpl index 46651fe5145b..5b2ce536b17a 100644 --- a/mmv1/templates/terraform/examples/dataplex_lake_primary.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_lake_primary.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_dataplex_lake" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_lake" "{{$.PrimaryResourceId}}" { location = "us-central1" name = "tf-test-lake%{random_suffix}" description = "Test Lake" @@ -8,6 +8,6 @@ resource "google_dataplex_lake" "<%= ctx[:primary_resource_id] %>" { my-lake = "exists" } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } diff --git a/mmv1/templates/terraform/examples/dataplex_task_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_task_basic.tf.tmpl index c105741576c1..6e9b44eaf978 100644 --- a/mmv1/templates/terraform/examples/dataplex_task_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_task_basic.tf.tmpl @@ -2,18 +2,18 @@ data "google_project" "project" { } -resource "google_dataplex_lake" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_lake" "{{$.PrimaryResourceId}}" { name = "tf-test-lake%{random_suffix}" location = "us-central1" - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } -resource "google_dataplex_task" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_task" "{{$.PrimaryResourceId}}" { task_id = "tf-test-task%{random_suffix}" location = "us-central1" - lake = google_dataplex_lake.<%= ctx[:primary_resource_id] %>.name + lake = google_dataplex_lake.{{$.PrimaryResourceId}}.name description = "Test Task Basic" @@ -31,7 +31,7 @@ resource "google_dataplex_task" "<%= ctx[:primary_resource_id] %>" { execution_spec { service_account = "${data.google_project.project.number}-compute@developer.gserviceaccount.com" - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" max_job_execution_lifetime = "100s" kms_key = "234jn2kjn42k3n423" } @@ -41,6 +41,6 @@ resource "google_dataplex_task" "<%= ctx[:primary_resource_id] %>" { } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataplex_task_notebook.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_task_notebook.tf.tmpl index cbf395520186..93c66d075fca 100644 --- a/mmv1/templates/terraform/examples/dataplex_task_notebook.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_task_notebook.tf.tmpl @@ -9,18 +9,18 @@ data "google_project" "project" { } -resource "google_dataplex_lake" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_lake" "{{$.PrimaryResourceId}}" { name = "tf-test-lake%{random_suffix}" location = "us-central1" - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } -resource "google_dataplex_task" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_task" "{{$.PrimaryResourceId}}" { task_id = "tf-test-task%{random_suffix}" location = "us-central1" - lake = google_dataplex_lake.<%= ctx[:primary_resource_id] %>.name + lake = google_dataplex_lake.{{$.PrimaryResourceId}}.name trigger_spec { type = "RECURRING" schedule = "1 * * * *" @@ -54,7 +54,7 @@ resource "google_dataplex_task" "<%= ctx[:primary_resource_id] %>" { archive_uris = ["gs://terraform-test/test.csv"] } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataplex_task_spark.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_task_spark.tf.tmpl index 25363788007d..6e9f038c9c59 100644 --- a/mmv1/templates/terraform/examples/dataplex_task_spark.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_task_spark.tf.tmpl @@ -8,18 +8,18 @@ data "google_project" "project" { } -resource "google_dataplex_lake" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_lake" "{{$.PrimaryResourceId}}" { name = "tf-test-lake%{random_suffix}" location = "us-central1" - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } -resource "google_dataplex_task" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_task" "{{$.PrimaryResourceId}}" { task_id = "tf-test-task%{random_suffix}" location = "us-central1" - lake = google_dataplex_lake.<%= ctx[:primary_resource_id] %>.name + lake = google_dataplex_lake.{{$.PrimaryResourceId}}.name trigger_spec { type = "ON_DEMAND" } @@ -56,6 +56,6 @@ resource "google_dataplex_task" "<%= ctx[:primary_resource_id] %>" { sql_script = "show databases" } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataplex_zone_primary.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_zone_primary.tf.tmpl index b5ee3a9404de..4b7fc2ee0a46 100644 --- a/mmv1/templates/terraform/examples/dataplex_zone_primary.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_zone_primary.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_dataplex_lake" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_lake" "{{$.PrimaryResourceId}}" { location = "us-central1" name = "tf-test-lake%{random_suffix}" description = "Test Lake" @@ -8,17 +8,17 @@ resource "google_dataplex_lake" "<%= ctx[:primary_resource_id] %>" { my-lake = "exists" } - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } -resource "google_dataplex_zone" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataplex_zone" "{{$.PrimaryResourceId}}" { name = "tf-test-zone%{random_suffix}" discovery_spec { enabled = false } - lake = google_dataplex_lake.<%= ctx[:primary_resource_id] %>.name + lake = google_dataplex_lake.{{$.PrimaryResourceId}}.name location = "us-central1" resource_spec { @@ -29,6 +29,6 @@ resource "google_dataplex_zone" "<%= ctx[:primary_resource_id] %>" { description = "Test Zone" display_name = "Test Zone" labels = {} - project = "<%= ctx[:test_env_vars]['project_name'] %>" + project = "{{index $.TestEnvVars "project_name"}}" } diff --git a/mmv1/templates/terraform/examples/dataproc_autoscaling_policy.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_autoscaling_policy.tf.tmpl index 424d6a0b957d..4b28a1b85b2c 100644 --- a/mmv1/templates/terraform/examples/dataproc_autoscaling_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_autoscaling_policy.tf.tmpl @@ -1,16 +1,16 @@ resource "google_dataproc_cluster" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" cluster_config { autoscaling_config { - policy_uri = google_dataproc_autoscaling_policy.<%= ctx[:primary_resource_id] %>.name + policy_uri = google_dataproc_autoscaling_policy.{{$.PrimaryResourceId}}.name } } } -resource "google_dataproc_autoscaling_policy" "<%= ctx[:primary_resource_id] %>" { - policy_id = "<%= ctx[:vars]['name'] %>" +resource "google_dataproc_autoscaling_policy" "{{$.PrimaryResourceId}}" { + policy_id = "{{index $.Vars "name"}}" location = "us-central1" worker_config { diff --git a/mmv1/templates/terraform/examples/dataproc_autoscaling_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_autoscaling_policy_basic.tf.tmpl index 6b94612bb48c..9782d66ee8b3 100644 --- a/mmv1/templates/terraform/examples/dataproc_autoscaling_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_autoscaling_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_autoscaling_policy" "<%= ctx[:primary_resource_id] %>" { - policy_id = "<%= ctx[:vars]['name'] %>" +resource "google_dataproc_autoscaling_policy" "{{$.PrimaryResourceId}}" { + policy_id = "{{index $.Vars "name"}}" location = "us-central1" worker_config { diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_federation_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_federation_basic.tf.tmpl index 6ec9e8fdff35..46a80cc4e7e3 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_federation_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_federation_basic.tf.tmpl @@ -1,17 +1,17 @@ -resource "google_dataproc_metastore_federation" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataproc_metastore_federation" "{{$.PrimaryResourceId}}" { location = "us-central1" - federation_id = "<%= ctx[:vars]['federation_id'] %>" + federation_id = "{{index $.Vars "federation_id"}}" version = "3.1.2" backend_metastores { rank = "1" - name = google_dataproc_metastore_service.<%= ctx[:primary_resource_id] %>.id + name = google_dataproc_metastore_service.{{$.PrimaryResourceId}}.id metastore_type = "DATAPROC_METASTORE" } } -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['service_id'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "service_id"}}" location = "us-central1" tier = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_federation_bigquery.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_federation_bigquery.tf.tmpl index 64f760359549..4d22834f235c 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_federation_bigquery.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_federation_bigquery.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_dataproc_metastore_federation" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataproc_metastore_federation" "{{$.PrimaryResourceId}}" { location = "us-central1" - federation_id = "<%= ctx[:vars]['federation_id'] %>" + federation_id = "{{index $.Vars "federation_id"}}" version = "3.1.2" backend_metastores { @@ -11,13 +11,13 @@ resource "google_dataproc_metastore_federation" "<%= ctx[:primary_resource_id] % backend_metastores { rank = "1" - name = google_dataproc_metastore_service.<%= ctx[:primary_resource_id] %>.id + name = google_dataproc_metastore_service.{{$.PrimaryResourceId}}.id metastore_type = "DATAPROC_METASTORE" } } -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['service_id'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "service_id"}}" location = "us-central1" tier = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_max_scaling_factor.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_max_scaling_factor.tf.tmpl index 92df03031c00..be032f873ff1 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_max_scaling_factor.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_max_scaling_factor.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" # DPMS 2 requires SPANNER database type, and does not require diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_min_and_max_scaling_factor.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_min_and_max_scaling_factor.tf.tmpl index 3601bf231716..9cc583eced99 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_min_and_max_scaling_factor.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_min_and_max_scaling_factor.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" # DPMS 2 requires SPANNER database type, and does not require diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_min_scaling_factor.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_min_scaling_factor.tf.tmpl index 27268dda15d0..60b281b9aaf9 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_min_scaling_factor.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_min_scaling_factor.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" # DPMS 2 requires SPANNER database type, and does not require diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_no_limit_config.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_no_limit_config.tf.tmpl index a27bc222d06d..a584dadb9377 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_no_limit_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_autoscaling_no_limit_config.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { provider = google-beta - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" # DPMS 2 requires SPANNER database type, and does not require diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_aux.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_aux.tf.tmpl index 659e88aaf440..1f85c54b297a 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_aux.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_aux.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" tier = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_basic.tf.tmpl index 368e76e15bd1..7e1dbeb6c0d4 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" port = 9080 tier = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_cmek_example.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_cmek_example.tf.tmpl index 2d3b63bfaf6d..3b08a32b7eab 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_cmek_example.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_cmek_example.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" encryption_config { @@ -13,7 +13,7 @@ resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" resource "google_kms_crypto_key" "crypto_key" { provider = google-beta - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id purpose = "ENCRYPT_DECRYPT" @@ -21,6 +21,6 @@ resource "google_kms_crypto_key" "crypto_key" { resource "google_kms_key_ring" "key_ring" { provider = google-beta - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_cmek_test.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_cmek_test.tf.tmpl index 731960437dd5..e27a4ebb33ff 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_cmek_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_cmek_test.tf.tmpl @@ -3,8 +3,8 @@ data "google_project" "project" {} data "google_storage_project_service_account" "gcs_account" {} -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" encryption_config { @@ -22,14 +22,14 @@ resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id purpose = "ENCRYPT_DECRYPT" } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2.tf.tmpl index cf95ffc9a7b8..bf24ee70a442 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" # DPMS 2 requires SPANNER database type, and does not require diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2_scaling_factor.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2_scaling_factor.tf.tmpl index 44f7f3ec6658..824c72509683 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2_scaling_factor.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2_scaling_factor.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" # DPMS 2 requires SPANNER database type, and does not require diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2_scaling_factor_lt1.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2_scaling_factor_lt1.tf.tmpl index d6d34f5d40b6..dc3c0a0bde68 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2_scaling_factor_lt1.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_dpms2_scaling_factor_lt1.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" # DPMS 2 requires SPANNER database type, and does not require diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_endpoint.tf.tmpl index 267d7cbdf4f3..c8b9837b1f6a 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_endpoint.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" tier = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_metadata.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_metadata.tf.tmpl index cb1df20a5a4f..a92fc1495917 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_metadata.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_metadata.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" tier = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_private_service_connect.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_private_service_connect.tf.tmpl index 01cfb57ba8bb..5b07bf408e5c 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_private_service_connect.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_private_service_connect.tf.tmpl @@ -1,18 +1,18 @@ resource "google_compute_network" "net" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnet" { - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" region = "us-central1" network = google_compute_network.net.id ip_cidr_range = "10.0.0.0/22" private_ip_google_access = true } -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" tier = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_private_service_connect_custom_routes.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_private_service_connect_custom_routes.tf.tmpl index 2bc10009dd99..819f917e19e1 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_private_service_connect_custom_routes.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_private_service_connect_custom_routes.tf.tmpl @@ -1,21 +1,21 @@ resource "google_compute_network" "net" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnet" { provider = google-beta - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" region = "us-central1" network = google_compute_network.net.id ip_cidr_range = "10.0.0.0/22" private_ip_google_access = true } -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { provider = google-beta - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" hive_metastore_config { diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_scheduled_backup.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_scheduled_backup.tf.tmpl index fe4ada3fd0bc..c2e29a78e23a 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_scheduled_backup.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_scheduled_backup.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" port = 9080 tier = "DEVELOPER" @@ -26,6 +26,6 @@ resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['metastore_service_name'] %>" + name = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataproc_metastore_service_telemetry.tf.tmpl b/mmv1/templates/terraform/examples/dataproc_metastore_service_telemetry.tf.tmpl index 91d804028fa6..e58944599a38 100644 --- a/mmv1/templates/terraform/examples/dataproc_metastore_service_telemetry.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataproc_metastore_service_telemetry.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataproc_metastore_service" "<%= ctx[:primary_resource_id] %>" { - service_id = "<%= ctx[:vars]['metastore_service_name'] %>" +resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "metastore_service_name"}}" location = "us-central1" port = 9080 tier = "DEVELOPER" diff --git a/mmv1/templates/terraform/examples/datastream_connection_profile_basic.tf.tmpl b/mmv1/templates/terraform/examples/datastream_connection_profile_basic.tf.tmpl index 516b5b93b2c9..1605f8f37595 100644 --- a/mmv1/templates/terraform/examples/datastream_connection_profile_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_connection_profile_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_datastream_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_datastream_connection_profile" "{{$.PrimaryResourceId}}" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "connection_profile_id"}}" gcs_profile { bucket = "my-bucket" diff --git a/mmv1/templates/terraform/examples/datastream_connection_profile_full.tf.tmpl b/mmv1/templates/terraform/examples/datastream_connection_profile_full.tf.tmpl index a06c613daeef..c4d2ae3b1818 100644 --- a/mmv1/templates/terraform/examples/datastream_connection_profile_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_connection_profile_full.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_datastream_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_datastream_connection_profile" "{{$.PrimaryResourceId}}" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "connection_profile_id"}}" gcs_profile { bucket = "my-bucket" diff --git a/mmv1/templates/terraform/examples/datastream_connection_profile_postgres.tf.tmpl b/mmv1/templates/terraform/examples/datastream_connection_profile_postgres.tf.tmpl index 331479017807..9d532ca28d21 100644 --- a/mmv1/templates/terraform/examples/datastream_connection_profile_postgres.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_connection_profile_postgres.tf.tmpl @@ -1,5 +1,5 @@ resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "POSTGRES_14" region = "us-central1" settings { @@ -30,7 +30,7 @@ resource "google_sql_database_instance" "instance" { } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_database" "db" { @@ -49,10 +49,10 @@ resource "google_sql_user" "user" { password = random_password.pwd.result } -resource "google_datastream_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_datastream_connection_profile" "{{$.PrimaryResourceId}}" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "connection_profile_id"}}" postgresql_profile { hostname = google_sql_database_instance.instance.public_ip_address diff --git a/mmv1/templates/terraform/examples/datastream_connection_profile_postgresql_private_connection.tf.tmpl b/mmv1/templates/terraform/examples/datastream_connection_profile_postgresql_private_connection.tf.tmpl index 5df86ff5990e..d8b5003e503b 100644 --- a/mmv1/templates/terraform/examples/datastream_connection_profile_postgresql_private_connection.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_connection_profile_postgresql_private_connection.tf.tmpl @@ -1,7 +1,7 @@ resource "google_datastream_private_connection" "private_connection" { display_name = "Connection profile" location = "us-central1" - private_connection_id = "<%= ctx[:vars]['private_connection_id'] %>" + private_connection_id = "{{index $.Vars "private_connection_id"}}" labels = { key = "value" @@ -14,11 +14,11 @@ resource "google_datastream_private_connection" "private_connection" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "POSTGRES_14" region = "us-central1" settings { @@ -49,7 +49,7 @@ resource "google_sql_database_instance" "instance" { } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_database" "db" { @@ -68,10 +68,10 @@ resource "google_sql_user" "user" { password = random_password.pwd.result } -resource "google_datastream_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_datastream_connection_profile" "{{$.PrimaryResourceId}}" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "connection_profile_id"}}" postgresql_profile { hostname = google_sql_database_instance.instance.public_ip_address diff --git a/mmv1/templates/terraform/examples/datastream_connection_profile_sql_server.tf.tmpl b/mmv1/templates/terraform/examples/datastream_connection_profile_sql_server.tf.tmpl index 267effea1048..68a563b1397a 100644 --- a/mmv1/templates/terraform/examples/datastream_connection_profile_sql_server.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_connection_profile_sql_server.tf.tmpl @@ -1,9 +1,9 @@ resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['sql_server_name'] %>" + name = "{{index $.Vars "sql_server_name"}}" database_version = "SQLSERVER_2019_STANDARD" region = "us-central1" - root_password = "<%= ctx[:vars]['sql_server_root_password'] %>" - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + root_password = "{{index $.Vars "sql_server_root_password"}}" + deletion_protection = "{{index $.Vars "deletion_protection"}}" settings { tier = "db-custom-2-4096" @@ -34,20 +34,20 @@ resource "google_sql_database_instance" "instance" { } resource "google_sql_database" "db" { - name = "<%= ctx[:vars]['database_name'] %>" + name = "{{index $.Vars "database_name"}}" instance = google_sql_database_instance.instance.name } resource "google_sql_user" "user" { - name = "<%= ctx[:vars]['database_user'] %>" + name = "{{index $.Vars "database_user"}}" instance = google_sql_database_instance.instance.name - password = "<%= ctx[:vars]['database_password'] %>" + password = "{{index $.Vars "database_password"}}" } resource "google_datastream_connection_profile" "default" { display_name = "SQL Server Source" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" sql_server_profile { hostname = google_sql_database_instance.instance.public_ip_address diff --git a/mmv1/templates/terraform/examples/datastream_private_connection_full.tf.tmpl b/mmv1/templates/terraform/examples/datastream_private_connection_full.tf.tmpl index dfd9a50eeb49..92ba4312ac4a 100644 --- a/mmv1/templates/terraform/examples/datastream_private_connection_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_private_connection_full.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_datastream_private_connection" "<%= ctx[:primary_resource_id] %>" { +resource "google_datastream_private_connection" "{{$.PrimaryResourceId}}" { display_name = "Connection profile" location = "us-central1" - private_connection_id = "<%= ctx[:vars]['private_connection_id'] %>" + private_connection_id = "{{index $.Vars "private_connection_id"}}" labels = { key = "value" @@ -14,5 +14,5 @@ resource "google_datastream_private_connection" "<%= ctx[:primary_resource_id] % } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/datastream_stream_basic.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_basic.tf.tmpl index 57049642000c..094370cf1414 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_basic.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "MYSQL_8_0" region = "us-central1" settings { @@ -37,7 +37,7 @@ resource "google_sql_database_instance" "instance" { } } - deletion_protection = <%= ctx[:vars]['deletion_protection'] %> + deletion_protection = {{index $.Vars "deletion_protection"}} } resource "google_sql_database" "db" { @@ -60,7 +60,7 @@ resource "google_sql_user" "user" { resource "google_datastream_connection_profile" "source_connection_profile" { display_name = "Source connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" mysql_profile { hostname = google_sql_database_instance.instance.public_ip_address @@ -70,7 +70,7 @@ resource "google_datastream_connection_profile" "source_connection_profile" { } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" uniform_bucket_level_access = true } @@ -96,7 +96,7 @@ resource "google_storage_bucket_iam_member" "reader" { resource "google_datastream_connection_profile" "destination_connection_profile" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['destination_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "destination_connection_profile_id"}}" gcs_profile { bucket = google_storage_bucket.bucket.name @@ -104,8 +104,8 @@ resource "google_datastream_connection_profile" "destination_connection_profile" } } -resource "google_datastream_stream" "<%= ctx[:primary_resource_id] %>" { - stream_id = "<%= ctx[:vars]['stream_id'] %>" +resource "google_datastream_stream" "{{$.PrimaryResourceId}}" { + stream_id = "{{index $.Vars "stream_id"}}" location = "us-central1" display_name = "my stream" source_config { diff --git a/mmv1/templates/terraform/examples/datastream_stream_bigquery.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_bigquery.tf.tmpl index ef6b95271498..e6510a8d2bed 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_bigquery.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_bigquery.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "MYSQL_8_0" region = "us-central1" settings { @@ -37,7 +37,7 @@ resource "google_sql_database_instance" "instance" { } } - deletion_protection = <%= ctx[:vars]['deletion_protection'] %> + deletion_protection = {{index $.Vars "deletion_protection"}} } resource "google_sql_database" "db" { @@ -60,7 +60,7 @@ resource "google_sql_user" "user" { resource "google_datastream_connection_profile" "source_connection_profile" { display_name = "Source connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" mysql_profile { hostname = google_sql_database_instance.instance.public_ip_address @@ -73,7 +73,7 @@ data "google_bigquery_default_service_account" "bq_sa" { } resource "google_kms_crypto_key_iam_member" "bigquery_key_user" { - crypto_key_id = "<%= ctx[:vars]['bigquery_destination_table_kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "bigquery_destination_table_kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:${data.google_bigquery_default_service_account.bq_sa.email}" } @@ -81,16 +81,16 @@ resource "google_kms_crypto_key_iam_member" "bigquery_key_user" { resource "google_datastream_connection_profile" "destination_connection_profile" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['destination_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "destination_connection_profile_id"}}" bigquery_profile {} } -resource "google_datastream_stream" "<%= ctx[:primary_resource_id] %>" { +resource "google_datastream_stream" "{{$.PrimaryResourceId}}" { depends_on = [ google_kms_crypto_key_iam_member.bigquery_key_user ] - stream_id = "<%= ctx[:vars]['stream_id'] %>" + stream_id = "{{index $.Vars "stream_id"}}" location = "us-central1" display_name = "my stream" source_config { @@ -103,7 +103,7 @@ resource "google_datastream_stream" "<%= ctx[:primary_resource_id] %>" { source_hierarchy_datasets { dataset_template { location = "us-central1" - kms_key_name = "<%= ctx[:vars]['bigquery_destination_table_kms_key_name'] %>" + kms_key_name = "{{index $.Vars "bigquery_destination_table_kms_key_name"}}" } } } diff --git a/mmv1/templates/terraform/examples/datastream_stream_bigquery_append_only.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_bigquery_append_only.tf.tmpl index 8aec442bc336..d126251f871b 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_bigquery_append_only.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_bigquery_append_only.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "MYSQL_8_0" region = "us-central1" settings { @@ -37,7 +37,7 @@ resource "google_sql_database_instance" "instance" { } } - deletion_protection = <%= ctx[:vars]['deletion_protection'] %> + deletion_protection = {{index $.Vars "deletion_protection"}} } resource "google_sql_database" "db" { @@ -60,7 +60,7 @@ resource "google_sql_user" "user" { resource "google_datastream_connection_profile" "source_connection_profile" { display_name = "Source connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" mysql_profile { hostname = google_sql_database_instance.instance.public_ip_address @@ -72,13 +72,13 @@ resource "google_datastream_connection_profile" "source_connection_profile" { resource "google_datastream_connection_profile" "destination_connection_profile" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['destination_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "destination_connection_profile_id"}}" bigquery_profile {} } -resource "google_datastream_stream" "<%= ctx[:primary_resource_id] %>" { - stream_id = "<%= ctx[:vars]['stream_id'] %>" +resource "google_datastream_stream" "{{$.PrimaryResourceId}}" { + stream_id = "{{index $.Vars "stream_id"}}" location = "us-central1" display_name = "my stream" source_config { diff --git a/mmv1/templates/terraform/examples/datastream_stream_full.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_full.tf.tmpl index 4c57f84110fd..3a86fd1d5886 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_full.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "project" { } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" database_version = "MYSQL_8_0" region = "us-central1" settings { @@ -37,7 +37,7 @@ resource "google_sql_database_instance" "instance" { } } - deletion_protection = <%= ctx[:vars]['deletion_protection'] %> + deletion_protection = {{index $.Vars "deletion_protection"}} } resource "google_sql_database" "db" { @@ -60,7 +60,7 @@ resource "google_sql_user" "user" { resource "google_datastream_connection_profile" "source_connection_profile" { display_name = "Source connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" mysql_profile { hostname = google_sql_database_instance.instance.public_ip_address @@ -70,7 +70,7 @@ resource "google_datastream_connection_profile" "source_connection_profile" { } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" uniform_bucket_level_access = true } @@ -94,7 +94,7 @@ resource "google_storage_bucket_iam_member" "reader" { } resource "google_kms_crypto_key_iam_member" "key_user" { - crypto_key_id = "<%= ctx[:vars]['stream_cmek'] %>" + crypto_key_id = "{{index $.Vars "stream_cmek"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-datastream.iam.gserviceaccount.com" } @@ -102,7 +102,7 @@ resource "google_kms_crypto_key_iam_member" "key_user" { resource "google_datastream_connection_profile" "destination_connection_profile" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['destination_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "destination_connection_profile_id"}}" gcs_profile { bucket = google_storage_bucket.bucket.name @@ -110,11 +110,11 @@ resource "google_datastream_connection_profile" "destination_connection_profile" } } -resource "google_datastream_stream" "<%= ctx[:primary_resource_id] %>" { +resource "google_datastream_stream" "{{$.PrimaryResourceId}}" { depends_on = [ google_kms_crypto_key_iam_member.key_user ] - stream_id = "<%= ctx[:vars]['stream_id'] %>" + stream_id = "{{index $.Vars "stream_id"}}" desired_state = "NOT_STARTED" location = "us-central1" display_name = "my stream" @@ -194,5 +194,5 @@ resource "google_datastream_stream" "<%= ctx[:primary_resource_id] %>" { } } - customer_managed_encryption_key = "<%= ctx[:vars]['stream_cmek'] %>" + customer_managed_encryption_key = "{{index $.Vars "stream_cmek"}}" } diff --git a/mmv1/templates/terraform/examples/datastream_stream_oracle.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_oracle.tf.tmpl index f2f3d2c87069..32beb3236459 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_oracle.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_oracle.tf.tmpl @@ -1,7 +1,7 @@ resource "google_datastream_connection_profile" "source" { display_name = "Oracle Source" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" oracle_profile { hostname = "hostname" @@ -15,7 +15,7 @@ resource "google_datastream_connection_profile" "source" { resource "google_datastream_connection_profile" "destination" { display_name = "BigQuery Destination" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['destination_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "destination_connection_profile_id"}}" bigquery_profile {} } @@ -23,7 +23,7 @@ resource "google_datastream_connection_profile" "destination" { resource "google_datastream_stream" "stream5" { display_name = "Oracle to BigQuery" location = "us-central1" - stream_id = "<%= ctx[:vars]['stream_id'] %>" + stream_id = "{{index $.Vars "stream_id"}}" desired_state = "RUNNING" source_config { diff --git a/mmv1/templates/terraform/examples/datastream_stream_postgresql.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_postgresql.tf.tmpl index 7df075b05e1d..f83b8d3bfa16 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_postgresql.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_postgresql.tf.tmpl @@ -1,7 +1,7 @@ resource "google_datastream_connection_profile" "source" { display_name = "Postgresql Source" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" postgresql_profile { hostname = "hostname" @@ -15,15 +15,15 @@ resource "google_datastream_connection_profile" "source" { resource "google_datastream_connection_profile" "destination" { display_name = "BigQuery Destination" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['destination_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "destination_connection_profile_id"}}" bigquery_profile {} } -resource "google_datastream_stream" "<%= ctx[:primary_resource_id] %>" { +resource "google_datastream_stream" "{{$.PrimaryResourceId}}" { display_name = "Postgres to BigQuery" location = "us-central1" - stream_id = "<%= ctx[:vars]['stream_id'] %>" + stream_id = "{{index $.Vars "stream_id"}}" desired_state = "RUNNING" source_config { diff --git a/mmv1/templates/terraform/examples/datastream_stream_postgresql_bigquery_dataset_id.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_postgresql_bigquery_dataset_id.tf.tmpl index bc54ed89ff5e..508058420bf7 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_postgresql_bigquery_dataset_id.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_postgresql_bigquery_dataset_id.tf.tmpl @@ -1,6 +1,6 @@ resource "google_bigquery_dataset" "postgres" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "postgres" description = "Database of postgres" location = "us-central1" @@ -9,7 +9,7 @@ resource "google_bigquery_dataset" "postgres" { resource "google_datastream_stream" "default" { display_name = "postgres to bigQuery" location = "us-central1" - stream_id = "<%= ctx[:vars]['stream_id'] %>" + stream_id = "{{index $.Vars "stream_id"}}" source_config { source_connection_profile = google_datastream_connection_profile.source_connection_profile.id @@ -34,12 +34,12 @@ resource "google_datastream_stream" "default" { resource "google_datastream_connection_profile" "destination_connection_profile2" { display_name = "Connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['dest_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "dest_connection_profile_id"}}" bigquery_profile {} } resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" database_version = "MYSQL_8_0" region = "us-central1" settings { @@ -87,7 +87,7 @@ resource "random_password" "pwd" { } resource "google_sql_user" "user" { - name = "<%= ctx[:vars]['sql_user_name'] %>" + name = "{{index $.Vars "sql_user_name"}}" instance = google_sql_database_instance.instance.name host = "%" password = random_password.pwd.result @@ -96,7 +96,7 @@ resource "google_sql_user" "user" { resource "google_datastream_connection_profile" "source_connection_profile" { display_name = "Source connection profile" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" mysql_profile { hostname = google_sql_database_instance.instance.public_ip_address diff --git a/mmv1/templates/terraform/examples/datastream_stream_sql_server.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_sql_server.tf.tmpl index 794a5c1a96e5..9b49772d739a 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_sql_server.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_sql_server.tf.tmpl @@ -1,9 +1,9 @@ resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['sql_server_name'] %>" + name = "{{index $.Vars "sql_server_name"}}" database_version = "SQLSERVER_2019_STANDARD" region = "us-central1" - root_password = "<%= ctx[:vars]['sql_server_root_password'] %>" - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + root_password = "{{index $.Vars "sql_server_root_password"}}" + deletion_protection = "{{index $.Vars "deletion_protection"}}" settings { tier = "db-custom-2-4096" @@ -34,21 +34,21 @@ resource "google_sql_database_instance" "instance" { } resource "google_sql_database" "db" { - name = "<%= ctx[:vars]['database_name'] %>" + name = "{{index $.Vars "database_name"}}" instance = google_sql_database_instance.instance.name depends_on = [google_sql_user.user] } resource "google_sql_user" "user" { - name = "<%= ctx[:vars]['database_user'] %>" + name = "{{index $.Vars "database_user"}}" instance = google_sql_database_instance.instance.name - password = "<%= ctx[:vars]['database_password'] %>" + password = "{{index $.Vars "database_password"}}" } resource "google_datastream_connection_profile" "source" { display_name = "SQL Server Source" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" sql_server_profile { hostname = google_sql_database_instance.instance.public_ip_address @@ -62,7 +62,7 @@ resource "google_datastream_connection_profile" "source" { resource "google_datastream_connection_profile" "destination" { display_name = "BigQuery Destination" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['destination_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "destination_connection_profile_id"}}" bigquery_profile {} } @@ -70,7 +70,7 @@ resource "google_datastream_connection_profile" "destination" { resource "google_datastream_stream" "default" { display_name = "SQL Server to BigQuery" location = "us-central1" - stream_id = "<%= ctx[:vars]['stream_id'] %>" + stream_id = "{{index $.Vars "stream_id"}}" source_config { source_connection_profile = google_datastream_connection_profile.source.id diff --git a/mmv1/templates/terraform/examples/datastream_stream_sql_server_change_tables.tf.tmpl b/mmv1/templates/terraform/examples/datastream_stream_sql_server_change_tables.tf.tmpl index 0915685979ab..40afbdb587b8 100644 --- a/mmv1/templates/terraform/examples/datastream_stream_sql_server_change_tables.tf.tmpl +++ b/mmv1/templates/terraform/examples/datastream_stream_sql_server_change_tables.tf.tmpl @@ -1,9 +1,9 @@ resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['sql_server_name'] %>" + name = "{{index $.Vars "sql_server_name"}}" database_version = "SQLSERVER_2019_STANDARD" region = "us-central1" - root_password = "<%= ctx[:vars]['sql_server_root_password'] %>" - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + root_password = "{{index $.Vars "sql_server_root_password"}}" + deletion_protection = "{{index $.Vars "deletion_protection"}}" settings { tier = "db-custom-2-4096" @@ -34,21 +34,21 @@ resource "google_sql_database_instance" "instance" { } resource "google_sql_database" "db" { - name = "<%= ctx[:vars]['database_name'] %>" + name = "{{index $.Vars "database_name"}}" instance = google_sql_database_instance.instance.name depends_on = [google_sql_user.user] } resource "google_sql_user" "user" { - name = "<%= ctx[:vars]['database_user'] %>" + name = "{{index $.Vars "database_user"}}" instance = google_sql_database_instance.instance.name - password = "<%= ctx[:vars]['database_password'] %>" + password = "{{index $.Vars "database_password"}}" } resource "google_datastream_connection_profile" "source" { display_name = "SQL Server Source" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['source_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "source_connection_profile_id"}}" sql_server_profile { hostname = google_sql_database_instance.instance.public_ip_address @@ -62,7 +62,7 @@ resource "google_datastream_connection_profile" "source" { resource "google_datastream_connection_profile" "destination" { display_name = "BigQuery Destination" location = "us-central1" - connection_profile_id = "<%= ctx[:vars]['destination_connection_profile_id'] %>" + connection_profile_id = "{{index $.Vars "destination_connection_profile_id"}}" bigquery_profile {} } @@ -70,7 +70,7 @@ resource "google_datastream_connection_profile" "destination" { resource "google_datastream_stream" "default" { display_name = "SQL Server to BigQuery" location = "us-central1" - stream_id = "<%= ctx[:vars]['stream_id'] %>" + stream_id = "{{index $.Vars "stream_id"}}" source_config { source_connection_profile = google_datastream_connection_profile.source.id diff --git a/mmv1/templates/terraform/examples/deployment_manager_deployment_basic.tf.tmpl b/mmv1/templates/terraform/examples/deployment_manager_deployment_basic.tf.tmpl index de127a03fc00..ff19792fa29c 100644 --- a/mmv1/templates/terraform/examples/deployment_manager_deployment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/deployment_manager_deployment_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_deployment_manager_deployment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['deployment_name'] %>" +resource "google_deployment_manager_deployment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "deployment_name"}}" target { config { diff --git a/mmv1/templates/terraform/examples/deployment_manager_deployment_imports.tf.tmpl b/mmv1/templates/terraform/examples/deployment_manager_deployment_imports.tf.tmpl index f10cf6f610b9..a441c0b0268e 100644 --- a/mmv1/templates/terraform/examples/deployment_manager_deployment_imports.tf.tmpl +++ b/mmv1/templates/terraform/examples/deployment_manager_deployment_imports.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_deployment_manager_deployment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['deployment_name'] %>" +resource "google_deployment_manager_deployment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "deployment_name"}}" target { config { content = <" { +resource "google_developer_connect_connection" "{{$.PrimaryResourceId}}" { provider = google-beta location = "us-central1" - connection_id = "<%= ctx[:vars]['connection_name'] %>" + connection_id = "{{index $.Vars "connection_name"}}" github_config { github_app = "DEVELOPER_CONNECT" diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl index 5200642e34d6..1c253849206f 100644 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_developer_connect_git_repository_link" "<%= ctx[:primary_resource_id] %>" { +resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { provider = google-beta - git_repository_link_id = "<%= ctx[:vars]['git_repository_link_name'] %>" + git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" parent_connection = google_developer_connect_connection.github_conn.connection_id clone_uri = "https://github.com/gcb-developerconnect-robot/tf-demo.git" location = "us-central1" @@ -11,7 +11,7 @@ resource "google_developer_connect_connection" "github_conn" { provider = google-beta location = "us-central1" - connection_id = "<%= ctx[:vars]['connection_name'] %>" + connection_id = "{{index $.Vars "connection_name"}}" disabled = false github_config { diff --git a/mmv1/templates/terraform/examples/dialogflow_agent_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflow_agent_full.tf.tmpl index 782a007741c1..ef8aa04ef527 100644 --- a/mmv1/templates/terraform/examples/dialogflow_agent_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflow_agent_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dialogflow_agent" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["agent_name"] %>" +resource "google_dialogflow_agent" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "agent_name"}}" default_language_code = "en" supported_language_codes = ["fr","de","es"] time_zone = "America/New_York" diff --git a/mmv1/templates/terraform/examples/dialogflow_entity_type_basic.tf.tmpl b/mmv1/templates/terraform/examples/dialogflow_entity_type_basic.tf.tmpl index bafe6d533f82..7838fdba39f3 100644 --- a/mmv1/templates/terraform/examples/dialogflow_entity_type_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflow_entity_type_basic.tf.tmpl @@ -4,9 +4,9 @@ resource "google_dialogflow_agent" "basic_agent" { time_zone = "America/New_York" } -resource "google_dialogflow_entity_type" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_entity_type" "{{$.PrimaryResourceId}}" { depends_on = [google_dialogflow_agent.basic_agent] - display_name = "<%= ctx[:vars]["entity_type_name"] %>" + display_name = "{{index $.Vars "entity_type_name"}}" kind = "KIND_MAP" entities { value = "value1" diff --git a/mmv1/templates/terraform/examples/dialogflow_fulfillment_basic.tf.tmpl b/mmv1/templates/terraform/examples/dialogflow_fulfillment_basic.tf.tmpl index c68481f23ad9..76ad61ac6c45 100644 --- a/mmv1/templates/terraform/examples/dialogflow_fulfillment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflow_fulfillment_basic.tf.tmpl @@ -4,9 +4,9 @@ resource "google_dialogflow_agent" "basic_agent" { time_zone = "America/New_York" } -resource "google_dialogflow_fulfillment" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_fulfillment" "{{$.PrimaryResourceId}}" { depends_on = [google_dialogflow_agent.basic_agent] - display_name = "<%= ctx[:vars]["fulfillment_name"] %>" + display_name = "{{index $.Vars "fulfillment_name"}}" enabled = true generic_web_service { uri = "https://google.com" diff --git a/mmv1/templates/terraform/examples/dialogflow_intent_basic.tf.tmpl b/mmv1/templates/terraform/examples/dialogflow_intent_basic.tf.tmpl index 6f1e4507fd3b..32af88de2e80 100644 --- a/mmv1/templates/terraform/examples/dialogflow_intent_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflow_intent_basic.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dialogflow_agent" "basic_agent" { time_zone = "America/New_York" } -resource "google_dialogflow_intent" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_intent" "{{$.PrimaryResourceId}}" { depends_on = [google_dialogflow_agent.basic_agent] - display_name = "<%= ctx[:vars]["intent_name"] %>" + display_name = "{{index $.Vars "intent_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dialogflow_intent_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflow_intent_full.tf.tmpl index d0364703f76c..9fcbced7f5a0 100644 --- a/mmv1/templates/terraform/examples/dialogflow_intent_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflow_intent_full.tf.tmpl @@ -1,7 +1,7 @@ resource "google_project" "agent_project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } @@ -12,7 +12,7 @@ resource "google_project_service" "agent_project" { } resource "google_service_account" "dialogflow_service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" } resource "google_project_iam_member" "agent_create" { @@ -28,10 +28,10 @@ resource "google_dialogflow_agent" "basic_agent" { time_zone = "America/New_York" } -resource "google_dialogflow_intent" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_intent" "{{$.PrimaryResourceId}}" { project = google_project.agent_project.project_id depends_on = [google_dialogflow_agent.basic_agent] - display_name = "<%= ctx[:vars]["intent_name"] %>" + display_name = "{{index $.Vars "intent_name"}}" webhook_state = "WEBHOOK_STATE_ENABLED" priority = 1 is_fallback = false diff --git a/mmv1/templates/terraform/examples/dialogflowcx_agent_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_agent_full.tf.tmpl index 1a62c572ba40..c58d83218701 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_agent_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_agent_full.tf.tmpl @@ -1,11 +1,11 @@ resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]["bucket_name"] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" uniform_bucket_level_access = true } -resource "google_dialogflow_cx_agent" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["agent_name"] %>" +resource "google_dialogflow_cx_agent" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr","de","es"] diff --git a/mmv1/templates/terraform/examples/dialogflowcx_entity_type_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_entity_type_full.tf.tmpl index 9885cf4ce2ee..fea269d03232 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_entity_type_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_entity_type_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr","de","es"] @@ -14,7 +14,7 @@ resource "google_dialogflow_cx_agent" "agent" { } -resource "google_dialogflow_cx_entity_type" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_entity_type" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id display_name = "MyEntity" kind = "KIND_MAP" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_environment_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_environment_full.tf.tmpl index b4f30a4de908..8be3bb9929c9 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_environment_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_environment_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr","de","es"] @@ -19,7 +19,7 @@ resource "google_dialogflow_cx_version" "version_1" { description = "version 1.0.0" } -resource "google_dialogflow_cx_environment" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_environment" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id display_name = "Development" description = "Development Environment" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_environment_regional.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_environment_regional.tf.tmpl index ea7af171cb0e..c834744eb4cc 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_environment_regional.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_environment_regional.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "us-central1" default_language_code = "en" supported_language_codes = ["fr","de","es"] @@ -17,7 +17,7 @@ resource "google_dialogflow_cx_version" "version_1" { description = "version 1.0.0" } -resource "google_dialogflow_cx_environment" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_environment" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id display_name = "Development" description = "Development Environment" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_flow_basic.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_flow_basic.tf.tmpl index 8b92d1e5792a..e0e17c94fd26 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_flow_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_flow_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr", "de", "es"] @@ -14,7 +14,7 @@ resource "google_dialogflow_cx_agent" "agent" { } -resource "google_dialogflow_cx_flow" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_flow" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id display_name = "MyFlow" description = "Test Flow" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_flow_default_start_flow.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_flow_default_start_flow.tf.tmpl index 19bda4f341dd..8224a4ba5191 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_flow_default_start_flow.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_flow_default_start_flow.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" time_zone = "America/New_York" @@ -19,7 +19,7 @@ resource "google_dialogflow_cx_intent" "default_welcome_intent" { } -resource "google_dialogflow_cx_flow" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_flow" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id is_default_start_flow = true display_name = "Default Start Flow" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_flow_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_flow_full.tf.tmpl index 3dde921aed9f..0ed8216c4812 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_flow_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_flow_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr", "de", "es"] @@ -14,13 +14,13 @@ resource "google_dialogflow_cx_agent" "agent" { } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]["bucket_name"] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" uniform_bucket_level_access = true } -resource "google_dialogflow_cx_flow" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_flow" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id display_name = "MyFlow" description = "Test Flow" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_intent_default_negative_intent.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_intent_default_negative_intent.tf.tmpl index 3d945d8b08c3..8cbc3e985e74 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_intent_default_negative_intent.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_intent_default_negative_intent.tf.tmpl @@ -1,12 +1,12 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" time_zone = "America/New_York" } -resource "google_dialogflow_cx_intent" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_intent" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id is_default_negative_intent = true display_name = "Default Negative Intent" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_intent_default_welcome_intent.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_intent_default_welcome_intent.tf.tmpl index 0772b2bdde78..d66b92f43d78 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_intent_default_welcome_intent.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_intent_default_welcome_intent.tf.tmpl @@ -1,12 +1,12 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" time_zone = "America/New_York" } -resource "google_dialogflow_cx_intent" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_intent" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id is_default_welcome_intent = true display_name = "Default Welcome Intent" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_intent_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_intent_full.tf.tmpl index af722ff6eeea..880839d95f27 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_intent_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_intent_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr","de","es"] @@ -14,7 +14,7 @@ resource "google_dialogflow_cx_agent" "agent" { } -resource "google_dialogflow_cx_intent" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_intent" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id display_name = "Example" priority = 1 diff --git a/mmv1/templates/terraform/examples/dialogflowcx_page_basic.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_page_basic.tf.tmpl index 7e4bb6f07778..6fd0938b292e 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_page_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_page_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr", "de", "es"] @@ -14,7 +14,7 @@ resource "google_dialogflow_cx_agent" "agent" { } -resource "google_dialogflow_cx_page" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_page" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.start_flow display_name = "MyPage" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_page_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_page_full.tf.tmpl index 59294cec6305..091c066381a8 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_page_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_page_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr", "de", "es"] @@ -14,7 +14,7 @@ resource "google_dialogflow_cx_agent" "agent" { } -resource "google_dialogflow_cx_page" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_page" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.start_flow display_name = "MyPage" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_security_settings_basic.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_security_settings_basic.tf.tmpl index 3110c1643922..d85945866503 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_security_settings_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_security_settings_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dialogflow_cx_security_settings" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["settings_name"] %>" +resource "google_dialogflow_cx_security_settings" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "settings_name"}}" location = "global" purge_data_types = [] retention_window_days = 7 diff --git a/mmv1/templates/terraform/examples/dialogflowcx_security_settings_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_security_settings_full.tf.tmpl index e3533518fb2d..7e2a7b4c1c03 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_security_settings_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_security_settings_full.tf.tmpl @@ -1,6 +1,6 @@ resource "google_data_loss_prevention_inspect_template" "inspect" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/global" - display_name = "<%= ctx[:vars]['inspect_name'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}/locations/global" + display_name = "{{index $.Vars "inspect_name"}}" inspect_config { info_types { name = "EMAIL_ADDRESS" @@ -9,8 +9,8 @@ resource "google_data_loss_prevention_inspect_template" "inspect" { } resource "google_data_loss_prevention_deidentify_template" "deidentify" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/global" - display_name = "<%= ctx[:vars]['deidentify_name'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}/locations/global" + display_name = "{{index $.Vars "deidentify_name"}}" deidentify_config { info_type_transformations { transformations { @@ -27,13 +27,13 @@ resource "google_data_loss_prevention_deidentify_template" "deidentify" { } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]["bucket_name"] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" uniform_bucket_level_access = true } -resource "google_dialogflow_cx_security_settings" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["settings_name"] %>" +resource "google_dialogflow_cx_security_settings" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "settings_name"}}" location = "global" redaction_strategy = "REDACT_WITH_SERVICE" redaction_scope = "REDACT_DISK_STORAGE" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_test_case_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_test_case_full.tf.tmpl index c399764f03f9..ac358d46d14e 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_test_case_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_test_case_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr", "de", "es"] @@ -52,7 +52,7 @@ resource "google_dialogflow_cx_intent" "intent" { } } -resource "google_dialogflow_cx_test_case" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_test_case" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id display_name = "MyTestCase" tags = ["#tag1"] diff --git a/mmv1/templates/terraform/examples/dialogflowcx_version_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_version_full.tf.tmpl index 3a7587558d3b..72e8c974914d 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_version_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_version_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["fr","de","es"] @@ -14,7 +14,7 @@ resource "google_dialogflow_cx_agent" "agent" { } -resource "google_dialogflow_cx_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_version" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.start_flow display_name = "1.0.0" description = "version 1.0.0" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_version_regional.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_version_regional.tf.tmpl index 28d9fa1ded4a..73baff01786f 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_version_regional.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_version_regional.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "us-central1" default_language_code = "en" supported_language_codes = ["fr","de","es"] @@ -12,7 +12,7 @@ resource "google_dialogflow_cx_agent" "agent" { } -resource "google_dialogflow_cx_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_version" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.start_flow display_name = "1.0.0" description = "version 1.0.0" diff --git a/mmv1/templates/terraform/examples/dialogflowcx_webhook_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_webhook_full.tf.tmpl index efc81c37c2b1..dc90b4f0fb7c 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_webhook_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_webhook_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_dialogflow_cx_agent" "agent" { - display_name = "<%= ctx[:vars]["agent_name"] %>" + display_name = "{{index $.Vars "agent_name"}}" location = "global" default_language_code = "en" supported_language_codes = ["it","de","es"] @@ -14,7 +14,7 @@ resource "google_dialogflow_cx_agent" "agent" { } -resource "google_dialogflow_cx_webhook" "<%= ctx[:primary_resource_id] %>" { +resource "google_dialogflow_cx_webhook" "{{$.PrimaryResourceId}}" { parent = google_dialogflow_cx_agent.agent.id display_name = "MyFlow" generic_web_service { diff --git a/mmv1/templates/terraform/examples/discoveryengine_chat_engine_basic.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_chat_engine_basic.tf.tmpl index c8163407135a..0f7e12e2b67d 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_chat_engine_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_chat_engine_basic.tf.tmpl @@ -1,6 +1,6 @@ resource "google_discovery_engine_data_store" "test_data_store" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "Structured datastore" industry_vertical = "GENERIC" content_config = "NO_CONTENT" @@ -9,7 +9,7 @@ resource "google_discovery_engine_data_store" "test_data_store" { resource "google_discovery_engine_data_store" "test_data_store_2" { location = google_discovery_engine_data_store.test_data_store.location - data_store_id = "<%= ctx[:vars]['data_store_2_id'] %>" + data_store_id = "{{index $.Vars "data_store_2_id"}}" display_name = "Structured datastore 2" industry_vertical = "GENERIC" content_config = "NO_CONTENT" @@ -17,7 +17,7 @@ resource "google_discovery_engine_data_store" "test_data_store_2" { } resource "google_discovery_engine_chat_engine" "primary" { - engine_id = "<%= ctx[:vars]['engine_id'] %>" + engine_id = "{{index $.Vars "engine_id"}}" collection_id = "default_collection" location = google_discovery_engine_data_store.test_data_store.location display_name = "Chat engine" diff --git a/mmv1/templates/terraform/examples/discoveryengine_datastore_basic.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_datastore_basic.tf.tmpl index a6c45d479956..532bf189826a 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_datastore_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_datastore_basic.tf.tmpl @@ -1,6 +1,6 @@ resource "google_discovery_engine_data_store" "basic" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "tf-test-structured-datastore" industry_vertical = "GENERIC" content_config = "NO_CONTENT" diff --git a/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config.tf.tmpl index a43c68fa3374..da1475f5cc11 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config.tf.tmpl @@ -1,6 +1,6 @@ resource "google_discovery_engine_data_store" "document_processing_config" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "tf-test-structured-datastore" industry_vertical = "GENERIC" content_config = "NO_CONTENT" diff --git a/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config_layout.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config_layout.tf.tmpl index 47d6a70eebff..3b06dceeaf77 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config_layout.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config_layout.tf.tmpl @@ -1,6 +1,6 @@ resource "google_discovery_engine_data_store" "document_processing_config_layout" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "tf-test-structured-datastore" industry_vertical = "GENERIC" content_config = "CONTENT_REQUIRED" diff --git a/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config_ocr.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config_ocr.tf.tmpl index 82c76e4ec2a8..8f5ef26fecd7 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config_ocr.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_datastore_document_processing_config_ocr.tf.tmpl @@ -1,6 +1,6 @@ resource "google_discovery_engine_data_store" "document_processing_config_ocr" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "tf-test-structured-datastore" industry_vertical = "GENERIC" content_config = "NO_CONTENT" diff --git a/mmv1/templates/terraform/examples/discoveryengine_schema_basic.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_schema_basic.tf.tmpl index 799a7f563304..b50d1a51dd8a 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_schema_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_schema_basic.tf.tmpl @@ -1,13 +1,13 @@ resource "google_discovery_engine_schema" "basic" { location = google_discovery_engine_data_store.basic.location data_store_id = google_discovery_engine_data_store.basic.data_store_id - schema_id = "<%= ctx[:vars]['schema_id'] %>" + schema_id = "{{index $.Vars "schema_id"}}" json_schema = "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"datetime_detection\":true,\"type\":\"object\",\"geolocation_detection\":true}" } resource "google_discovery_engine_data_store" "basic" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "tf-test-structured-datastore" industry_vertical = "GENERIC" content_config = "NO_CONTENT" diff --git a/mmv1/templates/terraform/examples/discoveryengine_searchengine_basic.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_searchengine_basic.tf.tmpl index f6bb41971e17..3d179230c2bb 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_searchengine_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_searchengine_basic.tf.tmpl @@ -1,6 +1,6 @@ resource "google_discovery_engine_data_store" "basic" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "tf-test-structured-datastore" industry_vertical = "GENERIC" content_config = "NO_CONTENT" @@ -8,7 +8,7 @@ resource "google_discovery_engine_data_store" "basic" { create_advanced_site_search = false } resource "google_discovery_engine_search_engine" "basic" { - engine_id = "<%= ctx[:vars]['engine_id'] %>" + engine_id = "{{index $.Vars "engine_id"}}" collection_id = "default_collection" location = google_discovery_engine_data_store.basic.location display_name = "Example Display Name" diff --git a/mmv1/templates/terraform/examples/discoveryengine_targetsite_advanced.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_targetsite_advanced.tf.tmpl index 0488b6fa05ba..990d39321e19 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_targetsite_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_targetsite_advanced.tf.tmpl @@ -8,7 +8,7 @@ resource "google_discovery_engine_target_site" "advanced" { resource "google_discovery_engine_data_store" "advanced" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "tf-test-advanced-site-search-datastore" industry_vertical = "GENERIC" content_config = "PUBLIC_WEBSITE" diff --git a/mmv1/templates/terraform/examples/discoveryengine_targetsite_basic.tf.tmpl b/mmv1/templates/terraform/examples/discoveryengine_targetsite_basic.tf.tmpl index fe934d4b17ce..ae7241ac7c86 100644 --- a/mmv1/templates/terraform/examples/discoveryengine_targetsite_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/discoveryengine_targetsite_basic.tf.tmpl @@ -8,7 +8,7 @@ resource "google_discovery_engine_target_site" "basic" { resource "google_discovery_engine_data_store" "basic" { location = "global" - data_store_id = "<%= ctx[:vars]['data_store_id'] %>" + data_store_id = "{{index $.Vars "data_store_id"}}" display_name = "tf-test-basic-site-search-datastore" industry_vertical = "GENERIC" content_config = "PUBLIC_WEBSITE" diff --git a/mmv1/templates/terraform/examples/disk_async.tf.tmpl b/mmv1/templates/terraform/examples/disk_async.tf.tmpl index 854398726589..1a2e2e6186d7 100644 --- a/mmv1/templates/terraform/examples/disk_async.tf.tmpl +++ b/mmv1/templates/terraform/examples/disk_async.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_disk" "primary" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" type = "pd-ssd" zone = "us-central1-a" @@ -7,7 +7,7 @@ resource "google_compute_disk" "primary" { } resource "google_compute_disk" "secondary" { - name = "<%= ctx[:vars]['secondary_disk_name'] %>" + name = "{{index $.Vars "secondary_disk_name"}}" type = "pd-ssd" zone = "us-east1-c" diff --git a/mmv1/templates/terraform/examples/disk_basic.tf.tmpl b/mmv1/templates/terraform/examples/disk_basic.tf.tmpl index 2003bc3686e6..18cae3e22eed 100644 --- a/mmv1/templates/terraform/examples/disk_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/disk_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_disk" "default" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" type = "pd-ssd" zone = "us-central1-a" image = "debian-11-bullseye-v20220719" diff --git a/mmv1/templates/terraform/examples/disk_features.tf.tmpl b/mmv1/templates/terraform/examples/disk_features.tf.tmpl index f8e9ea762211..57bedf5c4b2c 100644 --- a/mmv1/templates/terraform/examples/disk_features.tf.tmpl +++ b/mmv1/templates/terraform/examples/disk_features.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_disk" "default" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" type = "pd-ssd" zone = "us-central1-a" labels = { diff --git a/mmv1/templates/terraform/examples/disk_resource_policy_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/disk_resource_policy_attachment_basic.tf.tmpl index cb6344eaa15a..51afa60dc05e 100644 --- a/mmv1/templates/terraform/examples/disk_resource_policy_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/disk_resource_policy_attachment_basic.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_compute_disk_resource_policy_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_disk_resource_policy_attachment" "{{$.PrimaryResourceId}}" { name = google_compute_resource_policy.policy.name disk = google_compute_disk.ssd.name zone = "us-central1-a" } resource "google_compute_disk" "ssd" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" image = data.google_compute_image.my_image.self_link size = 50 type = "pd-ssd" @@ -13,7 +13,7 @@ resource "google_compute_disk" "ssd" { } resource "google_compute_resource_policy" "policy" { - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" region = "us-central1" snapshot_schedule_policy { schedule { diff --git a/mmv1/templates/terraform/examples/dlp_deidentify_template_basic.tf.tmpl b/mmv1/templates/terraform/examples/dlp_deidentify_template_basic.tf.tmpl index 817c870a05c8..dfb7b23d8a5c 100644 --- a/mmv1/templates/terraform/examples/dlp_deidentify_template_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_deidentify_template_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_deidentify_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_deidentify_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_deidentify_template_image_transformations.tf.tmpl b/mmv1/templates/terraform/examples/dlp_deidentify_template_image_transformations.tf.tmpl index 6720552dc9f9..d00cc6ae4082 100644 --- a/mmv1/templates/terraform/examples/dlp_deidentify_template_image_transformations.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_deidentify_template_image_transformations.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_deidentify_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_deidentify_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_deidentify_template_skip_characters.tf.tmpl b/mmv1/templates/terraform/examples/dlp_deidentify_template_skip_characters.tf.tmpl index 53b2bdca7462..55f5bd740a89 100644 --- a/mmv1/templates/terraform/examples/dlp_deidentify_template_skip_characters.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_deidentify_template_skip_characters.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_deidentify_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_deidentify_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_deidentify_template_with_template_id.tf.tmpl b/mmv1/templates/terraform/examples/dlp_deidentify_template_with_template_id.tf.tmpl index db69427c18fb..d6a3e291b965 100644 --- a/mmv1/templates/terraform/examples/dlp_deidentify_template_with_template_id.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_deidentify_template_with_template_id.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_data_loss_prevention_deidentify_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" - template_id = "<%= ctx[:vars]['name'] %>" +resource "google_data_loss_prevention_deidentify_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" + template_id = "{{index $.Vars "name"}}" deidentify_config { info_type_transformations { diff --git a/mmv1/templates/terraform/examples/dlp_discovery_config_actions.tf.tmpl b/mmv1/templates/terraform/examples/dlp_discovery_config_actions.tf.tmpl index cabaa008a8a8..6acbb9e34c9e 100644 --- a/mmv1/templates/terraform/examples/dlp_discovery_config_actions.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_discovery_config_actions.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/us" +resource "google_data_loss_prevention_discovery_config" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}/locations/us" location = "us" status = "RUNNING" @@ -21,7 +21,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } actions { pub_sub_notification { - topic = "projects/%{project}/topics/${google_pubsub_topic.<%= ctx[:primary_resource_id] %>.name}" + topic = "projects/%{project}/topics/${google_pubsub_topic.{{$.PrimaryResourceId}}.name}" event = "NEW_PROFILE" pubsub_condition { expressions { @@ -59,12 +59,12 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour inspect_templates = ["projects/%{project}/inspectTemplates/${google_data_loss_prevention_inspect_template.basic.name}"] } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { name = "fake-topic" } resource "google_data_loss_prevention_inspect_template" "basic" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_discovery_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/dlp_discovery_config_basic.tf.tmpl index 05c69c17cc9f..47277761d53d 100644 --- a/mmv1/templates/terraform/examples/dlp_discovery_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_discovery_config_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/us" +resource "google_data_loss_prevention_discovery_config" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}/locations/us" location = "us" status = "RUNNING" @@ -14,7 +14,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } resource "google_data_loss_prevention_inspect_template" "basic" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_discovery_config_cloud_sql.tf.tmpl b/mmv1/templates/terraform/examples/dlp_discovery_config_cloud_sql.tf.tmpl index 03b2fa82ec36..4949ecf4eeff 100644 --- a/mmv1/templates/terraform/examples/dlp_discovery_config_cloud_sql.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_discovery_config_cloud_sql.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/us" +resource "google_data_loss_prevention_discovery_config" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}/locations/us" location = "us" status = "RUNNING" @@ -66,7 +66,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } resource "google_data_loss_prevention_inspect_template" "basic" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_discovery_config_cloud_storage.tf.tmpl b/mmv1/templates/terraform/examples/dlp_discovery_config_cloud_storage.tf.tmpl index 9e54067a1070..d0bd7a86a81e 100644 --- a/mmv1/templates/terraform/examples/dlp_discovery_config_cloud_storage.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_discovery_config_cloud_storage.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/us" +resource "google_data_loss_prevention_discovery_config" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}/locations/us" location = "us" status = "RUNNING" @@ -69,7 +69,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } resource "google_data_loss_prevention_inspect_template" "basic" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_discovery_config_conditions_cadence.tf.tmpl b/mmv1/templates/terraform/examples/dlp_discovery_config_conditions_cadence.tf.tmpl index 012a21d968e3..c6d692443ec8 100644 --- a/mmv1/templates/terraform/examples/dlp_discovery_config_conditions_cadence.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_discovery_config_conditions_cadence.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/us" +resource "google_data_loss_prevention_discovery_config" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}/locations/us" location = "us" status = "RUNNING" @@ -30,7 +30,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } resource "google_data_loss_prevention_inspect_template" "basic" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_discovery_config_filter_regexes_and_conditions.tf.tmpl b/mmv1/templates/terraform/examples/dlp_discovery_config_filter_regexes_and_conditions.tf.tmpl index deaaba2970ca..32e26ca5b101 100644 --- a/mmv1/templates/terraform/examples/dlp_discovery_config_filter_regexes_and_conditions.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_discovery_config_filter_regexes_and_conditions.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/us" +resource "google_data_loss_prevention_discovery_config" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}/locations/us" location = "us" status = "RUNNING" @@ -39,7 +39,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } resource "google_data_loss_prevention_inspect_template" "basic" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_discovery_config_org_folder_paused.tf.tmpl b/mmv1/templates/terraform/examples/dlp_discovery_config_org_folder_paused.tf.tmpl index 20b0755bdc84..b6764b8e1ee8 100644 --- a/mmv1/templates/terraform/examples/dlp_discovery_config_org_folder_paused.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_discovery_config_org_folder_paused.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resource_id] %>" { - parent = "organizations/<%= ctx[:test_env_vars]['organization'] %>/locations/us" +resource "google_data_loss_prevention_discovery_config" "{{$.PrimaryResourceId}}" { + parent = "organizations/{{index $.TestEnvVars "organization"}}/locations/us" location = "us" targets { @@ -10,7 +10,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } } org_config { - project_id = "<%= ctx[:test_env_vars]['project'] %>" + project_id = "{{index $.TestEnvVars "project"}}" location { folder_id = 123 } @@ -20,7 +20,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } resource "google_data_loss_prevention_inspect_template" "basic" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_discovery_config_org_running.tf.tmpl b/mmv1/templates/terraform/examples/dlp_discovery_config_org_running.tf.tmpl index a1ca6d2026c4..8094c1d8adaa 100644 --- a/mmv1/templates/terraform/examples/dlp_discovery_config_org_running.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_discovery_config_org_running.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resource_id] %>" { - parent = "organizations/<%= ctx[:test_env_vars]['organization'] %>/locations/us" +resource "google_data_loss_prevention_discovery_config" "{{$.PrimaryResourceId}}" { + parent = "organizations/{{index $.TestEnvVars "organization"}}/locations/us" location = "us" targets { @@ -10,9 +10,9 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } } org_config { - project_id = "<%= ctx[:test_env_vars]['project'] %>" + project_id = "{{index $.TestEnvVars "project"}}" location { - organization_id = "<%= ctx[:test_env_vars]['organization'] %>" + organization_id = "{{index $.TestEnvVars "organization"}}" } } inspect_templates = ["projects/%{project}/inspectTemplates/${google_data_loss_prevention_inspect_template.basic.name}"] @@ -20,7 +20,7 @@ resource "google_data_loss_prevention_discovery_config" "<%= ctx[:primary_resour } resource "google_data_loss_prevention_inspect_template" "basic" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_inspect_template_basic.tf.tmpl b/mmv1/templates/terraform/examples/dlp_inspect_template_basic.tf.tmpl index 1bb5f3f5593f..0b3905f869dc 100644 --- a/mmv1/templates/terraform/examples/dlp_inspect_template_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_inspect_template_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_inspect_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_inspect_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_inspect_template_custom_type.tf.tmpl b/mmv1/templates/terraform/examples/dlp_inspect_template_custom_type.tf.tmpl index 8286a2aac5a3..750806433843 100644 --- a/mmv1/templates/terraform/examples/dlp_inspect_template_custom_type.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_inspect_template_custom_type.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_inspect_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_inspect_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_inspect_template_custom_type_surrogate.tf.tmpl b/mmv1/templates/terraform/examples/dlp_inspect_template_custom_type_surrogate.tf.tmpl index 3a634c51f773..361c4bdf0dca 100644 --- a/mmv1/templates/terraform/examples/dlp_inspect_template_custom_type_surrogate.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_inspect_template_custom_type_surrogate.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_inspect_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_inspect_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "My description" display_name = "display_name" diff --git a/mmv1/templates/terraform/examples/dlp_inspect_template_max_infotype_per_finding_default.tf.tmpl b/mmv1/templates/terraform/examples/dlp_inspect_template_max_infotype_per_finding_default.tf.tmpl index d0b2925ae465..d68929dfa046 100644 --- a/mmv1/templates/terraform/examples/dlp_inspect_template_max_infotype_per_finding_default.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_inspect_template_max_infotype_per_finding_default.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_inspect_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_inspect_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" inspect_config { info_types { diff --git a/mmv1/templates/terraform/examples/dlp_inspect_template_with_template_id.tf.tmpl b/mmv1/templates/terraform/examples/dlp_inspect_template_with_template_id.tf.tmpl index 1aa226b7120c..903f89cc75b1 100644 --- a/mmv1/templates/terraform/examples/dlp_inspect_template_with_template_id.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_inspect_template_with_template_id.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_data_loss_prevention_inspect_template" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" - template_id = "<%= ctx[:vars]['name'] %>" +resource "google_data_loss_prevention_inspect_template" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" + template_id = "{{index $.Vars "name"}}" inspect_config { info_types { diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_basic.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_basic.tf.tmpl index 4dbc09d2a39c..09d616eee537 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_bigquery_row_limit.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_bigquery_row_limit.tf.tmpl index a63aa351b63b..1099fad714ce 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_bigquery_row_limit.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_bigquery_row_limit.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_bigquery_row_limit_percentage.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_bigquery_row_limit_percentage.tf.tmpl index 8dc594b290f6..5da2f120015a 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_bigquery_row_limit_percentage.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_bigquery_row_limit_percentage.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_cloud_storage_optional_timespan_autopopulation.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_cloud_storage_optional_timespan_autopopulation.tf.tmpl index abdfdf5f3a02..206a5439864d 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_cloud_storage_optional_timespan_autopopulation.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_cloud_storage_optional_timespan_autopopulation.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_data_catalog_output.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_data_catalog_output.tf.tmpl index e85feab2458e..f89f34695ea8 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_data_catalog_output.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_data_catalog_output.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_deidentify.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_deidentify.tf.tmpl index 6d20e932e585..71e260269e5a 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_deidentify.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_deidentify.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description for the job_trigger created by terraform" display_name = "TerraformDisplayName" @@ -17,7 +17,7 @@ resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id file_types_to_transform = ["CSV", "TSV"] transformation_details_storage_config { table { - project_id = "<%= ctx[:test_env_vars]['project'] %>" + project_id = "{{index $.TestEnvVars "project"}}" dataset_id = google_bigquery_dataset.default.dataset_id table_id = google_bigquery_table.default.table_id } @@ -40,7 +40,7 @@ resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id } resource "google_bigquery_dataset" "default" { - dataset_id = "<%= ctx[:vars]['name'] %>" + dataset_id = "{{index $.Vars "name"}}" friendly_name = "terraform-test" description = "Description for the dataset created by terraform" location = "US" @@ -53,7 +53,7 @@ resource "google_bigquery_dataset" "default" { resource "google_bigquery_table" "default" { dataset_id = google_bigquery_dataset.default.dataset_id - table_id = "<%= ctx[:vars]['name'] %>" + table_id = "{{index $.Vars "name"}}" deletion_protection = false time_partitioning { diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_hybrid.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_hybrid.tf.tmpl index 57eb5c333aa9..d601b3a94f67 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_hybrid.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_hybrid.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" triggers { manual {} diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_inspect.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_inspect.tf.tmpl index 2fb6637ed260..244ffd3d8d81 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_inspect.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_inspect.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_job_notification_emails.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_job_notification_emails.tf.tmpl index 77fe02e1fbc7..ab361301ec6e 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_job_notification_emails.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_job_notification_emails.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description for the job_trigger created by terraform" display_name = "TerraformDisplayName" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_multiple_actions.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_multiple_actions.tf.tmpl index 0cf35eea49e1..d54c82bc4be5 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_multiple_actions.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_multiple_actions.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_publish_to_stackdriver.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_publish_to_stackdriver.tf.tmpl index 8beeeb051d8b..87ebd68db503 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_publish_to_stackdriver.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_publish_to_stackdriver.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description for the job_trigger created by terraform" display_name = "TerraformDisplayName" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_scc_output.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_scc_output.tf.tmpl index 5adb27163b7e..d4dd2ec23031 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_scc_output.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_scc_output.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_timespan_config_big_query.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_timespan_config_big_query.tf.tmpl index 2c708f41813b..b9e522cd2d52 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_timespan_config_big_query.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_timespan_config_big_query.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "BigQuery DLP Job Trigger with timespan config and row limit" display_name = "bigquery-dlp-job-trigger-limit-timespan" diff --git a/mmv1/templates/terraform/examples/dlp_job_trigger_with_id.tf.tmpl b/mmv1/templates/terraform/examples/dlp_job_trigger_with_id.tf.tmpl index a63f4bcdcc85..8df57256b5cf 100644 --- a/mmv1/templates/terraform/examples/dlp_job_trigger_with_id.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_job_trigger_with_id.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Starting description" display_name = "display" - trigger_id = "<%= ctx[:vars]['name'] %>" + trigger_id = "{{index $.Vars "name"}}" triggers { schedule { diff --git a/mmv1/templates/terraform/examples/dlp_stored_info_type_basic.tf.tmpl b/mmv1/templates/terraform/examples/dlp_stored_info_type_basic.tf.tmpl index 063ae6358c8a..ccaf03377fe1 100644 --- a/mmv1/templates/terraform/examples/dlp_stored_info_type_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_stored_info_type_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_stored_info_type" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_stored_info_type" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_stored_info_type_dictionary.tf.tmpl b/mmv1/templates/terraform/examples/dlp_stored_info_type_dictionary.tf.tmpl index 1e2de7c6e999..ad2801bcc9d1 100644 --- a/mmv1/templates/terraform/examples/dlp_stored_info_type_dictionary.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_stored_info_type_dictionary.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_stored_info_type" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_stored_info_type" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" diff --git a/mmv1/templates/terraform/examples/dlp_stored_info_type_large_custom_dictionary.tf.tmpl b/mmv1/templates/terraform/examples/dlp_stored_info_type_large_custom_dictionary.tf.tmpl index 10ecb5b6a143..ac7d4ff2e22a 100644 --- a/mmv1/templates/terraform/examples/dlp_stored_info_type_large_custom_dictionary.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_stored_info_type_large_custom_dictionary.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_data_loss_prevention_stored_info_type" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_stored_info_type" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" @@ -14,13 +14,13 @@ resource "google_data_loss_prevention_stored_info_type" "<%= ctx[:primary_resour } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" force_destroy = true } resource "google_storage_bucket_object" "object" { - name = "<%= ctx[:vars]['object_name'] %>" + name = "{{index $.Vars "object_name"}}" bucket = google_storage_bucket.bucket.name source = "./test-fixtures/words.txt" } diff --git a/mmv1/templates/terraform/examples/dlp_stored_info_type_with_id.tf.tmpl b/mmv1/templates/terraform/examples/dlp_stored_info_type_with_id.tf.tmpl index 799db328d3db..38681e1f70b2 100644 --- a/mmv1/templates/terraform/examples/dlp_stored_info_type_with_id.tf.tmpl +++ b/mmv1/templates/terraform/examples/dlp_stored_info_type_with_id.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_data_loss_prevention_stored_info_type" "<%= ctx[:primary_resource_id] %>" { - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_data_loss_prevention_stored_info_type" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project"}}" description = "Description" display_name = "Displayname" - stored_info_type_id = "<%= ctx[:vars]['name'] %>" + stored_info_type_id = "{{index $.Vars "name"}}" regex { pattern = "patient" diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_basic.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_basic.tf.tmpl index db5721b24113..59fd73af0a75 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { name = "example-zone" dns_name = "example-${random_id.rnd.hex}.com." description = "Example DNS zone" diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_cloud_logging.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_cloud_logging.tf.tmpl index 15826d5cfe1e..abdde5de1116 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_cloud_logging.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_cloud_logging.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['zone_name'] %>" +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "zone_name"}}" dns_name = "services.example.com." description = "Example cloud logging enabled DNS zone" labels = { diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_private.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_private.tf.tmpl index 2b6ca85e12ab..2f48709d0e95 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_private.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_private.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['zone_name'] %>" +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "zone_name"}}" dns_name = "private.example.com." description = "Example private DNS zone" labels = { @@ -19,11 +19,11 @@ resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network-1" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" auto_create_subnetworks = false } resource "google_compute_network" "network-2" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_private_forwarding.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_private_forwarding.tf.tmpl index e5f49dd70e80..0194bfb8f74f 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_private_forwarding.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_private_forwarding.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['zone_name'] %>" +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "zone_name"}}" dns_name = "private.example.com." description = "Example private DNS zone" labels = { @@ -28,11 +28,11 @@ resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network-1" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" auto_create_subnetworks = false } resource "google_compute_network" "network-2" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_private_gke.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_private_gke.tf.tmpl index 064b99b32724..6a4a3cc8d941 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_private_gke.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_private_gke.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['zone_name'] %>" +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "zone_name"}}" dns_name = "private.example.com." description = "Example private DNS zone" labels = { @@ -16,7 +16,7 @@ resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network-1" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" auto_create_subnetworks = false } @@ -39,7 +39,7 @@ resource "google_compute_subnetwork" "subnetwork-1" { } resource "google_container_cluster" "cluster-1" { - name = "<%= ctx[:vars]['cluster_1_name'] %>" + name = "{{index $.Vars "cluster_1_name"}}" location = "us-central1-c" initial_node_count = 1 @@ -64,5 +64,5 @@ resource "google_container_cluster" "cluster-1" { cluster_secondary_range_name = google_compute_subnetwork.subnetwork-1.secondary_ip_range[0].range_name services_secondary_range_name = google_compute_subnetwork.subnetwork-1.secondary_ip_range[1].range_name } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_private_multiproject.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_private_multiproject.tf.tmpl index 49c51a8c3508..692a8ef0864e 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_private_multiproject.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_private_multiproject.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['zone_name'] %>" +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "zone_name"}}" dns_name = "multiproject.private.example.com." description = "Example private DNS zone" labels = { @@ -32,23 +32,23 @@ resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { } resource "google_project" "project_1" { - name = "<%= ctx[:vars]['project_1_name'] %>" - project_id = "<%= ctx[:vars]['project_1_name'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + name = "{{index $.Vars "project_1_name"}}" + project_id = "{{index $.Vars "project_1_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } resource "google_project" "project_2" { - name = "<%= ctx[:vars]['project_2_name'] %>" - project_id = "<%= ctx[:vars]['project_2_name'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + name = "{{index $.Vars "project_2_name"}}" + project_id = "{{index $.Vars "project_2_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } resource "google_compute_network" "network_1_project_1" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" project = google_project.project_1.project_id auto_create_subnetworks = false depends_on = [ @@ -58,7 +58,7 @@ resource "google_compute_network" "network_1_project_1" { } resource "google_compute_network" "network_2_project_1" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" project = google_project.project_1.project_id auto_create_subnetworks = false depends_on = [ @@ -68,7 +68,7 @@ resource "google_compute_network" "network_2_project_1" { } resource "google_compute_network" "network_1_project_2" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" project = google_project.project_2.project_id auto_create_subnetworks = false depends_on = [ @@ -78,7 +78,7 @@ resource "google_compute_network" "network_1_project_2" { } resource "google_compute_network" "network_2_project_2" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" project = google_project.project_2.project_id auto_create_subnetworks = false depends_on = [ diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_private_peering.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_private_peering.tf.tmpl index 0914f25979d3..891a4512eadd 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_private_peering.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_private_peering.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['zone_name'] %>" +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "zone_name"}}" dns_name = "peering.example.com." description = "Example private DNS peering zone" @@ -19,11 +19,11 @@ resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network-source" { - name = "<%= ctx[:vars]['network_source_name'] %>" + name = "{{index $.Vars "network_source_name"}}" auto_create_subnetworks = false } resource "google_compute_network" "network-target" { - name = "<%= ctx[:vars]['network_target_name'] %>" + name = "{{index $.Vars "network_target_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_quickstart.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_quickstart.tf.tmpl index 850897284e7c..580fe7096c3b 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_quickstart.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_quickstart.tf.tmpl @@ -1,6 +1,6 @@ # to setup a web-server resource "google_compute_instance" "default" { - name = "<%= ctx[:vars]['dns_compute_instance'] %>" + name = "{{index $.Vars "dns_compute_instance"}}" machine_type = "g1-small" zone = "us-central1-b" @@ -25,7 +25,7 @@ resource "google_compute_instance" "default" { # to allow http traffic resource "google_compute_firewall" "default" { - name = "<%= ctx[:vars]['allow_http_traffic'] %>" + name = "{{index $.Vars "allow_http_traffic"}}" network = "default" allow { ports = ["80"] @@ -35,9 +35,9 @@ resource "google_compute_firewall" "default" { } # to create a DNS zone -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['example_zone_googlecloudexample'] %>" - dns_name = "<%= ctx[:vars]['dns_name'] %>" +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "example_zone_googlecloudexample"}}" + dns_name = "{{index $.Vars "dns_name"}}" description = "Example DNS zone" force_destroy = "true" } diff --git a/mmv1/templates/terraform/examples/dns_managed_zone_service_directory.tf.tmpl b/mmv1/templates/terraform/examples/dns_managed_zone_service_directory.tf.tmpl index 011eb2d5d540..916242554cd1 100644 --- a/mmv1/templates/terraform/examples/dns_managed_zone_service_directory.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_managed_zone_service_directory.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['zone_name'] %>" + name = "{{index $.Vars "zone_name"}}" dns_name = "services.example.com." description = "Example private DNS Service Directory zone" @@ -24,6 +24,6 @@ resource "google_service_directory_namespace" "example" { resource "google_compute_network" "network" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/dns_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/dns_policy_basic.tf.tmpl index 9de748173253..86ceb05b04d9 100644 --- a/mmv1/templates/terraform/examples/dns_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dns_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['policy_name'] %>" +resource "google_dns_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "policy_name"}}" enable_inbound_forwarding = true enable_logging = true @@ -23,11 +23,11 @@ resource "google_dns_policy" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network-1" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" auto_create_subnetworks = false } resource "google_compute_network" "network-2" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/dns_policy_multiproject.tf.tmpl b/mmv1/templates/terraform/examples/dns_policy_multiproject.tf.tmpl index 84e171274afe..74be0624fdc8 100644 --- a/mmv1/templates/terraform/examples/dns_policy_multiproject.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_policy_multiproject.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dns_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['policy_name'] %>" +resource "google_dns_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "policy_name"}}" enable_inbound_forwarding = true enable_logging = true @@ -26,23 +26,23 @@ resource "google_dns_policy" "<%= ctx[:primary_resource_id] %>" { } resource "google_project" "project_1" { - name = "<%= ctx[:vars]['project_1_name'] %>" - project_id = "<%= ctx[:vars]['project_1_name'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + name = "{{index $.Vars "project_1_name"}}" + project_id = "{{index $.Vars "project_1_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } resource "google_project" "project_2" { - name = "<%= ctx[:vars]['project_2_name'] %>" - project_id = "<%= ctx[:vars]['project_2_name'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + name = "{{index $.Vars "project_2_name"}}" + project_id = "{{index $.Vars "project_2_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } resource "google_compute_network" "network_1_project_1" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" project = google_project.project_1.project_id auto_create_subnetworks = false depends_on = [ @@ -52,7 +52,7 @@ resource "google_compute_network" "network_1_project_1" { } resource "google_compute_network" "network_2_project_1" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" project = google_project.project_1.project_id auto_create_subnetworks = false depends_on = [ @@ -62,7 +62,7 @@ resource "google_compute_network" "network_2_project_1" { } resource "google_compute_network" "network_1_project_2" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" project = google_project.project_2.project_id auto_create_subnetworks = false depends_on = [ @@ -72,7 +72,7 @@ resource "google_compute_network" "network_1_project_2" { } resource "google_compute_network" "network_2_project_2" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" project = google_project.project_2.project_id auto_create_subnetworks = false depends_on = [ diff --git a/mmv1/templates/terraform/examples/dns_record_set_basic.tf.tmpl b/mmv1/templates/terraform/examples/dns_record_set_basic.tf.tmpl index 915f9fd33c58..4ac1dc34847f 100644 --- a/mmv1/templates/terraform/examples/dns_record_set_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_record_set_basic.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sample_zone'] %>" - dns_name = "<%= ctx[:vars]['sample_zone'] %>.hashicorptest.com." +resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sample_zone"}}" + dns_name = "{{index $.Vars "sample_zone"}}.hashicorptest.com." description = "Test Description" } resource "google_dns_record_set" "default" { managed_zone = google_dns_managed_zone.parent-zone.name - name = "test-record.<%= ctx[:vars]['sample_zone'] %>.hashicorptest.com." + name = "test-record.{{index $.Vars "sample_zone"}}.hashicorptest.com." type = "A" rrdatas = ["10.0.0.1", "10.1.0.1"] ttl = 86400 diff --git a/mmv1/templates/terraform/examples/dns_response_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/dns_response_policy_basic.tf.tmpl index e08a71461935..ab8da5ec4b1c 100644 --- a/mmv1/templates/terraform/examples/dns_response_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_response_policy_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_compute_network" "network-1" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" auto_create_subnetworks = false } resource "google_compute_network" "network-2" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" auto_create_subnetworks = false } @@ -27,7 +27,7 @@ resource "google_compute_subnetwork" "subnetwork-1" { } resource "google_container_cluster" "cluster-1" { - name = "<%= ctx[:vars]['cluster_1_name'] %>" + name = "{{index $.Vars "cluster_1_name"}}" location = "us-central1-c" initial_node_count = 1 @@ -52,11 +52,11 @@ resource "google_container_cluster" "cluster-1" { cluster_secondary_range_name = google_compute_subnetwork.subnetwork-1.secondary_ip_range[0].range_name services_secondary_range_name = google_compute_subnetwork.subnetwork-1.secondary_ip_range[1].range_name } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_dns_response_policy" "<%= ctx[:primary_resource_id] %>" { - response_policy_name = "<%= ctx[:vars]['response_policy_name'] %>" +resource "google_dns_response_policy" "{{$.PrimaryResourceId}}" { + response_policy_name = "{{index $.Vars "response_policy_name"}}" networks { network_url = google_compute_network.network-1.id diff --git a/mmv1/templates/terraform/examples/dns_response_policy_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/dns_response_policy_rule_basic.tf.tmpl index 8564efc32e8f..7e8e38c88372 100644 --- a/mmv1/templates/terraform/examples/dns_response_policy_rule_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dns_response_policy_rule_basic.tf.tmpl @@ -1,15 +1,15 @@ resource "google_compute_network" "network-1" { - name = "<%= ctx[:vars]['network_1_name'] %>" + name = "{{index $.Vars "network_1_name"}}" auto_create_subnetworks = false } resource "google_compute_network" "network-2" { - name = "<%= ctx[:vars]['network_2_name'] %>" + name = "{{index $.Vars "network_2_name"}}" auto_create_subnetworks = false } resource "google_dns_response_policy" "response-policy" { - response_policy_name = "<%= ctx[:vars]['response_policy_name'] %>" + response_policy_name = "{{index $.Vars "response_policy_name"}}" networks { network_url = google_compute_network.network-1.id @@ -19,9 +19,9 @@ resource "google_dns_response_policy" "response-policy" { } } -resource "google_dns_response_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_dns_response_policy_rule" "{{$.PrimaryResourceId}}" { response_policy = google_dns_response_policy.response-policy.response_policy_name - rule_name = "<%= ctx[:vars]['response_policy_rule_name'] %>" + rule_name = "{{index $.Vars "response_policy_rule_name"}}" dns_name = "dns.example.com." local_data { diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_datetime.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_datetime.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_datetime.tf.tmpl rename to mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_datetime.tf.tmpl diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_enum.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_enum.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_enum.tf.tmpl rename to mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_enum.tf.tmpl diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_float.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_float.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_float.tf.tmpl rename to mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_float.tf.tmpl diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_integer.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_integer.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_integer.tf.tmpl rename to mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_integer.tf.tmpl diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_map.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_map.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_map.tf.tmpl rename to mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_map.tf.tmpl diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_property.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_property.tf.tmpl rename to mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property.tf.tmpl diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_property_enum.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property_enum.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_property_enum.tf.tmpl rename to mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property_enum.tf.tmpl diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_text.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_text.tf.tmpl index c6bb89e99c5f..afbd543dd173 100644 --- a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_text.tf.tmpl +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_text.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_document_ai_warehouse_document_schema" "<%= ctx[:primary_resource_id] %>" { +resource "google_document_ai_warehouse_document_schema" "{{$.PrimaryResourceId}}" { project_number = data.google_project.project.number display_name = "test-property-text" location = "us" diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_timestamp.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_timestamp.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_timestamp.tf.tmpl rename to mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_timestamp.tf.tmpl diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_location.tf.tmpl b/mmv1/templates/terraform/examples/document_ai_warehouse_location.tf.tmpl index 28ef1e3f8a78..527198bb8f6e 100644 --- a/mmv1/templates/terraform/examples/document_ai_warehouse_location.tf.tmpl +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_location.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_document_ai_warehouse_location" "<%= ctx[:primary_resource_id] %>" { +resource "google_document_ai_warehouse_location" "{{$.PrimaryResourceId}}" { location = "us" project_number = data.google_project.project.number access_control_mode = "ACL_MODE_DOCUMENT_LEVEL_ACCESS_CONTROL_GCI" diff --git a/mmv1/templates/terraform/examples/documentai_default_version.tf.tmpl b/mmv1/templates/terraform/examples/documentai_default_version.tf.tmpl index 5fc7d5a14b1a..46cfbed9dbc9 100644 --- a/mmv1/templates/terraform/examples/documentai_default_version.tf.tmpl +++ b/mmv1/templates/terraform/examples/documentai_default_version.tf.tmpl @@ -1,10 +1,10 @@ resource "google_document_ai_processor" "processor" { location = "us" - display_name = "<%= ctx[:vars]['processor_name'] %>" + display_name = "{{index $.Vars "processor_name"}}" type = "OCR_PROCESSOR" } -resource "google_document_ai_processor_default_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_document_ai_processor_default_version" "{{$.PrimaryResourceId}}" { processor = google_document_ai_processor.processor.id version = "${google_document_ai_processor.processor.id}/processorVersions/stable" diff --git a/mmv1/templates/terraform/examples/documentai_processor.tf.tmpl b/mmv1/templates/terraform/examples/documentai_processor.tf.tmpl index 7dfbec6b7ac2..6fe258399f12 100644 --- a/mmv1/templates/terraform/examples/documentai_processor.tf.tmpl +++ b/mmv1/templates/terraform/examples/documentai_processor.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_document_ai_processor" "<%= ctx[:primary_resource_id] %>" { +resource "google_document_ai_processor" "{{$.PrimaryResourceId}}" { location = "us" - display_name = "<%= ctx[:vars]['processor_name'] %>" + display_name = "{{index $.Vars "processor_name"}}" type = "OCR_PROCESSOR" } diff --git a/mmv1/templates/terraform/examples/documentai_processor_eu.tf.tmpl b/mmv1/templates/terraform/examples/documentai_processor_eu.tf.tmpl index a6ac0e11405d..564b5d77324b 100644 --- a/mmv1/templates/terraform/examples/documentai_processor_eu.tf.tmpl +++ b/mmv1/templates/terraform/examples/documentai_processor_eu.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_document_ai_processor" "<%= ctx[:primary_resource_id] %>" { +resource "google_document_ai_processor" "{{$.PrimaryResourceId}}" { location = "eu" - display_name = "<%= ctx[:vars]['processor_name'] %>" + display_name = "{{index $.Vars "processor_name"}}" type = "OCR_PROCESSOR" } diff --git a/mmv1/templates/terraform/examples/edgecontainer_cluster.tf.tmpl b/mmv1/templates/terraform/examples/edgecontainer_cluster.tf.tmpl index 3c51211b66da..5449c0fc0ea1 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_cluster.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_cluster.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_edgecontainer_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['edgecontainer_cluster_name'] %>" +resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "edgecontainer_cluster_name"}}" location = "us-central1" authorization { diff --git a/mmv1/templates/terraform/examples/edgecontainer_cluster_with_maintenance_window.tf.tmpl b/mmv1/templates/terraform/examples/edgecontainer_cluster_with_maintenance_window.tf.tmpl index db607e881694..9e8097f3b652 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_cluster_with_maintenance_window.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_cluster_with_maintenance_window.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_edgecontainer_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['edgecontainer_cluster_name'] %>" +resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "edgecontainer_cluster_name"}}" location = "us-central1" authorization { diff --git a/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_cluster.tf.tmpl b/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_cluster.tf.tmpl index f37d760e7703..1bfacb8f178d 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_cluster.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_cluster.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_edgecontainer_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['edgecontainer_cluster_name'] %>" +resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "edgecontainer_cluster_name"}}" location = "us-central1" authorization { diff --git a/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_cluster.tmpl b/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_cluster.tmpl index f37d760e7703..1bfacb8f178d 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_cluster.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_cluster.tmpl @@ -1,5 +1,5 @@ -resource "google_edgecontainer_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['edgecontainer_cluster_name'] %>" +resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "edgecontainer_cluster_name"}}" location = "us-central1" authorization { diff --git a/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_node_pool.tf.tmpl b/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_node_pool.tf.tmpl index db40620bcefa..d7eaf014bf00 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_node_pool.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_node_pool.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_edgecontainer_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['edgecontainer_cluster_name'] %>" +resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "edgecontainer_cluster_name"}}" location = "us-central1" authorization { @@ -29,7 +29,7 @@ resource "google_edgecontainer_cluster" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_edgecontainer_node_pool" "<%= ctx[:primary_resource_id] %>" { +resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" { name = "nodepool-1" cluster = google_edgecontainer_cluster.cluster.name location = "us-central1" diff --git a/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_node_pool_internal.tf.tmpl b/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_node_pool_internal.tf.tmpl index fbb0719249ce..84adb34ab582 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_node_pool_internal.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_local_control_plane_node_pool_internal.tf.tmpl @@ -28,7 +28,7 @@ resource "google_edgecontainer_cluster" "cluster" { } } -resource "google_edgecontainer_node_pool" "<%= ctx[:primary_resource_id] %>" { +resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" { name = "nodepool-1" cluster = google_edgecontainer_cluster.cluster.name location = "us-central1" diff --git a/mmv1/templates/terraform/examples/edgecontainer_node_pool.tf.tmpl b/mmv1/templates/terraform/examples/edgecontainer_node_pool.tf.tmpl index fb679a3f03fc..00d47ece7eb4 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_node_pool.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_node_pool.tf.tmpl @@ -18,7 +18,7 @@ resource "google_edgecontainer_cluster" "cluster" { } } -resource "google_edgecontainer_node_pool" "<%= ctx[:primary_resource_id] %>" { +resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" { name = "nodepool-1" cluster = google_edgecontainer_cluster.cluster.name location = "us-central1" diff --git a/mmv1/templates/terraform/examples/edgecontainer_node_pool_with_cmek.tf.tmpl b/mmv1/templates/terraform/examples/edgecontainer_node_pool_with_cmek.tf.tmpl index eb98e1c8caa1..c316af892c0d 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_node_pool_with_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_node_pool_with_cmek.tf.tmpl @@ -34,7 +34,7 @@ resource "google_kms_key_ring" "key_ring" { location = "us-central1" } -resource "google_edgecontainer_node_pool" "<%= ctx[:primary_resource_id] %>" { +resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" { depends_on = [google_kms_crypto_key_iam_member.crypto_key] name = "nodepool-1" diff --git a/mmv1/templates/terraform/examples/edgecontainer_vpn_connection.tf.tmpl b/mmv1/templates/terraform/examples/edgecontainer_vpn_connection.tf.tmpl index 3188a9f009fa..af9a87cb27ea 100644 --- a/mmv1/templates/terraform/examples/edgecontainer_vpn_connection.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgecontainer_vpn_connection.tf.tmpl @@ -26,7 +26,7 @@ resource "google_edgecontainer_node_pool" "node_pool" { node_count = 3 } -resource "google_edgecontainer_vpn_connection" "<%= ctx[:primary_resource_id] %>" { +resource "google_edgecontainer_vpn_connection" "{{$.PrimaryResourceId}}" { depends_on = [google_edgecontainer_node_pool.node_pool] name = "vpn-connection-1" location = "us-central1" diff --git a/mmv1/templates/terraform/examples/edgenetwork_network.tf.tmpl b/mmv1/templates/terraform/examples/edgenetwork_network.tf.tmpl index f8e872cb5c16..a52db0582712 100644 --- a/mmv1/templates/terraform/examples/edgenetwork_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgenetwork_network.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_edgenetwork_network" "<%= ctx[:primary_resource_id] %>" { - network_id = "<%= ctx[:vars]['edgenetwork_network_id'] %>" - location = "<%= ctx[:test_env_vars]['location'] %>" - zone = "<%= ctx[:test_env_vars]['zone'] %>" +resource "google_edgenetwork_network" "{{$.PrimaryResourceId}}" { + network_id = "{{index $.Vars "edgenetwork_network_id"}}" + location = "{{index $.TestEnvVars "location"}}" + zone = "{{index $.TestEnvVars "zone"}}" description = "Example network." mtu = 9000 labels = { diff --git a/mmv1/templates/terraform/examples/edgenetwork_subnet.tf.tmpl b/mmv1/templates/terraform/examples/edgenetwork_subnet.tf.tmpl index 8d84feca775f..3423d6184314 100644 --- a/mmv1/templates/terraform/examples/edgenetwork_subnet.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgenetwork_subnet.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_edgenetwork_subnet" "<%= ctx[:primary_resource_id] %>" { - subnet_id = "<%= ctx[:vars]['edgenetwork_subnet_id'] %>" - location = "<%= ctx[:test_env_vars]['location'] %>" - zone = "<%= ctx[:test_env_vars]['zone'] %>" +resource "google_edgenetwork_subnet" "{{$.PrimaryResourceId}}" { + subnet_id = "{{index $.Vars "edgenetwork_subnet_id"}}" + location = "{{index $.TestEnvVars "location"}}" + zone = "{{index $.TestEnvVars "zone"}}" description = "Example subnet." network = google_edgenetwork_network.example_network.id ipv4_cidr = ["4.4.4.1/24"] @@ -12,9 +12,9 @@ resource "google_edgenetwork_subnet" "<%= ctx[:primary_resource_id] %>" { } resource "google_edgenetwork_network" "example_network" { - network_id = "<%= ctx[:vars]['edgenetwork_network_id'] %>" - location = "<%= ctx[:test_env_vars]['location'] %>" - zone = "<%= ctx[:test_env_vars]['zone'] %>" + network_id = "{{index $.Vars "edgenetwork_network_id"}}" + location = "{{index $.TestEnvVars "location"}}" + zone = "{{index $.TestEnvVars "zone"}}" description = "Example network." mtu = 9000 } diff --git a/mmv1/templates/terraform/examples/edgenetwork_subnet_with_vlan_id.tf.tmpl b/mmv1/templates/terraform/examples/edgenetwork_subnet_with_vlan_id.tf.tmpl index d8a6fc6018f7..9a0df143b232 100644 --- a/mmv1/templates/terraform/examples/edgenetwork_subnet_with_vlan_id.tf.tmpl +++ b/mmv1/templates/terraform/examples/edgenetwork_subnet_with_vlan_id.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_edgenetwork_subnet" "<%= ctx[:primary_resource_id] %>" { - subnet_id = "<%= ctx[:vars]['edgenetwork_subnet_id'] %>" - location = "<%= ctx[:test_env_vars]['location'] %>" - zone = "<%= ctx[:test_env_vars]['zone'] %>" +resource "google_edgenetwork_subnet" "{{$.PrimaryResourceId}}" { + subnet_id = "{{index $.Vars "edgenetwork_subnet_id"}}" + location = "{{index $.TestEnvVars "location"}}" + zone = "{{index $.TestEnvVars "zone"}}" description = "Example subnet with VLAN ID." network = google_edgenetwork_network.example_network.id ipv6_cidr = ["4444:4444:4444:4444::1/64"] @@ -13,9 +13,9 @@ resource "google_edgenetwork_subnet" "<%= ctx[:primary_resource_id] %>" { } resource "google_edgenetwork_network" "example_network" { - network_id = "<%= ctx[:vars]['edgenetwork_network_id'] %>" - location = "<%= ctx[:test_env_vars]['location'] %>" - zone = "<%= ctx[:test_env_vars]['zone'] %>" + network_id = "{{index $.Vars "edgenetwork_network_id"}}" + location = "{{index $.TestEnvVars "location"}}" + zone = "{{index $.TestEnvVars "zone"}}" description = "Example network." mtu = 9000 } diff --git a/mmv1/templates/terraform/examples/endpoints_iam.tf.tmpl b/mmv1/templates/terraform/examples/endpoints_iam.tf.tmpl index 2639254e9591..3ca5ab9d175f 100644 --- a/mmv1/templates/terraform/examples/endpoints_iam.tf.tmpl +++ b/mmv1/templates/terraform/examples/endpoints_iam.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_endpoints_service" "<%= ctx[:primary_resource_id] %>" { - service_name = "<%= ctx[:vars]["name"] %>.endpoints.<%= ctx[:test_env_vars]["project_name"] %>.cloud.goog" - project = "<%= ctx[:test_env_vars]["project_name"] %>" +resource "google_endpoints_service" "{{$.PrimaryResourceId}}" { + service_name = "{{index $.Vars "name"}}.endpoints.{{index $.TestEnvVars "project_name"}}.cloud.goog" + project = "{{index $.TestEnvVars "project_name"}}" grpc_config = <.endpoints.<%= ctx[:test_env_vars]["project_name"] %>.cloud.goog +name: {{index $.Vars "name"}}.endpoints.{{index $.TestEnvVars "project_name"}}.cloud.goog usage: rules: - selector: endpoints.examples.bookstore.Bookstore.ListShelves diff --git a/mmv1/templates/terraform/examples/essential_contact.tf.tmpl b/mmv1/templates/terraform/examples/essential_contact.tf.tmpl index 6a0623a220b1..1247d9b477c7 100644 --- a/mmv1/templates/terraform/examples/essential_contact.tf.tmpl +++ b/mmv1/templates/terraform/examples/essential_contact.tf.tmpl @@ -1,7 +1,7 @@ data "google_project" "project" { } -resource "google_essential_contacts_contact" "<%= ctx[:primary_resource_id] %>" { +resource "google_essential_contacts_contact" "{{$.PrimaryResourceId}}" { parent = data.google_project.project.id email = "foo@bar.com" language_tag = "en-GB" diff --git a/mmv1/templates/terraform/examples/eventarc_basic_tf.tf.tmpl b/mmv1/templates/terraform/examples/eventarc_basic_tf.tf.tmpl index 0fae0c876a59..2aa6cd00729a 100644 --- a/mmv1/templates/terraform/examples/eventarc_basic_tf.tf.tmpl +++ b/mmv1/templates/terraform/examples/eventarc_basic_tf.tf.tmpl @@ -18,9 +18,9 @@ resource "google_project_service" "eventarc" { } # Deploy Cloud Run service -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['cloudrun_hello_tf'] %>" + name = "{{index $.Vars "cloudrun_hello_tf"}}" location = "us-east1" template { @@ -49,9 +49,9 @@ resource "google_cloud_run_service_iam_member" "allUsers" { } # Create a Pub/Sub trigger -resource "google_eventarc_trigger" "<%= ctx[:vars]['trigger_pubsub_tf'] %>" { +resource "google_eventarc_trigger" "{{index $.Vars "trigger_pubsub_tf"}}" { provider = google-beta - name = "<%= ctx[:vars]['trigger_pubsub_tf'] %>" + name = "{{index $.Vars "trigger_pubsub_tf"}}" location = google_cloud_run_service.default.location matching_criteria { attribute = "type" @@ -77,9 +77,9 @@ resource "google_project_iam_member" "project" { } # Create an AuditLog for Cloud Storage trigger -resource "google_eventarc_trigger" "<%= ctx[:vars]['trigger_auditlog_tf'] %>" { +resource "google_eventarc_trigger" "{{index $.Vars "trigger_auditlog_tf"}}" { provider = google-beta - name = "<%= ctx[:vars]['trigger_auditlog_tf'] %>" + name = "{{index $.Vars "trigger_auditlog_tf"}}" location = google_cloud_run_service.default.location project = data.google_project.project.id matching_criteria { diff --git a/mmv1/templates/terraform/examples/eventarc_workflows.tf.tmpl b/mmv1/templates/terraform/examples/eventarc_workflows.tf.tmpl index e85a3434a043..ea7f916116fd 100644 --- a/mmv1/templates/terraform/examples/eventarc_workflows.tf.tmpl +++ b/mmv1/templates/terraform/examples/eventarc_workflows.tf.tmpl @@ -29,7 +29,7 @@ resource "google_project_service" "workflows" { # Create a service account for Eventarc trigger and Workflows resource "google_service_account" "eventarc_workflows_service_account" { provider = google-beta - account_id = "<%= ctx[:vars]['service_account'] %>" + account_id = "{{index $.Vars "service_account"}}" display_name = "Eventarc Workflows Service Account" } @@ -58,7 +58,7 @@ resource "google_project_iam_member" "project_binding_workflows" { # Define and deploy a workflow resource "google_workflows_workflow" "workflows_example" { - name = "<%= ctx[:vars]['pubsub_workflow_tf'] %>" + name = "{{index $.Vars "pubsub_workflow_tf"}}" provider = google-beta region = "us-central1" description = "A sample workflow" @@ -72,8 +72,8 @@ google_service_account.eventarc_workflows_service_account] # Create an Eventarc trigger routing Pub/Sub events to Workflows -resource "google_eventarc_trigger" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['trigger_pubsub_workflow_tf'] %>" +resource "google_eventarc_trigger" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "trigger_pubsub_workflow_tf"}}" provider = google-beta location = "us-central1" matching_criteria { diff --git a/mmv1/templates/terraform/examples/external_cdn_lb_with_backend_bucket.tf.tmpl b/mmv1/templates/terraform/examples/external_cdn_lb_with_backend_bucket.tf.tmpl index 2d9f24a89eef..d0abe1648d10 100644 --- a/mmv1/templates/terraform/examples/external_cdn_lb_with_backend_bucket.tf.tmpl +++ b/mmv1/templates/terraform/examples/external_cdn_lb_with_backend_bucket.tf.tmpl @@ -2,7 +2,7 @@ # Cloud Storage bucket resource "google_storage_bucket" "default" { - name = "<%= ctx[:vars]['my_bucket'] %>" + name = "{{index $.Vars "my_bucket"}}" location = "us-east1" uniform_bucket_level_access = true storage_class = "STANDARD" @@ -24,7 +24,7 @@ resource "google_storage_bucket_iam_member" "default" { } resource "google_storage_bucket_object" "index_page" { - name = "<%= ctx[:vars]['index_page'] %>" + name = "{{index $.Vars "index_page"}}" bucket = google_storage_bucket.default.name content = <<-EOT @@ -34,7 +34,7 @@ resource "google_storage_bucket_object" "index_page" { } resource "google_storage_bucket_object" "error_page" { - name = "<%= ctx[:vars]['404_page'] %>" + name = "{{index $.Vars "404_page"}}" bucket = google_storage_bucket.default.name content = <<-EOT @@ -45,7 +45,7 @@ resource "google_storage_bucket_object" "error_page" { # image object for testing, try to access http:///test.jpg resource "google_storage_bucket_object" "test_image" { - name = "<%= ctx[:vars]['test_object'] %>" + name = "{{index $.Vars "test_object"}}" # Uncomment and add valid path to an object. # source = "/path/to/an/object" # content_type = "image/jpeg" @@ -59,12 +59,12 @@ resource "google_storage_bucket_object" "test_image" { # reserve IP address resource "google_compute_global_address" "default" { - name = "<%= ctx[:vars]['example_ip'] %>" + name = "{{index $.Vars "example_ip"}}" } # forwarding rule resource "google_compute_global_forwarding_rule" "default" { - name = "<%= ctx[:vars]['http_lb_forwarding_rule'] %>" + name = "{{index $.Vars "http_lb_forwarding_rule"}}" ip_protocol = "TCP" load_balancing_scheme = "EXTERNAL" port_range = "80" @@ -74,19 +74,19 @@ resource "google_compute_global_forwarding_rule" "default" { # http proxy resource "google_compute_target_http_proxy" "default" { - name = "<%= ctx[:vars]['http_lb_proxy'] %>" + name = "{{index $.Vars "http_lb_proxy"}}" url_map = google_compute_url_map.default.id } # url map resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['http_lb'] %>" + name = "{{index $.Vars "http_lb"}}" default_service = google_compute_backend_bucket.default.id } # backend bucket with CDN policy with default ttl settings -resource "google_compute_backend_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cat_backend_bucket'] %>" +resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cat_backend_bucket"}}" description = "Contains beautiful images" bucket_name = google_storage_bucket.default.name enable_cdn = true diff --git a/mmv1/templates/terraform/examples/external_http_lb_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/external_http_lb_mig_backend.tf.tmpl index e7fccf9493ca..3e0de516a7e5 100644 --- a/mmv1/templates/terraform/examples/external_http_lb_mig_backend.tf.tmpl +++ b/mmv1/templates/terraform/examples/external_http_lb_mig_backend.tf.tmpl @@ -1,7 +1,7 @@ # External HTTP load balancer with an CDN-enabled managed instance group backend resource "google_compute_instance_template" "default" { - name = "<%= ctx[:vars]['lb_backend_template'] %>" + name = "{{index $.Vars "lb_backend_template"}}" disk { auto_delete = true boot = true @@ -38,7 +38,7 @@ resource "google_compute_instance_template" "default" { } resource "google_compute_instance_group_manager" "default" { - name = "<%= ctx[:vars]['lb_backend_example'] %>" + name = "{{index $.Vars "lb_backend_example"}}" zone = "us-east1-b" named_port { name = "http" @@ -54,7 +54,7 @@ resource "google_compute_instance_group_manager" "default" { resource "google_compute_firewall" "default" { - name = "<%= ctx[:vars]['fw_allow_health_check'] %>" + name = "{{index $.Vars "fw_allow_health_check"}}" direction = "INGRESS" network = "global/networks/default" priority = 1000 @@ -67,12 +67,12 @@ resource "google_compute_firewall" "default" { } resource "google_compute_global_address" "default" { - name = "<%= ctx[:vars]['lb_ipv4_1'] %>" + name = "{{index $.Vars "lb_ipv4_1"}}" ip_version = "IPV4" } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['http_basic_check'] %>" + name = "{{index $.Vars "http_basic_check"}}" check_interval_sec = 5 healthy_threshold = 2 http_health_check { @@ -86,7 +86,7 @@ resource "google_compute_health_check" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['web_backend_service'] %>" + name = "{{index $.Vars "web_backend_service"}}" connection_draining_timeout_sec = 0 health_checks = [google_compute_health_check.default.id] load_balancing_scheme = "EXTERNAL_MANAGED" @@ -101,18 +101,18 @@ resource "google_compute_backend_service" "default" { } } -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['web_map_http'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "web_map_http"}}" default_service = google_compute_backend_service.default.id } resource "google_compute_target_http_proxy" "default" { - name = "<%= ctx[:vars]['http_lb_proxy'] %>" + name = "{{index $.Vars "http_lb_proxy"}}" url_map = google_compute_url_map.default.id } resource "google_compute_global_forwarding_rule" "default" { - name = "<%= ctx[:vars]['http_content_rule'] %>" + name = "{{index $.Vars "http_content_rule"}}" ip_protocol = "TCP" load_balancing_scheme = "EXTERNAL_MANAGED" port_range = "80-80" diff --git a/mmv1/templates/terraform/examples/external_http_lb_mig_backend_custom_header.tf.tmpl b/mmv1/templates/terraform/examples/external_http_lb_mig_backend_custom_header.tf.tmpl index 3cad95b5c4d5..176fbbe36422 100644 --- a/mmv1/templates/terraform/examples/external_http_lb_mig_backend_custom_header.tf.tmpl +++ b/mmv1/templates/terraform/examples/external_http_lb_mig_backend_custom_header.tf.tmpl @@ -3,14 +3,14 @@ # VPC resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['xlb_network_name'] %>" + name = "{{index $.Vars "xlb_network_name"}}" provider = google-beta auto_create_subnetworks = false } # backend subnet resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['backend_subnet_name'] %>" + name = "{{index $.Vars "backend_subnet_name"}}" provider = google-beta ip_cidr_range = "10.0.1.0/24" region = "us-central1" @@ -20,12 +20,12 @@ resource "google_compute_subnetwork" "default" { # reserved IP address resource "google_compute_global_address" "default" { provider = google-beta - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" } # forwarding rule -resource "google_compute_global_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" provider = google-beta ip_protocol = "TCP" load_balancing_scheme = "EXTERNAL" @@ -36,21 +36,21 @@ resource "google_compute_global_forwarding_rule" "<%= ctx[:primary_resource_id] # http proxy resource "google_compute_target_http_proxy" "default" { - name = "<%= ctx[:vars]['target_http_proxy_name'] %>" + name = "{{index $.Vars "target_http_proxy_name"}}" provider = google-beta url_map = google_compute_url_map.default.id } # url map resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" provider = google-beta default_service = google_compute_backend_service.default.id } # backend service with custom request and response headers resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" provider = google-beta protocol = "HTTP" port_name = "my-port" @@ -69,7 +69,7 @@ resource "google_compute_backend_service" "default" { # instance template resource "google_compute_instance_template" "default" { - name = "<%= ctx[:vars]['mig_template_name'] %>" + name = "{{index $.Vars "mig_template_name"}}" provider = google-beta machine_type = "e2-small" tags = ["allow-health-check"] @@ -117,7 +117,7 @@ resource "google_compute_instance_template" "default" { # health check resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['hc_name'] %>" + name = "{{index $.Vars "hc_name"}}" provider = google-beta http_health_check { port_specification = "USE_SERVING_PORT" @@ -126,7 +126,7 @@ resource "google_compute_health_check" "default" { # MIG resource "google_compute_instance_group_manager" "default" { - name = "<%= ctx[:vars]['mig_name'] %>" + name = "{{index $.Vars "mig_name"}}" provider = google-beta zone = "us-central1-c" named_port { @@ -143,7 +143,7 @@ resource "google_compute_instance_group_manager" "default" { # allow access from health check ranges resource "google_compute_firewall" "default" { - name = "<%= ctx[:vars]['fw_allow_hc_name'] %>" + name = "{{index $.Vars "fw_allow_hc_name"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/external_ssl_proxy_lb_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/external_ssl_proxy_lb_mig_backend.tf.tmpl index 7c1c975e8038..57c73c4d558f 100644 --- a/mmv1/templates/terraform/examples/external_ssl_proxy_lb_mig_backend.tf.tmpl +++ b/mmv1/templates/terraform/examples/external_ssl_proxy_lb_mig_backend.tf.tmpl @@ -2,14 +2,14 @@ # VPC resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['ssl_proxy_xlb_network'] %>" + name = "{{index $.Vars "ssl_proxy_xlb_network"}}" provider = google auto_create_subnetworks = false } # backend subnet resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['ssl_proxy_xlb_subnet'] %>" + name = "{{index $.Vars "ssl_proxy_xlb_subnet"}}" provider = google ip_cidr_range = "10.0.1.0/24" region = "us-central1" @@ -18,7 +18,7 @@ resource "google_compute_subnetwork" "default" { # reserved IP address resource "google_compute_global_address" "default" { - name = "<%= ctx[:vars]['ssl_proxy_xlb_ip'] %>" + name = "{{index $.Vars "ssl_proxy_xlb_ip"}}" } @@ -55,13 +55,13 @@ resource "tls_self_signed_cert" "default" { } resource "google_compute_ssl_certificate" "default" { - name = "<%= ctx[:vars]['default_cert'] %>" + name = "{{index $.Vars "default_cert"}}" private_key = tls_private_key.default.private_key_pem certificate = tls_self_signed_cert.default.cert_pem } resource "google_compute_target_ssl_proxy" "default" { - name = "<%= ctx[:vars]['test_proxy'] %>" + name = "{{index $.Vars "test_proxy"}}" backend_service = google_compute_backend_service.default.id ssl_certificates = [google_compute_ssl_certificate.default.id] } @@ -69,8 +69,8 @@ resource "google_compute_target_ssl_proxy" "default" { # forwarding rule -resource "google_compute_global_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['ssl_proxy_xlb_forwarding_rule'] %>" +resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "ssl_proxy_xlb_forwarding_rule"}}" provider = google ip_protocol = "TCP" load_balancing_scheme = "EXTERNAL" @@ -82,7 +82,7 @@ resource "google_compute_global_forwarding_rule" "<%= ctx[:primary_resource_id] # backend service resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['ssl_proxy_xlb_backend_service'] %>" + name = "{{index $.Vars "ssl_proxy_xlb_backend_service"}}" protocol = "SSL" port_name = "tcp" load_balancing_scheme = "EXTERNAL" @@ -97,7 +97,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['ssl_proxy_health_check'] %>" + name = "{{index $.Vars "ssl_proxy_health_check"}}" timeout_sec = 1 check_interval_sec = 1 tcp_health_check { @@ -107,7 +107,7 @@ resource "google_compute_health_check" "default" { # instance template resource "google_compute_instance_template" "default" { - name = "<%= ctx[:vars]['ssl_proxy_xlb_mig_template'] %>" + name = "{{index $.Vars "ssl_proxy_xlb_mig_template"}}" provider = google machine_type = "e2-small" tags = ["allow-health-check"] @@ -156,7 +156,7 @@ resource "google_compute_instance_template" "default" { # MIG resource "google_compute_instance_group_manager" "default" { - name = "<%= ctx[:vars]['ssl_proxy_xlb_mig1'] %>" + name = "{{index $.Vars "ssl_proxy_xlb_mig1"}}" provider = google zone = "us-central1-c" named_port { @@ -173,7 +173,7 @@ resource "google_compute_instance_group_manager" "default" { # allow access from health check ranges resource "google_compute_firewall" "default" { - name = "<%= ctx[:vars]['ssl_proxy_xlb_fw_allow_hc'] %>" + name = "{{index $.Vars "ssl_proxy_xlb_fw_allow_hc"}}" provider = google direction = "INGRESS" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/external_tcp_proxy_lb_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/external_tcp_proxy_lb_mig_backend.tf.tmpl index 519a8e587633..b1da9819a42f 100644 --- a/mmv1/templates/terraform/examples/external_tcp_proxy_lb_mig_backend.tf.tmpl +++ b/mmv1/templates/terraform/examples/external_tcp_proxy_lb_mig_backend.tf.tmpl @@ -2,14 +2,14 @@ # VPC resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['tcp_proxy_xlb_network'] %>" + name = "{{index $.Vars "tcp_proxy_xlb_network"}}" provider = google-beta auto_create_subnetworks = false } # backend subnet resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['tcp_proxy_xlb_subnet'] %>" + name = "{{index $.Vars "tcp_proxy_xlb_subnet"}}" provider = google-beta ip_cidr_range = "10.0.1.0/24" region = "us-central1" @@ -19,12 +19,12 @@ resource "google_compute_subnetwork" "default" { # reserved IP address resource "google_compute_global_address" "default" { provider = google-beta - name = "<%= ctx[:vars]['tcp_proxy_xlb_ip'] %>" + name = "{{index $.Vars "tcp_proxy_xlb_ip"}}" } # forwarding rule -resource "google_compute_global_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['tcp_proxy_xlb_forwarding_rule'] %>" +resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "tcp_proxy_xlb_forwarding_rule"}}" provider = google-beta ip_protocol = "TCP" load_balancing_scheme = "EXTERNAL" @@ -35,14 +35,14 @@ resource "google_compute_global_forwarding_rule" "<%= ctx[:primary_resource_id] resource "google_compute_target_tcp_proxy" "default" { provider = google-beta - name = "<%= ctx[:vars]['test_proxy_health_check'] %>" + name = "{{index $.Vars "test_proxy_health_check"}}" backend_service = google_compute_backend_service.default.id } # backend service resource "google_compute_backend_service" "default" { provider = google-beta - name = "<%= ctx[:vars]['tcp_proxy_xlb_backend_service'] %>" + name = "{{index $.Vars "tcp_proxy_xlb_backend_service"}}" protocol = "TCP" port_name = "tcp" load_balancing_scheme = "EXTERNAL" @@ -58,7 +58,7 @@ resource "google_compute_backend_service" "default" { resource "google_compute_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['tcp_proxy_health_check'] %>" + name = "{{index $.Vars "tcp_proxy_health_check"}}" timeout_sec = 1 check_interval_sec = 1 @@ -69,7 +69,7 @@ resource "google_compute_health_check" "default" { # instance template resource "google_compute_instance_template" "default" { - name = "<%= ctx[:vars]['tcp_proxy_xlb_mig_template'] %>" + name = "{{index $.Vars "tcp_proxy_xlb_mig_template"}}" provider = google-beta machine_type = "e2-small" tags = ["allow-health-check"] @@ -114,7 +114,7 @@ resource "google_compute_instance_template" "default" { # MIG resource "google_compute_instance_group_manager" "default" { - name = "<%= ctx[:vars]['tcp_proxy_xlb_mig1'] %>" + name = "{{index $.Vars "tcp_proxy_xlb_mig1"}}" provider = google-beta zone = "us-central1-c" named_port { @@ -131,7 +131,7 @@ resource "google_compute_instance_group_manager" "default" { # allow access from health check ranges resource "google_compute_firewall" "default" { - name = "<%= ctx[:vars]['tcp_proxy_xlb_fw_allow_hc'] %>" + name = "{{index $.Vars "tcp_proxy_xlb_fw_allow_hc"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/external_vpn_gateway.tf.tmpl b/mmv1/templates/terraform/examples/external_vpn_gateway.tf.tmpl index d81ab0df846c..9eeb7bf49af5 100644 --- a/mmv1/templates/terraform/examples/external_vpn_gateway.tf.tmpl +++ b/mmv1/templates/terraform/examples/external_vpn_gateway.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_ha_vpn_gateway" "ha_gateway" { region = "us-central1" - name = "<%= ctx[:vars]['ha_vpn_gateway_name'] %>" + name = "{{index $.Vars "ha_vpn_gateway_name"}}" network = google_compute_network.network.id } -resource "google_compute_external_vpn_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['external_gateway_name'] %>" +resource "google_compute_external_vpn_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "external_gateway_name"}}" redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT" description = "An externally managed VPN gateway" interface { @@ -15,7 +15,7 @@ resource "google_compute_external_vpn_gateway" "<%= ctx[:primary_resource_id] %> } resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" routing_mode = "GLOBAL" auto_create_subnetworks = false } @@ -35,7 +35,7 @@ resource "google_compute_subnetwork" "network_subnet2" { } resource "google_compute_router" "router1" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" network = google_compute_network.network.name bgp { asn = 64514 diff --git a/mmv1/templates/terraform/examples/filestore_backup_basic.tf.tmpl b/mmv1/templates/terraform/examples/filestore_backup_basic.tf.tmpl index b5ea8291e187..b9f4386b9009 100644 --- a/mmv1/templates/terraform/examples/filestore_backup_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/filestore_backup_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_filestore_instance" "instance" { - name = "<%= ctx[:vars]["instance_name"] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-central1-b" tier = "BASIC_HDD" @@ -15,8 +15,8 @@ resource "google_filestore_instance" "instance" { } } -resource "google_filestore_backup" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["backup_name"] %>" +resource "google_filestore_backup" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backup_name"}}" location = "us-central1" description = "This is a filestore backup for the test instance" source_instance = google_filestore_instance.instance.id diff --git a/mmv1/templates/terraform/examples/filestore_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/filestore_instance_basic.tf.tmpl index d28b45bd9a81..d43e35f1b864 100644 --- a/mmv1/templates/terraform/examples/filestore_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/filestore_instance_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_filestore_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-central1-b" tier = "BASIC_HDD" diff --git a/mmv1/templates/terraform/examples/filestore_instance_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/filestore_instance_enterprise.tf.tmpl index b7090feb3b6c..53c2c01e0382 100644 --- a/mmv1/templates/terraform/examples/filestore_instance_enterprise.tf.tmpl +++ b/mmv1/templates/terraform/examples/filestore_instance_enterprise.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_filestore_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-central1" tier = "ENTERPRISE" diff --git a/mmv1/templates/terraform/examples/filestore_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/filestore_instance_full.tf.tmpl index 077314a42f58..041153dd6713 100644 --- a/mmv1/templates/terraform/examples/filestore_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/filestore_instance_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_filestore_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-central1-b" tier = "BASIC_SSD" diff --git a/mmv1/templates/terraform/examples/filestore_instance_protocol.tf.tmpl b/mmv1/templates/terraform/examples/filestore_instance_protocol.tf.tmpl index c7cb489a814f..d477c41005dc 100644 --- a/mmv1/templates/terraform/examples/filestore_instance_protocol.tf.tmpl +++ b/mmv1/templates/terraform/examples/filestore_instance_protocol.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_filestore_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]["instance_name"] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-central1" tier = "ENTERPRISE" protocol = "NFS_V4_1" diff --git a/mmv1/templates/terraform/examples/filestore_snapshot_basic.tf.tmpl b/mmv1/templates/terraform/examples/filestore_snapshot_basic.tf.tmpl index a3f8b99dd483..3b1b799b6a78 100644 --- a/mmv1/templates/terraform/examples/filestore_snapshot_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/filestore_snapshot_basic.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_filestore_snapshot" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["snapshot_name"] %>" +resource "google_filestore_snapshot" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "snapshot_name"}}" instance = google_filestore_instance.instance.name location = "us-east1" } resource "google_filestore_instance" "instance" { - name = "<%= ctx[:vars]["instance_name"] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-east1" tier = "ENTERPRISE" diff --git a/mmv1/templates/terraform/examples/filestore_snapshot_full.tf.tmpl b/mmv1/templates/terraform/examples/filestore_snapshot_full.tf.tmpl index 6940f1e14836..1aa854cf539f 100644 --- a/mmv1/templates/terraform/examples/filestore_snapshot_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/filestore_snapshot_full.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_filestore_snapshot" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["snapshot_name"] %>" +resource "google_filestore_snapshot" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "snapshot_name"}}" instance = google_filestore_instance.instance.name location = "us-west1" - description = "Snapshot of <%= ctx[:vars]["instance_name"] %>" + description = "Snapshot of {{index $.Vars "instance_name"}}" labels = { my_label = "value" @@ -11,7 +11,7 @@ resource "google_filestore_snapshot" "<%= ctx[:primary_resource_id] %>" { } resource "google_filestore_instance" "instance" { - name = "<%= ctx[:vars]["instance_name"] %>" + name = "{{index $.Vars "instance_name"}}" location = "us-west1" tier = "ENTERPRISE" diff --git a/mmv1/templates/terraform/examples/firebase_android_app_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebase_android_app_basic.tf.tmpl index 8a3acc15feb8..d1d3626e7aab 100644 --- a/mmv1/templates/terraform/examples/firebase_android_app_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_android_app_basic.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_firebase_android_app" "<%= ctx[:primary_resource_id] %>" { +resource "google_firebase_android_app" "{{$.PrimaryResourceId}}" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" - package_name = "<%= ctx[:vars]['package_name'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + display_name = "{{index $.Vars "display_name"}}" + package_name = "{{index $.Vars "package_name"}}" sha1_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21c"] sha256_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"] } diff --git a/mmv1/templates/terraform/examples/firebase_android_app_custom_api_key.tf.tmpl b/mmv1/templates/terraform/examples/firebase_android_app_custom_api_key.tf.tmpl index 8f8ee2eb6df4..094ed4999d37 100644 --- a/mmv1/templates/terraform/examples/firebase_android_app_custom_api_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_android_app_custom_api_key.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_firebase_android_app" "<%= ctx[:primary_resource_id] %>" { +resource "google_firebase_android_app" "{{$.PrimaryResourceId}}" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" - package_name = "<%= ctx[:vars]['package_name'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + display_name = "{{index $.Vars "display_name"}}" + package_name = "{{index $.Vars "package_name"}}" sha1_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21c"] sha256_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"] api_key_id = google_apikeys_key.android.uid @@ -11,14 +11,14 @@ resource "google_firebase_android_app" "<%= ctx[:primary_resource_id] %>" { resource "google_apikeys_key" "android" { provider = google-beta - name = "<%= ctx[:vars]['api_key_name'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" - project = "<%= ctx[:test_env_vars]['project_id'] %>" + name = "{{index $.Vars "api_key_name"}}" + display_name = "{{index $.Vars "display_name"}}" + project = "{{index $.TestEnvVars "project_id"}}" restrictions { android_key_restrictions { allowed_applications { - package_name = "<%= ctx[:vars]['package_name'] %>" + package_name = "{{index $.Vars "package_name"}}" sha1_fingerprint = "2145bdf698b8715039bd0e83f2069bed435ac21c" } } diff --git a/mmv1/templates/terraform/examples/firebase_app_check_app_attest_config_full.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_app_attest_config_full.tf.tmpl index 4ef023c54153..773d266067c7 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_app_attest_config_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_app_attest_config_full.tf.tmpl @@ -1,10 +1,10 @@ resource "google_firebase_apple_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" display_name = "Apple app" - bundle_id = "<%= ctx[:vars]['bundle_id'] %>" - team_id = "<%= ctx[:vars]['team_id'] %>" + bundle_id = "{{index $.Vars "bundle_id"}}" + team_id = "{{index $.Vars "team_id"}}" } # It takes a while for App Check to recognize the new app @@ -17,9 +17,9 @@ resource "time_sleep" "wait_30s" { resource "google_firebase_app_check_app_attest_config" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" app_id = google_firebase_apple_app.default.app_id - token_ttl = "<%= ctx[:vars]['token_ttl'] %>" + token_ttl = "{{index $.Vars "token_ttl"}}" depends_on = [time_sleep.wait_30s] diff --git a/mmv1/templates/terraform/examples/firebase_app_check_app_attest_config_minimal.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_app_attest_config_minimal.tf.tmpl index 4ecb2eb56a87..019cb50010ff 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_app_attest_config_minimal.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_app_attest_config_minimal.tf.tmpl @@ -1,10 +1,10 @@ resource "google_firebase_apple_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" display_name = "Apple app" - bundle_id = "<%= ctx[:vars]['bundle_id'] %>" - team_id = "<%= ctx[:vars]['team_id'] %>" + bundle_id = "{{index $.Vars "bundle_id"}}" + team_id = "{{index $.Vars "team_id"}}" } # It takes a while for App Check to recognize the new app @@ -17,7 +17,7 @@ resource "time_sleep" "wait_30s" { resource "google_firebase_app_check_app_attest_config" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" app_id = google_firebase_apple_app.default.app_id depends_on = [time_sleep.wait_30s] diff --git a/mmv1/templates/terraform/examples/firebase_app_check_debug_token_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_debug_token_basic.tf.tmpl index 4b27b397b226..89836afa0640 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_debug_token_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_debug_token_basic.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_web_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" display_name = "Web App for debug token" } @@ -15,10 +15,10 @@ resource "time_sleep" "wait_30s" { resource "google_firebase_app_check_debug_token" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" app_id = google_firebase_web_app.default.app_id - display_name = "<%= ctx[:vars]['display_name'] %>" - token = "<%= ctx[:vars]['token'] %>" + display_name = "{{index $.Vars "display_name"}}" + token = "{{index $.Vars "token"}}" depends_on = [time_sleep.wait_30s] } diff --git a/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.tmpl index 72b6a96fbafb..5f8832f4e550 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_device_check_config_full.tf.tmpl @@ -1,10 +1,10 @@ resource "google_firebase_apple_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" display_name = "Apple app" - bundle_id = "<%= ctx[:vars]['bundle_id'] %>" - team_id = "<%= ctx[:vars]['team_id'] %>" + bundle_id = "{{index $.Vars "bundle_id"}}" + team_id = "{{index $.Vars "team_id"}}" } # It takes a while for App Check to recognize the new app @@ -17,11 +17,11 @@ resource "time_sleep" "wait_30s" { resource "google_firebase_app_check_device_check_config" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" app_id = google_firebase_apple_app.default.app_id - token_ttl = "<%= ctx[:vars]['token_ttl'] %>" - key_id = "<%= ctx[:vars]['key_id'] %>" - private_key = file("<%= ctx[:vars]['private_key_path'] %>") + token_ttl = "{{index $.Vars "token_ttl"}}" + key_id = "{{index $.Vars "key_id"}}" + private_key = file("{{index $.Vars "private_key_path"}}") depends_on = [time_sleep.wait_30s] diff --git a/mmv1/templates/terraform/examples/firebase_app_check_play_integrity_config_full.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_play_integrity_config_full.tf.tmpl index e915533d4724..db5a93b8a4ec 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_play_integrity_config_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_play_integrity_config_full.tf.tmpl @@ -2,7 +2,7 @@ resource "google_project_service" "play_integrity" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" service = "playintegrity.googleapis.com" # Don't disable the service if the resource block is removed by accident. @@ -12,9 +12,9 @@ resource "google_project_service" "play_integrity" { resource "google_firebase_android_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" display_name = "Play Integrity app" - package_name = "<%= ctx[:vars]['package_name'] %>" + package_name = "{{index $.Vars "package_name"}}" sha1_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21c"] sha256_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"] } @@ -29,9 +29,9 @@ resource "time_sleep" "wait_30s" { resource "google_firebase_app_check_play_integrity_config" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" app_id = google_firebase_android_app.default.app_id - token_ttl = "<%= ctx[:vars]['token_ttl'] %>" + token_ttl = "{{index $.Vars "token_ttl"}}" depends_on = [time_sleep.wait_30s] diff --git a/mmv1/templates/terraform/examples/firebase_app_check_play_integrity_config_minimal.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_play_integrity_config_minimal.tf.tmpl index 88a39df138f4..bbe75253a126 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_play_integrity_config_minimal.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_play_integrity_config_minimal.tf.tmpl @@ -2,7 +2,7 @@ resource "google_project_service" "play_integrity" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" service = "playintegrity.googleapis.com" # Don't disable the service if the resource block is removed by accident. @@ -12,9 +12,9 @@ resource "google_project_service" "play_integrity" { resource "google_firebase_android_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" display_name = "Play Integrity app" - package_name = "<%= ctx[:vars]['package_name'] %>" + package_name = "{{index $.Vars "package_name"}}" sha1_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21c"] sha256_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"] } @@ -29,7 +29,7 @@ resource "time_sleep" "wait_30s" { resource "google_firebase_app_check_play_integrity_config" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" app_id = google_firebase_android_app.default.app_id depends_on = [time_sleep.wait_30s] diff --git a/mmv1/templates/terraform/examples/firebase_app_check_recaptcha_enterprise_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_recaptcha_enterprise_config_basic.tf.tmpl index 30b1096a93ad..ee2abef0f7eb 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_recaptcha_enterprise_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_recaptcha_enterprise_config_basic.tf.tmpl @@ -2,7 +2,7 @@ resource "google_project_service" "recaptcha_enterprise" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" service = "recaptchaenterprise.googleapis.com" # Don't disable the service if the resource block is removed by accident. @@ -12,7 +12,7 @@ resource "google_project_service" "recaptcha_enterprise" { resource "google_firebase_web_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" display_name = "Web App for reCAPTCHA Enterprise" } @@ -26,10 +26,10 @@ resource "time_sleep" "wait_30s" { resource "google_firebase_app_check_recaptcha_enterprise_config" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" app_id = google_firebase_web_app.default.app_id - site_key = "<%= ctx[:vars]['site_key'] %>" - token_ttl = "<%= ctx[:vars]['token_ttl'] %>" + site_key = "{{index $.Vars "site_key"}}" + token_ttl = "{{index $.Vars "token_ttl"}}" depends_on = [time_sleep.wait_30s] } diff --git a/mmv1/templates/terraform/examples/firebase_app_check_recaptcha_v3_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_recaptcha_v3_config_basic.tf.tmpl index 18b6a671ea72..4c7826d45d1a 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_recaptcha_v3_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_recaptcha_v3_config_basic.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_web_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" display_name = "Web App for reCAPTCHA V3" } @@ -15,10 +15,10 @@ resource "time_sleep" "wait_30s" { resource "google_firebase_app_check_recaptcha_v3_config" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" app_id = google_firebase_web_app.default.app_id - site_secret = "<%= ctx[:vars]['site_secret'] %>" - token_ttl = "<%= ctx[:vars]['token_ttl'] %>" + site_secret = "{{index $.Vars "site_secret"}}" + token_ttl = "{{index $.Vars "token_ttl"}}" depends_on = [time_sleep.wait_30s] } diff --git a/mmv1/templates/terraform/examples/firebase_app_check_service_config_enforced.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_service_config_enforced.tf.tmpl index 5d6220b49aa0..e29fb3518c28 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_service_config_enforced.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_service_config_enforced.tf.tmpl @@ -1,12 +1,12 @@ resource "google_project_service" "appcheck" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" service = "firebaseappcheck.googleapis.com" disable_on_destroy = false } resource "google_firebase_app_check_service_config" "default" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - service_id = "<%= ctx[:vars]['service_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + service_id = "{{index $.Vars "service_id"}}" enforcement_mode = "ENFORCED" depends_on = [google_project_service.appcheck] diff --git a/mmv1/templates/terraform/examples/firebase_app_check_service_config_off.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_service_config_off.tf.tmpl index ac4cf31312a4..ff000e5a3b42 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_service_config_off.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_service_config_off.tf.tmpl @@ -1,12 +1,12 @@ resource "google_project_service" "appcheck" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" service = "firebaseappcheck.googleapis.com" disable_on_destroy = false } resource "google_firebase_app_check_service_config" "default" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - service_id = "<%= ctx[:vars]['service_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + service_id = "{{index $.Vars "service_id"}}" depends_on = [google_project_service.appcheck] } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/firebase_app_check_service_config_unenforced.tf.tmpl b/mmv1/templates/terraform/examples/firebase_app_check_service_config_unenforced.tf.tmpl index 57585f63646c..11f85955c357 100644 --- a/mmv1/templates/terraform/examples/firebase_app_check_service_config_unenforced.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_app_check_service_config_unenforced.tf.tmpl @@ -1,12 +1,12 @@ resource "google_project_service" "appcheck" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" service = "firebaseappcheck.googleapis.com" disable_on_destroy = false } resource "google_firebase_app_check_service_config" "default" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - service_id = "<%= ctx[:vars]['service_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + service_id = "{{index $.Vars "service_id"}}" enforcement_mode = "UNENFORCED" depends_on = [google_project_service.appcheck] diff --git a/mmv1/templates/terraform/examples/firebase_apple_app_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebase_apple_app_basic.tf.tmpl index 513dd93cd83d..a0fa84aa395d 100644 --- a/mmv1/templates/terraform/examples/firebase_apple_app_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_apple_app_basic.tf.tmpl @@ -1,6 +1,6 @@ resource "google_firebase_apple_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" - bundle_id = "<%= ctx[:vars]['bundle_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + display_name = "{{index $.Vars "display_name"}}" + bundle_id = "{{index $.Vars "bundle_id"}}" } diff --git a/mmv1/templates/terraform/examples/firebase_apple_app_full.tf.tmpl b/mmv1/templates/terraform/examples/firebase_apple_app_full.tf.tmpl index 948e993c1d51..105398c7edb3 100644 --- a/mmv1/templates/terraform/examples/firebase_apple_app_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_apple_app_full.tf.tmpl @@ -1,23 +1,23 @@ resource "google_firebase_apple_app" "full" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" - bundle_id = "<%= ctx[:vars]['bundle_id'] %>" - app_store_id = "<%= ctx[:vars]['app_store_id'] %>" - team_id = "<%= ctx[:vars]['team_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + display_name = "{{index $.Vars "display_name"}}" + bundle_id = "{{index $.Vars "bundle_id"}}" + app_store_id = "{{index $.Vars "app_store_id"}}" + team_id = "{{index $.Vars "team_id"}}" api_key_id = google_apikeys_key.apple.uid } resource "google_apikeys_key" "apple" { provider = google-beta - name = "<%= ctx[:vars]['api_key_name'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" - project = "<%= ctx[:test_env_vars]['project_id'] %>" + name = "{{index $.Vars "api_key_name"}}" + display_name = "{{index $.Vars "display_name"}}" + project = "{{index $.TestEnvVars "project_id"}}" restrictions { ios_key_restrictions { - allowed_bundle_ids = ["<%= ctx[:vars]['bundle_id'] %>"] + allowed_bundle_ids = ["{{index $.Vars "bundle_id"}}"] } } } diff --git a/mmv1/templates/terraform/examples/firebase_database_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebase_database_instance_basic.tf.tmpl index 029091a96d51..f7bf9b1f33f8 100644 --- a/mmv1/templates/terraform/examples/firebase_database_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_database_instance_basic.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_database_instance" "basic" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" region = "us-central1" - instance_id = "<%= ctx[:vars]['instance_id'] %>" + instance_id = "{{index $.Vars "instance_id"}}" } diff --git a/mmv1/templates/terraform/examples/firebase_database_instance_default_database.tf.tmpl b/mmv1/templates/terraform/examples/firebase_database_instance_default_database.tf.tmpl index a8cca389fc66..083fa263b42d 100644 --- a/mmv1/templates/terraform/examples/firebase_database_instance_default_database.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_database_instance_default_database.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "default" { provider = google-beta - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" labels = { "firebase" = "enabled" @@ -24,7 +24,7 @@ resource "google_firebase_database_instance" "default" { provider = google-beta project = google_firebase_project.default.project region = "us-central1" - instance_id = "<%= ctx[:vars]['project_id'] %>-default-rtdb" + instance_id = "{{index $.Vars "project_id"}}-default-rtdb" type = "DEFAULT_DATABASE" depends_on = [google_project_service.firebase_database] } diff --git a/mmv1/templates/terraform/examples/firebase_database_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/firebase_database_instance_full.tf.tmpl index 95051e451e64..d70cd1909dfb 100644 --- a/mmv1/templates/terraform/examples/firebase_database_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_database_instance_full.tf.tmpl @@ -1,8 +1,8 @@ resource "google_firebase_database_instance" "full" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" region = "europe-west1" - instance_id = "<%= ctx[:vars]['instance_id'] %>" + instance_id = "{{index $.Vars "instance_id"}}" type = "USER_DATABASE" desired_state = "DISABLED" } diff --git a/mmv1/templates/terraform/examples/firebase_extentions_instance_resize_image.tf.tmpl b/mmv1/templates/terraform/examples/firebase_extentions_instance_resize_image.tf.tmpl index 5a8501ef7003..4441c916b711 100644 --- a/mmv1/templates/terraform/examples/firebase_extentions_instance_resize_image.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_extentions_instance_resize_image.tf.tmpl @@ -1,7 +1,7 @@ resource "google_storage_bucket" "images" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['bucket_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "bucket_id"}}" location = "US" uniform_bucket_level_access = true @@ -11,8 +11,8 @@ resource "google_storage_bucket" "images" { resource "google_firebase_extensions_instance" "resize_image" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - instance_id = "<%= ctx[:vars]['instance-id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + instance_id = "{{index $.Vars "instance-id"}}" config { extension_ref = "firebase/storage-resize-images" extension_version = "0.2.2" @@ -31,7 +31,7 @@ resource "google_firebase_extensions_instance" "resize_image" { } system_params = { - "firebaseextensions.v1beta.function/location" = "<%= ctx[:vars]['location'] %>" + "firebaseextensions.v1beta.function/location" = "{{index $.Vars "location"}}" "firebaseextensions.v1beta.function/maxInstances" = 3000 "firebaseextensions.v1beta.function/minInstances" = 0 "firebaseextensions.v1beta.function/vpcConnectorEgressSettings" = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" @@ -41,6 +41,6 @@ resource "google_firebase_extensions_instance" "resize_image" { "firebase.extensions.storage-resize-images.v1.onCompletion" ] - eventarc_channel = "projects/<%= ctx[:test_env_vars]['project_id'] %>/locations/<%= ctx[:vars]['location'] %>/channels/firebase" + eventarc_channel = "projects/{{index $.TestEnvVars "project_id"}}/locations/{{index $.Vars "location"}}/channels/firebase" } } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/firebase_project_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebase_project_basic.tf.tmpl index 39840aeaaefa..46a2cb2d62b4 100644 --- a/mmv1/templates/terraform/examples/firebase_project_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_project_basic.tf.tmpl @@ -1,9 +1,9 @@ resource "google_project" "default" { provider = google-beta - project_id = "<%= ctx[:vars]['project_name'] %>" - name = "<%= ctx[:vars]['project_name'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_name"}}" + name = "{{index $.Vars "project_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" labels = { diff --git a/mmv1/templates/terraform/examples/firebase_web_app_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebase_web_app_basic.tf.tmpl index 46d98f831900..6a24a04a9163 100644 --- a/mmv1/templates/terraform/examples/firebase_web_app_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_web_app_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_firebase_web_app" "<%= ctx[:primary_resource_id] %>" { +resource "google_firebase_web_app" "{{$.PrimaryResourceId}}" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + display_name = "{{index $.Vars "display_name"}}" } data "google_firebase_web_app_config" "basic" { @@ -11,7 +11,7 @@ data "google_firebase_web_app_config" "basic" { resource "google_storage_bucket" "default" { provider = google-beta - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/firebase_web_app_custom_api_key.tf.tmpl b/mmv1/templates/terraform/examples/firebase_web_app_custom_api_key.tf.tmpl index 650793914c8f..8f45d47d4eee 100644 --- a/mmv1/templates/terraform/examples/firebase_web_app_custom_api_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebase_web_app_custom_api_key.tf.tmpl @@ -1,16 +1,16 @@ -resource "google_firebase_web_app" "<%= ctx[:primary_resource_id] %>" { +resource "google_firebase_web_app" "{{$.PrimaryResourceId}}" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + display_name = "{{index $.Vars "display_name"}}" api_key_id = google_apikeys_key.web.uid deletion_policy = "DELETE" } resource "google_apikeys_key" "web" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['api_key_name'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "api_key_name"}}" + display_name = "{{index $.Vars "display_name"}}" restrictions { browser_key_restrictions { diff --git a/mmv1/templates/terraform/examples/firebasehosting_channel_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_channel_basic.tf.tmpl index 6c5f20749ac4..00022fb521c5 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_channel_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_channel_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_firebase_hosting_channel" "default" { provider = google-beta site_id = google_firebase_hosting_site.default.site_id - channel_id = "<%= ctx[:vars]['channel_id'] %>" + channel_id = "{{index $.Vars "channel_id"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/firebasehosting_channel_full.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_channel_full.tf.tmpl index 2429ca6eb52e..e26595c8a067 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_channel_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_channel_full.tf.tmpl @@ -1,13 +1,13 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_firebase_hosting_channel" "full" { provider = google-beta site_id = google_firebase_hosting_site.default.site_id - channel_id = "<%= ctx[:vars]['channel_id'] %>" + channel_id = "{{index $.Vars "channel_id"}}" ttl = "86400s" retained_release_count = 20 labels = { diff --git a/mmv1/templates/terraform/examples/firebasehosting_customdomain_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_customdomain_basic.tf.tmpl index 5697e91ab916..94af7ca6a314 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_customdomain_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_customdomain_basic.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_hosting_custom_domain" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" - custom_domain = "<%= ctx[:vars]['custom_domain'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" + custom_domain = "{{index $.Vars "custom_domain"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/firebasehosting_customdomain_cloud_run.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_customdomain_cloud_run.tf.tmpl index df44959e46cf..174f3a0471e5 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_customdomain_cloud_run.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_customdomain_cloud_run.tf.tmpl @@ -1,13 +1,13 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_cloud_run_v2_service" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['cloud_run_service_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "cloud_run_service_id"}}" location = "us-central1" # Warning: allows all public traffic @@ -19,7 +19,7 @@ resource "google_cloud_run_v2_service" "default" { } } - deletion_protection = "<%= ctx[:vars]["deletion_protection"] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_firebase_hosting_version" "default" { @@ -46,9 +46,9 @@ resource "google_firebase_hosting_release" "default" { resource "google_firebase_hosting_custom_domain" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" site_id = google_firebase_hosting_site.default.site_id - custom_domain = "<%= ctx[:vars]['custom_domain'] %>" + custom_domain = "{{index $.Vars "custom_domain"}}" wait_dns_verification = false } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/firebasehosting_customdomain_full.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_customdomain_full.tf.tmpl index a144fdca89b6..962a6217f3c0 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_customdomain_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_customdomain_full.tf.tmpl @@ -1,18 +1,18 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" - site_id = "<%= ctx[:vars]['site_id'] %>" + site_id = "{{index $.Vars "site_id"}}" } resource "google_firebase_hosting_custom_domain" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" site_id = google_firebase_hosting_site.default.site_id - custom_domain = "<%= ctx[:vars]['custom_domain'] %>" + custom_domain = "{{index $.Vars "custom_domain"}}" cert_preference = "GROUPED" - redirect_target = "<%= ctx[:vars]['redirect_target'] %>" + redirect_target = "{{index $.Vars "redirect_target"}}" wait_dns_verification = false } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/firebasehosting_release_disable.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_release_disable.tf.tmpl index d3269d02aba1..bf98908fc948 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_release_disable.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_release_disable.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_firebase_hosting_release" "default" { diff --git a/mmv1/templates/terraform/examples/firebasehosting_release_in_channel.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_release_in_channel.tf.tmpl index 6c48f40e1b2e..06975a7e3e7b 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_release_in_channel.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_release_in_channel.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_firebase_hosting_version" "default" { @@ -19,7 +19,7 @@ resource "google_firebase_hosting_version" "default" { resource "google_firebase_hosting_channel" "default" { provider = google-beta site_id = google_firebase_hosting_site.default.site_id - channel_id = "<%= ctx[:vars]['channel_id'] %>" + channel_id = "{{index $.Vars "channel_id"}}" } resource "google_firebase_hosting_release" "default" { diff --git a/mmv1/templates/terraform/examples/firebasehosting_release_in_site.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_release_in_site.tf.tmpl index 30297ce04a80..f4d8e6c01ad7 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_release_in_site.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_release_in_site.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_firebase_hosting_version" "default" { diff --git a/mmv1/templates/terraform/examples/firebasehosting_site_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_site_basic.tf.tmpl index 46ffb5156e31..fdcc3c3a0faa 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_site_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_site_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } diff --git a/mmv1/templates/terraform/examples/firebasehosting_site_full.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_site_full.tf.tmpl index f436a7264428..29b51e964638 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_site_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_site_full.tf.tmpl @@ -1,12 +1,12 @@ resource "google_firebase_web_app" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + display_name = "{{index $.Vars "display_name"}}" } resource "google_firebase_hosting_site" "full" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" app_id = google_firebase_web_app.default.app_id } diff --git a/mmv1/templates/terraform/examples/firebasehosting_version_cloud_functions.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_version_cloud_functions.tf.tmpl index 9a50b1fb5af9..2bea81e01a6c 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_version_cloud_functions.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_version_cloud_functions.tf.tmpl @@ -1,13 +1,13 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_storage_bucket" "bucket" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['site_id'] %>-function-source" # Every bucket name must be globally unique + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "site_id"}}-function-source" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -16,14 +16,14 @@ resource "google_storage_bucket_object" "object" { provider = google-beta name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } resource "google_cloudfunctions_function" "function" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" - name = "<%= ctx[:vars]['cloud_function_id'] %>" + name = "{{index $.Vars "cloud_function_id"}}" description = "A Cloud Function connected to Firebase Hosing" runtime = "nodejs16" diff --git a/mmv1/templates/terraform/examples/firebasehosting_version_cloud_run.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_version_cloud_run.tf.tmpl index e8c32603ebad..258ac8617c38 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_version_cloud_run.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_version_cloud_run.tf.tmpl @@ -1,13 +1,13 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_cloud_run_v2_service" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['cloud_run_service_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "cloud_run_service_id"}}" location = "us-central1" # Warning: allows all public traffic @@ -19,7 +19,7 @@ resource "google_cloud_run_v2_service" "default" { } } - deletion_protection = "<%= ctx[:vars]["deletion_protection"] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_firebase_hosting_version" "default" { diff --git a/mmv1/templates/terraform/examples/firebasehosting_version_path.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_version_path.tf.tmpl index d4df018f8ea4..7513f5547b22 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_version_path.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_version_path.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_firebase_hosting_version" "default" { diff --git a/mmv1/templates/terraform/examples/firebasehosting_version_redirect.tf.tmpl b/mmv1/templates/terraform/examples/firebasehosting_version_redirect.tf.tmpl index 635b947867ae..b283d330bd33 100644 --- a/mmv1/templates/terraform/examples/firebasehosting_version_redirect.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasehosting_version_redirect.tf.tmpl @@ -1,7 +1,7 @@ resource "google_firebase_hosting_site" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" - site_id = "<%= ctx[:vars]['site_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + site_id = "{{index $.Vars "site_id"}}" } resource "google_firebase_hosting_version" "default" { diff --git a/mmv1/templates/terraform/examples/firebasestorage_bucket_basic.tf.tmpl b/mmv1/templates/terraform/examples/firebasestorage_bucket_basic.tf.tmpl index 6378bc0c051f..211c45f1fe12 100644 --- a/mmv1/templates/terraform/examples/firebasestorage_bucket_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firebasestorage_bucket_basic.tf.tmpl @@ -1,12 +1,12 @@ resource "google_storage_bucket" "default" { provider = google-beta - name = "<%= ctx[:vars]['bucket_id'] %>" + name = "{{index $.Vars "bucket_id"}}" location = "US" uniform_bucket_level_access = true } resource "google_firebase_storage_bucket" "default" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" bucket_id = google_storage_bucket.default.id } diff --git a/mmv1/templates/terraform/examples/firestore_backup_schedule_daily.tf.tmpl b/mmv1/templates/terraform/examples/firestore_backup_schedule_daily.tf.tmpl index 66c4bb95981d..0a1a846c030f 100644 --- a/mmv1/templates/terraform/examples/firestore_backup_schedule_daily.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_backup_schedule_daily.tf.tmpl @@ -1,15 +1,15 @@ resource "google_firestore_database" "database" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" } -resource "google_firestore_backup_schedule" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_backup_schedule" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" database = google_firestore_database.database.name retention = "8467200s" // 14 weeks (maximum possible retention) diff --git a/mmv1/templates/terraform/examples/firestore_backup_schedule_weekly.tf.tmpl b/mmv1/templates/terraform/examples/firestore_backup_schedule_weekly.tf.tmpl index 3c7eaad7e96b..ecf11345d7d3 100644 --- a/mmv1/templates/terraform/examples/firestore_backup_schedule_weekly.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_backup_schedule_weekly.tf.tmpl @@ -1,15 +1,15 @@ resource "google_firestore_database" "database" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" } -resource "google_firestore_backup_schedule" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_backup_schedule" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" database = google_firestore_database.database.name retention = "8467200s" // 14 weeks (maximum possible retention) diff --git a/mmv1/templates/terraform/examples/firestore_cmek_database.tf.tmpl b/mmv1/templates/terraform/examples/firestore_cmek_database.tf.tmpl index 151ab3a5689c..f4a36dd2ef85 100644 --- a/mmv1/templates/terraform/examples/firestore_cmek_database.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_cmek_database.tf.tmpl @@ -1,15 +1,15 @@ data "google_project" "project" { } -resource "google_firestore_database" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id']%>" +resource "google_firestore_database" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" concurrency_mode = "OPTIMISTIC" app_engine_integration_mode = "DISABLED" point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_ENABLED" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" cmek_config { kms_key_name = google_kms_crypto_key.crypto_key.id @@ -21,13 +21,13 @@ resource "google_firestore_database" "<%= ctx[:primary_resource_id] %>" { } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['kms_key_name'] %>" + name = "{{index $.Vars "kms_key_name"}}" key_ring = google_kms_key_ring.key_ring.id purpose = "ENCRYPT_DECRYPT" } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['kms_key_ring_name'] %>" + name = "{{index $.Vars "kms_key_ring_name"}}" location = "us" } diff --git a/mmv1/templates/terraform/examples/firestore_cmek_database_in_datastore_mode.tf.tmpl b/mmv1/templates/terraform/examples/firestore_cmek_database_in_datastore_mode.tf.tmpl index e045faf0bfae..ead83deaa4e4 100644 --- a/mmv1/templates/terraform/examples/firestore_cmek_database_in_datastore_mode.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_cmek_database_in_datastore_mode.tf.tmpl @@ -1,15 +1,15 @@ data "google_project" "project" { } -resource "google_firestore_database" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id']%>" +resource "google_firestore_database" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "DATASTORE_MODE" concurrency_mode = "OPTIMISTIC" app_engine_integration_mode = "DISABLED" point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_ENABLED" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" cmek_config { kms_key_name = google_kms_crypto_key.crypto_key.id @@ -21,13 +21,13 @@ resource "google_firestore_database" "<%= ctx[:primary_resource_id] %>" { } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['kms_key_name'] %>" + name = "{{index $.Vars "kms_key_name"}}" key_ring = google_kms_key_ring.key_ring.id purpose = "ENCRYPT_DECRYPT" } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['kms_key_ring_name'] %>" + name = "{{index $.Vars "kms_key_ring_name"}}" location = "us" } diff --git a/mmv1/templates/terraform/examples/firestore_database.tf.tmpl b/mmv1/templates/terraform/examples/firestore_database.tf.tmpl index fdb481a6a9ea..51ca0a344014 100644 --- a/mmv1/templates/terraform/examples/firestore_database.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_database.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_firestore_database" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id']%>" +resource "google_firestore_database" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" concurrency_mode = "OPTIMISTIC" app_engine_integration_mode = "DISABLED" point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_ENABLED" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/firestore_database_in_datastore_mode.tf.tmpl b/mmv1/templates/terraform/examples/firestore_database_in_datastore_mode.tf.tmpl index 55c0ab5285ac..825eb185c321 100644 --- a/mmv1/templates/terraform/examples/firestore_database_in_datastore_mode.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_database_in_datastore_mode.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_firestore_database" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id']%>" +resource "google_firestore_database" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "DATASTORE_MODE" concurrency_mode = "OPTIMISTIC" app_engine_integration_mode = "DISABLED" point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_ENABLED" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/firestore_default_database.tf.tmpl b/mmv1/templates/terraform/examples/firestore_default_database.tf.tmpl index 30e638bc6ad6..6b28ded4b153 100644 --- a/mmv1/templates/terraform/examples/firestore_default_database.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_default_database.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_firestore_database" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_database" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" name = "(default)" location_id = "nam5" type = "FIRESTORE_NATIVE" diff --git a/mmv1/templates/terraform/examples/firestore_default_database_in_datastore_mode.tf.tmpl b/mmv1/templates/terraform/examples/firestore_default_database_in_datastore_mode.tf.tmpl index 88919b9bea49..5bdf0d6ad119 100644 --- a/mmv1/templates/terraform/examples/firestore_default_database_in_datastore_mode.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_default_database_in_datastore_mode.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_firestore_database" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_database" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" name = "(default)" location_id = "nam5" type = "DATASTORE_MODE" diff --git a/mmv1/templates/terraform/examples/firestore_document_basic.tf.tmpl b/mmv1/templates/terraform/examples/firestore_document_basic.tf.tmpl index 9302846d5497..34f54c069258 100644 --- a/mmv1/templates/terraform/examples/firestore_document_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_document_basic.tf.tmpl @@ -1,7 +1,7 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } @@ -28,10 +28,10 @@ resource "google_firestore_database" "database" { depends_on = [google_project_service.firestore] } -resource "google_firestore_document" "<%= ctx[:primary_resource_id] %>" { +resource "google_firestore_document" "{{$.PrimaryResourceId}}" { project = google_project.project.project_id database = google_firestore_database.database.name collection = "somenewcollection" - document_id = "<%= ctx[:vars]['document_id'] %>" + document_id = "{{index $.Vars "document_id"}}" fields = "{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}" } diff --git a/mmv1/templates/terraform/examples/firestore_document_nested_document.tf.tmpl b/mmv1/templates/terraform/examples/firestore_document_nested_document.tf.tmpl index 9167ffcfa688..c49b4e96b329 100644 --- a/mmv1/templates/terraform/examples/firestore_document_nested_document.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_document_nested_document.tf.tmpl @@ -1,7 +1,7 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } @@ -28,18 +28,18 @@ resource "google_firestore_database" "database" { depends_on = [google_project_service.firestore] } -resource "google_firestore_document" "<%= ctx[:primary_resource_id] %>" { +resource "google_firestore_document" "{{$.PrimaryResourceId}}" { project = google_project.project.project_id database = google_firestore_database.database.name collection = "somenewcollection" - document_id = "<%= ctx[:vars]['document_id'] %>" + document_id = "{{index $.Vars "document_id"}}" fields = "{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}" } resource "google_firestore_document" "sub_document" { project = google_project.project.project_id database = google_firestore_database.database.name - collection = "${google_firestore_document.<%= ctx[:primary_resource_id] %>.path}/subdocs" + collection = "${google_firestore_document.{{$.PrimaryResourceId}}.path}/subdocs" document_id = "bitcoinkey" fields = "{\"something\":{\"mapValue\":{\"fields\":{\"ayo\":{\"stringValue\":\"val2\"}}}}}" } diff --git a/mmv1/templates/terraform/examples/firestore_field_basic.tf.tmpl b/mmv1/templates/terraform/examples/firestore_field_basic.tf.tmpl index 3dbb68459d62..bdca9cad59cd 100644 --- a/mmv1/templates/terraform/examples/firestore_field_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_field_basic.tf.tmpl @@ -1,15 +1,15 @@ resource "google_firestore_database" "database" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" } -resource "google_firestore_field" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_field" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" database = google_firestore_database.database.name collection = "chatrooms_%{random_suffix}" field = "basic" diff --git a/mmv1/templates/terraform/examples/firestore_field_complex_field_name.tf.tmpl b/mmv1/templates/terraform/examples/firestore_field_complex_field_name.tf.tmpl index 55bdd2e86165..8f569c85ccd7 100644 --- a/mmv1/templates/terraform/examples/firestore_field_complex_field_name.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_field_complex_field_name.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_firestore_field" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_field" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" collection = "chatrooms_%{random_suffix}" field = "`*`" diff --git a/mmv1/templates/terraform/examples/firestore_field_match_override.tf.tmpl b/mmv1/templates/terraform/examples/firestore_field_match_override.tf.tmpl index bafe6c06db03..9e00d797d00c 100644 --- a/mmv1/templates/terraform/examples/firestore_field_match_override.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_field_match_override.tf.tmpl @@ -1,15 +1,15 @@ resource "google_firestore_database" "database" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" } -resource "google_firestore_field" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_field" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" database = google_firestore_database.database.name collection = "chatrooms_%{random_suffix}" field = "field_with_same_configuration_as_ancestor" diff --git a/mmv1/templates/terraform/examples/firestore_field_timestamp.tf.tmpl b/mmv1/templates/terraform/examples/firestore_field_timestamp.tf.tmpl index 145f4d8e2530..29071cba3232 100644 --- a/mmv1/templates/terraform/examples/firestore_field_timestamp.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_field_timestamp.tf.tmpl @@ -1,15 +1,15 @@ resource "google_firestore_database" "database" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" - delete_protection_state = "<%= ctx[:vars]['delete_protection_state'] %>" + delete_protection_state = "{{index $.Vars "delete_protection_state"}}" deletion_policy = "DELETE" } -resource "google_firestore_field" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_field" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" database = google_firestore_database.database.name collection = "chatrooms" field = "timestamp" diff --git a/mmv1/templates/terraform/examples/firestore_index_basic.tf.tmpl b/mmv1/templates/terraform/examples/firestore_index_basic.tf.tmpl index b706e3be2817..ecc93964e5d9 100644 --- a/mmv1/templates/terraform/examples/firestore_index_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_index_basic.tf.tmpl @@ -1,6 +1,6 @@ resource "google_firestore_database" "database" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" @@ -8,8 +8,8 @@ resource "google_firestore_database" "database" { deletion_policy = "DELETE" } -resource "google_firestore_index" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_index" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" database = google_firestore_database.database.name collection = "atestcollection" diff --git a/mmv1/templates/terraform/examples/firestore_index_datastore_mode.tf.tmpl b/mmv1/templates/terraform/examples/firestore_index_datastore_mode.tf.tmpl index 4ec2fc640954..b6ae19a28db0 100644 --- a/mmv1/templates/terraform/examples/firestore_index_datastore_mode.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_index_datastore_mode.tf.tmpl @@ -1,6 +1,6 @@ resource "google_firestore_database" "database" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "DATASTORE_MODE" @@ -8,8 +8,8 @@ resource "google_firestore_database" "database" { deletion_policy = "DELETE" } -resource "google_firestore_index" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_index" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" database = google_firestore_database.database.name collection = "atestcollection" diff --git a/mmv1/templates/terraform/examples/firestore_index_vector.tf.tmpl b/mmv1/templates/terraform/examples/firestore_index_vector.tf.tmpl index 173e841ad42f..f764f08d493e 100644 --- a/mmv1/templates/terraform/examples/firestore_index_vector.tf.tmpl +++ b/mmv1/templates/terraform/examples/firestore_index_vector.tf.tmpl @@ -1,6 +1,6 @@ resource "google_firestore_database" "database" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "<%= ctx[:vars]['database_id'] %>" + project = "{{index $.TestEnvVars "project_id"}}" + name = "{{index $.Vars "database_id"}}" location_id = "nam5" type = "FIRESTORE_NATIVE" @@ -8,8 +8,8 @@ resource "google_firestore_database" "database" { deletion_policy = "DELETE" } -resource "google_firestore_index" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_firestore_index" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project_id"}}" database = google_firestore_database.database.name collection = "atestcollection" diff --git a/mmv1/templates/terraform/examples/firewall_basic.tf.tmpl b/mmv1/templates/terraform/examples/firewall_basic.tf.tmpl index 7b868126159f..77e1ea0feaa0 100644 --- a/mmv1/templates/terraform/examples/firewall_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/firewall_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_firewall" "default" { - name = "<%= ctx[:vars]['firewall_name'] %>" + name = "{{index $.Vars "firewall_name"}}" network = google_compute_network.default.name allow { @@ -15,5 +15,5 @@ resource "google_compute_firewall" "default" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/firewall_with_target_tags.tf.tmpl b/mmv1/templates/terraform/examples/firewall_with_target_tags.tf.tmpl index 48f9bee58579..44b17b9699ed 100644 --- a/mmv1/templates/terraform/examples/firewall_with_target_tags.tf.tmpl +++ b/mmv1/templates/terraform/examples/firewall_with_target_tags.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_firewall" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]["project"] %>" - name = "<%= ctx[:vars]['firewall_name'] %>" +resource "google_compute_firewall" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "firewall_name"}}" network = "default" description = "Creates firewall rule targeting tagged instances" diff --git a/mmv1/templates/terraform/examples/flask_google_cloud_quickstart.tf.tmpl b/mmv1/templates/terraform/examples/flask_google_cloud_quickstart.tf.tmpl index 65accdc7ebd9..fc23157f4b37 100644 --- a/mmv1/templates/terraform/examples/flask_google_cloud_quickstart.tf.tmpl +++ b/mmv1/templates/terraform/examples/flask_google_cloud_quickstart.tf.tmpl @@ -1,6 +1,6 @@ # Create a single Compute Engine instance -resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['flask_vm'] %>" +resource "google_compute_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "flask_vm"}}" machine_type = "f1-micro" zone = "us-west1-a" tags = ["ssh"] @@ -27,7 +27,7 @@ resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_firewall" "ssh" { - name = "<%= ctx[:vars]['allow_ssh'] %>" + name = "{{index $.Vars "allow_ssh"}}" allow { ports = ["22"] protocol = "tcp" @@ -41,7 +41,7 @@ resource "google_compute_firewall" "ssh" { resource "google_compute_firewall" "flask" { - name = "<%= ctx[:vars]['flask_app_firewall'] %>" + name = "{{index $.Vars "flask_app_firewall"}}" network = "default" allow { @@ -55,7 +55,7 @@ resource "google_compute_firewall" "flask" { # with versioning enabled resource "google_storage_bucket" "default" { - name = "<%= ctx[:vars]['bucket_tfstate'] %>" + name = "{{index $.Vars "bucket_tfstate"}}" force_destroy = false location = "US" storage_class = "STANDARD" diff --git a/mmv1/templates/terraform/examples/folder_access_approval_active_key_version.tf.tmpl b/mmv1/templates/terraform/examples/folder_access_approval_active_key_version.tf.tmpl index 64f844f433c0..64d4f3a55e47 100644 --- a/mmv1/templates/terraform/examples/folder_access_approval_active_key_version.tf.tmpl +++ b/mmv1/templates/terraform/examples/folder_access_approval_active_key_version.tf.tmpl @@ -1,6 +1,6 @@ resource "google_folder" "my_folder" { - display_name = "<%= ctx[:vars]['folder_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + display_name = "{{index $.Vars "folder_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" deletion_protection = false } @@ -41,7 +41,7 @@ data "google_kms_crypto_key_version" "crypto_key_version" { crypto_key = google_kms_crypto_key.crypto_key.id } -resource "google_folder_access_approval_settings" "<%= ctx[:primary_resource_id] %>" { +resource "google_folder_access_approval_settings" "{{$.PrimaryResourceId}}" { folder_id = google_folder.my_folder.folder_id active_key_version = data.google_kms_crypto_key_version.crypto_key_version.name diff --git a/mmv1/templates/terraform/examples/folder_access_approval_full.tf.tmpl b/mmv1/templates/terraform/examples/folder_access_approval_full.tf.tmpl index 140550f5a161..fc08b3dee4f8 100644 --- a/mmv1/templates/terraform/examples/folder_access_approval_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/folder_access_approval_full.tf.tmpl @@ -1,10 +1,10 @@ resource "google_folder" "my_folder" { - display_name = "<%= ctx[:vars]['folder_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + display_name = "{{index $.Vars "folder_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" deletion_protection = false } -resource "google_folder_access_approval_settings" "<%= ctx[:primary_resource_id] %>" { +resource "google_folder_access_approval_settings" "{{$.PrimaryResourceId}}" { folder_id = google_folder.my_folder.folder_id notification_emails = ["testuser@example.com", "example.user@example.com"] diff --git a/mmv1/templates/terraform/examples/forwarding_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_basic.tf.tmpl index 1774fdda51bb..c1d0a4d1dd7c 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_basic.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" target = google_compute_target_pool.default.id port_range = "80" } resource "google_compute_target_pool" "default" { - name = "<%= ctx[:vars]['target_pool_name'] %>" + name = "{{index $.Vars "target_pool_name"}}" } diff --git a/mmv1/templates/terraform/examples/forwarding_rule_externallb.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_externallb.tf.tmpl index b39018dee960..d49f86bdf06f 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_externallb.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_externallb.tf.tmpl @@ -1,21 +1,21 @@ // Forwarding rule for External Network Load Balancing using Backend Services -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" port_range = 80 backend_service = google_compute_region_backend_service.backend.id } resource "google_compute_region_backend_service" "backend" { provider = google-beta - name = "<%= ctx[:vars]['backend_name'] %>" + 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" { provider = google-beta - name = "check-<%= ctx[:vars]['backend_name'] %>" + name = "check-{{index $.Vars "backend_name"}}" check_interval_sec = 1 timeout_sec = 1 region = "us-central1" diff --git a/mmv1/templates/terraform/examples/forwarding_rule_global_internallb.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_global_internallb.tf.tmpl index baba424e88d8..8df91445892d 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_global_internallb.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_global_internallb.tf.tmpl @@ -1,6 +1,6 @@ // Forwarding rule for Internal Load Balancing -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "INTERNAL" backend_service = google_compute_region_backend_service.backend.id @@ -10,12 +10,12 @@ resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { subnetwork = google_compute_subnetwork.default.name } resource "google_compute_region_backend_service" "backend" { - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" region = "us-central1" health_checks = [google_compute_health_check.hc.id] } resource "google_compute_health_check" "hc" { - name = "check-<%= ctx[:vars]['backend_name'] %>" + name = "check-{{index $.Vars "backend_name"}}" check_interval_sec = 1 timeout_sec = 1 tcp_health_check { @@ -23,11 +23,11 @@ resource "google_compute_health_check" "hc" { } } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/forwarding_rule_http_lb.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_http_lb.tf.tmpl index 9fc9c95a32a1..dc11078d0156 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_http_lb.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_http_lb.tf.tmpl @@ -1,8 +1,8 @@ // Forwarding rule for Internal Load Balancing -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { provider = google-beta depends_on = [google_compute_subnetwork.proxy] - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" ip_protocol = "TCP" @@ -18,7 +18,7 @@ resource "google_compute_region_target_http_proxy" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['region_target_http_proxy_name'] %>" + name = "{{index $.Vars "region_target_http_proxy_name"}}" url_map = google_compute_region_url_map.default.id } @@ -26,7 +26,7 @@ resource "google_compute_region_url_map" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" default_service = google_compute_region_backend_service.default.id } @@ -42,7 +42,7 @@ resource "google_compute_region_backend_service" "default" { } region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" protocol = "HTTP" timeout_sec = 10 @@ -58,7 +58,7 @@ data "google_compute_image" "debian_image" { resource "google_compute_region_instance_group_manager" "rigm" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['rigm_name'] %>" + name = "{{index $.Vars "rigm_name"}}" version { instance_template = google_compute_instance_template.instance_template.id name = "primary" @@ -69,7 +69,7 @@ resource "google_compute_region_instance_group_manager" "rigm" { resource "google_compute_instance_template" "instance_template" { provider = google-beta - name = "template-<%= ctx[:vars]['region_backend_service_name'] %>" + name = "template-{{index $.Vars "region_backend_service_name"}}" machine_type = "e2-medium" network_interface { @@ -91,7 +91,7 @@ resource "google_compute_region_health_check" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port_specification = "USE_SERVING_PORT" } @@ -99,7 +99,7 @@ resource "google_compute_region_health_check" "default" { resource "google_compute_firewall" "fw1" { provider = google-beta - name = "<%= ctx[:vars]['fw_name'] %>-1" + name = "{{index $.Vars "fw_name"}}-1" network = google_compute_network.default.id source_ranges = ["10.1.2.0/24"] allow { @@ -117,7 +117,7 @@ resource "google_compute_firewall" "fw1" { resource "google_compute_firewall" "fw2" { depends_on = [google_compute_firewall.fw1] provider = google-beta - name = "<%= ctx[:vars]['fw_name'] %>-2" + name = "{{index $.Vars "fw_name"}}-2" network = google_compute_network.default.id source_ranges = ["0.0.0.0/0"] allow { @@ -131,7 +131,7 @@ resource "google_compute_firewall" "fw2" { resource "google_compute_firewall" "fw3" { depends_on = [google_compute_firewall.fw2] provider = google-beta - name = "<%= ctx[:vars]['fw_name'] %>-3" + name = "{{index $.Vars "fw_name"}}-3" network = google_compute_network.default.id source_ranges = ["130.211.0.0/22", "35.191.0.0/16"] allow { @@ -144,7 +144,7 @@ resource "google_compute_firewall" "fw3" { resource "google_compute_firewall" "fw4" { depends_on = [google_compute_firewall.fw3] provider = google-beta - name = "<%= ctx[:vars]['fw_name'] %>-4" + name = "{{index $.Vars "fw_name"}}-4" network = google_compute_network.default.id source_ranges = ["10.129.0.0/26"] target_tags = ["load-balanced-backend"] @@ -165,14 +165,14 @@ resource "google_compute_firewall" "fw4" { resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false routing_mode = "REGIONAL" } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>-default" + name = "{{index $.Vars "network_name"}}-default" ip_cidr_range = "10.1.2.0/24" region = "us-central1" network = google_compute_network.default.id @@ -180,7 +180,7 @@ resource "google_compute_subnetwork" "default" { resource "google_compute_subnetwork" "proxy" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>-proxy" + name = "{{index $.Vars "network_name"}}-proxy" ip_cidr_range = "10.129.0.0/26" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/forwarding_rule_internallb.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_internallb.tf.tmpl index 857de596a098..07d01a4f112e 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_internallb.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_internallb.tf.tmpl @@ -1,6 +1,6 @@ // Forwarding rule for Internal Load Balancing -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "INTERNAL" @@ -12,13 +12,13 @@ resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_region_backend_service" "backend" { - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" region = "us-central1" health_checks = [google_compute_health_check.hc.id] } resource "google_compute_health_check" "hc" { - name = "check-<%= ctx[:vars]['backend_name'] %>" + name = "check-{{index $.Vars "backend_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -28,12 +28,12 @@ resource "google_compute_health_check" "hc" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/forwarding_rule_internallb_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_internallb_ipv6.tf.tmpl index c71af6b2132d..9cad7a0d08a0 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_internallb_ipv6.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_internallb_ipv6.tf.tmpl @@ -1,6 +1,6 @@ // Forwarding rule for Internal Load Balancing -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "INTERNAL" @@ -12,13 +12,13 @@ resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_region_backend_service" "backend" { - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" region = "us-central1" health_checks = [google_compute_health_check.hc.id] } resource "google_compute_health_check" "hc" { - name = "check-<%= ctx[:vars]['backend_name'] %>" + name = "check-{{index $.Vars "backend_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -28,13 +28,13 @@ resource "google_compute_health_check" "hc" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false enable_ula_internal_ipv6 = true } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" stack_type = "IPV4_IPV6" diff --git a/mmv1/templates/terraform/examples/forwarding_rule_l3_default.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_l3_default.tf.tmpl index 98314cce430b..8c68f7ae9898 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_l3_default.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_l3_default.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" backend_service = google_compute_region_backend_service.service.id ip_protocol = "L3_DEFAULT" all_ports = true @@ -9,7 +9,7 @@ resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_region_backend_service" "service" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['service_name'] %>" + name = "{{index $.Vars "service_name"}}" health_checks = [google_compute_region_health_check.health_check.id] protocol = "UNSPECIFIED" load_balancing_scheme = "EXTERNAL" @@ -17,7 +17,7 @@ resource "google_compute_region_backend_service" "service" { resource "google_compute_region_health_check" "health_check" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" region = "us-central1" tcp_health_check { diff --git a/mmv1/templates/terraform/examples/forwarding_rule_regional_http_xlb.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_regional_http_xlb.tf.tmpl index 3dd6829576d6..395a45dcb23e 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_regional_http_xlb.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_regional_http_xlb.tf.tmpl @@ -1,8 +1,8 @@ // Forwarding rule for Regional External Load Balancing -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { provider = google-beta depends_on = [google_compute_subnetwork.proxy] - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" ip_protocol = "TCP" @@ -18,7 +18,7 @@ resource "google_compute_region_target_http_proxy" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['region_target_http_proxy_name'] %>" + name = "{{index $.Vars "region_target_http_proxy_name"}}" url_map = google_compute_region_url_map.default.id } @@ -26,7 +26,7 @@ resource "google_compute_region_url_map" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" default_service = google_compute_region_backend_service.default.id } @@ -42,7 +42,7 @@ resource "google_compute_region_backend_service" "default" { } region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" protocol = "HTTP" timeout_sec = 10 @@ -58,7 +58,7 @@ data "google_compute_image" "debian_image" { resource "google_compute_region_instance_group_manager" "rigm" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['rigm_name'] %>" + name = "{{index $.Vars "rigm_name"}}" version { instance_template = google_compute_instance_template.instance_template.id name = "primary" @@ -69,7 +69,7 @@ resource "google_compute_region_instance_group_manager" "rigm" { resource "google_compute_instance_template" "instance_template" { provider = google-beta - name = "template-<%= ctx[:vars]['region_backend_service_name'] %>" + name = "template-{{index $.Vars "region_backend_service_name"}}" machine_type = "e2-medium" network_interface { @@ -91,14 +91,14 @@ resource "google_compute_region_health_check" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port_specification = "USE_SERVING_PORT" } } resource "google_compute_address" "default" { - name = "<%= ctx[:vars]['ip_name'] %>-1" + name = "{{index $.Vars "ip_name"}}-1" provider = google-beta region = "us-central1" network_tier = "STANDARD" @@ -106,7 +106,7 @@ resource "google_compute_address" "default" { resource "google_compute_firewall" "fw1" { provider = google-beta - name = "<%= ctx[:vars]['fw_name'] %>-1" + name = "{{index $.Vars "fw_name"}}-1" network = google_compute_network.default.id source_ranges = ["10.1.2.0/24"] allow { @@ -124,7 +124,7 @@ resource "google_compute_firewall" "fw1" { resource "google_compute_firewall" "fw2" { depends_on = [google_compute_firewall.fw1] provider = google-beta - name = "<%= ctx[:vars]['fw_name'] %>-2" + name = "{{index $.Vars "fw_name"}}-2" network = google_compute_network.default.id source_ranges = ["0.0.0.0/0"] allow { @@ -138,7 +138,7 @@ resource "google_compute_firewall" "fw2" { resource "google_compute_firewall" "fw3" { depends_on = [google_compute_firewall.fw2] provider = google-beta - name = "<%= ctx[:vars]['fw_name'] %>-3" + name = "{{index $.Vars "fw_name"}}-3" network = google_compute_network.default.id source_ranges = ["130.211.0.0/22", "35.191.0.0/16"] allow { @@ -151,7 +151,7 @@ resource "google_compute_firewall" "fw3" { resource "google_compute_firewall" "fw4" { depends_on = [google_compute_firewall.fw3] provider = google-beta - name = "<%= ctx[:vars]['fw_name'] %>-4" + name = "{{index $.Vars "fw_name"}}-4" network = google_compute_network.default.id source_ranges = ["10.129.0.0/26"] target_tags = ["load-balanced-backend"] @@ -172,14 +172,14 @@ resource "google_compute_firewall" "fw4" { resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false routing_mode = "REGIONAL" } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>-default" + name = "{{index $.Vars "network_name"}}-default" ip_cidr_range = "10.1.2.0/24" region = "us-central1" network = google_compute_network.default.id @@ -187,7 +187,7 @@ resource "google_compute_subnetwork" "default" { resource "google_compute_subnetwork" "proxy" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>-proxy" + name = "{{index $.Vars "network_name"}}-proxy" ip_cidr_range = "10.129.0.0/26" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/forwarding_rule_regional_steering.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_regional_steering.tf.tmpl index 2899010db21f..020854ebd4c7 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_regional_steering.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_regional_steering.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_forwarding_rule" "steering" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" ip_address = google_compute_address.basic.address backend_service = google_compute_region_backend_service.external.self_link @@ -9,18 +9,18 @@ resource "google_compute_forwarding_rule" "steering" { } resource "google_compute_address" "basic" { - name = "<%= ctx[:vars]['ip_name'] %>" + name = "{{index $.Vars "ip_name"}}" region = "us-central1" } resource "google_compute_region_backend_service" "external" { - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" region = "us-central1" load_balancing_scheme = "EXTERNAL" } resource "google_compute_forwarding_rule" "external" { - name = "<%= ctx[:vars]['external_forwarding_rule_name'] %>" + name = "{{index $.Vars "external_forwarding_rule_name"}}" region = "us-central1" ip_address = google_compute_address.basic.address backend_service = google_compute_region_backend_service.external.self_link diff --git a/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc.tf.tmpl index c6561ddbd4b0..84a2c14d5165 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc.tf.tmpl @@ -1,6 +1,6 @@ // Forwarding rule for VPC private service connect -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "" target = google_compute_service_attachment.producer_service_attachment.id @@ -12,19 +12,19 @@ resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { // Consumer service endpoint resource "google_compute_network" "consumer_net" { - name = "<%= ctx[:vars]['consumer_network_name'] %>" + name = "{{index $.Vars "consumer_network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "consumer_subnet" { - name = "<%= ctx[:vars]['consumer_network_name'] %>" + name = "{{index $.Vars "consumer_network_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.consumer_net.id } resource "google_compute_address" "consumer_address" { - name = "<%= ctx[:vars]['ip_name'] %>-1" + name = "{{index $.Vars "ip_name"}}-1" region = "us-central1" subnetwork = google_compute_subnetwork.consumer_subnet.id address_type = "INTERNAL" @@ -34,19 +34,19 @@ resource "google_compute_address" "consumer_address" { // Producer service attachment resource "google_compute_network" "producer_net" { - name = "<%= ctx[:vars]['producer_network_name'] %>" + name = "{{index $.Vars "producer_network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "producer_subnet" { - name = "<%= ctx[:vars]['producer_network_name'] %>" + name = "{{index $.Vars "producer_network_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.producer_net.id } resource "google_compute_subnetwork" "psc_producer_subnet" { - name = "<%= ctx[:vars]['producer_psc_network_name'] %>" + name = "{{index $.Vars "producer_psc_network_name"}}" ip_cidr_range = "10.1.0.0/16" region = "us-central1" @@ -55,7 +55,7 @@ resource "google_compute_subnetwork" "psc_producer_subnet" { } resource "google_compute_service_attachment" "producer_service_attachment" { - name = "<%= ctx[:vars]['service_attachment_name'] %>" + name = "{{index $.Vars "service_attachment_name"}}" region = "us-central1" description = "A service attachment configured with Terraform" @@ -66,7 +66,7 @@ resource "google_compute_service_attachment" "producer_service_attachment" { } resource "google_compute_forwarding_rule" "producer_target_service" { - name = "<%= ctx[:vars]['producer_forwarding_rule_name'] %>" + name = "{{index $.Vars "producer_forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "INTERNAL" @@ -77,14 +77,14 @@ resource "google_compute_forwarding_rule" "producer_target_service" { } resource "google_compute_region_backend_service" "producer_service_backend" { - name = "<%= ctx[:vars]['producer_backend_name'] %>" + name = "{{index $.Vars "producer_backend_name"}}" region = "us-central1" health_checks = [google_compute_health_check.producer_service_health_check.id] } resource "google_compute_health_check" "producer_service_health_check" { - name = "<%= ctx[:vars]['producer_healthcheck_name'] %>" + name = "{{index $.Vars "producer_healthcheck_name"}}" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc_no_automate_dns.tf.tmpl b/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc_no_automate_dns.tf.tmpl index 820c111c3271..93b976c1217a 100644 --- a/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc_no_automate_dns.tf.tmpl +++ b/mmv1/templates/terraform/examples/forwarding_rule_vpc_psc_no_automate_dns.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "" target = google_compute_service_attachment.producer_service_attachment.id @@ -10,19 +10,19 @@ resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "consumer_net" { - name = "<%= ctx[:vars]['consumer_network_name'] %>" + name = "{{index $.Vars "consumer_network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "consumer_subnet" { - name = "<%= ctx[:vars]['consumer_network_name'] %>" + name = "{{index $.Vars "consumer_network_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.consumer_net.id } resource "google_compute_address" "consumer_address" { - name = "<%= ctx[:vars]['ip_name'] %>-1" + name = "{{index $.Vars "ip_name"}}-1" region = "us-central1" subnetwork = google_compute_subnetwork.consumer_subnet.id address_type = "INTERNAL" @@ -30,19 +30,19 @@ resource "google_compute_address" "consumer_address" { resource "google_compute_network" "producer_net" { - name = "<%= ctx[:vars]['producer_network_name'] %>" + name = "{{index $.Vars "producer_network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "producer_subnet" { - name = "<%= ctx[:vars]['producer_network_name'] %>" + name = "{{index $.Vars "producer_network_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.producer_net.id } resource "google_compute_subnetwork" "psc_producer_subnet" { - name = "<%= ctx[:vars]['producer_psc_network_name'] %>" + name = "{{index $.Vars "producer_psc_network_name"}}" ip_cidr_range = "10.1.0.0/16" region = "us-central1" @@ -51,7 +51,7 @@ resource "google_compute_subnetwork" "psc_producer_subnet" { } resource "google_compute_service_attachment" "producer_service_attachment" { - name = "<%= ctx[:vars]['service_attachment_name'] %>" + name = "{{index $.Vars "service_attachment_name"}}" region = "us-central1" description = "A service attachment configured with Terraform" @@ -62,7 +62,7 @@ resource "google_compute_service_attachment" "producer_service_attachment" { } resource "google_compute_forwarding_rule" "producer_target_service" { - name = "<%= ctx[:vars]['producer_forwarding_rule_name'] %>" + name = "{{index $.Vars "producer_forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "INTERNAL" @@ -73,14 +73,14 @@ resource "google_compute_forwarding_rule" "producer_target_service" { } resource "google_compute_region_backend_service" "producer_service_backend" { - name = "<%= ctx[:vars]['producer_backend_name'] %>" + name = "{{index $.Vars "producer_backend_name"}}" region = "us-central1" health_checks = [google_compute_health_check.producer_service_health_check.id] } resource "google_compute_health_check" "producer_service_health_check" { - name = "<%= ctx[:vars]['producer_healthcheck_name'] %>" + name = "{{index $.Vars "producer_healthcheck_name"}}" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/gkebackup_backupplan_autopilot.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_backupplan_autopilot.tf.tmpl index 34fd0e304e08..51e87e23fcc0 100644 --- a/mmv1/templates/terraform/examples/gkebackup_backupplan_autopilot.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_backupplan_autopilot.tf.tmpl @@ -1,5 +1,5 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1" enable_autopilot = true ip_allocation_policy { @@ -12,13 +12,13 @@ resource "google_container_cluster" "primary" { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "autopilot" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { diff --git a/mmv1/templates/terraform/examples/gkebackup_backupplan_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_backupplan_basic.tf.tmpl index 0e3cf848e94b..0ad3b4f9fe9c 100644 --- a/mmv1/templates/terraform/examples/gkebackup_backupplan_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_backupplan_basic.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { diff --git a/mmv1/templates/terraform/examples/gkebackup_backupplan_cmek.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_backupplan_cmek.tf.tmpl index 10850350dc69..e7fd2111332b 100644 --- a/mmv1/templates/terraform/examples/gkebackup_backupplan_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_backupplan_cmek.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "cmek" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -32,11 +32,11 @@ resource "google_gke_backup_backup_plan" "cmek" { } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/gkebackup_backupplan_full.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_backupplan_full.tf.tmpl index a95c584186ff..08db392f0b2c 100644 --- a/mmv1/templates/terraform/examples/gkebackup_backupplan_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_backupplan_full.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "full" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" retention_policy { diff --git a/mmv1/templates/terraform/examples/gkebackup_backupplan_permissive.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_backupplan_permissive.tf.tmpl index 764f82a37c61..ff568a0f05db 100644 --- a/mmv1/templates/terraform/examples/gkebackup_backupplan_permissive.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_backupplan_permissive.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } -resource "google_gke_backup_backup_plan" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gke_backup_backup_plan" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" retention_policy { diff --git a/mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_daily_window.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_daily_window.tf.tmpl index a58827c4b35e..f2631688f837 100644 --- a/mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_daily_window.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_daily_window.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } -resource "google_gke_backup_backup_plan" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gke_backup_backup_plan" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" retention_policy { diff --git a/mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_weekly_window.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_weekly_window.tf.tmpl index 29af2ca45fb7..19a58d493796 100644 --- a/mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_weekly_window.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_weekly_window.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } -resource "google_gke_backup_backup_plan" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gke_backup_backup_plan" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" retention_policy { diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_all_cluster_resources.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_all_cluster_resources.tf.tmpl index 8c15973c7b0b..921cbdff2d2f 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_all_cluster_resources.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_all_cluster_resources.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -27,7 +27,7 @@ resource "google_gke_backup_backup_plan" "basic" { } resource "google_gke_backup_restore_plan" "all_cluster_resources" { - name = "<%= ctx[:vars]['name'] %>-rp" + name = "{{index $.Vars "name"}}-rp" location = "us-central1" backup_plan = google_gke_backup_backup_plan.basic.id cluster = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_all_namespaces.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_all_namespaces.tf.tmpl index ca94a3f6ff5d..6ff5dc0c31ba 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_all_namespaces.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_all_namespaces.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -27,7 +27,7 @@ resource "google_gke_backup_backup_plan" "basic" { } resource "google_gke_backup_restore_plan" "all_ns" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" location = "us-central1" backup_plan = google_gke_backup_backup_plan.basic.id cluster = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_gitops_mode.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_gitops_mode.tf.tmpl index 42fc0f25c73e..f1463aab8d3f 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_gitops_mode.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_gitops_mode.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -26,8 +26,8 @@ resource "google_gke_backup_backup_plan" "basic" { } } -resource "google_gke_backup_restore_plan" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gke_backup_restore_plan" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" backup_plan = google_gke_backup_backup_plan.basic.id cluster = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_protected_application.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_protected_application.tf.tmpl index 647e051ee8b1..a3cabc4058aa 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_protected_application.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_protected_application.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -27,7 +27,7 @@ resource "google_gke_backup_backup_plan" "basic" { } resource "google_gke_backup_restore_plan" "rollback_app" { - name = "<%= ctx[:vars]['name'] %>-rp" + name = "{{index $.Vars "name"}}-rp" location = "us-central1" backup_plan = google_gke_backup_backup_plan.basic.id cluster = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_rename_namespace.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_rename_namespace.tf.tmpl index 17f10ee72c2f..4f2a05bf1ef5 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_rename_namespace.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_rename_namespace.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -27,7 +27,7 @@ resource "google_gke_backup_backup_plan" "basic" { } resource "google_gke_backup_restore_plan" "rename_ns" { - name = "<%= ctx[:vars]['name'] %>-rp" + name = "{{index $.Vars "name"}}-rp" location = "us-central1" backup_plan = google_gke_backup_backup_plan.basic.id cluster = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_restore_order.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_restore_order.tf.tmpl index 69649f0106cc..6436bbb05bc8 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_restore_order.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_restore_order.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -26,8 +26,8 @@ resource "google_gke_backup_backup_plan" "basic" { } } -resource "google_gke_backup_restore_plan" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gke_backup_restore_plan" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" backup_plan = google_gke_backup_backup_plan.basic.id cluster = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_rollback_namespace.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_rollback_namespace.tf.tmpl index bef0e3c61f14..bd719fdb9ddf 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_rollback_namespace.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_rollback_namespace.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -27,7 +27,7 @@ resource "google_gke_backup_backup_plan" "basic" { } resource "google_gke_backup_restore_plan" "rollback_ns" { - name = "<%= ctx[:vars]['name'] %>-rp" + name = "{{index $.Vars "name"}}-rp" location = "us-central1" backup_plan = google_gke_backup_backup_plan.basic.id cluster = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_second_transformation.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_second_transformation.tf.tmpl index 692506013e80..864914cac07a 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_second_transformation.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_second_transformation.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -27,7 +27,7 @@ resource "google_gke_backup_backup_plan" "basic" { } resource "google_gke_backup_restore_plan" "transform_rule" { - name = "<%= ctx[:vars]['name'] %>-rp" + name = "{{index $.Vars "name"}}-rp" description = "copy nginx env variables" labels = { "app" = "nginx" diff --git a/mmv1/templates/terraform/examples/gkebackup_restoreplan_volume_res.tf.tmpl b/mmv1/templates/terraform/examples/gkebackup_restoreplan_volume_res.tf.tmpl index e607fa94d6e1..4e078503a0f9 100644 --- a/mmv1/templates/terraform/examples/gkebackup_restoreplan_volume_res.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkebackup_restoreplan_volume_res.tf.tmpl @@ -1,22 +1,22 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['name'] %>-cluster" + name = "{{index $.Vars "name"}}-cluster" location = "us-central1" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } addons_config { gke_backup_agent_config { enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_backup_backup_plan" "basic" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" cluster = google_container_cluster.primary.id location = "us-central1" backup_config { @@ -26,8 +26,8 @@ resource "google_gke_backup_backup_plan" "basic" { } } -resource "google_gke_backup_restore_plan" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gke_backup_restore_plan" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" backup_plan = google_gke_backup_backup_plan.basic.id cluster = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkehub_membership_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkehub_membership_basic.tf.tmpl index b12a0d0d8aed..edab3c1c8bd7 100644 --- a/mmv1/templates/terraform/examples/gkehub_membership_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkehub_membership_basic.tf.tmpl @@ -1,14 +1,14 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1-a" initial_node_count = 1 - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_hub_membership" "membership" { - membership_id = "<%= ctx[:vars]['name'] %>" + membership_id = "{{index $.Vars "name"}}" endpoint { gke_cluster { resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}" diff --git a/mmv1/templates/terraform/examples/gkehub_membership_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkehub_membership_binding_basic.tf.tmpl index c9c5926c16a8..1cdf454bc9df 100644 --- a/mmv1/templates/terraform/examples/gkehub_membership_binding_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkehub_membership_binding_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1-a" initial_node_count = 1 - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_hub_membership" "membership" { @@ -22,7 +22,7 @@ resource "google_gke_hub_scope" "scope" { scope_id = "tf-test-scope%{random_suffix}" } -resource "google_gke_hub_membership_binding" "<%= ctx[:primary_resource_id] %>" { +resource "google_gke_hub_membership_binding" "{{$.PrimaryResourceId}}" { membership_binding_id = "tf-test-membership-binding%{random_suffix}" scope = google_gke_hub_scope.scope.name membership_id = google_gke_hub_membership.membership.membership_id diff --git a/mmv1/templates/terraform/examples/gkehub_membership_issuer.tf.tmpl b/mmv1/templates/terraform/examples/gkehub_membership_issuer.tf.tmpl index 35548342ce39..a40d9caf0ebb 100644 --- a/mmv1/templates/terraform/examples/gkehub_membership_issuer.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkehub_membership_issuer.tf.tmpl @@ -1,17 +1,17 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1-a" initial_node_count = 1 workload_identity_config { - workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" + workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_hub_membership" "membership" { - membership_id = "<%= ctx[:vars]['name'] %>" + membership_id = "{{index $.Vars "name"}}" endpoint { gke_cluster { resource_link = google_container_cluster.primary.id diff --git a/mmv1/templates/terraform/examples/gkehub_membership_rbac_role_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkehub_membership_rbac_role_binding_basic.tf.tmpl index 5f194e929c1f..662d22955b30 100644 --- a/mmv1/templates/terraform/examples/gkehub_membership_rbac_role_binding_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkehub_membership_rbac_role_binding_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_container_cluster" "primary" { provider = google-beta - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1-a" initial_node_count = 1 - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_hub_membership" "membership" { @@ -20,7 +20,7 @@ resource "google_gke_hub_membership" "membership" { depends_on = [google_container_cluster.primary] } -resource "google_gke_hub_membership_rbac_role_binding" "<%= ctx[:primary_resource_id] %>" { +resource "google_gke_hub_membership_rbac_role_binding" "{{$.PrimaryResourceId}}" { provider = google-beta membership_rbac_role_binding_id = "tf-test-membership-rbac-role-binding%{random_suffix}" membership_id = google_gke_hub_membership.membership.membership_id diff --git a/mmv1/templates/terraform/examples/gkehub_membership_regional.tf.tmpl b/mmv1/templates/terraform/examples/gkehub_membership_regional.tf.tmpl index 347f4c39958c..39c25ae63584 100644 --- a/mmv1/templates/terraform/examples/gkehub_membership_regional.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkehub_membership_regional.tf.tmpl @@ -1,15 +1,15 @@ resource "google_container_cluster" "primary" { - name = "<%= ctx[:vars]['cluster_name'] %>" + name = "{{index $.Vars "cluster_name"}}" location = "us-central1-a" initial_node_count = 1 deletion_protection = false - network = "<%= ctx[:vars]['network_name'] %>" - subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" + network = "{{index $.Vars "network_name"}}" + subnetwork = "{{index $.Vars "subnetwork_name"}}" } resource "google_gke_hub_membership" "membership" { - membership_id = "<%= ctx[:vars]['name'] %>" - location = "<%= ctx[:test_env_vars]['location'] %>" + membership_id = "{{index $.Vars "name"}}" + location = "{{index $.TestEnvVars "location"}}" endpoint { gke_cluster { resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}" diff --git a/mmv1/templates/terraform/examples/gkehub_namespace_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkehub_namespace_basic.tf.tmpl index e09137e9d016..862d70040cda 100644 --- a/mmv1/templates/terraform/examples/gkehub_namespace_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkehub_namespace_basic.tf.tmpl @@ -3,7 +3,7 @@ resource "google_gke_hub_scope" "scope" { } -resource "google_gke_hub_namespace" "<%= ctx[:primary_resource_id] %>" { +resource "google_gke_hub_namespace" "{{$.PrimaryResourceId}}" { scope_namespace_id = "tf-test-namespace%{random_suffix}" scope_id = google_gke_hub_scope.scope.scope_id scope = google_gke_hub_scope.scope.name diff --git a/mmv1/templates/terraform/examples/gkehub_scope_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkehub_scope_basic.tf.tmpl index 63efb8be3c78..77a9aca897f0 100644 --- a/mmv1/templates/terraform/examples/gkehub_scope_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkehub_scope_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gke_hub_scope" "<%= ctx[:primary_resource_id] %>" { - scope_id = "<%= ctx[:vars]['resource_name'] %>" +resource "google_gke_hub_scope" "{{$.PrimaryResourceId}}" { + scope_id = "{{index $.Vars "resource_name"}}" namespace_labels = { keyb = "valueb" keya = "valuea" diff --git a/mmv1/templates/terraform/examples/gkehub_scope_rbac_role_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkehub_scope_rbac_role_binding_basic.tf.tmpl index bb4bd7c43ed0..1600645443bd 100644 --- a/mmv1/templates/terraform/examples/gkehub_scope_rbac_role_binding_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkehub_scope_rbac_role_binding_basic.tf.tmpl @@ -2,7 +2,7 @@ resource "google_gke_hub_scope" "scope" { scope_id = "tf-test-scope%{random_suffix}" } -resource "google_gke_hub_scope_rbac_role_binding" "<%= ctx[:primary_resource_id] %>" { +resource "google_gke_hub_scope_rbac_role_binding" "{{$.PrimaryResourceId}}" { scope_rbac_role_binding_id = "tf-test-scope-rbac-role-binding%{random_suffix}" scope_id = google_gke_hub_scope.scope.scope_id user = "test-email@gmail.com" diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.tmpl index 5143587838e3..6df8083f5051 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gkeonprem_bare_metal_admin_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_bare_metal_admin_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" bare_metal_version = "1.13.4" network_config { diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.tmpl index 7aeccf1e06fe..e0c257f09e90 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gkeonprem_bare_metal_admin_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_bare_metal_admin_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" description = "test description" bare_metal_version = "1.13.4" diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_basic.tf.tmpl index a4f6603803ff..9e0faa604018 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gkeonprem_bare_metal_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_bare_metal_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" bare_metal_version = "1.12.3" diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_bgplb.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_bgplb.tf.tmpl index 9a67a2961790..96e8c121c51e 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_bgplb.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_bgplb.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gkeonprem_bare_metal_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_bare_metal_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" bare_metal_version = "1.12.3" diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_manuallb.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_manuallb.tf.tmpl index 318dfdaf6a82..090f6737db33 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_manuallb.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_cluster_manuallb.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gkeonprem_bare_metal_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_bare_metal_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" bare_metal_version = "1.12.3" diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_node_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_node_pool_basic.tf.tmpl index e8a629a1e606..b0b07f457ef7 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_node_pool_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_node_pool_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_gkeonprem_bare_metal_cluster" "default-basic" { - name = "<%= ctx[:vars]['cluster'] %>" + name = "{{index $.Vars "cluster"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" bare_metal_version = "1.12.3" @@ -68,8 +68,8 @@ resource "google_gkeonprem_bare_metal_cluster" "default-basic" { } } -resource "google_gkeonprem_bare_metal_node_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_bare_metal_node_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" bare_metal_cluster = google_gkeonprem_bare_metal_cluster.default-basic.name location = "us-west1" node_pool_config { diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_node_pool_full.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_node_pool_full.tf.tmpl index 4f5b096a90a4..802b2b120e49 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_node_pool_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_node_pool_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_gkeonprem_bare_metal_cluster" "default-full" { - name = "<%= ctx[:vars]['cluster'] %>" + name = "{{index $.Vars "cluster"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" bare_metal_version = "1.12.3" @@ -68,8 +68,8 @@ resource "google_gkeonprem_bare_metal_cluster" "default-full" { } } -resource "google_gkeonprem_bare_metal_node_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_bare_metal_node_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" display_name = "test-name" bare_metal_cluster = google_gkeonprem_bare_metal_cluster.default-full.name location = "us-west1" diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.tmpl index 3146d5a4c317..e68d8e4e3fa9 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gkeonprem_vmware_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_vmware_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" description = "test cluster" diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_f5lb.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_f5lb.tf.tmpl index 0bccd8275025..5a69beefc698 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_f5lb.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_f5lb.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gkeonprem_vmware_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_vmware_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" description = "test cluster" diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_manuallb.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_manuallb.tf.tmpl index 8e7b695d57c3..13397c5d9f28 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_manuallb.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_manuallb.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_gkeonprem_vmware_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_vmware_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" description = "test cluster" diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_node_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_node_pool_basic.tf.tmpl index 850f6a1de6ab..38f7bef0525d 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_node_pool_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_node_pool_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_gkeonprem_vmware_cluster" "default-basic" { - name = "<%= ctx[:vars]['cluster'] %>" + name = "{{index $.Vars "cluster"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" description = "test cluster" @@ -36,8 +36,8 @@ resource "google_gkeonprem_vmware_cluster" "default-basic" { } } -resource "google_gkeonprem_vmware_node_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_vmware_node_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" vmware_cluster = google_gkeonprem_vmware_cluster.default-basic.name config { diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_node_pool_full.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_node_pool_full.tf.tmpl index 34ccaadc2aff..fb466f05bc7a 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_node_pool_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_node_pool_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_gkeonprem_vmware_cluster" "default-full" { - name = "<%= ctx[:vars]['cluster'] %>" + name = "{{index $.Vars "cluster"}}" location = "us-west1" admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" description = "test cluster" @@ -36,8 +36,8 @@ resource "google_gkeonprem_vmware_cluster" "default-full" { } } -resource "google_gkeonprem_vmware_node_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_gkeonprem_vmware_node_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-west1" vmware_cluster = google_gkeonprem_vmware_cluster.default-full.name annotations = {} diff --git a/mmv1/templates/terraform/examples/global_address_basic.tf.tmpl b/mmv1/templates/terraform/examples/global_address_basic.tf.tmpl index 63687c184b95..66c3f2a1198a 100644 --- a/mmv1/templates/terraform/examples/global_address_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_address_basic.tf.tmpl @@ -1,3 +1,3 @@ resource "google_compute_global_address" "default" { - name = "<%= ctx[:vars]['global_address_name'] %>" + name = "{{index $.Vars "global_address_name"}}" } diff --git a/mmv1/templates/terraform/examples/global_address_private_services_connect.tf.tmpl b/mmv1/templates/terraform/examples/global_address_private_services_connect.tf.tmpl index dde98f58d632..77930767c235 100644 --- a/mmv1/templates/terraform/examples/global_address_private_services_connect.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_address_private_services_connect.tf.tmpl @@ -1,6 +1,6 @@ resource "google_compute_global_address" "default" { provider = google-beta - name = "<%= ctx[:vars]['global_address_name'] %>" + name = "{{index $.Vars "global_address_name"}}" address_type = "INTERNAL" purpose = "PRIVATE_SERVICE_CONNECT" network = google_compute_network.network.id @@ -9,6 +9,6 @@ resource "google_compute_global_address" "default" { resource "google_compute_network" "network" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/global_forwarding_rule_external_managed.tf.tmpl b/mmv1/templates/terraform/examples/global_forwarding_rule_external_managed.tf.tmpl index 1761aaf8bf3b..7f9263b0b0f7 100644 --- a/mmv1/templates/terraform/examples/global_forwarding_rule_external_managed.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_forwarding_rule_external_managed.tf.tmpl @@ -1,18 +1,18 @@ resource "google_compute_global_forwarding_rule" "default" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" target = google_compute_target_http_proxy.default.id port_range = "80" load_balancing_scheme = "EXTERNAL_MANAGED" } resource "google_compute_target_http_proxy" "default" { - name = "<%= ctx[:vars]['http_proxy_name'] %>" + name = "{{index $.Vars "http_proxy_name"}}" description = "a description" url_map = google_compute_url_map.default.id } resource "google_compute_url_map" "default" { - name = "url-map-<%= ctx[:vars]['http_proxy_name'] %>" + name = "url-map-{{index $.Vars "http_proxy_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -33,7 +33,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 diff --git a/mmv1/templates/terraform/examples/global_forwarding_rule_http.tf.tmpl b/mmv1/templates/terraform/examples/global_forwarding_rule_http.tf.tmpl index 8d9793018471..560777cbd768 100644 --- a/mmv1/templates/terraform/examples/global_forwarding_rule_http.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_forwarding_rule_http.tf.tmpl @@ -1,17 +1,17 @@ resource "google_compute_global_forwarding_rule" "default" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" target = google_compute_target_http_proxy.default.id port_range = "80" } resource "google_compute_target_http_proxy" "default" { - name = "<%= ctx[:vars]['http_proxy_name'] %>" + name = "{{index $.Vars "http_proxy_name"}}" description = "a description" url_map = google_compute_url_map.default.id } resource "google_compute_url_map" "default" { - name = "url-map-<%= ctx[:vars]['http_proxy_name'] %>" + name = "url-map-{{index $.Vars "http_proxy_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -32,7 +32,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -41,7 +41,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - name = "check-<%= ctx[:vars]['backend_service_name'] %>" + name = "check-{{index $.Vars "backend_service_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/global_forwarding_rule_hybrid.tf.tmpl b/mmv1/templates/terraform/examples/global_forwarding_rule_hybrid.tf.tmpl index fc04b2d203dc..bb529c4d4da1 100644 --- a/mmv1/templates/terraform/examples/global_forwarding_rule_hybrid.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_forwarding_rule_hybrid.tf.tmpl @@ -4,16 +4,16 @@ variable "subnetwork_cidr" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_network" "internal" { - name = "<%= ctx[:vars]['internal_network_name'] %>" + name = "{{index $.Vars "internal_network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "internal"{ - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" network = google_compute_network.internal.id ip_cidr_range = var.subnetwork_cidr region = "us-central1" @@ -22,7 +22,7 @@ resource "google_compute_subnetwork" "internal"{ // Zonal NEG with GCE_VM_IP_PORT resource "google_compute_network_endpoint_group" "default" { - name = "<%= ctx[:vars]['default_neg_name'] %>" + name = "{{index $.Vars "default_neg_name"}}" network = google_compute_network.default.id default_port = "90" zone = "us-central1-a" @@ -31,7 +31,7 @@ resource "google_compute_network_endpoint_group" "default" { // Zonal NEG with GCE_VM_IP resource "google_compute_network_endpoint_group" "internal" { - name = "<%= ctx[:vars]['internal_neg_name'] %>" + name = "{{index $.Vars "internal_neg_name"}}" network = google_compute_network.internal.id subnetwork = google_compute_subnetwork.internal.id zone = "us-central1-a" @@ -40,7 +40,7 @@ resource "google_compute_network_endpoint_group" "internal" { // Hybrid connectivity NEG resource "google_compute_network_endpoint_group" "hybrid" { - name = "<%= ctx[:vars]['hybrid_neg_name'] %>" + name = "{{index $.Vars "hybrid_neg_name"}}" network = google_compute_network.default.id default_port = "90" zone = "us-central1-a" @@ -55,7 +55,7 @@ resource "google_compute_network_endpoint" "hybrid-endpoint" { // Backend service for Zonal NEG resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['default_backend_service_name'] %>" + name = "{{index $.Vars "default_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -69,7 +69,7 @@ resource "google_compute_backend_service" "default" { // Backgend service for Hybrid NEG resource "google_compute_backend_service" "hybrid" { - name = "<%= ctx[:vars]['hybrid_backend_service_name'] %>" + name = "{{index $.Vars "hybrid_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -82,7 +82,7 @@ resource "google_compute_backend_service" "hybrid" { } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 @@ -92,7 +92,7 @@ resource "google_compute_health_check" "default" { } resource "google_compute_url_map" "default" { - name = "url-map-<%= ctx[:vars]['http_proxy_name'] %>" + name = "url-map-{{index $.Vars "http_proxy_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -118,13 +118,13 @@ resource "google_compute_url_map" "default" { } resource "google_compute_target_http_proxy" "default" { - name = "<%= ctx[:vars]['http_proxy_name'] %>" + name = "{{index $.Vars "http_proxy_name"}}" description = "a description" url_map = google_compute_url_map.default.id } resource "google_compute_global_forwarding_rule" "default" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" target = google_compute_target_http_proxy.default.id port_range = "80" } diff --git a/mmv1/templates/terraform/examples/global_forwarding_rule_internal.tf.tmpl b/mmv1/templates/terraform/examples/global_forwarding_rule_internal.tf.tmpl index c6ab9088dc8b..d8a43c7cbbf4 100644 --- a/mmv1/templates/terraform/examples/global_forwarding_rule_internal.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_forwarding_rule_internal.tf.tmpl @@ -1,6 +1,6 @@ resource "google_compute_global_forwarding_rule" "default" { provider = google-beta - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" target = google_compute_target_http_proxy.default.id port_range = "80" load_balancing_scheme = "INTERNAL_SELF_MANAGED" @@ -16,14 +16,14 @@ resource "google_compute_global_forwarding_rule" "default" { resource "google_compute_target_http_proxy" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_proxy_name'] %>" + name = "{{index $.Vars "http_proxy_name"}}" description = "a description" url_map = google_compute_url_map.default.id } resource "google_compute_url_map" "default" { provider = google-beta - name = "url-map-<%= ctx[:vars]['http_proxy_name'] %>" + name = "url-map-{{index $.Vars "http_proxy_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -45,7 +45,7 @@ resource "google_compute_url_map" "default" { resource "google_compute_backend_service" "default" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -69,7 +69,7 @@ data "google_compute_image" "debian_image" { resource "google_compute_instance_group_manager" "igm" { provider = google-beta - name = "<%= ctx[:vars]['igm_name'] %>" + name = "{{index $.Vars "igm_name"}}" version { instance_template = google_compute_instance_template.instance_template.id name = "primary" @@ -81,7 +81,7 @@ resource "google_compute_instance_group_manager" "igm" { resource "google_compute_instance_template" "instance_template" { provider = google-beta - name = "template-<%= ctx[:vars]['backend_service_name'] %>" + name = "template-{{index $.Vars "backend_service_name"}}" machine_type = "e2-medium" network_interface { @@ -97,7 +97,7 @@ resource "google_compute_instance_template" "instance_template" { resource "google_compute_health_check" "default" { provider = google-beta - name = "check-<%= ctx[:vars]['backend_service_name'] %>" + name = "check-{{index $.Vars "backend_service_name"}}" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/global_internal_http_lb_with_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/global_internal_http_lb_with_mig_backend.tf.tmpl index 021d98ee7b97..b0f91a10dcc5 100644 --- a/mmv1/templates/terraform/examples/global_internal_http_lb_with_mig_backend.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_internal_http_lb_with_mig_backend.tf.tmpl @@ -2,14 +2,14 @@ # VPC network resource "google_compute_network" "gilb_network" { - name = "<%= ctx[:vars]['gilb_network_name'] %>" + name = "{{index $.Vars "gilb_network_name"}}" provider = google-beta auto_create_subnetworks = false } # proxy-only subnet resource "google_compute_subnetwork" "proxy_subnet" { - name = "<%= ctx[:vars]['proxy_subnet_name'] %>" + name = "{{index $.Vars "proxy_subnet_name"}}" provider = google-beta ip_cidr_range = "10.0.0.0/24" region = "europe-west1" @@ -20,7 +20,7 @@ resource "google_compute_subnetwork" "proxy_subnet" { # backend subnet resource "google_compute_subnetwork" "gilb_subnet" { - name = "<%= ctx[:vars]['backend_subnet_name'] %>" + name = "{{index $.Vars "backend_subnet_name"}}" provider = google-beta ip_cidr_range = "10.0.1.0/24" region = "europe-west1" @@ -28,8 +28,8 @@ resource "google_compute_subnetwork" "gilb_subnet" { } # forwarding rule -resource "google_compute_global_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" provider = google-beta depends_on = [google_compute_subnetwork.proxy_subnet] ip_protocol = "TCP" @@ -42,21 +42,21 @@ resource "google_compute_global_forwarding_rule" "<%= ctx[:primary_resource_id] # HTTP target proxy resource "google_compute_target_http_proxy" "default" { - name = "<%= ctx[:vars]['target_http_proxy_name'] %>" + name = "{{index $.Vars "target_http_proxy_name"}}" provider = google-beta url_map = google_compute_url_map.default.id } # URL map resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" provider = google-beta default_service = google_compute_backend_service.default.id } # backend service resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" provider = google-beta protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" @@ -71,7 +71,7 @@ resource "google_compute_backend_service" "default" { # instance template resource "google_compute_instance_template" "instance_template" { - name = "<%= ctx[:vars]['mig_template_name'] %>" + name = "{{index $.Vars "mig_template_name"}}" provider = google-beta machine_type = "e2-small" tags = ["http-server"] @@ -119,7 +119,7 @@ resource "google_compute_instance_template" "instance_template" { # health check resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['hc_name'] %>" + name = "{{index $.Vars "hc_name"}}" provider = google-beta http_health_check { port_specification = "USE_SERVING_PORT" @@ -128,7 +128,7 @@ resource "google_compute_health_check" "default" { # MIG resource "google_compute_instance_group_manager" "mig" { - name = "<%= ctx[:vars]['mig_name'] %>" + name = "{{index $.Vars "mig_name"}}" provider = google-beta zone = "europe-west1-b" version { @@ -141,7 +141,7 @@ resource "google_compute_instance_group_manager" "mig" { # allow all access from IAP and health check ranges resource "google_compute_firewall" "fw-iap" { - name = "<%= ctx[:vars]['fw_allow_iap_hc_name'] %>" + name = "{{index $.Vars "fw_allow_iap_hc_name"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.gilb_network.id @@ -153,7 +153,7 @@ resource "google_compute_firewall" "fw-iap" { # allow http from proxy subnet to backends resource "google_compute_firewall" "fw-gilb-to-backends" { - name = "<%= ctx[:vars]['fw_allow_gilb_to_backends_name'] %>" + name = "{{index $.Vars "fw_allow_gilb_to_backends_name"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.gilb_network.id @@ -167,7 +167,7 @@ resource "google_compute_firewall" "fw-gilb-to-backends" { # test instance resource "google_compute_instance" "vm-test" { - name = "<%= ctx[:vars]['vm_test_name'] %>" + name = "{{index $.Vars "vm_test_name"}}" provider = google-beta zone = "europe-west1-b" machine_type = "e2-small" diff --git a/mmv1/templates/terraform/examples/global_network_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/global_network_endpoint.tf.tmpl index 1baa5cb24904..053eb23c3a8a 100644 --- a/mmv1/templates/terraform/examples/global_network_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_network_endpoint.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_compute_global_network_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_global_network_endpoint" "{{$.PrimaryResourceId}}" { global_network_endpoint_group = google_compute_global_network_endpoint_group.neg.name fqdn = "www.example.com" port = 90 } resource "google_compute_global_network_endpoint_group" "neg" { - name = "<%= ctx[:vars]['neg_name'] %>" + name = "{{index $.Vars "neg_name"}}" default_port = "90" network_endpoint_type = "INTERNET_FQDN_PORT" } diff --git a/mmv1/templates/terraform/examples/global_network_endpoint_group.tf.tmpl b/mmv1/templates/terraform/examples/global_network_endpoint_group.tf.tmpl index f6baec3eae87..91bf8100f523 100644 --- a/mmv1/templates/terraform/examples/global_network_endpoint_group.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_network_endpoint_group.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_global_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_global_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" default_port = "90" network_endpoint_type = "INTERNET_FQDN_PORT" } diff --git a/mmv1/templates/terraform/examples/global_network_endpoint_group_ip_address.tf.tmpl b/mmv1/templates/terraform/examples/global_network_endpoint_group_ip_address.tf.tmpl index 4554aa6cbb41..7e8d5620f621 100644 --- a/mmv1/templates/terraform/examples/global_network_endpoint_group_ip_address.tf.tmpl +++ b/mmv1/templates/terraform/examples/global_network_endpoint_group_ip_address.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_global_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_global_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" network_endpoint_type = "INTERNET_IP_PORT" default_port = 90 } diff --git a/mmv1/templates/terraform/examples/go/Storage_pool_create.tf.tmpl b/mmv1/templates/terraform/examples/go/Storage_pool_create.tf.tmpl deleted file mode 100644 index 1d219ce86ea6..000000000000 --- a/mmv1/templates/terraform/examples/go/Storage_pool_create.tf.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -# Create a network or use datasource to reference existing network -resource "google_compute_network" "peering_network" { - name = "{{index $.Vars "network_name"}}" -} - -# Reserve a CIDR for NetApp Volumes to use -# When using shared-VPCs, this resource needs to be created in host project -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "global_name"}}" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 16 - network = google_compute_network.peering_network.id -} - -# Create a Private Service Access connection -# When using shared-VPCs, this resource needs to be created in host project -resource "google_service_networking_connection" "default" { - network = google_compute_network.peering_network.id - service = "netapp.servicenetworking.goog" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} - -# Modify the PSA Connection to allow import/export of custom routes -# When using shared-VPCs, this resource needs to be created in host project -resource "google_compute_network_peering_routes_config" "route_updates" { - peering = google_service_networking_connection.default.peering - network = google_compute_network.peering_network.name - - import_custom_routes = true - export_custom_routes = true -} - -# Create a storage pool -# Create this resource in the project which is expected to own the volumes -resource "google_netapp_storage_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "pool_name"}}" - # project = - location = "us-central1" - service_level = "PREMIUM" - capacity_gib = "2048" - network = google_compute_network.peering_network.id -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_access_level_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_access_level_basic.tf.tmpl deleted file mode 100644 index ec4ce3eb9cc4..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_access_level_basic.tf.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -resource "google_access_context_manager_access_level" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" - title = "{{index $.Vars "access_level_name"}}" - basic { - conditions { - device_policy { - require_screen_lock = true - os_constraints { - os_type = "DESKTOP_CHROME_OS" - } - } - regions = [ - "CH", - "IT", - "US", - ] - } - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_access_level_condition_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_access_level_condition_basic.tf.tmpl deleted file mode 100644 index 4d1b2310a494..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_access_level_condition_basic.tf.tmpl +++ /dev/null @@ -1,52 +0,0 @@ -resource "google_access_context_manager_access_level" "access-level-service-account" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" - title = "{{index $.Vars "access_level_name"}}" - basic { - conditions { - device_policy { - require_screen_lock = true - os_constraints { - os_type = "DESKTOP_CHROME_OS" - } - } - regions = [ - "CH", - "IT", - "US", - ] - } - } - - lifecycle { - ignore_changes = [basic.0.conditions] - } -} - -resource "google_service_account" "created-later" { - account_id = "{{index $.Vars "account_id"}}" -} - -resource "google_access_context_manager_access_level_condition" "access-level-conditions" { - access_level = google_access_context_manager_access_level.access-level-service-account.name - ip_subnetworks = ["192.0.4.0/24"] - members = ["user:test@google.com", "user:test2@google.com", "serviceAccount:${google_service_account.created-later.email}"] - negate = false - device_policy { - require_screen_lock = false - require_admin_approval = false - require_corp_owned = true - os_constraints { - os_type = "DESKTOP_CHROME_OS" - } - } - regions = [ - "IT", - "US", - ] -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_access_level_with_vpc_network_sources.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_access_level_with_vpc_network_sources.tf.tmpl deleted file mode 100644 index 850fa022a305..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_access_level_with_vpc_network_sources.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_compute_network" "vpc_network" { - name = "tf-test" -} - -resource "google_access_context_manager_access_level" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" - title = "{{index $.Vars "access_level_name"}}" - basic { - conditions { - vpc_network_sources { - vpc_subnetwork { - network = "//compute.googleapis.com/${google_compute_network.vpc_network.id}" - vpc_ip_subnetworks = ["20.0.5.0/24"] - } - } - } - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_access_levels_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_access_levels_basic.tf.tmpl deleted file mode 100644 index d195e704f687..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_access_levels_basic.tf.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -resource "google_access_context_manager_access_levels" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - access_levels { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name1"}}" - title = "{{index $.Vars "access_level_name1"}}" - basic { - conditions { - device_policy { - require_screen_lock = true - os_constraints { - os_type = "DESKTOP_CHROME_OS" - } - } - regions = [ - "CH", - "IT", - "US", - ] - } - } - } - - access_levels { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name2"}}" - title = "{{index $.Vars "access_level_name2"}}" - basic { - conditions { - device_policy { - require_screen_lock = true - os_constraints { - os_type = "DESKTOP_MAC" - } - } - regions = [ - "CH", - "IT", - "US", - ] - } - } - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_access_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_access_policy_basic.tf.tmpl deleted file mode 100644 index 8c7f81101207..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_access_policy_basic.tf.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -resource "google_access_context_manager_access_policy" "{{$.PrimaryResourceId}}" { - parent = "organizations/123456789" - title = "Org Access Policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_access_policy_scoped.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_access_policy_scoped.tf.tmpl deleted file mode 100644 index b031c076fddc..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_access_policy_scoped.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_project" "project" { - project_id = "{{index $.TestEnvVars "project"}}" - name = "{{index $.TestEnvVars "project"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} - -resource "google_access_context_manager_access_policy" "{{$.PrimaryResourceId}}" { - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - title = "Scoped Access Policy" - scopes = ["projects/${google_project.project.number}"] -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_authorized_orgs_desc_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_authorized_orgs_desc_basic.tf.tmpl deleted file mode 100644 index 021fbf11b097..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_authorized_orgs_desc_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_access_context_manager_authorized_orgs_desc" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}/authorizedOrgsDescs/fakeDescName" - authorization_type = "AUTHORIZATION_TYPE_TRUST" - asset_type = "ASSET_TYPE_CREDENTIAL_STRENGTH" - authorization_direction = "AUTHORIZATION_DIRECTION_TO" - orgs = ["organizations/12345", "organizations/98765"] -} - -resource "google_access_context_manager_access_policy" "test-access" { - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_gcp_user_access_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_gcp_user_access_binding_basic.tf.tmpl deleted file mode 100644 index 75e4ab34af05..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_gcp_user_access_binding_basic.tf.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -resource "google_cloud_identity_group" "group" { - display_name = "{{index $.Vars "group_id"}}" - - parent = "customers/{{index $.TestEnvVars "cust_id"}}" - - group_key { - id = "{{index $.Vars "group_id"}}@{{index $.TestEnvVars "org_domain"}}" - } - - labels = { - "cloudidentity.googleapis.com/groups.discussion_forum" = "" - } -} - -resource "google_access_context_manager_access_level" "{{index $.Vars "access_level_id"}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" - title = "{{index $.Vars "access_level_name"}}" - basic { - conditions { - device_policy { - require_screen_lock = true - os_constraints { - os_type = "DESKTOP_CHROME_OS" - } - } - regions = [ - "US", - ] - } - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - title = "my policy" -} - - - -resource "google_access_context_manager_gcp_user_access_binding" "{{$.PrimaryResourceId}}" { - organization_id = "{{index $.TestEnvVars "org_id"}}" - group_key = trimprefix(google_cloud_identity_group.group.id, "groups/") - access_levels = [ - google_access_context_manager_access_level.{{index $.Vars "access_level_id"}}.name, - ] -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_basic.tf.tmpl deleted file mode 100644 index 60a0e34bd3ed..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_basic.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -resource "google_access_context_manager_service_perimeter" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name"}}" - title = "{{index $.Vars "service_perimeter_name"}}" - status { - restricted_services = ["storage.googleapis.com"] - } -} - -resource "google_access_context_manager_access_level" "access-level" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" - title = "{{index $.Vars "access_level_name"}}" - basic { - conditions { - device_policy { - require_screen_lock = false - os_constraints { - os_type = "DESKTOP_CHROME_OS" - } - } - regions = [ - "CH", - "IT", - "US", - ] - } - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry-run.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry-run.tf.tmpl deleted file mode 100644 index 49c5470bff20..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry-run.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_access_context_manager_service_perimeter" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name"}}" - title = "{{index $.Vars "service_perimeter_name"}}" - - # Service 'bigquery.googleapis.com' will be restricted. - status { - restricted_services = ["bigquery.googleapis.com"] - } - - # Service 'storage.googleapis.com' will be in dry-run mode. - spec { - restricted_services = ["storage.googleapis.com"] - } - - use_explicit_dry_run_spec = true - -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_egress_policy.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_egress_policy.tf.tmpl deleted file mode 100644 index 17561629da0e..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_egress_policy.tf.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -resource "google_access_context_manager_service_perimeter" "storage-perimeter" { - parent = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}/serviceperimeters/storage-perimeter" - title = "Storage Perimeter" - spec { - restricted_services = ["storage.googleapis.com"] - } - lifecycle { - ignore_changes = [status[0].resources] - } -} - -resource "google_access_context_manager_service_perimeter_dry_run_egress_policy" "egress_policy" { - perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" - egress_from { - identity_type = "ANY_IDENTITY" - } - egress_to { - resources = ["*"] - operations { - service_name = "bigquery.googleapis.com" - method_selectors { - method = "*" - } - } - } - lifecycle { - create_before_destroy = true - } -} - - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "Storage Policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_ingress_policy.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_ingress_policy.tf.tmpl deleted file mode 100644 index df981c843515..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_ingress_policy.tf.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -resource "google_access_context_manager_service_perimeter" "storage-perimeter" { - parent = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}/serviceperimeters/storage-perimeter" - title = "Storage Perimeter" - status { - restricted_services = ["storage.googleapis.com"] - } - lifecycle { - ignore_changes = [status[0].resources] - } -} - -resource "google_access_context_manager_service_perimeter_dry_run_ingress_policy" "ingress_policy" { - perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" - ingress_from { - identity_type = "any_identity" - sources { - access_level = "*" - } - } - ingress_to { - resources = ["*"] - operations { - service_name = "bigquery.googleapis.com" - method_selectors { - method = "*" - } - } - } - lifecycle { - create_before_destroy = true - } -} - - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "Storage Policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_resource_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_resource_basic.tf.tmpl deleted file mode 100644 index 6237c635567e..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_dry_run_resource_basic.tf.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -resource "google_access_context_manager_service_perimeter_dry_run_resource" "{{$.PrimaryResourceId}}" { - perimeter_name = google_access_context_manager_service_perimeter.{{$.PrimaryResourceId}}.name - resource = "projects/987654321" -} - -resource "google_access_context_manager_service_perimeter" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name"}}" - title = "{{index $.Vars "service_perimeter_name"}}" - spec { - restricted_services = ["storage.googleapis.com"] - } - use_explicit_dry_run_spec = true - lifecycle { - ignore_changes = [spec[0].resources] - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_egress_policy.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_egress_policy.tf.tmpl deleted file mode 100644 index 7ea39e59976f..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_egress_policy.tf.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -resource "google_access_context_manager_service_perimeter" "storage-perimeter" { - parent = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}/serviceperimeters/storage-perimeter" - title = "Storage Perimeter" - status { - restricted_services = ["storage.googleapis.com"] - } - lifecycle { - ignore_changes = [status[0].resources] - } -} - -resource "google_access_context_manager_service_perimeter_egress_policy" "egress_policy" { - perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" - egress_from { - identity_type = "ANY_IDENTITY" - } - egress_to { - resources = ["*"] - operations { - service_name = "bigquery.googleapis.com" - method_selectors { - method = "*" - } - } - } - lifecycle { - create_before_destroy = true - } -} - - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "Storage Policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_ingress_policy.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_ingress_policy.tf.tmpl deleted file mode 100644 index b54c62bcc207..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_ingress_policy.tf.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -resource "google_access_context_manager_service_perimeter" "storage-perimeter" { - parent = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}/serviceperimeters/storage-perimeter" - title = "Storage Perimeter" - status { - restricted_services = ["storage.googleapis.com"] - } - lifecycle { - ignore_changes = [status[0].resources] - } -} - -resource "google_access_context_manager_service_perimeter_ingress_policy" "ingress_policy" { - perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" - ingress_from { - identity_type = "any_identity" - sources { - access_level = "*" - } - } - ingress_to { - resources = ["*"] - operations { - service_name = "bigquery.googleapis.com" - method_selectors { - method = "*" - } - } - } - lifecycle { - create_before_destroy = true - } -} - - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "Storage Policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_resource_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_resource_basic.tf.tmpl deleted file mode 100644 index 5644cb7b5b4d..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_resource_basic.tf.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -resource "google_access_context_manager_service_perimeter_resource" "{{$.PrimaryResourceId}}" { - perimeter_name = google_access_context_manager_service_perimeter.{{$.PrimaryResourceId}}.name - resource = "projects/987654321" -} - -resource "google_access_context_manager_service_perimeter" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name"}}" - title = "{{index $.Vars "service_perimeter_name"}}" - status { - restricted_services = ["storage.googleapis.com"] - } - - lifecycle { - ignore_changes = [status[0].resources] - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_secure_data_exchange.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_secure_data_exchange.tf.tmpl deleted file mode 100644 index 25d2dd77a041..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeter_secure_data_exchange.tf.tmpl +++ /dev/null @@ -1,107 +0,0 @@ -resource "google_access_context_manager_service_perimeters" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - - service_perimeters { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name1"}}" - title = "{{index $.Vars "service_perimeter_name1"}}" - status { - restricted_services = ["storage.googleapis.com"] - } - } - - service_perimeters { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name2"}}" - title = "{{index $.Vars "service_perimeter_name2"}}" - status { - restricted_services = ["bigtable.googleapis.com"] - vpcAccessibleServices = { - enableRestriction = true - allowedServices = ["bigquery.googleapis.com"] - } - } - } -} - -resource "google_access_context_manager_access_level" "access-level" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" - title = "{{index $.Vars "access_level_name"}}" - basic { - conditions { - device_policy { - require_screen_lock = false - os_constraints { - os_type = "DESKTOP_CHROME_OS" - } - } - regions = [ - "CH", - "IT", - "US", - ] - } - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} - -resource "google_access_context_manager_service_perimeter" "test-access" { - parent = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}/servicePerimeters/%s" - title = "%s" - perimeter_type = "PERIMETER_TYPE_REGULAR" - status { - restricted_services = ["bigquery.googleapis.com", "storage.googleapis.com"] - access_levels = [google_access_context_manager_access_level.access-level.name] - - vpc_accessible_services { - enable_restriction = true - allowed_services = ["bigquery.googleapis.com", "storage.googleapis.com"] - } - - ingress_policies { - ingress_from { - sources { - access_level = google_access_context_manager_access_level.test-access.name - } - identity_type = "ANY_IDENTITY" - } - - ingress_to { - resources = [ "*" ] - operations { - service_name = "bigquery.googleapis.com" - - method_selectors { - method = "BigQueryStorage.ReadRows" - } - - method_selectors { - method = "TableService.ListTables" - } - - method_selectors { - permission = "bigquery.jobs.get" - } - } - - operations { - service_name = "storage.googleapis.com" - - method_selectors { - method = "google.storage.objects.create" - } - } - } - } - - egress_policies { - egress_from { - identity_type = "ANY_USER_ACCOUNT" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeters_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeters_basic.tf.tmpl deleted file mode 100644 index c127f9b8fca8..000000000000 --- a/mmv1/templates/terraform/examples/go/access_context_manager_service_perimeters_basic.tf.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -resource "google_access_context_manager_service_perimeters" "{{$.PrimaryResourceId}}" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - - service_perimeters { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name1"}}" - title = "{{index $.Vars "service_perimeter_name1"}}" - status { - restricted_services = ["storage.googleapis.com"] - } - } - - service_perimeters { - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/servicePerimeters/{{index $.Vars "service_perimeter_name2"}}" - title = "{{index $.Vars "service_perimeter_name2"}}" - status { - restricted_services = ["bigtable.googleapis.com"] - } - } -} - -resource "google_access_context_manager_access_level" "access-level" { - parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_name"}}" - title = "{{index $.Vars "access_level_name"}}" - basic { - conditions { - device_policy { - require_screen_lock = false - os_constraints { - os_type = "DESKTOP_CHROME_OS" - } - } - regions = [ - "CH", - "IT", - "US", - ] - } - } -} - -resource "google_access_context_manager_access_policy" "access-policy" { - parent = "organizations/123456789" - title = "my policy" -} diff --git a/mmv1/templates/terraform/examples/go/active_directory_domain_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/active_directory_domain_basic.tf.tmpl deleted file mode 100644 index 665ad26f8754..000000000000 --- a/mmv1/templates/terraform/examples/go/active_directory_domain_basic.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_active_directory_domain" "ad-domain" { - domain_name = "{{index $.Vars "domain_name"}}.org.com" - locations = ["us-central1"] - reserved_ip_range = "192.168.255.0/24" - deletion_protection = false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/active_directory_domain_trust_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/active_directory_domain_trust_basic.tf.tmpl deleted file mode 100644 index c1f9cf61d676..000000000000 --- a/mmv1/templates/terraform/examples/go/active_directory_domain_trust_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_active_directory_domain_trust" "ad-domain-trust" { - domain = "test-managed-ad.com" - target_domain_name = "example-gcp.com" - target_dns_ip_addresses = ["10.1.0.100"] - trust_direction = "OUTBOUND" - trust_type = "FOREST" - trust_handshake_secret = "Testing1!" - deletion_protection = false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/active_directory_peering_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/active_directory_peering_basic.tf.tmpl deleted file mode 100644 index e18ce41918ff..000000000000 --- a/mmv1/templates/terraform/examples/go/active_directory_peering_basic.tf.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -resource "google_active_directory_peering" "ad-domain-peering" { - provider = google-beta - domain_resource = google_active_directory_domain.ad-domain.name - peering_id = "ad-domain-peering" - authorized_network = google_compute_network.peered-network.id - deletion_protection = false - labels = { - foo = "bar" - } -} - -resource "google_active_directory_domain" "ad-domain" { - provider = google-beta - domain_name = "{{index $.Vars "domain_name"}}" - locations = ["us-central1"] - reserved_ip_range = "192.168.255.0/24" - authorized_networks = [google_compute_network.source-network.id] - deletion_protection = false -} - -resource "google_compute_network" "peered-network" { - provider = google-beta - project = google_project_service.compute.project - name = "ad-peered-network" -} - -resource "google_compute_network" "source-network" { - provider = google-beta - name = "ad-network" -} - -resource "google_project_service" "compute" { - provider = google-beta - project = google_project.peered-project.project_id - service = "compute.googleapis.com" -} - -resource "google_project" "peered-project" { - provider = google-beta - name = "{{index $.Vars "project_id"}}" - project_id = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/address_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/address_basic.tf.tmpl deleted file mode 100644 index b2ad4d9779c4..000000000000 --- a/mmv1/templates/terraform/examples/go/address_basic.tf.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -resource "google_compute_address" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "address_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/address_with_gce_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/go/address_with_gce_endpoint.tf.tmpl deleted file mode 100644 index 75d52bf10795..000000000000 --- a/mmv1/templates/terraform/examples/go/address_with_gce_endpoint.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_compute_address" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "address_name"}}" - address_type = "INTERNAL" - purpose = "GCE_ENDPOINT" -} diff --git a/mmv1/templates/terraform/examples/go/address_with_shared_loadbalancer_vip.tf.tmpl b/mmv1/templates/terraform/examples/go/address_with_shared_loadbalancer_vip.tf.tmpl deleted file mode 100644 index 1737f885cd9c..000000000000 --- a/mmv1/templates/terraform/examples/go/address_with_shared_loadbalancer_vip.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_compute_address" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "address_name"}}" - address_type = "INTERNAL" - purpose = "SHARED_LOADBALANCER_VIP" -} diff --git a/mmv1/templates/terraform/examples/go/address_with_subnetwork.tf.tmpl b/mmv1/templates/terraform/examples/go/address_with_subnetwork.tf.tmpl deleted file mode 100644 index 4e6eb8049ba8..000000000000 --- a/mmv1/templates/terraform/examples/go/address_with_subnetwork.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "subnetwork_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.default.id -} - -resource "google_compute_address" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "address_name"}}" - subnetwork = google_compute_subnetwork.default.id - address_type = "INTERNAL" - address = "10.0.42.42" - region = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/agent_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/agent_pool_basic.tf.tmpl deleted file mode 100644 index 88f8b8c2c3a8..000000000000 --- a/mmv1/templates/terraform/examples/go/agent_pool_basic.tf.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -data "google_storage_transfer_project_service_account" "default" { - project = "{{index $.TestEnvVars "project_id"}}" -} - -resource "google_project_iam_member" "pubsub_editor_role" { - project = "{{index $.TestEnvVars "project_id"}}" - role = "roles/pubsub.editor" - member = "serviceAccount:${data.google_storage_transfer_project_service_account.default.email}" -} - -resource "google_storage_transfer_agent_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "agent-pool-name"}}" - display_name = "Source A to destination Z" - bandwidth_limit { - limit_mbps = "120" - } - - depends_on = [google_project_iam_member.pubsub_editor_role] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/alloydb_backup_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_backup_basic.tf.tmpl deleted file mode 100644 index a78ce7463f6a..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_backup_basic.tf.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { - location = "us-central1" - backup_id = "{{index $.Vars "alloydb_backup_id"}}" - cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - - depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = google_compute_network.default.id - } -} - -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" - - depends_on = [google_service_networking_connection.vpc_connection] -} - -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "alloydb_cluster_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 16 - network = google_compute_network.default.id -} - -resource "google_service_networking_connection" "vpc_connection" { - network = google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_backup_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_backup_basic_test.tf.tmpl deleted file mode 100644 index b09d5a4be7ef..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_backup_basic_test.tf.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { - location = "us-central1" - backup_id = "{{index $.Vars "alloydb_backup_id"}}" - cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - - depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } -} - -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" -} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_backup_full.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_backup_full.tf.tmpl deleted file mode 100644 index 563fdcbac298..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_backup_full.tf.tmpl +++ /dev/null @@ -1,46 +0,0 @@ -resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { - location = "us-central1" - backup_id = "{{index $.Vars "alloydb_backup_id"}}" - cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - - description = "example description" - type = "ON_DEMAND" - labels = { - "label" = "key" - } - depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = google_compute_network.default.id - } -} - -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" - - depends_on = [google_service_networking_connection.vpc_connection] -} - -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "alloydb_cluster_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 16 - network = google_compute_network.default.id -} - -resource "google_service_networking_connection" "vpc_connection" { - network = google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_backup_full_test.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_backup_full_test.tf.tmpl deleted file mode 100644 index 218bc7ee3bed..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_backup_full_test.tf.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { - location = "us-central1" - backup_id = "{{index $.Vars "alloydb_backup_id"}}" - cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - - description = "example description" - type = "ON_DEMAND" - labels = { - "label" = "key" - } - depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } -} - -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" -} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_cluster_basic.tf.tmpl deleted file mode 100644 index c9bab8098b43..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_cluster_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = google_compute_network.default.id - } -} - -data "google_project" "project" {} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "alloydb_cluster_name"}}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/alloydb_cluster_full.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_cluster_full.tf.tmpl deleted file mode 100644 index 2b0c9e4c9f63..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_cluster_full.tf.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = google_compute_network.default.id - } - database_version = "POSTGRES_15" - - initial_user { - user = "{{index $.Vars "alloydb_cluster_name"}}" - password = "{{index $.Vars "alloydb_cluster_name"}}" - } - - continuous_backup_config { - enabled = true - recovery_window_days = 14 - } - - automated_backup_policy { - location = "us-central1" - backup_window = "1800s" - enabled = true - - weekly_schedule { - days_of_week = ["MONDAY"] - - start_times { - hours = 23 - minutes = 0 - seconds = 0 - nanos = 0 - } - } - - quantity_based_retention { - count = 1 - } - - labels = { - test = "{{index $.Vars "alloydb_cluster_name"}}" - } - } - - labels = { - test = "{{index $.Vars "alloydb_cluster_name"}}" - } -} - -data "google_project" "project" {} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "alloydb_cluster_name"}}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/alloydb_cluster_restore.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_cluster_restore.tf.tmpl deleted file mode 100644 index 7713276440e6..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_cluster_restore.tf.tmpl +++ /dev/null @@ -1,72 +0,0 @@ -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network = data.google_compute_network.default.id - - initial_user { - password = "{{index $.Vars "alloydb_cluster_name"}}" - } -} - -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } - - depends_on = [google_service_networking_connection.vpc_connection] -} - -resource "google_alloydb_backup" "{{$.PrimaryResourceId}}" { - backup_id = "{{index $.Vars "alloydb_backup_id"}}" - location = "us-central1" - cluster_name = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - - depends_on = [google_alloydb_instance.{{$.PrimaryResourceId}}] -} - -resource "google_alloydb_cluster" "restored_from_backup" { - cluster_id = "{{index $.Vars "alloydb_backup_restored_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } - restore_backup_source { - backup_name = google_alloydb_backup.{{$.PrimaryResourceId}}.name - } -} - -resource "google_alloydb_cluster" "restored_via_pitr" { - cluster_id = "{{index $.Vars "alloydb_pitr_restored_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } - restore_continuous_backup_source { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - point_in_time = "2023-08-03T19:19:00.094Z" - } -} - -data "google_project" "project" {} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "alloydb_cluster_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 16 - network = data.google_compute_network.default.id -} - -resource "google_service_networking_connection" "vpc_connection" { - network = data.google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_instance_basic.tf.tmpl deleted file mode 100644 index 575c2a6ed790..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_instance_basic.tf.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } - - depends_on = [google_service_networking_connection.vpc_connection] -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = google_compute_network.default.id - } - - initial_user { - password = "{{index $.Vars "alloydb_cluster_name"}}" - } -} - -data "google_project" "project" {} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "alloydb_cluster_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 16 - network = google_compute_network.default.id -} - -resource "google_service_networking_connection" "vpc_connection" { - network = google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/alloydb_instance_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_instance_basic_test.tf.tmpl deleted file mode 100644 index 0ca5146f0ac8..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_instance_basic_test.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } - initial_user { - password = "{{index $.Vars "alloydb_cluster_name"}}" - } -} - -data "google_project" "project" {} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_instance_psc_test.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_instance_psc_test.tf.tmpl deleted file mode 100644 index d2d4712d0ae7..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_instance_psc_test.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - - initial_user { - password = "{{index $.Vars "alloydb_cluster_name"}}" - } - psc_config { - psc_enabled = true - } -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_secondary_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_secondary_cluster_basic.tf.tmpl deleted file mode 100644 index 6911d955d778..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_secondary_cluster_basic.tf.tmpl +++ /dev/null @@ -1,58 +0,0 @@ -resource "google_alloydb_cluster" "primary" { - cluster_id = "{{index $.Vars "alloydb_primary_cluster_name"}}" - location = "us-central1" - network_config { - network = google_compute_network.default.id - } -} - -resource "google_alloydb_instance" "primary" { - cluster = google_alloydb_cluster.primary.name - instance_id = "{{index $.Vars "alloydb_primary_instance_name"}}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } - - depends_on = [google_service_networking_connection.vpc_connection] -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_secondary_cluster_name"}}" - location = "us-east1" - network_config { - network = google_compute_network.default.id - } - cluster_type = "SECONDARY" - - continuous_backup_config { - enabled = false - } - - secondary_config { - primary_cluster_name = google_alloydb_cluster.primary.name - } - - depends_on = [google_alloydb_instance.primary] -} - -data "google_project" "project" {} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "alloydb_secondary_cluster_name"}}" -} - -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "alloydb_secondary_cluster_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 16 - network = google_compute_network.default.id -} - -resource "google_service_networking_connection" "vpc_connection" { - network = google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/alloydb_secondary_cluster_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_secondary_cluster_basic_test.tf.tmpl deleted file mode 100644 index 9b04de5953d4..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_secondary_cluster_basic_test.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -resource "google_alloydb_cluster" "primary" { - cluster_id = "{{index $.Vars "alloydb_primary_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } -} - -resource "google_alloydb_instance" "primary" { - cluster = google_alloydb_cluster.primary.name - instance_id = "{{index $.Vars "alloydb_primary_instance_name"}}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } -} - -resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "alloydb_secondary_cluster_name"}}" - location = "us-east1" - network_config { - network = data.google_compute_network.default.id - } - cluster_type = "SECONDARY" - - continuous_backup_config { - enabled = false - } - - secondary_config { - primary_cluster_name = google_alloydb_cluster.primary.name - } - - depends_on = [google_alloydb_instance.primary] -} - -data "google_project" "project" {} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_secondary_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_secondary_instance_basic.tf.tmpl deleted file mode 100644 index 8e2eeb44e88d..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_secondary_instance_basic.tf.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -resource "google_alloydb_cluster" "primary" { - cluster_id = "{{index $.Vars "alloydb_primary_cluster_name"}}" - location = "us-central1" - network_config { - network = google_compute_network.default.id - } -} - -resource "google_alloydb_instance" "primary" { - cluster = google_alloydb_cluster.primary.name - instance_id = "{{index $.Vars "alloydb_primary_instance_name"}}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } - - depends_on = [google_service_networking_connection.vpc_connection] -} - -resource "google_alloydb_cluster" "secondary" { - cluster_id = "{{index $.Vars "alloydb_secondary_cluster_name"}}" - location = "us-east1" - network_config { - network = data.google_compute_network.default.id - } - cluster_type = "SECONDARY" - - continuous_backup_config { - enabled = false - } - - secondary_config { - primary_cluster_name = google_alloydb_cluster.primary.name - } - - deletion_policy = "FORCE" - - # Need lifecycle.ignore_changes because instance_type is an immutable field. - # And when promoting cluster from SECONDARY to PRIMARY, the instance_type of the associated secondary instance also changes and becomes PRIMARY. - # And we do not want terraform to destroy and create the instance because the field is immutable - lifecycle { - ignore_changes = [instance_type] - } - - depends_on = [google_alloydb_instance.primary] -} - -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.secondary.name - instance_id = "{{index $.Vars "alloydb_secondary_instance_name"}}" - instance_type = google_alloydb_cluster.secondary.cluster_type - - machine_config { - cpu_count = 2 - } - - depends_on = [google_service_networking_connection.vpc_connection] -} - -data "google_project" "project" {} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "alloydb_secondary_instance_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 16 - network = google_compute_network.default.id -} - -resource "google_service_networking_connection" "vpc_connection" { - network = google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_secondary_instance_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_secondary_instance_basic_test.tf.tmpl deleted file mode 100644 index 432fd4d91e80..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_secondary_instance_basic_test.tf.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -resource "google_alloydb_cluster" "primary" { - cluster_id = "{{index $.Vars "alloydb_primary_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } -} - -resource "google_alloydb_instance" "primary" { - cluster = google_alloydb_cluster.primary.name - instance_id = "{{index $.Vars "alloydb_primary_instance_name"}}" - instance_type = "PRIMARY" - - machine_config { - cpu_count = 2 - } -} - -resource "google_alloydb_cluster" "secondary" { - cluster_id = "{{index $.Vars "alloydb_secondary_cluster_name"}}" - location = "us-east1" - network_config { - network = data.google_compute_network.default.id - } - cluster_type = "SECONDARY" - - continuous_backup_config { - enabled = false - } - - secondary_config { - primary_cluster_name = google_alloydb_cluster.primary.name - } - - deletion_policy = "FORCE" - - depends_on = [google_alloydb_instance.primary] -} - -resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.secondary.name - instance_id = "{{index $.Vars "alloydb_secondary_instance_name"}}" - instance_type = google_alloydb_cluster.secondary.cluster_type - - machine_config { - cpu_count = 2 - } -} - -data "google_project" "project" {} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/alloydb_user_builtin.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_user_builtin.tf.tmpl deleted file mode 100644 index b91e92abddce..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_user_builtin.tf.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -resource "google_alloydb_instance" "default" { - cluster = google_alloydb_cluster.default.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" - - depends_on = [google_service_networking_connection.vpc_connection] -} - -resource "google_alloydb_cluster" "default" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } - initial_user { - password = "{{index $.Vars "alloydb_cluster_pass"}}" - } -} - -data "google_project" "project" {} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "alloydb_cluster_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 16 - network = google_compute_network.default.id -} - -resource "google_service_networking_connection" "vpc_connection" { - network = google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} - -resource "google_alloydb_user" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.default.name - user_id = "{{index $.Vars "alloydb_user_name"}}" - user_type = "ALLOYDB_BUILT_IN" - - password = "{{index $.Vars "alloydb_user_pass"}}" - database_roles = ["alloydbsuperuser"] - depends_on = [google_alloydb_instance.default] -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_user_builtin_test.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_user_builtin_test.tf.tmpl deleted file mode 100644 index 01d0f92dd77c..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_user_builtin_test.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -resource "google_alloydb_instance" "default" { - cluster = google_alloydb_cluster.default.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" -} - -resource "google_alloydb_cluster" "default" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } - initial_user { - password = "{{index $.Vars "alloydb_cluster_pass"}}" - } -} - -data "google_project" "project" {} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - - -resource "google_alloydb_user" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.default.name - user_id = "{{index $.Vars "alloydb_user_name"}}" - user_type = "ALLOYDB_BUILT_IN" - - password = "{{index $.Vars "alloydb_user_pass"}}" - database_roles = ["alloydbsuperuser"] - depends_on = [google_alloydb_instance.default] -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_user_iam.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_user_iam.tf.tmpl deleted file mode 100644 index 107cdaf25b3f..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_user_iam.tf.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -resource "google_alloydb_instance" "default" { - cluster = google_alloydb_cluster.default.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" - - depends_on = [google_service_networking_connection.vpc_connection] -} - -resource "google_alloydb_cluster" "default" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = google_compute_network.default.id - } - - initial_user { - password = "{{index $.Vars "alloydb_cluster_pass"}}" - } -} - -data "google_project" "project" {} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "alloydb_cluster_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 16 - network = google_compute_network.default.id -} - -resource "google_service_networking_connection" "vpc_connection" { - network = google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} - -resource "google_alloydb_user" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.default.name - user_id = "{{index $.Vars "alloydb_user_name"}}" - user_type = "ALLOYDB_IAM_USER" - - database_roles = ["alloydbiamuser"] - depends_on = [google_alloydb_instance.default] -} diff --git a/mmv1/templates/terraform/examples/go/alloydb_user_iam_test.tf.tmpl b/mmv1/templates/terraform/examples/go/alloydb_user_iam_test.tf.tmpl deleted file mode 100644 index eebb03454761..000000000000 --- a/mmv1/templates/terraform/examples/go/alloydb_user_iam_test.tf.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -resource "google_alloydb_instance" "default" { - cluster = google_alloydb_cluster.default.name - instance_id = "{{index $.Vars "alloydb_instance_name"}}" - instance_type = "PRIMARY" -} - -resource "google_alloydb_cluster" "default" { - cluster_id = "{{index $.Vars "alloydb_cluster_name"}}" - location = "us-central1" - network_config { - network = data.google_compute_network.default.id - } - initial_user { - password = "{{index $.Vars "alloydb_cluster_pass"}}" - } -} - -data "google_project" "project" {} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_alloydb_user" "{{$.PrimaryResourceId}}" { - cluster = google_alloydb_cluster.default.name - user_id = "{{index $.Vars "alloydb_user_name"}}" - user_type = "ALLOYDB_IAM_USER" - - database_roles = ["alloydbiamuser"] - depends_on = [google_alloydb_instance.default] -} diff --git a/mmv1/templates/terraform/examples/go/apigateway_api_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigateway_api_basic.tf.tmpl deleted file mode 100644 index f045b9b085e3..000000000000 --- a/mmv1/templates/terraform/examples/go/apigateway_api_basic.tf.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_id = "{{index $.Vars "api_id"}}" -} diff --git a/mmv1/templates/terraform/examples/go/apigateway_api_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigateway_api_config_basic.tf.tmpl deleted file mode 100644 index e0c35f8cb8a6..000000000000 --- a/mmv1/templates/terraform/examples/go/apigateway_api_config_basic.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_id = "{{index $.Vars "api_id"}}" -} - -resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { - provider = google-beta - api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id - api_config_id = "{{index $.Vars "config_id"}}" - - openapi_documents { - document { - path = "spec.yaml" - contents = filebase64("test-fixtures/openapi.yaml") - } - } - lifecycle { - create_before_destroy = true - } -} diff --git a/mmv1/templates/terraform/examples/go/apigateway_api_config_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apigateway_api_config_full.tf.tmpl deleted file mode 100644 index c0d7a1b90193..000000000000 --- a/mmv1/templates/terraform/examples/go/apigateway_api_config_full.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_id = "{{index $.Vars "api_id"}}" -} - -resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { - provider = google-beta - api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id - api_config_id = "{{index $.Vars "config_id"}}" - display_name = "MM Dev API Config" - labels = { - environment = "dev" - } - - openapi_documents { - document { - path = "spec.yaml" - contents = filebase64("test-fixtures/openapi.yaml") - } - } -} diff --git a/mmv1/templates/terraform/examples/go/apigateway_api_config_grpc.tf.tmpl b/mmv1/templates/terraform/examples/go/apigateway_api_config_grpc.tf.tmpl deleted file mode 100644 index d6828333f17c..000000000000 --- a/mmv1/templates/terraform/examples/go/apigateway_api_config_grpc.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_id = "{{index $.Vars "api_id"}}" -} - -resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { - provider = google-beta - api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id - api_config_id = "{{index $.Vars "config_id"}}" - - grpc_services { - file_descriptor_set { - path = "api_descriptor.pb" - contents = filebase64("test-fixtures/api_descriptor.pb") - } - } - managed_service_configs { - path = "api_config.yaml" - contents = base64encode(<<-EOF - type: google.api.Service - config_version: 3 - name: ${google_api_gateway_api.{{$.PrimaryResourceId}}.managed_service} - title: gRPC API example - apis: - - name: endpoints.examples.bookstore.Bookstore - usage: - rules: - - selector: endpoints.examples.bookstore.Bookstore.ListShelves - allow_unregistered_calls: true - backend: - rules: - - selector: "*" - address: grpcs://example.com - disable_auth: true - - EOF - ) - } - lifecycle { - create_before_destroy = true - } -} diff --git a/mmv1/templates/terraform/examples/go/apigateway_api_config_grpc_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apigateway_api_config_grpc_full.tf.tmpl deleted file mode 100644 index edd4b4799227..000000000000 --- a/mmv1/templates/terraform/examples/go/apigateway_api_config_grpc_full.tf.tmpl +++ /dev/null @@ -1,46 +0,0 @@ -resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_id = "{{index $.Vars "api_id"}}" -} - -resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { - provider = google-beta - api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id - api_config_id = "{{index $.Vars "config_id"}}" - - grpc_services { - file_descriptor_set { - path = "api_descriptor.pb" - contents = filebase64("test-fixtures/api_descriptor.pb") - } - source { - path = "bookstore.proto" - contents = filebase64("test-fixtures/bookstore.proto") - } - } - managed_service_configs { - path = "api_config.yaml" - contents = base64encode(<<-EOF - type: google.api.Service - config_version: 3 - name: ${google_api_gateway_api.{{$.PrimaryResourceId}}.managed_service} - title: gRPC API example - apis: - - name: endpoints.examples.bookstore.Bookstore - usage: - rules: - - selector: endpoints.examples.bookstore.Bookstore.ListShelves - allow_unregistered_calls: true - backend: - rules: - - selector: "*" - address: grpcs://example.com - disable_auth: true - - EOF - ) - } - lifecycle { - create_before_destroy = true - } -} diff --git a/mmv1/templates/terraform/examples/go/apigateway_api_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apigateway_api_full.tf.tmpl deleted file mode 100644 index fa8d669d4e06..000000000000 --- a/mmv1/templates/terraform/examples/go/apigateway_api_full.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_id = "{{index $.Vars "api_id"}}" - display_name = "MM Dev API" - labels = { - environment = "dev" - } -} diff --git a/mmv1/templates/terraform/examples/go/apigateway_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigateway_gateway_basic.tf.tmpl deleted file mode 100644 index eec7f80440b9..000000000000 --- a/mmv1/templates/terraform/examples/go/apigateway_gateway_basic.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_id = "{{index $.Vars "api_id"}}" -} - -resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { - provider = google-beta - api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id - api_config_id = "{{index $.Vars "config_id"}}" - - openapi_documents { - document { - path = "spec.yaml" - contents = filebase64("test-fixtures/openapi.yaml") - } - } - lifecycle { - create_before_destroy = true - } -} - -resource "google_api_gateway_gateway" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_config = google_api_gateway_api_config.{{$.PrimaryResourceId}}.id - gateway_id = "{{index $.Vars "gateway_id"}}" -} diff --git a/mmv1/templates/terraform/examples/go/apigateway_gateway_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apigateway_gateway_full.tf.tmpl deleted file mode 100644 index acb4c7f689e2..000000000000 --- a/mmv1/templates/terraform/examples/go/apigateway_gateway_full.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_api_gateway_api" "{{$.PrimaryResourceId}}" { - provider = google-beta - api_id = "{{index $.Vars "api_id"}}" -} - -resource "google_api_gateway_api_config" "{{$.PrimaryResourceId}}" { - provider = google-beta - api = google_api_gateway_api.{{$.PrimaryResourceId}}.api_id - api_config_id = "{{index $.Vars "config_id"}}" - - openapi_documents { - document { - path = "spec.yaml" - contents = filebase64("test-fixtures/openapi.yaml") - } - } -} - -resource "google_api_gateway_gateway" "{{$.PrimaryResourceId}}" { - provider = google-beta - region = "us-central1" - api_config = google_api_gateway_api_config.{{$.PrimaryResourceId}}.id - gateway_id = "{{index $.Vars "gateway_id"}}" - display_name = "MM Dev API Gateway" - labels = { - environment = "dev" - } -} diff --git a/mmv1/templates/terraform/examples/go/apigee_addons_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_addons_basic.tf.tmpl deleted file mode 100644 index 4de0a107b412..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_addons_basic.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_apigee_addons_config" "test_organization" { - org = "test_organization" - - addons_config { - api_security_config { - enabled = true - } - monetization_config { - enabled = true - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/apigee_addons_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_addons_full.tf.tmpl deleted file mode 100644 index 758ba6e32636..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_addons_full.tf.tmpl +++ /dev/null @@ -1,70 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_project_service" "apigee" { - project = data.google_client_config.current.project - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = data.google_client_config.current.project - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = data.google_client_config.current.project - service = "servicenetworking.googleapis.com" -} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" - project = data.google_client_config.current.project - 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 = data.google_client_config.current.project -} - -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] -} - -resource "google_apigee_organization" "org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - billing_type = "EVALUATION" - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_project_service.apigee - ] -} - -resource "google_apigee_addons_config" "test_organization" { - org = google_apigee_organization.org.name - - addons_config { - integration_config { - enabled = true - } - api_security_config { - enabled = true - } - connectors_platform_config { - enabled = true - } - monetization_config { - enabled = true - } - advanced_api_ops_config { - enabled = true - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/apigee_addons_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_addons_test.tf.tmpl deleted file mode 100644 index 7dd26447e516..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_addons_test.tf.tmpl +++ /dev/null @@ -1,78 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" - depends_on = [ google_project_service.servicenetworking ] -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" - depends_on = [ google_project_service.apigee ] -} - -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] -} - -resource "google_apigee_organization" "org" { - analytics_region = "us-central1" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - billing_type = "EVALUATION" - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_project_service.apigee - ] -} - -resource "google_apigee_addons_config" "{{$.PrimaryResourceId}}" { - org = google_apigee_organization.org.name - - addons_config { - integration_config { - enabled = true - } - api_security_config { - enabled = true - } - connectors_platform_config { - enabled = true - } - monetization_config { - enabled = true - } - advanced_api_ops_config { - enabled = true - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/apigee_endpoint_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_endpoint_attachment_basic.tf.tmpl deleted file mode 100644 index 72c53f1f0b1c..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_endpoint_attachment_basic.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} - -resource "google_apigee_endpoint_attachment" "apigee_endpoint_attachment" { - org_id = google_apigee_organization.apigee_org.id - endpoint_attachment_id = "test1" - location = "{google_compute_service_attachment location}" - service_attachment = "{google_compute_service_attachment id}" -} diff --git a/mmv1/templates/terraform/examples/go/apigee_endpoint_attachment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_endpoint_attachment_basic_test.tf.tmpl deleted file mode 100644 index 613a4a98606f..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_endpoint_attachment_basic_test.tf.tmpl +++ /dev/null @@ -1,162 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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_compute_address" "psc_ilb_consumer_address" { - name = "psc-ilb-consumer-address" - region = "us-west2" - - subnetwork = "default" - address_type = "INTERNAL" - - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_forwarding_rule" "psc_ilb_consumer" { - name = "psc-ilb-consumer-forwarding-rule" - region = "us-west2" - - target = google_compute_service_attachment.psc_ilb_service_attachment.id - load_balancing_scheme = "" # need to override EXTERNAL default when target is a service attachment - network = "default" - ip_address = google_compute_address.psc_ilb_consumer_address.address - - project = google_project.project.project_id -} - -resource "google_compute_forwarding_rule" "psc_ilb_target_service" { - name = "producer-forwarding-rule" - region = "us-west2" - - load_balancing_scheme = "INTERNAL" - backend_service = google_compute_region_backend_service.producer_service_backend.id - all_ports = true - network = google_compute_network.psc_ilb_network.name - subnetwork = google_compute_subnetwork.psc_ilb_producer_subnetwork.name - - project = google_project.project.project_id -} - -resource "google_compute_region_backend_service" "producer_service_backend" { - name = "producer-service" - region = "us-west2" - - health_checks = [google_compute_health_check.producer_service_health_check.id] - - project = google_project.project.project_id -} - -resource "google_compute_health_check" "producer_service_health_check" { - name = "producer-service-health-check" - - check_interval_sec = 1 - timeout_sec = 1 - tcp_health_check { - port = "80" - } - - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_network" "psc_ilb_network" { - name = "psc-ilb-network" - auto_create_subnetworks = false - - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { - name = "psc-ilb-producer-subnetwork" - region = "us-west2" - - network = google_compute_network.psc_ilb_network.id - ip_cidr_range = "10.0.0.0/16" - - project = google_project.project.project_id -} - -resource "google_compute_subnetwork" "psc_ilb_nat" { - name = "psc-ilb-nat" - region = "us-west2" - - network = google_compute_network.psc_ilb_network.id - purpose = "PRIVATE_SERVICE_CONNECT" - ip_cidr_range = "10.1.0.0/16" - - project = google_project.project.project_id -} - -resource "google_compute_service_attachment" "psc_ilb_service_attachment" { - name = "my-psc-ilb" - region = "us-west2" - description = "A service attachment configured with Terraform" - - enable_proxy_protocol = true - connection_preference = "ACCEPT_AUTOMATIC" - nat_subnets = [google_compute_subnetwork.psc_ilb_nat.id] - target_service = google_compute_forwarding_rule.psc_ilb_target_service.id - - project = google_project.project.project_id -} - -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_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 -} - diff --git a/mmv1/templates/terraform/examples/go/apigee_env_keystore_alias_self_signed_cert.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_env_keystore_alias_self_signed_cert.tf.tmpl deleted file mode 100644 index 4cffd3f021e3..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_env_keystore_alias_self_signed_cert.tf.tmpl +++ /dev/null @@ -1,85 +0,0 @@ -resource "google_project" "project" { - project_id = "{{index $.Vars "project_id"}}" - name = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -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 = "{{index $.Vars "environment_name"}}" - description = "Apigee Environment" - display_name = "environment-1" -} - -resource "google_apigee_env_keystore" "apigee_environment_keystore_alias" { - name = "{{index $.Vars "keystore_name"}}" - env_id = google_apigee_environment.apigee_environment_keystore_ss_alias.id -} - -resource "google_apigee_keystores_aliases_self_signed_cert" "apigee_environment_keystore_ss_alias" { - environment = google_apigee_environment.apigee_environment_keystore_ss_alias.name - org_id = google_apigee_organization.apigee_org.name - keystore = google_apigee_env_keystore.apigee_environment_keystore_alias.name - alias = "{{index $.Vars "keystores_alias"}}" - key_size = 1024 - sig_alg = "SHA512withRSA" - cert_validity_in_days = 4 - subject { - common_name = "selfsigned_example" - country_code = "US" - locality = "TX" - org = "CCE" - org_unit = "PSO" - } -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_basic.tf.tmpl deleted file mode 100644 index df9c2ea7b320..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_basic.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} - -resource "google_apigee_environment" "env" { - name = "{{index $.Vars "environment_name"}}" - description = "Apigee Environment" - display_name = "environment-1" - org_id = google_apigee_organization.apigee_org.id -} - diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_basic_deployment_apiproxy_type_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_basic_deployment_apiproxy_type_test.tf.tmpl deleted file mode 100644 index c1e4045d48c5..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_basic_deployment_apiproxy_type_test.tf.tmpl +++ /dev/null @@ -1,65 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -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" - deployment_type = "PROXY" - api_proxy_type = "PROGRAMMABLE" -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_basic_test.tf.tmpl deleted file mode 100644 index ff63f69ed691..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_basic_test.tf.tmpl +++ /dev/null @@ -1,63 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -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" -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_group_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_group_attachment_basic.tf.tmpl deleted file mode 100644 index d008def35c06..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_group_attachment_basic.tf.tmpl +++ /dev/null @@ -1,72 +0,0 @@ -resource "google_project" "project" { - project_id = "{{index $.Vars "project_id"}}" - name = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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_envgroup" "apigee_envgroup" { - org_id = google_apigee_organization.apigee_org.id - name = "{{index $.Vars "envgroup_name"}}" - hostnames = ["abc.foo.com"] -} - -resource "google_apigee_environment" "apigee_env" { - org_id = google_apigee_organization.apigee_org.id - name = "{{index $.Vars "environment_name"}}" - description = "Apigee Environment" - display_name = "{{index $.Vars "environment_name"}}" -} - -resource "google_apigee_envgroup_attachment" "{{$.PrimaryResourceId}}" { - envgroup_id = google_apigee_envgroup.apigee_envgroup.id - environment = google_apigee_environment.apigee_env.name -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_group_attachment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_group_attachment_basic_test.tf.tmpl deleted file mode 100644 index 611e1a31136f..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_group_attachment_basic_test.tf.tmpl +++ /dev/null @@ -1,72 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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_envgroup" "apigee_envgroup" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test%{random_suffix}" - hostnames = ["abc.foo.com"] -} - -resource "google_apigee_environment" "apigee_env" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test%{random_suffix}" - description = "Apigee Environment" - display_name = "tf-test%{random_suffix}" -} - -resource "google_apigee_envgroup_attachment" "{{$.PrimaryResourceId}}" { - envgroup_id = google_apigee_envgroup.apigee_envgroup.id - environment = google_apigee_environment.apigee_env.name -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_group_basic.tf.tmpl deleted file mode 100644 index 2e6eb4630b01..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_group_basic.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} - -resource "google_apigee_envgroup" "env_grp" { - name = "{{index $.Vars "envgroup_name"}}" - hostnames = ["abc.foo.com"] - org_id = google_apigee_organization.apigee_org.id -} - diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_group_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_group_basic_test.tf.tmpl deleted file mode 100644 index 6118cc0b6c98..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_group_basic_test.tf.tmpl +++ /dev/null @@ -1,61 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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_envgroup" "{{$.PrimaryResourceId}}" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test%{random_suffix}" - hostnames = ["abc.foo.com"] -} - diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_keystore_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_keystore_test.tf.tmpl deleted file mode 100644 index 3806673a0c61..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_keystore_test.tf.tmpl +++ /dev/null @@ -1,68 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -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" -} - -resource "google_apigee_env_keystore" "apigee_environment_keystore" { - name = "tf-test-keystore%{random_suffix}" - env_id = google_apigee_environment.{{$.PrimaryResourceId}}.id -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_basic.tf.tmpl deleted file mode 100644 index 522dcf1a3d13..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_basic.tf.tmpl +++ /dev/null @@ -1,55 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} - -resource "google_apigee_environment" "apigee_environment" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test-env" - description = "Apigee Environment" - display_name = "Apigee Environment" -} - -resource "google_apigee_instance" "apigee_instance" { - name = "tf-test-instance" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_instance_attachment" "apigee_instance_attachment" { - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_environment.name -} - -resource "google_apigee_environment_keyvaluemaps" "{{$.PrimaryResourceId}}" { - env_id = google_apigee_environment.apigee_environment.id - name = "tf-test-env-kvms" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_beta_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_beta_test.tf.tmpl deleted file mode 100644 index aa204c22c688..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_beta_test.tf.tmpl +++ /dev/null @@ -1,175 +0,0 @@ -resource "google_project" "project" { - provider = google-beta - - 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 "google_project_service" "apigee" { - provider = google-beta - - project = google_project.project.project_id - service = "apigee.googleapis.com" - } - - resource "google_project_service" "compute" { - provider = google-beta - - project = google_project.project.project_id - service = "compute.googleapis.com" - depends_on = [google_project_service.apigeeconnect] - } - - resource "google_project_service" "servicenetworking" { - provider = google-beta - - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" - depends_on = [google_project_service.compute] - } - - resource "google_project_service" "kms" { - provider = google-beta - - project = google_project.project.project_id - service = "cloudkms.googleapis.com" - depends_on = [google_project_service.servicenetworking] - } - - resource "google_project_service" "apigeeconnect" { - provider = google-beta - - project = google_project.project.project_id - service = "apigeeconnect.googleapis.com" - depends_on = [google_project_service.apigee] -} - - resource "google_compute_network" "apigee_network" { - provider = google-beta - - name = "apigee-network" - project = google_project.project.project_id - depends_on = [google_project_service.compute] - } - - resource "google_compute_global_address" "apigee_range" { - provider = google-beta - - 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" { - provider = google-beta - - 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_kms_key_ring" "apigee_keyring" { - provider = google-beta - - name = "apigee-keyring" - location = "us-central1" - project = google_project.project.project_id - depends_on = [google_project_service.kms] - } - - resource "google_kms_crypto_key" "apigee_key" { - provider = google-beta - - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id - } - - resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - - project = google_project.project.project_id - service = google_project_service.apigee.service - } - - resource "google_kms_crypto_key_iam_binding" "apigee_sa_keyuser" { - provider = google-beta - - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - members = [ - "serviceAccount:${google_project_service_identity.apigee_sa.email}", - ] - } - - resource "google_apigee_organization" "apigee_org" { - provider = google-beta - - display_name = "apigee-org" - description = "Terraform-managed Apigee Org" - analytics_region = "us-central1" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - billing_type = "EVALUATION" - runtime_type = "CLOUD" - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - properties { - property { - name = "features.hybrid.enabled" - value = "true" - } - property { - name = "features.mart.connect.enabled" - value = "true" - } - } - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_kms_crypto_key_iam_binding.apigee_sa_keyuser, - ] - } - -resource "google_apigee_environment" "apigee_environment" { - provider = google-beta - - org_id = google_apigee_organization.apigee_org.id - name = "tf-test-env%{random_suffix}" - description = "Apigee Environment" - display_name = "Apigee Environment" -} - -resource "google_apigee_instance" "apigee_instance" { - provider = google-beta - - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_instance_attachment" "apigee_instance_attachment" { - provider = google-beta - - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_environment.name -} - -resource "google_apigee_environment_keyvaluemaps" "{{$.PrimaryResourceId}}" { - provider = google-beta - - env_id = google_apigee_environment.apigee_environment.id - name = "tf-test-env-kvms%{random_suffix}" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_basic.tf.tmpl deleted file mode 100644 index ce759adf46ed..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_basic.tf.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} - -resource "google_apigee_environment" "apigee_environment" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test-env" - description = "Apigee Environment" - display_name = "Apigee Environment" -} - -resource "google_apigee_instance" "apigee_instance" { - name = "tf-test-instance" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_instance_attachment" "apigee_instance_attachment" { - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_environment.name -} - -resource "google_apigee_environment_keyvaluemaps" "apigee_environment_keyvaluemaps" { - env_id = google_apigee_environment.create_apigee_environment.id - name = "tf-test-env-kvms" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment - ] -} - -resource "google_apigee_environment_keyvaluemaps_entries" "{{$.PrimaryResourceId}}" { - env_keyvaluemap_id = google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps.id - name = "testName" - value = "testValue" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment, - google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_beta_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_beta_test.tf.tmpl deleted file mode 100644 index c7b3f6bf134c..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_beta_test.tf.tmpl +++ /dev/null @@ -1,190 +0,0 @@ -resource "google_project" "project" { - provider = google-beta - - 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 "google_project_service" "apigee" { - provider = google-beta - - project = google_project.project.project_id - service = "apigee.googleapis.com" - } - - resource "google_project_service" "compute" { - provider = google-beta - - project = google_project.project.project_id - service = "compute.googleapis.com" - depends_on = [google_project_service.apigeeconnect] - } - - resource "google_project_service" "servicenetworking" { - provider = google-beta - - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" - depends_on = [google_project_service.compute] - } - - resource "google_project_service" "kms" { - provider = google-beta - - project = google_project.project.project_id - service = "cloudkms.googleapis.com" - depends_on = [google_project_service.servicenetworking] - } - - resource "google_project_service" "apigeeconnect" { - provider = google-beta - - project = google_project.project.project_id - service = "apigeeconnect.googleapis.com" - depends_on = [google_project_service.apigee] -} - - resource "google_compute_network" "apigee_network" { - provider = google-beta - - name = "apigee-network" - project = google_project.project.project_id - depends_on = [google_project_service.compute] - } - - resource "google_compute_global_address" "apigee_range" { - provider = google-beta - - 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" { - provider = google-beta - - 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_kms_key_ring" "apigee_keyring" { - provider = google-beta - - name = "apigee-keyring" - location = "us-central1" - project = google_project.project.project_id - depends_on = [google_project_service.kms] - } - - resource "google_kms_crypto_key" "apigee_key" { - provider = google-beta - - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id - } - - resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - - project = google_project.project.project_id - service = google_project_service.apigee.service - } - - resource "google_kms_crypto_key_iam_binding" "apigee_sa_keyuser" { - provider = google-beta - - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - members = [ - "serviceAccount:${google_project_service_identity.apigee_sa.email}", - ] - } - - resource "google_apigee_organization" "apigee_org" { - provider = google-beta - - display_name = "apigee-org" - description = "Terraform-managed Apigee Org" - analytics_region = "us-central1" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - billing_type = "EVALUATION" - runtime_type = "CLOUD" - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - properties { - property { - name = "features.hybrid.enabled" - value = "true" - } - property { - name = "features.mart.connect.enabled" - value = "true" - } - } - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_kms_crypto_key_iam_binding.apigee_sa_keyuser, - ] - } - -resource "google_apigee_environment" "apigee_environment" { - provider = google-beta - - org_id = google_apigee_organization.apigee_org.id - name = "tf-test-env%{random_suffix}" - description = "Apigee Environment" - display_name = "Apigee Environment" -} - -resource "google_apigee_instance" "apigee_instance" { - provider = google-beta - - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_instance_attachment" "apigee_instance_attachment" { - provider = google-beta - - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_environment.name -} - -resource "google_apigee_environment_keyvaluemaps" "apigee_environment_keyvaluemaps" { - provider = google-beta - - env_id = google_apigee_environment.apigee_environment.id - name = "tf-test-env-kvms%{random_suffix}" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment - ] -} - -resource "google_apigee_environment_keyvaluemaps_entries" "{{$.PrimaryResourceId}}" { - provider = google-beta - - env_keyvaluemap_id = google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps.id - name = "testName" - value = "testValue" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment, - google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_test.tf.tmpl deleted file mode 100644 index f70f639f2a54..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_entries_test.tf.tmpl +++ /dev/null @@ -1,111 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" - depends_on = [ google_project_service.servicenetworking ] -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" - depends_on = [ google_project_service.apigee ] -} - -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] -} - -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 - billing_type = "EVALUATION" - runtime_type = "CLOUD" - properties { - property { - name = "features.hybrid.enabled" - value = "true" - } - property { - name = "features.mart.connect.enabled" - value = "true" - } - } - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_project_service.apigee - ] -} - -resource "google_apigee_environment" "apigee_environment" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test-env%{random_suffix}" - description = "Apigee Environment" - display_name = "Apigee Environment" -} - -resource "google_apigee_instance" "apigee_instance" { - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_instance_attachment" "apigee_instance_attachment" { - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_environment.name -} - -resource "google_apigee_environment_keyvaluemaps" "apigee_environment_keyvaluemaps" { - env_id = google_apigee_environment.apigee_environment.id - name = "tf-test-env-kvms%{random_suffix}" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment - ] -} - -resource "google_apigee_environment_keyvaluemaps_entries" "{{$.PrimaryResourceId}}" { - - env_keyvaluemap_id = google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps.id - name = "testName" - value = "testValue" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment, - google_apigee_environment_keyvaluemaps.apigee_environment_keyvaluemaps - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_test.tf.tmpl deleted file mode 100644 index 4265a85236f8..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_keyvaluemaps_test.tf.tmpl +++ /dev/null @@ -1,97 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" - depends_on = [ google_project_service.servicenetworking ] -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" - depends_on = [ google_project_service.apigee ] -} - -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] -} - -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 - billing_type = "EVALUATION" - runtime_type = "CLOUD" - properties { - property { - name = "features.hybrid.enabled" - value = "true" - } - property { - name = "features.mart.connect.enabled" - value = "true" - } - } - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_project_service.apigee - ] -} - -resource "google_apigee_environment" "apigee_environment" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test-env%{random_suffix}" - description = "Apigee Environment" - display_name = "Apigee Environment" -} - -resource "google_apigee_instance" "apigee_instance" { - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_instance_attachment" "apigee_instance_attachment" { - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_environment.name -} - -resource "google_apigee_environment_keyvaluemaps" "{{$.PrimaryResourceId}}" { - env_id = google_apigee_environment.apigee_environment.id - name = "tf-test-env-kvms%{random_suffix}" - depends_on = [ - google_apigee_organization.apigee_org, - google_apigee_environment.apigee_environment, - google_apigee_instance.apigee_instance, - google_apigee_instance_attachment.apigee_instance_attachment - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_patch_update_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_patch_update_test.tf.tmpl deleted file mode 100644 index d2bb56710d93..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_patch_update_test.tf.tmpl +++ /dev/null @@ -1,124 +0,0 @@ -resource "google_project" "project" { - provider = google-beta - - 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 "google_project_service" "apigee" { - provider = google-beta - - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - provider = google-beta - - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - provider = google-beta - - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -resource "google_project_service" "kms" { - provider = google-beta - - project = google_project.project.project_id - service = "cloudkms.googleapis.com" -} - -resource "google_compute_network" "apigee_network" { - provider = google-beta - - name = "apigee-network" - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_global_address" "apigee_range" { - provider = google-beta - - 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" { - provider = google-beta - - 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_kms_key_ring" "apigee_keyring" { - provider = google-beta - - name = "apigee-keyring" - location = "us-central1" - project = google_project.project.project_id - depends_on = [google_project_service.kms] -} - -resource "google_kms_crypto_key" "apigee_key" { - provider = google-beta - - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - provider = google-beta - - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "apigee_org" { - provider = google-beta - - analytics_region = "us-central1" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - billing_type = "PAYG" - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_project_service.apigee, - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} - -resource "google_apigee_environment" "{{$.PrimaryResourceId}}" { - provider = google-beta - - org_id = google_apigee_organization.apigee_org.id - name = "tf-test%{random_suffix}" - description = "Apigee Environment" - display_name = "tf-test%{random_suffix}" - type = "COMPREHENSIVE" - forward_proxy_uri = "http://test:123" -} diff --git a/mmv1/templates/terraform/examples/go/apigee_environment_reference_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_environment_reference_test.tf.tmpl deleted file mode 100644 index 2acd802bba19..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_environment_reference_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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -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" -} - -resource "google_apigee_env_keystore" "apigee_environment_keystore_1" { - name = "tf-test-keystore%{random_suffix}" - env_id = google_apigee_environment.{{$.PrimaryResourceId}}.id -} - -resource "google_apigee_env_references" "apigee_environment_reference" { - env_id = google_apigee_environment.{{$.PrimaryResourceId}}.id - name = "reference_test" - resource_type = "KeyStore" - refers = google_apigee_env_keystore.apigee_environment_keystore_1.name -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_attachment_basic.tf.tmpl deleted file mode 100644 index 9c535fae47c7..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_attachment_basic.tf.tmpl +++ /dev/null @@ -1,72 +0,0 @@ -resource "google_project" "project" { - project_id = "{{index $.Vars "project_id"}}" - name = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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_instance" "apigee_ins" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_environment" "apigee_env" { - org_id = google_apigee_organization.apigee_org.id - name = "{{index $.Vars "environment_name"}}" - description = "Apigee Environment" - display_name = "environment-1" -} - -resource "google_apigee_instance_attachment" "{{$.PrimaryResourceId}}" { - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_env.name -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_attachment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_attachment_basic_test.tf.tmpl deleted file mode 100644 index b70cf9d4d3b4..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_attachment_basic_test.tf.tmpl +++ /dev/null @@ -1,84 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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_instance" "apigee_instance" { - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_environment" "apigee_env" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test%{random_suffix}" - description = "Apigee Environment" - display_name = "tf-test%{random_suffix}" -} - -resource "google_apigee_environment" "apigee_env_2" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test-2-%{random_suffix}" - description = "Apigee 2 Environment" - display_name = "tf-test-2-%{random_suffix}" -} - -resource "google_apigee_instance_attachment" "{{$.PrimaryResourceId}}" { - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_env.name -} - -resource "google_apigee_instance_attachment" "{{$.PrimaryResourceId}}_2" { - instance_id = google_apigee_instance.apigee_instance.id - environment = google_apigee_environment.apigee_env_2.name -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_basic.tf.tmpl deleted file mode 100644 index 72b2b4fe3e6f..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_basic.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} - -resource "google_apigee_instance" "apigee_instance" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_basic_test.tf.tmpl deleted file mode 100644 index 2c8e0d988950..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_basic_test.tf.tmpl +++ /dev/null @@ -1,61 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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_instance" "{{$.PrimaryResourceId}}" { - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_cidr_range.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_cidr_range.tf.tmpl deleted file mode 100644 index 4c7a9812c093..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_cidr_range.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -resource "google_compute_global_address" "apigee_range" { - name = "apigee-range" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 22 - network = google_compute_network.apigee_network.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] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} - -resource "google_apigee_instance" "apigee_instance" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id - peering_cidr_range = "SLASH_22" -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_cidr_range_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_cidr_range_test.tf.tmpl deleted file mode 100644 index 6136c01baeac..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_cidr_range_test.tf.tmpl +++ /dev/null @@ -1,61 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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 = 22 - 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_instance" "{{$.PrimaryResourceId}}" { - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id - peering_cidr_range = "SLASH_22" -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_full.tf.tmpl deleted file mode 100644 index 068787dd7c7f..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_full.tf.tmpl +++ /dev/null @@ -1,69 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_kms_key_ring" "apigee_keyring" { - name = "apigee-keyring" - location = "us-central1" -} - -resource "google_kms_crypto_key" "apigee_key" { - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id - - lifecycle { - prevent_destroy = true - } -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - display_name = "apigee-org" - description = "Terraform-provisioned Apigee Org." - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} - -resource "google_apigee_instance" "apigee_instance" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1" - description = "Terraform-managed Apigee Runtime Instance" - display_name = "{{index $.Vars "instance_name"}}" - org_id = google_apigee_organization.apigee_org.id - disk_encryption_key_name = google_kms_crypto_key.apigee_key.id -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_full_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_full_test.tf.tmpl deleted file mode 100644 index 80ee6da8ae87..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_full_test.tf.tmpl +++ /dev/null @@ -1,124 +0,0 @@ -resource "google_project" "project" { - provider = google-beta - - 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 "google_project_service" "apigee" { - provider = google-beta - - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - provider = google-beta - - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - provider = google-beta - - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -resource "google_project_service" "kms" { - provider = google-beta - - project = google_project.project.project_id - service = "cloudkms.googleapis.com" -} - -resource "google_compute_network" "apigee_network" { - provider = google-beta - - name = "apigee-network" - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_global_address" "apigee_range" { - provider = google-beta - - 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" { - provider = google-beta - - 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_kms_key_ring" "apigee_keyring" { - provider = google-beta - - name = "apigee-keyring" - location = "us-central1" - project = google_project.project.project_id - depends_on = [google_project_service.kms] -} - -resource "google_kms_crypto_key" "apigee_key" { - provider = google-beta - - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - provider = google-beta - - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "apigee_org" { - provider = google-beta - - display_name = "apigee-org" - description = "Terraform-managed Apigee Org" - analytics_region = "us-central1" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} - -resource "google_apigee_instance" "{{$.PrimaryResourceId}}" { - provider = google-beta - - name = "tf-test%{random_suffix}" - location = "us-central1" - description = "Terraform-managed Apigee Instance" - display_name = "tf-test%{random_suffix}" - org_id = google_apigee_organization.apigee_org.id - disk_encryption_key_name = google_kms_crypto_key.apigee_key.id -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_ip_range.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_ip_range.tf.tmpl deleted file mode 100644 index 8b7a21079971..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_ip_range.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -resource "google_compute_global_address" "apigee_range" { - name = "apigee-range" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 22 - network = google_compute_network.apigee_network.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] -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} - -resource "google_apigee_instance" "apigee_instance" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id - ip_range = "10.87.8.0/22" -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_ip_range_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_ip_range_test.tf.tmpl deleted file mode 100644 index edb467cc02f5..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_ip_range_test.tf.tmpl +++ /dev/null @@ -1,61 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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 = 21 - 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_instance" "{{$.PrimaryResourceId}}" { - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id - ip_range = "${google_compute_global_address.apigee_range.address}/22" -} diff --git a/mmv1/templates/terraform/examples/go/apigee_instance_service_attachment_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_instance_service_attachment_basic_test.tf.tmpl deleted file mode 100644 index 22304c65b5f9..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_instance_service_attachment_basic_test.tf.tmpl +++ /dev/null @@ -1,161 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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_compute_address" "psc_ilb_consumer_address" { - name = "psc-ilb-consumer-address" - region = "us-west2" - - subnetwork = "default" - address_type = "INTERNAL" - - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_forwarding_rule" "psc_ilb_consumer" { - name = "psc-ilb-consumer-forwarding-rule" - region = "us-west2" - - target = google_compute_service_attachment.psc_ilb_service_attachment.id - load_balancing_scheme = "" # need to override EXTERNAL default when target is a service attachment - network = "default" - ip_address = google_compute_address.psc_ilb_consumer_address.id - - project = google_project.project.project_id -} - -resource "google_compute_forwarding_rule" "psc_ilb_target_service" { - name = "producer-forwarding-rule" - region = "us-west2" - - load_balancing_scheme = "INTERNAL" - backend_service = google_compute_region_backend_service.producer_service_backend.id - all_ports = true - network = google_compute_network.psc_ilb_network.name - subnetwork = google_compute_subnetwork.psc_ilb_producer_subnetwork.name - - project = google_project.project.project_id -} - -resource "google_compute_region_backend_service" "producer_service_backend" { - name = "producer-service" - region = "us-west2" - - health_checks = [google_compute_health_check.producer_service_health_check.id] - - project = google_project.project.project_id -} - -resource "google_compute_health_check" "producer_service_health_check" { - name = "producer-service-health-check" - - check_interval_sec = 1 - timeout_sec = 1 - tcp_health_check { - port = "80" - } - - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_network" "psc_ilb_network" { - name = "psc-ilb-network" - auto_create_subnetworks = false - - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { - name = "psc-ilb-producer-subnetwork" - region = "us-west2" - - network = google_compute_network.psc_ilb_network.id - ip_cidr_range = "10.0.0.0/16" - - project = google_project.project.project_id -} - -resource "google_compute_subnetwork" "psc_ilb_nat" { - name = "psc-ilb-nat" - region = "us-west2" - - network = google_compute_network.psc_ilb_network.id - purpose = "PRIVATE_SERVICE_CONNECT" - ip_cidr_range = "10.1.0.0/16" - - project = google_project.project.project_id -} - -resource "google_compute_service_attachment" "psc_ilb_service_attachment" { - name = "my-psc-ilb" - region = "us-west2" - description = "A service attachment configured with Terraform" - - enable_proxy_protocol = true - connection_preference = "ACCEPT_AUTOMATIC" - nat_subnets = [google_compute_subnetwork.psc_ilb_nat.id] - target_service = google_compute_forwarding_rule.psc_ilb_target_service.id - - project = google_project.project.project_id -} - -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_instance" "{{$.PrimaryResourceId}}" { - name = "tf-test%{random_suffix}" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id - consumer_accept_list = [google_project.project.number] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_nat_address_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_nat_address_basic.tf.tmpl deleted file mode 100644 index c9a6f727ae24..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_nat_address_basic.tf.tmpl +++ /dev/null @@ -1,74 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -resource "google_compute_global_address" "apigee_range" { - name = "apigee-range" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 21 - network = google_compute_network.apigee_network.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] -} - -resource "google_kms_key_ring" "apigee_keyring" { - name = "apigee-keyring" - location = "us-central1" -} - -resource "google_kms_crypto_key" "apigee_key" { - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id - - lifecycle { - prevent_destroy = true - } -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - display_name = "apigee-org" - description = "Terraform-provisioned Apigee Org." - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} - -resource "google_apigee_instance" "apigee_instance" { - name = "apigee-instance" - location = "us-central1" - description = "Terraform-managed Apigee Runtime Instance" - display_name = "apigee-instance" - org_id = google_apigee_organization.apigee_org.id - disk_encryption_key_name = google_kms_crypto_key.apigee_key.id -} - -resource "google_apigee_nat_address" "apigee-nat" { - name = "{{index $.Vars "nat_address_name"}}" - instance_id = google_apigee_instance.apigee_instance.id -} diff --git a/mmv1/templates/terraform/examples/go/apigee_nat_address_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_nat_address_basic_test.tf.tmpl deleted file mode 100644 index ce2a4f9206f8..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_nat_address_basic_test.tf.tmpl +++ /dev/null @@ -1,65 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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 = 21 - 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_instance" "apigee_instance" { - name = "apigee-instance" - location = "us-central1" - org_id = google_apigee_organization.apigee_org.id -} - -resource "google_apigee_nat_address" "{{$.PrimaryResourceId}}" { - name = "tf-test%{random_suffix}" - instance_id = google_apigee_instance.apigee_instance.id -} diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic.tf.tmpl deleted file mode 100644 index d2e0ff043303..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_apigee_organization" "org" { - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - depends_on = [google_service_networking_connection.apigee_vpc_connection] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_disable_vpc_peering.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_disable_vpc_peering.tf.tmpl deleted file mode 100644 index ca2afe9ae26c..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_disable_vpc_peering.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_apigee_organization" "org" { - description = "Terraform-provisioned basic Apigee Org without VPC Peering." - analytics_region = "us-central1" - project_id = data.google_client_config.current.project - disable_vpc_peering = true -} - diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_disable_vpc_peering_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_disable_vpc_peering_test.tf.tmpl deleted file mode 100644 index 5b5b6adf8ea2..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_disable_vpc_peering_test.tf.tmpl +++ /dev/null @@ -1,22 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { - description = "Terraform-provisioned basic Apigee Org without VPC Peering." - analytics_region = "us-central1" - project_id = google_project.project.project_id - disable_vpc_peering = true - depends_on = [ - google_project_service.apigee, - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_test.tf.tmpl deleted file mode 100644 index 508d8899f826..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_basic_test.tf.tmpl +++ /dev/null @@ -1,54 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -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" "{{$.PrimaryResourceId}}" { - 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, - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full.tf.tmpl deleted file mode 100644 index 459295a4fa34..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full.tf.tmpl +++ /dev/null @@ -1,60 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_compute_network" "apigee_network" { - name = "apigee-network" -} - -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 -} - -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] -} - -resource "google_kms_key_ring" "apigee_keyring" { - name = "apigee-keyring" - location = "us-central1" -} - -resource "google_kms_crypto_key" "apigee_key" { - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id - - lifecycle { - prevent_destroy = true - } -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "org" { - analytics_region = "us-central1" - display_name = "apigee-org" - description = "Terraform-provisioned Apigee Org." - project_id = data.google_client_config.current.project - authorized_network = google_compute_network.apigee_network.id - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_disable_vpc_peering.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_disable_vpc_peering.tf.tmpl deleted file mode 100644 index f05b6dd2cce2..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_disable_vpc_peering.tf.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -data "google_client_config" "current" {} - -resource "google_kms_key_ring" "apigee_keyring" { - name = "apigee-keyring" - location = "us-central1" -} - -resource "google_kms_crypto_key" "apigee_key" { - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id - - lifecycle { - prevent_destroy = true - } -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "org" { - analytics_region = "us-central1" - display_name = "apigee-org" - description = "Terraform-provisioned Apigee Org without VPC Peering." - project_id = data.google_client_config.current.project - disable_vpc_peering = true - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - - depends_on = [ - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_disable_vpc_peering_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_disable_vpc_peering_test.tf.tmpl deleted file mode 100644 index 457d32a0aefa..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_disable_vpc_peering_test.tf.tmpl +++ /dev/null @@ -1,88 +0,0 @@ -resource "google_project" "project" { - provider = google-beta - - 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 "google_project_service" "apigee" { - provider = google-beta - - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - provider = google-beta - - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "kms" { - provider = google-beta - - project = google_project.project.project_id - service = "cloudkms.googleapis.com" -} - -resource "google_kms_key_ring" "apigee_keyring" { - provider = google-beta - - name = "apigee-keyring" - location = "us-central1" - project = google_project.project.project_id - depends_on = [google_project_service.kms] -} - -resource "google_kms_crypto_key" "apigee_key" { - provider = google-beta - - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - provider = google-beta - - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { - provider = google-beta - - display_name = "apigee-org" - description = "Terraform-provisioned Apigee Org without VPC Peering." - analytics_region = "us-central1" - project_id = google_project.project.project_id - disable_vpc_peering = true - billing_type = "EVALUATION" - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - properties { - property { - name = "features.mart.connect.enabled" - value = "true" - } - property { - name = "features.hybrid.enabled" - value = "true" - } - } - - depends_on = [ - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_test.tf.tmpl deleted file mode 100644 index 4e193a9658bc..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_cloud_full_test.tf.tmpl +++ /dev/null @@ -1,124 +0,0 @@ -resource "google_project" "project" { - provider = google-beta - - 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 "google_project_service" "apigee" { - provider = google-beta - - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - provider = google-beta - - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - provider = google-beta - - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -resource "google_project_service" "kms" { - provider = google-beta - - project = google_project.project.project_id - service = "cloudkms.googleapis.com" -} - -resource "google_compute_network" "apigee_network" { - provider = google-beta - - name = "apigee-network" - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_global_address" "apigee_range" { - provider = google-beta - - 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" { - provider = google-beta - - 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_kms_key_ring" "apigee_keyring" { - provider = google-beta - - name = "apigee-keyring" - location = "us-central1" - project = google_project.project.project_id - depends_on = [google_project_service.kms] -} - -resource "google_kms_crypto_key" "apigee_key" { - provider = google-beta - - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - provider = google-beta - - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { - provider = google-beta - - display_name = "apigee-org" - description = "Terraform-managed Apigee Org" - analytics_region = "us-central1" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - billing_type = "EVALUATION" - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - properties { - property { - name = "features.hybrid.enabled" - value = "true" - } - property { - name = "features.mart.connect.enabled" - value = "true" - } - } - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_drz_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_drz_test.tf.tmpl deleted file mode 100644 index 269b2bfe70ba..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_drz_test.tf.tmpl +++ /dev/null @@ -1,120 +0,0 @@ -provider "google-beta" { - apigee_custom_endpoint = "https://eu-apigee.googleapis.com/v1/" -} - -resource "google_project" "project" { - provider = google-beta - - 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 "google_project_service" "apigee" { - provider = google-beta - - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - provider = google-beta - - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - provider = google-beta - - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -resource "google_project_service" "kms" { - provider = google-beta - - project = google_project.project.project_id - service = "cloudkms.googleapis.com" -} - -resource "google_compute_network" "apigee_network" { - provider = google-beta - - name = "apigee-network" - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_global_address" "apigee_range" { - provider = google-beta - - 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" { - provider = google-beta - - 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_kms_key_ring" "apigee_keyring" { - provider = google-beta - - name = "apigee-keyring" - location = "europe-central2" - project = google_project.project.project_id - depends_on = [google_project_service.kms] -} - -resource "google_kms_crypto_key" "apigee_key" { - provider = google-beta - - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - provider = google-beta - - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { - provider = google-beta - - api_consumer_data_location = "europe-central2" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - billing_type = "PAYG" - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - api_consumer_data_encryption_key_name = google_kms_crypto_key.apigee_key.id - retention = "MINIMUM" - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_project_service.apigee, - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} - diff --git a/mmv1/templates/terraform/examples/go/apigee_organization_retention_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_organization_retention_test.tf.tmpl deleted file mode 100644 index 95f5f38fb758..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_organization_retention_test.tf.tmpl +++ /dev/null @@ -1,115 +0,0 @@ -resource "google_project" "project" { - provider = google-beta - - 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 "google_project_service" "apigee" { - provider = google-beta - - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_project_service" "compute" { - provider = google-beta - - project = google_project.project.project_id - service = "compute.googleapis.com" -} - -resource "google_project_service" "servicenetworking" { - provider = google-beta - - project = google_project.project.project_id - service = "servicenetworking.googleapis.com" -} - -resource "google_project_service" "kms" { - provider = google-beta - - project = google_project.project.project_id - service = "cloudkms.googleapis.com" -} - -resource "google_compute_network" "apigee_network" { - provider = google-beta - - name = "apigee-network" - project = google_project.project.project_id - depends_on = [google_project_service.compute] -} - -resource "google_compute_global_address" "apigee_range" { - provider = google-beta - - 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" { - provider = google-beta - - 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_kms_key_ring" "apigee_keyring" { - provider = google-beta - - name = "apigee-keyring" - location = "us-central1" - project = google_project.project.project_id - depends_on = [google_project_service.kms] -} - -resource "google_kms_crypto_key" "apigee_key" { - provider = google-beta - - name = "apigee-key" - key_ring = google_kms_key_ring.apigee_keyring.id -} - -resource "google_project_service_identity" "apigee_sa" { - provider = google-beta - - project = google_project.project.project_id - service = google_project_service.apigee.service -} - -resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" { - provider = google-beta - - crypto_key_id = google_kms_crypto_key.apigee_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - member = google_project_service_identity.apigee_sa.member -} - -resource "google_apigee_organization" "{{$.PrimaryResourceId}}" { - provider = google-beta - - analytics_region = "us-central1" - project_id = google_project.project.project_id - authorized_network = google_compute_network.apigee_network.id - billing_type = "PAYG" - runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id - retention = "MINIMUM" - - depends_on = [ - google_service_networking_connection.apigee_vpc_connection, - google_project_service.apigee, - google_kms_crypto_key_iam_member.apigee_sa_keyuser, - ] -} - diff --git a/mmv1/templates/terraform/examples/go/apigee_sync_authorization_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_sync_authorization_basic_test.tf.tmpl deleted file mode 100644 index 277bdf85022e..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_sync_authorization_basic_test.tf.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -resource "google_project" "project" { - project_id = "{{index $.Vars "project_id"}}" - name = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -resource "google_apigee_organization" "apigee_org" { - analytics_region = "us-central1" - project_id = google_project.project.project_id - - runtime_type = "HYBRID" - depends_on = [google_project_service.apigee] -} - -resource "google_service_account" "service_account" { - account_id = "{{index $.Vars "account_id"}}" - display_name = "Service Account" -} - -resource "google_project_iam_member" "synchronizer-iam" { - project = google_project.project.project_id - role = "roles/apigee.synchronizerManager" - member = "serviceAccount:${google_service_account.service_account.email}" -} - -resource "google_apigee_sync_authorization" "{{$.PrimaryResourceId}}" { - name = google_apigee_organization.apigee_org.name - identities = [ - "serviceAccount:${google_service_account.service_account.email}", - ] - depends_on = [google_project_iam_member.synchronizer-iam] -} diff --git a/mmv1/templates/terraform/examples/go/apigee_target_server_test.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_target_server_test.tf.tmpl deleted file mode 100644 index 3930cc27ff5a..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_target_server_test.tf.tmpl +++ /dev/null @@ -1,72 +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 "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -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" "apigee_environment" { - org_id = google_apigee_organization.apigee_org.id - name = "tf-test%{random_suffix}" - description = "Apigee Environment" - display_name = "environment-1" -} - -resource "google_apigee_target_server" "{{$.PrimaryResourceId}}" { - name = "tf-test-target-server%{random_suffix}" - description = "Apigee Target Server" - protocol = "HTTP" - host = "abc.foo.com" - port = 8080 - env_id = google_apigee_environment.apigee_environment.id -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/apigee_target_server_test_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apigee_target_server_test_basic.tf.tmpl deleted file mode 100644 index f5d53555ed45..000000000000 --- a/mmv1/templates/terraform/examples/go/apigee_target_server_test_basic.tf.tmpl +++ /dev/null @@ -1,72 +0,0 @@ -resource "google_project" "project" { - project_id = "{{index $.Vars "project_id"}}" - name = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_project_service" "apigee" { - project = google_project.project.project_id - service = "apigee.googleapis.com" -} - -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" "apigee_environment" { - org_id = google_apigee_organization.apigee_org.id - name = "{{index $.Vars "environment_name"}}" - description = "Apigee Environment" - display_name = "environment-1" -} - -resource "google_apigee_target_server" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "target_server"}}" - description = "Apigee Target Server" - protocol = "HTTP" - host = "abc.foo.com" - port = 8080 - env_id = google_apigee_environment.apigee_environment.id -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/app_engine_application_url_dispatch_rules_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/app_engine_application_url_dispatch_rules_basic.tf.tmpl deleted file mode 100644 index 7007e1669cb0..000000000000 --- a/mmv1/templates/terraform/examples/go/app_engine_application_url_dispatch_rules_basic.tf.tmpl +++ /dev/null @@ -1,46 +0,0 @@ -resource "google_app_engine_application_url_dispatch_rules" "{{$.PrimaryResourceId}}" { - dispatch_rules { - domain = "*" - path = "/*" - service = "default" - } - - dispatch_rules { - domain = "*" - path = "/admin/*" - service = google_app_engine_standard_app_version.admin_v3.service - } -} - -resource "google_app_engine_standard_app_version" "admin_v3" { - version_id = "v3" - service = "admin" - runtime = "nodejs20" - - entrypoint { - shell = "node ./app.js" - } - - deployment { - zip { - source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - } - } - - env_variables = { - port = "8080" - } - - delete_service_on_destroy = true -} - -resource "google_storage_bucket" "bucket" { - name = "{{index $.Vars "bucket_name"}}" - location = "US" -} - -resource "google_storage_bucket_object" "object" { - name = "hello-world.zip" - bucket = google_storage_bucket.bucket.name - source = "./test-fixtures/hello-world.zip" -} diff --git a/mmv1/templates/terraform/examples/go/app_engine_domain_mapping_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/app_engine_domain_mapping_basic.tf.tmpl deleted file mode 100644 index 772894a6a0ee..000000000000 --- a/mmv1/templates/terraform/examples/go/app_engine_domain_mapping_basic.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_app_engine_domain_mapping" "{{$.PrimaryResourceId}}" { - domain_name = "verified-domain.com" - - ssl_settings { - ssl_management_type = "AUTOMATIC" - } -} diff --git a/mmv1/templates/terraform/examples/go/app_engine_firewall_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/app_engine_firewall_rule_basic.tf.tmpl deleted file mode 100644 index 65ff5428d7bb..000000000000 --- a/mmv1/templates/terraform/examples/go/app_engine_firewall_rule_basic.tf.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -resource "google_project" "my_project" { - name = "tf-test-project" - project_id = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_app_engine_application" "app" { - project = google_project.my_project.project_id - location_id = "us-central" -} - -resource "google_app_engine_firewall_rule" "rule" { - project = google_app_engine_application.app.project - priority = 1000 - action = "ALLOW" - source_range = "*" -} diff --git a/mmv1/templates/terraform/examples/go/app_engine_flexible_app_version.tf.tmpl b/mmv1/templates/terraform/examples/go/app_engine_flexible_app_version.tf.tmpl deleted file mode 100644 index 242bdbd85d13..000000000000 --- a/mmv1/templates/terraform/examples/go/app_engine_flexible_app_version.tf.tmpl +++ /dev/null @@ -1,110 +0,0 @@ -resource "google_project" "my_project" { - name = "{{index $.Vars "project"}}" - project_id = "{{index $.Vars "project"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_app_engine_application" "app" { - project = google_project.my_project.project_id - location_id = "us-central" -} - -resource "google_project_service" "service" { - project = google_project.my_project.project_id - service = "appengineflex.googleapis.com" - - disable_dependent_services = false -} - -resource "google_service_account" "custom_service_account" { - project = google_project_service.service.project - account_id = "{{index $.Vars "account_id"}}" - display_name = "Custom Service Account" -} - -resource "google_project_iam_member" "gae_api" { - project = google_project_service.service.project - role = "roles/compute.networkUser" - member = "serviceAccount:${google_service_account.custom_service_account.email}" -} - -resource "google_project_iam_member" "logs_writer" { - project = google_project_service.service.project - role = "roles/logging.logWriter" - member = "serviceAccount:${google_service_account.custom_service_account.email}" -} - -resource "google_project_iam_member" "storage_viewer" { - project = google_project_service.service.project - role = "roles/storage.objectViewer" - member = "serviceAccount:${google_service_account.custom_service_account.email}" -} - -resource "google_app_engine_flexible_app_version" "{{$.PrimaryResourceId}}" { - version_id = "v1" - project = google_project_iam_member.gae_api.project - service = "default" - runtime = "nodejs" - flexible_runtime_settings { - operating_system = "ubuntu22" - runtime_version = "20" - } - - entrypoint { - shell = "node ./app.js" - } - - deployment { - zip { - source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - } - } - - liveness_check { - path = "/" - } - - readiness_check { - path = "/" - } - - env_variables = { - port = "8080" - } - - handlers { - url_regex = ".*\\/my-path\\/*" - security_level = "SECURE_ALWAYS" - login = "LOGIN_REQUIRED" - auth_fail_action = "AUTH_FAIL_ACTION_REDIRECT" - - static_files { - path = "my-other-path" - upload_path_regex = ".*\\/my-path\\/*" - } - } - - automatic_scaling { - cool_down_period = "120s" - cpu_utilization { - target_utilization = 0.5 - } - } - - noop_on_destroy = true - service_account = google_service_account.custom_service_account.email -} - -resource "google_storage_bucket" "bucket" { - project = google_project.my_project.project_id - name = "{{index $.Vars "bucket_name"}}" - location = "US" -} - -resource "google_storage_bucket_object" "object" { - name = "hello-world.zip" - bucket = google_storage_bucket.bucket.name - source = "./test-fixtures/hello-world.zip" -} diff --git a/mmv1/templates/terraform/examples/go/app_engine_service_network_settings.tf.tmpl b/mmv1/templates/terraform/examples/go/app_engine_service_network_settings.tf.tmpl deleted file mode 100644 index 7491bb7cb3b4..000000000000 --- a/mmv1/templates/terraform/examples/go/app_engine_service_network_settings.tf.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -resource "google_storage_bucket" "bucket" { - name = "{{index $.Vars "bucket_name"}}" - location = "US" -} - -resource "google_storage_bucket_object" "object" { - name = "hello-world.zip" - bucket = google_storage_bucket.bucket.name - source = "./test-fixtures/hello-world.zip" -} - -resource "google_app_engine_standard_app_version" "internalapp" { - version_id = "v1" - service = "internalapp" - delete_service_on_destroy = true - - runtime = "nodejs20" - entrypoint { - shell = "node ./app.js" - } - deployment { - zip { - source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - } - } - env_variables = { - port = "8080" - } -} - -resource "google_app_engine_service_network_settings" "{{$.PrimaryResourceId}}" { - service = google_app_engine_standard_app_version.internalapp.service - network_settings { - ingress_traffic_allowed = "INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY" - } -} diff --git a/mmv1/templates/terraform/examples/go/app_engine_service_split_traffic.tf.tmpl b/mmv1/templates/terraform/examples/go/app_engine_service_split_traffic.tf.tmpl deleted file mode 100644 index 1a52f549116c..000000000000 --- a/mmv1/templates/terraform/examples/go/app_engine_service_split_traffic.tf.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -resource "google_storage_bucket" "bucket" { - name = "{{index $.Vars "bucket_name"}}" - location = "US" -} - -resource "google_storage_bucket_object" "object" { - name = "hello-world.zip" - bucket = google_storage_bucket.bucket.name - source = "./test-fixtures/hello-world.zip" -} - -resource "google_app_engine_standard_app_version" "liveapp_v1" { - version_id = "v1" - service = "liveapp" - delete_service_on_destroy = true - - runtime = "nodejs20" - entrypoint { - shell = "node ./app.js" - } - deployment { - zip { - source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - } - } - env_variables = { - port = "8080" - } -} - -resource "google_app_engine_standard_app_version" "liveapp_v2" { - version_id = "v2" - service = "liveapp" - noop_on_destroy = true - - runtime = "nodejs20" - entrypoint { - shell = "node ./app.js" - } - deployment { - zip { - source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - } - } - env_variables = { - port = "8080" - } -} - -resource "google_app_engine_service_split_traffic" "{{$.PrimaryResourceId}}" { - service = google_app_engine_standard_app_version.liveapp_v2.service - - migrate_traffic = false - split { - shard_by = "IP" - allocations = { - (google_app_engine_standard_app_version.liveapp_v1.version_id) = 0.75 - (google_app_engine_standard_app_version.liveapp_v2.version_id) = 0.25 - } - } -} diff --git a/mmv1/templates/terraform/examples/go/app_engine_standard_app_version.tf.tmpl b/mmv1/templates/terraform/examples/go/app_engine_standard_app_version.tf.tmpl deleted file mode 100644 index bcbdc13d7683..000000000000 --- a/mmv1/templates/terraform/examples/go/app_engine_standard_app_version.tf.tmpl +++ /dev/null @@ -1,92 +0,0 @@ -resource "google_service_account" "custom_service_account" { - account_id = "{{index $.Vars "account_id"}}" - display_name = "Custom Service Account" -} - -resource "google_project_iam_member" "gae_api" { - project = google_service_account.custom_service_account.project - role = "roles/compute.networkUser" - member = "serviceAccount:${google_service_account.custom_service_account.email}" -} - -resource "google_project_iam_member" "storage_viewer" { - project = google_service_account.custom_service_account.project - role = "roles/storage.objectViewer" - member = "serviceAccount:${google_service_account.custom_service_account.email}" -} - -resource "google_app_engine_standard_app_version" "{{$.PrimaryResourceId}}" { - version_id = "v1" - service = "myapp" - runtime = "nodejs20" - - entrypoint { - shell = "node ./app.js" - } - - deployment { - zip { - source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - } - } - - env_variables = { - port = "8080" - } - - automatic_scaling { - max_concurrent_requests = 10 - min_idle_instances = 1 - max_idle_instances = 3 - min_pending_latency = "1s" - max_pending_latency = "5s" - standard_scheduler_settings { - target_cpu_utilization = 0.5 - target_throughput_utilization = 0.75 - min_instances = 2 - max_instances = 10 - } - } - - delete_service_on_destroy = true - service_account = google_service_account.custom_service_account.email -} - -resource "google_app_engine_standard_app_version" "myapp_v2" { - version_id = "v2" - service = "myapp" - runtime = "nodejs20" - app_engine_apis = true - - entrypoint { - shell = "node ./app.js" - } - - deployment { - zip { - source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}" - } - } - - env_variables = { - port = "8080" - } - - basic_scaling { - max_instances = 5 - } - - noop_on_destroy = true - service_account = google_service_account.custom_service_account.email -} - -resource "google_storage_bucket" "bucket" { - name = "{{index $.Vars "bucket_name"}}" - location = "US" -} - -resource "google_storage_bucket_object" "object" { - name = "hello-world.zip" - bucket = google_storage_bucket.bucket.name - source = "./test-fixtures/hello-world.zip" -} diff --git a/mmv1/templates/terraform/examples/go/apphub_application_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apphub_application_basic.tf.tmpl deleted file mode 100644 index 1e48d362718a..000000000000 --- a/mmv1/templates/terraform/examples/go/apphub_application_basic.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_apphub_application" "{{$.PrimaryResourceId}}" { - location = "us-east1" - application_id = "{{index $.Vars "application_id"}}" - scope { - type = "REGIONAL" - } -} diff --git a/mmv1/templates/terraform/examples/go/apphub_application_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apphub_application_full.tf.tmpl deleted file mode 100644 index daf707b451c5..000000000000 --- a/mmv1/templates/terraform/examples/go/apphub_application_full.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_apphub_application" "{{$.PrimaryResourceId}}" { - location = "us-east1" - application_id = "{{index $.Vars "application_id"}}" - display_name = "{{index $.Vars "display_name"}}" - scope { - type = "REGIONAL" - } - description = "{{index $.Vars "desc"}}" - attributes { - environment { - type = "STAGING" - } - criticality { - type = "MISSION_CRITICAL" - } - business_owners { - display_name = "{{index $.Vars "business_name"}}" - email = "{{index $.Vars "business_email"}}" - } - developer_owners { - display_name = "{{index $.Vars "developer_name"}}" - email = "{{index $.Vars "developer_email"}}" - } - operator_owners { - display_name = "{{index $.Vars "operator_name"}}" - email = "{{index $.Vars "operator_email"}}" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/apphub_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apphub_service_basic.tf.tmpl deleted file mode 100644 index 0c11196256e0..000000000000 --- a/mmv1/templates/terraform/examples/go/apphub_service_basic.tf.tmpl +++ /dev/null @@ -1,109 +0,0 @@ -resource "google_apphub_application" "application" { - location = "us-central1" - application_id = "{{index $.Vars "application_id"}}" - scope { - type = "REGIONAL" - } -} - -resource "google_project" "service_project" { - project_id ="{{index $.Vars "service_project_attachment_id"}}" - name = "Service Project" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -# Enable Compute API -resource "google_project_service" "compute_service_project" { - project = google_project.service_project.project_id - service = "compute.googleapis.com" -} - -resource "time_sleep" "wait_120s" { - depends_on = [google_project_service.compute_service_project] - - create_duration = "120s" -} - -resource "google_apphub_service_project_attachment" "service_project_attachment" { - service_project_attachment_id = google_project.service_project.project_id - depends_on = [time_sleep.wait_120s] -} - -# discovered service block -data "google_apphub_discovered_service" "catalog-service" { - provider = google - location = "us-central1" - service_uri = "//compute.googleapis.com/${google_compute_forwarding_rule.forwarding_rule.id}" - depends_on = [google_apphub_service_project_attachment.service_project_attachment, time_sleep.wait_120s_for_resource_ingestion] -} - -resource "time_sleep" "wait_120s_for_resource_ingestion" { - depends_on = [google_compute_forwarding_rule.forwarding_rule] - create_duration = "120s" -} - -resource "google_apphub_service" "{{$.PrimaryResourceId}}" { - location = "us-central1" - application_id = google_apphub_application.application.application_id - service_id = google_compute_forwarding_rule.forwarding_rule.name - discovered_service = data.google_apphub_discovered_service.catalog-service.name -} - - -#creates service - - -# VPC network -resource "google_compute_network" "ilb_network" { - name = "{{index $.Vars "ilb_network"}}" - project = google_project.service_project.project_id - auto_create_subnetworks = false - depends_on = [time_sleep.wait_120s] -} - - -# backend subnet -resource "google_compute_subnetwork" "ilb_subnet" { - name = "{{index $.Vars "ilb_subnet"}}" - project = google_project.service_project.project_id - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.ilb_network.id -} - -# forwarding rule -resource "google_compute_forwarding_rule" "forwarding_rule" { - name ="{{index $.Vars "forwarding_rule"}}" - project = google_project.service_project.project_id - region = "us-central1" - ip_version = "IPV4" - load_balancing_scheme = "INTERNAL" - all_ports = true - backend_service = google_compute_region_backend_service.backend.id - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id -} - - - -# backend service -resource "google_compute_region_backend_service" "backend" { - name = "{{index $.Vars "backend_service"}}" - project = google_project.service_project.project_id - region = "us-central1" - health_checks = [google_compute_health_check.default.id] -} - -# health check -resource "google_compute_health_check" "default" { - name = "{{index $.Vars "health_check"}}" - project = google_project.service_project.project_id - check_interval_sec = 1 - timeout_sec = 1 - tcp_health_check { - port = "80" - } - depends_on = [time_sleep.wait_120s] -} diff --git a/mmv1/templates/terraform/examples/go/apphub_service_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apphub_service_full.tf.tmpl deleted file mode 100644 index 31a52f86769e..000000000000 --- a/mmv1/templates/terraform/examples/go/apphub_service_full.tf.tmpl +++ /dev/null @@ -1,131 +0,0 @@ -resource "google_apphub_application" "application" { - location = "us-central1" - application_id = "{{index $.Vars "application_id"}}" - scope { - type = "REGIONAL" - } -} - -resource "google_project" "service_project" { - project_id ="{{index $.Vars "service_project_attachment_id"}}" - name = "Service Project" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -# Enable Compute API -resource "google_project_service" "compute_service_project" { - project = google_project.service_project.project_id - service = "compute.googleapis.com" -} - -resource "time_sleep" "wait_120s" { - depends_on = [google_project_service.compute_service_project] - - create_duration = "120s" -} - -resource "google_apphub_service_project_attachment" "service_project_attachment" { - service_project_attachment_id = google_project.service_project.project_id - depends_on = [time_sleep.wait_120s] -} - -# discovered service block -data "google_apphub_discovered_service" "catalog-service" { - provider = google - location = "us-central1" - service_uri = "//compute.googleapis.com/${google_compute_forwarding_rule.forwarding_rule.id}" - depends_on = [google_apphub_service_project_attachment.service_project_attachment, time_sleep.wait_120s_for_resource_ingestion] -} - -resource "time_sleep" "wait_120s_for_resource_ingestion" { - depends_on = [google_compute_forwarding_rule.forwarding_rule] - create_duration = "120s" -} - -resource "google_apphub_service" "{{$.PrimaryResourceId}}" { - location = "us-central1" - application_id = google_apphub_application.application.application_id - service_id = google_compute_forwarding_rule.forwarding_rule.name - discovered_service = data.google_apphub_discovered_service.catalog-service.name - display_name = "{{index $.Vars "display_name"}}" - description = "{{index $.Vars "desc"}}" - attributes { - environment { - type = "STAGING" - } - criticality { - type = "MISSION_CRITICAL" - } - business_owners { - display_name = "{{index $.Vars "business_name"}}" - email = "{{index $.Vars "business_email"}}" - } - developer_owners { - display_name = "{{index $.Vars "developer_name"}}" - email = "{{index $.Vars "developer_email"}}" - } - operator_owners { - display_name = "{{index $.Vars "operator_name"}}" - email = "{{index $.Vars "operator_email"}}" - } - } -} - - -#creates service - - -# VPC network -resource "google_compute_network" "ilb_network" { - name = "{{index $.Vars "ilb_network"}}" - project = google_project.service_project.project_id - auto_create_subnetworks = false - depends_on = [time_sleep.wait_120s] -} - - -# backend subnet -resource "google_compute_subnetwork" "ilb_subnet" { - name = "{{index $.Vars "ilb_subnet"}}" - project = google_project.service_project.project_id - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.ilb_network.id -} - -# forwarding rule -resource "google_compute_forwarding_rule" "forwarding_rule" { - name ="{{index $.Vars "forwarding_rule"}}" - project = google_project.service_project.project_id - region = "us-central1" - ip_version = "IPV4" - load_balancing_scheme = "INTERNAL" - all_ports = true - backend_service = google_compute_region_backend_service.backend.id - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id -} - - - -# backend service -resource "google_compute_region_backend_service" "backend" { - name = "{{index $.Vars "backend_service"}}" - project = google_project.service_project.project_id - region = "us-central1" - health_checks = [google_compute_health_check.default.id] -} - -# health check -resource "google_compute_health_check" "default" { - name = "{{index $.Vars "health_check"}}" - project = google_project.service_project.project_id - check_interval_sec = 1 - timeout_sec = 1 - tcp_health_check { - port = "80" - } - depends_on = [time_sleep.wait_120s] -} diff --git a/mmv1/templates/terraform/examples/go/apphub_service_project_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apphub_service_project_attachment_basic.tf.tmpl deleted file mode 100644 index f70836d2f6bb..000000000000 --- a/mmv1/templates/terraform/examples/go/apphub_service_project_attachment_basic.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_apphub_service_project_attachment" "{{$.PrimaryResourceId}}" { - service_project_attachment_id = google_project.service_project.project_id - depends_on = [time_sleep.wait_120s] -} - -resource "google_project" "service_project" { - project_id ="{{index $.Vars "service_project_attachment_id"}}" - name = "Service Project" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} - -resource "time_sleep" "wait_120s" { - depends_on = [google_project.service_project] - - create_duration = "120s" -} diff --git a/mmv1/templates/terraform/examples/go/apphub_service_project_attachment_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apphub_service_project_attachment_full.tf.tmpl deleted file mode 100644 index 080cc3ff9072..000000000000 --- a/mmv1/templates/terraform/examples/go/apphub_service_project_attachment_full.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_apphub_service_project_attachment" "{{$.PrimaryResourceId}}" { - service_project_attachment_id = google_project.service_project_full.project_id - service_project = google_project.service_project_full.project_id - depends_on = [time_sleep.wait_120s] -} - -resource "google_project" "service_project_full" { - project_id ="{{index $.Vars "service_project_attachment_id"}}" - name = "Service Project Full" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} - -resource "time_sleep" "wait_120s" { - depends_on = [google_project.service_project_full] - - create_duration = "120s" -} diff --git a/mmv1/templates/terraform/examples/go/apphub_workload_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/apphub_workload_basic.tf.tmpl deleted file mode 100644 index 392395e8017e..000000000000 --- a/mmv1/templates/terraform/examples/go/apphub_workload_basic.tf.tmpl +++ /dev/null @@ -1,127 +0,0 @@ -resource "google_apphub_application" "application" { - location = "us-central1" - application_id = "{{index $.Vars "application_id"}}" - scope { - type = "REGIONAL" - } -} - -resource "google_project" "service_project" { - project_id ="{{index $.Vars "service_project_attachment_id"}}" - name = "Service Project" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -# Enable Compute API -resource "google_project_service" "compute_service_project" { - project = google_project.service_project.project_id - service = "compute.googleapis.com" -} - -resource "time_sleep" "wait_120s" { - depends_on = [google_project_service.compute_service_project] - - create_duration = "120s" -} - -resource "google_apphub_service_project_attachment" "service_project_attachment" { - service_project_attachment_id = google_project.service_project.project_id - depends_on = [time_sleep.wait_120s] -} - - -# Discovered workload -data "google_apphub_discovered_workload" "catalog-workload" { - location = "us-central1" - workload_uri = "${replace(google_compute_region_instance_group_manager.mig.instance_group, "https://www.googleapis.com/compute/v1", "//compute.googleapis.com")}" - depends_on = [time_sleep.wait_120s_for_resource_ingestion] -} - -resource "time_sleep" "wait_120s_for_resource_ingestion" { - depends_on = [google_compute_region_instance_group_manager.mig] - create_duration = "120s" -} - -resource "google_apphub_workload" "{{$.PrimaryResourceId}}" { - location = "us-central1" - application_id = google_apphub_application.application.application_id - workload_id = google_compute_region_instance_group_manager.mig.name - discovered_workload = data.google_apphub_discovered_workload.catalog-workload.name -} - -#Workload creation - - -# VPC network -resource "google_compute_network" "ilb_network" { - name = "{{index $.Vars "ilb_network"}}" - project = google_project.service_project.project_id - auto_create_subnetworks = false - depends_on = [time_sleep.wait_120s] -} - -# backend subnet -resource "google_compute_subnetwork" "ilb_subnet" { - name = "{{index $.Vars "ilb_subnet"}}" - project = google_project.service_project.project_id - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.ilb_network.id -} - -# instance template -resource "google_compute_instance_template" "instance_template" { - name = "{{index $.Vars "instance_template"}}" - project = google_project.service_project.project_id - machine_type = "e2-small" - tags = ["http-server"] - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - access_config { - # add external ip to fetch packages - } - } - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y nginx-light jq - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - cat < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -resource "google_compute_region_instance_group_manager" "mig" { - name = "{{index $.Vars "mig"}}" - project = google_project.service_project.project_id - region = "us-central1" - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/apphub_workload_full.tf.tmpl b/mmv1/templates/terraform/examples/go/apphub_workload_full.tf.tmpl deleted file mode 100644 index 2a51cfb09d59..000000000000 --- a/mmv1/templates/terraform/examples/go/apphub_workload_full.tf.tmpl +++ /dev/null @@ -1,148 +0,0 @@ -resource "google_apphub_application" "application" { - location = "us-central1" - application_id = "{{index $.Vars "application_id"}}" - scope { - type = "REGIONAL" - } -} - -resource "google_project" "service_project" { - project_id ="{{index $.Vars "service_project_attachment_id"}}" - name = "Service Project" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -# Enable Compute API -resource "google_project_service" "compute_service_project" { - project = google_project.service_project.project_id - service = "compute.googleapis.com" -} - -resource "time_sleep" "wait_120s" { - depends_on = [google_project_service.compute_service_project] - - create_duration = "120s" -} - -resource "google_apphub_service_project_attachment" "service_project_attachment" { - service_project_attachment_id = google_project.service_project.project_id - depends_on = [time_sleep.wait_120s] -} - -# Discovered workload -data "google_apphub_discovered_workload" "catalog-workload" { - location = "us-central1" - workload_uri = "${replace(google_compute_region_instance_group_manager.mig.instance_group, "https://www.googleapis.com/compute/v1", "//compute.googleapis.com")}" - depends_on = [time_sleep.wait_120s_for_resource_ingestion] -} - -resource "time_sleep" "wait_120s_for_resource_ingestion" { - depends_on = [google_compute_region_instance_group_manager.mig] - create_duration = "120s" -} - -resource "google_apphub_workload" "{{$.PrimaryResourceId}}" { - location = "us-central1" - application_id = google_apphub_application.application.application_id - workload_id = google_compute_region_instance_group_manager.mig.name - discovered_workload = data.google_apphub_discovered_workload.catalog-workload.name - display_name = "{{index $.Vars "display_name"}}" - description = "{{index $.Vars "desc"}}" - attributes { - environment { - type = "STAGING" - } - criticality { - type = "MISSION_CRITICAL" - } - business_owners { - display_name = "{{index $.Vars "business_name"}}" - email = "{{index $.Vars "business_email"}}" - } - developer_owners { - display_name = "{{index $.Vars "developer_name"}}" - email = "{{index $.Vars "developer_email"}}" - } - operator_owners { - display_name = "{{index $.Vars "operator_name"}}" - email = "{{index $.Vars "operator_email"}}" - } - } -} - -#Workload creation - - -# VPC network -resource "google_compute_network" "ilb_network" { - name = "{{index $.Vars "ilb_network"}}" - project = google_project.service_project.project_id - auto_create_subnetworks = false - depends_on = [time_sleep.wait_120s] -} - -# backend subnet -resource "google_compute_subnetwork" "ilb_subnet" { - name = "{{index $.Vars "ilb_subnet"}}" - project = google_project.service_project.project_id - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.ilb_network.id -} - -# instance template -resource "google_compute_instance_template" "instance_template" { - name = "{{index $.Vars "instance_template"}}" - project = google_project.service_project.project_id - machine_type = "e2-small" - tags = ["http-server"] - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - access_config { - # add external ip to fetch packages - } - } - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y nginx-light jq - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - cat < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -resource "google_compute_region_instance_group_manager" "mig" { - name = "{{index $.Vars "mig"}}" - project = google_project.service_project.project_id - region = "us-central1" - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_basic.tf.tmpl deleted file mode 100644 index 37687acc6960..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_basic.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "DOCKER" -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_cleanup.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_cleanup.tf.tmpl deleted file mode 100644 index 8853964941e1..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_cleanup.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "DOCKER" - cleanup_policy_dry_run = false - cleanup_policies { - id = "delete-prerelease" - action = "DELETE" - condition { - tag_state = "TAGGED" - tag_prefixes = ["alpha", "v0"] - older_than = "2592000s" - } - } - cleanup_policies { - id = "keep-tagged-release" - action = "KEEP" - condition { - tag_state = "TAGGED" - tag_prefixes = ["release"] - package_name_prefixes = ["webapp", "mobile"] - } - } - cleanup_policies { - id = "keep-minimum-versions" - action = "KEEP" - most_recent_versions { - package_name_prefixes = ["webapp", "mobile", "sandbox"] - keep_count = 5 - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_cmek.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_cmek.tf.tmpl deleted file mode 100644 index 872bc29043ab..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_cmek.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "example docker repository with cmek" - format = "DOCKER" - kms_key_name = "{{index $.Vars "kms_key_name"}}" - depends_on = [ - google_kms_crypto_key_iam_member.crypto_key - ] -} - -resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "{{index $.Vars "kms_key_name"}}" - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" -} - -data "google_project" "project" {} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_docker.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_docker.tf.tmpl deleted file mode 100644 index b7c1bd729542..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_docker.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "DOCKER" - - docker_config { - immutable_tags = true - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote.tf.tmpl deleted file mode 100644 index a91876f75950..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "DOCKER" - mode = "REMOTE_REPOSITORY" - remote_repository_config { - description = "docker hub" - docker_repository { - public_repository = "DOCKER_HUB" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_apt.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_apt.tf.tmpl deleted file mode 100644 index ddffa4d557c1..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_apt.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "APT" - mode = "REMOTE_REPOSITORY" - remote_repository_config { - description = "Debian buster remote repository" - apt_repository { - public_repository { - repository_base = "DEBIAN" - repository_path = "debian/dists/buster" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_docker_custom_with_auth.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_docker_custom_with_auth.tf.tmpl deleted file mode 100644 index 17a3951db7f6..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_docker_custom_with_auth.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -data "google_project" "project" {} - -resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { - secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - secret_data = "{{index $.Vars "secret_data"}}" -} - -resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - role = "roles/secretmanager.secretAccessor" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" -} - -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "DOCKER" - mode = "REMOTE_REPOSITORY" - remote_repository_config { - description = "custom docker remote with credentials" - disable_upstream_validation = true - docker_repository { - custom_repository { - uri = "https://registry-1.docker.io" - } - } - upstream_credentials { - username_password_credentials { - username = "{{index $.Vars "username"}}" - password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_dockerhub_auth.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_dockerhub_auth.tf.tmpl deleted file mode 100644 index e005c0e8ed59..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_dockerhub_auth.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -data "google_project" "project" {} - -resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { - secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - secret_data = "{{index $.Vars "secret_data"}}" -} - -resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - role = "roles/secretmanager.secretAccessor" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" -} - -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "DOCKER" - mode = "REMOTE_REPOSITORY" - remote_repository_config { - description = "docker hub with custom credentials" - disable_upstream_validation = true - docker_repository { - public_repository = "DOCKER_HUB" - } - upstream_credentials { - username_password_credentials { - username = "{{index $.Vars "username"}}" - password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_maven_custom_with_auth.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_maven_custom_with_auth.tf.tmpl deleted file mode 100644 index e259ae40a08e..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_maven_custom_with_auth.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -data "google_project" "project" {} - -resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { - secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - secret_data = "{{index $.Vars "secret_data"}}" -} - -resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - role = "roles/secretmanager.secretAccessor" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" -} - -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "MAVEN" - mode = "REMOTE_REPOSITORY" - remote_repository_config { - description = "custom maven remote with credentials" - disable_upstream_validation = true - maven_repository { - custom_repository { - uri = "https://my.maven.registry" - } - } - upstream_credentials { - username_password_credentials { - username = "{{index $.Vars "username"}}" - password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_npm_custom_with_auth.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_npm_custom_with_auth.tf.tmpl deleted file mode 100644 index 8606714a3644..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_npm_custom_with_auth.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -data "google_project" "project" {} - -resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { - secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - secret_data = "{{index $.Vars "secret_data"}}" -} - -resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - role = "roles/secretmanager.secretAccessor" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" -} - -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "NPM" - mode = "REMOTE_REPOSITORY" - remote_repository_config { - description = "custom npm with credentials" - disable_upstream_validation = true - npm_repository { - custom_repository { - uri = "https://my.npm.registry" - } - } - upstream_credentials { - username_password_credentials { - username = "{{index $.Vars "username"}}" - password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_python_custom_with_auth.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_python_custom_with_auth.tf.tmpl deleted file mode 100644 index fa58182a7b44..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_python_custom_with_auth.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -data "google_project" "project" {} - -resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { - secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - secret_data = "{{index $.Vars "secret_data"}}" -} - -resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id - role = "roles/secretmanager.secretAccessor" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" -} - -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "PYTHON" - mode = "REMOTE_REPOSITORY" - remote_repository_config { - description = "custom npm with credentials" - disable_upstream_validation = true - python_repository { - custom_repository { - uri = "https://my.python.registry" - } - } - upstream_credentials { - username_password_credentials { - username = "{{index $.Vars "username"}}" - password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_yum.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_yum.tf.tmpl deleted file mode 100644 index dd2bba09cf8f..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_remote_yum.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "YUM" - mode = "REMOTE_REPOSITORY" - remote_repository_config { - description = "Rocky 9 remote repository" - yum_repository { - public_repository { - repository_base = "ROCKY" - repository_path = "pub/rocky/9/BaseOS/x86_64/os" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_repository_virtual.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_repository_virtual.tf.tmpl deleted file mode 100644 index 88ce7362dafb..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_repository_virtual.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}-upstream-1" { - location = "us-central1" - repository_id = "{{index $.Vars "upstream_repository_id"}}-1" - description = "{{index $.Vars "upstream_desc"}} 1" - format = "DOCKER" -} - -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}-upstream-2" { - location = "us-central1" - repository_id = "{{index $.Vars "upstream_repository_id"}}-2" - description = "{{index $.Vars "upstream_desc"}} 2" - format = "DOCKER" -} - -resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { - depends_on = [] - location = "us-central1" - repository_id = "{{index $.Vars "repository_id"}}" - description = "{{index $.Vars "desc"}}" - format = "DOCKER" - mode = "VIRTUAL_REPOSITORY" - virtual_repository_config { - upstream_policies { - id = "{{index $.Vars "upstream_policy_id"}}-1" - repository = google_artifact_registry_repository.{{$.PrimaryResourceId}}-upstream-1.id - priority = 20 - } - upstream_policies { - id = "{{index $.Vars "upstream_policy_id"}}-2" - repository = google_artifact_registry_repository.{{$.PrimaryResourceId}}-upstream-2.id - priority = 10 - } - } -} diff --git a/mmv1/templates/terraform/examples/go/artifact_registry_vpcsc_config.tf.tmpl b/mmv1/templates/terraform/examples/go/artifact_registry_vpcsc_config.tf.tmpl deleted file mode 100644 index 431fb79c9c90..000000000000 --- a/mmv1/templates/terraform/examples/go/artifact_registry_vpcsc_config.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_artifact_registry_vpcsc_config" "{{$.PrimaryResourceId}}" { - provider = google-beta - location = "us-central1" - vpcsc_policy = "ALLOW" -} - diff --git a/mmv1/templates/terraform/examples/go/autoscaler_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/autoscaler_basic.tf.tmpl deleted file mode 100644 index d9854df5960b..000000000000 --- a/mmv1/templates/terraform/examples/go/autoscaler_basic.tf.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -resource "google_compute_autoscaler" "foobar" { - name = "{{index $.Vars "autoscaler_name"}}" - zone = "us-central1-f" - target = google_compute_instance_group_manager.foobar.id - - autoscaling_policy { - max_replicas = 5 - min_replicas = 1 - cooldown_period = 60 - - cpu_utilization { - target = 0.5 - } - } -} - -resource "google_compute_instance_template" "foobar" { - name = "{{index $.Vars "instance_template_name"}}" - machine_type = "e2-medium" - can_ip_forward = false - - tags = ["foo", "bar"] - - disk { - source_image = data.google_compute_image.debian_9.id - } - - network_interface { - network = "default" - } - - metadata = { - foo = "bar" - } - - service_account { - scopes = ["userinfo-email", "compute-ro", "storage-ro"] - } -} - -resource "google_compute_target_pool" "foobar" { - name = "{{index $.Vars "target_pool_name"}}" -} - -resource "google_compute_instance_group_manager" "foobar" { - name = "{{index $.Vars "igm_name"}}" - zone = "us-central1-f" - - version { - instance_template = google_compute_instance_template.foobar.id - name = "primary" - } - - target_pools = [google_compute_target_pool.foobar.id] - base_instance_name = "foobar" -} - -data "google_compute_image" "debian_9" { - family = "debian-11" - project = "debian-cloud" -} diff --git a/mmv1/templates/terraform/examples/go/autoscaler_single_instance.tf.tmpl b/mmv1/templates/terraform/examples/go/autoscaler_single_instance.tf.tmpl deleted file mode 100644 index 728f2e2416d2..000000000000 --- a/mmv1/templates/terraform/examples/go/autoscaler_single_instance.tf.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -resource "google_compute_autoscaler" "{{$.PrimaryResourceId}}" { - provider = {{index $.Vars "provider_name"}} - - name = "{{index $.Vars "autoscaler_name"}}" - zone = "us-central1-f" - target = google_compute_instance_group_manager.default.id - - autoscaling_policy { - max_replicas = 5 - min_replicas = 1 - cooldown_period = 60 - - metric { - name = "pubsub.googleapis.com/subscription/num_undelivered_messages" - filter = "resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription" - single_instance_assignment = 65535 - } - } -} - -resource "google_compute_instance_template" "default" { - provider = {{index $.Vars "provider_name"}} - - name = "{{index $.Vars "instance_template_name"}}" - machine_type = "e2-medium" - can_ip_forward = false - - tags = ["foo", "bar"] - - disk { - source_image = data.google_compute_image.debian_9.id - } - - network_interface { - network = "default" - } - - metadata = { - foo = "bar" - } - - service_account { - scopes = ["userinfo-email", "compute-ro", "storage-ro"] - } -} - -resource "google_compute_target_pool" "default" { - provider = {{index $.Vars "provider_name"}} - - name = "{{index $.Vars "target_pool_name"}}" -} - -resource "google_compute_instance_group_manager" "default" { - provider = {{index $.Vars "provider_name"}} - - name = "{{index $.Vars "igm_name"}}" - zone = "us-central1-f" - - version { - instance_template = google_compute_instance_template.default.id - name = "primary" - } - - target_pools = [google_compute_target_pool.default.id] - base_instance_name = "autoscaler-sample" -} - -data "google_compute_image" "debian_9" { - provider = {{index $.Vars "provider_name"}} - - family = "debian-11" - project = "debian-cloud" -} - -provider "google-beta" { - region = "us-central1" - zone = "us-central1-a" - {{index $.Vars "provider_alias"}} -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/backend_bucket_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_bucket_basic.tf.tmpl deleted file mode 100644 index fa229adbef50..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_bucket_basic.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_compute_backend_bucket" "image_backend" { - name = "{{index $.Vars "backend_bucket_name"}}" - description = "Contains beautiful images" - bucket_name = google_storage_bucket.image_bucket.name - enable_cdn = true -} - -resource "google_storage_bucket" "image_bucket" { - name = "{{index $.Vars "bucket_name"}}" - location = "EU" -} diff --git a/mmv1/templates/terraform/examples/go/backend_bucket_bypass_cache.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_bucket_bypass_cache.tf.tmpl deleted file mode 100644 index 0c1072b209ac..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_bucket_bypass_cache.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_bucket_name"}}" - description = "Contains beautiful images" - bucket_name = google_storage_bucket.image_bucket.name - enable_cdn = true - cdn_policy { - bypass_cache_on_request_headers { - header_name = "test" - } - } -} - -resource "google_storage_bucket" "image_bucket" { - name = "{{index $.Vars "bucket_name"}}" - location = "EU" -} diff --git a/mmv1/templates/terraform/examples/go/backend_bucket_coalescing.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_bucket_coalescing.tf.tmpl deleted file mode 100644 index aedcc7568d37..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_bucket_coalescing.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_bucket_name"}}" - description = "Contains beautiful images" - bucket_name = google_storage_bucket.image_bucket.name - enable_cdn = true - cdn_policy { - request_coalescing = true - } -} - -resource "google_storage_bucket" "image_bucket" { - name = "{{index $.Vars "bucket_name"}}" - location = "EU" -} diff --git a/mmv1/templates/terraform/examples/go/backend_bucket_full.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_bucket_full.tf.tmpl deleted file mode 100644 index 83fa0b7c308b..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_bucket_full.tf.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_bucket_name"}}" - description = "Contains beautiful beta mages" - bucket_name = google_storage_bucket.{{$.PrimaryResourceId}}.name - enable_cdn = true - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = 3600 - client_ttl = 7200 - max_ttl = 10800 - negative_caching = true - } - custom_response_headers = [ - "X-Client-Geo-Location:{client_region},{client_city}", - "X-Tested-By:Magic-Modules" - ] -} - -resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "bucket_name"}}" - location = "EU" -} diff --git a/mmv1/templates/terraform/examples/go/backend_bucket_include_http_headers.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_bucket_include_http_headers.tf.tmpl deleted file mode 100644 index 476c03f35ca4..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_bucket_include_http_headers.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_bucket_name"}}" - description = "Contains beautiful images" - bucket_name = google_storage_bucket.image_bucket.name - enable_cdn = true - cdn_policy { - cache_key_policy { - include_http_headers = ["X-My-Header-Field"] - } - } -} - -resource "google_storage_bucket" "image_bucket" { - name = "{{index $.Vars "backend_bucket_name"}}" - location = "EU" -} diff --git a/mmv1/templates/terraform/examples/go/backend_bucket_query_string_whitelist.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_bucket_query_string_whitelist.tf.tmpl deleted file mode 100644 index 7a424d5b1729..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_bucket_query_string_whitelist.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_bucket_name"}}" - description = "Contains beautiful images" - bucket_name = google_storage_bucket.image_bucket.name - enable_cdn = true - cdn_policy { - cache_key_policy { - query_string_whitelist = ["image-version"] - } - } -} - -resource "google_storage_bucket" "image_bucket" { - name = "{{index $.Vars "backend_bucket_name"}}" - location = "EU" -} diff --git a/mmv1/templates/terraform/examples/go/backend_bucket_security_policy.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_bucket_security_policy.tf.tmpl deleted file mode 100644 index 6b1f2962dc3c..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_bucket_security_policy.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_bucket_name"}}" - description = "Contains beautiful images" - bucket_name = google_storage_bucket.{{$.PrimaryResourceId}}.name - enable_cdn = true - edge_security_policy = google_compute_security_policy.policy.id -} - -resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "bucket_name"}}" - location = "EU" -} - -resource "google_compute_security_policy" "policy" { - name = "{{index $.Vars "bucket_name"}}" - description = "basic security policy" - type = "CLOUD_ARMOR_EDGE" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/backend_bucket_signed_url_key.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_bucket_signed_url_key.tf.tmpl deleted file mode 100644 index 7f936cd2164b..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_bucket_signed_url_key.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "random_id" "url_signature" { - byte_length = 16 -} - -resource "google_compute_backend_bucket_signed_url_key" "backend_key" { - name = "{{index $.Vars "key_name"}}" - key_value = random_id.url_signature.b64_url - backend_bucket = google_compute_backend_bucket.test_backend.name -} - -resource "google_compute_backend_bucket" "test_backend" { - name = "{{index $.Vars "backend_name"}}" - description = "Contains beautiful images" - bucket_name = google_storage_bucket.bucket.name - enable_cdn = true -} - -resource "google_storage_bucket" "bucket" { - name = "{{index $.Vars "bucket_name"}}" - location = "EU" -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_basic.tf.tmpl deleted file mode 100644 index bdd4e9cf799f..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_basic.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_cache.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_cache.tf.tmpl deleted file mode 100644 index 6ad4c2c26738..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_cache.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] - enable_cdn = true - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = 3600 - client_ttl = 7200 - max_ttl = 10800 - negative_caching = true - signed_url_cache_max_age_sec = 7200 - } -} - -resource "google_compute_http_health_check" "default" { - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_cache_bypass_cache_on_request_headers.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_cache_bypass_cache_on_request_headers.tf.tmpl deleted file mode 100644 index 63b1a6000463..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_cache_bypass_cache_on_request_headers.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] - enable_cdn = true - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = 3600 - client_ttl = 7200 - max_ttl = 10800 - negative_caching = true - signed_url_cache_max_age_sec = 7200 - - bypass_cache_on_request_headers { - header_name = "Authorization" - } - - bypass_cache_on_request_headers { - header_name = "Proxy-Authorization" - } - } -} - -resource "google_compute_http_health_check" "default" { - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_cache_include_http_headers.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_cache_include_http_headers.tf.tmpl deleted file mode 100644 index b1b74eef6997..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_cache_include_http_headers.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - enable_cdn = true - cdn_policy { - cache_mode = "USE_ORIGIN_HEADERS" - cache_key_policy { - include_host = true - include_protocol = true - include_query_string = true - include_http_headers = ["X-My-Header-Field"] - } - } -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_cache_include_named_cookies.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_cache_include_named_cookies.tf.tmpl deleted file mode 100644 index 13bb8966b56b..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_cache_include_named_cookies.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - enable_cdn = true - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = 3600 - client_ttl = 7200 - max_ttl = 10800 - cache_key_policy { - include_host = true - include_protocol = true - include_query_string = true - include_named_cookies = ["__next_preview_data", "__prerender_bypass"] - } - } -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_cache_simple.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_cache_simple.tf.tmpl deleted file mode 100644 index 8d9d34d1cc54..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_cache_simple.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] - enable_cdn = true - cdn_policy { - signed_url_cache_max_age_sec = 7200 - } -} - -resource "google_compute_http_health_check" "default" { - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_external_iap.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_external_iap.tf.tmpl deleted file mode 100644 index f2da2681ca83..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_external_iap.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - protocol = "HTTP" - load_balancing_scheme = "EXTERNAL" - iap { - enabled = true - oauth2_client_id = "abc" - oauth2_client_secret = "xyz" - } -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_external_managed.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_external_managed.tf.tmpl deleted file mode 100644 index 800fcf72bb71..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_external_managed.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_health_check.default.id] - load_balancing_scheme = "EXTERNAL_MANAGED" -} - -resource "google_compute_health_check" "default" { - name = "{{index $.Vars "health_check_name"}}" - http_health_check { - port = 80 - } -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_network_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_network_endpoint.tf.tmpl deleted file mode 100644 index 395b563567ed..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_network_endpoint.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_compute_global_network_endpoint_group" "external_proxy" { - provider = google-beta - name = "{{index $.Vars "neg_name"}}" - network_endpoint_type = "INTERNET_FQDN_PORT" - default_port = "443" -} - -resource "google_compute_global_network_endpoint" "proxy" { - provider = google-beta - global_network_endpoint_group = google_compute_global_network_endpoint_group.external_proxy.id - fqdn = "test.example.com" - port = google_compute_global_network_endpoint_group.external_proxy.default_port -} - -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - enable_cdn = true - timeout_sec = 10 - connection_draining_timeout_sec = 10 - - custom_request_headers = ["host: ${google_compute_global_network_endpoint.proxy.fqdn}"] - custom_response_headers = ["X-Cache-Hit: {cdn_cache_status}"] - - backend { - group = google_compute_global_network_endpoint_group.external_proxy.id - } -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_signed_url_key.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_signed_url_key.tf.tmpl deleted file mode 100644 index 0e27e701055d..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_signed_url_key.tf.tmpl +++ /dev/null @@ -1,59 +0,0 @@ -resource "random_id" "url_signature" { - byte_length = 16 -} - -resource "google_compute_backend_service_signed_url_key" "backend_key" { - name = "{{index $.Vars "key_name"}}" - key_value = random_id.url_signature.b64_url - backend_service = google_compute_backend_service.example_backend.name -} - -resource "google_compute_backend_service" "example_backend" { - name = "{{index $.Vars "backend_name"}}" - description = "Our company website" - port_name = "http" - protocol = "HTTP" - timeout_sec = 10 - enable_cdn = true - - backend { - group = google_compute_instance_group_manager.webservers.instance_group - } - - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_instance_group_manager" "webservers" { - name = "{{index $.Vars "igm_name"}}" - - version { - instance_template = google_compute_instance_template.webserver.id - name = "primary" - } - - base_instance_name = "webserver" - zone = "us-central1-f" - target_size = 1 -} - -resource "google_compute_instance_template" "webserver" { - name = "standard-webserver" - machine_type = "e2-medium" - - network_interface { - network = "default" - } - - disk { - source_image = "debian-cloud/debian-11" - auto_delete = true - boot = true - } -} - -resource "google_compute_http_health_check" "default" { - name = "test" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_traffic_director_ring_hash.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_traffic_director_ring_hash.tf.tmpl deleted file mode 100644 index f40a7b76345c..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_traffic_director_ring_hash.tf.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_health_check.health_check.id] - load_balancing_scheme = "INTERNAL_SELF_MANAGED" - locality_lb_policy = "RING_HASH" - session_affinity = "HTTP_COOKIE" - circuit_breakers { - max_connections = 10 - } - consistent_hash { - http_cookie { - ttl { - seconds = 11 - nanos = 1111 - } - name = "mycookie" - } - } - outlier_detection { - consecutive_errors = 2 - consecutive_gateway_failure = 5 - enforcing_consecutive_errors = 100 - enforcing_consecutive_gateway_failure = 0 - enforcing_success_rate = 100 - max_ejection_percent = 10 - success_rate_minimum_hosts = 5 - success_rate_request_volume = 100 - success_rate_stdev_factor = 1900 - } -} - -resource "google_compute_health_check" "health_check" { - provider = google-beta - - name = "{{index $.Vars "health_check_name"}}" - http_health_check { - port = 80 - } -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_traffic_director_round_robin.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_traffic_director_round_robin.tf.tmpl deleted file mode 100644 index 7645808bc4cc..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_traffic_director_round_robin.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_health_check.health_check.id] - load_balancing_scheme = "INTERNAL_SELF_MANAGED" - locality_lb_policy = "ROUND_ROBIN" -} - -resource "google_compute_health_check" "health_check" { - provider = google-beta - - name = "{{index $.Vars "health_check_name"}}" - http_health_check { - port = 80 - } -} diff --git a/mmv1/templates/terraform/examples/go/backend_service_unspecified_protocol_simple.tf.tmpl b/mmv1/templates/terraform/examples/go/backend_service_unspecified_protocol_simple.tf.tmpl deleted file mode 100644 index 4cb46f314166..000000000000 --- a/mmv1/templates/terraform/examples/go/backend_service_unspecified_protocol_simple.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] - protocol = "UNSPECIFIED" - region = "us-central1" - load_balancing_scheme = "INTERNAL" - timeout_sec = 30 -} - -resource "google_compute_http_health_check" "default" { - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} diff --git a/mmv1/templates/terraform/examples/go/backup_dr_backup_vault_full.tf.tmpl b/mmv1/templates/terraform/examples/go/backup_dr_backup_vault_full.tf.tmpl deleted file mode 100644 index a2bf023066c1..000000000000 --- a/mmv1/templates/terraform/examples/go/backup_dr_backup_vault_full.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_backup_dr_backup_vault" "{{$.PrimaryResourceId}}" { - provider = google-beta - location = "us-central1" - backup_vault_id = "{{index $.Vars "backup_vault_id"}}" - description = "This is a second backup vault built by Terraform." - backup_minimum_enforced_retention_duration = "100000s" - labels = { - foo = "bar1" - bar = "baz1" - } - annotations = { - annotations1 = "bar1" - annotations2 = "baz1" - } - force_update = "true" - force_delete = "true" - allow_missing = "true" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/backup_dr_management_server.tf.tmpl b/mmv1/templates/terraform/examples/go/backup_dr_management_server.tf.tmpl deleted file mode 100644 index d5187f9a7a7a..000000000000 --- a/mmv1/templates/terraform/examples/go/backup_dr_management_server.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -resource "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_global_address" "private_ip_address" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - address_type = "INTERNAL" - purpose = "VPC_PEERING" - prefix_length = 20 - network = google_compute_network.default.id -} - -resource "google_service_networking_connection" "default" { - provider = google-beta - network = google_compute_network.default.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_address.name] -} - -resource "google_backup_dr_management_server" "{{$.PrimaryResourceId}}" { - provider = google-beta - location = "us-central1" - name = "{{index $.Vars "managementserver_name"}}" - type = "BACKUP_RESTORE" - networks { - network = google_compute_network.default.id - peering_mode = "PRIVATE_SERVICE_ACCESS" - } - depends_on = [ google_service_networking_connection.default ] -} diff --git a/mmv1/templates/terraform/examples/go/backup_dr_management_server_test.tf.tmpl b/mmv1/templates/terraform/examples/go/backup_dr_management_server_test.tf.tmpl deleted file mode 100644 index 482af3421f94..000000000000 --- a/mmv1/templates/terraform/examples/go/backup_dr_management_server_test.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -data "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" -} - -resource "google_backup_dr_management_server" "{{$.PrimaryResourceId}}" { - provider = google-beta - location = "us-central1" - name = "{{index $.Vars "managementserver_name"}}" - type = "BACKUP_RESTORE" - networks { - network = data.google_compute_network.default.id - peering_mode = "PRIVATE_SERVICE_ACCESS" - } -} diff --git a/mmv1/templates/terraform/examples/go/beyondcorp_app_connection_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/beyondcorp_app_connection_basic.tf.tmpl deleted file mode 100644 index 1a995efb4be7..000000000000 --- a/mmv1/templates/terraform/examples/go/beyondcorp_app_connection_basic.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_service_account" "service_account" { - account_id = "{{index $.Vars "account_id"}}" - display_name = "Test Service Account" -} - -resource "google_beyondcorp_app_connector" "app_connector" { - name = "{{index $.Vars "app_connector_name"}}" - principal_info { - service_account { - email = google_service_account.service_account.email - } - } -} - -resource "google_beyondcorp_app_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "app_connection_name"}}" - type = "TCP_PROXY" - application_endpoint { - host = "foo-host" - port = 8080 - } - connectors = [google_beyondcorp_app_connector.app_connector.id] -} diff --git a/mmv1/templates/terraform/examples/go/beyondcorp_app_connection_full.tf.tmpl b/mmv1/templates/terraform/examples/go/beyondcorp_app_connection_full.tf.tmpl deleted file mode 100644 index 9224d30b34ef..000000000000 --- a/mmv1/templates/terraform/examples/go/beyondcorp_app_connection_full.tf.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -resource "google_service_account" "service_account" { - account_id = "{{index $.Vars "account_id"}}" - display_name = "Test Service Account" -} - -resource "google_beyondcorp_app_gateway" "app_gateway" { - name = "{{index $.Vars "app_gateway_name"}}" - type = "TCP_PROXY" - host_type = "GCP_REGIONAL_MIG" -} - -resource "google_beyondcorp_app_connector" "app_connector" { - name = "{{index $.Vars "app_connector_name"}}" - principal_info { - service_account { - email = google_service_account.service_account.email - } - } -} - -resource "google_beyondcorp_app_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "app_connection_name"}}" - type = "TCP_PROXY" - display_name = "{{index $.Vars "display_name"}}" - application_endpoint { - host = "foo-host" - port = 8080 - } - connectors = [google_beyondcorp_app_connector.app_connector.id] - gateway { - app_gateway = google_beyondcorp_app_gateway.app_gateway.id - } - labels = { - foo = "bar" - bar = "baz" - } -} diff --git a/mmv1/templates/terraform/examples/go/beyondcorp_app_connector_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/beyondcorp_app_connector_basic.tf.tmpl deleted file mode 100644 index c789654397f2..000000000000 --- a/mmv1/templates/terraform/examples/go/beyondcorp_app_connector_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_service_account" "service_account" { - account_id = "{{index $.Vars "account_id"}}" - display_name = "Test Service Account" -} - -resource "google_beyondcorp_app_connector" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "app_connector_name"}}" - principal_info { - service_account { - email = google_service_account.service_account.email - } - } -} diff --git a/mmv1/templates/terraform/examples/go/beyondcorp_app_connector_full.tf.tmpl b/mmv1/templates/terraform/examples/go/beyondcorp_app_connector_full.tf.tmpl deleted file mode 100644 index 2db536b85952..000000000000 --- a/mmv1/templates/terraform/examples/go/beyondcorp_app_connector_full.tf.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -resource "google_service_account" "service_account" { - account_id = "{{index $.Vars "account_id"}}" - display_name = "Test Service Account" -} - -resource "google_beyondcorp_app_connector" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "app_connector_name"}}" - region = "us-central1" - display_name = "{{index $.Vars "display_name"}}" - principal_info { - service_account { - email = google_service_account.service_account.email - } - } - labels = { - foo = "bar" - bar = "baz" - } -} diff --git a/mmv1/templates/terraform/examples/go/beyondcorp_app_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/beyondcorp_app_gateway_basic.tf.tmpl deleted file mode 100644 index cd1efb307100..000000000000 --- a/mmv1/templates/terraform/examples/go/beyondcorp_app_gateway_basic.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_beyondcorp_app_gateway" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "app_gateway_name"}}" - type = "TCP_PROXY" - region = "us-central1" - host_type = "GCP_REGIONAL_MIG" -} diff --git a/mmv1/templates/terraform/examples/go/beyondcorp_app_gateway_full.tf.tmpl b/mmv1/templates/terraform/examples/go/beyondcorp_app_gateway_full.tf.tmpl deleted file mode 100644 index 64ab719c2693..000000000000 --- a/mmv1/templates/terraform/examples/go/beyondcorp_app_gateway_full.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_beyondcorp_app_gateway" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "app_gateway_name"}}" - type = "TCP_PROXY" - region = "us-central1" - display_name = "{{index $.Vars "display_name"}}" - labels = { - foo = "bar" - bar = "baz" - } - host_type = "GCP_REGIONAL_MIG" -} diff --git a/mmv1/templates/terraform/examples/go/biglake_database.tf.tmpl b/mmv1/templates/terraform/examples/go/biglake_database.tf.tmpl deleted file mode 100644 index bfeed43c4997..000000000000 --- a/mmv1/templates/terraform/examples/go/biglake_database.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_biglake_catalog" "catalog" { - name = "{{index $.Vars "catalog_id"}}" - location = "US" -} - -resource "google_storage_bucket" "bucket" { - name = "{{index $.Vars "bucket_id"}}" - location = "US" - force_destroy = true - uniform_bucket_level_access = true -} - -resource "google_storage_bucket_object" "metadata_folder" { - name = "metadata/" - content = " " - bucket = google_storage_bucket.bucket.name -} - -resource "google_biglake_database" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - catalog = google_biglake_catalog.catalog.id - type = "HIVE" - hive_options { - location_uri = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.metadata_folder.name}" - parameters = { - "owner": "John Doe" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/biglake_table.tf.tmpl b/mmv1/templates/terraform/examples/go/biglake_table.tf.tmpl deleted file mode 100644 index 69c554130d00..000000000000 --- a/mmv1/templates/terraform/examples/go/biglake_table.tf.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -resource "google_biglake_catalog" "catalog" { - name = "{{index $.Vars "catalog"}}" - location = "US" -} - -resource "google_storage_bucket" "bucket" { - name = "{{index $.Vars "bucket"}}" - location = "US" - force_destroy = true - uniform_bucket_level_access = true -} - -resource "google_storage_bucket_object" "metadata_folder" { - name = "metadata/" - content = " " - bucket = google_storage_bucket.bucket.name -} - - -resource "google_storage_bucket_object" "data_folder" { - name = "data/" - content = " " - bucket = google_storage_bucket.bucket.name -} - -resource "google_biglake_database" "database" { - name = "{{index $.Vars "database"}}" - catalog = google_biglake_catalog.catalog.id - type = "HIVE" - hive_options { - location_uri = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.metadata_folder.name}" - parameters = { - "owner" = "Alex" - } - } -} - -resource "google_biglake_table" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - database = google_biglake_database.database.id - type = "HIVE" - hive_options { - table_type = "MANAGED_TABLE" - storage_descriptor { - location_uri = "gs://${google_storage_bucket.bucket.name}/${google_storage_bucket_object.data_folder.name}" - input_format = "org.apache.hadoop.mapred.SequenceFileInputFormat" - output_format = "org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat" - } - # Some Example Parameters. - parameters = { - "spark.sql.create.version" = "3.1.3" - "spark.sql.sources.schema.numParts" = "1" - "transient_lastDdlTime" = "1680894197" - "spark.sql.partitionProvider" = "catalog" - "owner" = "John Doe" - "spark.sql.sources.schema.part.0"= "{\"type\":\"struct\",\"fields\":[{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"name\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"age\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}]}" - "spark.sql.sources.provider" = "iceberg" - "provider" = "iceberg" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/bigquery_analyticshub_data_exchange_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/bigquery_analyticshub_data_exchange_basic.tf.tmpl deleted file mode 100644 index 54cb026c6177..000000000000 --- a/mmv1/templates/terraform/examples/go/bigquery_analyticshub_data_exchange_basic.tf.tmpl +++ /dev/null @@ -1,6 +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"}}" -} diff --git a/mmv1/templates/terraform/examples/go/bigquery_analyticshub_data_exchange_dcr.tf.tmpl b/mmv1/templates/terraform/examples/go/bigquery_analyticshub_data_exchange_dcr.tf.tmpl deleted file mode 100644 index bc26d58a9a52..000000000000 --- a/mmv1/templates/terraform/examples/go/bigquery_analyticshub_data_exchange_dcr.tf.tmpl +++ /dev/null @@ -1,9 +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"}}" - sharing_environment_config { - dcr_exchange_config {} - } -} diff --git a/mmv1/templates/terraform/examples/go/bigquery_analyticshub_listing_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/bigquery_analyticshub_listing_basic.tf.tmpl deleted file mode 100644 index b9900df469f8..000000000000 --- a/mmv1/templates/terraform/examples/go/bigquery_analyticshub_listing_basic.tf.tmpl +++ /dev/null @@ -1,25 +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" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/bigquery_analyticshub_listing_dcr.tf.tmpl b/mmv1/templates/terraform/examples/go/bigquery_analyticshub_listing_dcr.tf.tmpl deleted file mode 100644 index 1dbf2705cf73..000000000000 --- a/mmv1/templates/terraform/examples/go/bigquery_analyticshub_listing_dcr.tf.tmpl +++ /dev/null @@ -1,60 +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"}}" - sharing_environment_config { - dcr_exchange_config {} - } -} - -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 - selected_resources { - table = google_bigquery_table.{{$.PrimaryResourceId}}.id - } - } - - restricted_export_config { - enabled = true - } -} - -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_table" "{{$.PrimaryResourceId}}" { - deletion_protection = false - table_id = "{{index $.Vars "listing_id"}}" - dataset_id = google_bigquery_dataset.{{$.PrimaryResourceId}}.dataset_id - schema = <Some example SSML XML - EOF - } - } - messages { - live_agent_handoff { - metadata = <Some example SSML XML - EOF - } - } - messages { - live_agent_handoff { - metadata = <Some example SSML XML - EOF - } - } - messages { - live_agent_handoff { - metadata = <Some example SSML XML - EOF - } - } - messages { - live_agent_handoff { - metadata = <Some example SSML XML - EOF - } - } - messages { - live_agent_handoff { - metadata = <Some example SSML XML - EOF - } - } - messages { - live_agent_handoff { - metadata = <Some example SSML XML - EOF - } - } - messages { - live_agent_handoff { - metadata = <

Hello World!

" > /var/www/html/index.html - EOF -} - -# to allow http traffic -resource "google_compute_firewall" "default" { - name = "{{index $.Vars "allow_http_traffic"}}" - network = "default" - allow { - ports = ["80"] - protocol = "tcp" - } - source_ranges = ["0.0.0.0/0"] -} - -# to create a DNS zone -resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "example_zone_googlecloudexample"}}" - dns_name = "{{index $.Vars "dns_name"}}" - description = "Example DNS zone" - force_destroy = "true" -} - -# to register web-server's ip address in DNS -resource "google_dns_record_set" "default" { - name = google_dns_managed_zone.default.dns_name - managed_zone = google_dns_managed_zone.default.name - type = "A" - ttl = 300 - rrdatas = [ - google_compute_instance.default.network_interface.0.access_config.0.nat_ip - ] -} diff --git a/mmv1/templates/terraform/examples/go/dns_managed_zone_service_directory.tf.tmpl b/mmv1/templates/terraform/examples/go/dns_managed_zone_service_directory.tf.tmpl deleted file mode 100644 index 916242554cd1..000000000000 --- a/mmv1/templates/terraform/examples/go/dns_managed_zone_service_directory.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { - provider = google-beta - - name = "{{index $.Vars "zone_name"}}" - 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 = "example" - location = "us-central1" -} - -resource "google_compute_network" "network" { - provider = google-beta - - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/go/dns_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/dns_policy_basic.tf.tmpl deleted file mode 100644 index 86ceb05b04d9..000000000000 --- a/mmv1/templates/terraform/examples/go/dns_policy_basic.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -resource "google_dns_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "policy_name"}}" - enable_inbound_forwarding = true - - enable_logging = true - - alternative_name_server_config { - target_name_servers { - ipv4_address = "172.16.1.10" - forwarding_path = "private" - } - target_name_servers { - ipv4_address = "172.16.1.20" - } - } - - networks { - network_url = google_compute_network.network-1.id - } - networks { - network_url = google_compute_network.network-2.id - } -} - -resource "google_compute_network" "network-1" { - name = "{{index $.Vars "network_1_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_network" "network-2" { - name = "{{index $.Vars "network_2_name"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/go/dns_policy_multiproject.tf.tmpl b/mmv1/templates/terraform/examples/go/dns_policy_multiproject.tf.tmpl deleted file mode 100644 index 74be0624fdc8..000000000000 --- a/mmv1/templates/terraform/examples/go/dns_policy_multiproject.tf.tmpl +++ /dev/null @@ -1,114 +0,0 @@ -resource "google_dns_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "policy_name"}}" - enable_inbound_forwarding = true - - enable_logging = true - - networks { - network_url = google_compute_network.network_1_project_1.id - } - networks { - network_url = google_compute_network.network_2_project_1.id - } - networks { - network_url = google_compute_network.network_1_project_2.id - } - networks { - network_url = google_compute_network.network_2_project_2.id - } - - depends_on = [ - google_project_service.compute_project_1, - google_project_service.dns_project_1, - google_project_service.compute_project_2, - google_project_service.dns_project_2, - ] -} - -resource "google_project" "project_1" { - name = "{{index $.Vars "project_1_name"}}" - project_id = "{{index $.Vars "project_1_name"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_project" "project_2" { - name = "{{index $.Vars "project_2_name"}}" - project_id = "{{index $.Vars "project_2_name"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_compute_network" "network_1_project_1" { - name = "{{index $.Vars "network_1_name"}}" - project = google_project.project_1.project_id - auto_create_subnetworks = false - depends_on = [ - google_project_service.compute_project_1, - google_project_service.dns_project_1, - ] -} - -resource "google_compute_network" "network_2_project_1" { - name = "{{index $.Vars "network_2_name"}}" - project = google_project.project_1.project_id - auto_create_subnetworks = false - depends_on = [ - google_project_service.compute_project_1, - google_project_service.dns_project_1, - ] -} - -resource "google_compute_network" "network_1_project_2" { - name = "{{index $.Vars "network_1_name"}}" - project = google_project.project_2.project_id - auto_create_subnetworks = false - depends_on = [ - google_project_service.compute_project_2, - google_project_service.dns_project_2, - ] -} - -resource "google_compute_network" "network_2_project_2" { - name = "{{index $.Vars "network_2_name"}}" - project = google_project.project_2.project_id - auto_create_subnetworks = false - depends_on = [ - google_project_service.compute_project_2, - google_project_service.dns_project_2, - ] -} - -resource "google_project_service" "compute_project_1" { - project = google_project.project_1.project_id - service = "compute.googleapis.com" - depends_on = [ - google_project.project_1, - ] -} - -resource "google_project_service" "compute_project_2" { - project = google_project.project_2.project_id - service = "compute.googleapis.com" - depends_on = [ - google_project_service.dns_project_1 - ] -} - -resource "google_project_service" "dns_project_1" { - project = google_project.project_1.project_id - service = "dns.googleapis.com" - depends_on = [ - google_project_service.compute_project_1 - ] -} - -resource "google_project_service" "dns_project_2" { - project = google_project.project_2.project_id - service = "dns.googleapis.com" - depends_on = [ - google_project_service.compute_project_2, - ] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/dns_record_set_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/dns_record_set_basic.tf.tmpl deleted file mode 100644 index 4ac1dc34847f..000000000000 --- a/mmv1/templates/terraform/examples/go/dns_record_set_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_dns_managed_zone" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "sample_zone"}}" - dns_name = "{{index $.Vars "sample_zone"}}.hashicorptest.com." - description = "Test Description" -} - -resource "google_dns_record_set" "default" { - managed_zone = google_dns_managed_zone.parent-zone.name - name = "test-record.{{index $.Vars "sample_zone"}}.hashicorptest.com." - type = "A" - rrdatas = ["10.0.0.1", "10.1.0.1"] - ttl = 86400 -} diff --git a/mmv1/templates/terraform/examples/go/dns_response_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/dns_response_policy_basic.tf.tmpl deleted file mode 100644 index ab8da5ec4b1c..000000000000 --- a/mmv1/templates/terraform/examples/go/dns_response_policy_basic.tf.tmpl +++ /dev/null @@ -1,70 +0,0 @@ -resource "google_compute_network" "network-1" { - name = "{{index $.Vars "network_1_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_network" "network-2" { - name = "{{index $.Vars "network_2_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "subnetwork-1" { - name = google_compute_network.network-1.name - network = google_compute_network.network-1.name - ip_cidr_range = "10.0.36.0/24" - region = "us-central1" - private_ip_google_access = true - - secondary_ip_range { - range_name = "pod" - ip_cidr_range = "10.0.0.0/19" - } - - secondary_ip_range { - range_name = "svc" - ip_cidr_range = "10.0.32.0/22" - } -} - -resource "google_container_cluster" "cluster-1" { - name = "{{index $.Vars "cluster_1_name"}}" - location = "us-central1-c" - initial_node_count = 1 - - networking_mode = "VPC_NATIVE" - default_snat_status { - disabled = true - } - network = google_compute_network.network-1.name - subnetwork = google_compute_subnetwork.subnetwork-1.name - - private_cluster_config { - enable_private_endpoint = true - enable_private_nodes = true - master_ipv4_cidr_block = "10.42.0.0/28" - master_global_access_config { - enabled = true - } - } - master_authorized_networks_config { - } - ip_allocation_policy { - cluster_secondary_range_name = google_compute_subnetwork.subnetwork-1.secondary_ip_range[0].range_name - services_secondary_range_name = google_compute_subnetwork.subnetwork-1.secondary_ip_range[1].range_name - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" -} - -resource "google_dns_response_policy" "{{$.PrimaryResourceId}}" { - response_policy_name = "{{index $.Vars "response_policy_name"}}" - - networks { - network_url = google_compute_network.network-1.id - } - networks { - network_url = google_compute_network.network-2.id - } - gke_clusters { - gke_cluster_name = google_container_cluster.cluster-1.id - } -} diff --git a/mmv1/templates/terraform/examples/go/dns_response_policy_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/dns_response_policy_rule_basic.tf.tmpl deleted file mode 100644 index 7e8e38c88372..000000000000 --- a/mmv1/templates/terraform/examples/go/dns_response_policy_rule_basic.tf.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -resource "google_compute_network" "network-1" { - name = "{{index $.Vars "network_1_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_network" "network-2" { - name = "{{index $.Vars "network_2_name"}}" - auto_create_subnetworks = false -} - -resource "google_dns_response_policy" "response-policy" { - response_policy_name = "{{index $.Vars "response_policy_name"}}" - - networks { - network_url = google_compute_network.network-1.id - } - networks { - network_url = google_compute_network.network-2.id - } -} - -resource "google_dns_response_policy_rule" "{{$.PrimaryResourceId}}" { - response_policy = google_dns_response_policy.response-policy.response_policy_name - rule_name = "{{index $.Vars "response_policy_rule_name"}}" - dns_name = "dns.example.com." - - local_data { - local_datas { - name = "dns.example.com." - type = "A" - ttl = 300 - rrdatas = ["192.0.2.91"] - } - } - -} diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_text.tf.tmpl b/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_text.tf.tmpl deleted file mode 100644 index afbd543dd173..000000000000 --- a/mmv1/templates/terraform/examples/go/document_ai_warehouse_document_schema_text.tf.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -resource "google_document_ai_warehouse_document_schema" "{{$.PrimaryResourceId}}" { - project_number = data.google_project.project.number - display_name = "test-property-text" - location = "us" - document_is_folder = false - - property_definitions { - name = "prop3" - display_name = "propdisp3" - is_repeatable = false - is_filterable = true - is_searchable = true - is_metadata = false - is_required = false - retrieval_importance = "HIGHEST" - schema_sources { - name = "dummy_source" - processor_type = "dummy_processor" - } - text_type_options {} - } -} - -data "google_project" "project" { -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/document_ai_warehouse_location.tf.tmpl b/mmv1/templates/terraform/examples/go/document_ai_warehouse_location.tf.tmpl deleted file mode 100644 index 527198bb8f6e..000000000000 --- a/mmv1/templates/terraform/examples/go/document_ai_warehouse_location.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_document_ai_warehouse_location" "{{$.PrimaryResourceId}}" { - location = "us" - project_number = data.google_project.project.number - access_control_mode = "ACL_MODE_DOCUMENT_LEVEL_ACCESS_CONTROL_GCI" - database_type = "DB_INFRA_SPANNER" - kms_key = "dummy_key" - document_creator_default_role = "DOCUMENT_ADMIN" -} - -data "google_project" "project" { -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/documentai_default_version.tf.tmpl b/mmv1/templates/terraform/examples/go/documentai_default_version.tf.tmpl deleted file mode 100644 index 46cfbed9dbc9..000000000000 --- a/mmv1/templates/terraform/examples/go/documentai_default_version.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_document_ai_processor" "processor" { - location = "us" - display_name = "{{index $.Vars "processor_name"}}" - type = "OCR_PROCESSOR" -} - -resource "google_document_ai_processor_default_version" "{{$.PrimaryResourceId}}" { - processor = google_document_ai_processor.processor.id - version = "${google_document_ai_processor.processor.id}/processorVersions/stable" - - lifecycle { - ignore_changes = [ - # Using "stable" or "rc" will return a specific version from the API; suppressing the diff. - version, - ] - } -} diff --git a/mmv1/templates/terraform/examples/go/documentai_processor.tf.tmpl b/mmv1/templates/terraform/examples/go/documentai_processor.tf.tmpl deleted file mode 100644 index 6fe258399f12..000000000000 --- a/mmv1/templates/terraform/examples/go/documentai_processor.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_document_ai_processor" "{{$.PrimaryResourceId}}" { - location = "us" - display_name = "{{index $.Vars "processor_name"}}" - type = "OCR_PROCESSOR" -} diff --git a/mmv1/templates/terraform/examples/go/documentai_processor_eu.tf.tmpl b/mmv1/templates/terraform/examples/go/documentai_processor_eu.tf.tmpl deleted file mode 100644 index 564b5d77324b..000000000000 --- a/mmv1/templates/terraform/examples/go/documentai_processor_eu.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_document_ai_processor" "{{$.PrimaryResourceId}}" { - location = "eu" - display_name = "{{index $.Vars "processor_name"}}" - type = "OCR_PROCESSOR" -} diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_cluster.tf.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_cluster.tf.tmpl deleted file mode 100644 index 5449c0fc0ea1..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_cluster.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "edgecontainer_cluster_name"}}" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.0.0.0/16"] - services_ipv4_cidr_blocks = ["10.1.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } - - labels = { - my_key = "my_val" - other_key = "other_val" - } -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_cluster_with_maintenance_window.tf.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_cluster_with_maintenance_window.tf.tmpl deleted file mode 100644 index 9e8097f3b652..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_cluster_with_maintenance_window.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "edgecontainer_cluster_name"}}" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.0.0.0/16"] - services_ipv4_cidr_blocks = ["10.1.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } - - maintenance_policy { - window { - recurring_window { - window { - start_time = "2023-01-01T08:00:00Z" - end_time = "2023-01-01T17:00:00Z" - } - - recurrence = "FREQ=WEEKLY;BYDAY=SA" - } - } - } -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_cluster.tf.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_cluster.tf.tmpl deleted file mode 100644 index 1bfacb8f178d..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_cluster.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "edgecontainer_cluster_name"}}" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.0.0.0/16"] - services_ipv4_cidr_blocks = ["10.1.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } - - external_load_balancer_ipv4_address_pools = ["10.100.0.0-10.100.0.10"] - - control_plane { - local { - node_location = "us-central1-edge-example-edgesite" - node_count = 1 - machine_filter = "machine-name" - shared_deployment_policy = "ALLOWED" - } - } -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_cluster.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_cluster.tmpl deleted file mode 100644 index 1bfacb8f178d..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_cluster.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "edgecontainer_cluster_name"}}" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.0.0.0/16"] - services_ipv4_cidr_blocks = ["10.1.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } - - external_load_balancer_ipv4_address_pools = ["10.100.0.0-10.100.0.10"] - - control_plane { - local { - node_location = "us-central1-edge-example-edgesite" - node_count = 1 - machine_filter = "machine-name" - shared_deployment_policy = "ALLOWED" - } - } -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_node_pool.tf.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_node_pool.tf.tmpl deleted file mode 100644 index d7eaf014bf00..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_node_pool.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -resource "google_edgecontainer_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "edgecontainer_cluster_name"}}" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.0.0.0/16"] - services_ipv4_cidr_blocks = ["10.1.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } - - external_load_balancer_ipv4_address_pools = ["10.100.0.0-10.100.0.10"] - - control_plane { - local { - node_location = "us-central1-edge-example-edgesite" - node_count = 1 - machine_filter = "machine-name" - shared_deployment_policy = "ALLOWED" - } - } -} - -resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" { - name = "nodepool-1" - cluster = google_edgecontainer_cluster.cluster.name - location = "us-central1" - node_location = "us-central1-edge-example-edgesite" - node_count = 3 -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_node_pool_internal.tf.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_node_pool_internal.tf.tmpl deleted file mode 100644 index 84adb34ab582..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_local_control_plane_node_pool_internal.tf.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -resource "google_edgecontainer_cluster" "cluster" { - name = "tf-lcp-cluster" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.16.0.0/16"] - services_ipv4_cidr_blocks = ["10.17.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } - - external_load_balancer_ipv4_address_pools = ["172.17.34.97-172.17.34.99"] - - control_plane { - local { - node_location = "us-central1-edge-den25349" - node_count = 1 - shared_deployment_policy = "ALLOWED" - } - } -} - -resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" { - name = "nodepool-1" - cluster = google_edgecontainer_cluster.cluster.name - location = "us-central1" - node_location = "us-central1-edge-den25349" - node_count = 1 -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_node_pool.tf.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_node_pool.tf.tmpl deleted file mode 100644 index 00d47ece7eb4..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_node_pool.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -resource "google_edgecontainer_cluster" "cluster" { - name = "default" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.0.0.0/16"] - services_ipv4_cidr_blocks = ["10.1.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } -} - -resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" { - name = "nodepool-1" - cluster = google_edgecontainer_cluster.cluster.name - location = "us-central1" - node_location = "us-central1-edge-example-edgesite" - node_count = 3 - - labels = { - my_key = "my_val" - other_key = "other_val" - } -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_node_pool_with_cmek.tf.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_node_pool_with_cmek.tf.tmpl deleted file mode 100644 index c316af892c0d..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_node_pool_with_cmek.tf.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -resource "google_edgecontainer_cluster" "cluster" { - name = "default" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.0.0.0/16"] - services_ipv4_cidr_blocks = ["10.1.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } -} - -resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = google_kms_crypto_key.crypto_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-edgecontainer.iam.gserviceaccount.com" -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "key" - key_ring = google_kms_key_ring.key_ring.id -} - -resource "google_kms_key_ring" "key_ring" { - name = "keyring" - location = "us-central1" -} - -resource "google_edgecontainer_node_pool" "{{$.PrimaryResourceId}}" { - depends_on = [google_kms_crypto_key_iam_member.crypto_key] - - name = "nodepool-1" - cluster = google_edgecontainer_cluster.cluster.name - location = "us-central1" - node_location = "us-central1-edge-example-edgesite" - node_count = 3 - - local_disk_encryption { - kms_key = google_kms_crypto_key.crypto_key.id - } -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgecontainer_vpn_connection.tf.tmpl b/mmv1/templates/terraform/examples/go/edgecontainer_vpn_connection.tf.tmpl deleted file mode 100644 index af9a87cb27ea..000000000000 --- a/mmv1/templates/terraform/examples/go/edgecontainer_vpn_connection.tf.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -resource "google_edgecontainer_cluster" "cluster" { - name = "default" - location = "us-central1" - - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - - networking { - cluster_ipv4_cidr_blocks = ["10.0.0.0/16"] - services_ipv4_cidr_blocks = ["10.1.0.0/16"] - } - - fleet { - project = "projects/${data.google_project.project.number}" - } -} - -resource "google_edgecontainer_node_pool" "node_pool" { - name = "nodepool-1" - cluster = google_edgecontainer_cluster.cluster.name - location = "us-central1" - node_location = "us-central1-edge-example-edgesite" - node_count = 3 -} - -resource "google_edgecontainer_vpn_connection" "{{$.PrimaryResourceId}}" { - depends_on = [google_edgecontainer_node_pool.node_pool] - name = "vpn-connection-1" - location = "us-central1" - cluster = "projects/${data.google_project.project.number}/locations/us-east1/clusters/${google_edgecontainer_cluster.cluster.name}" - vpc = google_compute_network.vpc.name - enable_high_availability = true - - labels = { - my_key = "my_val" - other_key = "other_val" - } -} - -resource "google_compute_network" "vpc" { - name = "example-vpc" -} - -data "google_project" "project" {} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/edgenetwork_network.tf.tmpl b/mmv1/templates/terraform/examples/go/edgenetwork_network.tf.tmpl deleted file mode 100644 index a52db0582712..000000000000 --- a/mmv1/templates/terraform/examples/go/edgenetwork_network.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_edgenetwork_network" "{{$.PrimaryResourceId}}" { - network_id = "{{index $.Vars "edgenetwork_network_id"}}" - location = "{{index $.TestEnvVars "location"}}" - zone = "{{index $.TestEnvVars "zone"}}" - description = "Example network." - mtu = 9000 - labels = { - "environment" : "dev" - } -} - - diff --git a/mmv1/templates/terraform/examples/go/edgenetwork_subnet.tf.tmpl b/mmv1/templates/terraform/examples/go/edgenetwork_subnet.tf.tmpl deleted file mode 100644 index 3423d6184314..000000000000 --- a/mmv1/templates/terraform/examples/go/edgenetwork_subnet.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ - -resource "google_edgenetwork_subnet" "{{$.PrimaryResourceId}}" { - subnet_id = "{{index $.Vars "edgenetwork_subnet_id"}}" - location = "{{index $.TestEnvVars "location"}}" - zone = "{{index $.TestEnvVars "zone"}}" - description = "Example subnet." - network = google_edgenetwork_network.example_network.id - ipv4_cidr = ["4.4.4.1/24"] - labels = { - "environment" : "dev" - } -} - -resource "google_edgenetwork_network" "example_network" { - network_id = "{{index $.Vars "edgenetwork_network_id"}}" - location = "{{index $.TestEnvVars "location"}}" - zone = "{{index $.TestEnvVars "zone"}}" - description = "Example network." - mtu = 9000 -} diff --git a/mmv1/templates/terraform/examples/go/edgenetwork_subnet_with_vlan_id.tf.tmpl b/mmv1/templates/terraform/examples/go/edgenetwork_subnet_with_vlan_id.tf.tmpl deleted file mode 100644 index 9a0df143b232..000000000000 --- a/mmv1/templates/terraform/examples/go/edgenetwork_subnet_with_vlan_id.tf.tmpl +++ /dev/null @@ -1,22 +0,0 @@ - -resource "google_edgenetwork_subnet" "{{$.PrimaryResourceId}}" { - subnet_id = "{{index $.Vars "edgenetwork_subnet_id"}}" - location = "{{index $.TestEnvVars "location"}}" - zone = "{{index $.TestEnvVars "zone"}}" - description = "Example subnet with VLAN ID." - network = google_edgenetwork_network.example_network.id - ipv6_cidr = ["4444:4444:4444:4444::1/64"] - vlan_id = 44 - labels = { - "environment" : "dev" - } -} - -resource "google_edgenetwork_network" "example_network" { - network_id = "{{index $.Vars "edgenetwork_network_id"}}" - location = "{{index $.TestEnvVars "location"}}" - zone = "{{index $.TestEnvVars "zone"}}" - description = "Example network." - mtu = 9000 -} - diff --git a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_configmanagement.tf.tmpl b/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_configmanagement.tf.tmpl deleted file mode 100644 index ee32445cf049..000000000000 --- a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_configmanagement.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "configmanagement" - location = "global" - fleet_default_member_config { - configmanagement { - config_sync { - git { - sync_repo = "https://github.com/hashicorp/terraform" - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller.tf.tmpl b/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller.tf.tmpl deleted file mode 100644 index 1d45cd87c706..000000000000 --- a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "policycontroller" - location = "global" - fleet_default_member_config { - policycontroller { - policy_controller_hub_config { - install_spec = "INSTALL_SPEC_ENABLED" - exemptable_namespaces = ["foo"] - policy_content { - bundles { - bundle = "policy-essentials-v2022" - exempted_namespaces = ["foo", "bar"] - } - template_library { - installation = "ALL" - } - } - audit_interval_seconds = 30 - referential_rules_enabled = true - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller_full.tf.tmpl b/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller_full.tf.tmpl deleted file mode 100644 index b5ae18f27781..000000000000 --- a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller_full.tf.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "policycontroller" - location = "global" - fleet_default_member_config { - policycontroller { - policy_controller_hub_config { - install_spec = "INSTALL_SPEC_SUSPENDED" - policy_content { - bundles { - bundle = "pci-dss-v3.2.1" - exempted_namespaces = ["baz", "bar"] - } - bundles { - bundle = "nist-sp-800-190" - exempted_namespaces = [] - } - template_library { - installation = "ALL" - } - } - constraint_violation_limit = 50 - referential_rules_enabled = true - log_denies_enabled = true - mutation_enabled = true - deployment_configs { - component = "admission" - replica_count = 2 - pod_affinity = "ANTI_AFFINITY" - } - deployment_configs { - component = "audit" - container_resources { - limits { - memory = "1Gi" - cpu = "1.5" - } - requests { - memory = "500Mi" - cpu = "150m" - } - } - pod_toleration { - key = "key1" - operator = "Equal" - value = "value1" - effect = "NoSchedule" - } - } - monitoring { - backends = [ - "PROMETHEUS" - ] - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller_minimal.tf.tmpl b/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller_minimal.tf.tmpl deleted file mode 100644 index 80d950a1ec89..000000000000 --- a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_policycontroller_minimal.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "policycontroller" - location = "global" - fleet_default_member_config { - policycontroller { - policy_controller_hub_config { - install_spec = "INSTALL_SPEC_ENABLED" - policy_content {} - constraint_violation_limit = 50 - referential_rules_enabled = true - log_denies_enabled = true - mutation_enabled = true - deployment_configs { - component = "admission" - } - monitoring {} - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_service_mesh.tf.tmpl b/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_service_mesh.tf.tmpl deleted file mode 100644 index 97455d34a37d..000000000000 --- a/mmv1/templates/terraform/examples/go/enable_fleet_default_member_config_service_mesh.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "servicemesh" - location = "global" - fleet_default_member_config { - mesh { - management = "MANAGEMENT_AUTOMATIC" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_both_default_and_scope_logs.tf.tmpl b/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_both_default_and_scope_logs.tf.tmpl deleted file mode 100644 index 003e7cf4c574..000000000000 --- a/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_both_default_and_scope_logs.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "fleetobservability" - location = "global" - spec { - fleetobservability { - logging_config { - default_config { - mode = "COPY" - } - fleet_scope_logs_config { - mode = "MOVE" - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_default_logs_with_COPY.tf.tmpl b/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_default_logs_with_COPY.tf.tmpl deleted file mode 100644 index ce3b2c7ef054..000000000000 --- a/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_default_logs_with_COPY.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "fleetobservability" - location = "global" - spec { - fleetobservability { - logging_config { - default_config { - mode = "COPY" - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_scope_logs_with_MOVE.tf.tmpl b/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_scope_logs_with_MOVE.tf.tmpl deleted file mode 100644 index 1a713fe42fb3..000000000000 --- a/mmv1/templates/terraform/examples/go/enable_fleet_observability_for_scope_logs_with_MOVE.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "fleetobservability" - location = "global" - spec { - fleetobservability { - logging_config { - fleet_scope_logs_config { - mode = "MOVE" - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/endpoints_iam.tf.tmpl b/mmv1/templates/terraform/examples/go/endpoints_iam.tf.tmpl deleted file mode 100644 index 3ca5ab9d175f..000000000000 --- a/mmv1/templates/terraform/examples/go/endpoints_iam.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_endpoints_service" "{{$.PrimaryResourceId}}" { - service_name = "{{index $.Vars "name"}}.endpoints.{{index $.TestEnvVars "project_name"}}.cloud.goog" - project = "{{index $.TestEnvVars "project_name"}}" - grpc_config = < -

Congratulations on setting up Google Cloud CDN with Storage backend!

- - EOT -} - -resource "google_storage_bucket_object" "error_page" { - name = "{{index $.Vars "404_page"}}" - bucket = google_storage_bucket.default.name - content = <<-EOT - -

404 Error: Object you are looking for is no longer available!

- - EOT -} - -# image object for testing, try to access http:///test.jpg -resource "google_storage_bucket_object" "test_image" { - name = "{{index $.Vars "test_object"}}" - # Uncomment and add valid path to an object. - # source = "/path/to/an/object" - # content_type = "image/jpeg" - - # Delete after uncommenting above source and content_type attributes - content = "Data as string to be uploaded" - content_type = "text/plain" - - bucket = google_storage_bucket.default.name -} - -# reserve IP address -resource "google_compute_global_address" "default" { - name = "{{index $.Vars "example_ip"}}" -} - -# forwarding rule -resource "google_compute_global_forwarding_rule" "default" { - name = "{{index $.Vars "http_lb_forwarding_rule"}}" - ip_protocol = "TCP" - load_balancing_scheme = "EXTERNAL" - port_range = "80" - target = google_compute_target_http_proxy.default.id - ip_address = google_compute_global_address.default.id -} - -# http proxy -resource "google_compute_target_http_proxy" "default" { - name = "{{index $.Vars "http_lb_proxy"}}" - url_map = google_compute_url_map.default.id -} - -# url map -resource "google_compute_url_map" "default" { - name = "{{index $.Vars "http_lb"}}" - default_service = google_compute_backend_bucket.default.id -} - -# backend bucket with CDN policy with default ttl settings -resource "google_compute_backend_bucket" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "cat_backend_bucket"}}" - description = "Contains beautiful images" - bucket_name = google_storage_bucket.default.name - enable_cdn = true - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - client_ttl = 3600 - default_ttl = 3600 - max_ttl = 86400 - negative_caching = true - serve_while_stale = 86400 - } -} diff --git a/mmv1/templates/terraform/examples/go/external_http_lb_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/go/external_http_lb_mig_backend.tf.tmpl deleted file mode 100644 index 3e0de516a7e5..000000000000 --- a/mmv1/templates/terraform/examples/go/external_http_lb_mig_backend.tf.tmpl +++ /dev/null @@ -1,121 +0,0 @@ -# External HTTP load balancer with an CDN-enabled managed instance group backend - -resource "google_compute_instance_template" "default" { - name = "{{index $.Vars "lb_backend_template"}}" - disk { - auto_delete = true - boot = true - device_name = "persistent-disk-0" - mode = "READ_WRITE" - source_image = "projects/debian-cloud/global/images/family/debian-11" - type = "PERSISTENT" - } - labels = { - managed-by-cnrm = "true" - } - machine_type = "n1-standard-1" - metadata = { - startup-script = "#! /bin/bash\n sudo apt-get update\n sudo apt-get install apache2 -y\n sudo a2ensite default-ssl\n sudo a2enmod ssl\n sudo vm_hostname=\"$(curl -H \"Metadata-Flavor:Google\" \\\n http://169.254.169.254/computeMetadata/v1/instance/name)\"\n sudo echo \"Page served from: $vm_hostname\" | \\\n tee /var/www/html/index.html\n sudo systemctl restart apache2" - } - network_interface { - access_config { - network_tier = "PREMIUM" - } - network = "global/networks/default" - subnetwork = "regions/us-east1/subnetworks/default" - } - region = "us-east1" - scheduling { - automatic_restart = true - on_host_maintenance = "MIGRATE" - provisioning_model = "STANDARD" - } - service_account { - email = "default" - scopes = ["https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring.write", "https://www.googleapis.com/auth/pubsub", "https://www.googleapis.com/auth/service.management.readonly", "https://www.googleapis.com/auth/servicecontrol", "https://www.googleapis.com/auth/trace.append"] - } - tags = ["allow-health-check"] -} - -resource "google_compute_instance_group_manager" "default" { - name = "{{index $.Vars "lb_backend_example"}}" - zone = "us-east1-b" - named_port { - name = "http" - port = 80 - } - version { - instance_template = google_compute_instance_template.default.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} - - -resource "google_compute_firewall" "default" { - name = "{{index $.Vars "fw_allow_health_check"}}" - direction = "INGRESS" - network = "global/networks/default" - priority = 1000 - source_ranges = ["130.211.0.0/22", "35.191.0.0/16"] - target_tags = ["allow-health-check"] - allow { - ports = ["80"] - protocol = "tcp" - } -} - -resource "google_compute_global_address" "default" { - name = "{{index $.Vars "lb_ipv4_1"}}" - ip_version = "IPV4" -} - -resource "google_compute_health_check" "default" { - name = "{{index $.Vars "http_basic_check"}}" - check_interval_sec = 5 - healthy_threshold = 2 - http_health_check { - port = 80 - port_specification = "USE_FIXED_PORT" - proxy_header = "NONE" - request_path = "/" - } - timeout_sec = 5 - unhealthy_threshold = 2 -} - -resource "google_compute_backend_service" "default" { - name = "{{index $.Vars "web_backend_service"}}" - connection_draining_timeout_sec = 0 - health_checks = [google_compute_health_check.default.id] - load_balancing_scheme = "EXTERNAL_MANAGED" - port_name = "http" - protocol = "HTTP" - session_affinity = "NONE" - timeout_sec = 30 - backend { - group = google_compute_instance_group_manager.default.instance_group - balancing_mode = "UTILIZATION" - capacity_scaler = 1.0 - } -} - -resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "web_map_http"}}" - default_service = google_compute_backend_service.default.id -} - -resource "google_compute_target_http_proxy" "default" { - name = "{{index $.Vars "http_lb_proxy"}}" - url_map = google_compute_url_map.default.id -} - -resource "google_compute_global_forwarding_rule" "default" { - name = "{{index $.Vars "http_content_rule"}}" - ip_protocol = "TCP" - load_balancing_scheme = "EXTERNAL_MANAGED" - port_range = "80-80" - target = google_compute_target_http_proxy.default.id - ip_address = google_compute_global_address.default.id -} diff --git a/mmv1/templates/terraform/examples/go/external_http_lb_mig_backend_custom_header.tf.tmpl b/mmv1/templates/terraform/examples/go/external_http_lb_mig_backend_custom_header.tf.tmpl deleted file mode 100644 index 176fbbe36422..000000000000 --- a/mmv1/templates/terraform/examples/go/external_http_lb_mig_backend_custom_header.tf.tmpl +++ /dev/null @@ -1,155 +0,0 @@ -# External HTTP load balancer with a CDN-enabled managed instance group backend -# and custom request and response headers - -# VPC -resource "google_compute_network" "default" { - name = "{{index $.Vars "xlb_network_name"}}" - provider = google-beta - auto_create_subnetworks = false -} - -# backend subnet -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "backend_subnet_name"}}" - provider = google-beta - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.default.id -} - -# reserved IP address -resource "google_compute_global_address" "default" { - provider = google-beta - name = "{{index $.Vars "address_name"}}" -} - -# forwarding rule -resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - provider = google-beta - ip_protocol = "TCP" - load_balancing_scheme = "EXTERNAL" - port_range = "80" - target = google_compute_target_http_proxy.default.id - ip_address = google_compute_global_address.default.id -} - -# http proxy -resource "google_compute_target_http_proxy" "default" { - name = "{{index $.Vars "target_http_proxy_name"}}" - provider = google-beta - url_map = google_compute_url_map.default.id -} - -# url map -resource "google_compute_url_map" "default" { - name = "{{index $.Vars "url_map_name"}}" - provider = google-beta - default_service = google_compute_backend_service.default.id -} - -# backend service with custom request and response headers -resource "google_compute_backend_service" "default" { - name = "{{index $.Vars "backend_service_name"}}" - provider = google-beta - protocol = "HTTP" - port_name = "my-port" - load_balancing_scheme = "EXTERNAL" - timeout_sec = 10 - enable_cdn = true - custom_request_headers = ["X-Client-Geo-Location: {client_region_subdivision}, {client_city}"] - custom_response_headers = ["X-Cache-Hit: {cdn_cache_status}"] - health_checks = [google_compute_health_check.default.id] - backend { - group = google_compute_instance_group_manager.default.instance_group - balancing_mode = "UTILIZATION" - capacity_scaler = 1.0 - } -} - -# instance template -resource "google_compute_instance_template" "default" { - name = "{{index $.Vars "mig_template_name"}}" - provider = google-beta - machine_type = "e2-small" - tags = ["allow-health-check"] - - network_interface { - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - access_config { - # add external ip to fetch packages - } - } - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y nginx-light jq - - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - - cat < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -# health check -resource "google_compute_health_check" "default" { - name = "{{index $.Vars "hc_name"}}" - provider = google-beta - http_health_check { - port_specification = "USE_SERVING_PORT" - } -} - -# MIG -resource "google_compute_instance_group_manager" "default" { - name = "{{index $.Vars "mig_name"}}" - provider = google-beta - zone = "us-central1-c" - named_port { - name = "http" - port = 8080 - } - version { - instance_template = google_compute_instance_template.default.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} - -# allow access from health check ranges -resource "google_compute_firewall" "default" { - name = "{{index $.Vars "fw_allow_hc_name"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.default.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16"] - allow { - protocol = "tcp" - } - target_tags = ["allow-health-check"] -} diff --git a/mmv1/templates/terraform/examples/go/external_ssl_proxy_lb_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/go/external_ssl_proxy_lb_mig_backend.tf.tmpl deleted file mode 100644 index 57c73c4d558f..000000000000 --- a/mmv1/templates/terraform/examples/go/external_ssl_proxy_lb_mig_backend.tf.tmpl +++ /dev/null @@ -1,186 +0,0 @@ -# External SSL proxy load balancer with managed instance group backend - -# VPC -resource "google_compute_network" "default" { - name = "{{index $.Vars "ssl_proxy_xlb_network"}}" - provider = google - auto_create_subnetworks = false -} - -# backend subnet -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "ssl_proxy_xlb_subnet"}}" - provider = google - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.default.id -} - -# reserved IP address -resource "google_compute_global_address" "default" { - name = "{{index $.Vars "ssl_proxy_xlb_ip"}}" -} - - -# Self-signed regional SSL certificate for testing -resource "tls_private_key" "default" { - algorithm = "RSA" - rsa_bits = 2048 -} - -resource "tls_self_signed_cert" "default" { - key_algorithm = tls_private_key.default.algorithm - private_key_pem = tls_private_key.default.private_key_pem - - # Certificate expires after 12 hours. - validity_period_hours = 12 - - # Generate a new certificate if Terraform is run within three - # hours of the certificate's expiration time. - early_renewal_hours = 3 - - # Reasonable set of uses for a server SSL certificate. - allowed_uses = [ - "key_encipherment", - "digital_signature", - "server_auth", - ] - - dns_names = ["example.com"] - - subject { - common_name = "example.com" - organization = "ACME Examples, Inc" - } -} - -resource "google_compute_ssl_certificate" "default" { - name = "{{index $.Vars "default_cert"}}" - private_key = tls_private_key.default.private_key_pem - certificate = tls_self_signed_cert.default.cert_pem -} - -resource "google_compute_target_ssl_proxy" "default" { - name = "{{index $.Vars "test_proxy"}}" - backend_service = google_compute_backend_service.default.id - ssl_certificates = [google_compute_ssl_certificate.default.id] -} - - - -# forwarding rule -resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "ssl_proxy_xlb_forwarding_rule"}}" - provider = google - ip_protocol = "TCP" - load_balancing_scheme = "EXTERNAL" - port_range = "443" - target = google_compute_target_ssl_proxy.default.id - ip_address = google_compute_global_address.default.id -} - - -# backend service -resource "google_compute_backend_service" "default" { - name = "{{index $.Vars "ssl_proxy_xlb_backend_service"}}" - protocol = "SSL" - port_name = "tcp" - load_balancing_scheme = "EXTERNAL" - timeout_sec = 10 - health_checks = [google_compute_health_check.default.id] - backend { - group = google_compute_instance_group_manager.default.instance_group - balancing_mode = "UTILIZATION" - max_utilization = 1.0 - capacity_scaler = 1.0 - } -} - -resource "google_compute_health_check" "default" { - name = "{{index $.Vars "ssl_proxy_health_check"}}" - timeout_sec = 1 - check_interval_sec = 1 - tcp_health_check { - port = "443" - } -} - -# instance template -resource "google_compute_instance_template" "default" { - name = "{{index $.Vars "ssl_proxy_xlb_mig_template"}}" - provider = google - machine_type = "e2-small" - tags = ["allow-health-check"] - - network_interface { - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - access_config { - # add external ip to fetch packages - } - } - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - export DEBIAN_FRONTEND=noninteractive - sudo apt-get update - sudo apt-get install -y apache2 jq - sudo a2ensite default-ssl - sudo a2enmod ssl - sudo service apache2 restart - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - cat < /var/www/html/index.html -

SSL Load Balancer

-
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -# MIG -resource "google_compute_instance_group_manager" "default" { - name = "{{index $.Vars "ssl_proxy_xlb_mig1"}}" - provider = google - zone = "us-central1-c" - named_port { - name = "tcp" - port = 443 - } - version { - instance_template = google_compute_instance_template.default.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} - -# allow access from health check ranges -resource "google_compute_firewall" "default" { - name = "{{index $.Vars "ssl_proxy_xlb_fw_allow_hc"}}" - provider = google - direction = "INGRESS" - network = google_compute_network.default.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16"] - allow { - protocol = "tcp" - } - target_tags = ["allow-health-check"] -} - diff --git a/mmv1/templates/terraform/examples/go/external_tcp_proxy_lb_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/go/external_tcp_proxy_lb_mig_backend.tf.tmpl deleted file mode 100644 index b1da9819a42f..000000000000 --- a/mmv1/templates/terraform/examples/go/external_tcp_proxy_lb_mig_backend.tf.tmpl +++ /dev/null @@ -1,143 +0,0 @@ -# External TCP proxy load balancer with managed instance group backend - -# VPC -resource "google_compute_network" "default" { - name = "{{index $.Vars "tcp_proxy_xlb_network"}}" - provider = google-beta - auto_create_subnetworks = false -} - -# backend subnet -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "tcp_proxy_xlb_subnet"}}" - provider = google-beta - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.default.id -} - -# reserved IP address -resource "google_compute_global_address" "default" { - provider = google-beta - name = "{{index $.Vars "tcp_proxy_xlb_ip"}}" -} - -# forwarding rule -resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "tcp_proxy_xlb_forwarding_rule"}}" - provider = google-beta - ip_protocol = "TCP" - load_balancing_scheme = "EXTERNAL" - port_range = "110" - target = google_compute_target_tcp_proxy.default.id - ip_address = google_compute_global_address.default.id -} - -resource "google_compute_target_tcp_proxy" "default" { - provider = google-beta - name = "{{index $.Vars "test_proxy_health_check"}}" - backend_service = google_compute_backend_service.default.id -} - -# backend service -resource "google_compute_backend_service" "default" { - provider = google-beta - name = "{{index $.Vars "tcp_proxy_xlb_backend_service"}}" - protocol = "TCP" - port_name = "tcp" - load_balancing_scheme = "EXTERNAL" - timeout_sec = 10 - health_checks = [google_compute_health_check.default.id] - backend { - group = google_compute_instance_group_manager.default.instance_group - balancing_mode = "UTILIZATION" - max_utilization = 1.0 - capacity_scaler = 1.0 - } -} - -resource "google_compute_health_check" "default" { - provider = google-beta - name = "{{index $.Vars "tcp_proxy_health_check"}}" - timeout_sec = 1 - check_interval_sec = 1 - - tcp_health_check { - port = "80" - } -} - -# instance template -resource "google_compute_instance_template" "default" { - name = "{{index $.Vars "tcp_proxy_xlb_mig_template"}}" - provider = google-beta - machine_type = "e2-small" - tags = ["allow-health-check"] - - network_interface { - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - access_config { - # add external ip to fetch packages - } - } - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y nginx-light jq - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - cat < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -# MIG -resource "google_compute_instance_group_manager" "default" { - name = "{{index $.Vars "tcp_proxy_xlb_mig1"}}" - provider = google-beta - zone = "us-central1-c" - named_port { - name = "tcp" - port = 80 - } - version { - instance_template = google_compute_instance_template.default.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} - -# allow access from health check ranges -resource "google_compute_firewall" "default" { - name = "{{index $.Vars "tcp_proxy_xlb_fw_allow_hc"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.default.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16"] - allow { - protocol = "tcp" - } - target_tags = ["allow-health-check"] -} diff --git a/mmv1/templates/terraform/examples/go/external_vpn_gateway.tf.tmpl b/mmv1/templates/terraform/examples/go/external_vpn_gateway.tf.tmpl deleted file mode 100644 index 9eeb7bf49af5..000000000000 --- a/mmv1/templates/terraform/examples/go/external_vpn_gateway.tf.tmpl +++ /dev/null @@ -1,101 +0,0 @@ -resource "google_compute_ha_vpn_gateway" "ha_gateway" { - region = "us-central1" - name = "{{index $.Vars "ha_vpn_gateway_name"}}" - network = google_compute_network.network.id -} - -resource "google_compute_external_vpn_gateway" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "external_gateway_name"}}" - redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT" - description = "An externally managed VPN gateway" - interface { - id = 0 - ip_address = "8.8.8.8" - } -} - -resource "google_compute_network" "network" { - name = "{{index $.Vars "network_name"}}" - routing_mode = "GLOBAL" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "network_subnet1" { - name = "ha-vpn-subnet-1" - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.network.id -} - -resource "google_compute_subnetwork" "network_subnet2" { - name = "ha-vpn-subnet-2" - ip_cidr_range = "10.0.2.0/24" - region = "us-west1" - network = google_compute_network.network.id -} - -resource "google_compute_router" "router1" { - name = "{{index $.Vars "router_name"}}" - network = google_compute_network.network.name - bgp { - asn = 64514 - } -} - -resource "google_compute_vpn_tunnel" "tunnel1" { - name = "ha-vpn-tunnel1" - region = "us-central1" - vpn_gateway = google_compute_ha_vpn_gateway.ha_gateway.id - peer_external_gateway = google_compute_external_vpn_gateway.external_gateway.id - peer_external_gateway_interface = 0 - shared_secret = "a secret message" - router = google_compute_router.router1.id - vpn_gateway_interface = 0 -} - -resource "google_compute_vpn_tunnel" "tunnel2" { - name = "ha-vpn-tunnel2" - region = "us-central1" - vpn_gateway = google_compute_ha_vpn_gateway.ha_gateway.id - peer_external_gateway = google_compute_external_vpn_gateway.external_gateway.id - peer_external_gateway_interface = 0 - shared_secret = "a secret message" - router = " ${google_compute_router.router1.id}" - vpn_gateway_interface = 1 -} - -resource "google_compute_router_interface" "router1_interface1" { - name = "router1-interface1" - router = google_compute_router.router1.name - region = "us-central1" - ip_range = "169.254.0.1/30" - vpn_tunnel = google_compute_vpn_tunnel.tunnel1.name -} - -resource "google_compute_router_peer" "router1_peer1" { - name = "router1-peer1" - router = google_compute_router.router1.name - region = "us-central1" - peer_ip_address = "169.254.0.2" - peer_asn = 64515 - advertised_route_priority = 100 - interface = google_compute_router_interface.router1_interface1.name -} - -resource "google_compute_router_interface" "router1_interface2" { - name = "router1-interface2" - router = google_compute_router.router1.name - region = "us-central1" - ip_range = "169.254.1.1/30" - vpn_tunnel = google_compute_vpn_tunnel.tunnel2.name -} - -resource "google_compute_router_peer" "router1_peer2" { - name = "router1-peer2" - router = google_compute_router.router1.name - region = "us-central1" - peer_ip_address = "169.254.1.2" - peer_asn = 64515 - advertised_route_priority = 100 - interface = google_compute_router_interface.router1_interface2.name -} diff --git a/mmv1/templates/terraform/examples/go/filestore_backup_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/filestore_backup_basic.tf.tmpl deleted file mode 100644 index b9f4386b9009..000000000000 --- a/mmv1/templates/terraform/examples/go/filestore_backup_basic.tf.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -resource "google_filestore_instance" "instance" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1-b" - tier = "BASIC_HDD" - - file_shares { - capacity_gb = 1024 - name = "share1" - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - connect_mode = "DIRECT_PEERING" - } -} - -resource "google_filestore_backup" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backup_name"}}" - location = "us-central1" - description = "This is a filestore backup for the test instance" - source_instance = google_filestore_instance.instance.id - source_file_share = "share1" - - labels = { - "files":"label1", - "other-label": "label2" - } -} - diff --git a/mmv1/templates/terraform/examples/go/filestore_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/filestore_instance_basic.tf.tmpl deleted file mode 100644 index d43e35f1b864..000000000000 --- a/mmv1/templates/terraform/examples/go/filestore_instance_basic.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1-b" - tier = "BASIC_HDD" - - file_shares { - capacity_gb = 1024 - name = "share1" - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - } -} diff --git a/mmv1/templates/terraform/examples/go/filestore_instance_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/go/filestore_instance_enterprise.tf.tmpl deleted file mode 100644 index 53c2c01e0382..000000000000 --- a/mmv1/templates/terraform/examples/go/filestore_instance_enterprise.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1" - tier = "ENTERPRISE" - - file_shares { - capacity_gb = 1024 - name = "share1" - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - } - - kms_key_name = google_kms_crypto_key.filestore_key.id -} - -resource "google_kms_key_ring" "filestore_keyring" { - name = "filestore-keyring" - location = "us-central1" -} - -resource "google_kms_crypto_key" "filestore_key" { - name = "filestore-key" - key_ring = google_kms_key_ring.filestore_keyring.id -} diff --git a/mmv1/templates/terraform/examples/go/filestore_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/go/filestore_instance_full.tf.tmpl deleted file mode 100644 index 041153dd6713..000000000000 --- a/mmv1/templates/terraform/examples/go/filestore_instance_full.tf.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1-b" - tier = "BASIC_SSD" - - file_shares { - capacity_gb = 2560 - name = "share1" - - nfs_export_options { - ip_ranges = ["10.0.0.0/24"] - access_mode = "READ_WRITE" - squash_mode = "NO_ROOT_SQUASH" - } - - nfs_export_options { - ip_ranges = ["10.10.0.0/24"] - access_mode = "READ_ONLY" - squash_mode = "ROOT_SQUASH" - anon_uid = 123 - anon_gid = 456 - } - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - connect_mode = "DIRECT_PEERING" - } -} diff --git a/mmv1/templates/terraform/examples/go/filestore_instance_protocol.tf.tmpl b/mmv1/templates/terraform/examples/go/filestore_instance_protocol.tf.tmpl deleted file mode 100644 index d477c41005dc..000000000000 --- a/mmv1/templates/terraform/examples/go/filestore_instance_protocol.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_filestore_instance" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "instance_name"}}" - location = "us-central1" - tier = "ENTERPRISE" - protocol = "NFS_V4_1" - - file_shares { - capacity_gb = 1024 - name = "share1" - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - } - -} diff --git a/mmv1/templates/terraform/examples/go/filestore_snapshot_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/filestore_snapshot_basic.tf.tmpl deleted file mode 100644 index 3b1b799b6a78..000000000000 --- a/mmv1/templates/terraform/examples/go/filestore_snapshot_basic.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_filestore_snapshot" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "snapshot_name"}}" - instance = google_filestore_instance.instance.name - location = "us-east1" -} - -resource "google_filestore_instance" "instance" { - name = "{{index $.Vars "instance_name"}}" - location = "us-east1" - tier = "ENTERPRISE" - - file_shares { - capacity_gb = 1024 - name = "share1" - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - } -} diff --git a/mmv1/templates/terraform/examples/go/filestore_snapshot_full.tf.tmpl b/mmv1/templates/terraform/examples/go/filestore_snapshot_full.tf.tmpl deleted file mode 100644 index 1aa854cf539f..000000000000 --- a/mmv1/templates/terraform/examples/go/filestore_snapshot_full.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_filestore_snapshot" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "snapshot_name"}}" - instance = google_filestore_instance.instance.name - location = "us-west1" - - description = "Snapshot of {{index $.Vars "instance_name"}}" - - labels = { - my_label = "value" - } -} - -resource "google_filestore_instance" "instance" { - name = "{{index $.Vars "instance_name"}}" - location = "us-west1" - tier = "ENTERPRISE" - - file_shares { - capacity_gb = 1024 - name = "share1" - } - - networks { - network = "default" - modes = ["MODE_IPV4"] - } -} diff --git a/mmv1/templates/terraform/examples/go/firebase_android_app_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_android_app_basic.tf.tmpl deleted file mode 100644 index d1d3626e7aab..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_android_app_basic.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_firebase_android_app" "{{$.PrimaryResourceId}}" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "{{index $.Vars "display_name"}}" - package_name = "{{index $.Vars "package_name"}}" - sha1_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21c"] - sha256_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"] -} diff --git a/mmv1/templates/terraform/examples/go/firebase_android_app_custom_api_key.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_android_app_custom_api_key.tf.tmpl deleted file mode 100644 index 094ed4999d37..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_android_app_custom_api_key.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_firebase_android_app" "{{$.PrimaryResourceId}}" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "{{index $.Vars "display_name"}}" - package_name = "{{index $.Vars "package_name"}}" - sha1_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21c"] - sha256_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"] - api_key_id = google_apikeys_key.android.uid -} - -resource "google_apikeys_key" "android" { - provider = google-beta - - name = "{{index $.Vars "api_key_name"}}" - display_name = "{{index $.Vars "display_name"}}" - project = "{{index $.TestEnvVars "project_id"}}" - - restrictions { - android_key_restrictions { - allowed_applications { - package_name = "{{index $.Vars "package_name"}}" - sha1_fingerprint = "2145bdf698b8715039bd0e83f2069bed435ac21c" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_app_attest_config_full.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_app_attest_config_full.tf.tmpl deleted file mode 100644 index 773d266067c7..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_app_attest_config_full.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -resource "google_firebase_apple_app" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "Apple app" - bundle_id = "{{index $.Vars "bundle_id"}}" - team_id = "{{index $.Vars "team_id"}}" -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_apple_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_app_attest_config" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - app_id = google_firebase_apple_app.default.app_id - token_ttl = "{{index $.Vars "token_ttl"}}" - - depends_on = [time_sleep.wait_30s] - - lifecycle { - precondition { - condition = google_firebase_apple_app.default.team_id != "" - error_message = "Provide a Team ID on the Apple App to use App Check" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_app_attest_config_minimal.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_app_attest_config_minimal.tf.tmpl deleted file mode 100644 index 019cb50010ff..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_app_attest_config_minimal.tf.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -resource "google_firebase_apple_app" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "Apple app" - bundle_id = "{{index $.Vars "bundle_id"}}" - team_id = "{{index $.Vars "team_id"}}" -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_apple_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_app_attest_config" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - app_id = google_firebase_apple_app.default.app_id - - depends_on = [time_sleep.wait_30s] - - lifecycle { - precondition { - condition = google_firebase_apple_app.default.team_id != "" - error_message = "Provide a Team ID on the Apple App to use App Check" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_debug_token_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_debug_token_basic.tf.tmpl deleted file mode 100644 index 89836afa0640..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_debug_token_basic.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_firebase_web_app" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "Web App for debug token" -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_web_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_debug_token" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - app_id = google_firebase_web_app.default.app_id - display_name = "{{index $.Vars "display_name"}}" - token = "{{index $.Vars "token"}}" - - depends_on = [time_sleep.wait_30s] -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_device_check_config_full.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_device_check_config_full.tf.tmpl deleted file mode 100644 index 5f8832f4e550..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_device_check_config_full.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -resource "google_firebase_apple_app" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "Apple app" - bundle_id = "{{index $.Vars "bundle_id"}}" - team_id = "{{index $.Vars "team_id"}}" -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_apple_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_device_check_config" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - app_id = google_firebase_apple_app.default.app_id - token_ttl = "{{index $.Vars "token_ttl"}}" - key_id = "{{index $.Vars "key_id"}}" - private_key = file("{{index $.Vars "private_key_path"}}") - - depends_on = [time_sleep.wait_30s] - - lifecycle { - precondition { - condition = google_firebase_apple_app.default.team_id != "" - error_message = "Provide a Team ID on the Apple App to use App Check" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_play_integrity_config_full.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_play_integrity_config_full.tf.tmpl deleted file mode 100644 index db5a93b8a4ec..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_play_integrity_config_full.tf.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -# Enables the Play Integrity API -resource "google_project_service" "play_integrity" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - service = "playintegrity.googleapis.com" - - # Don't disable the service if the resource block is removed by accident. - disable_on_destroy = false -} - -resource "google_firebase_android_app" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "Play Integrity app" - package_name = "{{index $.Vars "package_name"}}" - sha1_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21c"] - sha256_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"] -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_android_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_play_integrity_config" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - app_id = google_firebase_android_app.default.app_id - token_ttl = "{{index $.Vars "token_ttl"}}" - - depends_on = [time_sleep.wait_30s] - - lifecycle { - precondition { - condition = length(google_firebase_android_app.default.sha256_hashes) > 0 - error_message = "Provide a SHA-256 certificate on the Android App to use App Check" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_play_integrity_config_minimal.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_play_integrity_config_minimal.tf.tmpl deleted file mode 100644 index bbe75253a126..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_play_integrity_config_minimal.tf.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -# Enables the Play Integrity API -resource "google_project_service" "play_integrity" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - service = "playintegrity.googleapis.com" - - # Don't disable the service if the resource block is removed by accident. - disable_on_destroy = false -} - -resource "google_firebase_android_app" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "Play Integrity app" - package_name = "{{index $.Vars "package_name"}}" - sha1_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21c"] - sha256_hashes = ["2145bdf698b8715039bd0e83f2069bed435ac21ca1b2c3d4e5f6123456789abc"] -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_android_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_play_integrity_config" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - app_id = google_firebase_android_app.default.app_id - - depends_on = [time_sleep.wait_30s] - - lifecycle { - precondition { - condition = length(google_firebase_android_app.default.sha256_hashes) > 0 - error_message = "Provide a SHA-256 certificate on the Android App to use App Check" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_recaptcha_enterprise_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_recaptcha_enterprise_config_basic.tf.tmpl deleted file mode 100644 index ee2abef0f7eb..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_recaptcha_enterprise_config_basic.tf.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -# Enables the reCAPTCHA Enterprise API -resource "google_project_service" "recaptcha_enterprise" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - service = "recaptchaenterprise.googleapis.com" - - # Don't disable the service if the resource block is removed by accident. - disable_on_destroy = false -} - -resource "google_firebase_web_app" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "Web App for reCAPTCHA Enterprise" -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_web_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_recaptcha_enterprise_config" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - app_id = google_firebase_web_app.default.app_id - site_key = "{{index $.Vars "site_key"}}" - token_ttl = "{{index $.Vars "token_ttl"}}" - - depends_on = [time_sleep.wait_30s] -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_recaptcha_v3_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_recaptcha_v3_config_basic.tf.tmpl deleted file mode 100644 index 4c7826d45d1a..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_recaptcha_v3_config_basic.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_firebase_web_app" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "Web App for reCAPTCHA V3" -} - -# It takes a while for App Check to recognize the new app -# If your app already exists, you don't have to wait 30 seconds. -resource "time_sleep" "wait_30s" { - depends_on = [google_firebase_web_app.default] - create_duration = "30s" -} - -resource "google_firebase_app_check_recaptcha_v3_config" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - app_id = google_firebase_web_app.default.app_id - site_secret = "{{index $.Vars "site_secret"}}" - token_ttl = "{{index $.Vars "token_ttl"}}" - - depends_on = [time_sleep.wait_30s] -} diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_enforced.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_enforced.tf.tmpl deleted file mode 100644 index e29fb3518c28..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_enforced.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_project_service" "appcheck" { - project = "{{index $.TestEnvVars "project_id"}}" - service = "firebaseappcheck.googleapis.com" - disable_on_destroy = false -} - -resource "google_firebase_app_check_service_config" "default" { - project = "{{index $.TestEnvVars "project_id"}}" - service_id = "{{index $.Vars "service_id"}}" - enforcement_mode = "ENFORCED" - - depends_on = [google_project_service.appcheck] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_off.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_off.tf.tmpl deleted file mode 100644 index ff000e5a3b42..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_off.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_project_service" "appcheck" { - project = "{{index $.TestEnvVars "project_id"}}" - service = "firebaseappcheck.googleapis.com" - disable_on_destroy = false -} - -resource "google_firebase_app_check_service_config" "default" { - project = "{{index $.TestEnvVars "project_id"}}" - service_id = "{{index $.Vars "service_id"}}" - - depends_on = [google_project_service.appcheck] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_unenforced.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_unenforced.tf.tmpl deleted file mode 100644 index 11f85955c357..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_app_check_service_config_unenforced.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_project_service" "appcheck" { - project = "{{index $.TestEnvVars "project_id"}}" - service = "firebaseappcheck.googleapis.com" - disable_on_destroy = false -} - -resource "google_firebase_app_check_service_config" "default" { - project = "{{index $.TestEnvVars "project_id"}}" - service_id = "{{index $.Vars "service_id"}}" - enforcement_mode = "UNENFORCED" - - depends_on = [google_project_service.appcheck] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebase_apple_app_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_apple_app_basic.tf.tmpl deleted file mode 100644 index a0fa84aa395d..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_apple_app_basic.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_firebase_apple_app" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "{{index $.Vars "display_name"}}" - bundle_id = "{{index $.Vars "bundle_id"}}" -} diff --git a/mmv1/templates/terraform/examples/go/firebase_apple_app_full.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_apple_app_full.tf.tmpl deleted file mode 100644 index 105398c7edb3..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_apple_app_full.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_firebase_apple_app" "full" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "{{index $.Vars "display_name"}}" - bundle_id = "{{index $.Vars "bundle_id"}}" - app_store_id = "{{index $.Vars "app_store_id"}}" - team_id = "{{index $.Vars "team_id"}}" - api_key_id = google_apikeys_key.apple.uid -} - -resource "google_apikeys_key" "apple" { - provider = google-beta - - name = "{{index $.Vars "api_key_name"}}" - display_name = "{{index $.Vars "display_name"}}" - project = "{{index $.TestEnvVars "project_id"}}" - - restrictions { - ios_key_restrictions { - allowed_bundle_ids = ["{{index $.Vars "bundle_id"}}"] - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firebase_database_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_database_instance_basic.tf.tmpl deleted file mode 100644 index f7bf9b1f33f8..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_database_instance_basic.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_firebase_database_instance" "basic" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - region = "us-central1" - instance_id = "{{index $.Vars "instance_id"}}" -} - diff --git a/mmv1/templates/terraform/examples/go/firebase_database_instance_default_database.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_database_instance_default_database.tf.tmpl deleted file mode 100644 index 083fa263b42d..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_database_instance_default_database.tf.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -resource "google_project" "default" { - provider = google-beta - project_id = "{{index $.Vars "project_id"}}" - name = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" - labels = { - "firebase" = "enabled" - } -} - -resource "google_firebase_project" "default" { - provider = google-beta - project = google_project.default.project_id -} - -resource "google_project_service" "firebase_database" { - provider = google-beta - project = google_firebase_project.default.project - service = "firebasedatabase.googleapis.com" -} - -resource "google_firebase_database_instance" "default" { - provider = google-beta - project = google_firebase_project.default.project - region = "us-central1" - instance_id = "{{index $.Vars "project_id"}}-default-rtdb" - type = "DEFAULT_DATABASE" - depends_on = [google_project_service.firebase_database] -} diff --git a/mmv1/templates/terraform/examples/go/firebase_database_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_database_instance_full.tf.tmpl deleted file mode 100644 index d70cd1909dfb..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_database_instance_full.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_firebase_database_instance" "full" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - region = "europe-west1" - instance_id = "{{index $.Vars "instance_id"}}" - type = "USER_DATABASE" - desired_state = "DISABLED" -} diff --git a/mmv1/templates/terraform/examples/go/firebase_extentions_instance_resize_image.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_extentions_instance_resize_image.tf.tmpl deleted file mode 100644 index 4441c916b711..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_extentions_instance_resize_image.tf.tmpl +++ /dev/null @@ -1,46 +0,0 @@ -resource "google_storage_bucket" "images" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "bucket_id"}}" - location = "US" - uniform_bucket_level_access = true - - # Delete all objects when the bucket is deleted - force_destroy = true -} - -resource "google_firebase_extensions_instance" "resize_image" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - instance_id = "{{index $.Vars "instance-id"}}" - config { - extension_ref = "firebase/storage-resize-images" - extension_version = "0.2.2" - - # The following params apply to the firebase/storage-resize-images extension. - # Different extensions may have different params - params = { - DELETE_ORIGINAL_FILE = false - MAKE_PUBLIC = false - IMAGE_TYPE = false - IS_ANIMATED = true - FUNCTION_MEMORY = 1024 - DO_BACKFILL = false - IMG_SIZES = "200x200" - IMG_BUCKET = google_storage_bucket.images.name - } - - system_params = { - "firebaseextensions.v1beta.function/location" = "{{index $.Vars "location"}}" - "firebaseextensions.v1beta.function/maxInstances" = 3000 - "firebaseextensions.v1beta.function/minInstances" = 0 - "firebaseextensions.v1beta.function/vpcConnectorEgressSettings" = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" - } - - allowed_event_types = [ - "firebase.extensions.storage-resize-images.v1.onCompletion" - ] - - eventarc_channel = "projects/{{index $.TestEnvVars "project_id"}}/locations/{{index $.Vars "location"}}/channels/firebase" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebase_project_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_project_basic.tf.tmpl deleted file mode 100644 index 46a2cb2d62b4..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_project_basic.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_project" "default" { - provider = google-beta - - project_id = "{{index $.Vars "project_name"}}" - name = "{{index $.Vars "project_name"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" - - labels = { - "firebase" = "enabled" - } -} - -resource "google_firebase_project" "default" { - provider = google-beta - project = google_project.default.project_id -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebase_web_app_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_web_app_basic.tf.tmpl deleted file mode 100644 index 6a24a04a9163..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_web_app_basic.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -resource "google_firebase_web_app" "{{$.PrimaryResourceId}}" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "{{index $.Vars "display_name"}}" -} - -data "google_firebase_web_app_config" "basic" { - provider = google-beta - web_app_id = google_firebase_web_app.basic.app_id -} - -resource "google_storage_bucket" "default" { - provider = google-beta - name = "{{index $.Vars "bucket_name"}}" - location = "US" -} - -resource "google_storage_bucket_object" "default" { - provider = google-beta - bucket = google_storage_bucket.default.name - name = "firebase-config.json" - - content = jsonencode({ - appId = google_firebase_web_app.basic.app_id - apiKey = data.google_firebase_web_app_config.basic.api_key - authDomain = data.google_firebase_web_app_config.basic.auth_domain - databaseURL = lookup(data.google_firebase_web_app_config.basic, "database_url", "") - storageBucket = lookup(data.google_firebase_web_app_config.basic, "storage_bucket", "") - messagingSenderId = lookup(data.google_firebase_web_app_config.basic, "messaging_sender_id", "") - measurementId = lookup(data.google_firebase_web_app_config.basic, "measurement_id", "") - }) -} diff --git a/mmv1/templates/terraform/examples/go/firebase_web_app_custom_api_key.tf.tmpl b/mmv1/templates/terraform/examples/go/firebase_web_app_custom_api_key.tf.tmpl deleted file mode 100644 index 8f45d47d4eee..000000000000 --- a/mmv1/templates/terraform/examples/go/firebase_web_app_custom_api_key.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_firebase_web_app" "{{$.PrimaryResourceId}}" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "{{index $.Vars "display_name"}}" - api_key_id = google_apikeys_key.web.uid - deletion_policy = "DELETE" -} - -resource "google_apikeys_key" "web" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "api_key_name"}}" - display_name = "{{index $.Vars "display_name"}}" - - restrictions { - browser_key_restrictions { - allowed_referrers = ["*"] - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_channel_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_channel_basic.tf.tmpl deleted file mode 100644 index 00022fb521c5..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_channel_basic.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_firebase_hosting_channel" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - channel_id = "{{index $.Vars "channel_id"}}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_channel_full.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_channel_full.tf.tmpl deleted file mode 100644 index e26595c8a067..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_channel_full.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_firebase_hosting_channel" "full" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - channel_id = "{{index $.Vars "channel_id"}}" - ttl = "86400s" - retained_release_count = 20 - labels = { - "some-key": "some-value" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_basic.tf.tmpl deleted file mode 100644 index 94af7ca6a314..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_basic.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_firebase_hosting_custom_domain" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" - custom_domain = "{{index $.Vars "custom_domain"}}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_cloud_run.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_cloud_run.tf.tmpl deleted file mode 100644 index 174f3a0471e5..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_cloud_run.tf.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_cloud_run_v2_service" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "cloud_run_service_id"}}" - location = "us-central1" - - # Warning: allows all public traffic - ingress = "INGRESS_TRAFFIC_ALL" - - template { - containers { - image = "us-docker.pkg.dev/cloudrun/container/hello" - } - } - - deletion_protection = "{{index $.Vars "deletion_protection"}}" -} - -resource "google_firebase_hosting_version" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - config { - rewrites { - glob = "/hello/**" - run { - service_id = google_cloud_run_v2_service.default.name - region = google_cloud_run_v2_service.default.location - } - } - } -} - -resource "google_firebase_hosting_release" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - version_name = google_firebase_hosting_version.default.name - message = "Cloud Run Integration" -} - -resource "google_firebase_hosting_custom_domain" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - site_id = google_firebase_hosting_site.default.site_id - custom_domain = "{{index $.Vars "custom_domain"}}" - - wait_dns_verification = false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_full.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_full.tf.tmpl deleted file mode 100644 index 962a6217f3c0..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_customdomain_full.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_firebase_hosting_custom_domain" "default" { - provider = google-beta - - project = "{{index $.TestEnvVars "project_id"}}" - site_id = google_firebase_hosting_site.default.site_id - custom_domain = "{{index $.Vars "custom_domain"}}" - cert_preference = "GROUPED" - redirect_target = "{{index $.Vars "redirect_target"}}" - - wait_dns_verification = false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_release_disable.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_release_disable.tf.tmpl deleted file mode 100644 index bf98908fc948..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_release_disable.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_firebase_hosting_release" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - type = "SITE_DISABLE" - message = "Take down site" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_release_in_channel.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_release_in_channel.tf.tmpl deleted file mode 100644 index 06975a7e3e7b..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_release_in_channel.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_firebase_hosting_version" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - config { - redirects { - glob = "/google/**" - status_code = 302 - location = "https://www.google.com" - } - } -} - -resource "google_firebase_hosting_channel" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - channel_id = "{{index $.Vars "channel_id"}}" -} - -resource "google_firebase_hosting_release" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - channel_id = google_firebase_hosting_channel.default.channel_id - version_name = google_firebase_hosting_version.default.name - message = "Test release in channel" -} - diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_release_in_site.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_release_in_site.tf.tmpl deleted file mode 100644 index f4d8e6c01ad7..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_release_in_site.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_firebase_hosting_version" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - config { - redirects { - glob = "/google/**" - status_code = 302 - location = "https://www.google.com" - } - } -} - -resource "google_firebase_hosting_release" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - version_name = google_firebase_hosting_version.default.name - message = "Test release" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_site_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_site_basic.tf.tmpl deleted file mode 100644 index fdcc3c3a0faa..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_site_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_site_full.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_site_full.tf.tmpl deleted file mode 100644 index 29b51e964638..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_site_full.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_firebase_web_app" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - display_name = "{{index $.Vars "display_name"}}" -} - -resource "google_firebase_hosting_site" "full" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" - app_id = google_firebase_web_app.default.app_id -} diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_version_cloud_functions.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_version_cloud_functions.tf.tmpl deleted file mode 100644 index 2bea81e01a6c..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_version_cloud_functions.tf.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_storage_bucket" "bucket" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "site_id"}}-function-source" # Every bucket name must be globally unique - location = "US" - uniform_bucket_level_access = true -} - -resource "google_storage_bucket_object" "object" { - provider = google-beta - 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_cloudfunctions_function" "function" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - - name = "{{index $.Vars "cloud_function_id"}}" - description = "A Cloud Function connected to Firebase Hosing" - runtime = "nodejs16" - - available_memory_mb = 128 - source_archive_bucket = google_storage_bucket.bucket.name - source_archive_object = google_storage_bucket_object.object.name - trigger_http = true - entry_point = "helloHttp" -} - -resource "google_firebase_hosting_version" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - config { - rewrites { - glob = "/hello/**" - function = google_cloudfunctions_function.function.name - } - } -} - -resource "google_firebase_hosting_release" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - version_name = google_firebase_hosting_version.default.name - message = "Cloud Functions Integration" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_version_cloud_run.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_version_cloud_run.tf.tmpl deleted file mode 100644 index 258ac8617c38..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_version_cloud_run.tf.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_cloud_run_v2_service" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "cloud_run_service_id"}}" - location = "us-central1" - - # Warning: allows all public traffic - ingress = "INGRESS_TRAFFIC_ALL" - - template { - containers { - image = "us-docker.pkg.dev/cloudrun/container/hello" - } - } - - deletion_protection = "{{index $.Vars "deletion_protection"}}" -} - -resource "google_firebase_hosting_version" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - config { - rewrites { - glob = "/hello/**" - run { - service_id = google_cloud_run_v2_service.default.name - region = google_cloud_run_v2_service.default.location - } - } - } -} - -resource "google_firebase_hosting_release" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - version_name = google_firebase_hosting_version.default.name - message = "Cloud Run Integration" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_version_path.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_version_path.tf.tmpl deleted file mode 100644 index 7513f5547b22..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_version_path.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_firebase_hosting_version" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - config { - rewrites { - glob = "**" - path = "/index.html" - } - } -} - -resource "google_firebase_hosting_release" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - version_name = google_firebase_hosting_version.default.name - message = "Path Rewrite" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasehosting_version_redirect.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasehosting_version_redirect.tf.tmpl deleted file mode 100644 index b283d330bd33..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasehosting_version_redirect.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_firebase_hosting_site" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - site_id = "{{index $.Vars "site_id"}}" -} - -resource "google_firebase_hosting_version" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - config { - redirects { - glob = "/google/**" - status_code = 302 - location = "https://www.google.com" - } - } -} - -resource "google_firebase_hosting_release" "default" { - provider = google-beta - site_id = google_firebase_hosting_site.default.site_id - version_name = google_firebase_hosting_version.default.name - message = "Redirect to Google" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firebasestorage_bucket_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firebasestorage_bucket_basic.tf.tmpl deleted file mode 100644 index 211c45f1fe12..000000000000 --- a/mmv1/templates/terraform/examples/go/firebasestorage_bucket_basic.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_storage_bucket" "default" { - provider = google-beta - name = "{{index $.Vars "bucket_id"}}" - location = "US" - uniform_bucket_level_access = true -} - -resource "google_firebase_storage_bucket" "default" { - provider = google-beta - project = "{{index $.TestEnvVars "project_id"}}" - bucket_id = google_storage_bucket.default.id -} diff --git a/mmv1/templates/terraform/examples/go/firestore_backup_schedule_daily.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_backup_schedule_daily.tf.tmpl deleted file mode 100644 index 0a1a846c030f..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_backup_schedule_daily.tf.tmpl +++ /dev/null @@ -1,18 +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_backup_schedule" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - database = google_firestore_database.database.name - - retention = "8467200s" // 14 weeks (maximum possible retention) - - daily_recurrence {} -} diff --git a/mmv1/templates/terraform/examples/go/firestore_backup_schedule_weekly.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_backup_schedule_weekly.tf.tmpl deleted file mode 100644 index ecf11345d7d3..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_backup_schedule_weekly.tf.tmpl +++ /dev/null @@ -1,20 +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_backup_schedule" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - database = google_firestore_database.database.name - - retention = "8467200s" // 14 weeks (maximum possible retention) - - weekly_recurrence { - day = "SUNDAY" - } -} diff --git a/mmv1/templates/terraform/examples/go/firestore_cmek_database.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_cmek_database.tf.tmpl deleted file mode 100644 index f4a36dd2ef85..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_cmek_database.tf.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -data "google_project" "project" { -} - -resource "google_firestore_database" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "database_id"}}" - location_id = "nam5" - type = "FIRESTORE_NATIVE" - concurrency_mode = "OPTIMISTIC" - app_engine_integration_mode = "DISABLED" - point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_ENABLED" - delete_protection_state = "{{index $.Vars "delete_protection_state"}}" - deletion_policy = "DELETE" - cmek_config { - kms_key_name = google_kms_crypto_key.crypto_key.id - } - - depends_on = [ - google_kms_crypto_key_iam_binding.firestore_cmek_keyuser - ] -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "{{index $.Vars "kms_key_name"}}" - key_ring = google_kms_key_ring.key_ring.id - purpose = "ENCRYPT_DECRYPT" -} - -resource "google_kms_key_ring" "key_ring" { - name = "{{index $.Vars "kms_key_ring_name"}}" - location = "us" -} - -resource "google_kms_crypto_key_iam_binding" "firestore_cmek_keyuser" { - crypto_key_id = google_kms_crypto_key.crypto_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - members = [ - "serviceAccount:service-${data.google_project.project.number}@gcp-sa-firestore.iam.gserviceaccount.com", - ] -} diff --git a/mmv1/templates/terraform/examples/go/firestore_cmek_database_in_datastore_mode.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_cmek_database_in_datastore_mode.tf.tmpl deleted file mode 100644 index ead83deaa4e4..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_cmek_database_in_datastore_mode.tf.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -data "google_project" "project" { -} - -resource "google_firestore_database" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "database_id"}}" - location_id = "nam5" - type = "DATASTORE_MODE" - concurrency_mode = "OPTIMISTIC" - app_engine_integration_mode = "DISABLED" - point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_ENABLED" - delete_protection_state = "{{index $.Vars "delete_protection_state"}}" - deletion_policy = "DELETE" - cmek_config { - kms_key_name = google_kms_crypto_key.crypto_key.id - } - - depends_on = [ - google_kms_crypto_key_iam_binding.firestore_cmek_keyuser - ] -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "{{index $.Vars "kms_key_name"}}" - key_ring = google_kms_key_ring.key_ring.id - purpose = "ENCRYPT_DECRYPT" -} - -resource "google_kms_key_ring" "key_ring" { - name = "{{index $.Vars "kms_key_ring_name"}}" - location = "us" -} - -resource "google_kms_crypto_key_iam_binding" "firestore_cmek_keyuser" { - crypto_key_id = google_kms_crypto_key.crypto_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - members = [ - "serviceAccount:service-${data.google_project.project.number}@gcp-sa-firestore.iam.gserviceaccount.com", - ] -} diff --git a/mmv1/templates/terraform/examples/go/firestore_database.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_database.tf.tmpl deleted file mode 100644 index 51ca0a344014..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_database.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_firestore_database" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "database_id"}}" - location_id = "nam5" - type = "FIRESTORE_NATIVE" - concurrency_mode = "OPTIMISTIC" - app_engine_integration_mode = "DISABLED" - point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_ENABLED" - delete_protection_state = "{{index $.Vars "delete_protection_state"}}" - deletion_policy = "DELETE" -} diff --git a/mmv1/templates/terraform/examples/go/firestore_database_in_datastore_mode.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_database_in_datastore_mode.tf.tmpl deleted file mode 100644 index 825eb185c321..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_database_in_datastore_mode.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_firestore_database" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "database_id"}}" - location_id = "nam5" - type = "DATASTORE_MODE" - concurrency_mode = "OPTIMISTIC" - app_engine_integration_mode = "DISABLED" - point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_ENABLED" - delete_protection_state = "{{index $.Vars "delete_protection_state"}}" - deletion_policy = "DELETE" -} diff --git a/mmv1/templates/terraform/examples/go/firestore_default_database.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_default_database.tf.tmpl deleted file mode 100644 index 6b28ded4b153..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_default_database.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_firestore_database" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - name = "(default)" - location_id = "nam5" - type = "FIRESTORE_NATIVE" -} diff --git a/mmv1/templates/terraform/examples/go/firestore_default_database_in_datastore_mode.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_default_database_in_datastore_mode.tf.tmpl deleted file mode 100644 index 5bdf0d6ad119..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_default_database_in_datastore_mode.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_firestore_database" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - name = "(default)" - location_id = "nam5" - type = "DATASTORE_MODE" -} diff --git a/mmv1/templates/terraform/examples/go/firestore_document_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_document_basic.tf.tmpl deleted file mode 100644 index 34f54c069258..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_document_basic.tf.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -resource "google_project" "project" { - project_id = "{{index $.Vars "project_id"}}" - name = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} - -resource "time_sleep" "wait_60_seconds" { - depends_on = [google_project.project] - - create_duration = "60s" -} - -resource "google_project_service" "firestore" { - project = google_project.project.project_id - service = "firestore.googleapis.com" - - # Needed for CI tests for permissions to propagate, should not be needed for actual usage - depends_on = [time_sleep.wait_60_seconds] -} - -resource "google_firestore_database" "database" { - project = google_project.project.project_id - name = "(default)" - location_id = "nam5" - type = "FIRESTORE_NATIVE" - - depends_on = [google_project_service.firestore] -} - -resource "google_firestore_document" "{{$.PrimaryResourceId}}" { - project = google_project.project.project_id - database = google_firestore_database.database.name - collection = "somenewcollection" - document_id = "{{index $.Vars "document_id"}}" - fields = "{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}" -} diff --git a/mmv1/templates/terraform/examples/go/firestore_document_nested_document.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_document_nested_document.tf.tmpl deleted file mode 100644 index c49b4e96b329..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_document_nested_document.tf.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -resource "google_project" "project" { - project_id = "{{index $.Vars "project_id"}}" - name = "{{index $.Vars "project_id"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} - -resource "time_sleep" "wait_60_seconds" { - depends_on = [google_project.project] - - create_duration = "60s" -} - -resource "google_project_service" "firestore" { - project = google_project.project.project_id - service = "firestore.googleapis.com" - - # Needed for CI tests for permissions to propagate, should not be needed for actual usage - depends_on = [time_sleep.wait_60_seconds] -} - -resource "google_firestore_database" "database" { - project = google_project.project.project_id - name = "(default)" - location_id = "nam5" - type = "FIRESTORE_NATIVE" - - depends_on = [google_project_service.firestore] -} - -resource "google_firestore_document" "{{$.PrimaryResourceId}}" { - project = google_project.project.project_id - database = google_firestore_database.database.name - collection = "somenewcollection" - document_id = "{{index $.Vars "document_id"}}" - fields = "{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}" -} - -resource "google_firestore_document" "sub_document" { - project = google_project.project.project_id - database = google_firestore_database.database.name - collection = "${google_firestore_document.{{$.PrimaryResourceId}}.path}/subdocs" - document_id = "bitcoinkey" - fields = "{\"something\":{\"mapValue\":{\"fields\":{\"ayo\":{\"stringValue\":\"val2\"}}}}}" -} - -resource "google_firestore_document" "sub_sub_document" { - project = google_project.project.project_id - database = google_firestore_database.database.name - collection = "${google_firestore_document.sub_document.path}/subsubdocs" - document_id = "asecret" - fields = "{\"something\":{\"mapValue\":{\"fields\":{\"secret\":{\"stringValue\":\"hithere\"}}}}}" -} diff --git a/mmv1/templates/terraform/examples/go/firestore_field_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_field_basic.tf.tmpl deleted file mode 100644 index bdca9cad59cd..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_field_basic.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 = "basic" - - index_config { - indexes { - order = "ASCENDING" - query_scope = "COLLECTION_GROUP" - } - indexes { - array_config = "CONTAINS" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firestore_field_complex_field_name.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_field_complex_field_name.tf.tmpl deleted file mode 100644 index 8f569c85ccd7..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_field_complex_field_name.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_firestore_field" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - collection = "chatrooms_%{random_suffix}" - field = "`*`" - - index_config { - indexes { - order = "ASCENDING" - query_scope = "COLLECTION_GROUP" - } - indexes { - array_config = "CONTAINS" - } - } - ttl_config {} -} diff --git a/mmv1/templates/terraform/examples/go/firestore_field_match_override.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_field_match_override.tf.tmpl deleted file mode 100644 index 9e00d797d00c..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_field_match_override.tf.tmpl +++ /dev/null @@ -1,28 +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 = "field_with_same_configuration_as_ancestor" - - index_config { - indexes { - order = "ASCENDING" - } - indexes { - order = "DESCENDING" - } - indexes { - array_config = "CONTAINS" - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/firestore_field_timestamp.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_field_timestamp.tf.tmpl deleted file mode 100644 index 29071cba3232..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_field_timestamp.tf.tmpl +++ /dev/null @@ -1,22 +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" - field = "timestamp" - - # enables a TTL policy for the document based on the value of entries with this field - ttl_config {} - - // Disable all single field indexes for the timestamp property. - index_config {} -} diff --git a/mmv1/templates/terraform/examples/go/firestore_index_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_index_basic.tf.tmpl deleted file mode 100644 index ecc93964e5d9..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_index_basic.tf.tmpl +++ /dev/null @@ -1,25 +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 = "DELETE_PROTECTION_DISABLED" - deletion_policy = "DELETE" -} - -resource "google_firestore_index" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - database = google_firestore_database.database.name - collection = "atestcollection" - - fields { - field_path = "name" - order = "ASCENDING" - } - - fields { - field_path = "description" - order = "DESCENDING" - } -} diff --git a/mmv1/templates/terraform/examples/go/firestore_index_datastore_mode.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_index_datastore_mode.tf.tmpl deleted file mode 100644 index b6ae19a28db0..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_index_datastore_mode.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_firestore_database" "database" { - project = "{{index $.TestEnvVars "project_id"}}" - name = "{{index $.Vars "database_id"}}" - location_id = "nam5" - type = "DATASTORE_MODE" - - delete_protection_state = "DELETE_PROTECTION_DISABLED" - deletion_policy = "DELETE" -} - -resource "google_firestore_index" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - database = google_firestore_database.database.name - collection = "atestcollection" - - query_scope = "COLLECTION_RECURSIVE" - api_scope = "DATASTORE_MODE_API" - - fields { - field_path = "name" - order = "ASCENDING" - } - - fields { - field_path = "description" - order = "DESCENDING" - } -} diff --git a/mmv1/templates/terraform/examples/go/firestore_index_vector.tf.tmpl b/mmv1/templates/terraform/examples/go/firestore_index_vector.tf.tmpl deleted file mode 100644 index f764f08d493e..000000000000 --- a/mmv1/templates/terraform/examples/go/firestore_index_vector.tf.tmpl +++ /dev/null @@ -1,33 +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 = "DELETE_PROTECTION_DISABLED" - deletion_policy = "DELETE" -} - -resource "google_firestore_index" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project_id"}}" - database = google_firestore_database.database.name - collection = "atestcollection" - - fields { - field_path = "field_name" - order = "ASCENDING" - } - - fields { - field_path = "__name__" - order = "ASCENDING" - } - - fields { - field_path = "description" - vector_config { - dimension = 128 - flat {} - } - } -} diff --git a/mmv1/templates/terraform/examples/go/firewall_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/firewall_basic.tf.tmpl deleted file mode 100644 index 77e1ea0feaa0..000000000000 --- a/mmv1/templates/terraform/examples/go/firewall_basic.tf.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -resource "google_compute_firewall" "default" { - name = "{{index $.Vars "firewall_name"}}" - network = google_compute_network.default.name - - allow { - protocol = "icmp" - } - - allow { - protocol = "tcp" - ports = ["80", "8080", "1000-2000"] - } - - source_tags = ["web"] -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/firewall_with_target_tags.tf.tmpl b/mmv1/templates/terraform/examples/go/firewall_with_target_tags.tf.tmpl deleted file mode 100644 index 44b17b9699ed..000000000000 --- a/mmv1/templates/terraform/examples/go/firewall_with_target_tags.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_compute_firewall" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project"}}" - name = "{{index $.Vars "firewall_name"}}" - network = "default" - description = "Creates firewall rule targeting tagged instances" - - allow { - protocol = "tcp" - ports = ["80", "8080", "1000-2000"] - } - - source_tags = ["foo"] - target_tags = ["web"] -} diff --git a/mmv1/templates/terraform/examples/go/flask_google_cloud_quickstart.tf.tmpl b/mmv1/templates/terraform/examples/go/flask_google_cloud_quickstart.tf.tmpl deleted file mode 100644 index fc23157f4b37..000000000000 --- a/mmv1/templates/terraform/examples/go/flask_google_cloud_quickstart.tf.tmpl +++ /dev/null @@ -1,65 +0,0 @@ -# Create a single Compute Engine instance -resource "google_compute_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "flask_vm"}}" - machine_type = "f1-micro" - zone = "us-west1-a" - tags = ["ssh"] - - metadata = { - enable-oslogin = "TRUE" - } - boot_disk { - initialize_params { - image = "debian-cloud/debian-11" - } - } - - # Install Flask - metadata_startup_script = "sudo apt-get update; sudo apt-get install -yq build-essential python-pip rsync; pip install flask" - - network_interface { - network = "default" - - access_config { - # Include this section to give the VM an external IP address - } - } -} - -resource "google_compute_firewall" "ssh" { - name = "{{index $.Vars "allow_ssh"}}" - allow { - ports = ["22"] - protocol = "tcp" - } - direction = "INGRESS" - network = "default" - priority = 1000 - source_ranges = ["0.0.0.0/0"] - target_tags = ["ssh"] -} - - -resource "google_compute_firewall" "flask" { - name = "{{index $.Vars "flask_app_firewall"}}" - network = "default" - - allow { - protocol = "tcp" - ports = ["5000"] - } - source_ranges = ["0.0.0.0/0"] -} - -# Create new multi-region storage bucket in the US -# with versioning enabled - -resource "google_storage_bucket" "default" { - name = "{{index $.Vars "bucket_tfstate"}}" - force_destroy = false - location = "US" - storage_class = "STANDARD" - versioning { - enabled = true - } -} diff --git a/mmv1/templates/terraform/examples/go/folder_access_approval_active_key_version.tf.tmpl b/mmv1/templates/terraform/examples/go/folder_access_approval_active_key_version.tf.tmpl deleted file mode 100644 index 64d4f3a55e47..000000000000 --- a/mmv1/templates/terraform/examples/go/folder_access_approval_active_key_version.tf.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -resource "google_folder" "my_folder" { - display_name = "{{index $.Vars "folder_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - deletion_protection = false -} - -resource "google_project" "my_project" { - name = "My Project" - project_id = "your-project-id" - folder_id = google_folder.my_folder.name - deletion_policy = "DELETE" -} - -resource "google_kms_key_ring" "key_ring" { - name = "key-ring" - location = "global" - project = google_project.my_project.project_id -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "crypto-key" - key_ring = google_kms_key_ring.key_ring.id - purpose = "ASYMMETRIC_SIGN" - - version_template { - algorithm = "EC_SIGN_P384_SHA384" - } -} - -data "google_access_approval_folder_service_account" "service_account" { - folder_id = google_folder.my_folder.folder_id -} - -resource "google_kms_crypto_key_iam_member" "iam" { - crypto_key_id = google_kms_crypto_key.crypto_key.id - role = "roles/cloudkms.signerVerifier" - member = "serviceAccount:${data.google_access_approval_folder_service_account.service_account.account_email}" -} - -data "google_kms_crypto_key_version" "crypto_key_version" { - crypto_key = google_kms_crypto_key.crypto_key.id -} - -resource "google_folder_access_approval_settings" "{{$.PrimaryResourceId}}" { - folder_id = google_folder.my_folder.folder_id - active_key_version = data.google_kms_crypto_key_version.crypto_key_version.name - - enrolled_services { - cloud_product = "all" - } - - depends_on = [google_kms_crypto_key_iam_member.iam] -} diff --git a/mmv1/templates/terraform/examples/go/folder_access_approval_full.tf.tmpl b/mmv1/templates/terraform/examples/go/folder_access_approval_full.tf.tmpl deleted file mode 100644 index fc08b3dee4f8..000000000000 --- a/mmv1/templates/terraform/examples/go/folder_access_approval_full.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_folder" "my_folder" { - display_name = "{{index $.Vars "folder_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - deletion_protection = false -} - -resource "google_folder_access_approval_settings" "{{$.PrimaryResourceId}}" { - folder_id = google_folder.my_folder.folder_id - notification_emails = ["testuser@example.com", "example.user@example.com"] - - enrolled_services { - cloud_product = "all" - } -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_basic.tf.tmpl deleted file mode 100644 index c1d0a4d1dd7c..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - target = google_compute_target_pool.default.id - port_range = "80" -} - -resource "google_compute_target_pool" "default" { - name = "{{index $.Vars "target_pool_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_externallb.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_externallb.tf.tmpl deleted file mode 100644 index d49f86bdf06f..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_externallb.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -// Forwarding rule for External Network Load Balancing using Backend Services -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - port_range = 80 - backend_service = google_compute_region_backend_service.backend.id -} -resource "google_compute_region_backend_service" "backend" { - provider = google-beta - 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" { - provider = google-beta - name = "check-{{index $.Vars "backend_name"}}" - check_interval_sec = 1 - timeout_sec = 1 - region = "us-central1" - - tcp_health_check { - port = "80" - } -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_global_internallb.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_global_internallb.tf.tmpl deleted file mode 100644 index 8df91445892d..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_global_internallb.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -// Forwarding rule for Internal Load Balancing -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - load_balancing_scheme = "INTERNAL" - backend_service = google_compute_region_backend_service.backend.id - all_ports = true - allow_global_access = true - network = google_compute_network.default.name - subnetwork = google_compute_subnetwork.default.name -} -resource "google_compute_region_backend_service" "backend" { - name = "{{index $.Vars "backend_name"}}" - region = "us-central1" - health_checks = [google_compute_health_check.hc.id] -} -resource "google_compute_health_check" "hc" { - name = "check-{{index $.Vars "backend_name"}}" - check_interval_sec = 1 - timeout_sec = 1 - tcp_health_check { - port = "80" - } -} -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "network_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.default.id -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_http_lb.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_http_lb.tf.tmpl deleted file mode 100644 index dc11078d0156..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_http_lb.tf.tmpl +++ /dev/null @@ -1,189 +0,0 @@ -// Forwarding rule for Internal Load Balancing -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - depends_on = [google_compute_subnetwork.proxy] - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - - ip_protocol = "TCP" - load_balancing_scheme = "INTERNAL_MANAGED" - port_range = "80" - target = google_compute_region_target_http_proxy.default.id - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - network_tier = "PREMIUM" -} - -resource "google_compute_region_target_http_proxy" "default" { - provider = google-beta - - region = "us-central1" - name = "{{index $.Vars "region_target_http_proxy_name"}}" - url_map = google_compute_region_url_map.default.id -} - -resource "google_compute_region_url_map" "default" { - provider = google-beta - - region = "us-central1" - name = "{{index $.Vars "region_url_map_name"}}" - default_service = google_compute_region_backend_service.default.id -} - -resource "google_compute_region_backend_service" "default" { - provider = google-beta - - load_balancing_scheme = "INTERNAL_MANAGED" - - backend { - group = google_compute_region_instance_group_manager.rigm.instance_group - balancing_mode = "UTILIZATION" - capacity_scaler = 1.0 - } - - region = "us-central1" - name = "{{index $.Vars "region_backend_service_name"}}" - protocol = "HTTP" - timeout_sec = 10 - - health_checks = [google_compute_region_health_check.default.id] -} - -data "google_compute_image" "debian_image" { - provider = google-beta - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_region_instance_group_manager" "rigm" { - provider = google-beta - region = "us-central1" - name = "{{index $.Vars "rigm_name"}}" - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } - base_instance_name = "internal-glb" - target_size = 1 -} - -resource "google_compute_instance_template" "instance_template" { - provider = google-beta - name = "template-{{index $.Vars "region_backend_service_name"}}" - machine_type = "e2-medium" - - network_interface { - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - } - - disk { - source_image = data.google_compute_image.debian_image.self_link - auto_delete = true - boot = true - } - - tags = ["allow-ssh", "load-balanced-backend"] -} - -resource "google_compute_region_health_check" "default" { - depends_on = [google_compute_firewall.fw4] - provider = google-beta - - region = "us-central1" - name = "{{index $.Vars "region_health_check_name"}}" - http_health_check { - port_specification = "USE_SERVING_PORT" - } -} - -resource "google_compute_firewall" "fw1" { - provider = google-beta - name = "{{index $.Vars "fw_name"}}-1" - network = google_compute_network.default.id - source_ranges = ["10.1.2.0/24"] - allow { - protocol = "tcp" - } - allow { - protocol = "udp" - } - allow { - protocol = "icmp" - } - direction = "INGRESS" -} - -resource "google_compute_firewall" "fw2" { - depends_on = [google_compute_firewall.fw1] - provider = google-beta - name = "{{index $.Vars "fw_name"}}-2" - network = google_compute_network.default.id - source_ranges = ["0.0.0.0/0"] - allow { - protocol = "tcp" - ports = ["22"] - } - target_tags = ["allow-ssh"] - direction = "INGRESS" -} - -resource "google_compute_firewall" "fw3" { - depends_on = [google_compute_firewall.fw2] - provider = google-beta - name = "{{index $.Vars "fw_name"}}-3" - network = google_compute_network.default.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16"] - allow { - protocol = "tcp" - } - target_tags = ["load-balanced-backend"] - direction = "INGRESS" -} - -resource "google_compute_firewall" "fw4" { - depends_on = [google_compute_firewall.fw3] - provider = google-beta - name = "{{index $.Vars "fw_name"}}-4" - network = google_compute_network.default.id - source_ranges = ["10.129.0.0/26"] - target_tags = ["load-balanced-backend"] - allow { - protocol = "tcp" - ports = ["80"] - } - allow { - protocol = "tcp" - ports = ["443"] - } - allow { - protocol = "tcp" - ports = ["8000"] - } - direction = "INGRESS" -} - -resource "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false - routing_mode = "REGIONAL" -} - -resource "google_compute_subnetwork" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}-default" - ip_cidr_range = "10.1.2.0/24" - region = "us-central1" - network = google_compute_network.default.id -} - -resource "google_compute_subnetwork" "proxy" { - provider = google-beta - name = "{{index $.Vars "network_name"}}-proxy" - ip_cidr_range = "10.129.0.0/26" - region = "us-central1" - network = google_compute_network.default.id - purpose = "REGIONAL_MANAGED_PROXY" - role = "ACTIVE" -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_internallb.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_internallb.tf.tmpl deleted file mode 100644 index 07d01a4f112e..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_internallb.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -// Forwarding rule for Internal Load Balancing -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - - load_balancing_scheme = "INTERNAL" - backend_service = google_compute_region_backend_service.backend.id - all_ports = true - network = google_compute_network.default.name - subnetwork = google_compute_subnetwork.default.name - ip_version = "IPV4" -} - -resource "google_compute_region_backend_service" "backend" { - name = "{{index $.Vars "backend_name"}}" - region = "us-central1" - health_checks = [google_compute_health_check.hc.id] -} - -resource "google_compute_health_check" "hc" { - name = "check-{{index $.Vars "backend_name"}}" - check_interval_sec = 1 - timeout_sec = 1 - - tcp_health_check { - port = "80" - } -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "network_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.default.id -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_internallb_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_internallb_ipv6.tf.tmpl deleted file mode 100644 index 9cad7a0d08a0..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_internallb_ipv6.tf.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -// Forwarding rule for Internal Load Balancing -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - - load_balancing_scheme = "INTERNAL" - backend_service = google_compute_region_backend_service.backend.id - all_ports = true - network = google_compute_network.default.name - subnetwork = google_compute_subnetwork.default.name - ip_version = "IPV6" -} - -resource "google_compute_region_backend_service" "backend" { - name = "{{index $.Vars "backend_name"}}" - region = "us-central1" - health_checks = [google_compute_health_check.hc.id] -} - -resource "google_compute_health_check" "hc" { - name = "check-{{index $.Vars "backend_name"}}" - check_interval_sec = 1 - timeout_sec = 1 - - tcp_health_check { - port = "80" - } -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false - enable_ula_internal_ipv6 = true -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "subnet_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - stack_type = "IPV4_IPV6" - ipv6_access_type = "INTERNAL" - network = google_compute_network.default.id -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_l3_default.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_l3_default.tf.tmpl deleted file mode 100644 index 8c68f7ae9898..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_l3_default.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "forwarding_rule_name"}}" - backend_service = google_compute_region_backend_service.service.id - ip_protocol = "L3_DEFAULT" - all_ports = true -} - -resource "google_compute_region_backend_service" "service" { - provider = google-beta - region = "us-central1" - name = "{{index $.Vars "service_name"}}" - health_checks = [google_compute_region_health_check.health_check.id] - protocol = "UNSPECIFIED" - load_balancing_scheme = "EXTERNAL" -} - -resource "google_compute_region_health_check" "health_check" { - provider = google-beta - name = "{{index $.Vars "health_check_name"}}" - region = "us-central1" - - tcp_health_check { - port = 80 - } -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_regional_http_xlb.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_regional_http_xlb.tf.tmpl deleted file mode 100644 index 395a45dcb23e..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_regional_http_xlb.tf.tmpl +++ /dev/null @@ -1,196 +0,0 @@ -// Forwarding rule for Regional External Load Balancing -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - depends_on = [google_compute_subnetwork.proxy] - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - - ip_protocol = "TCP" - load_balancing_scheme = "EXTERNAL_MANAGED" - port_range = "80" - target = google_compute_region_target_http_proxy.default.id - network = google_compute_network.default.id - ip_address = google_compute_address.default.address - network_tier = "STANDARD" -} - -resource "google_compute_region_target_http_proxy" "default" { - provider = google-beta - - region = "us-central1" - name = "{{index $.Vars "region_target_http_proxy_name"}}" - url_map = google_compute_region_url_map.default.id -} - -resource "google_compute_region_url_map" "default" { - provider = google-beta - - region = "us-central1" - name = "{{index $.Vars "region_url_map_name"}}" - default_service = google_compute_region_backend_service.default.id -} - -resource "google_compute_region_backend_service" "default" { - provider = google-beta - - load_balancing_scheme = "EXTERNAL_MANAGED" - - backend { - group = google_compute_region_instance_group_manager.rigm.instance_group - balancing_mode = "UTILIZATION" - capacity_scaler = 1.0 - } - - region = "us-central1" - name = "{{index $.Vars "region_backend_service_name"}}" - protocol = "HTTP" - timeout_sec = 10 - - health_checks = [google_compute_region_health_check.default.id] -} - -data "google_compute_image" "debian_image" { - provider = google-beta - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_region_instance_group_manager" "rigm" { - provider = google-beta - region = "us-central1" - name = "{{index $.Vars "rigm_name"}}" - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } - base_instance_name = "internal-glb" - target_size = 1 -} - -resource "google_compute_instance_template" "instance_template" { - provider = google-beta - name = "template-{{index $.Vars "region_backend_service_name"}}" - machine_type = "e2-medium" - - network_interface { - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - } - - disk { - source_image = data.google_compute_image.debian_image.self_link - auto_delete = true - boot = true - } - - tags = ["allow-ssh", "load-balanced-backend"] -} - -resource "google_compute_region_health_check" "default" { - depends_on = [google_compute_firewall.fw4] - provider = google-beta - - region = "us-central1" - name = "{{index $.Vars "region_health_check_name"}}" - http_health_check { - port_specification = "USE_SERVING_PORT" - } -} - -resource "google_compute_address" "default" { - name = "{{index $.Vars "ip_name"}}-1" - provider = google-beta - region = "us-central1" - network_tier = "STANDARD" -} - -resource "google_compute_firewall" "fw1" { - provider = google-beta - name = "{{index $.Vars "fw_name"}}-1" - network = google_compute_network.default.id - source_ranges = ["10.1.2.0/24"] - allow { - protocol = "tcp" - } - allow { - protocol = "udp" - } - allow { - protocol = "icmp" - } - direction = "INGRESS" -} - -resource "google_compute_firewall" "fw2" { - depends_on = [google_compute_firewall.fw1] - provider = google-beta - name = "{{index $.Vars "fw_name"}}-2" - network = google_compute_network.default.id - source_ranges = ["0.0.0.0/0"] - allow { - protocol = "tcp" - ports = ["22"] - } - target_tags = ["allow-ssh"] - direction = "INGRESS" -} - -resource "google_compute_firewall" "fw3" { - depends_on = [google_compute_firewall.fw2] - provider = google-beta - name = "{{index $.Vars "fw_name"}}-3" - network = google_compute_network.default.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16"] - allow { - protocol = "tcp" - } - target_tags = ["load-balanced-backend"] - direction = "INGRESS" -} - -resource "google_compute_firewall" "fw4" { - depends_on = [google_compute_firewall.fw3] - provider = google-beta - name = "{{index $.Vars "fw_name"}}-4" - network = google_compute_network.default.id - source_ranges = ["10.129.0.0/26"] - target_tags = ["load-balanced-backend"] - allow { - protocol = "tcp" - ports = ["80"] - } - allow { - protocol = "tcp" - ports = ["443"] - } - allow { - protocol = "tcp" - ports = ["8000"] - } - direction = "INGRESS" -} - -resource "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false - routing_mode = "REGIONAL" -} - -resource "google_compute_subnetwork" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}-default" - ip_cidr_range = "10.1.2.0/24" - region = "us-central1" - network = google_compute_network.default.id -} - -resource "google_compute_subnetwork" "proxy" { - provider = google-beta - name = "{{index $.Vars "network_name"}}-proxy" - ip_cidr_range = "10.129.0.0/26" - region = "us-central1" - network = google_compute_network.default.id - purpose = "REGIONAL_MANAGED_PROXY" - role = "ACTIVE" -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_regional_steering.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_regional_steering.tf.tmpl deleted file mode 100644 index 020854ebd4c7..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_regional_steering.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_compute_forwarding_rule" "steering" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - ip_address = google_compute_address.basic.address - backend_service = google_compute_region_backend_service.external.self_link - load_balancing_scheme = "EXTERNAL" - source_ip_ranges = ["34.121.88.0/24", "35.187.239.137"] - depends_on = [google_compute_forwarding_rule.external] -} - -resource "google_compute_address" "basic" { - name = "{{index $.Vars "ip_name"}}" - region = "us-central1" -} - -resource "google_compute_region_backend_service" "external" { - name = "{{index $.Vars "backend_name"}}" - region = "us-central1" - load_balancing_scheme = "EXTERNAL" -} - -resource "google_compute_forwarding_rule" "external" { - name = "{{index $.Vars "external_forwarding_rule_name"}}" - region = "us-central1" - ip_address = google_compute_address.basic.address - backend_service = google_compute_region_backend_service.external.self_link - load_balancing_scheme = "EXTERNAL" -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_vpc_psc.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_vpc_psc.tf.tmpl deleted file mode 100644 index 84a2c14d5165..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_vpc_psc.tf.tmpl +++ /dev/null @@ -1,94 +0,0 @@ -// Forwarding rule for VPC private service connect -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - load_balancing_scheme = "" - target = google_compute_service_attachment.producer_service_attachment.id - network = google_compute_network.consumer_net.name - ip_address = google_compute_address.consumer_address.id - allow_psc_global_access = true -} - -// Consumer service endpoint - -resource "google_compute_network" "consumer_net" { - name = "{{index $.Vars "consumer_network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "consumer_subnet" { - name = "{{index $.Vars "consumer_network_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.consumer_net.id -} - -resource "google_compute_address" "consumer_address" { - name = "{{index $.Vars "ip_name"}}-1" - region = "us-central1" - subnetwork = google_compute_subnetwork.consumer_subnet.id - address_type = "INTERNAL" -} - - -// Producer service attachment - -resource "google_compute_network" "producer_net" { - name = "{{index $.Vars "producer_network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "producer_subnet" { - name = "{{index $.Vars "producer_network_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.producer_net.id -} - -resource "google_compute_subnetwork" "psc_producer_subnet" { - name = "{{index $.Vars "producer_psc_network_name"}}" - ip_cidr_range = "10.1.0.0/16" - region = "us-central1" - - purpose = "PRIVATE_SERVICE_CONNECT" - network = google_compute_network.producer_net.id -} - -resource "google_compute_service_attachment" "producer_service_attachment" { - name = "{{index $.Vars "service_attachment_name"}}" - region = "us-central1" - description = "A service attachment configured with Terraform" - - enable_proxy_protocol = true - connection_preference = "ACCEPT_AUTOMATIC" - nat_subnets = [google_compute_subnetwork.psc_producer_subnet.name] - target_service = google_compute_forwarding_rule.producer_target_service.id -} - -resource "google_compute_forwarding_rule" "producer_target_service" { - name = "{{index $.Vars "producer_forwarding_rule_name"}}" - region = "us-central1" - - load_balancing_scheme = "INTERNAL" - backend_service = google_compute_region_backend_service.producer_service_backend.id - all_ports = true - network = google_compute_network.producer_net.name - subnetwork = google_compute_subnetwork.producer_subnet.name -} - -resource "google_compute_region_backend_service" "producer_service_backend" { - name = "{{index $.Vars "producer_backend_name"}}" - region = "us-central1" - - health_checks = [google_compute_health_check.producer_service_health_check.id] -} - -resource "google_compute_health_check" "producer_service_health_check" { - name = "{{index $.Vars "producer_healthcheck_name"}}" - - check_interval_sec = 1 - timeout_sec = 1 - tcp_health_check { - port = "80" - } -} diff --git a/mmv1/templates/terraform/examples/go/forwarding_rule_vpc_psc_no_automate_dns.tf.tmpl b/mmv1/templates/terraform/examples/go/forwarding_rule_vpc_psc_no_automate_dns.tf.tmpl deleted file mode 100644 index 93b976c1217a..000000000000 --- a/mmv1/templates/terraform/examples/go/forwarding_rule_vpc_psc_no_automate_dns.tf.tmpl +++ /dev/null @@ -1,90 +0,0 @@ -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-central1" - load_balancing_scheme = "" - target = google_compute_service_attachment.producer_service_attachment.id - network = google_compute_network.consumer_net.name - ip_address = google_compute_address.consumer_address.id - allow_psc_global_access = true - no_automate_dns_zone = true -} - -resource "google_compute_network" "consumer_net" { - name = "{{index $.Vars "consumer_network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "consumer_subnet" { - name = "{{index $.Vars "consumer_network_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.consumer_net.id -} - -resource "google_compute_address" "consumer_address" { - name = "{{index $.Vars "ip_name"}}-1" - region = "us-central1" - subnetwork = google_compute_subnetwork.consumer_subnet.id - address_type = "INTERNAL" -} - - -resource "google_compute_network" "producer_net" { - name = "{{index $.Vars "producer_network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "producer_subnet" { - name = "{{index $.Vars "producer_network_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.producer_net.id -} - -resource "google_compute_subnetwork" "psc_producer_subnet" { - name = "{{index $.Vars "producer_psc_network_name"}}" - ip_cidr_range = "10.1.0.0/16" - region = "us-central1" - - purpose = "PRIVATE_SERVICE_CONNECT" - network = google_compute_network.producer_net.id -} - -resource "google_compute_service_attachment" "producer_service_attachment" { - name = "{{index $.Vars "service_attachment_name"}}" - region = "us-central1" - description = "A service attachment configured with Terraform" - - enable_proxy_protocol = true - connection_preference = "ACCEPT_AUTOMATIC" - nat_subnets = [google_compute_subnetwork.psc_producer_subnet.name] - target_service = google_compute_forwarding_rule.producer_target_service.id -} - -resource "google_compute_forwarding_rule" "producer_target_service" { - name = "{{index $.Vars "producer_forwarding_rule_name"}}" - region = "us-central1" - - load_balancing_scheme = "INTERNAL" - backend_service = google_compute_region_backend_service.producer_service_backend.id - all_ports = true - network = google_compute_network.producer_net.name - subnetwork = google_compute_subnetwork.producer_subnet.name -} - -resource "google_compute_region_backend_service" "producer_service_backend" { - name = "{{index $.Vars "producer_backend_name"}}" - region = "us-central1" - - health_checks = [google_compute_health_check.producer_service_health_check.id] -} - -resource "google_compute_health_check" "producer_service_health_check" { - name = "{{index $.Vars "producer_healthcheck_name"}}" - - check_interval_sec = 1 - timeout_sec = 1 - tcp_health_check { - port = "80" - } -} diff --git a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_autopilot.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_backupplan_autopilot.tf.tmpl deleted file mode 100644 index 51e87e23fcc0..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_autopilot.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1" - enable_autopilot = true - ip_allocation_policy { - } - release_channel { - channel = "RAPID" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "autopilot" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_backupplan_basic.tf.tmpl deleted file mode 100644 index 0ad3b4f9fe9c..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_basic.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_cmek.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_backupplan_cmek.tf.tmpl deleted file mode 100644 index e7fd2111332b..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_cmek.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "cmek" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - selected_namespaces { - namespaces = ["default", "test"] - } - encryption_key { - gcp_kms_encryption_key = google_kms_crypto_key.crypto_key.id - } - } -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "{{index $.Vars "key_name"}}" - key_ring = google_kms_key_ring.key_ring.id -} - -resource "google_kms_key_ring" "key_ring" { - name = "{{index $.Vars "key_name"}}" - location = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_full.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_backupplan_full.tf.tmpl deleted file mode 100644 index 08db392f0b2c..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_full.tf.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "full" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - retention_policy { - backup_delete_lock_days = 30 - backup_retain_days = 180 - } - backup_schedule { - cron_schedule = "0 9 * * 1" - } - backup_config { - include_volume_data = true - include_secrets = true - selected_applications { - namespaced_names { - name = "app1" - namespace = "ns1" - } - namespaced_names { - name = "app2" - namespace = "ns2" - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_permissive.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_backupplan_permissive.tf.tmpl deleted file mode 100644 index ff568a0f05db..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_permissive.tf.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - retention_policy { - backup_delete_lock_days = 30 - backup_retain_days = 180 - } - backup_schedule { - cron_schedule = "0 9 * * 1" - } - backup_config { - include_volume_data = true - include_secrets = true - permissive_mode = true - selected_applications { - namespaced_names { - name = "app1" - namespace = "ns1" - } - namespaced_names { - name = "app2" - namespace = "ns2" - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_rpo_daily_window.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_backupplan_rpo_daily_window.tf.tmpl deleted file mode 100644 index f2631688f837..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_rpo_daily_window.tf.tmpl +++ /dev/null @@ -1,58 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - retention_policy { - backup_delete_lock_days = 30 - backup_retain_days = 180 - } - backup_schedule { - paused = true - rpo_config { - target_rpo_minutes=1440 - exclusion_windows { - start_time { - hours = 12 - } - duration = "7200s" - daily = true - } - exclusion_windows { - start_time { - hours = 8 - minutes = 40 - seconds = 1 - nanos = 100 - } - duration = "3600s" - single_occurrence_date { - year = 2024 - month = 3 - day = 16 - } - } - } - } - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} diff --git a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_rpo_weekly_window.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_backupplan_rpo_weekly_window.tf.tmpl deleted file mode 100644 index 19a58d493796..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_backupplan_rpo_weekly_window.tf.tmpl +++ /dev/null @@ -1,70 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - retention_policy { - backup_delete_lock_days = 30 - backup_retain_days = 180 - } - backup_schedule { - paused = true - rpo_config { - target_rpo_minutes=1440 - exclusion_windows { - start_time { - hours = 1 - minutes = 23 - } - duration = "1800s" - days_of_week { - days_of_week = ["MONDAY", "THURSDAY"] - } - } - exclusion_windows { - start_time { - hours = 12 - } - duration = "3600s" - single_occurrence_date { - year = 2024 - month = 3 - day = 17 - } - } - exclusion_windows { - start_time { - hours = 8 - minutes = 40 - } - duration = "600s" - single_occurrence_date { - year = 2024 - month = 3 - day = 18 - } - } - } - } - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_all_cluster_resources.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_all_cluster_resources.tf.tmpl deleted file mode 100644 index 921cbdff2d2f..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_all_cluster_resources.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "all_cluster_resources" { - name = "{{index $.Vars "name"}}-rp" - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - no_namespaces = true - namespaced_resource_restore_mode = "FAIL_ON_CONFLICT" - cluster_resource_restore_scope { - all_group_kinds = true - } - cluster_resource_conflict_policy = "USE_EXISTING_VERSION" - } -} diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_all_namespaces.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_all_namespaces.tf.tmpl deleted file mode 100644 index 6ff5dc0c31ba..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_all_namespaces.tf.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "all_ns" { - name = "{{index $.Vars "name"}}" - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - all_namespaces = true - namespaced_resource_restore_mode = "FAIL_ON_CONFLICT" - volume_data_restore_policy = "RESTORE_VOLUME_DATA_FROM_BACKUP" - cluster_resource_restore_scope { - all_group_kinds = true - } - cluster_resource_conflict_policy = "USE_EXISTING_VERSION" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_gitops_mode.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_gitops_mode.tf.tmpl deleted file mode 100644 index f1463aab8d3f..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_gitops_mode.tf.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - all_namespaces = true - namespaced_resource_restore_mode = "MERGE_SKIP_ON_CONFLICT" - volume_data_restore_policy = "RESTORE_VOLUME_DATA_FROM_BACKUP" - cluster_resource_restore_scope { - all_group_kinds = true - } - cluster_resource_conflict_policy = "USE_EXISTING_VERSION" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_protected_application.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_protected_application.tf.tmpl deleted file mode 100644 index a3cabc4058aa..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_protected_application.tf.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "rollback_app" { - name = "{{index $.Vars "name"}}-rp" - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - selected_applications { - namespaced_names { - name = "my-app" - namespace = "my-ns" - } - } - namespaced_resource_restore_mode = "DELETE_AND_RESTORE" - volume_data_restore_policy = "REUSE_VOLUME_HANDLE_FROM_BACKUP" - cluster_resource_restore_scope { - no_group_kinds = true - } - } -} diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_rename_namespace.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_rename_namespace.tf.tmpl deleted file mode 100644 index 4f2a05bf1ef5..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_rename_namespace.tf.tmpl +++ /dev/null @@ -1,69 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "rename_ns" { - name = "{{index $.Vars "name"}}-rp" - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - selected_namespaces { - namespaces = ["ns1"] - } - namespaced_resource_restore_mode = "FAIL_ON_CONFLICT" - volume_data_restore_policy = "REUSE_VOLUME_HANDLE_FROM_BACKUP" - cluster_resource_restore_scope { - no_group_kinds = true - } - transformation_rules { - description = "rename namespace from ns1 to ns2" - resource_filter { - group_kinds { - resource_kind = "Namespace" - } - json_path = ".metadata[?(@.name == 'ns1')]" - } - field_actions { - op = "REPLACE" - path = "/metadata/name" - value = "ns2" - } - } - transformation_rules { - description = "move all resources from ns1 to ns2" - resource_filter { - namespaces = ["ns1"] - } - field_actions { - op = "REPLACE" - path = "/metadata/namespace" - value = "ns2" - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_restore_order.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_restore_order.tf.tmpl deleted file mode 100644 index 6436bbb05bc8..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_restore_order.tf.tmpl +++ /dev/null @@ -1,65 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - all_namespaces = true - namespaced_resource_restore_mode = "FAIL_ON_CONFLICT" - volume_data_restore_policy = "RESTORE_VOLUME_DATA_FROM_BACKUP" - cluster_resource_restore_scope { - all_group_kinds = true - } - cluster_resource_conflict_policy = "USE_EXISTING_VERSION" - restore_order { - group_kind_dependencies { - satisfying { - resource_group = "stable.example.com" - resource_kind = "kindA" - } - requiring { - resource_group = "stable.example.com" - resource_kind = "kindB" - } - } - group_kind_dependencies { - satisfying { - resource_group = "stable.example.com" - resource_kind = "kindB" - } - requiring { - resource_group = "stable.example.com" - resource_kind = "kindC" - } - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_rollback_namespace.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_rollback_namespace.tf.tmpl deleted file mode 100644 index bd719fdb9ddf..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_rollback_namespace.tf.tmpl +++ /dev/null @@ -1,52 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "rollback_ns" { - name = "{{index $.Vars "name"}}-rp" - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - selected_namespaces { - namespaces = ["my-ns"] - } - namespaced_resource_restore_mode = "DELETE_AND_RESTORE" - volume_data_restore_policy = "RESTORE_VOLUME_DATA_FROM_BACKUP" - cluster_resource_restore_scope { - selected_group_kinds { - resource_group = "apiextension.k8s.io" - resource_kind = "CustomResourceDefinition" - } - selected_group_kinds { - resource_group = "storage.k8s.io" - resource_kind = "StorageClass" - } - } - cluster_resource_conflict_policy = "USE_EXISTING_VERSION" - } -} diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_second_transformation.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_second_transformation.tf.tmpl deleted file mode 100644 index 864914cac07a..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_second_transformation.tf.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "transform_rule" { - name = "{{index $.Vars "name"}}-rp" - description = "copy nginx env variables" - labels = { - "app" = "nginx" - } - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - excluded_namespaces { - namespaces = ["my-ns"] - } - namespaced_resource_restore_mode = "DELETE_AND_RESTORE" - volume_data_restore_policy = "RESTORE_VOLUME_DATA_FROM_BACKUP" - cluster_resource_restore_scope { - excluded_group_kinds { - resource_group = "apiextension.k8s.io" - resource_kind = "CustomResourceDefinition" - } - } - cluster_resource_conflict_policy = "USE_EXISTING_VERSION" - transformation_rules { - description = "Copy environment variables from the nginx container to the install init container." - resource_filter { - group_kinds { - resource_kind = "Pod" - resource_group = "" - } - json_path = ".metadata[?(@.name == 'nginx')]" - } - field_actions { - op = "COPY" - path = "/spec/initContainers/0/env" - from_path = "/spec/containers/0/env" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_volume_res.tf.tmpl b/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_volume_res.tf.tmpl deleted file mode 100644 index 4e078503a0f9..000000000000 --- a/mmv1/templates/terraform/examples/go/gkebackup_restoreplan_volume_res.tf.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "name"}}-cluster" - location = "us-central1" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - addons_config { - gke_backup_agent_config { - enabled = true - } - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_backup_backup_plan" "basic" { - name = "{{index $.Vars "name"}}" - cluster = google_container_cluster.primary.id - location = "us-central1" - backup_config { - include_volume_data = true - include_secrets = true - all_namespaces = true - } -} - -resource "google_gke_backup_restore_plan" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-central1" - backup_plan = google_gke_backup_backup_plan.basic.id - cluster = google_container_cluster.primary.id - restore_config { - all_namespaces = true - namespaced_resource_restore_mode = "FAIL_ON_CONFLICT" - volume_data_restore_policy = "NO_VOLUME_DATA_RESTORATION" - cluster_resource_restore_scope { - all_group_kinds = true - } - cluster_resource_conflict_policy = "USE_EXISTING_VERSION" - volume_data_restore_policy_bindings { - policy = "RESTORE_VOLUME_DATA_FROM_BACKUP" - volume_type = "GCE_PERSISTENT_DISK" - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkehub_feature_anthos_service_mesh.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_feature_anthos_service_mesh.tf.tmpl deleted file mode 100644 index 7015a45b6604..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_feature_anthos_service_mesh.tf.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "servicemesh" - location = "global" -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_feature_clusterupgrade.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_feature_clusterupgrade.tf.tmpl deleted file mode 100644 index a10a76f90d1f..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_feature_clusterupgrade.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "clusterupgrade" - location = "global" - spec { - clusterupgrade { - upstream_fleets = [] - post_conditions { - soaking = "60s" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_feature_multi_cluster_ingress.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_feature_multi_cluster_ingress.tf.tmpl deleted file mode 100644 index 3a286936114d..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_feature_multi_cluster_ingress.tf.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -resource "google_container_cluster" "cluster" { - name = "my-cluster" - location = "us-central1-a" - initial_node_count = 1 -} - -resource "google_gke_hub_membership" "membership" { - membership_id = "my-membership" - endpoint { - gke_cluster { - resource_link = "//container.googleapis.com/${google_container_cluster.cluster.id}" - } - } - description = "Membership" -} - -resource "google_gke_hub_feature" "feature" { - name = "multiclusteringress" - location = "global" - spec { - multiclusteringress { - config_membership = google_gke_hub_membership.membership.id - } - } -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_feature_multi_cluster_service_discovery.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_feature_multi_cluster_service_discovery.tf.tmpl deleted file mode 100644 index 41da85587959..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_feature_multi_cluster_service_discovery.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_gke_hub_feature" "feature" { - name = "multiclusterservicediscovery" - location = "global" - labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_fleet_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_fleet_basic.tf.tmpl deleted file mode 100644 index b31d3770c71c..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_fleet_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_gke_hub_fleet" "default" { - display_name = "my production fleet" - default_cluster_config { - security_posture_config { - mode = "DISABLED" - vulnerability_mode = "VULNERABILITY_DISABLED" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_membership_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_membership_basic.tf.tmpl deleted file mode 100644 index edab3c1c8bd7..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_membership_basic.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1-a" - initial_node_count = 1 - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_hub_membership" "membership" { - membership_id = "{{index $.Vars "name"}}" - endpoint { - gke_cluster { - resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}" - } - } - - labels = { - env = "test" - } -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_membership_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_membership_binding_basic.tf.tmpl deleted file mode 100644 index 1cdf454bc9df..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_membership_binding_basic.tf.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1-a" - initial_node_count = 1 - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_hub_membership" "membership" { - membership_id = "tf-test-membership%{random_suffix}" - endpoint { - gke_cluster { - resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}" - } - } - - depends_on = [google_container_cluster.primary] -} - -resource "google_gke_hub_scope" "scope" { - scope_id = "tf-test-scope%{random_suffix}" -} - -resource "google_gke_hub_membership_binding" "{{$.PrimaryResourceId}}" { - membership_binding_id = "tf-test-membership-binding%{random_suffix}" - scope = google_gke_hub_scope.scope.name - membership_id = google_gke_hub_membership.membership.membership_id - location = "global" - labels = { - keyb = "valueb" - keya = "valuea" - keyc = "valuec" - } - depends_on = [ - google_gke_hub_membership.membership, - google_gke_hub_scope.scope - ] -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_membership_issuer.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_membership_issuer.tf.tmpl deleted file mode 100644 index a40d9caf0ebb..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_membership_issuer.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1-a" - initial_node_count = 1 - workload_identity_config { - workload_pool = "{{index $.TestEnvVars "project"}}.svc.id.goog" - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_hub_membership" "membership" { - membership_id = "{{index $.Vars "name"}}" - endpoint { - gke_cluster { - resource_link = google_container_cluster.primary.id - } - } - authority { - issuer = "https://container.googleapis.com/v1/${google_container_cluster.primary.id}" - } -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_membership_rbac_role_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_membership_rbac_role_binding_basic.tf.tmpl deleted file mode 100644 index 662d22955b30..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_membership_rbac_role_binding_basic.tf.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -resource "google_container_cluster" "primary" { - provider = google-beta - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1-a" - initial_node_count = 1 - deletion_protection = "{{index $.Vars "deletion_protection"}}" - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_hub_membership" "membership" { - provider = google-beta - membership_id = "tf-test-membership%{random_suffix}" - endpoint { - gke_cluster { - resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}" - } - } - - depends_on = [google_container_cluster.primary] -} - -resource "google_gke_hub_membership_rbac_role_binding" "{{$.PrimaryResourceId}}" { - provider = google-beta - membership_rbac_role_binding_id = "tf-test-membership-rbac-role-binding%{random_suffix}" - membership_id = google_gke_hub_membership.membership.membership_id - user = "service-${data.google_project.project.number}@gcp-sa-anthossupport.iam.gserviceaccount.com" - role { - predefined_role = "ANTHOS_SUPPORT" - } - location = "global" - depends_on = [google_gke_hub_membership.membership] -} - -data "google_project" "project" { - provider = google-beta -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_membership_regional.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_membership_regional.tf.tmpl deleted file mode 100644 index 39c25ae63584..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_membership_regional.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_container_cluster" "primary" { - name = "{{index $.Vars "cluster_name"}}" - location = "us-central1-a" - initial_node_count = 1 - deletion_protection = false - network = "{{index $.Vars "network_name"}}" - subnetwork = "{{index $.Vars "subnetwork_name"}}" -} - -resource "google_gke_hub_membership" "membership" { - membership_id = "{{index $.Vars "name"}}" - location = "{{index $.TestEnvVars "location"}}" - endpoint { - gke_cluster { - resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_namespace_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_namespace_basic.tf.tmpl deleted file mode 100644 index 862d70040cda..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_namespace_basic.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_gke_hub_scope" "scope" { - scope_id = "tf-test-scope%{random_suffix}" -} - - -resource "google_gke_hub_namespace" "{{$.PrimaryResourceId}}" { - scope_namespace_id = "tf-test-namespace%{random_suffix}" - scope_id = google_gke_hub_scope.scope.scope_id - scope = google_gke_hub_scope.scope.name - namespace_labels = { - keyb = "valueb" - keya = "valuea" - keyc = "valuec" - } - labels = { - keyb = "valueb" - keya = "valuea" - keyc = "valuec" - } - depends_on = [google_gke_hub_scope.scope] -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_scope_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_scope_basic.tf.tmpl deleted file mode 100644 index 77a9aca897f0..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_scope_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_gke_hub_scope" "{{$.PrimaryResourceId}}" { - scope_id = "{{index $.Vars "resource_name"}}" - namespace_labels = { - keyb = "valueb" - keya = "valuea" - keyc = "valuec" - } - labels = { - keyb = "valueb" - keya = "valuea" - keyc = "valuec" - } -} diff --git a/mmv1/templates/terraform/examples/go/gkehub_scope_rbac_role_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkehub_scope_rbac_role_binding_basic.tf.tmpl deleted file mode 100644 index 1600645443bd..000000000000 --- a/mmv1/templates/terraform/examples/go/gkehub_scope_rbac_role_binding_basic.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_gke_hub_scope" "scope" { - scope_id = "tf-test-scope%{random_suffix}" -} - -resource "google_gke_hub_scope_rbac_role_binding" "{{$.PrimaryResourceId}}" { - scope_rbac_role_binding_id = "tf-test-scope-rbac-role-binding%{random_suffix}" - scope_id = google_gke_hub_scope.scope.scope_id - user = "test-email@gmail.com" - role { - predefined_role = "ADMIN" - } - labels = { - key = "value" - } - depends_on = [google_gke_hub_scope.scope] -} - diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_admin_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_admin_cluster_basic.tf.tmpl deleted file mode 100644 index 6df8083f5051..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_admin_cluster_basic.tf.tmpl +++ /dev/null @@ -1,58 +0,0 @@ -resource "google_gkeonprem_bare_metal_admin_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - bare_metal_version = "1.13.4" - network_config { - island_mode_cidr { - service_address_cidr_blocks = ["172.26.0.0/16"] - pod_address_cidr_blocks = ["10.240.0.0/13"] - } - } - node_config { - max_pods_per_node = 250 - } - control_plane { - control_plane_node_pool_config { - node_pool_config { - labels = {} - operating_system = "LINUX" - node_configs { - labels = {} - node_ip = "10.200.0.2" - } - node_configs { - labels = {} - node_ip = "10.200.0.3" - } - node_configs { - labels = {} - node_ip = "10.200.0.4" - } - } - } - } - load_balancer { - port_config { - control_plane_load_balancer_port = 443 - } - vip_config { - control_plane_vip = "10.200.0.5" - } - } - storage { - lvp_share_config { - lvp_config { - path = "/mnt/localpv-share" - storage_class = "local-shared" - } - shared_path_pv_count = 5 - } - lvp_node_mounts_config { - path = "/mnt/localpv-disk" - storage_class = "local-disks" - } - } - node_access_config { - login_user = "root" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_admin_cluster_full.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_admin_cluster_full.tf.tmpl deleted file mode 100644 index e0c257f09e90..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_admin_cluster_full.tf.tmpl +++ /dev/null @@ -1,91 +0,0 @@ -resource "google_gkeonprem_bare_metal_admin_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - description = "test description" - bare_metal_version = "1.13.4" - annotations = { - env = "test" - } - network_config { - island_mode_cidr { - service_address_cidr_blocks = ["172.26.0.0/16"] - pod_address_cidr_blocks = ["10.240.0.0/13"] - } - } - node_config { - max_pods_per_node = 250 - } - control_plane { - control_plane_node_pool_config { - node_pool_config { - labels = {} - operating_system = "LINUX" - node_configs { - labels = {} - node_ip = "10.200.0.2" - } - node_configs { - labels = {} - node_ip = "10.200.0.3" - } - node_configs { - labels = {} - node_ip = "10.200.0.4" - } - taints { - key = "test-key" - value = "test-value" - effect = "NO_EXECUTE" - } - } - } - api_server_args { - argument = "test argument" - value = "test value" - } - } - load_balancer { - port_config { - control_plane_load_balancer_port = 443 - } - vip_config { - control_plane_vip = "10.200.0.5" - } - manual_lb_config { - enabled = true - } - } - storage { - lvp_share_config { - lvp_config { - path = "/mnt/localpv-share" - storage_class = "local-shared" - } - shared_path_pv_count = 5 - } - lvp_node_mounts_config { - path = "/mnt/localpv-disk" - storage_class = "local-disks" - } - } - node_access_config { - login_user = "root" - } - security_config { - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - } - maintenance_config { - maintenance_address_cidr_blocks = ["10.0.0.1/32", "10.0.0.2/32"] - } - cluster_operations { - enable_application_logs = true - } - proxy { - uri = "test proxy uri" - no_proxy = ["127.0.0.1"] - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_basic.tf.tmpl deleted file mode 100644 index 9e0faa604018..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_basic.tf.tmpl +++ /dev/null @@ -1,71 +0,0 @@ -resource "google_gkeonprem_bare_metal_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - bare_metal_version = "1.12.3" - network_config { - island_mode_cidr { - service_address_cidr_blocks = ["172.26.0.0/16"] - pod_address_cidr_blocks = ["10.240.0.0/13"] - } - } - control_plane { - control_plane_node_pool_config { - node_pool_config { - labels = {} - operating_system = "LINUX" - node_configs { - labels = {} - node_ip = "10.200.0.9" - } - } - } - } - load_balancer { - port_config { - control_plane_load_balancer_port = 443 - } - vip_config { - control_plane_vip = "10.200.0.13" - ingress_vip = "10.200.0.14" - } - metal_lb_config { - address_pools { - pool = "pool1" - addresses = [ - "10.200.0.14/32", - "10.200.0.15/32", - "10.200.0.16/32", - "10.200.0.17/32", - "10.200.0.18/32", - "fd00:1::f/128", - "fd00:1::10/128", - "fd00:1::11/128", - "fd00:1::12/128" - ] - avoid_buggy_ips = true - manual_assign = true - } - } - } - storage { - lvp_share_config { - lvp_config { - path = "/mnt/localpv-share" - storage_class = "local-shared" - } - shared_path_pv_count = 5 - } - lvp_node_mounts_config { - path = "/mnt/localpv-disk" - storage_class = "local-disks" - } - } - security_config { - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_bgplb.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_bgplb.tf.tmpl deleted file mode 100644 index 96e8c121c51e..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_bgplb.tf.tmpl +++ /dev/null @@ -1,131 +0,0 @@ -resource "google_gkeonprem_bare_metal_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - bare_metal_version = "1.12.3" - network_config { - island_mode_cidr { - service_address_cidr_blocks = ["172.26.0.0/16"] - pod_address_cidr_blocks = ["10.240.0.0/13"] - } - advanced_networking = true - multiple_network_interfaces_config { - enabled = true - } - sr_iov_config { - enabled = true - } - } - control_plane { - control_plane_node_pool_config { - node_pool_config { - labels = {} - operating_system = "LINUX" - node_configs { - labels = {} - node_ip = "10.200.0.9" - } - taints { - key = "test-key" - value = "test-value" - effect = "NO_EXECUTE" - } - } - } - api_server_args { - argument = "test-argument" - value = "test-value" - } - } - load_balancer { - port_config { - control_plane_load_balancer_port = 443 - } - vip_config { - control_plane_vip = "10.200.0.13" - ingress_vip = "10.200.0.14" - } - bgp_lb_config { - asn = 123456 - bgp_peer_configs { - asn = 123457 - ip_address = "10.0.0.1" - control_plane_nodes = ["test-node"] - } - address_pools { - pool = "pool1" - addresses = [ - "10.200.0.14/32", - "10.200.0.15/32", - "10.200.0.16/32", - "10.200.0.17/32", - "10.200.0.18/32", - "fd00:1::f/128", - "fd00:1::10/128", - "fd00:1::11/128", - "fd00:1::12/128" - ] - } - load_balancer_node_pool_config { - node_pool_config { - labels = {} - operating_system = "LINUX" - node_configs { - labels = {} - node_ip = "10.200.0.9" - } - taints { - key = "test-key" - value = "test-value" - effect = "NO_EXECUTE" - } - kubelet_config { - registry_pull_qps = 10 - registry_burst = 12 - serialize_image_pulls_disabled = true - } - } - } - } - } - storage { - lvp_share_config { - lvp_config { - path = "/mnt/localpv-share" - storage_class = "local-shared" - } - shared_path_pv_count = 5 - } - lvp_node_mounts_config { - path = "/mnt/localpv-disk" - storage_class = "local-disks" - } - } - security_config { - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - } - proxy { - uri = "http://test-domain/test" - no_proxy = ["127.0.0.1"] - } - cluster_operations { - enable_application_logs = true - } - maintenance_config { - maintenance_address_cidr_blocks = ["192.168.0.1/20"] - } - node_config { - max_pods_per_node = 10 - container_runtime = "CONTAINERD" - } - node_access_config { - login_user = "test@example.com" - } - os_environment_config { - package_repo_excluded = true - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_manuallb.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_manuallb.tf.tmpl deleted file mode 100644 index 090f6737db33..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_cluster_manuallb.tf.tmpl +++ /dev/null @@ -1,62 +0,0 @@ -resource "google_gkeonprem_bare_metal_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - bare_metal_version = "1.12.3" - network_config { - island_mode_cidr { - service_address_cidr_blocks = ["172.26.0.0/16"] - pod_address_cidr_blocks = ["10.240.0.0/13"] - } - } - control_plane { - control_plane_node_pool_config { - node_pool_config { - labels = {} - operating_system = "LINUX" - node_configs { - labels = {} - node_ip = "10.200.0.9" - } - } - } - } - load_balancer { - port_config { - control_plane_load_balancer_port = 443 - } - vip_config { - control_plane_vip = "10.200.0.13" - ingress_vip = "10.200.0.14" - } - manual_lb_config { - enabled = true - } - } - storage { - lvp_share_config { - lvp_config { - path = "/mnt/localpv-share" - storage_class = "local-shared" - } - shared_path_pv_count = 5 - } - lvp_node_mounts_config { - path = "/mnt/localpv-disk" - storage_class = "local-disks" - } - } - security_config { - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - } - binary_authorization { - evaluation_mode = "DISABLED" - } - upgrade_policy { - policy = "SERIAL" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_node_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_node_pool_basic.tf.tmpl deleted file mode 100644 index b0b07f457ef7..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_node_pool_basic.tf.tmpl +++ /dev/null @@ -1,81 +0,0 @@ -resource "google_gkeonprem_bare_metal_cluster" "default-basic" { - name = "{{index $.Vars "cluster"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - bare_metal_version = "1.12.3" - network_config { - island_mode_cidr { - service_address_cidr_blocks = ["172.26.0.0/16"] - pod_address_cidr_blocks = ["10.240.0.0/13"] - } - } - control_plane { - control_plane_node_pool_config { - node_pool_config { - labels = {} - operating_system = "LINUX" - node_configs { - labels = {} - node_ip = "10.200.0.9" - } - } - } - } - load_balancer { - port_config { - control_plane_load_balancer_port = 443 - } - vip_config { - control_plane_vip = "10.200.0.13" - ingress_vip = "10.200.0.14" - } - metal_lb_config { - address_pools { - pool = "pool1" - addresses = [ - "10.200.0.14/32", - "10.200.0.15/32", - "10.200.0.16/32", - "10.200.0.17/32", - "10.200.0.18/32", - "fd00:1::f/128", - "fd00:1::10/128", - "fd00:1::11/128", - "fd00:1::12/128" - ] - } - } - } - storage { - lvp_share_config { - lvp_config { - path = "/mnt/localpv-share" - storage_class = "local-shared" - } - shared_path_pv_count = 5 - } - lvp_node_mounts_config { - path = "/mnt/localpv-disk" - storage_class = "local-disks" - } - } - security_config { - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - } -} - -resource "google_gkeonprem_bare_metal_node_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - bare_metal_cluster = google_gkeonprem_bare_metal_cluster.default-basic.name - location = "us-west1" - node_pool_config { - operating_system = "LINUX" - node_configs { - node_ip = "10.200.0.11" - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_node_pool_full.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_node_pool_full.tf.tmpl deleted file mode 100644 index 802b2b120e49..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_bare_metal_node_pool_full.tf.tmpl +++ /dev/null @@ -1,90 +0,0 @@ -resource "google_gkeonprem_bare_metal_cluster" "default-full" { - name = "{{index $.Vars "cluster"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - bare_metal_version = "1.12.3" - network_config { - island_mode_cidr { - service_address_cidr_blocks = ["172.26.0.0/16"] - pod_address_cidr_blocks = ["10.240.0.0/13"] - } - } - control_plane { - control_plane_node_pool_config { - node_pool_config { - labels = {} - operating_system = "LINUX" - node_configs { - labels = {} - node_ip = "10.200.0.9" - } - } - } - } - load_balancer { - port_config { - control_plane_load_balancer_port = 443 - } - vip_config { - control_plane_vip = "10.200.0.13" - ingress_vip = "10.200.0.14" - } - metal_lb_config { - address_pools { - pool = "pool1" - addresses = [ - "10.200.0.14/32", - "10.200.0.15/32", - "10.200.0.16/32", - "10.200.0.17/32", - "10.200.0.18/32", - "fd00:1::f/128", - "fd00:1::10/128", - "fd00:1::11/128", - "fd00:1::12/128" - ] - } - } - } - storage { - lvp_share_config { - lvp_config { - path = "/mnt/localpv-share" - storage_class = "local-shared" - } - shared_path_pv_count = 5 - } - lvp_node_mounts_config { - path = "/mnt/localpv-disk" - storage_class = "local-disks" - } - } - security_config { - authorization { - admin_users { - username = "admin@hashicorptest.com" - } - } - } -} - -resource "google_gkeonprem_bare_metal_node_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - display_name = "test-name" - bare_metal_cluster = google_gkeonprem_bare_metal_cluster.default-full.name - location = "us-west1" - annotations = {} - node_pool_config { - operating_system = "LINUX" - labels = {} - node_configs { - node_ip = "10.200.0.11" - labels = {} - } - taints { - key = "test-key" - value = "test-value" - effect = "NO_EXECUTE" - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_basic.tf.tmpl deleted file mode 100644 index e68d8e4e3fa9..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_basic.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -resource "google_gkeonprem_vmware_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - description = "test cluster" - on_prem_version = "1.13.1-gke.35" - annotations = {} - network_config { - service_address_cidr_blocks = ["10.96.0.0/12"] - pod_address_cidr_blocks = ["192.168.0.0/16"] - dhcp_ip_config { - enabled = true - } - } - control_plane_node { - cpus = 4 - memory = 8192 - replicas = 1 - } - load_balancer { - vip_config { - control_plane_vip = "10.251.133.5" - ingress_vip = "10.251.135.19" - } - metal_lb_config { - address_pools { - pool = "ingress-ip" - manual_assign = "true" - addresses = ["10.251.135.19"] - avoid_buggy_ips = true - } - address_pools { - pool = "lb-test-ip" - manual_assign = "true" - addresses = ["10.251.135.19"] - avoid_buggy_ips = true - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_f5lb.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_f5lb.tf.tmpl deleted file mode 100644 index 5a69beefc698..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_f5lb.tf.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -resource "google_gkeonprem_vmware_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - description = "test cluster" - on_prem_version = "1.13.1-gke.35" - annotations = {} - network_config { - service_address_cidr_blocks = ["10.96.0.0/12"] - pod_address_cidr_blocks = ["192.168.0.0/16"] - dhcp_ip_config { - enabled = true - } - control_plane_v2_config { - control_plane_ip_block { - ips { - hostname = "test-hostname" - ip = "10.0.0.1" - } - netmask="10.0.0.1/32" - gateway="test-gateway" - } - } - vcenter_network = "test-vcenter-network" - } - control_plane_node { - cpus = 4 - memory = 8192 - replicas = 1 - auto_resize_config { - enabled = true - } - } - load_balancer { - vip_config { - control_plane_vip = "10.251.133.5" - ingress_vip = "10.251.135.19" - } - f5_config { - address = "10.0.0.1" - partition = "test-partition" - snat_pool = "test-snap-pool" - } - } - dataplane_v2 { - dataplane_v2_enabled = true - windows_dataplane_v2_enabled = true - advanced_networking = true - } - vm_tracking_enabled = true - enable_control_plane_v2 = true - disable_bundled_ingress = true - authorization { - admin_users { - username = "testuser@gmail.com" - } - } - anti_affinity_groups { - aag_config_disabled = true - } - auto_repair_config { - enabled = true - } - storage { - vsphere_csi_disabled = true - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_manuallb.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_manuallb.tf.tmpl deleted file mode 100644 index 13397c5d9f28..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_cluster_manuallb.tf.tmpl +++ /dev/null @@ -1,90 +0,0 @@ -resource "google_gkeonprem_vmware_cluster" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - description = "test cluster" - on_prem_version = "1.13.1-gke.35" - annotations = {} - network_config { - service_address_cidr_blocks = ["10.96.0.0/12"] - pod_address_cidr_blocks = ["192.168.0.0/16"] - host_config { - dns_servers = ["10.254.41.1"] - ntp_servers = ["216.239.35.8"] - dns_search_domains = ["test-domain"] - } - - static_ip_config { - ip_blocks { - netmask = "255.255.252.0" - gateway = "10.251.31.254" - ips { - ip = "10.251.30.153" - hostname = "test-hostname1" - } - ips { - ip = "10.251.31.206" - hostname = "test-hostname2" - } - ips { - ip = "10.251.31.193" - hostname = "test-hostname3" - } - ips { - ip = "10.251.30.230" - hostname = "test-hostname4" - } - } - } - } - control_plane_node { - cpus = 4 - memory = 8192 - replicas = 1 - auto_resize_config { - enabled = true - } - } - load_balancer { - vip_config { - control_plane_vip = "10.251.133.5" - ingress_vip = "10.251.135.19" - } - manual_lb_config { - ingress_http_node_port = 30005 - ingress_https_node_port = 30006 - control_plane_node_port = 30007 - konnectivity_server_node_port = 30008 - } - } - vcenter { - resource_pool = "test-resource-pool" - datastore = "test-datastore" - datacenter = "test-datacenter" - cluster = "test-cluster" - folder = "test-folder" - ca_cert_data = "test-ca-cert-data" - storage_policy_name = "test-storage-policy-name" - } - dataplane_v2 { - dataplane_v2_enabled = true - windows_dataplane_v2_enabled = true - advanced_networking = true - } - vm_tracking_enabled = true - enable_control_plane_v2 = true - upgrade_policy { - control_plane_only = true - } - authorization { - admin_users { - username = "testuser@gmail.com" - } - } - anti_affinity_groups { - aag_config_disabled = true - } - auto_repair_config { - enabled = true - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_node_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_vmware_node_pool_basic.tf.tmpl deleted file mode 100644 index 38f7bef0525d..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_node_pool_basic.tf.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -resource "google_gkeonprem_vmware_cluster" "default-basic" { - name = "{{index $.Vars "cluster"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - description = "test cluster" - on_prem_version = "1.13.1-gke.35" - network_config { - service_address_cidr_blocks = ["10.96.0.0/12"] - pod_address_cidr_blocks = ["192.168.0.0/16"] - dhcp_ip_config { - enabled = true - } - } - control_plane_node { - cpus = 4 - memory = 8192 - replicas = 1 - } - load_balancer { - vip_config { - control_plane_vip = "10.251.133.5" - ingress_vip = "10.251.135.19" - } - metal_lb_config { - address_pools { - pool = "ingress-ip" - manual_assign = "true" - addresses = ["10.251.135.19"] - } - address_pools { - pool = "lb-test-ip" - manual_assign = "true" - addresses = ["10.251.135.19"] - } - } - } -} - -resource "google_gkeonprem_vmware_node_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - vmware_cluster = google_gkeonprem_vmware_cluster.default-basic.name - config { - replicas = 3 - image_type = "ubuntu_containerd" - enable_load_balancer = true - } -} diff --git a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_node_pool_full.tf.tmpl b/mmv1/templates/terraform/examples/go/gkeonprem_vmware_node_pool_full.tf.tmpl deleted file mode 100644 index fb466f05bc7a..000000000000 --- a/mmv1/templates/terraform/examples/go/gkeonprem_vmware_node_pool_full.tf.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -resource "google_gkeonprem_vmware_cluster" "default-full" { - name = "{{index $.Vars "cluster"}}" - location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" - description = "test cluster" - on_prem_version = "1.13.1-gke.35" - network_config { - service_address_cidr_blocks = ["10.96.0.0/12"] - pod_address_cidr_blocks = ["192.168.0.0/16"] - dhcp_ip_config { - enabled = true - } - } - control_plane_node { - cpus = 4 - memory = 8192 - replicas = 1 - } - load_balancer { - vip_config { - control_plane_vip = "10.251.133.5" - ingress_vip = "10.251.135.19" - } - metal_lb_config { - address_pools { - pool = "ingress-ip" - manual_assign = "true" - addresses = ["10.251.135.19"] - } - address_pools { - pool = "lb-test-ip" - manual_assign = "true" - addresses = ["10.251.135.19"] - } - } - } -} - -resource "google_gkeonprem_vmware_node_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-west1" - vmware_cluster = google_gkeonprem_vmware_cluster.default-full.name - annotations = {} - config { - cpus = 4 - memory_mb = 8196 - replicas = 3 - image_type = "ubuntu_containerd" - image = "image" - boot_disk_size_gb = 10 - taints { - key = "key" - value = "value" - } - taints { - key = "key" - value = "value" - effect = "NO_SCHEDULE" - } - labels = {} - vsphere_config { - datastore = "test-datastore" - tags { - category = "test-category-1" - tag = "tag-1" - } - tags { - category = "test-category-2" - tag = "tag-2" - } - host_groups = ["host1", "host2"] - } - enable_load_balancer = true - } - node_pool_autoscaling { - min_replicas = 1 - max_replicas = 5 - } -} diff --git a/mmv1/templates/terraform/examples/go/global_address_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/global_address_basic.tf.tmpl deleted file mode 100644 index 66c3f2a1198a..000000000000 --- a/mmv1/templates/terraform/examples/go/global_address_basic.tf.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -resource "google_compute_global_address" "default" { - name = "{{index $.Vars "global_address_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/global_address_private_services_connect.tf.tmpl b/mmv1/templates/terraform/examples/go/global_address_private_services_connect.tf.tmpl deleted file mode 100644 index 77930767c235..000000000000 --- a/mmv1/templates/terraform/examples/go/global_address_private_services_connect.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_compute_global_address" "default" { - provider = google-beta - name = "{{index $.Vars "global_address_name"}}" - address_type = "INTERNAL" - purpose = "PRIVATE_SERVICE_CONNECT" - network = google_compute_network.network.id - address = "100.100.100.105" -} - -resource "google_compute_network" "network" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/global_forwarding_rule_external_managed.tf.tmpl b/mmv1/templates/terraform/examples/go/global_forwarding_rule_external_managed.tf.tmpl deleted file mode 100644 index 7f9263b0b0f7..000000000000 --- a/mmv1/templates/terraform/examples/go/global_forwarding_rule_external_managed.tf.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -resource "google_compute_global_forwarding_rule" "default" { - name = "{{index $.Vars "forwarding_rule_name"}}" - target = google_compute_target_http_proxy.default.id - port_range = "80" - load_balancing_scheme = "EXTERNAL_MANAGED" -} - -resource "google_compute_target_http_proxy" "default" { - name = "{{index $.Vars "http_proxy_name"}}" - description = "a description" - url_map = google_compute_url_map.default.id -} - -resource "google_compute_url_map" "default" { - name = "url-map-{{index $.Vars "http_proxy_name"}}" - description = "a description" - default_service = google_compute_backend_service.default.id - - host_rule { - hosts = ["mysite.com"] - path_matcher = "allpaths" - } - - path_matcher { - name = "allpaths" - default_service = google_compute_backend_service.default.id - - path_rule { - paths = ["/*"] - service = google_compute_backend_service.default.id - } - } -} - -resource "google_compute_backend_service" "default" { - name = "{{index $.Vars "backend_service_name"}}" - port_name = "http" - protocol = "HTTP" - timeout_sec = 10 - load_balancing_scheme = "EXTERNAL_MANAGED" -} diff --git a/mmv1/templates/terraform/examples/go/global_forwarding_rule_http.tf.tmpl b/mmv1/templates/terraform/examples/go/global_forwarding_rule_http.tf.tmpl deleted file mode 100644 index 560777cbd768..000000000000 --- a/mmv1/templates/terraform/examples/go/global_forwarding_rule_http.tf.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -resource "google_compute_global_forwarding_rule" "default" { - name = "{{index $.Vars "forwarding_rule_name"}}" - target = google_compute_target_http_proxy.default.id - port_range = "80" -} - -resource "google_compute_target_http_proxy" "default" { - name = "{{index $.Vars "http_proxy_name"}}" - description = "a description" - url_map = google_compute_url_map.default.id -} - -resource "google_compute_url_map" "default" { - name = "url-map-{{index $.Vars "http_proxy_name"}}" - description = "a description" - default_service = google_compute_backend_service.default.id - - host_rule { - hosts = ["mysite.com"] - path_matcher = "allpaths" - } - - path_matcher { - name = "allpaths" - default_service = google_compute_backend_service.default.id - - path_rule { - paths = ["/*"] - service = google_compute_backend_service.default.id - } - } -} - -resource "google_compute_backend_service" "default" { - name = "{{index $.Vars "backend_service_name"}}" - port_name = "http" - protocol = "HTTP" - timeout_sec = 10 - - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - name = "check-{{index $.Vars "backend_service_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} diff --git a/mmv1/templates/terraform/examples/go/global_forwarding_rule_hybrid.tf.tmpl b/mmv1/templates/terraform/examples/go/global_forwarding_rule_hybrid.tf.tmpl deleted file mode 100644 index bb529c4d4da1..000000000000 --- a/mmv1/templates/terraform/examples/go/global_forwarding_rule_hybrid.tf.tmpl +++ /dev/null @@ -1,130 +0,0 @@ -// Roughly mirrors https://cloud.google.com/load-balancing/docs/https/setting-up-ext-https-hybrid -variable "subnetwork_cidr" { - default = "10.0.0.0/24" -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_network" "internal" { - name = "{{index $.Vars "internal_network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "internal"{ - name = "{{index $.Vars "subnetwork_name"}}" - network = google_compute_network.internal.id - ip_cidr_range = var.subnetwork_cidr - region = "us-central1" - private_ip_google_access= true -} - -// Zonal NEG with GCE_VM_IP_PORT -resource "google_compute_network_endpoint_group" "default" { - name = "{{index $.Vars "default_neg_name"}}" - network = google_compute_network.default.id - default_port = "90" - zone = "us-central1-a" - network_endpoint_type = "GCE_VM_IP_PORT" -} - -// Zonal NEG with GCE_VM_IP -resource "google_compute_network_endpoint_group" "internal" { - name = "{{index $.Vars "internal_neg_name"}}" - network = google_compute_network.internal.id - subnetwork = google_compute_subnetwork.internal.id - zone = "us-central1-a" - network_endpoint_type = "GCE_VM_IP" -} - -// Hybrid connectivity NEG -resource "google_compute_network_endpoint_group" "hybrid" { - name = "{{index $.Vars "hybrid_neg_name"}}" - network = google_compute_network.default.id - default_port = "90" - zone = "us-central1-a" - network_endpoint_type = "NON_GCP_PRIVATE_IP_PORT" -} - -resource "google_compute_network_endpoint" "hybrid-endpoint" { - network_endpoint_group = google_compute_network_endpoint_group.hybrid.name - port = google_compute_network_endpoint_group.hybrid.default_port - ip_address = "127.0.0.1" -} - -// Backend service for Zonal NEG -resource "google_compute_backend_service" "default" { - name = "{{index $.Vars "default_backend_service_name"}}" - port_name = "http" - protocol = "HTTP" - timeout_sec = 10 - backend { - group = google_compute_network_endpoint_group.default.id - balancing_mode = "RATE" - max_rate_per_endpoint = 10 - } - health_checks = [google_compute_health_check.default.id] -} - -// Backgend service for Hybrid NEG -resource "google_compute_backend_service" "hybrid" { - name = "{{index $.Vars "hybrid_backend_service_name"}}" - port_name = "http" - protocol = "HTTP" - timeout_sec = 10 - backend { - group = google_compute_network_endpoint_group.hybrid.id - balancing_mode = "RATE" - max_rate_per_endpoint = 10 - } - health_checks = [google_compute_health_check.default.id] -} - -resource "google_compute_health_check" "default" { - name = "{{index $.Vars "health_check_name"}}" - timeout_sec = 1 - check_interval_sec = 1 - - tcp_health_check { - port = "80" - } -} - -resource "google_compute_url_map" "default" { - name = "url-map-{{index $.Vars "http_proxy_name"}}" - description = "a description" - default_service = google_compute_backend_service.default.id - - host_rule { - hosts = ["mysite.com"] - path_matcher = "allpaths" - } - - path_matcher { - name = "allpaths" - default_service = google_compute_backend_service.default.id - - path_rule { - paths = ["/*"] - service = google_compute_backend_service.default.id - } - - path_rule { - paths = ["/hybrid"] - service = google_compute_backend_service.hybrid.id - } - } -} - -resource "google_compute_target_http_proxy" "default" { - name = "{{index $.Vars "http_proxy_name"}}" - description = "a description" - url_map = google_compute_url_map.default.id -} - -resource "google_compute_global_forwarding_rule" "default" { - name = "{{index $.Vars "forwarding_rule_name"}}" - target = google_compute_target_http_proxy.default.id - port_range = "80" -} diff --git a/mmv1/templates/terraform/examples/go/global_forwarding_rule_internal.tf.tmpl b/mmv1/templates/terraform/examples/go/global_forwarding_rule_internal.tf.tmpl deleted file mode 100644 index d8a43c7cbbf4..000000000000 --- a/mmv1/templates/terraform/examples/go/global_forwarding_rule_internal.tf.tmpl +++ /dev/null @@ -1,108 +0,0 @@ -resource "google_compute_global_forwarding_rule" "default" { - provider = google-beta - name = "{{index $.Vars "forwarding_rule_name"}}" - target = google_compute_target_http_proxy.default.id - port_range = "80" - load_balancing_scheme = "INTERNAL_SELF_MANAGED" - ip_address = "0.0.0.0" - metadata_filters { - filter_match_criteria = "MATCH_ANY" - filter_labels { - name = "PLANET" - value = "MARS" - } - } -} - -resource "google_compute_target_http_proxy" "default" { - provider = google-beta - name = "{{index $.Vars "http_proxy_name"}}" - description = "a description" - url_map = google_compute_url_map.default.id -} - -resource "google_compute_url_map" "default" { - provider = google-beta - name = "url-map-{{index $.Vars "http_proxy_name"}}" - description = "a description" - default_service = google_compute_backend_service.default.id - - host_rule { - hosts = ["mysite.com"] - path_matcher = "allpaths" - } - - path_matcher { - name = "allpaths" - default_service = google_compute_backend_service.default.id - - path_rule { - paths = ["/*"] - service = google_compute_backend_service.default.id - } - } -} - -resource "google_compute_backend_service" "default" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - port_name = "http" - protocol = "HTTP" - timeout_sec = 10 - load_balancing_scheme = "INTERNAL_SELF_MANAGED" - - backend { - group = google_compute_instance_group_manager.igm.instance_group - balancing_mode = "RATE" - capacity_scaler = 0.4 - max_rate_per_instance = 50 - } - - health_checks = [google_compute_health_check.default.id] -} - -data "google_compute_image" "debian_image" { - provider = google-beta - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_instance_group_manager" "igm" { - provider = google-beta - name = "{{index $.Vars "igm_name"}}" - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } - base_instance_name = "internal-glb" - zone = "us-central1-f" - target_size = 1 -} - -resource "google_compute_instance_template" "instance_template" { - provider = google-beta - name = "template-{{index $.Vars "backend_service_name"}}" - machine_type = "e2-medium" - - network_interface { - network = "default" - } - - disk { - source_image = data.google_compute_image.debian_image.self_link - auto_delete = true - boot = true - } -} - -resource "google_compute_health_check" "default" { - provider = google-beta - name = "check-{{index $.Vars "backend_service_name"}}" - check_interval_sec = 1 - timeout_sec = 1 - - tcp_health_check { - port = "80" - } -} - diff --git a/mmv1/templates/terraform/examples/go/global_internal_http_lb_with_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/go/global_internal_http_lb_with_mig_backend.tf.tmpl deleted file mode 100644 index b0f91a10dcc5..000000000000 --- a/mmv1/templates/terraform/examples/go/global_internal_http_lb_with_mig_backend.tf.tmpl +++ /dev/null @@ -1,183 +0,0 @@ -# Global Internal HTTP load balancer with a managed instance group backend - -# VPC network -resource "google_compute_network" "gilb_network" { - name = "{{index $.Vars "gilb_network_name"}}" - provider = google-beta - auto_create_subnetworks = false -} - -# proxy-only subnet -resource "google_compute_subnetwork" "proxy_subnet" { - name = "{{index $.Vars "proxy_subnet_name"}}" - provider = google-beta - ip_cidr_range = "10.0.0.0/24" - region = "europe-west1" - purpose = "GLOBAL_MANAGED_PROXY" - role = "ACTIVE" - network = google_compute_network.gilb_network.id -} - -# backend subnet -resource "google_compute_subnetwork" "gilb_subnet" { - name = "{{index $.Vars "backend_subnet_name"}}" - provider = google-beta - ip_cidr_range = "10.0.1.0/24" - region = "europe-west1" - network = google_compute_network.gilb_network.id -} - -# forwarding rule -resource "google_compute_global_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - provider = google-beta - depends_on = [google_compute_subnetwork.proxy_subnet] - ip_protocol = "TCP" - load_balancing_scheme = "INTERNAL_MANAGED" - port_range = "80" - target = google_compute_target_http_proxy.default.id - network = google_compute_network.gilb_network.id - subnetwork = google_compute_subnetwork.gilb_subnet.id -} - -# HTTP target proxy -resource "google_compute_target_http_proxy" "default" { - name = "{{index $.Vars "target_http_proxy_name"}}" - provider = google-beta - url_map = google_compute_url_map.default.id -} - -# URL map -resource "google_compute_url_map" "default" { - name = "{{index $.Vars "url_map_name"}}" - provider = google-beta - default_service = google_compute_backend_service.default.id -} - -# backend service -resource "google_compute_backend_service" "default" { - name = "{{index $.Vars "backend_service_name"}}" - provider = google-beta - protocol = "HTTP" - load_balancing_scheme = "INTERNAL_MANAGED" - timeout_sec = 10 - health_checks = [google_compute_health_check.default.id] - backend { - group = google_compute_instance_group_manager.mig.instance_group - balancing_mode = "UTILIZATION" - capacity_scaler = 1.0 - } -} - -# instance template -resource "google_compute_instance_template" "instance_template" { - name = "{{index $.Vars "mig_template_name"}}" - provider = google-beta - machine_type = "e2-small" - tags = ["http-server"] - - network_interface { - network = google_compute_network.gilb_network.id - subnetwork = google_compute_subnetwork.gilb_subnet.id - access_config { - # add external ip to fetch packages - } - } - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y nginx-light jq - - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - - cat < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -# health check -resource "google_compute_health_check" "default" { - name = "{{index $.Vars "hc_name"}}" - provider = google-beta - http_health_check { - port_specification = "USE_SERVING_PORT" - } -} - -# MIG -resource "google_compute_instance_group_manager" "mig" { - name = "{{index $.Vars "mig_name"}}" - provider = google-beta - zone = "europe-west1-b" - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} - -# allow all access from IAP and health check ranges -resource "google_compute_firewall" "fw-iap" { - name = "{{index $.Vars "fw_allow_iap_hc_name"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.gilb_network.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] - allow { - protocol = "tcp" - } -} - -# allow http from proxy subnet to backends -resource "google_compute_firewall" "fw-gilb-to-backends" { - name = "{{index $.Vars "fw_allow_gilb_to_backends_name"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.gilb_network.id - source_ranges = ["10.0.0.0/24"] - target_tags = ["http-server"] - allow { - protocol = "tcp" - ports = ["80", "443", "8080"] - } -} - -# test instance -resource "google_compute_instance" "vm-test" { - name = "{{index $.Vars "vm_test_name"}}" - provider = google-beta - zone = "europe-west1-b" - machine_type = "e2-small" - network_interface { - network = google_compute_network.gilb_network.id - subnetwork = google_compute_subnetwork.gilb_subnet.id - } - boot_disk { - initialize_params { - image = "debian-cloud/debian-12" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/global_network_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/go/global_network_endpoint.tf.tmpl deleted file mode 100644 index 053eb23c3a8a..000000000000 --- a/mmv1/templates/terraform/examples/go/global_network_endpoint.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_compute_global_network_endpoint" "{{$.PrimaryResourceId}}" { - global_network_endpoint_group = google_compute_global_network_endpoint_group.neg.name - fqdn = "www.example.com" - port = 90 -} - -resource "google_compute_global_network_endpoint_group" "neg" { - name = "{{index $.Vars "neg_name"}}" - default_port = "90" - network_endpoint_type = "INTERNET_FQDN_PORT" -} diff --git a/mmv1/templates/terraform/examples/go/global_network_endpoint_group.tf.tmpl b/mmv1/templates/terraform/examples/go/global_network_endpoint_group.tf.tmpl deleted file mode 100644 index 91bf8100f523..000000000000 --- a/mmv1/templates/terraform/examples/go/global_network_endpoint_group.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_compute_global_network_endpoint_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "neg_name"}}" - default_port = "90" - network_endpoint_type = "INTERNET_FQDN_PORT" -} diff --git a/mmv1/templates/terraform/examples/go/global_network_endpoint_group_ip_address.tf.tmpl b/mmv1/templates/terraform/examples/go/global_network_endpoint_group_ip_address.tf.tmpl deleted file mode 100644 index 7e8d5620f621..000000000000 --- a/mmv1/templates/terraform/examples/go/global_network_endpoint_group_ip_address.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_compute_global_network_endpoint_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "neg_name"}}" - network_endpoint_type = "INTERNET_IP_PORT" - default_port = 90 -} diff --git a/mmv1/templates/terraform/examples/go/ha_vpn_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/ha_vpn_gateway_basic.tf.tmpl deleted file mode 100644 index a20645e5e9da..000000000000 --- a/mmv1/templates/terraform/examples/go/ha_vpn_gateway_basic.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_compute_ha_vpn_gateway" "ha_gateway1" { - region = "us-central1" - name = "{{index $.Vars "ha_vpn_gateway1_name"}}" - 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/go/ha_vpn_gateway_gcp_to_gcp.tf.tmpl b/mmv1/templates/terraform/examples/go/ha_vpn_gateway_gcp_to_gcp.tf.tmpl deleted file mode 100644 index b048fc49571a..000000000000 --- a/mmv1/templates/terraform/examples/go/ha_vpn_gateway_gcp_to_gcp.tf.tmpl +++ /dev/null @@ -1,179 +0,0 @@ -resource "google_compute_ha_vpn_gateway" "{{$.PrimaryResourceId}}" { - region = "us-central1" - name = "{{index $.Vars "ha_vpn_gateway1_name"}}" - network = google_compute_network.network1.id -} - -resource "google_compute_ha_vpn_gateway" "ha_gateway2" { - region = "us-central1" - name = "{{index $.Vars "ha_vpn_gateway2_name"}}" - network = google_compute_network.network2.id -} - -resource "google_compute_network" "network1" { - name = "{{index $.Vars "network1_name"}}" - routing_mode = "GLOBAL" - auto_create_subnetworks = false -} - -resource "google_compute_network" "network2" { - name = "{{index $.Vars "network2_name"}}" - routing_mode = "GLOBAL" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "network1_subnet1" { - name = "ha-vpn-subnet-1" - ip_cidr_range = "10.0.1.0/24" - region = "us-central1" - network = google_compute_network.network1.id -} - -resource "google_compute_subnetwork" "network1_subnet2" { - name = "ha-vpn-subnet-2" - ip_cidr_range = "10.0.2.0/24" - region = "us-west1" - network = google_compute_network.network1.id -} - -resource "google_compute_subnetwork" "network2_subnet1" { - name = "ha-vpn-subnet-3" - ip_cidr_range = "192.168.1.0/24" - region = "us-central1" - network = google_compute_network.network2.id -} - -resource "google_compute_subnetwork" "network2_subnet2" { - name = "ha-vpn-subnet-4" - ip_cidr_range = "192.168.2.0/24" - region = "us-east1" - network = google_compute_network.network2.id -} - -resource "google_compute_router" "router1" { - name = "{{index $.Vars "router1_name"}}" - network = google_compute_network.network1.name - bgp { - asn = 64514 - } -} - -resource "google_compute_router" "router2" { - name = "{{index $.Vars "router2_name"}}" - network = google_compute_network.network2.name - bgp { - asn = 64515 - } -} - -resource "google_compute_vpn_tunnel" "tunnel1" { - name = "ha-vpn-tunnel1" - region = "us-central1" - vpn_gateway = google_compute_ha_vpn_gateway.ha_gateway1.id - peer_gcp_gateway = google_compute_ha_vpn_gateway.ha_gateway2.id - shared_secret = "a secret message" - router = google_compute_router.router1.id - vpn_gateway_interface = 0 -} - -resource "google_compute_vpn_tunnel" "tunnel2" { - name = "ha-vpn-tunnel2" - region = "us-central1" - vpn_gateway = google_compute_ha_vpn_gateway.ha_gateway1.id - peer_gcp_gateway = google_compute_ha_vpn_gateway.ha_gateway2.id - shared_secret = "a secret message" - router = google_compute_router.router1.id - vpn_gateway_interface = 1 -} - -resource "google_compute_vpn_tunnel" "tunnel3" { - name = "ha-vpn-tunnel3" - region = "us-central1" - vpn_gateway = google_compute_ha_vpn_gateway.ha_gateway2.id - peer_gcp_gateway = google_compute_ha_vpn_gateway.ha_gateway1.id - shared_secret = "a secret message" - router = google_compute_router.router2.id - vpn_gateway_interface = 0 -} - -resource "google_compute_vpn_tunnel" "tunnel4" { - name = "ha-vpn-tunnel4" - region = "us-central1" - vpn_gateway = google_compute_ha_vpn_gateway.ha_gateway2.id - peer_gcp_gateway = google_compute_ha_vpn_gateway.ha_gateway1.id - shared_secret = "a secret message" - router = google_compute_router.router2.id - vpn_gateway_interface = 1 -} - -resource "google_compute_router_interface" "router1_interface1" { - name = "router1-interface1" - router = google_compute_router.router1.name - region = "us-central1" - ip_range = "169.254.0.1/30" - vpn_tunnel = google_compute_vpn_tunnel.tunnel1.name -} - -resource "google_compute_router_peer" "router1_peer1" { - name = "router1-peer1" - router = google_compute_router.router1.name - region = "us-central1" - peer_ip_address = "169.254.0.2" - peer_asn = 64515 - advertised_route_priority = 100 - interface = google_compute_router_interface.router1_interface1.name -} - -resource "google_compute_router_interface" "router1_interface2" { - name = "router1-interface2" - router = google_compute_router.router1.name - region = "us-central1" - ip_range = "169.254.1.2/30" - vpn_tunnel = google_compute_vpn_tunnel.tunnel2.name -} - -resource "google_compute_router_peer" "router1_peer2" { - name = "router1-peer2" - router = google_compute_router.router1.name - region = "us-central1" - peer_ip_address = "169.254.1.1" - peer_asn = 64515 - advertised_route_priority = 100 - interface = google_compute_router_interface.router1_interface2.name -} - -resource "google_compute_router_interface" "router2_interface1" { - name = "router2-interface1" - router = google_compute_router.router2.name - region = "us-central1" - ip_range = "169.254.0.2/30" - vpn_tunnel = google_compute_vpn_tunnel.tunnel3.name -} - -resource "google_compute_router_peer" "router2_peer1" { - name = "router2-peer1" - router = google_compute_router.router2.name - region = "us-central1" - peer_ip_address = "169.254.0.1" - peer_asn = 64514 - advertised_route_priority = 100 - interface = google_compute_router_interface.router2_interface1.name -} - -resource "google_compute_router_interface" "router2_interface2" { - name = "router2-interface2" - router = google_compute_router.router2.name - region = "us-central1" - ip_range = "169.254.1.1/30" - vpn_tunnel = google_compute_vpn_tunnel.tunnel4.name -} - -resource "google_compute_router_peer" "router2_peer2" { - name = "router2-peer2" - router = google_compute_router.router2.name - region = "us-central1" - peer_ip_address = "169.254.1.2" - peer_asn = 64514 - advertised_route_priority = 100 - interface = google_compute_router_interface.router2_interface2.name -} diff --git a/mmv1/templates/terraform/examples/go/ha_vpn_gateway_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/go/ha_vpn_gateway_ipv6.tf.tmpl deleted file mode 100644 index 7c5efe0534d6..000000000000 --- a/mmv1/templates/terraform/examples/go/ha_vpn_gateway_ipv6.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_compute_ha_vpn_gateway" "ha_gateway1" { - region = "us-central1" - name = "{{index $.Vars "ha_vpn_gateway1_name"}}" - network = google_compute_network.network1.id - stack_type = "IPV4_IPV6" -} - -resource "google_compute_network" "network1" { - name = "{{index $.Vars "network1_name"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/go/health_check_grpc.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_grpc.tf.tmpl deleted file mode 100644 index f1f5e9df739a..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_grpc.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_compute_health_check" "grpc-health-check" { - name = "{{index $.Vars "health_check_name"}}" - - timeout_sec = 1 - check_interval_sec = 1 - - grpc_health_check { - port = "443" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_grpc_full.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_grpc_full.tf.tmpl deleted file mode 100644 index 15ad978487f0..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_grpc_full.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_compute_health_check" "grpc-health-check" { - name = "{{index $.Vars "health_check_name"}}" - - timeout_sec = 1 - check_interval_sec = 1 - - grpc_health_check { - port_name = "health-check-port" - port_specification = "USE_NAMED_PORT" - grpc_service_name = "testservice" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_http.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_http.tf.tmpl deleted file mode 100644 index d1e8c1d6ca58..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_http.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_compute_health_check" "http-health-check" { - name = "{{index $.Vars "health_check_name"}}" - - timeout_sec = 1 - check_interval_sec = 1 - - http_health_check { - port = 80 - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_http2.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_http2.tf.tmpl deleted file mode 100644 index 6a2af9194b6f..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_http2.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_compute_health_check" "http2-health-check" { - name = "{{index $.Vars "health_check_name"}}" - - timeout_sec = 1 - check_interval_sec = 1 - - http2_health_check { - port = "443" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_http2_full.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_http2_full.tf.tmpl deleted file mode 100644 index 92e2e0b8f1cf..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_http2_full.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_compute_health_check" "http2-health-check" { - name = "{{index $.Vars "health_check_name"}}" - description = "Health check via http2" - - timeout_sec = 1 - check_interval_sec = 1 - healthy_threshold = 4 - unhealthy_threshold = 5 - - http2_health_check { - port_name = "health-check-port" - port_specification = "USE_NAMED_PORT" - host = "1.2.3.4" - request_path = "/mypath" - proxy_header = "NONE" - response = "I AM HEALTHY" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_http_full.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_http_full.tf.tmpl deleted file mode 100644 index 4834ee829d58..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_http_full.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_compute_health_check" "http-health-check" { - name = "{{index $.Vars "health_check_name"}}" - description = "Health check via http" - - timeout_sec = 1 - check_interval_sec = 1 - healthy_threshold = 4 - unhealthy_threshold = 5 - - http_health_check { - port_name = "health-check-port" - port_specification = "USE_NAMED_PORT" - host = "1.2.3.4" - request_path = "/mypath" - proxy_header = "NONE" - response = "I AM HEALTHY" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_https.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_https.tf.tmpl deleted file mode 100644 index 2a66a31df0e6..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_https.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_compute_health_check" "https-health-check" { - name = "{{index $.Vars "health_check_name"}}" - - timeout_sec = 1 - check_interval_sec = 1 - - https_health_check { - port = "443" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_https_full.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_https_full.tf.tmpl deleted file mode 100644 index 4c0714f8d345..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_https_full.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_compute_health_check" "https-health-check" { - name = "{{index $.Vars "health_check_name"}}" - description = "Health check via https" - - timeout_sec = 1 - check_interval_sec = 1 - healthy_threshold = 4 - unhealthy_threshold = 5 - - https_health_check { - port_name = "health-check-port" - port_specification = "USE_NAMED_PORT" - host = "1.2.3.4" - request_path = "/mypath" - proxy_header = "NONE" - response = "I AM HEALTHY" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_ssl.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_ssl.tf.tmpl deleted file mode 100644 index 4134e34da522..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_ssl.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_compute_health_check" "ssl-health-check" { - name = "{{index $.Vars "health_check_name"}}" - - timeout_sec = 1 - check_interval_sec = 1 - - ssl_health_check { - port = "443" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_ssl_full.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_ssl_full.tf.tmpl deleted file mode 100644 index 79d928ac48d8..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_ssl_full.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_compute_health_check" "ssl-health-check" { - name = "{{index $.Vars "health_check_name"}}" - description = "Health check via ssl" - - timeout_sec = 1 - check_interval_sec = 1 - healthy_threshold = 4 - unhealthy_threshold = 5 - - ssl_health_check { - port_name = "health-check-port" - port_specification = "USE_NAMED_PORT" - request = "ARE YOU HEALTHY?" - proxy_header = "NONE" - response = "I AM HEALTHY" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_tcp.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_tcp.tf.tmpl deleted file mode 100644 index 6e1ed144b137..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_tcp.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_compute_health_check" "tcp-health-check" { - name = "{{index $.Vars "health_check_name"}}" - - timeout_sec = 1 - check_interval_sec = 1 - - tcp_health_check { - port = "80" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_tcp_full.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_tcp_full.tf.tmpl deleted file mode 100644 index e70fcde14e37..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_tcp_full.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_compute_health_check" "tcp-health-check" { - name = "{{index $.Vars "health_check_name"}}" - description = "Health check via tcp" - - timeout_sec = 1 - check_interval_sec = 1 - healthy_threshold = 4 - unhealthy_threshold = 5 - - tcp_health_check { - port_name = "health-check-port" - port_specification = "USE_NAMED_PORT" - request = "ARE YOU HEALTHY?" - proxy_header = "NONE" - response = "I AM HEALTHY" - } -} diff --git a/mmv1/templates/terraform/examples/go/health_check_with_logging.tf.tmpl b/mmv1/templates/terraform/examples/go/health_check_with_logging.tf.tmpl deleted file mode 100644 index 8cfd2f43cb02..000000000000 --- a/mmv1/templates/terraform/examples/go/health_check_with_logging.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_compute_health_check" "{{$.PrimaryResourceId}}" { - provider = google-beta - - name = "{{index $.Vars "health_check_name"}}" - - timeout_sec = 1 - check_interval_sec = 1 - - tcp_health_check { - port = "22" - } - - log_config { - enable = true - } -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_consent_store_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_consent_store_basic.tf.tmpl deleted file mode 100644 index 2076a41f1a60..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_consent_store_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_healthcare_dataset" "dataset" { - location = "us-central1" - name = "{{index $.Vars "dataset_id"}}" -} - -resource "google_healthcare_consent_store" "{{$.PrimaryResourceId}}" { - dataset = google_healthcare_dataset.dataset.id - name = "{{index $.Vars "consent_id"}}" -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_consent_store_full.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_consent_store_full.tf.tmpl deleted file mode 100644 index 643e0d580711..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_consent_store_full.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ - -resource "google_healthcare_dataset" "dataset" { - location = "us-central1" - name = "{{index $.Vars "dataset_id"}}" -} - -resource "google_healthcare_consent_store" "{{$.PrimaryResourceId}}" { - dataset = google_healthcare_dataset.dataset.id - name = "{{index $.Vars "consent_id"}}" - - enable_consent_create_on_update = true - default_consent_ttl = "90000s" - - labels = { - "label1" = "labelvalue1" - } -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_consent_store_iam.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_consent_store_iam.tf.tmpl deleted file mode 100644 index a6c8dd7a0ae5..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_consent_store_iam.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_healthcare_dataset" "dataset" { - location = "us-central1" - name = "{{index $.Vars "dataset_id"}}" -} - -resource "google_healthcare_consent_store" "{{$.PrimaryResourceId}}" { - dataset = google_healthcare_dataset.dataset.id - name = "{{index $.Vars "consent_id"}}" -} - -resource "google_service_account" "test-account" { - account_id = "{{index $.Vars "account_id"}}" - display_name = "Test Service Account" -} - -resource "google_healthcare_consent_store_iam_member" "test-iam" { - dataset = google_healthcare_dataset.dataset.id - consent_store_id = google_healthcare_consent_store.{{$.PrimaryResourceId}}.name - role = "roles/editor" - member = "serviceAccount:${google_service_account.test-account.email}" -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_dataset_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_dataset_basic.tf.tmpl deleted file mode 100644 index c671662920e4..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_dataset_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_healthcare_dataset" "default" { - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" - time_zone = "UTC" -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_dataset_cmek.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_dataset_cmek.tf.tmpl deleted file mode 100644 index a7f2a6244c99..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_dataset_cmek.tf.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -data "google_project" "project" {} - -resource "google_healthcare_dataset" "default" { - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" - time_zone = "UTC" - - encryption_spec { - kms_key_name = google_kms_crypto_key.crypto_key.id - } - - depends_on = [ - google_kms_crypto_key_iam_binding.healthcare_cmek_keyuser - ] -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "{{index $.Vars "key_name"}}" - key_ring = google_kms_key_ring.key_ring.id - purpose = "ENCRYPT_DECRYPT" -} - -resource "google_kms_key_ring" "key_ring" { - name = "{{index $.Vars "keyring_name"}}" - location = "us-central1" -} - -resource "google_kms_crypto_key_iam_binding" "healthcare_cmek_keyuser" { - crypto_key_id = google_kms_crypto_key.crypto_key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - members = [ - "serviceAccount:service-${data.google_project.project.number}@gcp-sa-healthcare.iam.gserviceaccount.com", - ] -} - - diff --git a/mmv1/templates/terraform/examples/go/healthcare_dicom_store_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_dicom_store_basic.tf.tmpl deleted file mode 100644 index 37ee460c0075..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_dicom_store_basic.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_healthcare_dicom_store" "default" { - name = "{{index $.Vars "dicom_store_name"}}" - dataset = google_healthcare_dataset.dataset.id - - notification_config { - pubsub_topic = google_pubsub_topic.topic.id - } - - labels = { - label1 = "labelvalue1" - } -} - -resource "google_pubsub_topic" "topic" { - name = "{{index $.Vars "pubsub_topic"}}" -} - -resource "google_healthcare_dataset" "dataset" { - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_dicom_store_bq_stream.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_dicom_store_bq_stream.tf.tmpl deleted file mode 100644 index c376a5c41b0e..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_dicom_store_bq_stream.tf.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -resource "google_healthcare_dicom_store" "default" { - provider = google-beta - - name = "{{index $.Vars "dicom_store_name"}}" - dataset = google_healthcare_dataset.dataset.id - - notification_config { - pubsub_topic = google_pubsub_topic.topic.id - send_for_bulk_import = true - } - - labels = { - label1 = "labelvalue1" - } - - stream_configs { - bigquery_destination { - table_uri = "bq://${google_bigquery_dataset.bq_dataset.project}.${google_bigquery_dataset.bq_dataset.dataset_id}.${google_bigquery_table.bq_table.table_id}" - } - } -} - -resource "google_pubsub_topic" "topic" { - provider = google-beta - - name = "{{index $.Vars "pubsub_topic"}}" -} - -resource "google_healthcare_dataset" "dataset" { - provider = google-beta - - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" -} - -resource "google_bigquery_dataset" "bq_dataset" { - provider = google-beta - - dataset_id = "{{index $.Vars "bq_dataset_name"}}" - friendly_name = "test" - description = "This is a test description" - location = "US" - delete_contents_on_destroy = true -} - -resource "google_bigquery_table" "bq_table" { - provider = google-beta - - deletion_protection = false - dataset_id = google_bigquery_dataset.bq_dataset.dataset_id - table_id = "{{index $.Vars "bq_table_name"}}" -} - diff --git a/mmv1/templates/terraform/examples/go/healthcare_fhir_store_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_fhir_store_basic.tf.tmpl deleted file mode 100644 index a61cdf68c9f5..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_fhir_store_basic.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_healthcare_fhir_store" "default" { - name = "{{index $.Vars "fhir_store_name"}}" - dataset = google_healthcare_dataset.dataset.id - version = "R4" - complex_data_type_reference_parsing = "DISABLED" - - enable_update_create = false - disable_referential_integrity = false - disable_resource_versioning = false - enable_history_import = false - default_search_handling_strict = false - - notification_configs { - pubsub_topic = google_pubsub_topic.topic.id - } - - labels = { - label1 = "labelvalue1" - } -} - -resource "google_pubsub_topic" "topic" { - name = "{{index $.Vars "pubsub_topic"}}" -} - -resource "google_healthcare_dataset" "dataset" { - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_fhir_store_notification_config.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_fhir_store_notification_config.tf.tmpl deleted file mode 100644 index 4ae13979d4c0..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_fhir_store_notification_config.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_healthcare_fhir_store" "default" { - name = "{{index $.Vars "fhir_store_name"}}" - dataset = google_healthcare_dataset.dataset.id - version = "R4" - - enable_update_create = false - disable_referential_integrity = false - disable_resource_versioning = false - enable_history_import = false - - labels = { - label1 = "labelvalue1" - } - - notification_config { - pubsub_topic = "${google_pubsub_topic.topic.id}" - } -} - -resource "google_pubsub_topic" "topic" { - name = "{{index $.Vars "pubsub_topic"}}" -} - -resource "google_healthcare_dataset" "dataset" { - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_fhir_store_notification_configs.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_fhir_store_notification_configs.tf.tmpl deleted file mode 100644 index 219fadbc32b5..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_fhir_store_notification_configs.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_healthcare_fhir_store" "default" { - name = "{{index $.Vars "fhir_store_name"}}" - dataset = google_healthcare_dataset.dataset.id - version = "R4" - - enable_update_create = false - disable_referential_integrity = false - disable_resource_versioning = false - enable_history_import = false - - labels = { - label1 = "labelvalue1" - } - - notification_configs { - pubsub_topic = "${google_pubsub_topic.topic.id}" - send_full_resource = true - send_previous_resource_on_delete = true - } -} - -resource "google_pubsub_topic" "topic" { - name = "{{index $.Vars "pubsub_topic"}}" -} - -resource "google_healthcare_dataset" "dataset" { - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_fhir_store_streaming_config.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_fhir_store_streaming_config.tf.tmpl deleted file mode 100644 index 166e22b99977..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_fhir_store_streaming_config.tf.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -resource "google_healthcare_fhir_store" "default" { - name = "{{index $.Vars "fhir_store_name"}}" - dataset = google_healthcare_dataset.dataset.id - version = "R4" - - enable_update_create = false - disable_referential_integrity = false - disable_resource_versioning = false - enable_history_import = false - - labels = { - label1 = "labelvalue1" - } - - stream_configs { - resource_types = ["Observation"] - bigquery_destination { - dataset_uri = "bq://${google_bigquery_dataset.bq_dataset.project}.${google_bigquery_dataset.bq_dataset.dataset_id}" - schema_config { - recursive_structure_depth = 3 - last_updated_partition_config { - type = "HOUR" - expiration_ms = 1000000 - } - } - } - } -} - -resource "google_pubsub_topic" "topic" { - name = "{{index $.Vars "pubsub_topic"}}" -} - -resource "google_healthcare_dataset" "dataset" { - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" -} - -resource "google_bigquery_dataset" "bq_dataset" { - dataset_id = "{{index $.Vars "bq_dataset_name"}}" - friendly_name = "test" - description = "This is a test description" - location = "US" - delete_contents_on_destroy = true -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_hl7_v2_store_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_hl7_v2_store_basic.tf.tmpl deleted file mode 100644 index 1b7c060e73a5..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_hl7_v2_store_basic.tf.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -resource "google_healthcare_hl7_v2_store" "store" { - name = "{{index $.Vars "hl7_v2_store_name"}}" - dataset = google_healthcare_dataset.dataset.id - reject_duplicate_message = true - - notification_configs { - pubsub_topic = google_pubsub_topic.topic.id - } - - labels = { - label1 = "labelvalue1" - } -} - -resource "google_pubsub_topic" "topic" { - name = "{{index $.Vars "pubsub_topic"}}" -} - -resource "google_healthcare_dataset" "dataset" { - name = "{{index $.Vars "dataset_name"}}" - location = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/healthcare_hl7_v2_store_parser_config.tf.tmpl b/mmv1/templates/terraform/examples/go/healthcare_hl7_v2_store_parser_config.tf.tmpl deleted file mode 100644 index d507994f833d..000000000000 --- a/mmv1/templates/terraform/examples/go/healthcare_hl7_v2_store_parser_config.tf.tmpl +++ /dev/null @@ -1,96 +0,0 @@ -resource "google_healthcare_hl7_v2_store" "store" { - provider = google-beta - name = "{{index $.Vars "hl7_v2_store_name"}}" - dataset = google_healthcare_dataset.dataset.id - - parser_config { - allow_null_header = false - segment_terminator = "Jw==" - schema = < MIIDpDCCAoygAwIBAgIGAX7/5qPhMA0GCSqGSIb3DQEBCwUAMIGSMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEUMBIGA1UECwwLU1NPUHJvdmlkZXIxEzARBgNVBAMMCmRldi00NTg0MjExHDAaBgkqhkiG9w0BCQEWDWluZm9Ab2t0YS5jb20wHhcNMjIwMjE2MDAxOTEyWhcNMzIwMjE2MDAyMDEyWjCBkjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDTALBgNVBAoMBE9rdGExFDASBgNVBAsMC1NTT1Byb3ZpZGVyMRMwEQYDVQQDDApkZXYtNDU4NDIxMRwwGgYJKoZIhvcNAQkBFg1pbmZvQG9rdGEuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxrBl7GKz52cRpxF9xCsirnRuMxnhFBaUrsHqAQrLqWmdlpNYZTVg+T9iQ+aq/iE68L+BRZcZniKIvW58wqqS0ltXVvIkXuDSvnvnkkI5yMIVErR20K8jSOKQm1FmK+fgAJ4koshFiu9oLiqu0Ejc0DuL3/XRsb4RuxjktKTb1khgBBtb+7idEk0sFR0RPefAweXImJkDHDm7SxjDwGJUubbqpdTxasPr0W+AHI1VUzsUsTiHAoyb0XDkYqHfDzhj/ZdIEl4zHQ3bEZvlD984ztAnmX2SuFLLKfXeAAGHei8MMixJvwxYkkPeYZ/5h8WgBZPP4heS2CPjwYExt29L8QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQARjJFz++a9Z5IQGFzsZMrX2EDR5ML4xxUiQkbhld1S1PljOLcYFARDmUC2YYHOueU4ee8Jid9nPGEUebV/4Jok+b+oQh+dWMgiWjSLI7h5q4OYZ3VJtdlVwgMFt2iz+/4yBKMUZ50g3Qgg36vE34us+eKitg759JgCNsibxn0qtJgSPm0sgP2L6yTaLnoEUbXBRxCwynTSkp9ZijZqEzbhN0e2dWv7Rx/nfpohpDP6vEiFImKFHpDSv3M/5de1ytQzPFrZBYt9WlzlYwE1aD9FHCxdd+rWgYMVVoRaRmndpV/Rq3QUuDuFJtaoX11bC7ExkOpg9KstZzA63i3VcfYv" - } -} diff --git a/mmv1/templates/terraform/examples/go/iam_workforce_pool_provider_saml_full.tf.tmpl b/mmv1/templates/terraform/examples/go/iam_workforce_pool_provider_saml_full.tf.tmpl deleted file mode 100644 index c74bfab882a1..000000000000 --- a/mmv1/templates/terraform/examples/go/iam_workforce_pool_provider_saml_full.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_iam_workforce_pool" "pool" { - workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - location = "global" -} - -resource "google_iam_workforce_pool_provider" "{{$.PrimaryResourceId}}" { - workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id - location = google_iam_workforce_pool.pool.location - provider_id = "{{index $.Vars "provider_id"}}" - attribute_mapping = { - "google.subject" = "assertion.sub" - } - saml { - idp_metadata_xml = " MIIDpDCCAoygAwIBAgIGAX7/5qPhMA0GCSqGSIb3DQEBCwUAMIGSMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEUMBIGA1UECwwLU1NPUHJvdmlkZXIxEzARBgNVBAMMCmRldi00NTg0MjExHDAaBgkqhkiG9w0BCQEWDWluZm9Ab2t0YS5jb20wHhcNMjIwMjE2MDAxOTEyWhcNMzIwMjE2MDAyMDEyWjCBkjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDTALBgNVBAoMBE9rdGExFDASBgNVBAsMC1NTT1Byb3ZpZGVyMRMwEQYDVQQDDApkZXYtNDU4NDIxMRwwGgYJKoZIhvcNAQkBFg1pbmZvQG9rdGEuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxrBl7GKz52cRpxF9xCsirnRuMxnhFBaUrsHqAQrLqWmdlpNYZTVg+T9iQ+aq/iE68L+BRZcZniKIvW58wqqS0ltXVvIkXuDSvnvnkkI5yMIVErR20K8jSOKQm1FmK+fgAJ4koshFiu9oLiqu0Ejc0DuL3/XRsb4RuxjktKTb1khgBBtb+7idEk0sFR0RPefAweXImJkDHDm7SxjDwGJUubbqpdTxasPr0W+AHI1VUzsUsTiHAoyb0XDkYqHfDzhj/ZdIEl4zHQ3bEZvlD984ztAnmX2SuFLLKfXeAAGHei8MMixJvwxYkkPeYZ/5h8WgBZPP4heS2CPjwYExt29L8QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQARjJFz++a9Z5IQGFzsZMrX2EDR5ML4xxUiQkbhld1S1PljOLcYFARDmUC2YYHOueU4ee8Jid9nPGEUebV/4Jok+b+oQh+dWMgiWjSLI7h5q4OYZ3VJtdlVwgMFt2iz+/4yBKMUZ50g3Qgg36vE34us+eKitg759JgCNsibxn0qtJgSPm0sgP2L6yTaLnoEUbXBRxCwynTSkp9ZijZqEzbhN0e2dWv7Rx/nfpohpDP6vEiFImKFHpDSv3M/5de1ytQzPFrZBYt9WlzlYwE1aD9FHCxdd+rWgYMVVoRaRmndpV/Rq3QUuDuFJtaoX11bC7ExkOpg9KstZzA63i3VcfYv" - } - display_name = "Display name" - description = "A sample SAML workforce pool provider." - disabled = false - attribute_condition = "true" -} diff --git a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_basic.tf.tmpl deleted file mode 100644 index ea32eb6ddbc8..000000000000 --- a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_basic.tf.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -resource "google_iam_workload_identity_pool" "{{$.PrimaryResourceId}}" { - workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" -} diff --git a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_full.tf.tmpl b/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_full.tf.tmpl deleted file mode 100644 index a46cc332b260..000000000000 --- a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_full.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_iam_workload_identity_pool" "{{$.PrimaryResourceId}}" { - workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" - display_name = "Name of pool" - description = "Identity pool for automated test" - disabled = true -} diff --git a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_aws_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_aws_basic.tf.tmpl deleted file mode 100644 index 05bfb8727960..000000000000 --- a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_aws_basic.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" -} - -resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { - workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" - aws { - account_id = "999999999999" - } -} diff --git a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_aws_full.tf.tmpl b/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_aws_full.tf.tmpl deleted file mode 100644 index b9ac672da3a2..000000000000 --- a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_aws_full.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" -} - -resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { - workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" - display_name = "Name of provider" - description = "AWS identity pool provider for automated test" - disabled = true - attribute_condition = "attribute.aws_role==\"arn:aws:sts::999999999999:assumed-role/stack-eu-central-1-lambdaRole\"" - attribute_mapping = { - "google.subject" = "assertion.arn" - "attribute.aws_account" = "assertion.account" - "attribute.environment" = "assertion.arn.contains(\":instance-profile/Production\") ? \"prod\" : \"test\"" - } - aws { - account_id = "999999999999" - } -} diff --git a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_oidc_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_oidc_basic.tf.tmpl deleted file mode 100644 index 4629a385b1b5..000000000000 --- a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_oidc_basic.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" -} - -resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { - workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" - attribute_mapping = { - "google.subject" = "assertion.sub" - } - oidc { - issuer_uri = "https://sts.windows.net/azure-tenant-id" - } -} diff --git a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_oidc_full.tf.tmpl b/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_oidc_full.tf.tmpl deleted file mode 100644 index b9513e50c5bd..000000000000 --- a/mmv1/templates/terraform/examples/go/iam_workload_identity_pool_provider_oidc_full.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" -} - -resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { - workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" - display_name = "Name of provider" - description = "OIDC identity pool provider for automated test" - disabled = true - attribute_condition = "\"e968c2ef-047c-498d-8d79-16ca1b61e77e\" in assertion.groups" - attribute_mapping = { - "google.subject" = "\"azure::\" + assertion.tid + \"::\" + assertion.sub" - "attribute.tid" = "assertion.tid" - "attribute.managed_identity_name" = < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -# Regional health check -resource "google_compute_region_health_check" "default" { - name = "{{index $.Vars "l7_ilb_hc"}}" - region = "europe-west1" - http_health_check { - port_specification = "USE_SERVING_PORT" - } -} - -# Regional MIG -resource "google_compute_region_instance_group_manager" "default" { - name = "{{index $.Vars "l7_ilb_mig1"}}" - region = "europe-west1" - version { - instance_template = google_compute_instance_template.default.id - name = "primary" - } - named_port { - name = "http-server" - port = 80 - } - base_instance_name = "vm" - target_size = 2 -} - -# Allow all access to health check ranges -resource "google_compute_firewall" "default" { - name = "{{index $.Vars "l7_ilb_fw_allow_hc"}}" - direction = "INGRESS" - network = google_compute_network.default.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] - allow { - protocol = "tcp" - } -} - -# Allow http from proxy subnet to backends -resource "google_compute_firewall" "backends" { - name = "{{index $.Vars "l7_ilb_fw_allow_ilb_to_backends"}}" - direction = "INGRESS" - network = google_compute_network.default.id - source_ranges = ["10.0.0.0/24"] - target_tags = ["http-server"] - allow { - protocol = "tcp" - ports = ["80", "443", "8080"] - } -} - -# Test instance -resource "google_compute_instance" "default" { - name = "{{index $.Vars "l7_ilb_test_vm"}}" - zone = "europe-west1-b" - machine_type = "e2-small" - network_interface { - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - } - boot_disk { - initialize_params { - image = "debian-cloud/debian-12" - } - } -} - -### HTTP-to-HTTPS redirect ### - -# Regional forwarding rule -resource "google_compute_forwarding_rule" "redirect" { - name = "{{index $.Vars "l7_ilb_redirect"}}" - region = "europe-west1" - ip_protocol = "TCP" - ip_address = google_compute_address.default.address # Same as HTTPS load balancer - load_balancing_scheme = "INTERNAL_MANAGED" - port_range = "80" - target = google_compute_region_target_http_proxy.default.id - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - network_tier = "PREMIUM" -} - -# Regional HTTP proxy -resource "google_compute_region_target_http_proxy" "default" { - name = "{{index $.Vars "l7_ilb_target_http_proxy"}}" - region = "europe-west1" - url_map = google_compute_region_url_map.redirect.id -} - -# Regional URL map -resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "l7_ilb_redirect_url_map"}}" - region = "europe-west1" - default_service = google_compute_region_backend_service.default.id - host_rule { - hosts = ["*"] - path_matcher = "allpaths" - } - - path_matcher { - name = "allpaths" - default_service = google_compute_region_backend_service.default.id - path_rule { - paths = ["/"] - url_redirect { - https_redirect = true - host_redirect = "10.0.1.5:443" - redirect_response_code = "PERMANENT_REDIRECT" - strip_query = true - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_connection_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_connection_advanced.tf.tmpl deleted file mode 100644 index 266d4df5db33..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_connection_advanced.tf.tmpl +++ /dev/null @@ -1,232 +0,0 @@ -data "google_project" "test_project" { -} - -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - user_managed { - replicas { - location = "us-central1" - } - } - } -} - - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - secret_data = "dummypassword" -} - -resource "google_secret_manager_secret_iam_member" "secret_iam" { - secret_id = google_secret_manager_secret.secret-basic.id - role = "roles/secretmanager.admin" - member = "serviceAccount:${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - depends_on = [google_secret_manager_secret_version.secret-version-basic] -} - -resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "connection_name"}}" - description = "tf updated description" - location = "us-central1" - service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/zendesk/connectors/zendesk/versions/1" - config_variable { - key = "proxy_enabled" - boolean_value = false - } - config_variable { - key = "sample_integer_value" - integer_value = 1 - } - - config_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - - config_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - - suspended = false - auth_config { - additional_variable { - key = "sample_string" - string_value = "sampleString" - } - additional_variable { - key = "sample_boolean" - boolean_value = false - } - additional_variable { - key = "sample_integer" - integer_value = 1 - } - additional_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - auth_type = "USER_PASSWORD" - auth_key = "sampleAuthKey" - user_password { - username = "user@xyz.com" - password { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - } - - destination_config { - key = "url" - destination { - host = "https://test.zendesk.com" - port = 80 - } - } - lock_config { - locked = false - reason = "Its not locked" - } - log_config { - enabled = true - } - node_config { - min_node_count = 2 - max_node_count = 50 - } - labels = { - foo = "bar" - } - ssl_config { - additional_variable { - key = "sample_string" - string_value = "sampleString" - } - additional_variable { - key = "sample_boolean" - boolean_value = false - } - additional_variable { - key = "sample_integer" - integer_value = 1 - } - additional_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - client_cert_type = "PEM" - client_certificate { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - client_private_key { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - client_private_key_pass { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - private_server_certificate { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - server_cert_type = "PEM" - trust_model = "PRIVATE" - type = "TLS" - use_ssl = true - } - - eventing_enablement_type = "EVENTING_AND_CONNECTION" - eventing_config { - additional_variable { - key = "sample_string" - string_value = "sampleString" - } - additional_variable { - key = "sample_boolean" - boolean_value = false - } - additional_variable { - key = "sample_integer" - integer_value = 1 - } - additional_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - registration_destination_config { - key = "registration_destination_config" - destination { - host = "https://test.zendesk.com" - port = 80 - } - } - auth_config { - auth_type = "USER_PASSWORD" - auth_key = "sampleAuthKey" - user_password { - username = "user@xyz.com" - password { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_string" - string_value = "sampleString" - } - additional_variable { - key = "sample_boolean" - boolean_value = false - } - additional_variable { - key = "sample_integer" - integer_value = 1 - } - additional_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - } - enrichment_enabled = true - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_connection_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_connection_basic.tf.tmpl deleted file mode 100644 index fe8b803fdd1e..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_connection_basic.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -data "google_project" "test_project" { -} - -resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "connection_name"}}" - location = "us-central1" - connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/gcp/connectors/pubsub/versions/1" - description = "tf created description" - config_variable { - key = "project_id" - string_value = "connectors-example" - } - config_variable { - key = "topic_id" - string_value = "test" - } -} diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth.tf.tmpl deleted file mode 100644 index 8dcc0da0e69b..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth.tf.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -data "google_project" "test_project" { -} - -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - user_managed { - replicas { - location = "us-central1" - } - } - } -} - - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - secret_data = "dummypassword" -} - -resource "google_secret_manager_secret_iam_member" "secret_iam" { - secret_id = google_secret_manager_secret.secret-basic.id - role = "roles/secretmanager.admin" - member = "serviceAccount:${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - depends_on = [google_secret_manager_secret_version.secret-version-basic] -} - -resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "connection_name"}}" - location = "us-central1" - connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" - description = "tf created description" - config_variable { - key = "impersonate_user_mode" - string_value = "User" - } - config_variable { - key = "proxy_enabled" - boolean_value = false - } - auth_config{ - auth_type = "OAUTH2_AUTH_CODE_FLOW" - oauth2_auth_code_flow { - auth_uri = "sampleauthuri" - client_id = "sampleclientid" - client_secret { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - enable_pkce = true - scopes = [ - "sample_scope_1", - "sample_scope_2" - ] - } - } - -} diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_cc.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_cc.tf.tmpl deleted file mode 100644 index e9b7b1e3bf02..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_cc.tf.tmpl +++ /dev/null @@ -1,87 +0,0 @@ -data "google_project" "test_project" { -} - -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - user_managed { - replicas { - location = "us-central1" - } - } - } -} - - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - secret_data = "dummypassword" -} - -resource "google_secret_manager_secret_iam_member" "secret_iam" { - secret_id = google_secret_manager_secret.secret-basic.id - role = "roles/secretmanager.admin" - member = "serviceAccount:${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - depends_on = [google_secret_manager_secret_version.secret-version-basic] -} - -resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "connection_name"}}" - location = "us-central1" - connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" - service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - description = "tf created description" - config_variable { - key = "impersonate_user_mode" - string_value = "User" - } - config_variable { - key = "proxy_enabled" - boolean_value = false - } - auth_config { - auth_type = "OAUTH2_CLIENT_CREDENTIALS" - oauth2_client_credentials { - client_id = "testclientid" - client_secret { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "oauth_jwt_cert" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "oauth_jwt_cert_password" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "oauth_jwt_subject_type" - string_value = "sample" - } - additional_variable { - key = "oauth_jwt_subject" - string_value = "sample" - } - additional_variable { - key = "oauth_jwt_public_key_id" - string_value = "sample" - } - additional_variable { - key = "auth_scheme" - string_value = "sample" - } - additional_variable { - key = "initiate_oauth" - string_value = "sample" - } - additional_variable { - key = "oauth_jwt_cert_type" - string_value = "PEMKEY_BLOB" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_jwt.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_jwt.tf.tmpl deleted file mode 100644 index 1ed95073b324..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_jwt.tf.tmpl +++ /dev/null @@ -1,55 +0,0 @@ -data "google_project" "test_project" { -} - -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - user_managed { - replicas { - location = "us-central1" - } - } - } -} - - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - secret_data = "dummypassword" -} - -resource "google_secret_manager_secret_iam_member" "secret_iam" { - secret_id = google_secret_manager_secret.secret-basic.id - role = "roles/secretmanager.admin" - member = "serviceAccount:${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - depends_on = [google_secret_manager_secret_version.secret-version-basic] -} - -resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "connection_name"}}" - location = "us-central1" - connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" - service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - description = "tf created description" - config_variable { - key = "impersonate_user_mode" - string_value = "User" - } - config_variable { - key = "proxy_enabled" - boolean_value = false - } - auth_config { - auth_type = "OAUTH2_JWT_BEARER" - oauth2_jwt_bearer { - client_key { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - jwt_claims { - issuer = "test" - subject = "johndoe@example.org" - audience = "test" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_ssh.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_ssh.tf.tmpl deleted file mode 100644 index 2b5dd2298918..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_connection_oauth_ssh.tf.tmpl +++ /dev/null @@ -1,56 +0,0 @@ -data "google_project" "test_project" { -} - -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - user_managed { - replicas { - location = "us-central1" - } - } - } -} - - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - secret_data = "dummypassword" -} - -resource "google_secret_manager_secret_iam_member" "secret_iam" { - secret_id = google_secret_manager_secret.secret-basic.id - role = "roles/secretmanager.admin" - member = "serviceAccount:${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - depends_on = [google_secret_manager_secret_version.secret-version-basic] -} - -resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "connection_name"}}" - location = "us-central1" - connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" - service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - description = "tf created description" - config_variable { - key = "impersonate_user_mode" - string_value = "User" - } - config_variable { - key = "proxy_enabled" - boolean_value = false - } - auth_config{ - auth_type = "SSH_PUBLIC_KEY" - ssh_public_key { - cert_type = "PEMKEY_BLOB" - ssh_client_cert { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - ssh_client_cert_pass { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - username = "abc" - } - } - -} diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_connection_sa.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_connection_sa.tf.tmpl deleted file mode 100644 index 250e2e74ea37..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_connection_sa.tf.tmpl +++ /dev/null @@ -1,230 +0,0 @@ -data "google_project" "test_project" { -} - -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_id"}}" - replication { - user_managed { - replicas { - location = "us-central1" - } - } - } -} - - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - secret_data = "dummypassword" -} - -resource "google_secret_manager_secret_iam_member" "secret_iam" { - secret_id = google_secret_manager_secret.secret-basic.id - role = "roles/secretmanager.admin" - member = "serviceAccount:${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - depends_on = [google_secret_manager_secret_version.secret-version-basic] -} - -resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "connection_name"}}" - description = "tf updated description" - location = "us-central1" - service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" - connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/zendesk/connectors/zendesk/versions/1" - config_variable { - key = "proxy_enabled" - boolean_value = false - } - config_variable { - key = "sample_integer_value" - integer_value = 1 - } - - config_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - - config_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - - suspended = false - auth_config { - additional_variable { - key = "sample_string" - string_value = "sampleString" - } - additional_variable { - key = "sample_boolean" - boolean_value = false - } - additional_variable { - key = "sample_integer" - integer_value = 1 - } - additional_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - auth_type = "USER_PASSWORD" - auth_key = "sampleAuthKey" - user_password { - username = "user@xyz.com" - password { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - } - - destination_config { - key = "url" - destination { - service_attachment = "projects/connectors-example/regions/us-central1/serviceAttachments/test" - } - } - lock_config { - locked = false - reason = "Its not locked" - } - log_config { - enabled = true - } - node_config { - min_node_count = 2 - max_node_count = 50 - } - labels = { - foo = "bar" - } - ssl_config { - additional_variable { - key = "sample_string" - string_value = "sampleString" - } - additional_variable { - key = "sample_boolean" - boolean_value = false - } - additional_variable { - key = "sample_integer" - integer_value = 1 - } - additional_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - client_cert_type = "PEM" - client_certificate { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - client_private_key { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - client_private_key_pass { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - private_server_certificate { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - server_cert_type = "PEM" - trust_model = "PRIVATE" - type = "TLS" - use_ssl = true - } - - eventing_enablement_type = "EVENTING_AND_CONNECTION" - eventing_config { - additional_variable { - key = "sample_string" - string_value = "sampleString" - } - additional_variable { - key = "sample_boolean" - boolean_value = false - } - additional_variable { - key = "sample_integer" - integer_value = 1 - } - additional_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - registration_destination_config { - key = "registration_destination_config" - destination { - service_attachment = "projects/connectors-example/regions/us-central1/serviceAttachments/test" - } - } - auth_config { - auth_type = "USER_PASSWORD" - auth_key = "sampleAuthKey" - user_password { - username = "user@xyz.com" - password { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_string" - string_value = "sampleString" - } - additional_variable { - key = "sample_boolean" - boolean_value = false - } - additional_variable { - key = "sample_integer" - integer_value = 1 - } - additional_variable { - key = "sample_secret_value" - secret_value { - secret_version = google_secret_manager_secret_version.secret-version-basic.name - } - } - additional_variable { - key = "sample_encryption_key_value" - encryption_key_value { - type = "GOOGLE_MANAGED" - kms_key_name = "sampleKMSKkey" - } - } - } - enrichment_enabled = true - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_endpoint_attachment.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_endpoint_attachment.tf.tmpl deleted file mode 100644 index 2d734b1cb351..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_endpoint_attachment.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_integration_connectors_endpoint_attachment" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "endpoint_attachment_name"}}" - location = "us-central1" - description = "tf created description" - service_attachment = "projects/connectors-example/regions/us-central1/serviceAttachments/test" - labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/integration_connectors_managed_zone.tf.tmpl b/mmv1/templates/terraform/examples/go/integration_connectors_managed_zone.tf.tmpl deleted file mode 100644 index 6ba34c480050..000000000000 --- a/mmv1/templates/terraform/examples/go/integration_connectors_managed_zone.tf.tmpl +++ /dev/null @@ -1,58 +0,0 @@ -resource "google_project" "target_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 "google_project_iam_member" "dns_peer_binding" { - project = google_project.target_project.project_id - role = "roles/dns.peer" - member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-connectors.iam.gserviceaccount.com" -} - -resource "google_project_service" "dns" { - project = google_project.target_project.project_id - service = "dns.googleapis.com" -} - -resource "google_project_service" "compute" { - project = google_project.target_project.project_id - service = "compute.googleapis.com" -} - -resource "google_compute_network" "network" { - project = google_project.target_project.project_id - name = "test" - auto_create_subnetworks = false - depends_on = [google_project_service.compute] -} - -resource "google_dns_managed_zone" "zone" { - name = "tf-test-dns%{random_suffix}" - dns_name = "private%{random_suffix}.example.com." - visibility = "private" - - private_visibility_config { - networks { - network_url = google_compute_network.network.id - } - } - depends_on = [google_project_service.dns] -} - -data "google_project" "test_project" { -} - -resource "google_integration_connectors_managed_zone" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "managed_zone_name"}}" - description = "tf created description" - labels = { - intent = "example" - } - target_project = google_project.target_project.project_id - target_vpc = "test" - dns = google_dns_managed_zone.zone.dns_name - depends_on = [google_project_iam_member.dns_peer_binding,google_dns_managed_zone.zone] -} diff --git a/mmv1/templates/terraform/examples/go/integrations_auth_config_advance.tf.tmpl b/mmv1/templates/terraform/examples/go/integrations_auth_config_advance.tf.tmpl deleted file mode 100644 index 8275e659a58f..000000000000 --- a/mmv1/templates/terraform/examples/go/integrations_auth_config_advance.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_integrations_client" "client" { - location = "asia-east2" -} - -resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { - location = "asia-east2" - display_name = "{{index $.Vars "auth_config_name"}}" - description = "Test auth config created via terraform" - visibility = "CLIENT_VISIBLE" - expiry_notification_duration = ["3.500s"] - override_valid_time = "2014-10-02T15:01:23Z" - decrypted_credential { - credential_type = "USERNAME_AND_PASSWORD" - username_and_password { - username = "test-username" - password = "test-password" - } - } - depends_on = [google_integrations_client.client] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/integrations_auth_config_auth_token.tf.tmpl b/mmv1/templates/terraform/examples/go/integrations_auth_config_auth_token.tf.tmpl deleted file mode 100644 index 381caeb0db7d..000000000000 --- a/mmv1/templates/terraform/examples/go/integrations_auth_config_auth_token.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_integrations_client" "client" { - location = "us-west2" -} - -resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { - location = "us-west2" - display_name = "{{index $.Vars "auth_config_name"}}" - description = "Test auth config created via terraform" - decrypted_credential { - credential_type = "AUTH_TOKEN" - auth_token { - type = "Basic" - token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9" - } - } - depends_on = [google_integrations_client.client] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/integrations_auth_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/integrations_auth_config_basic.tf.tmpl deleted file mode 100644 index 09b52bbd258e..000000000000 --- a/mmv1/templates/terraform/examples/go/integrations_auth_config_basic.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_integrations_client" "client" { - location = "us-west1" -} - -resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { - location = "us-west1" - display_name = "{{index $.Vars "auth_config_name"}}" - description = "Test auth config created via terraform" - decrypted_credential { - credential_type = "USERNAME_AND_PASSWORD" - username_and_password { - username = "test-username" - password = "test-password" - } - } - depends_on = [google_integrations_client.client] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/integrations_auth_config_client_certificate_only.tf.tmpl b/mmv1/templates/terraform/examples/go/integrations_auth_config_client_certificate_only.tf.tmpl deleted file mode 100644 index 3b868b1ffb24..000000000000 --- a/mmv1/templates/terraform/examples/go/integrations_auth_config_client_certificate_only.tf.tmpl +++ /dev/null @@ -1,63 +0,0 @@ -resource "google_integrations_client" "client" { - location = "us-west3" -} - -resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { - location = "us-west3" - display_name = "{{index $.Vars "auth_config_name"}}" - description = "Test auth config created via terraform" - decrypted_credential { - credential_type = "CLIENT_CERTIFICATE_ONLY" - } - client_certificate { - ssl_certificate = < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -# health check -resource "google_compute_region_health_check" "default" { - name = "{{index $.Vars "hc_name"}}" - provider = google-beta - region = "europe-west1" - http_health_check { - port_specification = "USE_SERVING_PORT" - } -} - -# MIG -resource "google_compute_region_instance_group_manager" "mig" { - name = "{{index $.Vars "mig_name"}}" - provider = google-beta - region = "europe-west1" - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} - -# allow all access from IAP and health check ranges -resource "google_compute_firewall" "fw-iap" { - name = "{{index $.Vars "fw_allow_iap_hc_name"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.ilb_network.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] - allow { - protocol = "tcp" - } -} - -# allow http from proxy subnet to backends -resource "google_compute_firewall" "fw-ilb-to-backends" { - name = "{{index $.Vars "fw_allow_ilb_to_backends_name"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.ilb_network.id - source_ranges = ["10.0.0.0/24"] - target_tags = ["http-server"] - allow { - protocol = "tcp" - ports = ["80", "443", "8080"] - } -} - -# test instance -resource "google_compute_instance" "vm-test" { - name = "{{index $.Vars "vm_test_name"}}" - provider = google-beta - zone = "europe-west1-b" - machine_type = "e2-small" - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - } - boot_disk { - initialize_params { - image = "debian-cloud/debian-12" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/internal_tcp_udp_lb_with_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/go/internal_tcp_udp_lb_with_mig_backend.tf.tmpl deleted file mode 100644 index 7205bc4ca755..000000000000 --- a/mmv1/templates/terraform/examples/go/internal_tcp_udp_lb_with_mig_backend.tf.tmpl +++ /dev/null @@ -1,178 +0,0 @@ -# Internal TCP/UDP load balancer with a managed instance group backend - -# VPC -resource "google_compute_network" "ilb_network" { - name = "{{index $.Vars "ilb_network_name"}}" - provider = google-beta - auto_create_subnetworks = false -} - -# backed subnet -resource "google_compute_subnetwork" "ilb_subnet" { - name = "{{index $.Vars "backend_subnet_name"}}" - provider = google-beta - ip_cidr_range = "10.0.1.0/24" - region = "europe-west1" - network = google_compute_network.ilb_network.id -} - -# forwarding rule -resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "forwarding_rule_name"}}" - backend_service = google_compute_region_backend_service.default.id - provider = google-beta - region = "europe-west1" - ip_protocol = "TCP" - load_balancing_scheme = "INTERNAL" - all_ports = true - allow_global_access = true - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id -} - -# backend service -resource "google_compute_region_backend_service" "default" { - name = "{{index $.Vars "backend_service_name"}}" - provider = google-beta - region = "europe-west1" - protocol = "TCP" - load_balancing_scheme = "INTERNAL" - health_checks = [google_compute_region_health_check.default.id] - backend { - group = google_compute_region_instance_group_manager.mig.instance_group - balancing_mode = "CONNECTION" - } -} - -# instance template -resource "google_compute_instance_template" "instance_template" { - name = "{{index $.Vars "mig_template_name"}}" - provider = google-beta - machine_type = "e2-small" - tags = ["allow-ssh","allow-health-check"] - - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - access_config { - # add external ip to fetch packages - } - } - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y nginx-light jq - - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - - cat < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - lifecycle { - create_before_destroy = true - } -} - -# health check -resource "google_compute_region_health_check" "default" { - name = "{{index $.Vars "hc_name"}}" - provider = google-beta - region = "europe-west1" - http_health_check { - port = "80" - } -} - -# MIG -resource "google_compute_region_instance_group_manager" "mig" { - name = "{{index $.Vars "mig_name"}}" - provider = google-beta - region = "europe-west1" - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } - base_instance_name = "vm" - target_size = 2 -} - -# allow all access from health check ranges -resource "google_compute_firewall" "fw_hc" { - name = "{{index $.Vars "fw_allow_hc_name"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.ilb_network.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] - allow { - protocol = "tcp" - } - target_tags = ["allow-health-check"] -} - -# allow communication within the subnet -resource "google_compute_firewall" "fw_ilb_to_backends" { - name = "{{index $.Vars "fw_allow_ilb_to_backends_name"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.ilb_network.id - source_ranges = ["10.0.1.0/24"] - allow { - protocol = "tcp" - } - allow { - protocol = "udp" - } - allow { - protocol = "icmp" - } -} - -# allow SSH -resource "google_compute_firewall" "fw_ilb_ssh" { - name = "{{index $.Vars "fw_allow_ilb_ssh_name"}}" - provider = google-beta - direction = "INGRESS" - network = google_compute_network.ilb_network.id - allow { - protocol = "tcp" - ports = ["22"] - } - target_tags = ["allow-ssh"] - source_ranges = ["0.0.0.0/0"] -} - -# test instance -resource "google_compute_instance" "vm_test" { - name = "{{index $.Vars "vm_test_name"}}" - provider = google-beta - zone = "europe-west1-b" - machine_type = "e2-small" - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - } - boot_disk { - initialize_params { - image = "debian-cloud/debian-12" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/kmsConfig_create.tf.tmpl b/mmv1/templates/terraform/examples/go/kmsConfig_create.tf.tmpl deleted file mode 100644 index 6f9c80f60be4..000000000000 --- a/mmv1/templates/terraform/examples/go/kmsConfig_create.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_kms_key_ring" "keyring" { - name = "{{index $.Vars "key_ring_value"}}" - location = "us-central1" -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "{{index $.Vars "crypto_name"}}" - key_ring = google_kms_key_ring.keyring.id - # rotation_period = "7776000s" -} - -resource "google_netapp_kmsconfig" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "kms_name"}}" - description="this is a test description" - crypto_key_name=google_kms_crypto_key.crypto_key.id - location="us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/kms_autokey_config_all.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_autokey_config_all.tf.tmpl deleted file mode 100644 index aa3ad3661cc6..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_autokey_config_all.tf.tmpl +++ /dev/null @@ -1,77 +0,0 @@ -# Create Folder in GCP Organization -resource "google_folder" "autokms_folder" { - provider = google-beta - display_name = "{{index $.Vars "folder_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - deletion_protection = false -} - -# Create the key project -resource "google_project" "key_project" { - provider = google-beta - project_id = "{{index $.Vars "key_project_name"}}" - name = "{{index $.Vars "key_project_name"}}" - folder_id = google_folder.autokms_folder.folder_id - billing_account = "{{index $.TestEnvVars "billing_account"}}" - depends_on = [google_folder.autokms_folder] - deletion_policy = "DELETE" -} - -# Enable the Cloud KMS API -resource "google_project_service" "kms_api_service" { - provider = google-beta - service = "cloudkms.googleapis.com" - project = google_project.key_project.project_id - disable_on_destroy = false - disable_dependent_services = true - depends_on = [google_project.key_project] -} - -# Wait delay after enabling APIs -resource "time_sleep" "wait_enable_service_api" { - depends_on = [google_project_service.kms_api_service] - create_duration = "30s" -} - -#Create KMS Service Agent -resource "google_project_service_identity" "kms_service_agent" { - provider = google-beta - service = "cloudkms.googleapis.com" - project = google_project.key_project.number - depends_on = [time_sleep.wait_enable_service_api] -} - -# Wait delay after creating service agent. -resource "time_sleep" "wait_service_agent" { - depends_on = [google_project_service_identity.kms_service_agent] - create_duration = "10s" -} - -#Grant the KMS Service Agent the Cloud KMS Admin role -resource "google_project_iam_member" "autokey_project_admin" { - provider = google-beta - project = google_project.key_project.project_id - role = "roles/cloudkms.admin" - member = "serviceAccount:service-${google_project.key_project.number}@gcp-sa-cloudkms.iam.gserviceaccount.com" - depends_on = [time_sleep.wait_service_agent] -} - -# Wait delay after granting IAM permissions -resource "time_sleep" "wait_srv_acc_permissions" { - create_duration = "10s" - depends_on = [google_project_iam_member.autokey_project_admin] -} - -resource "google_kms_autokey_config" "{{$.PrimaryResourceId}}" { - provider = google-beta - folder = google_folder.autokms_folder.id - key_project = "projects/${google_project.key_project.project_id}" - depends_on = [time_sleep.wait_srv_acc_permissions] -} - -# Wait delay after setting AutokeyConfig, to prevent diffs on reapply, -# because setting the config takes a little to fully propagate. -resource "time_sleep" "wait_autokey_propagation" { - create_duration = "30s" - depends_on = [google_kms_autokey_config.{{$.PrimaryResourceId}}] -} diff --git a/mmv1/templates/terraform/examples/go/kms_crypto_key_asymmetric_sign.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_crypto_key_asymmetric_sign.tf.tmpl deleted file mode 100644 index 7fa0a6bdf530..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_crypto_key_asymmetric_sign.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_kms_key_ring" "keyring" { - name = "keyring-example" - location = "global" -} - -resource "google_kms_crypto_key" "{{$.PrimaryResourceId}}" { - name = "crypto-key-example" - key_ring = google_kms_key_ring.keyring.id - purpose = "ASYMMETRIC_SIGN" - - version_template { - algorithm = "EC_SIGN_P384_SHA384" - } - - lifecycle { - prevent_destroy = true - } -} diff --git a/mmv1/templates/terraform/examples/go/kms_crypto_key_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_crypto_key_basic.tf.tmpl deleted file mode 100644 index e996e99f3e26..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_crypto_key_basic.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_kms_key_ring" "keyring" { - name = "keyring-example" - location = "global" -} - -resource "google_kms_crypto_key" "{{$.PrimaryResourceId}}" { - name = "crypto-key-example" - key_ring = google_kms_key_ring.keyring.id - rotation_period = "7776000s" - - lifecycle { - prevent_destroy = true - } -} diff --git a/mmv1/templates/terraform/examples/go/kms_crypto_key_version_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_crypto_key_version_basic.tf.tmpl deleted file mode 100644 index 556d174b3e63..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_crypto_key_version_basic.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_kms_key_ring" "keyring" { - name = "keyring-example" - location = "global" -} - -resource "google_kms_crypto_key" "cryptokey" { - name = "crypto-key-example" - key_ring = google_kms_key_ring.keyring.id - rotation_period = "7776000s" -} - -resource "google_kms_crypto_key_version" "{{$.PrimaryResourceId}}" { - crypto_key = google_kms_crypto_key.cryptokey.id -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/kms_ekm_connection_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_ekm_connection_basic.tf.tmpl deleted file mode 100644 index 9ecf12b55ab2..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_ekm_connection_basic.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_kms_ekm_connection" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "ekmconnection_name"}}" - location = "us-central1" - key_management_mode = "MANUAL" - service_resolvers { - service_directory_service = "projects/project_id/locations/us-central1/namespaces/namespace_name/services/service_name" - hostname = "example-ekm.goog" - server_certificates { - raw_der = "==HAwIBCCAr6gAwIBAgIUWR+EV4lqiV7Ql12VY==" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/kms_key_handle_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_key_handle_basic.tf.tmpl deleted file mode 100644 index 2c87c30cb825..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_key_handle_basic.tf.tmpl +++ /dev/null @@ -1,96 +0,0 @@ -# Create Folder in GCP Organization -resource "google_folder" "autokms_folder" { - provider = google-beta - display_name = "folder-example" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - deletion_protection = false -} - -# Create the key project -resource "google_project" "key_project" { - provider = google-beta - project_id = "{{index $.Vars "key_project_name"}}" - name = "{{index $.Vars "key_project_name"}}" - folder_id = google_folder.autokms_folder.folder_id - billing_account = "{{index $.TestEnvVars "billing_account"}}" - depends_on = [google_folder.autokms_folder] - deletion_policy = "DELETE" -} - -# Create the resource project -resource "google_project" "resource_project" { - provider = google-beta - project_id = "{{index $.Vars "resource_project_name"}}" - name = "{{index $.Vars "resource_project_name"}}" - folder_id = google_folder.autokms_folder.folder_id - billing_account = "{{index $.TestEnvVars "billing_account"}}" - depends_on = [google_folder.autokms_folder] - deletion_policy = "DELETE" -} - -# Enable the Cloud KMS API -resource "google_project_service" "kms_api_service" { - provider = google-beta - service = "cloudkms.googleapis.com" - project = google_project.key_project.project_id - disable_on_destroy = false - disable_dependent_services = true - depends_on = [google_project.key_project] -} - -# Wait delay after enabling APIs -resource "time_sleep" "wait_enable_service_api" { - depends_on = [google_project_service.kms_api_service] - create_duration = "30s" -} - -#Create KMS Service Agent -resource "google_project_service_identity" "kms_service_agent" { - provider = google-beta - service = "cloudkms.googleapis.com" - project = google_project.key_project.number - depends_on = [time_sleep.wait_enable_service_api] -} - -# Wait delay after creating service agent. -resource "time_sleep" "wait_service_agent" { - depends_on = [google_project_service_identity.kms_service_agent] - create_duration = "10s" -} - -#Grant the KMS Service Agent the Cloud KMS Admin role -resource "google_project_iam_member" "autokey_project_admin" { - provider = google-beta - project = google_project.key_project.project_id - role = "roles/cloudkms.admin" - member = "serviceAccount:service-${google_project.key_project.number}@gcp-sa-cloudkms.iam.gserviceaccount.com" - depends_on = [time_sleep.wait_service_agent] -} - -# Wait delay after granting IAM permissions -resource "time_sleep" "wait_srv_acc_permissions" { - create_duration = "10s" - depends_on = [google_project_iam_member.autokey_project_admin] -} - -resource "google_kms_autokey_config" "autokey_config" { - provider = google-beta - folder = google_folder.autokms_folder.folder_id - key_project = "projects/${google_project.key_project.project_id}" - depends_on = [time_sleep.wait_srv_acc_permissions] -} - -# Wait delay for autokey config to take effect -resource "time_sleep" "wait_autokey_config" { - create_duration = "10s" - depends_on = [google_kms_autokey_config.autokey_config] -} - -resource "google_kms_key_handle" "{{$.PrimaryResourceId}}" { - provider = google-beta - project = google_project.resource_project.project_id - name = "example-key-handle" - location = "global" - resource_type_selector = "storage.googleapis.com/Bucket" - depends_on = [time_sleep.wait_autokey_config] -} diff --git a/mmv1/templates/terraform/examples/go/kms_key_ring_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_key_ring_basic.tf.tmpl deleted file mode 100644 index b5c4f5c1ac23..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_key_ring_basic.tf.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -resource "google_kms_key_ring" "{{$.PrimaryResourceId}}" { - name = "keyring-example" - location = "global" -} diff --git a/mmv1/templates/terraform/examples/go/kms_key_ring_import_job.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_key_ring_import_job.tf.tmpl deleted file mode 100644 index 5ca047e3b736..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_key_ring_import_job.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_kms_key_ring" "keyring" { - name = "{{index $.Vars "keyring"}}" - location = "global" -} - -resource "google_kms_crypto_key" "example-key" { - name = "{{index $.Vars "cryptokey"}}"" - key_ring = google_kms_key_ring.keyring.id - skip_initial_version_creation = true -} - -resource "google_kms_key_ring_import_job" "{{$.PrimaryResourceId}}" { - key_ring = google_kms_key_ring.keyring.id - import_job_id = "my-import-job" - - import_method = "RSA_OAEP_3072_SHA1_AES_256" - protection_level = "SOFTWARE" -} diff --git a/mmv1/templates/terraform/examples/go/kms_secret_ciphertext_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/kms_secret_ciphertext_basic.tf.tmpl deleted file mode 100644 index 117d51df8d26..000000000000 --- a/mmv1/templates/terraform/examples/go/kms_secret_ciphertext_basic.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -resource "google_kms_key_ring" "keyring" { - name = "keyring-example" - location = "global" -} - -resource "google_kms_crypto_key" "cryptokey" { - name = "crypto-key-example" - key_ring = google_kms_key_ring.keyring.id - rotation_period = "7776000s" - - lifecycle { - prevent_destroy = true - } -} - -resource "google_kms_secret_ciphertext" "{{$.PrimaryResourceId}}" { - crypto_key = google_kms_crypto_key.cryptokey.id - plaintext = "my-secret-password" -} - -resource "google_compute_instance" "instance" { - name = "{{index $.Vars "instance_name"}}" - machine_type = "e2-medium" - zone = "us-central1-a" - - boot_disk { - initialize_params { - image = "debian-cloud/debian-11" - } - } - - network_interface { - network = "default" - - access_config { - } - } - - metadata = { - password = google_kms_secret_ciphertext.{{$.PrimaryResourceId}}.ciphertext - } -} diff --git a/mmv1/templates/terraform/examples/go/logging_folder_settings_all.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_folder_settings_all.tf.tmpl deleted file mode 100644 index fbd552c14b33..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_folder_settings_all.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_logging_folder_settings" "{{$.PrimaryResourceId}}" { - disable_default_sink = true - folder = google_folder.my_folder.folder_id - kms_key_name = "{{index $.Vars "key_name"}}" - storage_location = "us-central1" - depends_on = [ google_kms_crypto_key_iam_member.iam ] -} - -resource "google_folder" "my_folder" { - display_name = "{{index $.Vars "folder_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - deletion_protection = false -} - -data "google_logging_folder_settings" "settings" { - folder = google_folder.my_folder.folder_id -} - -resource "google_kms_crypto_key_iam_member" "iam" { - crypto_key_id = "{{index $.Vars "key_name"}}" - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:${data.google_logging_folder_settings.settings.kms_service_account_id}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/logging_linked_dataset_all_params.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_linked_dataset_all_params.tf.tmpl deleted file mode 100644 index c50306e3e073..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_linked_dataset_all_params.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { - location = "global" - project = "{{index $.TestEnvVars "project"}}" - enable_analytics = true - bucket_id = "{{index $.Vars "bucket_id"}}" -} - -resource "google_logging_linked_dataset" "{{$.PrimaryResourceId}}" { - link_id = "{{index $.Vars "link_id"}}" - bucket = "{{index $.Vars "bucket_id"}}" - parent = "projects/{{index $.TestEnvVars "project"}}" - location = "global" - description = "Linked dataset test" - - depends_on = ["google_logging_project_bucket_config.{{$.PrimaryResourceId}}"] -} diff --git a/mmv1/templates/terraform/examples/go/logging_linked_dataset_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_linked_dataset_basic.tf.tmpl deleted file mode 100644 index 11220dfe8c7e..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_linked_dataset_basic.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { - location = "global" - project = "{{index $.TestEnvVars "project"}}" - enable_analytics = true - bucket_id = "{{index $.Vars "bucket_id"}}" -} - -resource "google_logging_linked_dataset" "{{$.PrimaryResourceId}}" { - link_id = "{{index $.Vars "link_id"}}" - bucket = google_logging_project_bucket_config.{{$.PrimaryResourceId}}.id - description = "Linked dataset test" -} diff --git a/mmv1/templates/terraform/examples/go/logging_log_view_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_log_view_basic.tf.tmpl deleted file mode 100644 index be900870a59a..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_log_view_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project"}}" - location = "global" - retention_days = 30 - bucket_id = "_Default" -} - -resource "google_logging_log_view" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "log_view_name"}}" - bucket = google_logging_project_bucket_config.{{$.PrimaryResourceId}}.id - description = "A logging view configured with Terraform" - filter = "SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")" -} diff --git a/mmv1/templates/terraform/examples/go/logging_log_view_long_name.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_log_view_long_name.tf.tmpl deleted file mode 100644 index bc834e6dea38..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_log_view_long_name.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project"}}" - location = "global" - retention_days = 30 - bucket_id = "_Default" -} - -resource "google_logging_log_view" "{{$.PrimaryResourceId}}" { - name = "projects/{{index $.TestEnvVars "project"}}/locations/global/buckets/_Default/views/tf-test-view%{random_suffix}" - bucket = google_logging_project_bucket_config.{{$.PrimaryResourceId}}.id - description = "A logging view configured with Terraform" - filter = "SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")" -} diff --git a/mmv1/templates/terraform/examples/go/logging_metric_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_metric_basic.tf.tmpl deleted file mode 100644 index ff5a467f4729..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_metric_basic.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -resource "google_logging_metric" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "logging_metric_name"}}" - filter = "resource.type=gae_app AND severity>=ERROR" - metric_descriptor { - metric_kind = "DELTA" - value_type = "DISTRIBUTION" - unit = "1" - labels { - key = "mass" - value_type = "STRING" - description = "amount of matter" - } - labels { - key = "sku" - value_type = "INT64" - description = "Identifying number for item" - } - display_name = "My metric" - } - value_extractor = "EXTRACT(jsonPayload.request)" - label_extractors = { - "mass" = "EXTRACT(jsonPayload.request)" - "sku" = "EXTRACT(jsonPayload.id)" - } - bucket_options { - linear_buckets { - num_finite_buckets = 3 - width = 1 - offset = 1 - } - } -} diff --git a/mmv1/templates/terraform/examples/go/logging_metric_counter_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_metric_counter_basic.tf.tmpl deleted file mode 100644 index d3fd6708fd1d..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_metric_counter_basic.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_logging_metric" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "logging_metric_name"}}" - filter = "resource.type=gae_app AND severity>=ERROR" - metric_descriptor { - metric_kind = "DELTA" - value_type = "INT64" - } -} diff --git a/mmv1/templates/terraform/examples/go/logging_metric_counter_labels.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_metric_counter_labels.tf.tmpl deleted file mode 100644 index 408c18f94ea8..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_metric_counter_labels.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_logging_metric" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "logging_metric_name"}}" - filter = "resource.type=gae_app AND severity>=ERROR" - metric_descriptor { - metric_kind = "DELTA" - value_type = "INT64" - labels { - key = "mass" - value_type = "STRING" - description = "amount of matter" - } - } - label_extractors = { - "mass" = "EXTRACT(jsonPayload.request)" - } -} diff --git a/mmv1/templates/terraform/examples/go/logging_metric_disabled.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_metric_disabled.tf.tmpl deleted file mode 100644 index a3420310141e..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_metric_disabled.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_logging_metric" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "logging_metric_name"}}" - filter = "resource.type=gae_app AND severity>=ERROR" - metric_descriptor { - metric_kind = "DELTA" - value_type = "INT64" - } - disabled = true -} diff --git a/mmv1/templates/terraform/examples/go/logging_metric_logging_bucket.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_metric_logging_bucket.tf.tmpl deleted file mode 100644 index 08dfacb2a201..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_metric_logging_bucket.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { - location = "global" - project = "{{index $.TestEnvVars "project"}}" - bucket_id = "_Default" -} - -resource "google_logging_metric" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "logging_metric_name"}}" - filter = "resource.type=gae_app AND severity>=ERROR" - bucket_name = google_logging_project_bucket_config.{{$.PrimaryResourceId}}.id -} diff --git a/mmv1/templates/terraform/examples/go/logging_organization_settings_all.tf.tmpl b/mmv1/templates/terraform/examples/go/logging_organization_settings_all.tf.tmpl deleted file mode 100644 index fa2730168dee..000000000000 --- a/mmv1/templates/terraform/examples/go/logging_organization_settings_all.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_logging_organization_settings" "{{$.PrimaryResourceId}}" { - disable_default_sink = true - kms_key_name = "{{index $.Vars "key_name"}}" - organization = "{{index $.TestEnvVars "org_id"}}" - storage_location = "us-central1" - depends_on = [ google_kms_crypto_key_iam_member.iam ] -} - -data "google_logging_organization_settings" "settings" { - organization = "{{index $.TestEnvVars "org_id"}}" -} - -resource "google_kms_crypto_key_iam_member" "iam" { - crypto_key_id = "{{index $.Vars "key_name"}}" - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:${data.google_logging_organization_settings.settings.kms_service_account_id}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/looker_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/looker_instance_basic.tf.tmpl deleted file mode 100644 index 5e7d34314cac..000000000000 --- a/mmv1/templates/terraform/examples/go/looker_instance_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_looker_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - platform_edition = "LOOKER_CORE_STANDARD_ANNUAL" - region = "us-central1" - oauth_config { - client_id = "{{index $.Vars "client_id"}}" - client_secret = "{{index $.Vars "client_secret"}}" - } -} diff --git a/mmv1/templates/terraform/examples/go/looker_instance_custom_domain.tf.tmpl b/mmv1/templates/terraform/examples/go/looker_instance_custom_domain.tf.tmpl deleted file mode 100644 index e86f5215539f..000000000000 --- a/mmv1/templates/terraform/examples/go/looker_instance_custom_domain.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_looker_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - platform_edition = "LOOKER_CORE_STANDARD_ANNUAL" - region = "us-central1" - oauth_config { - client_id = "{{index $.Vars "client_id"}}" - client_secret = "{{index $.Vars "client_secret"}}" - } - // After your Looker (Google Cloud core) instance has been created, you can set up, view information about, or delete a custom domain for your instance. - // Therefore 2 terraform applies, one to create the instance, then another to set up the custom domain. - custom_domain { - domain = "{{index $.Vars "custom_domain"}}.com" - } -} diff --git a/mmv1/templates/terraform/examples/go/looker_instance_enterprise_full.tf.tmpl b/mmv1/templates/terraform/examples/go/looker_instance_enterprise_full.tf.tmpl deleted file mode 100644 index b0069af15cee..000000000000 --- a/mmv1/templates/terraform/examples/go/looker_instance_enterprise_full.tf.tmpl +++ /dev/null @@ -1,75 +0,0 @@ -resource "google_looker_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - platform_edition = "LOOKER_CORE_ENTERPRISE_ANNUAL" - region = "us-central1" - private_ip_enabled = true - public_ip_enabled = false - reserved_range = "${google_compute_global_address.looker_range.name}" - consumer_network = google_compute_network.looker_network.id - admin_settings { - allowed_email_domains = ["google.com"] - } - encryption_config { - kms_key_name = "{{index $.Vars "kms_key_name"}}" - } - maintenance_window { - day_of_week = "THURSDAY" - start_time { - hours = 22 - minutes = 0 - seconds = 0 - nanos = 0 - } - } - deny_maintenance_period { - start_date { - year = 2050 - month = 1 - day = 1 - } - end_date { - year = 2050 - month = 2 - day = 1 - } - time { - hours = 10 - minutes = 0 - seconds = 0 - nanos = 0 - } - } - oauth_config { - client_id = "{{index $.Vars "client_id"}}" - client_secret = "{{index $.Vars "client_secret"}}" - } - depends_on = [ - google_service_networking_connection.looker_vpc_connection - ] -} - -resource "google_service_networking_connection" "looker_vpc_connection" { - network = google_compute_network.looker_network.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.looker_range.name] -} - -resource "google_compute_global_address" "looker_range" { - name = "{{index $.Vars "address_name"}}" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 20 - network = google_compute_network.looker_network.id -} - -data "google_project" "project" {} - -resource "google_compute_network" "looker_network" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "{{index $.Vars "kms_key_name"}}" - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-looker.iam.gserviceaccount.com" -} diff --git a/mmv1/templates/terraform/examples/go/looker_instance_enterprise_full_test.tf.tmpl b/mmv1/templates/terraform/examples/go/looker_instance_enterprise_full_test.tf.tmpl deleted file mode 100644 index b10bef84c797..000000000000 --- a/mmv1/templates/terraform/examples/go/looker_instance_enterprise_full_test.tf.tmpl +++ /dev/null @@ -1,64 +0,0 @@ -resource "google_looker_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - platform_edition = "LOOKER_CORE_ENTERPRISE_ANNUAL" - region = "us-central1" - private_ip_enabled = true - public_ip_enabled = false - reserved_range = "${data.google_compute_global_address.looker_range.name}" - consumer_network = data.google_compute_network.looker_network.id - admin_settings { - allowed_email_domains = ["google.com"] - } - encryption_config { - kms_key_name = "{{index $.Vars "kms_key_name"}}" - } - maintenance_window { - day_of_week = "THURSDAY" - start_time { - hours = 22 - minutes = 0 - seconds = 0 - nanos = 0 - } - } - deny_maintenance_period { - start_date { - year = 2050 - month = 1 - day = 1 - } - end_date { - year = 2050 - month = 2 - day = 1 - } - time { - hours = 10 - minutes = 0 - seconds = 0 - nanos = 0 - } - } - oauth_config { - client_id = "{{index $.Vars "client_id"}}" - client_secret = "{{index $.Vars "client_secret"}}" - } - - depends_on = [google_kms_crypto_key_iam_member.crypto_key] -} - -data "google_compute_global_address" "looker_range" { - name = "{{index $.Vars "address_name"}}" -} - -data "google_project" "project" {} - -data "google_compute_network" "looker_network" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "{{index $.Vars "kms_key_name"}}" - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-looker.iam.gserviceaccount.com" -} diff --git a/mmv1/templates/terraform/examples/go/looker_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/go/looker_instance_full.tf.tmpl deleted file mode 100644 index 79e6c65721e5..000000000000 --- a/mmv1/templates/terraform/examples/go/looker_instance_full.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -resource "google_looker_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - platform_edition = "LOOKER_CORE_STANDARD_ANNUAL" - region = "us-central1" - public_ip_enabled = true - admin_settings { - allowed_email_domains = ["google.com"] - } - maintenance_window { - day_of_week = "THURSDAY" - start_time { - hours = 22 - minutes = 0 - seconds = 0 - nanos = 0 - } - } - deny_maintenance_period { - start_date { - year = 2050 - month = 1 - day = 1 - } - end_date { - year = 2050 - month = 2 - day = 1 - } - time { - hours = 10 - minutes = 0 - seconds = 0 - nanos = 0 - } - } - oauth_config { - client_id = "{{index $.Vars "client_id"}}" - client_secret = "{{index $.Vars "client_secret"}}" - } -} diff --git a/mmv1/templates/terraform/examples/go/machine_image_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/machine_image_basic.tf.tmpl deleted file mode 100644 index d3e7e3790c29..000000000000 --- a/mmv1/templates/terraform/examples/go/machine_image_basic.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_compute_instance" "vm" { - provider = google-beta - name = "{{index $.Vars "vm_name"}}" - machine_type = "e2-medium" - - boot_disk { - initialize_params { - image = "debian-cloud/debian-11" - } - } - - network_interface { - network = "default" - } -} - -resource "google_compute_machine_image" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "image_name"}}" - source_instance = google_compute_instance.vm.self_link -} diff --git a/mmv1/templates/terraform/examples/go/managed_ssl_certificate_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/managed_ssl_certificate_basic.tf.tmpl deleted file mode 100644 index 9ed1db7e9f0c..000000000000 --- a/mmv1/templates/terraform/examples/go/managed_ssl_certificate_basic.tf.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -resource "google_compute_managed_ssl_certificate" "default" { - name = "{{index $.Vars "cert_name"}}" - - managed { - domains = ["sslcert.tf-test.club."] - } -} - -resource "google_compute_target_https_proxy" "default" { - name = "{{index $.Vars "proxy_name"}}" - url_map = google_compute_url_map.default.id - ssl_certificates = [google_compute_managed_ssl_certificate.default.id] -} - -resource "google_compute_url_map" "default" { - name = "{{index $.Vars "url_map_name"}}" - description = "a description" - - default_service = google_compute_backend_service.default.id - - host_rule { - hosts = ["sslcert.tf-test.club"] - path_matcher = "allpaths" - } - - path_matcher { - name = "allpaths" - default_service = google_compute_backend_service.default.id - - path_rule { - paths = ["/*"] - service = google_compute_backend_service.default.id - } - } -} - -resource "google_compute_backend_service" "default" { - name = "{{index $.Vars "backend_service_name"}}" - port_name = "http" - protocol = "HTTP" - timeout_sec = 10 - - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} - -resource "google_compute_global_forwarding_rule" "default" { - name = "{{index $.Vars "forwarding_rule_name"}}" - target = google_compute_target_https_proxy.default.id - port_range = 443 -} diff --git a/mmv1/templates/terraform/examples/go/managed_ssl_certificate_recreation.tf.tmpl b/mmv1/templates/terraform/examples/go/managed_ssl_certificate_recreation.tf.tmpl deleted file mode 100644 index ea026e29ef4b..000000000000 --- a/mmv1/templates/terraform/examples/go/managed_ssl_certificate_recreation.tf.tmpl +++ /dev/null @@ -1,66 +0,0 @@ -// This example allows the list of managed domains to be modified and will -// recreate the ssl certificate and update the target https proxy correctly - -resource "google_compute_target_https_proxy" "default" { - name = "test-proxy" - url_map = google_compute_url_map.default.id - ssl_certificates = [google_compute_managed_ssl_certificate.cert.id] -} - -locals { - managed_domains = tolist(["test.example.com"]) -} - -resource "random_id" "certificate" { - byte_length = 4 - prefix = "issue6147-cert-" - - keepers = { - domains = join(",", local.managed_domains) - } -} - -resource "google_compute_managed_ssl_certificate" "cert" { - name = random_id.certificate.hex - - lifecycle { - create_before_destroy = true - } - - managed { - domains = local.managed_domains - } -} - -resource "google_compute_url_map" "default" { - name = "url-map" - description = "a description" - default_service = google_compute_backend_service.default.id - host_rule { - hosts = ["mysite.com"] - path_matcher = "allpaths" - } - path_matcher { - name = "allpaths" - default_service = google_compute_backend_service.default.id - path_rule { - paths = ["/*"] - service = google_compute_backend_service.default.id - } - } -} - -resource "google_compute_backend_service" "default" { - name = "backend-service" - port_name = "http" - protocol = "HTTP" - timeout_sec = 10 - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - name = "http-health-check" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} diff --git a/mmv1/templates/terraform/examples/go/managedkafka_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/managedkafka_cluster_basic.tf.tmpl deleted file mode 100644 index 7b85bb69ef83..000000000000 --- a/mmv1/templates/terraform/examples/go/managedkafka_cluster_basic.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_managed_kafka_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "cluster_id"}}" - location = "us-central1" - capacity_config { - vcpu_count = 3 - memory_bytes = 3221225472 - } - gcp_config { - access_config { - network_configs { - subnet = "projects/${data.google_project.project.number}/regions/us-central1/subnetworks/default" - } - } - } - rebalance_config { - mode = "NO_REBALANCE" - } - labels = { - key = "value" - } - - provider = google-beta -} - -data "google_project" "project" { - provider = google-beta -} diff --git a/mmv1/templates/terraform/examples/go/managedkafka_cluster_cmek.tf.tmpl b/mmv1/templates/terraform/examples/go/managedkafka_cluster_cmek.tf.tmpl deleted file mode 100644 index b8c8a8431bbf..000000000000 --- a/mmv1/templates/terraform/examples/go/managedkafka_cluster_cmek.tf.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -resource "google_managed_kafka_cluster" "{{$.PrimaryResourceId}}" { - cluster_id = "{{index $.Vars "cluster_id"}}" - location = "us-central1" - capacity_config { - vcpu_count = 3 - memory_bytes = 3221225472 - } - gcp_config { - access_config { - network_configs { - subnet = "projects/${data.google_project.project.number}/regions/us-central1/subnetworks/default" - } - } - kms_key = google_kms_crypto_key.key.id - } - - provider = google-beta -} - -resource "google_project_service_identity" "kafka_service_identity" { - project = data.google_project.project.project_id - service = "managedkafka.googleapis.com" - - provider = google-beta -} - -resource "google_kms_crypto_key" "key" { - name = "{{index $.Vars "key_name"}}" - key_ring = google_kms_key_ring.key_ring.id - - provider = google-beta -} - -resource "google_kms_key_ring" "key_ring" { - name = "{{index $.Vars "key_ring_name"}}" - location = "us-central1" - - provider = google-beta -} - -resource "google_kms_crypto_key_iam_binding" "crypto_key_binding" { - crypto_key_id = google_kms_crypto_key.key.id - role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" - - members = [ - "serviceAccount:service-${data.google_project.project.number}@gcp-sa-managedkafka.iam.gserviceaccount.com", - ] - - provider = google-beta -} - -data "google_project" "project" { - provider = google-beta -} diff --git a/mmv1/templates/terraform/examples/go/managedkafka_topic_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/managedkafka_topic_basic.tf.tmpl deleted file mode 100644 index bf9c86760633..000000000000 --- a/mmv1/templates/terraform/examples/go/managedkafka_topic_basic.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -resource "google_managed_kafka_cluster" "cluster" { - cluster_id = "{{index $.Vars "cluster_id"}}" - location = "us-central1" - capacity_config { - vcpu_count = 3 - memory_bytes = 3221225472 - } - gcp_config { - access_config { - network_configs { - subnet = "projects/${data.google_project.project.number}/regions/us-central1/subnetworks/default" - } - } - } - - provider = google-beta -} - -resource "google_managed_kafka_topic" "{{$.PrimaryResourceId}}" { - topic_id = "{{index $.Vars "topic_id"}}" - cluster = google_managed_kafka_cluster.cluster.cluster_id - location = "us-central1" - partition_count = 2 - replication_factor = 3 - configs = { - "cleanup.policy" = "compact" - } - - provider = google-beta -} - -data "google_project" "project" { - provider = google-beta -} diff --git a/mmv1/templates/terraform/examples/go/memcache_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/memcache_instance_basic.tf.tmpl deleted file mode 100644 index 932acaa30c92..000000000000 --- a/mmv1/templates/terraform/examples/go/memcache_instance_basic.tf.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -// This example assumes this network already exists. -// The API creates a tenant network per network authorized for a -// Memcache instance and that network is not deleted when the user-created -// network (authorized_network) is deleted, so this prevents issues -// with tenant network quota. -// If this network hasn't been created and you are using this example in your -// config, add an additional network resource or change -// this from "data"to "resource" -resource "google_compute_network" "memcache_network" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_compute_global_address" "service_range" { - name = "{{index $.Vars "address_name"}}" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 16 - network = google_compute_network.memcache_network.id -} - -resource "google_service_networking_connection" "private_service_connection" { - network = google_compute_network.memcache_network.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.service_range.name] -} - -resource "google_memcache_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - authorized_network = google_service_networking_connection.private_service_connection.network - - labels = { - env = "test" - } - - node_config { - cpu_count = 1 - memory_size_mb = 1024 - } - node_count = 1 - memcache_version = "MEMCACHE_1_5" - - maintenance_policy { - weekly_maintenance_window { - day = "SATURDAY" - duration = "14400s" - start_time { - hours = 0 - minutes = 30 - seconds = 0 - nanos = 0 - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/memcache_instance_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/go/memcache_instance_basic_test.tf.tmpl deleted file mode 100644 index c9f5c6b5f4b0..000000000000 --- a/mmv1/templates/terraform/examples/go/memcache_instance_basic_test.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -// This example assumes this network already exists. -// The API creates a tenant network per network authorized for a -// Memcache instance and that network is not deleted when the user-created -// network (authorized_network) is deleted, so this prevents issues -// with tenant network quota. -// If this network hasn't been created and you are using this example in your -// config, add an additional network resource or change -// this from "data"to "resource" -data "google_compute_network" "memcache_network" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_memcache_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - authorized_network = data.google_compute_network.memcache_network.id - - labels = { - env = "test" - } - - node_config { - cpu_count = 1 - memory_size_mb = 1024 - } - node_count = 1 - memcache_version = "MEMCACHE_1_5" - - maintenance_policy { - weekly_maintenance_window { - day = "SATURDAY" - duration = "14400s" - start_time { - hours = 0 - minutes = 30 - seconds = 0 - nanos = 0 - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/memorystore_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/memorystore_instance_basic.tf.tmpl deleted file mode 100644 index c8db3451c720..000000000000 --- a/mmv1/templates/terraform/examples/go/memorystore_instance_basic.tf.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -resource "google_memorystore_instance" "{{$.PrimaryResourceId}}" { - provider = google-beta - instance_id = "{{index $.Vars "instance_name"}}" - shard_count = 3 - desired_psc_auto_connections { - network = google_compute_network.producer_net.id - project_id = data.google_project.project.project_id - } - location = "us-central1" - deletion_protection_enabled = false - depends_on = [ - google_network_connectivity_service_connection_policy.default - ] - - lifecycle { - prevent_destroy = "{{index $.Vars "prevent_destroy"}}" - } -} - -resource "google_network_connectivity_service_connection_policy" "default" { - provider = google-beta - name = "{{index $.Vars "policy_name"}}" - location = "us-central1" - service_class = "gcp-memorystore" - description = "my basic service connection policy" - network = google_compute_network.producer_net.id - psc_config { - subnetworks = [google_compute_subnetwork.producer_subnet.id] - } -} - -resource "google_compute_subnetwork" "producer_subnet" { - provider = google-beta - name = "{{index $.Vars "subnet_name"}}" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.producer_net.id -} - -resource "google_compute_network" "producer_net" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -data "google_project" "project" { - provider = google-beta -} diff --git a/mmv1/templates/terraform/examples/go/memorystore_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/go/memorystore_instance_full.tf.tmpl deleted file mode 100644 index 58128a095461..000000000000 --- a/mmv1/templates/terraform/examples/go/memorystore_instance_full.tf.tmpl +++ /dev/null @@ -1,70 +0,0 @@ -resource "google_memorystore_instance" "{{$.PrimaryResourceId}}" { - provider = google-beta - instance_id = "{{index $.Vars "instance_name"}}" - shard_count = 3 - desired_psc_auto_connections { - network = google_compute_network.producer_net.id - project_id = data.google_project.project.project_id - } - location = "us-central1" - replica_count = 2 - node_type = "SHARED_CORE_NANO" - transit_encryption_mode = "TRANSIT_ENCRYPTION_DISABLED" - authorization_mode = "AUTH_DISABLED" - engine_configs = { - maxmemory-policy = "volatile-ttl" - } - zone_distribution_config { - mode = "SINGLE_ZONE" - zone = "us-central1-b" - } - engine_version = "VALKEY_7_2" - deletion_protection_enabled = false - persistence_config { - mode = "RDB" - rdb_config { - rdb_snapshot_period = "ONE_HOUR" - rdb_snapshot_start_time = "2024-10-02T15:01:23Z" - } - } - labels = { - "abc" : "xyz" - } - depends_on = [ - google_network_connectivity_service_connection_policy.default - ] - - lifecycle { - prevent_destroy = "{{index $.Vars "prevent_destroy"}}" - } -} - -resource "google_network_connectivity_service_connection_policy" "default" { - provider = google-beta - name = "{{index $.Vars "policy_name"}}" - location = "us-central1" - service_class = "gcp-memorystore" - description = "my basic service connection policy" - network = google_compute_network.producer_net.id - psc_config { - subnetworks = [google_compute_subnetwork.producer_subnet.id] - } -} - -resource "google_compute_subnetwork" "producer_subnet" { - provider = google-beta - name = "{{index $.Vars "subnet_name"}}" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.producer_net.id -} - -resource "google_compute_network" "producer_net" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -data "google_project" "project" { - provider = google-beta -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/memorystore_instance_persistence_aof.tf.tmpl b/mmv1/templates/terraform/examples/go/memorystore_instance_persistence_aof.tf.tmpl deleted file mode 100644 index 8bd11ec0f648..000000000000 --- a/mmv1/templates/terraform/examples/go/memorystore_instance_persistence_aof.tf.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -resource "google_memorystore_instance" "{{$.PrimaryResourceId}}" { - provider = google-beta - instance_id = "{{index $.Vars "instance_name"}}" - shard_count = 3 - desired_psc_auto_connections { - network = google_compute_network.producer_net.id - project_id = data.google_project.project.project_id - } - location = "us-central1" - persistence_config { - mode = "AOF" - aof_config { - append_fsync = "EVERY_SEC" - } - } - depends_on = [ - google_network_connectivity_service_connection_policy.default - ] - deletion_protection_enabled = false - lifecycle { - prevent_destroy = "{{index $.Vars "prevent_destroy"}}" - } -} - -resource "google_network_connectivity_service_connection_policy" "default" { - provider = google-beta - name = "{{index $.Vars "policy_name"}}" - location = "us-central1" - service_class = "gcp-memorystore" - description = "my basic service connection policy" - network = google_compute_network.producer_net.id - psc_config { - subnetworks = [google_compute_subnetwork.producer_subnet.id] - } -} - -resource "google_compute_subnetwork" "producer_subnet" { - provider = google-beta - name = "{{index $.Vars "subnet_name"}}" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.producer_net.id -} - -resource "google_compute_network" "producer_net" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -data "google_project" "project" { - provider = google-beta -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/migration_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/migration_group_basic.tf.tmpl deleted file mode 100644 index 0be6b297b569..000000000000 --- a/mmv1/templates/terraform/examples/go/migration_group_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_migration_center_group" "{{$.PrimaryResourceId}}" { - location = "us-central1" - group_id = "{{index $.Vars "group_name"}}" - description = "Terraform integration test description" - display_name = "Terraform integration test display" - labels = { - key = "value" - } -} diff --git a/mmv1/templates/terraform/examples/go/ml_model_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/ml_model_basic.tf.tmpl deleted file mode 100644 index cd563d154a94..000000000000 --- a/mmv1/templates/terraform/examples/go/ml_model_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_ml_engine_model" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "model_name"}}" - description = "My model" - regions = ["us-central1"] -} diff --git a/mmv1/templates/terraform/examples/go/ml_model_full.tf.tmpl b/mmv1/templates/terraform/examples/go/ml_model_full.tf.tmpl deleted file mode 100644 index 13ff69dc5754..000000000000 --- a/mmv1/templates/terraform/examples/go/ml_model_full.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_ml_engine_model" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "model_name"}}" - description = "My model" - regions = ["us-central1"] - labels = { - my_model = "foo" - } - online_prediction_logging = true - online_prediction_console_logging = true -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_alert_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_alert_policy_basic.tf.tmpl deleted file mode 100644 index 3cc86dd89b11..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_alert_policy_basic.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_monitoring_alert_policy" "{{$.PrimaryResourceId}}" { - display_name = "{{index $.Vars "alert_policy_display_name"}}" - combiner = "OR" - conditions { - display_name = "test condition" - condition_threshold { - filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"" - duration = "60s" - comparison = "COMPARISON_GT" - aggregations { - alignment_period = "60s" - per_series_aligner = "ALIGN_RATE" - } - } - } - - user_labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_alert_policy_evaluation_missing_data.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_alert_policy_evaluation_missing_data.tf.tmpl deleted file mode 100644 index c1f130774281..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_alert_policy_evaluation_missing_data.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_monitoring_alert_policy" "{{$.PrimaryResourceId}}" { - display_name = "{{index $.Vars "alert_policy_display_name"}}" - combiner = "OR" - conditions { - display_name = "test condition" - condition_threshold { - filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"" - duration = "60s" - comparison = "COMPARISON_GT" - aggregations { - alignment_period = "60s" - per_series_aligner = "ALIGN_RATE" - } - evaluation_missing_data = "EVALUATION_MISSING_DATA_INACTIVE" - } - } - - user_labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_alert_policy_forecast_options.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_alert_policy_forecast_options.tf.tmpl deleted file mode 100644 index 32f87463f336..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_alert_policy_forecast_options.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_monitoring_alert_policy" "{{$.PrimaryResourceId}}" { - display_name = "{{index $.Vars "alert_policy_display_name"}}" - combiner = "OR" - conditions { - display_name = "test condition" - condition_threshold { - filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"" - duration = "60s" - forecast_options { - forecast_horizon = "3600s" - } - comparison = "COMPARISON_GT" - aggregations { - alignment_period = "60s" - per_series_aligner = "ALIGN_RATE" - } - } - } - - user_labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_alert_policy_promql_condition.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_alert_policy_promql_condition.tf.tmpl deleted file mode 100644 index 78695c4f5be4..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_alert_policy_promql_condition.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_monitoring_alert_policy" "{{$.PrimaryResourceId}}" { - display_name = "{{index $.Vars "alert_policy_display_name"}}" - combiner = "OR" - conditions { - display_name = "test condition" - condition_prometheus_query_language { - query = "compute_googleapis_com:instance_cpu_usage_time > 0" - duration = "60s" - evaluation_interval = "60s" - alert_rule = "AlwaysOn" - rule_group = "a test" - } - } - - alert_strategy { - auto_close = "1800s" - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_group_basic.tf.tmpl deleted file mode 100644 index 4e0170e7cdb1..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_group_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_monitoring_group" "{{$.PrimaryResourceId}}" { - display_name = "tf-test {{index $.Vars "display_name"}}" - - filter = "resource.metadata.region=\"europe-west2\"" -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_group_subgroup.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_group_subgroup.tf.tmpl deleted file mode 100644 index 8a15d386d5c2..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_group_subgroup.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_monitoring_group" "parent" { - display_name = "tf-test {{index $.Vars "display_name"}}" - filter = "resource.metadata.region=\"europe-west2\"" -} - -resource "google_monitoring_group" "{{$.PrimaryResourceId}}" { - display_name = "tf-test {{index $.Vars "display_name2"}}" - filter = "resource.metadata.region=\"europe-west2\"" - parent_name = google_monitoring_group.parent.name -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_metric_descriptor_alert.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_metric_descriptor_alert.tf.tmpl deleted file mode 100644 index 99076471e60f..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_metric_descriptor_alert.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_monitoring_metric_descriptor" "{{$.PrimaryResourceId}}" { - description = "Daily sales records from all branch stores." - display_name = "{{index $.Vars "display_name"}}" - type = "custom.googleapis.com/stores/{{index $.Vars "type"}}" - metric_kind = "GAUGE" - value_type = "DOUBLE" - unit = "{USD}" -} - -resource "google_monitoring_alert_policy" "alert_policy" { - display_name = "{{index $.Vars "display_name"}}" - combiner = "OR" - conditions { - display_name = "test condition" - condition_threshold { - filter = "metric.type=\"${google_monitoring_metric_descriptor.{{$.PrimaryResourceId}}.type}\" AND resource.type=\"gce_instance\"" - duration = "60s" - comparison = "COMPARISON_GT" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_metric_descriptor_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_metric_descriptor_basic.tf.tmpl deleted file mode 100644 index d21fb76c418e..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_metric_descriptor_basic.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_monitoring_metric_descriptor" "{{$.PrimaryResourceId}}" { - description = "Daily sales records from all branch stores." - display_name = "{{index $.Vars "display_name"}}" - type = "custom.googleapis.com/stores/{{index $.Vars "type"}}" - metric_kind = "GAUGE" - value_type = "DOUBLE" - unit = "{USD}" - labels { - key = "store_id" - value_type = "STRING" - description = "The ID of the store." - } - launch_stage = "BETA" - metadata { - sample_period = "60s" - ingest_delay = "30s" - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_monitored_project_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_monitored_project_basic.tf.tmpl deleted file mode 100644 index a043ba953711..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_monitored_project_basic.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_monitoring_monitored_project" "{{$.PrimaryResourceId}}" { - metrics_scope = "{{index $.TestEnvVars "project_id"}}" - name = google_project.basic.project_id -} - -resource "google_project" "basic" { - project_id = "{{index $.Vars "monitored_project"}}" - name = "{{index $.Vars "monitored_project"}}-display" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_monitored_project_long_form.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_monitored_project_long_form.tf.tmpl deleted file mode 100644 index c26cdc569f60..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_monitored_project_long_form.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_monitoring_monitored_project" "{{$.PrimaryResourceId}}" { - metrics_scope = "{{index $.TestEnvVars "project_id"}}" - name = "locations/global/metricsScopes/{{index $.TestEnvVars "project_id"}}/projects/${google_project.basic.project_id}" -} - -resource "google_project" "basic" { - project_id = "{{index $.Vars "monitored_project"}}" - name = "{{index $.Vars "monitored_project"}}-display" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_service_custom.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_service_custom.tf.tmpl deleted file mode 100644 index ccb6de98dfe8..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_service_custom.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_monitoring_custom_service" "{{$.PrimaryResourceId}}" { - service_id = "{{index $.Vars "service_id"}}" - display_name = "My Custom Service {{index $.Vars "service_id"}}" - - telemetry { - resource_name = "{{index $.Vars "resource_name"}}" - } - - user_labels = { - my_key = "my_value" - my_other_key = "my_other_value" - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_service_example.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_service_example.tf.tmpl deleted file mode 100644 index 7c8576e2415f..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_service_example.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_monitoring_service" "{{$.PrimaryResourceId}}" { - service_id = "{{index $.Vars "service_id"}}" - display_name = "My Service {{index $.Vars "service_id"}}" - - user_labels = { - my_key = "my_value" - my_other_key = "my_other_value" - } - - basic_service { - service_type = "APP_ENGINE" - service_labels = { - module_id = "another-module-id" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_slo_appengine.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_slo_appengine.tf.tmpl deleted file mode 100644 index 2d1d044aed22..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_slo_appengine.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -data "google_monitoring_app_engine_service" "default" { - module_id = "default" -} - -resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { - service = data.google_monitoring_app_engine_service.default.service_id - - slo_id = "{{index $.Vars "slo_id"}}" - display_name = "Terraform Test SLO for App Engine" - - goal = 0.9 - calendar_period = "DAY" - - basic_sli { - latency { - threshold = "1s" - } - } - - user_labels = { - my_key = "my_value" - my_other_key = "my_other_value" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/monitoring_slo_request_based.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_slo_request_based.tf.tmpl deleted file mode 100644 index 982536a97636..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_slo_request_based.tf.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -resource "google_monitoring_custom_service" "customsrv" { - service_id = "{{index $.Vars "service_id"}}" - display_name = "My Custom Service" -} - -resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { - service = google_monitoring_custom_service.customsrv.service_id - slo_id = "{{index $.Vars "slo_id"}}" - display_name = "Terraform Test SLO with request based SLI (good total ratio)" - - goal = 0.9 - rolling_period_days = 30 - - request_based_sli { - distribution_cut { - distribution_filter = "metric.type=\"serviceruntime.googleapis.com/api/request_latencies\" resource.type=\"api\" " - range { - max = 0.5 - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_good_bad_metric_filter.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_good_bad_metric_filter.tf.tmpl deleted file mode 100644 index aeda66fb1e8f..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_good_bad_metric_filter.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_monitoring_custom_service" "customsrv" { - service_id = "{{index $.Vars "service_id"}}" - display_name = "My Custom Service" -} - -resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { - service = google_monitoring_custom_service.customsrv.service_id - display_name = "Terraform Test SLO with window based SLI" - - goal = 0.95 - calendar_period = "FORTNIGHT" - - windows_based_sli { - window_period = "400s" - good_bad_metric_filter = join(" AND ", [ - "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\"", - "resource.type=\"uptime_url\"", - ]) - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_metric_mean.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_metric_mean.tf.tmpl deleted file mode 100644 index f9c9f26652ef..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_metric_mean.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_monitoring_custom_service" "customsrv" { - service_id = "{{index $.Vars "service_id"}}" - display_name = "My Custom Service" -} - -resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { - service = google_monitoring_custom_service.customsrv.service_id - display_name = "Terraform Test SLO with window based SLI" - - goal = 0.9 - rolling_period_days = 20 - - windows_based_sli { - window_period = "600s" - metric_mean_in_range { - time_series = join(" AND ", [ - "metric.type=\"agent.googleapis.com/cassandra/client_request/latency/95p\"", - "resource.type=\"gce_instance\"", - ]) - - range { - max = 5 - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_metric_sum.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_metric_sum.tf.tmpl deleted file mode 100644 index df1e35b6842d..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_metric_sum.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_monitoring_custom_service" "customsrv" { - service_id = "{{index $.Vars "service_id"}}" - display_name = "My Custom Service" -} - -resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { - service = google_monitoring_custom_service.customsrv.service_id - display_name = "Terraform Test SLO with window based SLI" - - goal = 0.9 - rolling_period_days = 20 - - windows_based_sli { - window_period = "400s" - metric_sum_in_range { - time_series = join(" AND ", [ - "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\"", - "resource.type=\"uptime_url\"", - ]) - - range { - max = 5000 - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_ratio_threshold.tf.tmpl b/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_ratio_threshold.tf.tmpl deleted file mode 100644 index cf9619a4d88c..000000000000 --- a/mmv1/templates/terraform/examples/go/monitoring_slo_windows_based_ratio_threshold.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -resource "google_monitoring_custom_service" "customsrv" { - service_id = "{{index $.Vars "service_id"}}" - display_name = "My Custom Service" -} - -resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { - service = google_monitoring_custom_service.customsrv.service_id - display_name = "Terraform Test SLO with window based SLI" - - goal = 0.9 - rolling_period_days = 20 - - windows_based_sli { - window_period = "100s" - - good_total_ratio_threshold { - threshold = 0.1 - performance { - distribution_cut { - distribution_filter = join(" AND ", [ - "metric.type=\"serviceruntime.googleapis.com/api/request_latencies\"", - "resource.type=\"consumed_api\"", - ]) - - range { - min = 1 - max = 9 - } - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/netapp_active_directory_full.tf.tmpl b/mmv1/templates/terraform/examples/go/netapp_active_directory_full.tf.tmpl deleted file mode 100644 index 0337e2f9e0c7..000000000000 --- a/mmv1/templates/terraform/examples/go/netapp_active_directory_full.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_netapp_active_directory" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "active_directory_full_name"}}" - location = "us-central1" - domain = "ad.internal" - dns = "172.30.64.3" - net_bios_prefix = "smbserver" - username = "user" - password = "pass" - aes_encryption = false - backup_operators = ["test1", "test2"] - administrators = ["test1", "test2"] - description = "ActiveDirectory is the public representation of the active directory config." - encrypt_dc_connections = false - kdc_hostname = "hostname" - kdc_ip = "10.10.0.11" - labels = { - "foo": "bar" - } - ldap_signing = false - nfs_users_with_ldap = false - organizational_unit = "CN=Computers" - security_operators = ["test1", "test2"] - site = "test-site" - } diff --git a/mmv1/templates/terraform/examples/go/netapp_backup.tf.tmpl b/mmv1/templates/terraform/examples/go/netapp_backup.tf.tmpl deleted file mode 100644 index bb066449286e..000000000000 --- a/mmv1/templates/terraform/examples/go/netapp_backup.tf.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_netapp_storage_pool" "default" { - name = "{{index $.Vars "pool_name"}}" - location = "us-central1" - service_level = "PREMIUM" - capacity_gib = "2048" - network = data.google_compute_network.default.id -} - -resource "google_netapp_volume" "default" { - name = "{{index $.Vars "volume_name"}}" - location = google_netapp_storage_pool.default.location - capacity_gib = "100" - share_name = "{{index $.Vars "volume_name"}}" - storage_pool = google_netapp_storage_pool.default.name - protocols = ["NFSV3"] - deletion_policy = "FORCE" - backup_config { - backup_vault = google_netapp_backup_vault.default.id - } -} - -resource "google_netapp_backup_vault" "default" { - name = "{{index $.Vars "backup_vault_name"}}" - location = google_netapp_storage_pool.default.location -} - -resource "google_netapp_backup" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backup_name"}}" - location = google_netapp_backup_vault.default.location - vault_name = google_netapp_backup_vault.default.name - source_volume = google_netapp_volume.default.id -} diff --git a/mmv1/templates/terraform/examples/go/netapp_backup_policy_full.tf.tmpl b/mmv1/templates/terraform/examples/go/netapp_backup_policy_full.tf.tmpl deleted file mode 100644 index 70f778fcf97c..000000000000 --- a/mmv1/templates/terraform/examples/go/netapp_backup_policy_full.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_netapp_backup_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backup_policy_full_name"}}" - location = "us-central1" - daily_backup_limit = 2 - weekly_backup_limit = 1 - monthly_backup_limit = 1 - description = "TF test backup schedule" - enabled = true - labels = { - "foo" = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/netapp_backup_vault.tf.tmpl b/mmv1/templates/terraform/examples/go/netapp_backup_vault.tf.tmpl deleted file mode 100644 index 5a6bbc9d3de9..000000000000 --- a/mmv1/templates/terraform/examples/go/netapp_backup_vault.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_netapp_backup_vault" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "backup_vault_name"}}" - location = "us-central1" - description = "Terraform created vault" - labels = { - "creator": "testuser" - } -} diff --git a/mmv1/templates/terraform/examples/go/netapp_volume_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/netapp_volume_basic.tf.tmpl deleted file mode 100644 index fc71c1e25467..000000000000 --- a/mmv1/templates/terraform/examples/go/netapp_volume_basic.tf.tmpl +++ /dev/null @@ -1,21 +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" "{{$.PrimaryResourceId}}" { - location = "us-west2" - name = "{{index $.Vars "volume_name"}}" - capacity_gib = "100" - share_name = "{{index $.Vars "volume_name"}}" - storage_pool = google_netapp_storage_pool.default.name - protocols = ["NFSV3"] - deletion_policy = "DEFAULT" -} - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/netapp_volume_replication_create.tf.tmpl b/mmv1/templates/terraform/examples/go/netapp_volume_replication_create.tf.tmpl deleted file mode 100644 index a4a9e2cddedb..000000000000 --- a/mmv1/templates/terraform/examples/go/netapp_volume_replication_create.tf.tmpl +++ /dev/null @@ -1,54 +0,0 @@ - -data "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} - -resource "google_netapp_storage_pool" "source_pool" { - name = "{{index $.Vars "source_pool_name"}}" - location = "us-central1" - service_level = "PREMIUM" - capacity_gib = 2048 - network = data.google_compute_network.default.id -} - -resource "google_netapp_storage_pool" "destination_pool" { - name = "{{index $.Vars "destination_pool_name"}}" - location = "us-west2" - service_level = "PREMIUM" - capacity_gib = 2048 - network = data.google_compute_network.default.id -} - -resource "google_netapp_volume" "source_volume" { - location = google_netapp_storage_pool.source_pool.location - name = "{{index $.Vars "volume_name"}}" - capacity_gib = 100 - share_name = "{{index $.Vars "volume_name"}}" - storage_pool = google_netapp_storage_pool.source_pool.name - protocols = [ - "NFSV3" - ] - deletion_policy = "FORCE" -} - -resource "google_netapp_volume_replication" "{{$.PrimaryResourceId}}" { - depends_on = [google_netapp_volume.source_volume] - location = google_netapp_volume.source_volume.location - volume_name = google_netapp_volume.source_volume.name - name = "{{index $.Vars "replication_name"}}" - replication_schedule = "EVERY_10_MINUTES" - description = "This is a replication resource" - destination_volume_parameters { - storage_pool = google_netapp_storage_pool.destination_pool.id - volume_id = "{{index $.Vars "destination_volume"}}" - # Keeping the share_name of source and destination the same - # simplifies implementing client failover concepts - share_name = "{{index $.Vars "volume_name"}}" - description = "This is a replicated volume" - } - # WARNING: Setting delete_destination_volume to true, will delete the - # CURRENT destination volume if the replication is deleted. Omit the field - # or set delete_destination_volume=false to avoid accidental volume deletion. - delete_destination_volume = true - wait_for_mirror = true -} diff --git a/mmv1/templates/terraform/examples/go/network_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_attachment_basic.tf.tmpl deleted file mode 100644 index ec9f23221b61..000000000000 --- a/mmv1/templates/terraform/examples/go/network_attachment_basic.tf.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -resource "google_compute_network_attachment" "default" { - name = "{{index $.Vars "resource_name"}}" - region = "us-central1" - description = "basic network attachment description" - connection_preference = "ACCEPT_MANUAL" - - subnetworks = [ - google_compute_subnetwork.default.self_link - ] - - producer_accept_lists = [ - google_project.accepted_producer_project.project_id - ] - - producer_reject_lists = [ - google_project.rejected_producer_project.project_id - ] -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "subnetwork_name"}}" - region = "us-central1" - - network = google_compute_network.default.id - ip_cidr_range = "10.0.0.0/16" -} - -resource "google_project" "rejected_producer_project" { - project_id = "{{index $.Vars "rejected_producer_project_name"}}" - name = "{{index $.Vars "rejected_producer_project_name"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} - -resource "google_project" "accepted_producer_project" { - project_id = "{{index $.Vars "accepted_producer_project_name"}}" - name = "{{index $.Vars "accepted_producer_project_name"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - billing_account = "{{index $.TestEnvVars "billing_account"}}" - deletion_policy = "DELETE" -} diff --git a/mmv1/templates/terraform/examples/go/network_attachment_instance_usage.tf.tmpl b/mmv1/templates/terraform/examples/go/network_attachment_instance_usage.tf.tmpl deleted file mode 100644 index 6a44bee01a67..000000000000 --- a/mmv1/templates/terraform/examples/go/network_attachment_instance_usage.tf.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -resource "google_compute_network" "default" { - provider = google-beta - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - provider = google-beta - name = "{{index $.Vars "subnetwork_name"}}" - region = "us-central1" - - network = google_compute_network.default.id - ip_cidr_range = "10.0.0.0/16" -} - -resource "google_compute_network_attachment" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - region = "us-central1" - description = "my basic network attachment" - - subnetworks = [google_compute_subnetwork.default.id] - connection_preference = "ACCEPT_AUTOMATIC" -} - -resource "google_compute_instance" "default" { - provider = google-beta - name = "{{index $.Vars "instance_name"}}" - zone = "us-central1-a" - machine_type = "e2-micro" - - boot_disk { - initialize_params { - image = "debian-cloud/debian-11" - } - } - - network_interface { - network = "default" - } - - network_interface { - network_attachment = google_compute_network_attachment.default.self_link - } -} diff --git a/mmv1/templates/terraform/examples/go/network_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_basic.tf.tmpl deleted file mode 100644 index 5a8d71402914..000000000000 --- a/mmv1/templates/terraform/examples/go/network_basic.tf.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -resource "google_compute_network" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_hub_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_hub_basic.tf.tmpl deleted file mode 100644 index 1bfba77d608a..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_hub_basic.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_network_connectivity_hub" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - description = "A sample hub" - labels = { - label-one = "value-one" - } -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_hub_with_export_psc.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_hub_with_export_psc.tf.tmpl deleted file mode 100644 index a07d2d0078bf..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_hub_with_export_psc.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_network_connectivity_hub" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - description = "A sample hub with Private Service Connect transitivity is enabled" - export_psc = true -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_automatic_reservation.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_automatic_reservation.tf.tmpl deleted file mode 100644 index d32adf23a7f4..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_automatic_reservation.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_network_connectivity_internal_range" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "internal_range_name"}}" - network = google_compute_network.default.id - usage = "FOR_VPC" - peering = "FOR_SELF" - prefix_length = 24 - target_cidr_range = [ - "192.16.0.0/16" - ] -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_basic.tf.tmpl deleted file mode 100644 index 9f89f49d6bcb..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_basic.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_network_connectivity_internal_range" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "internal_range_name"}}" - description = "Test internal range" - network = google_compute_network.default.self_link - usage = "FOR_VPC" - peering = "FOR_SELF" - ip_cidr_range = "10.0.0.0/24" - - labels = { - label-a: "b" - } -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_external_ranges.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_external_ranges.tf.tmpl deleted file mode 100644 index 9c7e4b8bd9df..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_external_ranges.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_network_connectivity_internal_range" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "internal_range_name"}}" - network = google_compute_network.default.id - usage = "EXTERNAL_TO_VPC" - peering = "FOR_SELF" - ip_cidr_range = "172.16.0.0/24" - - labels = { - external-reserved-range: "on-premises" - } -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_reserve_with_overlap.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_reserve_with_overlap.tf.tmpl deleted file mode 100644 index e6d487d51a41..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_internal_ranges_reserve_with_overlap.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_network_connectivity_internal_range" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "internal_range_name"}}" - description = "Test internal range" - network = google_compute_network.default.id - usage = "FOR_VPC" - peering = "FOR_SELF" - ip_cidr_range = "10.0.0.0/30" - - overlaps = [ - "OVERLAP_EXISTING_SUBNET_RANGE" - ] - - depends_on = [ - google_compute_subnetwork.default - ] -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - name = "overlapping-subnet" - ip_cidr_range = "10.0.0.0/24" - region = "us-central1" - network = google_compute_network.default.id -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_policy_based_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_policy_based_route_basic.tf.tmpl deleted file mode 100644 index 8e2bd940b957..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_policy_based_route_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_network_connectivity_policy_based_route" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "pbr_name"}}" - network = google_compute_network.my_network.id - filter { - protocol_version = "IPV4" - } - next_hop_other_routes = "DEFAULT_ROUTING" -} - -resource "google_compute_network" "my_network" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_policy_based_route_full.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_policy_based_route_full.tf.tmpl deleted file mode 100644 index b1b726f50692..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_policy_based_route_full.tf.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -resource "google_network_connectivity_policy_based_route" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "pbr_name"}}" - description = "My routing policy" - network = google_compute_network.my_network.id - priority = 2302 - - filter { - protocol_version = "IPV4" - ip_protocol = "UDP" - src_range = "10.0.0.0/24" - dest_range = "0.0.0.0/0" - } - next_hop_ilb_ip = google_compute_global_address.ilb.address - - virtual_machine { - tags = ["restricted"] - } - - labels = { - env = "default" - } -} - -resource "google_compute_network" "my_network" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -# This example substitutes an arbitrary internal IP for an internal network -# load balancer for brevity. Consult https://cloud.google.com/load-balancing/docs/internal -# to set one up. -resource "google_compute_global_address" "ilb" { - name = "{{index $.Vars "ilb_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_policy_basic.tf.tmpl deleted file mode 100644 index a85c0e245885..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_policy_basic.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_compute_network" "producer_net" { - name = "{{index $.Vars "producer_network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "producer_subnet" { - name = "{{index $.Vars "producer_subnetwork_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.producer_net.id -} - -resource "google_network_connectivity_service_connection_policy" "default" { - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - service_class = "{{index $.Vars "service_class_name"}}" - description = "my basic service connection policy" - network = google_compute_network.producer_net.id - psc_config { - subnetworks = [google_compute_subnetwork.producer_subnet.id] - limit = 2 - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_regional_endpoint_global_access.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_regional_endpoint_global_access.tf.tmpl deleted file mode 100644 index 0e9d1a71b7e9..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_regional_endpoint_global_access.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_compute_network" "my_network" { - name = "{{index $.Vars "rep_network"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "my_subnetwork" { - name = "{{index $.Vars "rep_subnetwork"}}" - ip_cidr_range = "192.168.0.0/24" - region = "us-central1" - network = google_compute_network.my_network.id -} - -resource "google_network_connectivity_regional_endpoint" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "rep_name"}}" - location = "us-central1" - target_google_api = "storage.us-central1.p.rep.googleapis.com" - access_type = "GLOBAL" - address = "192.168.0.4" - network = google_compute_network.my_network.id - subnetwork = google_compute_subnetwork.my_subnetwork.id -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_regional_endpoint_regional_access.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_regional_endpoint_regional_access.tf.tmpl deleted file mode 100644 index a39621ba2ccb..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_regional_endpoint_regional_access.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_compute_network" "my_network" { - name = "{{index $.Vars "rep_network"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "my_subnetwork" { - name = "{{index $.Vars "rep_subnetwork"}}" - ip_cidr_range = "192.168.0.0/24" - region = "us-central1" - network = google_compute_network.my_network.id -} - -resource "google_network_connectivity_regional_endpoint" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "rep_name"}}" - location = "us-central1" - target_google_api = "storage.us-central1.p.rep.googleapis.com" - access_type = "REGIONAL" - address = "192.168.0.5" - network = google_compute_network.my_network.id - subnetwork = google_compute_subnetwork.my_subnetwork.id - description = "My RegionalEndpoint targeting Google API storage.us-central1.p.rep.googleapis.com" - labels = {env = "default"} -} diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_spoke_linked_vpc_network_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_spoke_linked_vpc_network_basic.tf.tmpl deleted file mode 100644 index c53105428404..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_spoke_linked_vpc_network_basic.tf.tmpl +++ /dev/null @@ -1,33 +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 router appliance instance" - labels = { - label-one = "value-one" - } - hub = google_network_connectivity_hub.basic_hub.id - linked_vpc_network { - exclude_export_ranges = [ - "198.51.100.0/24", - "10.10.0.0/16" - ] - include_export_ranges = [ - "198.51.100.0/23", - "10.0.0.0/8" - ] - uri = google_compute_network.network.self_link - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_connectivity_spoke_router_appliance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_connectivity_spoke_router_appliance_basic.tf.tmpl deleted file mode 100644 index 693028f32f8c..000000000000 --- a/mmv1/templates/terraform/examples/go/network_connectivity_spoke_router_appliance_basic.tf.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -resource "google_compute_network" "network" { - name = "tf-test-network%{random_suffix}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "subnetwork" { - name = "tf-test-subnet%{random_suffix}" - ip_cidr_range = "10.0.0.0/28" - region = "us-central1" - network = google_compute_network.network.self_link -} - -resource "google_compute_instance" "instance" { - name = "tf-test-instance%{random_suffix}" - machine_type = "e2-medium" - can_ip_forward = true - zone = "us-central1-a" - - boot_disk { - initialize_params { - image = "projects/debian-cloud/global/images/debian-10-buster-v20210817" - } - } - - network_interface { - subnetwork = google_compute_subnetwork.subnetwork.name - network_ip = "10.0.0.2" - access_config { - network_tier = "PREMIUM" - } - } -} - -resource "google_network_connectivity_hub" "basic_hub" { - name = "tf-test-hub%{random_suffix}" - description = "A sample hub" - labels = { - label-two = "value-one" - } -} - -resource "google_network_connectivity_spoke" "primary" { - name = "tf-test-name%{random_suffix}" - location = "us-central1" - description = "A sample spoke with a linked routher appliance instance" - labels = { - label-one = "value-one" - } - hub = google_network_connectivity_hub.basic_hub.id - linked_router_appliance_instances { - instances { - virtual_machine = google_compute_instance.instance.self_link - ip_address = "10.0.0.2" - } - site_to_site_data_transfer = true - } -} diff --git a/mmv1/templates/terraform/examples/go/network_custom_firewall_enforcement_order.tf.tmpl b/mmv1/templates/terraform/examples/go/network_custom_firewall_enforcement_order.tf.tmpl deleted file mode 100644 index d621d2a084bf..000000000000 --- a/mmv1/templates/terraform/examples/go/network_custom_firewall_enforcement_order.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_compute_network" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project"}}" - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = true - network_firewall_policy_enforcement_order = "BEFORE_CLASSIC_FIREWALL" -} diff --git a/mmv1/templates/terraform/examples/go/network_custom_mtu.tf.tmpl b/mmv1/templates/terraform/examples/go/network_custom_mtu.tf.tmpl deleted file mode 100644 index 0a075376d536..000000000000 --- a/mmv1/templates/terraform/examples/go/network_custom_mtu.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_compute_network" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project"}}" - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = true - mtu = 1460 -} diff --git a/mmv1/templates/terraform/examples/go/network_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/go/network_endpoint.tf.tmpl deleted file mode 100644 index 22b8ad297b0f..000000000000 --- a/mmv1/templates/terraform/examples/go/network_endpoint.tf.tmpl +++ /dev/null @@ -1,49 +0,0 @@ -resource "google_compute_network_endpoint" "{{$.PrimaryResourceId}}" { - network_endpoint_group = google_compute_network_endpoint_group.neg.name - - instance = google_compute_instance.endpoint-instance.name - port = google_compute_network_endpoint_group.neg.default_port - ip_address = google_compute_instance.endpoint-instance.network_interface[0].network_ip -} - -data "google_compute_image" "my_image" { - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_instance" "endpoint-instance" { - name = "{{index $.Vars "instance_name"}}" - machine_type = "e2-medium" - - boot_disk { - initialize_params { - image = data.google_compute_image.my_image.self_link - } - } - - network_interface { - subnetwork = google_compute_subnetwork.default.id - access_config { - } - } -} - -resource "google_compute_network_endpoint_group" "group" { - name = "{{index $.Vars "neg_name"}}" - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - default_port = "90" - zone = "us-central1-a" -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "subnetwork_name"}}" - ip_cidr_range = "10.0.0.1/16" - region = "us-central1" - network = google_compute_network.default.id -} diff --git a/mmv1/templates/terraform/examples/go/network_endpoint_group.tf.tmpl b/mmv1/templates/terraform/examples/go/network_endpoint_group.tf.tmpl deleted file mode 100644 index d25108a75310..000000000000 --- a/mmv1/templates/terraform/examples/go/network_endpoint_group.tf.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -resource "google_compute_network_endpoint_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "neg_name"}}" - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - default_port = "90" - zone = "us-central1-a" -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "subnetwork_name"}}" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.default.id -} diff --git a/mmv1/templates/terraform/examples/go/network_endpoint_group_non_gcp.tf.tmpl b/mmv1/templates/terraform/examples/go/network_endpoint_group_non_gcp.tf.tmpl deleted file mode 100644 index b20bcb391aa6..000000000000 --- a/mmv1/templates/terraform/examples/go/network_endpoint_group_non_gcp.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_compute_network_endpoint_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "neg_name"}}" - network = google_compute_network.default.id - default_port = "90" - zone = "us-central1-a" - network_endpoint_type = "NON_GCP_PRIVATE_IP_PORT" -} - -resource "google_compute_network_endpoint" "default-endpoint" { - network_endpoint_group = google_compute_network_endpoint_group.{{$.PrimaryResourceId}}.name - port = google_compute_network_endpoint_group.{{$.PrimaryResourceId}}.default_port - ip_address = "127.0.0.1" -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" -} diff --git a/mmv1/templates/terraform/examples/go/network_endpoints.tf.tmpl b/mmv1/templates/terraform/examples/go/network_endpoints.tf.tmpl deleted file mode 100644 index 78b44128faaf..000000000000 --- a/mmv1/templates/terraform/examples/go/network_endpoints.tf.tmpl +++ /dev/null @@ -1,73 +0,0 @@ -resource "google_compute_network_endpoints" "{{$.PrimaryResourceId}}" { - network_endpoint_group = google_compute_network_endpoint_group.neg.name - - network_endpoints { - instance = google_compute_instance.endpoint-instance1.name - port = google_compute_network_endpoint_group.neg.default_port - ip_address = google_compute_instance.endpoint-instance1.network_interface[0].network_ip - } - network_endpoints { - instance = google_compute_instance.endpoint-instance2.name - port = google_compute_network_endpoint_group.neg.default_port - ip_address = google_compute_instance.endpoint-instance2.network_interface[0].network_ip - } -} - -data "google_compute_image" "my_image" { - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_instance" "endpoint-instance1" { - name = "{{index $.Vars "instance_name"}}1" - machine_type = "e2-medium" - - boot_disk { - initialize_params { - image = data.google_compute_image.my_image.self_link - } - } - - network_interface { - subnetwork = google_compute_subnetwork.default.id - access_config { - } - } -} - -resource "google_compute_instance" "endpoint-instance2" { - name = "{{index $.Vars "instance_name"}}2" - machine_type = "e2-medium" - - boot_disk { - initialize_params { - image = data.google_compute_image.my_image.self_link - } - } - - network_interface { - subnetwork = google_compute_subnetwork.default.id - access_config { - } - } -} - -resource "google_compute_network_endpoint_group" "group" { - name = "{{index $.Vars "neg_name"}}" - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - default_port = "90" - zone = "us-central1-a" -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "subnetwork_name"}}" - ip_cidr_range = "10.0.0.1/16" - region = "us-central1" - network = google_compute_network.default.id -} diff --git a/mmv1/templates/terraform/examples/go/network_firewall_policy_full.tf.tmpl b/mmv1/templates/terraform/examples/go/network_firewall_policy_full.tf.tmpl deleted file mode 100644 index cef4b0f1d805..000000000000 --- a/mmv1/templates/terraform/examples/go/network_firewall_policy_full.tf.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -resource "google_compute_network_firewall_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "policy_name"}}" - description = "Terraform test" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_management_connectivity_test_addresses.tf.tmpl b/mmv1/templates/terraform/examples/go/network_management_connectivity_test_addresses.tf.tmpl deleted file mode 100644 index aa9a5ce8ef3c..000000000000 --- a/mmv1/templates/terraform/examples/go/network_management_connectivity_test_addresses.tf.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -resource "google_network_management_connectivity_test" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "primary_resource_name"}}" - source { - ip_address = google_compute_address.source-addr.address - project_id = google_compute_address.source-addr.project - network = google_compute_network.vpc.id - network_type = "GCP_NETWORK" - } - - destination { - ip_address = google_compute_address.dest-addr.address - project_id = google_compute_address.dest-addr.project - network = google_compute_network.vpc.id - } - - protocol = "UDP" -} - -resource "google_compute_network" "vpc" { - name = "{{index $.Vars "network"}}" -} - -resource "google_compute_subnetwork" "subnet" { - name = "{{index $.Vars "network"}}-subnet" - ip_cidr_range = "10.0.0.0/16" - region = "us-central1" - network = google_compute_network.vpc.id -} - -resource "google_compute_address" "source-addr" { - name = "{{index $.Vars "source_addr"}}" - subnetwork = google_compute_subnetwork.subnet.id - address_type = "INTERNAL" - address = "10.0.42.42" - region = "us-central1" -} - -resource "google_compute_address" "dest-addr" { - name = "{{index $.Vars "dest_addr"}}" - subnetwork = google_compute_subnetwork.subnet.id - address_type = "INTERNAL" - address = "10.0.43.43" - region = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/network_management_connectivity_test_instances.tf.tmpl b/mmv1/templates/terraform/examples/go/network_management_connectivity_test_instances.tf.tmpl deleted file mode 100644 index 1ab2b32cea92..000000000000 --- a/mmv1/templates/terraform/examples/go/network_management_connectivity_test_instances.tf.tmpl +++ /dev/null @@ -1,58 +0,0 @@ -resource "google_network_management_connectivity_test" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "primary_resource_name"}}" - source { - instance = google_compute_instance.source.id - } - - destination { - instance = google_compute_instance.destination.id - } - - protocol = "TCP" - labels = { - env = "test" - } -} - -resource "google_compute_instance" "source" { - name = "{{index $.Vars "source_instance"}}" - machine_type = "e2-medium" - - boot_disk { - initialize_params { - image = data.google_compute_image.debian_9.id - } - } - - network_interface { - network = google_compute_network.vpc.id - access_config { - } - } -} - -resource "google_compute_instance" "destination" { - name = "{{index $.Vars "dest_instance"}}" - machine_type = "e2-medium" - - boot_disk { - initialize_params { - image = data.google_compute_image.debian_9.id - } - } - - network_interface { - network = google_compute_network.vpc.id - access_config { - } - } -} - -resource "google_compute_network" "vpc" { - name = "{{index $.Vars "network_name"}}" -} - -data "google_compute_image" "debian_9" { - family = "debian-11" - project = "debian-cloud" -} diff --git a/mmv1/templates/terraform/examples/go/network_peering_routes_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_peering_routes_config_basic.tf.tmpl deleted file mode 100644 index 4c67d3daa988..000000000000 --- a/mmv1/templates/terraform/examples/go/network_peering_routes_config_basic.tf.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -resource "google_compute_network_peering_routes_config" "{{$.PrimaryResourceId}}" { - peering = google_compute_network_peering.peering_primary.name - network = google_compute_network.network_primary.name - - import_custom_routes = true - export_custom_routes = true -} - -resource "google_compute_network_peering" "peering_primary" { - name = "{{index $.Vars "peering_primary_name"}}" - network = google_compute_network.network_primary.id - peer_network = google_compute_network.network_secondary.id - - import_custom_routes = true - export_custom_routes = true -} - -resource "google_compute_network_peering" "peering_secondary" { - name = "{{index $.Vars "peering_secondary_name"}}" - network = google_compute_network.network_secondary.id - peer_network = google_compute_network.network_primary.id -} - -resource "google_compute_network" "network_primary" { - name = "{{index $.Vars "network_primary_name"}}" - auto_create_subnetworks = "false" -} - -resource "google_compute_network" "network_secondary" { - name = "{{index $.Vars "network_secondary_name"}}" - auto_create_subnetworks = "false" -} diff --git a/mmv1/templates/terraform/examples/go/network_peering_routes_config_gke.tf.tmpl b/mmv1/templates/terraform/examples/go/network_peering_routes_config_gke.tf.tmpl deleted file mode 100644 index 669f83afb3f7..000000000000 --- a/mmv1/templates/terraform/examples/go/network_peering_routes_config_gke.tf.tmpl +++ /dev/null @@ -1,53 +0,0 @@ -resource "google_compute_network_peering_routes_config" "{{$.PrimaryResourceId}}" { - peering = google_container_cluster.private_cluster.private_cluster_config[0].peering_name - network = google_compute_network.container_network.name - - import_custom_routes = true - export_custom_routes = true -} - -resource "google_compute_network" "container_network" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "container_subnetwork" { - name = "{{index $.Vars "subnetwork_name"}}" - region = "us-central1" - network = google_compute_network.container_network.name - ip_cidr_range = "10.0.36.0/24" - private_ip_google_access = true - - secondary_ip_range { - range_name = "pod" - ip_cidr_range = "10.0.0.0/19" - } - - secondary_ip_range { - range_name = "svc" - ip_cidr_range = "10.0.32.0/22" - } -} - -resource "google_container_cluster" "private_cluster" { - name = "{{index $.Vars "gke_cluster_name"}}" - location = "us-central1-a" - initial_node_count = 1 - - network = google_compute_network.container_network.name - subnetwork = google_compute_subnetwork.container_subnetwork.name - - private_cluster_config { - enable_private_endpoint = true - enable_private_nodes = true - master_ipv4_cidr_block = "10.42.0.0/28" - } - - master_authorized_networks_config {} - - ip_allocation_policy { - cluster_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[0].range_name - services_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[1].range_name - } - deletion_protection = "{{index $.Vars "deletion_protection"}}" -} diff --git a/mmv1/templates/terraform/examples/go/network_security_address_groups_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_address_groups_advanced.tf.tmpl deleted file mode 100644 index ddd8b75c490a..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_address_groups_advanced.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_network_security_address_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - parent = "projects/{{index $.TestEnvVars "project"}}" - location = "us-central1" - description = "my description" - type = "IPV4" - capacity = "100" - items = ["208.80.154.224/32"] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_security_address_groups_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_address_groups_basic.tf.tmpl deleted file mode 100644 index db94e9e8c7ce..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_address_groups_basic.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_network_security_address_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - parent = "projects/{{index $.TestEnvVars "project"}}" - location = "us-central1" - type = "IPV4" - capacity = "100" - items = ["208.80.154.224/32"] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_security_address_groups_cloud_armor.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_address_groups_cloud_armor.tf.tmpl deleted file mode 100644 index f33650525d12..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_address_groups_cloud_armor.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_network_security_address_group" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - parent = "projects/{{index $.TestEnvVars "project"}}" - location = "global" - type = "IPV4" - capacity = "100" - purpose = ["CLOUD_ARMOR"] - items = ["208.80.154.224/32"] -} diff --git a/mmv1/templates/terraform/examples/go/network_security_address_groups_organization_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_address_groups_organization_basic.tf.tmpl deleted file mode 100644 index 7e8f37d38654..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_address_groups_organization_basic.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_network_security_address_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - location = "us-central1" - type = "IPV4" - capacity = "100" - items = ["208.80.154.224/32"] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_security_authorization_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_authorization_policy_basic.tf.tmpl deleted file mode 100644 index e7214da8b41b..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_authorization_policy_basic.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_network_security_authorization_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - action = "ALLOW" - rules { - sources { - principals = ["namespace/*"] - ip_blocks = ["1.2.3.0/24"] - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_security_authorization_policy_destinations.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_authorization_policy_destinations.tf.tmpl deleted file mode 100644 index 4d517cc9598b..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_authorization_policy_destinations.tf.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -resource "google_network_security_authorization_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - action = "ALLOW" - rules { - sources { - principals = ["namespace/*"] - ip_blocks = ["1.2.3.0/24"] - } - destinations { - hosts = ["mydomain.*"] - ports = [8080] - methods = ["GET"] - http_header_match { - header_name = ":method" - regex_match = "GET" - } - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_security_client_tls_policy_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_client_tls_policy_advanced.tf.tmpl deleted file mode 100644 index 3a9f7f396aad..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_client_tls_policy_advanced.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_network_security_client_tls_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - client_certificate { - certificate_provider_instance { - plugin_instance = "google_cloud_private_spiffe" - } - } - server_validation_ca { - grpc_endpoint { - target_uri = "unix:mypath" - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_security_client_tls_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_client_tls_policy_basic.tf.tmpl deleted file mode 100644 index 6c58a2792450..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_client_tls_policy_basic.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_network_security_client_tls_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - sni = "secure.example.com" -} diff --git a/mmv1/templates/terraform/examples/go/network_security_firewall_endpoint_association_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_firewall_endpoint_association_basic.tf.tmpl deleted file mode 100644 index 4677de4095e8..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_firewall_endpoint_association_basic.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_compute_network" "foobar" { - name = "tf-test-my-vpc%{randomSuffix}" - auto_create_subnetworks = false -} - -resource "google_network_security_firewall_endpoint" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name_prefix"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - location = "us-central1-a" - billing_project_id = "{{index $.TestEnvVars "project"}}" - - labels = { - foo = "bar" - } -} - -resource "google_network_security_firewall_endpoint_association" "{{$.PrimaryResourceId}}_association" { - name = "{{index $.Vars "resource_name_prefix"}}-association" - parent = "projects/{{index $.TestEnvVars "project"}}" - location = "us-central1-a" - network = google_compute_network.foobar.id - firewall_endpoint = google_network_security_firewall_endpoint.{{$.PrimaryResourceId}}.id - disabled = false - - labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/network_security_firewall_endpoint_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_firewall_endpoint_basic.tf.tmpl deleted file mode 100644 index e7b0f6f6bc9c..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_firewall_endpoint_basic.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_network_security_firewall_endpoint" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - location = "us-central1-a" - billing_project_id = "{{index $.TestEnvVars "project"}}" - - labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_basic.tf.tmpl deleted file mode 100644 index be88facae445..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_network_security_gateway_security_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - description = "my description" -} diff --git a/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_rules_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_rules_advanced.tf.tmpl deleted file mode 100644 index 86c4196df668..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_rules_advanced.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_network_security_gateway_security_policy" "default" { - name = "{{index $.Vars "gateway_security_policy_id"}}" - location = "us-central1" - description = "gateway security policy created to be used as reference by the rule." -} - -resource "google_network_security_gateway_security_policy_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - gateway_security_policy = google_network_security_gateway_security_policy.default.name - enabled = true - description = "my description" - priority = 0 - session_matcher = "host() == 'example.com'" - application_matcher = "request.method == 'POST'" - tls_inspection_enabled = false - basic_profile = "ALLOW" -} diff --git a/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_rules_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_rules_basic.tf.tmpl deleted file mode 100644 index a24ce0e2464e..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_rules_basic.tf.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -resource "google_network_security_gateway_security_policy" "default" { - name = "{{index $.Vars "gateway_security_policy_id"}}" - location = "us-central1" - description = "gateway security policy created to be used as reference by the rule." -} - -resource "google_network_security_gateway_security_policy_rule" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - gateway_security_policy = google_network_security_gateway_security_policy.default.name - enabled = true - description = "my description" - priority = 0 - session_matcher = "host() == 'example.com'" - basic_profile = "ALLOW" -} diff --git a/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_tls_inspection_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_tls_inspection_basic.tf.tmpl deleted file mode 100644 index 439206f36845..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_gateway_security_policy_tls_inspection_basic.tf.tmpl +++ /dev/null @@ -1,91 +0,0 @@ -resource "google_privateca_ca_pool" "default" { - provider = google-beta - name = "{{index $.Vars "privateca_ca_pool_name"}}" - location = "us-central1" - tier = "DEVOPS" - publishing_options { - publish_ca_cert = false - publish_crl = false - } - issuance_policy { - maximum_lifetime = "1209600s" - baseline_values { - ca_options { - is_ca = false - } - key_usage { - base_key_usage {} - extended_key_usage { - server_auth = true - } - } - } - } -} - - -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" - lifetime = "86400s" - type = "SELF_SIGNED" - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true - config { - subject_config { - subject { - organization = "Test LLC" - common_name = "my-ca" - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = false - } - } - } - } - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } -} - -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 - depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default, google_privateca_ca_pool_iam_member.tls_inspection_permission] -} - -resource "google_network_security_gateway_security_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - description = "my description" - tls_inspection_policy = google_network_security_tls_inspection_policy.default.id - depends_on = [google_network_security_tls_inspection_policy.default] -} diff --git a/mmv1/templates/terraform/examples/go/network_security_security_profile_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_security_profile_basic.tf.tmpl deleted file mode 100644 index 56dadb74c18d..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_security_profile_basic.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_network_security_security_profile" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - type = "THREAT_PREVENTION" - - labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/network_security_security_profile_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_security_profile_group_basic.tf.tmpl deleted file mode 100644 index 36779721d397..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_security_profile_group_basic.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_network_security_security_profile_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "security_profile_group_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - threat_prevention_profile = google_network_security_security_profile.security_profile.id - - labels = { - foo = "bar" - } -} - -resource "google_network_security_security_profile" "security_profile" { - name = "{{index $.Vars "security_profile_name"}}" - type = "THREAT_PREVENTION" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - location = "global" -} diff --git a/mmv1/templates/terraform/examples/go/network_security_security_profile_overrides.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_security_profile_overrides.tf.tmpl deleted file mode 100644 index 88c3fd1a78d6..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_security_profile_overrides.tf.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -resource "google_network_security_security_profile" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - description = "my description" - type = "THREAT_PREVENTION" - - threat_prevention_profile { - severity_overrides { - action = "ALLOW" - severity = "INFORMATIONAL" - } - - severity_overrides { - action = "DENY" - severity = "HIGH" - } - - threat_overrides { - action = "ALLOW" - threat_id = "280647" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_advanced.tf.tmpl deleted file mode 100644 index 5ae27a9e44c9..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_advanced.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_network_security_server_tls_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - location = "global" - allow_open = "false" - mtls_policy { - client_validation_mode = "ALLOW_INVALID_OR_MISSING_CLIENT_CERT" - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_basic.tf.tmpl deleted file mode 100644 index 09e6ceb7a8e7..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_basic.tf.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -resource "google_network_security_server_tls_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - allow_open = "false" - server_certificate { - certificate_provider_instance { - plugin_instance = "google_cloud_private_spiffe" - } - } - mtls_policy { - client_validation_ca { - grpc_endpoint { - target_uri = "unix:mypath" - } - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_mtls.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_mtls.tf.tmpl deleted file mode 100644 index ad2b16fd30fd..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_mtls.tf.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -data "google_project" "project" { -} - -resource "google_network_security_server_tls_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - - description = "my description" - location = "global" - allow_open = "false" - - mtls_policy { - client_validation_mode = "REJECT_INVALID" - client_validation_trust_config = "projects/${data.google_project.project.number}/locations/global/trustConfigs/${google_certificate_manager_trust_config.default.name}" - } - - labels = { - foo = "bar" - } -} - -resource "google_certificate_manager_trust_config" "default" { - name = "{{index $.Vars "trust_config_name"}}" - description = "sample trust config description" - location = "global" - - trust_stores { - trust_anchors { - pem_certificate = file("test-fixtures/ca_cert.pem") - } - intermediate_cas { - pem_certificate = file("test-fixtures/ca_cert.pem") - } - } - - labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_server_cert.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_server_cert.tf.tmpl deleted file mode 100644 index 400c48c0255a..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_server_tls_policy_server_cert.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_network_security_server_tls_policy" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - location = "global" - allow_open = "false" - server_certificate { - grpc_endpoint { - target_uri = "unix:mypath" - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_security_tls_inspection_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_tls_inspection_policy_basic.tf.tmpl deleted file mode 100644 index 77d23513b97a..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_tls_inspection_policy_basic.tf.tmpl +++ /dev/null @@ -1,76 +0,0 @@ -resource "google_privateca_ca_pool" "default" { - name = "{{index $.Vars "privateca_ca_pool_name"}}" - location = "us-central1" - tier = "DEVOPS" - publishing_options { - publish_ca_cert = false - publish_crl = false - } - issuance_policy { - maximum_lifetime = "1209600s" - baseline_values { - ca_options { - is_ca = false - } - key_usage { - base_key_usage {} - extended_key_usage { - server_auth = true - } - } - } - } -} - -resource "google_privateca_certificate_authority" "default" { - pool = google_privateca_ca_pool.default.name - certificate_authority_id = "{{index $.Vars "privateca_certificate_authority_id"}}" - location = "us-central1" - lifetime = "86400s" - type = "SELF_SIGNED" - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true - config { - subject_config { - subject { - organization = "Test LLC" - common_name = "my-ca" - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = false - } - } - } - } - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } -} - - -data "google_project" "project" {} - -resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" { - 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" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - ca_pool = google_privateca_ca_pool.default.id - exclude_public_ca_set = false - depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default, google_privateca_ca_pool_iam_member.tls_inspection_permission] -} diff --git a/mmv1/templates/terraform/examples/go/network_security_tls_inspection_policy_custom.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_tls_inspection_policy_custom.tf.tmpl deleted file mode 100644 index 9a7bd4c8a0e6..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_tls_inspection_policy_custom.tf.tmpl +++ /dev/null @@ -1,130 +0,0 @@ -resource "google_privateca_ca_pool" "default" { - provider = google-beta - name = "{{index $.Vars "privateca_ca_pool_name"}}" - location = "us-central1" - tier = "DEVOPS" - - publishing_options { - publish_ca_cert = false - publish_crl = false - } - - issuance_policy { - maximum_lifetime = "1209600s" - baseline_values { - ca_options { - is_ca = false - } - key_usage { - base_key_usage {} - extended_key_usage { - server_auth = true - } - } - } - } -} - -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" - lifetime = "86400s" - type = "SELF_SIGNED" - deletion_protection = false - skip_grace_period = true - - ignore_active_certificates_on_deletion = true - - config { - subject_config { - subject { - organization = "Test LLC" - common_name = "my-ca" - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = false - } - } - } - } - - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } -} - -resource "google_project_service_identity" "ns_sa" { - provider = google-beta - service = "networksecurity.googleapis.com" -} - -resource "google_privateca_ca_pool_iam_member" "default" { - provider = google-beta - ca_pool = google_privateca_ca_pool.default.id - role = "roles/privateca.certificateManager" - member = google_project_service_identity.ns_sa.member -} - -resource "google_certificate_manager_trust_config" "default" { - provider = google-beta - name = "{{index $.Vars "trust_config_name"}}" - description = "sample trust config description" - location = "us-central1" - - trust_stores { - trust_anchors { - pem_certificate = file("test-fixtures/ca_cert.pem") - } - intermediate_cas { - pem_certificate = file("test-fixtures/ca_cert.pem") - } - } -} - -resource "google_network_security_tls_inspection_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - ca_pool = google_privateca_ca_pool.default.id - - exclude_public_ca_set = false - min_tls_version = "TLS_1_0" - trust_config = google_certificate_manager_trust_config.default.id - tls_feature_profile = "PROFILE_CUSTOM" - - custom_tls_features = [ - "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", - "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", - "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256", - "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", - "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", - "TLS_RSA_WITH_3DES_EDE_CBC_SHA", - "TLS_RSA_WITH_AES_128_CBC_SHA", - "TLS_RSA_WITH_AES_128_GCM_SHA256", - "TLS_RSA_WITH_AES_256_CBC_SHA", - "TLS_RSA_WITH_AES_256_GCM_SHA384", - ] - - depends_on = [ - google_privateca_certificate_authority.default, - google_privateca_ca_pool_iam_member.default, - ] -} diff --git a/mmv1/templates/terraform/examples/go/network_security_url_lists_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_url_lists_advanced.tf.tmpl deleted file mode 100644 index cfb5d17bd967..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_url_lists_advanced.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_network_security_url_lists" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - description = "my description" - values = ["www.example.com", "about.example.com", "github.com/example-org/*"] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_security_url_lists_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_security_url_lists_basic.tf.tmpl deleted file mode 100644 index b3b1bdbde4ab..000000000000 --- a/mmv1/templates/terraform/examples/go/network_security_url_lists_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_network_security_url_lists" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - location = "us-central1" - values = ["www.example.com"] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_edge_cache_keyset_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_edge_cache_keyset_basic.tf.tmpl deleted file mode 100644 index f6b281c0f316..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_edge_cache_keyset_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ - -resource "google_network_services_edge_cache_keyset" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - description = "The default keyset" - public_key { - id = "my-public-key" - value = "FHsTyFHNmvNpw4o7-rp-M1yqMyBF8vXSBRkZtkQ0RKY" - } - public_key { - id = "my-public-key-2" - value = "hzd03llxB1u5FOLKFkZ6_wCJqC7jtN0bg7xlBqS6WVM" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_edge_cache_keyset_dual_token.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_edge_cache_keyset_dual_token.tf.tmpl deleted file mode 100644 index 81d7673016c0..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_edge_cache_keyset_dual_token.tf.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_name"}}" - - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - - secret_data = "secret-data" -} - -resource "google_network_services_edge_cache_keyset" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - description = "The default keyset" - public_key { - id = "my-public-key" - managed = true - } - validation_shared_keys { - secret_version = google_secret_manager_secret_version.secret-version-basic.id - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_advanced.tf.tmpl deleted file mode 100644 index fe371102219e..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_advanced.tf.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -resource "google_network_services_edge_cache_origin" "fallback" { - name = "{{index $.Vars "resource_name_2"}}" - origin_address = "fallback.example.com" - description = "The default bucket for media edge test" - max_attempts = 3 - protocol = "HTTP" - port = 80 - - retry_conditions = [ - "CONNECT_FAILURE", - "NOT_FOUND", - "HTTP_5XX", - "FORBIDDEN", - ] - timeout { - connect_timeout = "10s" - max_attempts_timeout = "20s" - response_timeout = "60s" - read_timeout = "5s" - } - origin_override_action { - url_rewrite { - host_rewrite = "example.com" - } - header_action { - request_headers_to_add { - header_name = "x-header" - header_value = "value" - replace = true - } - } - } - origin_redirect { - redirect_conditions = [ - "MOVED_PERMANENTLY", - "FOUND", - "SEE_OTHER", - "TEMPORARY_REDIRECT", - "PERMANENT_REDIRECT", - ] - } -} - -resource "google_network_services_edge_cache_origin" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - origin_address = "gs://media-edge-default" - failover_origin = google_network_services_edge_cache_origin.fallback.id - description = "The default bucket for media edge test" - max_attempts = 2 - labels = { - a = "b" - } - - timeout { - connect_timeout = "10s" - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_basic.tf.tmpl deleted file mode 100644 index e43bd03e2e5e..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_network_services_edge_cache_origin" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - origin_address = "gs://media-edge-default" - description = "The default bucket for media edge test" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_v4auth.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_v4auth.tf.tmpl deleted file mode 100644 index 0dbd1880b380..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_edge_cache_origin_v4auth.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_name"}}" - - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - - secret_data = "secret-data" -} - -resource "google_network_services_edge_cache_origin" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - origin_address = "gs://media-edge-default" - description = "The default bucket for V4 authentication" - aws_v4_authentication { - access_key_id = "ACCESSKEYID" - secret_access_key_version = google_secret_manager_secret_version.secret-version-basic.id - origin_region = "auto" - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_advanced.tf.tmpl deleted file mode 100644 index 35039da20349..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_advanced.tf.tmpl +++ /dev/null @@ -1,184 +0,0 @@ -resource "google_storage_bucket" "dest" { - name = "{{index $.Vars "bucket_name"}}" - location = "US" - force_destroy = true -} - -resource "google_network_services_edge_cache_origin" "google" { - name = "{{index $.Vars "origin_google"}}" - origin_address = "google.com" - description = "The default bucket for media edge test" - max_attempts = 2 - timeout { - connect_timeout = "10s" - } -} - -resource "google_network_services_edge_cache_origin" "instance" { - name = "{{index $.Vars "origin_name"}}" - origin_address = google_storage_bucket.dest.url - description = "The default bucket for media edge test" - max_attempts = 2 - timeout { - connect_timeout = "10s" - } -} - -resource "google_network_services_edge_cache_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "service_name"}}" - description = "some description" - disable_quic = true - disable_http2 = true - labels = { - a = "b" - } - - routing { - host_rule { - description = "host rule description" - hosts = ["sslcert.tf-test.club"] - path_matcher = "routes" - } - host_rule { - description = "host rule2" - hosts = ["sslcert.tf-test2.club"] - path_matcher = "routes" - } - - host_rule { - description = "host rule3" - hosts = ["sslcert.tf-test3.club"] - path_matcher = "routesAdvanced" - } - - path_matcher { - name = "routes" - route_rule { - description = "a route rule to match against" - priority = 1 - match_rule { - prefix_match = "/" - } - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = "3600s" - } - } - header_action { - response_header_to_add { - header_name = "x-cache-status" - header_value = "{cdn_cache_status}" - } - } - } - } - - path_matcher { - name = "routesAdvanced" - description = "an advanced ruleset" - route_rule { - description = "an advanced route rule to match against" - priority = 1 - match_rule { - prefix_match = "/potato/" - query_parameter_match { - name = "debug" - present_match = true - } - query_parameter_match { - name = "state" - exact_match = "debug" - } - } - match_rule { - full_path_match = "/apple" - } - header_action { - request_header_to_add { - header_name = "debug" - header_value = "true" - replace = true - } - request_header_to_add { - header_name = "potato" - header_value = "plant" - } - response_header_to_add { - header_name = "potato" - header_value = "plant" - replace = true - } - request_header_to_remove { - header_name = "prod" - } - response_header_to_remove { - header_name = "prod" - } - } - - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = "3800s" - client_ttl = "3600s" - max_ttl = "9000s" - cache_key_policy { - include_protocol = true - exclude_host = true - included_query_parameters = ["apple", "dev", "santa", "claus"] - included_header_names = ["banana"] - included_cookie_names = ["orange"] - } - negative_caching = true - signed_request_mode = "DISABLED" - negative_caching_policy = { - "500" = "3000s" - } - } - url_rewrite { - path_prefix_rewrite = "/dev" - host_rewrite = "dev.club" - } - cors_policy { - max_age = "2500s" - allow_credentials = true - allow_origins = ["*"] - allow_methods = ["GET"] - allow_headers = ["dev"] - expose_headers = ["prod"] - } - } - } - route_rule { - description = "a second route rule to match against" - priority = 2 - match_rule { - full_path_match = "/yay" - } - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = "3600s" - cache_key_policy { - excluded_query_parameters = ["dev"] - } - } - cors_policy { - max_age = "3000s" - allow_headers = ["dev"] - disabled = true - } - } - } - } - } - - log_config { - enable = true - sample_rate = 0.01 - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_basic.tf.tmpl deleted file mode 100644 index dde61b33b067..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_basic.tf.tmpl +++ /dev/null @@ -1,50 +0,0 @@ -resource "google_storage_bucket" "dest" { - name = "{{index $.Vars "bucket_name"}}" - location = "US" - force_destroy = true -} - -resource "google_network_services_edge_cache_origin" "instance" { - name = "{{index $.Vars "origin_name"}}" - origin_address = google_storage_bucket.dest.url - description = "The default bucket for media edge test" - max_attempts = 2 - timeout { - connect_timeout = "10s" - } -} - -resource "google_network_services_edge_cache_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "service_name"}}" - description = "some description" - routing { - host_rule { - description = "host rule description" - hosts = ["sslcert.tf-test.club"] - path_matcher = "routes" - } - path_matcher { - name = "routes" - route_rule { - description = "a route rule to match against" - priority = 1 - match_rule { - prefix_match = "/" - } - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = "3600s" - } - } - header_action { - response_header_to_add { - header_name = "x-cache-status" - header_value = "{cdn_cache_status}" - } - } - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_dual_token.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_dual_token.tf.tmpl deleted file mode 100644 index b2b6b7a375bd..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_edge_cache_service_dual_token.tf.tmpl +++ /dev/null @@ -1,115 +0,0 @@ -resource "google_secret_manager_secret" "secret-basic" { - secret_id = "{{index $.Vars "secret_name"}}" - - replication { - auto {} - } -} - -resource "google_secret_manager_secret_version" "secret-version-basic" { - secret = google_secret_manager_secret.secret-basic.id - - secret_data = "secret-data" -} - -resource "google_network_services_edge_cache_keyset" "keyset" { - name = "{{index $.Vars "keyset_name"}}" - description = "The default keyset" - public_key { - id = "my-public-key" - managed = true - } - validation_shared_keys { - secret_version = google_secret_manager_secret_version.secret-version-basic.id - } -} - -resource "google_network_services_edge_cache_origin" "instance" { - name = "{{index $.Vars "origin_name"}}" - origin_address = "gs://media-edge-default" - description = "The default bucket for media edge test" -} - -resource "google_network_services_edge_cache_service" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "service_name"}}" - description = "some description" - routing { - host_rule { - description = "host rule description" - hosts = ["sslcert.tf-test.club"] - path_matcher = "routes" - } - path_matcher { - name = "routes" - route_rule { - description = "a route rule to match against master playlist" - priority = 1 - match_rule { - path_template_match = "/master.m3u8" - } - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - signed_request_mode = "REQUIRE_TOKENS" - signed_request_keyset = google_network_services_edge_cache_keyset.keyset.id - signed_token_options { - token_query_parameter = "edge-cache-token" - } - signed_request_maximum_expiration_ttl = "600s" - add_signatures { - actions = ["GENERATE_COOKIE"] - keyset = google_network_services_edge_cache_keyset.keyset.id - copied_parameters = ["PathGlobs", "SessionID"] - } - } - } - } - route_rule { - description = "a route rule to match against all playlists" - priority = 2 - match_rule { - path_template_match = "/*.m3u8" - } - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - signed_request_mode = "REQUIRE_TOKENS" - signed_request_keyset = google_network_services_edge_cache_keyset.keyset.id - signed_token_options { - token_query_parameter = "hdnts" - allowed_signature_algorithms = ["ED25519", "HMAC_SHA_256", "HMAC_SHA1"] - } - add_signatures { - actions = ["GENERATE_TOKEN_HLS_COOKIELESS"] - keyset = google_network_services_edge_cache_keyset.keyset.id - token_ttl = "1200s" - token_query_parameter = "hdntl" - copied_parameters = ["URLPrefix"] - } - } - } - } - route_rule { - description = "a route rule to match against" - priority = 3 - match_rule { - path_template_match = "/**.m3u8" - } - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - signed_request_mode = "REQUIRE_TOKENS" - signed_request_keyset = google_network_services_edge_cache_keyset.keyset.id - signed_token_options { - token_query_parameter = "hdntl" - } - add_signatures { - actions = ["PROPAGATE_TOKEN_HLS_COOKIELESS"] - token_query_parameter = "hdntl" - } - } - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_endpoint_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_endpoint_policy_basic.tf.tmpl deleted file mode 100644 index 6addafc3c07b..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_endpoint_policy_basic.tf.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -resource "google_network_services_endpoint_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - type = "SIDECAR_PROXY" - traffic_port_selector { - ports = ["8081"] - } - endpoint_matcher { - metadata_label_matcher { - metadata_label_match_criteria = "MATCH_ANY" - metadata_labels { - label_name = "foo" - label_value = "bar" - } - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_endpoint_policy_empty_match.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_endpoint_policy_empty_match.tf.tmpl deleted file mode 100644 index 754caeecfdf4..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_endpoint_policy_empty_match.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_network_services_endpoint_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - type = "SIDECAR_PROXY" - traffic_port_selector { - ports = ["8081"] - } - endpoint_matcher { - metadata_label_matcher { - metadata_label_match_criteria = "MATCH_ANY" - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_gateway_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_gateway_advanced.tf.tmpl deleted file mode 100644 index a6ef2e0e45f8..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_gateway_advanced.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - type = "OPEN_MESH" - ports = [443] - scope = "default-scope-advance" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_gateway_basic.tf.tmpl deleted file mode 100644 index 1576b6cfefe6..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_gateway_basic.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "resource_name"}}" - scope = "default-scope-basic" - type = "OPEN_MESH" - ports = [443] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_gateway_multiple_swp_same_network.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_gateway_multiple_swp_same_network.tf.tmpl deleted file mode 100644 index 200f38d39928..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_gateway_multiple_swp_same_network.tf.tmpl +++ /dev/null @@ -1,77 +0,0 @@ -resource "google_certificate_manager_certificate" "default" { - name = "{{index $.Vars "certificate_name"}}" - location = "us-south1" - self_managed { - pem_certificate = file("test-fixtures/cert.pem") - pem_private_key = file("test-fixtures/private-key.pem") - } -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - routing_mode = "REGIONAL" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "subnetwork_name"}}" - purpose = "PRIVATE" - ip_cidr_range = "10.128.0.0/20" - region = "us-south1" - network = google_compute_network.default.id - role = "ACTIVE" -} - -resource "google_compute_subnetwork" "proxyonlysubnet" { - name = "{{index $.Vars "proxy_only_subnetwork_name"}}" - purpose = "REGIONAL_MANAGED_PROXY" - ip_cidr_range = "192.168.0.0/23" - region = "us-south1" - network = google_compute_network.default.id - role = "ACTIVE" -} - -resource "google_network_security_gateway_security_policy" "default" { - name = "{{index $.Vars "policy_name"}}" - location = "us-south1" -} - -resource "google_network_security_gateway_security_policy_rule" "default" { - name = "{{index $.Vars "policy_rule_name"}}" - location = "us-south1" - gateway_security_policy = google_network_security_gateway_security_policy.default.name - enabled = true - priority = 1 - session_matcher = "host() == 'example.com'" - basic_profile = "ALLOW" -} - -resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "gateway_name_1"}}" - location = "us-south1" - addresses = ["10.128.0.99"] - type = "SECURE_WEB_GATEWAY" - ports = [443] - scope = "{{index $.Vars "scope_1"}}" - certificate_urls = [google_certificate_manager_certificate.default.id] - gateway_security_policy = google_network_security_gateway_security_policy.default.id - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - delete_swg_autogen_router_on_destroy = true - depends_on = [google_compute_subnetwork.proxyonlysubnet] -} - -resource "google_network_services_gateway" "gateway2" { - name = "{{index $.Vars "gateway_name_2"}}" - location = "us-south1" - addresses = ["10.128.0.98"] - type = "SECURE_WEB_GATEWAY" - ports = [443] - scope = "{{index $.Vars "scope_2"}}" - certificate_urls = [google_certificate_manager_certificate.default.id] - gateway_security_policy = google_network_security_gateway_security_policy.default.id - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - delete_swg_autogen_router_on_destroy = true - depends_on = [google_compute_subnetwork.proxyonlysubnet] -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_gateway_secure_web_proxy.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_gateway_secure_web_proxy.tf.tmpl deleted file mode 100644 index dd0446334b48..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_gateway_secure_web_proxy.tf.tmpl +++ /dev/null @@ -1,62 +0,0 @@ -resource "google_certificate_manager_certificate" "default" { - name = "{{index $.Vars "certificate_name"}}" - location = "us-central1" - self_managed { - pem_certificate = file("test-fixtures/cert.pem") - pem_private_key = file("test-fixtures/private-key.pem") - } -} - -resource "google_compute_network" "default" { - name = "{{index $.Vars "network_name"}}" - routing_mode = "REGIONAL" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "default" { - name = "{{index $.Vars "subnetwork_name"}}" - purpose = "PRIVATE" - ip_cidr_range = "10.128.0.0/20" - region = "us-central1" - network = google_compute_network.default.id - role = "ACTIVE" -} - -resource "google_compute_subnetwork" "proxyonlysubnet" { - name = "{{index $.Vars "proxy_only_subnetwork_name"}}" - purpose = "REGIONAL_MANAGED_PROXY" - ip_cidr_range = "192.168.0.0/23" - region = "us-central1" - network = google_compute_network.default.id - role = "ACTIVE" -} - -resource "google_network_security_gateway_security_policy" "default" { - name = "{{index $.Vars "policy_name"}}" - location = "us-central1" -} - -resource "google_network_security_gateway_security_policy_rule" "default" { - name = "{{index $.Vars "policy_rule_name"}}" - location = "us-central1" - gateway_security_policy = google_network_security_gateway_security_policy.default.name - enabled = true - priority = 1 - session_matcher = "host() == 'example.com'" - basic_profile = "ALLOW" -} - -resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "gateway_name_1"}}" - location = "us-central1" - addresses = ["10.128.0.99"] - type = "SECURE_WEB_GATEWAY" - ports = [443] - scope = "{{index $.Vars "scope_1"}}" - certificate_urls = [google_certificate_manager_certificate.default.id] - gateway_security_policy = google_network_security_gateway_security_policy.default.id - network = google_compute_network.default.id - subnetwork = google_compute_subnetwork.default.id - delete_swg_autogen_router_on_destroy = true - depends_on = [google_compute_subnetwork.proxyonlysubnet] -} diff --git a/mmv1/templates/terraform/examples/go/network_services_grpc_route_actions.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_grpc_route_actions.tf.tmpl deleted file mode 100644 index cb5f24659c03..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_grpc_route_actions.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_network_services_grpc_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - hostnames = ["example"] - rules { - action { - fault_injection_policy { - delay { - fixed_delay = "1s" - percentage = 1 - } - abort { - http_status = 500 - percentage = 1 - } - } - retry_policy { - retry_conditions = ["cancelled"] - num_retries = 1 - } - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_grpc_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_grpc_route_basic.tf.tmpl deleted file mode 100644 index dee3bb8ef609..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_grpc_route_basic.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_network_services_grpc_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - hostnames = ["example"] - rules { - matches { - headers { - key = "key" - value = "value" - } - } - action { - retry_policy { - retry_conditions = ["cancelled"] - num_retries = 1 - } - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_grpc_route_matches_and_actions.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_grpc_route_matches_and_actions.tf.tmpl deleted file mode 100644 index a4353b313945..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_grpc_route_matches_and_actions.tf.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -resource "google_network_services_grpc_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - hostnames = ["example"] - rules { - matches { - headers { - key = "key" - value = "value" - } - } - matches { - headers { - key = "key" - value = "value" - } - method { - grpc_service = "foo" - grpc_method = "bar" - case_sensitive = true - } - } - action { - fault_injection_policy { - delay { - fixed_delay = "1s" - percentage = 1 - } - abort { - http_status = 500 - percentage = 1 - } - } - retry_policy { - retry_conditions = ["cancelled"] - num_retries = 1 - } - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_http_route_actions.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_http_route_actions.tf.tmpl deleted file mode 100644 index 0f8ebfe5f869..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_http_route_actions.tf.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -resource "google_network_services_http_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - hostnames = ["example"] - rules { - action { - fault_injection_policy { - delay { - fixed_delay = "1s" - percentage = 1 - } - abort { - http_status = 500 - percentage = 1 - } - } - url_rewrite { - path_prefix_rewrite = "new-prefix" - host_rewrite = "new-host" - } - retry_policy { - retry_conditions = ["server_error"] - num_retries = 1 - per_try_timeout = "1s" - } - request_mirror_policy { - destination { - service_name = "new" - weight = 1 - } - } - cors_policy { - allow_origins = ["example"] - allow_methods = ["GET", "PUT"] - allow_headers = ["version", "type"] - expose_headers = ["version", "type"] - max_age = "1s" - allow_credentials = true - disabled = false - } - request_header_modifier { - set = { "version": "1", "type" : "json"} - add = { "minor-version": "1"} - remove = ["arg"] - } - response_header_modifier { - set = { "version": "1", "type" : "json"} - add = { "minor-version": "1"} - remove = ["removearg"] - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_http_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_http_route_basic.tf.tmpl deleted file mode 100644 index c01e1226d7a2..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_http_route_basic.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_network_services_http_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - hostnames = ["example"] - rules { - matches { - query_parameters { - query_parameter = "key" - exact_match = "value" - } - full_path_match = "example" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_http_route_matches_and_actions.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_http_route_matches_and_actions.tf.tmpl deleted file mode 100644 index e6e4a5c605a4..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_http_route_matches_and_actions.tf.tmpl +++ /dev/null @@ -1,84 +0,0 @@ -resource "google_network_services_http_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - hostnames = ["example"] - rules { - matches { - headers { - header = "header" - invert_match = false - regex_match = "header-value" - } - query_parameters { - query_parameter = "key" - exact_match = "value" - } - prefix_match = "example" - ignore_case = false - } - matches { - headers { - header = "header" - invert_match = false - present_match = true - } - query_parameters { - query_parameter = "key" - regex_match = "value" - } - regex_match = "example" - ignore_case = false - } - matches { - headers { - header = "header" - invert_match = false - present_match = true - } - query_parameters { - query_parameter = "key" - present_match = true - } - full_path_match = "example" - ignore_case = false - } - action { - redirect { - host_redirect = "new-host" - path_redirect = "new-path" - prefix_rewrite = "new-prefix" - https_redirect = true - strip_query = true - port_redirect = 8081 - } - url_rewrite { - path_prefix_rewrite = "new-prefix" - host_rewrite = "new-host" - } - retry_policy { - retry_conditions = ["server_error"] - num_retries = 1 - per_try_timeout = "1s" - } - request_mirror_policy { - destination { - service_name = "new" - weight = 1 - } - } - cors_policy { - allow_origins = ["example"] - allow_methods = ["GET", "PUT"] - allow_headers = ["version", "type"] - expose_headers = ["version", "type"] - max_age = "1s" - allow_credentials = true - disabled = false - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_http_route_mesh_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_http_route_mesh_basic.tf.tmpl deleted file mode 100644 index ff4acf3b3dda..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_http_route_mesh_basic.tf.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" -} - -resource "google_network_services_http_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - hostnames = ["example"] - meshes = [ - google_network_services_mesh.{{$.PrimaryResourceId}}.id - ] - rules { - matches { - query_parameters { - query_parameter = "key" - exact_match = "value" - } - full_path_match = "example" - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_lb_route_extension_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_lb_route_extension_basic.tf.tmpl deleted file mode 100644 index ed012d98ccb0..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_lb_route_extension_basic.tf.tmpl +++ /dev/null @@ -1,348 +0,0 @@ -# Internal HTTP load balancer with a managed instance group backend -# VPC network -resource "google_compute_network" "ilb_network" { - name = "{{index $.Vars "ilb_network_name"}}" - auto_create_subnetworks = false -} - -# proxy-only subnet -resource "google_compute_subnetwork" "proxy_subnet" { - name = "{{index $.Vars "proxy_subnet_name"}}" - ip_cidr_range = "10.0.0.0/24" - region = "us-west1" - purpose = "REGIONAL_MANAGED_PROXY" - role = "ACTIVE" - network = google_compute_network.ilb_network.id -} - -# backend subnet -resource "google_compute_subnetwork" "ilb_subnet" { - name = "{{index $.Vars "backend_subnet_name"}}" - ip_cidr_range = "10.0.1.0/24" - region = "us-west1" - network = google_compute_network.ilb_network.id - - depends_on = [ - google_compute_subnetwork.proxy_subnet - ] -} - -# forwarding rule -resource "google_compute_forwarding_rule" "default" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-west1" - ip_protocol = "TCP" - load_balancing_scheme = "INTERNAL_MANAGED" - port_range = "80" - target = google_compute_region_target_http_proxy.default.id - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - network_tier = "PREMIUM" - - depends_on = [ - google_compute_subnetwork.proxy_subnet - ] -} - -# HTTP target proxy -resource "google_compute_region_target_http_proxy" "default" { - name = "{{index $.Vars "target_http_proxy_name"}}" - region = "us-west1" - url_map = google_compute_region_url_map.default.id -} - -# URL map -resource "google_compute_region_url_map" "default" { - name = "tf-test-l7-ilb-regional-url-map%{random_suffix}" - region = "us-west1" - default_service = google_compute_region_backend_service.default.id - - host_rule { - hosts = ["service-extensions.com"] - path_matcher = "callouts" - } - - path_matcher { - name = "callouts" - default_service = google_compute_region_backend_service.callouts_backend.id - } -} - -# backend service -resource "google_compute_region_backend_service" "default" { - name = "{{index $.Vars "backend_service_name"}}" - region = "us-west1" - protocol = "HTTP" - load_balancing_scheme = "INTERNAL_MANAGED" - timeout_sec = 10 - health_checks = [google_compute_region_health_check.default.id] - - backend { - group = google_compute_region_instance_group_manager.mig.instance_group - balancing_mode = "UTILIZATION" - capacity_scaler = 1.0 - } -} - -# instance template -resource "google_compute_instance_template" "instance_template" { - name = "{{index $.Vars "mig_template_name"}}" - machine_type = "e2-small" - tags = ["http-server"] - - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - - access_config { - # add external ip to fetch packages - } - } - - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y nginx-light jq - - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - - cat < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - - lifecycle { - create_before_destroy = true - } -} - -# health check -resource "google_compute_region_health_check" "default" { - name = "{{index $.Vars "hc_name"}}" - region = "us-west1" - - http_health_check { - port_specification = "USE_SERVING_PORT" - } -} - -# MIG -resource "google_compute_region_instance_group_manager" "mig" { - name = "{{index $.Vars "mig_name"}}" - region = "us-west1" - - base_instance_name = "vm" - target_size = 2 - - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } -} - -# allow all access from IAP and health check ranges -resource "google_compute_firewall" "fw_iap" { - name = "{{index $.Vars "fw_allow_iap_hc_name"}}" - direction = "INGRESS" - network = google_compute_network.ilb_network.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] - - allow { - protocol = "tcp" - } -} - -# allow http from proxy subnet to backends -resource "google_compute_firewall" "fw_ilb_to_backends" { - name = "{{index $.Vars "fw_allow_ilb_to_backends_name"}}" - direction = "INGRESS" - network = google_compute_network.ilb_network.id - source_ranges = ["10.0.0.0/24"] - target_tags = ["http-server"] - - allow { - protocol = "tcp" - ports = ["80", "443", "8080"] - } - - depends_on = [ - google_compute_firewall.fw_iap - ] -} - -resource "google_network_services_lb_route_extension" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "lb_route_extension_name"}}" - description = "my route extension" - location = "us-west1" - load_balancing_scheme = "INTERNAL_MANAGED" - forwarding_rules = [google_compute_forwarding_rule.default.self_link] - - extension_chains { - name = "chain1" - - match_condition { - cel_expression = "request.path.startsWith('/extensions')" - } - - extensions { - name = "ext11" - authority = "ext11.com" - service = google_compute_region_backend_service.callouts_backend.self_link - timeout = "0.1s" - fail_open = false - - forward_headers = ["custom-header"] - } - } - - labels = { - foo = "bar" - } -} - -# test instance -resource "google_compute_instance" "vm_test" { - name = "{{index $.Vars "vm_test_name"}}" - zone = "us-west1-b" - machine_type = "e2-small" - - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - } - - boot_disk { - initialize_params { - image = "debian-cloud/debian-11" - } - } -} - -# Route Extension Backend Instance -resource "google_compute_instance" "callouts_instance" { - name = "{{index $.Vars "callouts_instance_name"}}" - zone = "us-west1-a" - machine_type = "e2-small" - - labels = { - "container-vm" = "cos-stable-109-17800-147-54" - } - - tags = ["allow-ssh","load-balanced-backend"] - - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.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" - } - } - - # Initialize an Envoy's Ext Proc gRPC API based on a docker container - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - apt-get update - apt-get install apache2 -y - a2ensite default-ssl - a2enmod ssl - echo "Page served from second backend service" | tee /var/www/html/index.html - systemctl restart apache2' - EOF1 - } - - lifecycle { - create_before_destroy = true - } - - deletion_protection = false - - depends_on = [ - google_compute_instance.vm_test - ] -} - -// callouts instance group -resource "google_compute_instance_group" "callouts_instance_group" { - name = "{{index $.Vars "callouts_instance_group"}}" - 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" - } -} - -# callout health check -resource "google_compute_region_health_check" "callouts_health_check" { - name = "{{index $.Vars "callouts_hc_name"}}" - region = "us-west1" - - http_health_check { - port = 80 - } - - depends_on = [ - google_compute_region_health_check.default - ] -} - -# callout backend service -resource "google_compute_region_backend_service" "callouts_backend" { - name = "{{index $.Vars "callouts_backend_name"}}" - region = "us-west1" - protocol = "HTTP2" - load_balancing_scheme = "INTERNAL_MANAGED" - timeout_sec = 10 - 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 - } - - depends_on = [ - google_compute_region_backend_service.default - ] -} diff --git a/mmv1/templates/terraform/examples/go/network_services_lb_traffic_extension_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_lb_traffic_extension_basic.tf.tmpl deleted file mode 100644 index 9943d494b2f1..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_lb_traffic_extension_basic.tf.tmpl +++ /dev/null @@ -1,334 +0,0 @@ -# Internal HTTP load balancer with a managed instance group backend -# VPC network -resource "google_compute_network" "ilb_network" { - name = "{{index $.Vars "ilb_network_name"}}" - auto_create_subnetworks = false -} - -# proxy-only subnet -resource "google_compute_subnetwork" "proxy_subnet" { - name = "{{index $.Vars "proxy_subnet_name"}}" - ip_cidr_range = "10.0.0.0/24" - region = "us-west1" - purpose = "REGIONAL_MANAGED_PROXY" - role = "ACTIVE" - network = google_compute_network.ilb_network.id -} - -# backend subnet -resource "google_compute_subnetwork" "ilb_subnet" { - name = "{{index $.Vars "backend_subnet_name"}}" - ip_cidr_range = "10.0.1.0/24" - region = "us-west1" - network = google_compute_network.ilb_network.id - - depends_on = [ - google_compute_subnetwork.proxy_subnet - ] -} - -# forwarding rule -resource "google_compute_forwarding_rule" "default" { - name = "{{index $.Vars "forwarding_rule_name"}}" - region = "us-west1" - ip_protocol = "TCP" - load_balancing_scheme = "INTERNAL_MANAGED" - port_range = "80" - target = google_compute_region_target_http_proxy.default.id - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - network_tier = "PREMIUM" - - depends_on = [ - google_compute_subnetwork.proxy_subnet - ] -} - -# HTTP target proxy -resource "google_compute_region_target_http_proxy" "default" { - name = "{{index $.Vars "target_http_proxy_name"}}" - region = "us-west1" - url_map = google_compute_region_url_map.default.id -} - -# URL map -resource "google_compute_region_url_map" "default" { - name = "{{index $.Vars "regional_url_map_name"}}" - region = "us-west1" - default_service = google_compute_region_backend_service.default.id -} - -# backend service -resource "google_compute_region_backend_service" "default" { - name = "{{index $.Vars "backend_service_name"}}" - region = "us-west1" - protocol = "HTTP" - load_balancing_scheme = "INTERNAL_MANAGED" - timeout_sec = 10 - health_checks = [google_compute_region_health_check.default.id] - - backend { - group = google_compute_region_instance_group_manager.mig.instance_group - balancing_mode = "UTILIZATION" - capacity_scaler = 1.0 - } -} - -# instance template -resource "google_compute_instance_template" "instance_template" { - name = "{{index $.Vars "mig_template_name"}}" - machine_type = "e2-small" - tags = ["http-server"] - - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - - access_config { - # add external ip to fetch packages - } - } - - disk { - source_image = "debian-cloud/debian-12" - auto_delete = true - boot = true - } - - # install nginx and serve a simple web page - metadata = { - startup-script = <<-EOF1 - #! /bin/bash - set -euo pipefail - - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y nginx-light jq - - NAME=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/hostname") - IP=$(curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip") - METADATA=$(curl -f -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=True" | jq 'del(.["startup-script"])') - - cat < /var/www/html/index.html -
-      Name: $NAME
-      IP: $IP
-      Metadata: $METADATA
-      
- EOF - EOF1 - } - - lifecycle { - create_before_destroy = true - } -} - -# health check -resource "google_compute_region_health_check" "default" { - name = "{{index $.Vars "hc_name"}}" - region = "us-west1" - - http_health_check { - port_specification = "USE_SERVING_PORT" - } -} - -# MIG -resource "google_compute_region_instance_group_manager" "mig" { - name = "{{index $.Vars "mig_name"}}" - region = "us-west1" - - base_instance_name = "vm" - target_size = 2 - - version { - instance_template = google_compute_instance_template.instance_template.id - name = "primary" - } -} - -# allow all access from IAP and health check ranges -resource "google_compute_firewall" "fw_iap" { - name = "{{index $.Vars "fw_allow_iap_hc_name"}}" - direction = "INGRESS" - network = google_compute_network.ilb_network.id - source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] - - allow { - protocol = "tcp" - } -} - -# allow http from proxy subnet to backends -resource "google_compute_firewall" "fw_ilb_to_backends" { - name = "{{index $.Vars "fw_allow_ilb_to_backends_name"}}" - direction = "INGRESS" - network = google_compute_network.ilb_network.id - source_ranges = ["10.0.0.0/24"] - target_tags = ["http-server"] - - allow { - protocol = "tcp" - ports = ["80", "443", "8080"] - } - - depends_on = [ - google_compute_firewall.fw_iap - ] -} - -resource "google_network_services_lb_traffic_extension" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "lb_traffic_extension_name"}}" - description = "my traffic extension" - location = "us-west1" - - load_balancing_scheme = "INTERNAL_MANAGED" - forwarding_rules = [google_compute_forwarding_rule.default.self_link] - - extension_chains { - name = "chain1" - - match_condition { - cel_expression = "request.host == 'example.com'" - } - - extensions { - name = "ext11" - authority = "ext11.com" - service = google_compute_region_backend_service.callouts_backend.self_link - timeout = "0.1s" - fail_open = false - - supported_events = ["REQUEST_HEADERS"] - forward_headers = ["custom-header"] - } - } - - labels = { - foo = "bar" - } -} - -# test instance -resource "google_compute_instance" "vm_test" { - name = "{{index $.Vars "vm_test_name"}}" - zone = "us-west1-b" - machine_type = "e2-small" - - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.id - } - - boot_disk { - initialize_params { - image = "debian-cloud/debian-11" - } - } -} - -# Traffic Extension Backend Instance -resource "google_compute_instance" "callouts_instance" { - name = "{{index $.Vars "callouts_instance_name"}}" - zone = "us-west1-a" - machine_type = "e2-small" - - labels = { - "container-vm" = "cos-stable-109-17800-147-54" - } - - tags = ["allow-ssh","load-balanced-backend"] - - network_interface { - network = google_compute_network.ilb_network.id - subnetwork = google_compute_subnetwork.ilb_subnet.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" - } - } - - # 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/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" - } - - lifecycle { - create_before_destroy = true - } - - deletion_protection = false - - depends_on = [ - google_compute_instance.vm_test - ] -} - -// callouts instance group -resource "google_compute_instance_group" "callouts_instance_group" { - name = "{{index $.Vars "callouts_instance_group"}}" - 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" - } -} - -# callout health check -resource "google_compute_region_health_check" "callouts_health_check" { - name = "{{index $.Vars "callouts_hc_name"}}" - region = "us-west1" - - http_health_check { - port = 80 - } - - depends_on = [ - google_compute_region_health_check.default - ] -} - -# callout backend service -resource "google_compute_region_backend_service" "callouts_backend" { - name = "{{index $.Vars "callouts_backend_name"}}" - region = "us-west1" - protocol = "HTTP2" - load_balancing_scheme = "INTERNAL_MANAGED" - timeout_sec = 10 - 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 - } - - depends_on = [ - google_compute_region_backend_service.default - ] -} diff --git a/mmv1/templates/terraform/examples/go/network_services_mesh_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_mesh_basic.tf.tmpl deleted file mode 100644 index c07c7fa5895c..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_mesh_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - interception_port = 443 -} diff --git a/mmv1/templates/terraform/examples/go/network_services_mesh_no_port.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_mesh_no_port.tf.tmpl deleted file mode 100644 index 285ffb5e6fa1..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_mesh_no_port.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_service_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_service_binding_basic.tf.tmpl deleted file mode 100644 index b4e09d42bdb6..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_service_binding_basic.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" { - provider = google-beta - namespace_id = "{{index $.Vars "namespace_id"}}" - location = "us-central1" -} - -resource "google_service_directory_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - service_id = "{{index $.Vars "service_id"}}" - namespace = google_service_directory_namespace.{{$.PrimaryResourceId}}.id - - metadata = { - stage = "prod" - region = "us-central1" - } -} - -resource "google_network_services_service_binding" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - service = google_service_directory_service.{{$.PrimaryResourceId}}.id -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_service_lb_policies_advanced.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_service_lb_policies_advanced.tf.tmpl deleted file mode 100644 index 51680aa0e867..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_service_lb_policies_advanced.tf.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -resource "google_network_services_service_lb_policies" "{{$.PrimaryResourceId}}" { - provider = google-beta - - name = "{{index $.Vars "resource_name"}}" - location = "global" - description = "my description" - load_balancing_algorithm = "SPRAY_TO_REGION" - - auto_capacity_drain { - enable = true - } - - failover_config { - failover_health_threshold = 70 - } - - labels = { - foo = "bar" - } -} - -resource "google_compute_backend_service" "default" { - provider = google-beta - - name = "{{index $.Vars "backend_name"}}" - description = "my description" - load_balancing_scheme = "INTERNAL_SELF_MANAGED" - protocol = "HTTP" - service_lb_policy = "//networkservices.googleapis.com/${google_network_services_service_lb_policies.{{$.PrimaryResourceId}}.id}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_service_lb_policies_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_service_lb_policies_basic.tf.tmpl deleted file mode 100644 index db6ea6cd28e2..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_service_lb_policies_basic.tf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resource "google_network_services_service_lb_policies" "{{$.PrimaryResourceId}}" { - provider = google-beta - - name = "{{index $.Vars "resource_name"}}" - location = "global" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_tcp_route_actions.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_tcp_route_actions.tf.tmpl deleted file mode 100644 index d978673267eb..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_tcp_route_actions.tf.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - provider = google-beta - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} - -resource "google_network_services_tcp_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - rules { - action { - destinations { - service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id - weight = 1 - } - original_destination = false - idle_timeout = "60s" - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_tcp_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_tcp_route_basic.tf.tmpl deleted file mode 100644 index 773b5baf3752..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_tcp_route_basic.tf.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - provider = google-beta - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} - -resource "google_network_services_tcp_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - rules { - matches { - address = "10.0.0.1/32" - port = "8081" - } - action { - destinations { - service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id - weight = 1 - } - original_destination = false - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/network_services_tcp_route_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_tcp_route_gateway_basic.tf.tmpl deleted file mode 100644 index 1e29035956f3..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_tcp_route_gateway_basic.tf.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - provider = google-beta - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} - -resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - scope = "my-scope" - type = "OPEN_MESH" - ports = [443] -} - - -resource "google_network_services_tcp_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - gateways = [ - google_network_services_gateway.{{$.PrimaryResourceId}}.id - ] - rules { - matches { - address = "10.0.0.1/32" - port = "8081" - } - action { - destinations { - service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id - weight = 1 - } - original_destination = false - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_tcp_route_mesh_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_tcp_route_mesh_basic.tf.tmpl deleted file mode 100644 index 2d739980a95c..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_tcp_route_mesh_basic.tf.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - provider = google-beta - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} - -resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" -} - - -resource "google_network_services_tcp_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - meshes = [ - google_network_services_mesh.{{$.PrimaryResourceId}}.id - ] - rules { - matches { - address = "10.0.0.1/32" - port = "8081" - } - action { - destinations { - service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id - weight = 1 - } - original_destination = false - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_tls_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_tls_route_basic.tf.tmpl deleted file mode 100644 index 63898224d74f..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_tls_route_basic.tf.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - provider = google-beta - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} - -resource "google_network_services_tls_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - description = "my description" - rules { - matches { - sni_host = ["example.com"] - alpn = ["http/1.1"] - } - action { - destinations { - service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id - weight = 1 - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_tls_route_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_tls_route_gateway_basic.tf.tmpl deleted file mode 100644 index a7b11eec544d..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_tls_route_gateway_basic.tf.tmpl +++ /dev/null @@ -1,46 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - provider = google-beta - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} - -resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" - scope = "my-scope" - type = "OPEN_MESH" - ports = [443] -} - -resource "google_network_services_tls_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - description = "my description" - gateways = [ - google_network_services_gateway.{{$.PrimaryResourceId}}.id - ] - rules { - matches { - sni_host = ["example.com"] - alpn = ["http/1.1"] - } - action { - destinations { - service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id - weight = 1 - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/network_services_tls_route_mesh_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/network_services_tls_route_mesh_basic.tf.tmpl deleted file mode 100644 index 692e818007ee..000000000000 --- a/mmv1/templates/terraform/examples/go/network_services_tls_route_mesh_basic.tf.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "backend_service_name"}}" - health_checks = [google_compute_http_health_check.default.id] -} - -resource "google_compute_http_health_check" "default" { - provider = google-beta - name = "{{index $.Vars "http_health_check_name"}}" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} - -resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - labels = { - foo = "bar" - } - description = "my description" -} - - -resource "google_network_services_tls_route" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "resource_name"}}" - description = "my description" - meshes = [ - google_network_services_mesh.{{$.PrimaryResourceId}}.id - ] - rules { - matches { - sni_host = ["example.com"] - alpn = ["http/1.1"] - } - action { - destinations { - service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id - weight = 1 - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/node_group_autoscaling_policy.tf.tmpl b/mmv1/templates/terraform/examples/go/node_group_autoscaling_policy.tf.tmpl deleted file mode 100644 index 4a9b744f292d..000000000000 --- a/mmv1/templates/terraform/examples/go/node_group_autoscaling_policy.tf.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -resource "google_compute_node_template" "soletenant-tmpl" { - name = "{{index $.Vars "template_name"}}" - region = "us-central1" - node_type = "n1-node-96-624" -} - -resource "google_compute_node_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "group_name"}}" - zone = "us-central1-f" - description = "example google_compute_node_group for Terraform Google Provider" - maintenance_policy = "RESTART_IN_PLACE" - maintenance_window { - start_time = "08:00" - } - initial_size = 1 - node_template = google_compute_node_template.soletenant-tmpl.id - autoscaling_policy { - mode = "ONLY_SCALE_OUT" - min_nodes = 1 - max_nodes = 10 - } -} diff --git a/mmv1/templates/terraform/examples/go/node_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/node_group_basic.tf.tmpl deleted file mode 100644 index 46215b216663..000000000000 --- a/mmv1/templates/terraform/examples/go/node_group_basic.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_compute_node_template" "soletenant-tmpl" { - name = "{{index $.Vars "template_name"}}" - region = "us-central1" - node_type = "n1-node-96-624" -} - -resource "google_compute_node_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "group_name"}}" - zone = "us-central1-f" - description = "example google_compute_node_group for Terraform Google Provider" - - initial_size = 1 - node_template = google_compute_node_template.soletenant-tmpl.id -} diff --git a/mmv1/templates/terraform/examples/go/node_group_maintenance_interval.tf.tmpl b/mmv1/templates/terraform/examples/go/node_group_maintenance_interval.tf.tmpl deleted file mode 100644 index f7e332c6a604..000000000000 --- a/mmv1/templates/terraform/examples/go/node_group_maintenance_interval.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_compute_node_template" "soletenant-tmpl" { - provider = google-beta - name = "{{index $.Vars "template_name"}}" - region = "us-central1" - node_type = "c2-node-60-240" -} - -resource "google_compute_node_group" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "{{index $.Vars "group_name"}}" - zone = "us-central1-a" - description = "example google_compute_node_group for Terraform Google Provider" - - initial_size = 1 - node_template = google_compute_node_template.soletenant-tmpl.id - - maintenance_interval = "RECURRENT" -} diff --git a/mmv1/templates/terraform/examples/go/node_group_share_settings.tf.tmpl b/mmv1/templates/terraform/examples/go/node_group_share_settings.tf.tmpl deleted file mode 100644 index 94800793ec5c..000000000000 --- a/mmv1/templates/terraform/examples/go/node_group_share_settings.tf.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -resource "google_project" "guest_project" { - project_id = "{{index $.Vars "guest_project_id"}}" - name = "{{index $.Vars "guest_project_name"}}" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} - -resource "google_compute_node_template" "soletenant-tmpl" { - name = "{{index $.Vars "template_name"}}" - region = "us-central1" - node_type = "n1-node-96-624" -} - -resource "google_compute_node_group" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "group_name"}}" - zone = "us-central1-f" - description = "example google_compute_node_group for Terraform Google Provider" - - initial_size = 1 - node_template = google_compute_node_template.soletenant-tmpl.id - - share_settings { - share_type = "SPECIFIC_PROJECTS" - project_map { - id = google_project.guest_project.project_id - project_id = google_project.guest_project.project_id - } - } -} - diff --git a/mmv1/templates/terraform/examples/go/node_template_accelerators.tf.tmpl b/mmv1/templates/terraform/examples/go/node_template_accelerators.tf.tmpl deleted file mode 100644 index a2066aa68599..000000000000 --- a/mmv1/templates/terraform/examples/go/node_template_accelerators.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -data "google_compute_node_types" "central1a" { - zone = "us-central1-a" -} - -resource "google_compute_node_template" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "template_name"}}" - region = "us-central1" - node_type = "n1-node-96-624" - - accelerators { - accelerator_type = "nvidia-tesla-t4" - accelerator_count = 4 - } -} - diff --git a/mmv1/templates/terraform/examples/go/node_template_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/node_template_basic.tf.tmpl deleted file mode 100644 index 44ebd317a9d2..000000000000 --- a/mmv1/templates/terraform/examples/go/node_template_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_compute_node_template" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "template_name"}}" - region = "us-central1" - node_type = "n1-node-96-624" -} diff --git a/mmv1/templates/terraform/examples/go/node_template_server_binding.tf.tmpl b/mmv1/templates/terraform/examples/go/node_template_server_binding.tf.tmpl deleted file mode 100644 index 7ffc6c962ab0..000000000000 --- a/mmv1/templates/terraform/examples/go/node_template_server_binding.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -data "google_compute_node_types" "central1a" { - zone = "us-central1-a" -} - -resource "google_compute_node_template" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "template_name"}}" - region = "us-central1" - node_type = "n1-node-96-624" - - node_affinity_labels = { - foo = "baz" - } - - server_binding { - type = "RESTART_NODE_ON_MINIMAL_SERVERS" - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_environment_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_environment_basic.tf.tmpl deleted file mode 100644 index f9ef4114b963..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_environment_basic.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -resource "google_notebooks_environment" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "environment_name"}}" - location = "us-west1-a" - container_image { - repository = "gcr.io/deeplearning-platform-release/base-cpu" - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_instance_basic.tf.tmpl deleted file mode 100644 index c3a4e1e94acf..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_instance_basic.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - location = "us-west1-a" - machine_type = "e2-medium" - vm_image { - project = "deeplearning-platform-release" - image_family = "tf-latest-cpu" - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_instance_basic_container.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_instance_basic_container.tf.tmpl deleted file mode 100644 index 69a2f09a2f31..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_instance_basic_container.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - location = "us-west1-a" - machine_type = "e2-medium" - metadata = { - proxy-mode = "service_account" - terraform = "true" - } - container_image { - repository = "gcr.io/deeplearning-platform-release/base-cpu" - tag = "latest" - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_instance_basic_gpu.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_instance_basic_gpu.tf.tmpl deleted file mode 100644 index 00be07fddb1d..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_instance_basic_gpu.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - location = "us-west1-a" - machine_type = "n1-standard-1" // can't be e2 because of accelerator - - install_gpu_driver = true - accelerator_config { - type = "NVIDIA_TESLA_T4" - core_count = 1 - } - vm_image { - project = "deeplearning-platform-release" - image_family = "tf-latest-gpu" - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_instance_basic_stopped.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_instance_basic_stopped.tf.tmpl deleted file mode 100644 index 45b14362e670..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_instance_basic_stopped.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - location = "us-west1-a" - machine_type = "e2-medium" - vm_image { - project = "deeplearning-platform-release" - image_family = "tf-latest-cpu" - } - desired_state = "STOPPED" -} diff --git a/mmv1/templates/terraform/examples/go/notebook_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_instance_full.tf.tmpl deleted file mode 100644 index 930acc42a524..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_instance_full.tf.tmpl +++ /dev/null @@ -1,52 +0,0 @@ -resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "instance_name"}}" - location = "us-central1-a" - machine_type = "e2-medium" - - vm_image { - project = "deeplearning-platform-release" - image_family = "tf-latest-cpu" - } - - instance_owners = [ "{{index $.TestEnvVars "service_account"}}"] - service_account = "{{index $.TestEnvVars "service_account"}}" - - install_gpu_driver = true - boot_disk_type = "PD_SSD" - boot_disk_size_gb = 110 - - no_public_ip = true - no_proxy_access = true - - network = data.google_compute_network.my_network.id - subnet = data.google_compute_subnetwork.my_subnetwork.id - - labels = { - k = "val" - } - - metadata = { - terraform = "true" - } - service_account_scopes = [ - "https://www.googleapis.com/auth/bigquery", - "https://www.googleapis.com/auth/devstorage.read_write", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/userinfo.email" - ] - - tags = ["foo", "bar"] - - disk_encryption = "CMEK" - kms_key = "{{index $.Vars "key_name"}}" - desired_state = "ACTIVE" -} - -data "google_compute_network" "my_network" { - name = "default" -} - -data "google_compute_subnetwork" "my_subnetwork" { - name = "default" - region = "us-central1" -} diff --git a/mmv1/templates/terraform/examples/go/notebook_runtime_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_runtime_basic.tf.tmpl deleted file mode 100644 index a2b6d4811892..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_runtime_basic.tf.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "runtime_name"}}" - location = "us-central1" - access_config { - access_type = "SINGLE_USER" - runtime_owner = "admin@hashicorptest.com" - } - virtual_machine { - virtual_machine_config { - machine_type = "n1-standard-4" - data_disk { - initialize_params { - disk_size_gb = "100" - disk_type = "PD_STANDARD" - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_runtime_basic_container.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_runtime_basic_container.tf.tmpl deleted file mode 100644 index bce1ea07d351..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_runtime_basic_container.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "runtime_name"}}" - location = "us-central1" - access_config { - access_type = "SINGLE_USER" - runtime_owner = "admin@hashicorptest.com" - } - virtual_machine { - virtual_machine_config { - machine_type = "n1-standard-4" - data_disk { - initialize_params { - disk_size_gb = "100" - disk_type = "PD_STANDARD" - } - } - container_images { - repository = "gcr.io/deeplearning-platform-release/base-cpu" - tag = "latest" - } - container_images { - repository = "gcr.io/deeplearning-platform-release/beam-notebooks" - tag = "latest" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_runtime_basic_gpu.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_runtime_basic_gpu.tf.tmpl deleted file mode 100644 index 939dbf16c46f..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_runtime_basic_gpu.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "runtime_name"}}" - location = "us-central1" - access_config { - access_type = "SINGLE_USER" - runtime_owner = "admin@hashicorptest.com" - } - software_config { - install_gpu_driver = true - } - virtual_machine { - virtual_machine_config { - machine_type = "n1-standard-4" - data_disk { - initialize_params { - disk_size_gb = "100" - disk_type = "PD_STANDARD" - } - } - accelerator_config { - core_count = "1" - type = "NVIDIA_TESLA_V100" - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_runtime_kernels.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_runtime_kernels.tf.tmpl deleted file mode 100644 index ca2cbaa4c487..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_runtime_kernels.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "runtime_name"}}" - location = "us-central1" - access_config { - access_type = "SINGLE_USER" - runtime_owner = "admin@hashicorptest.com" - } - software_config { - kernels { - repository = "gcr.io/deeplearning-platform-release/base-cpu" - tag = "latest" - } - } - virtual_machine { - virtual_machine_config { - machine_type = "n1-standard-4" - data_disk { - initialize_params { - disk_size_gb = "100" - disk_type = "PD_STANDARD" - } - } - } - } - labels = { - k = "val" - } -} diff --git a/mmv1/templates/terraform/examples/go/notebook_runtime_script.tf.tmpl b/mmv1/templates/terraform/examples/go/notebook_runtime_script.tf.tmpl deleted file mode 100644 index 0e36ed8a0af9..000000000000 --- a/mmv1/templates/terraform/examples/go/notebook_runtime_script.tf.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "runtime_name"}}" - location = "us-central1" - access_config { - access_type = "SINGLE_USER" - runtime_owner = "admin@hashicorptest.com" - } - software_config { - post_startup_script_behavior = "RUN_EVERY_START" - } - virtual_machine { - virtual_machine_config { - machine_type = "n1-standard-4" - data_disk { - initialize_params { - disk_size_gb = "100" - disk_type = "PD_STANDARD" - } - } - } - } - labels = { - k = "val" - } -} diff --git a/mmv1/templates/terraform/examples/go/notification_channel_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/notification_channel_basic.tf.tmpl deleted file mode 100644 index e0cc9f49b2e0..000000000000 --- a/mmv1/templates/terraform/examples/go/notification_channel_basic.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_monitoring_notification_channel" "{{$.PrimaryResourceId}}" { - display_name = "{{index $.Vars "display_name"}}" - type = "email" - labels = { - email_address = "fake_email@blahblah.com" - } - force_delete = false -} diff --git a/mmv1/templates/terraform/examples/go/notification_channel_sensitive.tf.tmpl b/mmv1/templates/terraform/examples/go/notification_channel_sensitive.tf.tmpl deleted file mode 100644 index 35c6e51c35dc..000000000000 --- a/mmv1/templates/terraform/examples/go/notification_channel_sensitive.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_monitoring_notification_channel" "{{$.PrimaryResourceId}}" { - display_name = "Test Slack Channel" - type = "slack" - labels = { - "channel_name" = "#foobar" - } - sensitive_labels { - auth_token = "one" - } -} diff --git a/mmv1/templates/terraform/examples/go/only_external_vpn_gateway_full.tf.tmpl b/mmv1/templates/terraform/examples/go/only_external_vpn_gateway_full.tf.tmpl deleted file mode 100644 index a687fa867636..000000000000 --- a/mmv1/templates/terraform/examples/go/only_external_vpn_gateway_full.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_compute_external_vpn_gateway" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "external_gateway_name"}}" - redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT" - description = "An externally managed VPN gateway" - interface { - id = 0 - ip_address = "8.8.8.8" - } - labels = { - key = "value" - } -} diff --git a/mmv1/templates/terraform/examples/go/org_policy_custom_constraint_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/org_policy_custom_constraint_basic.tf.tmpl deleted file mode 100644 index 2c231aef13bf..000000000000 --- a/mmv1/templates/terraform/examples/go/org_policy_custom_constraint_basic.tf.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -resource "google_org_policy_custom_constraint" "{{$.PrimaryResourceId}}" { - - name = "{{index $.Vars "policy_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - - action_type = "ALLOW" - condition = "resource.management.autoUpgrade == false" - method_types = ["CREATE", "UPDATE"] - resource_types = ["container.googleapis.com/NodePool"] -} diff --git a/mmv1/templates/terraform/examples/go/org_policy_custom_constraint_full.tf.tmpl b/mmv1/templates/terraform/examples/go/org_policy_custom_constraint_full.tf.tmpl deleted file mode 100644 index 5d49a61ea126..000000000000 --- a/mmv1/templates/terraform/examples/go/org_policy_custom_constraint_full.tf.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -resource "google_org_policy_custom_constraint" "{{$.PrimaryResourceId}}" { - - name = "{{index $.Vars "policy_name"}}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - display_name = "Disable GKE auto upgrade" - description = "Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced." - - action_type = "ALLOW" - condition = "resource.management.autoUpgrade == false" - method_types = ["CREATE", "UPDATE"] - resource_types = ["container.googleapis.com/NodePool"] -} - -resource "google_org_policy_policy" "bool" { - - name = "organizations/{{index $.TestEnvVars "org_id"}}/policies/${google_org_policy_custom_constraint.constraint.name}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - - spec { - rules { - enforce = "TRUE" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/org_policy_policy_dry_run_spec.tf.tmpl b/mmv1/templates/terraform/examples/go/org_policy_policy_dry_run_spec.tf.tmpl deleted file mode 100644 index a5a1bc790d2c..000000000000 --- a/mmv1/templates/terraform/examples/go/org_policy_policy_dry_run_spec.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_org_policy_custom_constraint" "constraint" { - name = "custom.disableGkeAutoUpgrade%{random_suffix}" - parent = "organizations/123456789" - display_name = "Disable GKE auto upgrade" - description = "Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced." - - action_type = "ALLOW" - condition = "resource.management.autoUpgrade == false" - method_types = ["CREATE"] - resource_types = ["container.googleapis.com/NodePool"] -} - -resource "google_org_policy_policy" "primary" { - name = "organizations/123456789/policies/${google_org_policy_custom_constraint.constraint.name}" - parent = "organizations/123456789" - - spec { - rules { - enforce = "FALSE" - } - } - dry_run_spec { - inherit_from_parent = false - reset = false - rules { - enforce = "FALSE" - } - } -} diff --git a/mmv1/templates/terraform/examples/go/org_policy_policy_enforce.tf.tmpl b/mmv1/templates/terraform/examples/go/org_policy_policy_enforce.tf.tmpl deleted file mode 100644 index 8441f6dcdc8f..000000000000 --- a/mmv1/templates/terraform/examples/go/org_policy_policy_enforce.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_org_policy_policy" "primary" { - name = "projects/${google_project.basic.name}/policies/iam.disableServiceAccountKeyUpload" - parent = "projects/${google_project.basic.name}" - - spec { - rules { - enforce = "FALSE" - } - } -} - -resource "google_project" "basic" { - project_id = "id" - name = "id" - org_id = "123456789" - deletion_policy = "DELETE" -} diff --git a/mmv1/templates/terraform/examples/go/org_policy_policy_folder.tf.tmpl b/mmv1/templates/terraform/examples/go/org_policy_policy_folder.tf.tmpl deleted file mode 100644 index 6d58a8cbc60b..000000000000 --- a/mmv1/templates/terraform/examples/go/org_policy_policy_folder.tf.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -resource "google_org_policy_policy" "primary" { - name = "${google_folder.basic.name}/policies/gcp.resourceLocations" - parent = google_folder.basic.name - - spec { - inherit_from_parent = true - - rules { - deny_all = "TRUE" - } - } -} - -resource "google_folder" "basic" { - parent = "organizations/123456789" - display_name = "folder" - deletion_protection = false -} diff --git a/mmv1/templates/terraform/examples/go/org_policy_policy_organization.tf.tmpl b/mmv1/templates/terraform/examples/go/org_policy_policy_organization.tf.tmpl deleted file mode 100644 index d5d73b2ac6c7..000000000000 --- a/mmv1/templates/terraform/examples/go/org_policy_policy_organization.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_org_policy_policy" "primary" { - name = "organizations/123456789/policies/gcp.detailedAuditLoggingMode" - parent = "organizations/123456789" - - spec { - reset = true - } -} diff --git a/mmv1/templates/terraform/examples/go/org_policy_policy_project.tf.tmpl b/mmv1/templates/terraform/examples/go/org_policy_policy_project.tf.tmpl deleted file mode 100644 index 7016cda43ed8..000000000000 --- a/mmv1/templates/terraform/examples/go/org_policy_policy_project.tf.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -resource "google_org_policy_policy" "primary" { - name = "projects/${google_project.basic.name}/policies/gcp.resourceLocations" - parent = "projects/${google_project.basic.name}" - - spec { - rules { - condition { - description = "A sample condition for the policy" - expression = "resource.matchTagId('tagKeys/123', 'tagValues/345')" - location = "sample-location.log" - title = "sample-condition" - } - - values { - allowed_values = ["projects/allowed-project"] - denied_values = ["projects/denied-project"] - } - } - - rules { - allow_all = "TRUE" - } - } -} - -resource "google_project" "basic" { - project_id = "id" - name = "id" - org_id = "123456789" - deletion_policy = "DELETE" -} diff --git a/mmv1/templates/terraform/examples/go/organization_access_approval_active_key_version.tf.tmpl b/mmv1/templates/terraform/examples/go/organization_access_approval_active_key_version.tf.tmpl deleted file mode 100644 index 629a4195a5be..000000000000 --- a/mmv1/templates/terraform/examples/go/organization_access_approval_active_key_version.tf.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -resource "google_project" "my_project" { - name = "My Project" - project_id = "your-project-id" - org_id = "{{index $.TestEnvVars "org_id"}}" - deletion_policy = "DELETE" -} - -resource "google_kms_key_ring" "key_ring" { - name = "key-ring" - location = "global" - project = google_project.my_project.project_id -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "crypto-key" - key_ring = google_kms_key_ring.key_ring.id - purpose = "ASYMMETRIC_SIGN" - - version_template { - algorithm = "EC_SIGN_P384_SHA384" - } -} - -data "google_access_approval_organization_service_account" "service_account" { - organization_id = "{{index $.TestEnvVars "org_id"}}" -} - -resource "google_kms_crypto_key_iam_member" "iam" { - crypto_key_id = google_kms_crypto_key.crypto_key.id - role = "roles/cloudkms.signerVerifier" - member = "serviceAccount:${data.google_access_approval_organization_service_account.service_account.account_email}" -} - -data "google_kms_crypto_key_version" "crypto_key_version" { - crypto_key = google_kms_crypto_key.crypto_key.id -} - -resource "google_organization_access_approval_settings" "{{$.PrimaryResourceId}}" { - organization_id = "{{index $.TestEnvVars "org_id"}}" - active_key_version = data.google_kms_crypto_key_version.crypto_key_version.name - - enrolled_services { - cloud_product = "all" - } - - depends_on = [google_kms_crypto_key_iam_member.iam] -} diff --git a/mmv1/templates/terraform/examples/go/organization_access_approval_full.tf.tmpl b/mmv1/templates/terraform/examples/go/organization_access_approval_full.tf.tmpl deleted file mode 100644 index 796f6fed6c23..000000000000 --- a/mmv1/templates/terraform/examples/go/organization_access_approval_full.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_organization_access_approval_settings" "{{$.PrimaryResourceId}}" { - organization_id = "{{index $.TestEnvVars "org_id"}}" - notification_emails = ["testuser@example.com", "example.user@example.com"] - - enrolled_services { - cloud_product = "appengine.googleapis.com" - } - - enrolled_services { - cloud_product = "dataflow.googleapis.com" - enrollment_level = "BLOCK_ALL" - } -} diff --git a/mmv1/templates/terraform/examples/go/organization_security_policy_association_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/organization_security_policy_association_basic.tf.tmpl deleted file mode 100644 index a8fd86eef059..000000000000 --- a/mmv1/templates/terraform/examples/go/organization_security_policy_association_basic.tf.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -resource "google_folder" "security_policy_target" { - provider = google-beta - display_name = "tf-test-secpol-%{random_suffix}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" - deletion_protection = false -} - -resource "google_compute_organization_security_policy" "policy" { - provider = google-beta - display_name = "tf-test%{random_suffix}" - parent = google_folder.security_policy_target.name -} - -resource "google_compute_organization_security_policy_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - policy_id = google_compute_organization_security_policy.{{$.PrimaryResourceId}}.id - action = "allow" - - direction = "INGRESS" - enable_logging = true - match { - config { - src_ip_ranges = ["192.168.0.0/16", "10.0.0.0/8"] - layer4_config { - ip_protocol = "tcp" - ports = ["22"] - } - layer4_config { - ip_protocol = "icmp" - } - } - } - priority = 100 -} - -resource "google_compute_organization_security_policy_association" "{{$.PrimaryResourceId}}" { - provider = google-beta - name = "tf-test%{random_suffix}" - attachment_id = google_compute_organization_security_policy.{{$.PrimaryResourceId}}.parent - policy_id = google_compute_organization_security_policy.{{$.PrimaryResourceId}}.id -} diff --git a/mmv1/templates/terraform/examples/go/organization_security_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/organization_security_policy_basic.tf.tmpl deleted file mode 100644 index 7481d667726e..000000000000 --- a/mmv1/templates/terraform/examples/go/organization_security_policy_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_compute_organization_security_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - display_name = "tf-test%{random_suffix}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" -} diff --git a/mmv1/templates/terraform/examples/go/organization_security_policy_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/organization_security_policy_rule_basic.tf.tmpl deleted file mode 100644 index 2e87d6940984..000000000000 --- a/mmv1/templates/terraform/examples/go/organization_security_policy_rule_basic.tf.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -resource "google_compute_organization_security_policy" "{{$.PrimaryResourceId}}" { - provider = google-beta - display_name = "tf-test%{random_suffix}" - parent = "organizations/{{index $.TestEnvVars "org_id"}}" -} - -resource "google_compute_organization_security_policy_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - - policy_id = google_compute_organization_security_policy.{{$.PrimaryResourceId}}.id - action = "allow" - - direction = "INGRESS" - enable_logging = true - match { - config { - src_ip_ranges = ["192.168.0.0/16", "10.0.0.0/8"] - layer4_config { - ip_protocol = "tcp" - ports = ["22"] - } - layer4_config { - ip_protocol = "icmp" - } - } - } - priority = 100 -} diff --git a/mmv1/templates/terraform/examples/go/os_config_guest_policies_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/os_config_guest_policies_basic.tf.tmpl deleted file mode 100644 index be07c04eed16..000000000000 --- a/mmv1/templates/terraform/examples/go/os_config_guest_policies_basic.tf.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -data "google_compute_image" "my_image" { - provider = google-beta - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_instance" "foobar" { - provider = google-beta - name = "{{index $.Vars "instance_name"}}" - machine_type = "e2-medium" - zone = "us-central1-a" - can_ip_forward = false - tags = ["foo", "bar"] - - boot_disk { - initialize_params { - image = data.google_compute_image.my_image.self_link - } - } - - network_interface { - network = "default" - } - - metadata = { - foo = "bar" - } -} - -resource "google_os_config_guest_policies" "{{$.PrimaryResourceId}}" { - provider = google-beta - guest_policy_id = "{{index $.Vars "guest_policy_id"}}" - - assignment { - instances = [google_compute_instance.foobar.id] - } - - packages { - name = "my-package" - desired_state = "UPDATED" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/os_config_guest_policies_packages.tf.tmpl b/mmv1/templates/terraform/examples/go/os_config_guest_policies_packages.tf.tmpl deleted file mode 100644 index f844c63adc64..000000000000 --- a/mmv1/templates/terraform/examples/go/os_config_guest_policies_packages.tf.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -resource "google_os_config_guest_policies" "{{$.PrimaryResourceId}}" { - provider = google-beta - guest_policy_id = "{{index $.Vars "guest_policy_id"}}" - - assignment { - group_labels { - labels = { - color = "red", - env = "test" - } - } - - group_labels { - labels = { - color = "blue", - env = "test" - } - } - } - - packages { - name = "my-package" - desired_state = "INSTALLED" - } - - packages { - name = "bad-package-1" - desired_state = "REMOVED" - } - - packages { - name = "bad-package-2" - desired_state = "REMOVED" - manager = "APT" - } - - package_repositories { - apt { - uri = "https://packages.cloud.google.com/apt" - archive_type = "DEB" - distribution = "cloud-sdk-stretch" - components = ["main"] - } - } - - package_repositories { - yum { - id = "google-cloud-sdk" - display_name = "Google Cloud SDK" - base_url = "https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64" - gpg_keys = ["https://packages.cloud.google.com/yum/doc/yum-key.gpg", "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"] - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/os_config_guest_policies_recipes.tf.tmpl b/mmv1/templates/terraform/examples/go/os_config_guest_policies_recipes.tf.tmpl deleted file mode 100644 index bec9d8fcab2e..000000000000 --- a/mmv1/templates/terraform/examples/go/os_config_guest_policies_recipes.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_os_config_guest_policies" "{{$.PrimaryResourceId}}" { - provider = google-beta - guest_policy_id = "{{index $.Vars "guest_policy_id"}}" - - assignment { - zones = ["us-east1-b", "us-east1-d"] - } - - recipes { - name = "{{index $.Vars "guest_policy_id"}}-recipe" - desired_state = "INSTALLED" - - artifacts { - id = "{{index $.Vars "guest_policy_id"}}-artifact-id" - - gcs { - bucket = "my-bucket" - object = "executable.msi" - generation = 1546030865175603 - } - } - - install_steps { - msi_installation { - artifact_id = "{{index $.Vars "guest_policy_id"}}-artifact-id" - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/os_config_patch_deployment_basic.tf.tmpl deleted file mode 100644 index be12837cd57a..000000000000 --- a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_basic.tf.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { - patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" - - instance_filter { - all = true - } - - one_time_schedule { - execute_time = "2999-10-10T10:10:10.045123456Z" - } -} diff --git a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_daily.tf.tmpl b/mmv1/templates/terraform/examples/go/os_config_patch_deployment_daily.tf.tmpl deleted file mode 100644 index 46697c651a88..000000000000 --- a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_daily.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { - patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" - - instance_filter { - all = true - } - - recurring_schedule { - time_zone { - id = "America/New_York" - } - - time_of_day { - hours = 0 - minutes = 30 - seconds = 30 - nanos = 20 - } - } -} diff --git a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_daily_midnight.tf.tmpl b/mmv1/templates/terraform/examples/go/os_config_patch_deployment_daily_midnight.tf.tmpl deleted file mode 100644 index e1645921b46d..000000000000 --- a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_daily_midnight.tf.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { - patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" - - instance_filter { - all = true - } - - recurring_schedule { - time_zone { - id = "America/New_York" - } - - time_of_day { - hours = 0 - minutes = 0 - seconds = 0 - nanos = 0 - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_full.tf.tmpl b/mmv1/templates/terraform/examples/go/os_config_patch_deployment_full.tf.tmpl deleted file mode 100644 index a4457437bbf5..000000000000 --- a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_full.tf.tmpl +++ /dev/null @@ -1,108 +0,0 @@ -resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { - patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" - - instance_filter { - group_labels { - labels = { - env = "dev", - app = "web" - } - } - - instance_name_prefixes = ["test-"] - - zones = ["us-central1-a", "us-central-1c"] - } - - patch_config { - mig_instances_allowed = true - - reboot_config = "ALWAYS" - - apt { - type = "DIST" - excludes = ["python"] - } - - yum { - security = true - minimal = true - excludes = ["bash"] - } - - goo { - enabled = true - } - - zypper { - categories = ["security"] - } - - windows_update { - classifications = ["CRITICAL", "SECURITY", "UPDATE"] - excludes = ["5012170"] - } - - pre_step { - linux_exec_step_config { - allowed_success_codes = [0,3] - local_path = "/tmp/pre_patch_script.sh" - } - - windows_exec_step_config { - interpreter = "SHELL" - allowed_success_codes = [0,2] - local_path = "C:\\Users\\user\\pre-patch-script.cmd" - } - } - - post_step { - linux_exec_step_config { - gcs_object { - bucket = "my-patch-scripts" - generation_number = "1523477886880" - object = "linux/post_patch_script" - } - } - - windows_exec_step_config { - interpreter = "POWERSHELL" - gcs_object { - bucket = "my-patch-scripts" - generation_number = "135920493447" - object = "windows/post_patch_script.ps1" - } - } - } - } - - duration = "10s" - - recurring_schedule { - time_zone { - id = "America/New_York" - } - - time_of_day { - hours = 0 - minutes = 30 - seconds = 30 - nanos = 20 - } - - monthly { - week_day_of_month { - week_ordinal = -1 - day_of_week = "TUESDAY" - day_offset = 3 - } - } - } - - rollout { - mode = "ZONE_BY_ZONE" - disruption_budget { - fixed = 1 - } - } -} diff --git a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_instance.tf.tmpl b/mmv1/templates/terraform/examples/go/os_config_patch_deployment_instance.tf.tmpl deleted file mode 100644 index 086ff1b7962c..000000000000 --- a/mmv1/templates/terraform/examples/go/os_config_patch_deployment_instance.tf.tmpl +++ /dev/null @@ -1,59 +0,0 @@ -data "google_compute_image" "my_image" { - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_instance" "foobar" { - name = "{{index $.Vars "instance_name"}}" - machine_type = "e2-medium" - zone = "us-central1-a" - can_ip_forward = false - tags = ["foo", "bar"] - - boot_disk { - initialize_params { - image = data.google_compute_image.my_image.self_link - } - } - - network_interface { - network = "default" - } - - metadata = { - foo = "bar" - } -} - -resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { - patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" - - instance_filter { - instances = [google_compute_instance.foobar.id] - } - - patch_config { - yum { - security = true - minimal = true - excludes = ["bash"] - } - } - - recurring_schedule { - time_zone { - id = "America/New_York" - } - - time_of_day { - hours = 0 - minutes = 30 - seconds = 30 - nanos = 20 - } - - monthly { - month_day = 1 - } - } -} diff --git a/mmv1/templates/terraform/examples/go/os_login_ssh_key_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/os_login_ssh_key_basic.tf.tmpl deleted file mode 100644 index 48ac4dc7ae7c..000000000000 --- a/mmv1/templates/terraform/examples/go/os_login_ssh_key_basic.tf.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -data "google_client_openid_userinfo" "me" { -} - -resource "google_os_login_ssh_public_key" "{{$.PrimaryResourceId}}" { - user = data.google_client_openid_userinfo.me.email - key = file("path/to/id_rsa.pub") -} diff --git a/mmv1/templates/terraform/examples/go/parallelstore_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/parallelstore_instance_basic.tf.tmpl deleted file mode 100644 index a7f67c16d9d3..000000000000 --- a/mmv1/templates/terraform/examples/go/parallelstore_instance_basic.tf.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -resource "google_parallelstore_instance" "{{$.PrimaryResourceId}}" { - instance_id = "{{index $.Vars "name"}}" - location = "us-central1-a" - description = "test instance" - capacity_gib = 12000 - network = google_compute_network.network.name - file_stripe_level = "FILE_STRIPE_LEVEL_MIN" - directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN" - labels = { - test = "value" - } - provider = google-beta - depends_on = [google_service_networking_connection.default] -} - -resource "google_compute_network" "network" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = true - mtu = 8896 - provider = google-beta -} - -# Create an IP address -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "address_name"}}" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 24 - network = google_compute_network.network.id - provider = google-beta -} - -# Create a private connection -resource "google_service_networking_connection" "default" { - network = google_compute_network.network.id - service = "servicenetworking.googleapis.com" - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] - provider = google-beta -} diff --git a/mmv1/templates/terraform/examples/go/preference_set_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/preference_set_basic.tf.tmpl deleted file mode 100644 index 530190fb0253..000000000000 --- a/mmv1/templates/terraform/examples/go/preference_set_basic.tf.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -resource "google_migration_center_preference_set" "{{$.PrimaryResourceId}}" { - location = "us-central1" - preference_set_id = "{{index $.Vars "set_name"}}" - description = "Terraform integration test description" - display_name = "Terraform integration test display" - virtual_machine_preferences { - vmware_engine_preferences { - cpu_overcommit_ratio = 1.5 - } - sizing_optimization_strategy = "SIZING_OPTIMIZATION_STRATEGY_SAME_AS_SOURCE" - target_product = "COMPUTE_MIGRATION_TARGET_PRODUCT_COMPUTE_ENGINE" - } -} diff --git a/mmv1/templates/terraform/examples/go/preference_set_full.tf.tmpl b/mmv1/templates/terraform/examples/go/preference_set_full.tf.tmpl deleted file mode 100644 index 83703c9b4f64..000000000000 --- a/mmv1/templates/terraform/examples/go/preference_set_full.tf.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -resource "google_migration_center_preference_set" "{{$.PrimaryResourceId}}" { - location = "us-central1" - preference_set_id = "{{index $.Vars "set_name"}}" - description = "Terraform integration test description" - display_name = "Terraform integration test display" - virtual_machine_preferences { - vmware_engine_preferences { - cpu_overcommit_ratio = 1.5 - storage_deduplication_compression_ratio = 1.3 - commitment_plan = "ON_DEMAND" - } - sizing_optimization_strategy = "SIZING_OPTIMIZATION_STRATEGY_SAME_AS_SOURCE" - target_product = "COMPUTE_MIGRATION_TARGET_PRODUCT_COMPUTE_ENGINE" - commitment_plan = "COMMITMENT_PLAN_ONE_YEAR" - region_preferences { - preferred_regions = ["us-central1"] - } - sole_tenancy_preferences { - commitment_plan = "ON_DEMAND" - cpu_overcommit_ratio = 1.2 - host_maintenance_policy = "HOST_MAINTENANCE_POLICY_DEFAULT" - node_types { - node_name = "tf-test" - } - } - compute_engine_preferences { - license_type = "LICENSE_TYPE_BRING_YOUR_OWN_LICENSE" - machine_preferences { - allowed_machine_series { - code = "C3" - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/private_service_connect_google_apis.tf.tmpl b/mmv1/templates/terraform/examples/go/private_service_connect_google_apis.tf.tmpl deleted file mode 100644 index 7434666761aa..000000000000 --- a/mmv1/templates/terraform/examples/go/private_service_connect_google_apis.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -resource "google_compute_network" "network" { - provider = google-beta - project = "{{index $.TestEnvVars "project"}}" - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "vpc_subnetwork" { - provider = google-beta - project = google_compute_network.network.project - name = "{{index $.Vars "subnetwork_name"}}" - ip_cidr_range = "10.2.0.0/16" - region = "us-central1" - network = google_compute_network.network.id - private_ip_google_access = true -} - -resource "google_compute_global_address" "default" { - provider = google-beta - project = google_compute_network.network.project - name = "{{index $.Vars "global_address_name"}}" - address_type = "INTERNAL" - purpose = "PRIVATE_SERVICE_CONNECT" - network = google_compute_network.network.id - address = "100.100.100.106" -} - -resource "google_compute_global_forwarding_rule" "default" { - provider = google-beta - project = google_compute_network.network.project - name = "{{index $.Vars "forwarding_rule_name"}}" - target = "all-apis" - network = google_compute_network.network.id - ip_address = google_compute_global_address.default.id - load_balancing_scheme = "" - service_directory_registrations { - namespace = "sd-namespace" - service_directory_region = "europe-west3" - } -} diff --git a/mmv1/templates/terraform/examples/go/private_service_connect_google_apis_no_automate_dns.tf.tmpl b/mmv1/templates/terraform/examples/go/private_service_connect_google_apis_no_automate_dns.tf.tmpl deleted file mode 100644 index 182ce72e366c..000000000000 --- a/mmv1/templates/terraform/examples/go/private_service_connect_google_apis_no_automate_dns.tf.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -resource "google_compute_network" "network" { - provider = google-beta - project = "{{index $.TestEnvVars "project"}}" - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "vpc_subnetwork" { - provider = google-beta - project = google_compute_network.network.project - name = "{{index $.Vars "subnetwork_name"}}" - ip_cidr_range = "10.2.0.0/16" - region = "us-central1" - network = google_compute_network.network.id - private_ip_google_access = true -} - -resource "google_compute_global_address" "default" { - provider = google-beta - project = google_compute_network.network.project - name = "{{index $.Vars "global_address_name"}}" - address_type = "INTERNAL" - purpose = "PRIVATE_SERVICE_CONNECT" - network = google_compute_network.network.id - address = "100.100.100.106" -} - -resource "google_compute_global_forwarding_rule" "default" { - provider = google-beta - project = google_compute_network.network.project - name = "{{index $.Vars "forwarding_rule_name"}}" - target = "all-apis" - network = google_compute_network.network.id - ip_address = google_compute_global_address.default.id - load_balancing_scheme = "" - no_automate_dns_zone = false -} diff --git a/mmv1/templates/terraform/examples/go/privateca_capool_all_fields.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_capool_all_fields.tf.tmpl deleted file mode 100644 index 1fce3dc083ef..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_capool_all_fields.tf.tmpl +++ /dev/null @@ -1,89 +0,0 @@ -resource "google_privateca_ca_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-central1" - tier = "ENTERPRISE" - publishing_options { - publish_ca_cert = false - publish_crl = true - encoding_format = "PEM" - } - labels = { - foo = "bar" - } - issuance_policy { - allowed_key_types { - elliptic_curve { - signature_algorithm = "ECDSA_P256" - } - } - allowed_key_types { - rsa { - min_modulus_size = 5 - max_modulus_size = 10 - } - } - maximum_lifetime = "50000s" - allowed_issuance_modes { - allow_csr_based_issuance = true - allow_config_based_issuance = true - } - identity_constraints { - allow_subject_passthrough = true - allow_subject_alt_names_passthrough = true - cel_expression { - expression = "subject_alt_names.all(san, san.type == DNS || san.type == EMAIL )" - title = "My title" - } - } - baseline_values { - aia_ocsp_servers = ["example.com"] - additional_extensions { - critical = true - value = "asdf" - object_id { - object_id_path = [1, 7] - } - } - policy_ids { - object_id_path = [1, 5] - } - policy_ids { - object_id_path = [1, 5, 7] - } - ca_options { - is_ca = true - max_issuer_path_length = 10 - } - key_usage { - base_key_usage { - digital_signature = true - content_commitment = true - key_encipherment = false - data_encipherment = true - key_agreement = true - cert_sign = false - crl_sign = true - decipher_only = true - } - extended_key_usage { - server_auth = true - client_auth = false - email_protection = true - code_signing = true - time_stamping = true - } - } - name_constraints { - critical = true - permitted_dns_names = ["*.example1.com", "*.example2.com"] - excluded_dns_names = ["*.deny.example1.com", "*.deny.example2.com"] - permitted_ip_ranges = ["10.0.0.0/8", "11.0.0.0/8"] - excluded_ip_ranges = ["10.1.1.0/24", "11.1.1.0/24"] - permitted_email_addresses = [".example1.com", ".example2.com"] - excluded_email_addresses = [".deny.example1.com", ".deny.example2.com"] - permitted_uris = [".example1.com", ".example2.com"] - excluded_uris = [".deny.example1.com", ".deny.example2.com"] - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/privateca_capool_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_capool_basic.tf.tmpl deleted file mode 100644 index c5f76a407a83..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_capool_basic.tf.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -resource "google_privateca_ca_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-central1" - tier = "ENTERPRISE" - publishing_options { - publish_ca_cert = true - publish_crl = true - } - labels = { - foo = "bar" - } -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_authority_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_authority_basic.tf.tmpl deleted file mode 100644 index 82e718a57170..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_authority_basic.tf.tmpl +++ /dev/null @@ -1,48 +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 = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - x509_config { - ca_options { - is_ca = true - max_issuer_path_length = 10 - } - key_usage { - base_key_usage { - digital_signature = true - content_commitment = true - key_encipherment = false - data_encipherment = true - key_agreement = true - cert_sign = true - crl_sign = true - decipher_only = true - } - extended_key_usage { - server_auth = true - client_auth = false - email_protection = true - code_signing = true - time_stamping = true - } - } - } - } - lifetime = "86400s" - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_authority_byo_key.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_authority_byo_key.tf.tmpl deleted file mode 100644 index 5007897394c7..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_authority_byo_key.tf.tmpl +++ /dev/null @@ -1,70 +0,0 @@ -resource "google_project_service_identity" "privateca_sa" { - service = "privateca.googleapis.com" -} - -resource "google_kms_crypto_key_iam_member" "privateca_sa_keyuser_signerverifier" { - crypto_key_id = "{{index $.Vars "kms_key_name"}}" - role = "roles/cloudkms.signerVerifier" - - member = google_project_service_identity.privateca_sa.member -} - -resource "google_kms_crypto_key_iam_member" "privateca_sa_keyuser_viewer" { - crypto_key_id = "{{index $.Vars "kms_key_name"}}" - role = "roles/viewer" - member = google_project_service_identity.privateca_sa.member -} - -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"}}" - key_spec { - cloud_kms_key_version = "{{index $.Vars "kms_key_name"}}/cryptoKeyVersions/1" - } - - config { - subject_config { - subject { - organization = "Example, Org." - common_name = "Example Authority" - } - } - x509_config { - ca_options { - # is_ca *MUST* be true for certificate authorities - is_ca = true - max_issuer_path_length = 10 - } - 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 { - server_auth = false - } - } - name_constraints { - critical = true - permitted_dns_names = ["*.example.com"] - excluded_dns_names = ["*.deny.example.com"] - permitted_ip_ranges = ["10.0.0.0/8"] - excluded_ip_ranges = ["10.1.1.0/24"] - permitted_email_addresses = [".example.com"] - excluded_email_addresses = [".deny.example.com"] - permitted_uris = [".example.com"] - excluded_uris = [".deny.example.com"] - } - } - } - - depends_on = [ - google_kms_crypto_key_iam_member.privateca_sa_keyuser_signerverifier, - google_kms_crypto_key_iam_member.privateca_sa_keyuser_viewer, - ] -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_authority_custom_ski.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_authority_custom_ski.tf.tmpl deleted file mode 100644 index 6e898ab25e80..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_authority_custom_ski.tf.tmpl +++ /dev/null @@ -1,51 +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 = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - subject_key_id { - key_id = "4cf3372289b1d411b999dbb9ebcd44744b6b2fca" - } - x509_config { - ca_options { - is_ca = true - max_issuer_path_length = 10 - } - key_usage { - base_key_usage { - digital_signature = true - content_commitment = true - key_encipherment = false - data_encipherment = true - key_agreement = true - cert_sign = true - crl_sign = true - decipher_only = true - } - extended_key_usage { - server_auth = true - client_auth = false - email_protection = true - code_signing = true - time_stamping = true - } - } - } - } - lifetime = "86400s" - key_spec { - cloud_kms_key_version = "{{index $.Vars "kms_key_name"}}/cryptoKeyVersions/1" - } -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_authority_subordinate.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_authority_subordinate.tf.tmpl deleted file mode 100644 index f468ba2d74b3..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_authority_subordinate.tf.tmpl +++ /dev/null @@ -1,94 +0,0 @@ -resource "google_privateca_certificate_authority" "root-ca" { - pool = "{{index $.Vars "pool_name"}}" - certificate_authority_id = "{{index $.Vars "certificate_authority_id"}}-root" - location = "us-central1" - config { - subject_config { - subject { - organization = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - 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 { - server_auth = false - } - } - } - } - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - - // Disable CA deletion related safe checks for easier cleanup. - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true -} - -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"}}-sub" - location = "{{index $.Vars "pool_location"}}" - deletion_protection = "{{index $.Vars "deletion_protection"}}" - subordinate_config { - certificate_authority = google_privateca_certificate_authority.root-ca.name - } - config { - subject_config { - subject { - organization = "HashiCorp" - common_name = "my-subordinate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - x509_config { - ca_options { - is_ca = true - # Force the sub CA to only issue leaf certs - max_issuer_path_length = 0 - } - key_usage { - base_key_usage { - digital_signature = true - content_commitment = true - key_encipherment = false - data_encipherment = true - key_agreement = true - cert_sign = true - crl_sign = true - decipher_only = true - } - extended_key_usage { - server_auth = true - client_auth = false - email_protection = true - code_signing = true - time_stamping = true - } - } - } - } - lifetime = "86400s" - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - type = "SUBORDINATE" -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_config.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_config.tf.tmpl deleted file mode 100644 index fb81cda6f900..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_config.tf.tmpl +++ /dev/null @@ -1,100 +0,0 @@ - -resource "google_privateca_ca_pool" "default" { - location = "us-central1" - name = "{{index $.Vars "ca_pool_id"}}" - tier = "ENTERPRISE" -} - -resource "google_privateca_certificate_authority" "default" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority_id = "my-authority" - config { - subject_config { - subject { - organization = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = true - } - } - } - } - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - - // Disable CA deletion related safe checks for easier cleanup. - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true -} - -resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority = google_privateca_certificate_authority.default.certificate_authority_id - lifetime = "86000s" - name = "{{index $.Vars "certificate_name"}}" - config { - subject_config { - subject { - common_name = "san1.example.com" - country_code = "us" - organization = "google" - organizational_unit = "enterprise" - locality = "mountain view" - province = "california" - street_address = "1600 amphitheatre parkway" - } - subject_alt_name { - email_addresses = ["email@example.com"] - ip_addresses = ["127.0.0.1"] - uris = ["http://www.ietf.org/rfc/rfc3986.txt"] - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - crl_sign = false - decipher_only = false - } - extended_key_usage { - server_auth = false - } - } - name_constraints { - critical = true - permitted_dns_names = ["*.example.com"] - excluded_dns_names = ["*.deny.example.com"] - permitted_ip_ranges = ["10.0.0.0/8"] - excluded_ip_ranges = ["10.1.1.0/24"] - permitted_email_addresses = [".example.com"] - excluded_email_addresses = [".deny.example.com"] - permitted_uris = [".example.com"] - excluded_uris = [".deny.example.com"] - } - } - public_key { - format = "PEM" - key = filebase64("test-fixtures/rsa_public.pem") - } - } -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_csr.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_csr.tf.tmpl deleted file mode 100644 index e2357245e0b8..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_csr.tf.tmpl +++ /dev/null @@ -1,56 +0,0 @@ -resource "google_privateca_ca_pool" "default" { - location = "us-central1" - name = "{{index $.Vars "ca_pool_id"}}" - tier = "ENTERPRISE" -} - -resource "google_privateca_certificate_authority" "default" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority_id = "my-authority" - config { - subject_config { - subject { - organization = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - 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 { - server_auth = false - } - } - } - } - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - - // Disable CA deletion related safe checks for easier cleanup. - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true -} - - -resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority = google_privateca_certificate_authority.default.certificate_authority_id - name = "{{index $.Vars "certificate_name"}}" - lifetime = "860s" - pem_csr = file("test-fixtures/rsa_csr.pem") -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_custom_ski.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_custom_ski.tf.tmpl deleted file mode 100644 index 81d37cec8816..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_custom_ski.tf.tmpl +++ /dev/null @@ -1,91 +0,0 @@ -resource "google_privateca_ca_pool" "default" { - location = "us-central1" - name = "{{index $.Vars "ca_pool_id"}}" - tier = "ENTERPRISE" -} - -resource "google_privateca_certificate_authority" "default" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority_id = "my-authority" - config { - subject_config { - subject { - organization = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - digital_signature = true - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = true - } - } - } - } - lifetime = "86400s" - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - - // Disable CA deletion related safe checks for easier cleanup. - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true -} - - -resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - name = "{{index $.Vars "certificate_name"}}" - lifetime = "860s" - config { - subject_config { - subject { - common_name = "san1.example.com" - country_code = "us" - organization = "google" - organizational_unit = "enterprise" - locality = "mountain view" - province = "california" - street_address = "1600 amphitheatre parkway" - postal_code = "94109" - } - } - subject_key_id { - key_id = "4cf3372289b1d411b999dbb9ebcd44744b6b2fca" - } - x509_config { - ca_options { - is_ca = false - } - key_usage { - base_key_usage { - crl_sign = true - } - extended_key_usage { - server_auth = true - } - } - } - public_key { - format = "PEM" - key = filebase64("test-fixtures/rsa_public.pem") - } - } - // Certificates require an authority to exist in the pool, though they don't - // need to be explicitly connected to it - depends_on = [google_privateca_certificate_authority.default] -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_generated_key.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_generated_key.tf.tmpl deleted file mode 100644 index 7ef4fdedd780..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_generated_key.tf.tmpl +++ /dev/null @@ -1,103 +0,0 @@ -resource "google_privateca_ca_pool" "default" { - location = "us-central1" - name = "default" - tier = "ENTERPRISE" -} - -resource "google_privateca_certificate_authority" "default" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority_id = "my-authority" - config { - subject_config { - subject { - organization = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = true - } - } - } - } - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - - // Disable CA deletion related safe checks for easier cleanup. - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true -} - -resource "tls_private_key" "cert_key" { - algorithm = "RSA" -} - -resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority = google_privateca_certificate_authority.default.certificate_authority_id - lifetime = "86000s" - name = "cert-1" - config { - subject_config { - subject { - common_name = "san1.example.com" - country_code = "us" - organization = "google" - organizational_unit = "enterprise" - locality = "mountain view" - province = "california" - street_address = "1600 amphitheatre parkway" - } - subject_alt_name { - email_addresses = ["email@example.com"] - ip_addresses = ["127.0.0.1"] - uris = ["http://www.ietf.org/rfc/rfc3986.txt"] - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = false - } - } - name_constraints { - critical = true - permitted_dns_names = ["*.example.com"] - excluded_dns_names = ["*.deny.example.com"] - permitted_ip_ranges = ["10.0.0.0/8"] - excluded_ip_ranges = ["10.1.1.0/24"] - permitted_email_addresses = [".example.com"] - excluded_email_addresses = [".deny.example.com"] - permitted_uris = [".example.com"] - excluded_uris = [".deny.example.com"] - } - } - public_key { - format = "PEM" - key = base64encode(tls_private_key.cert_key.public_key_pem) - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_no_authority.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_no_authority.tf.tmpl deleted file mode 100644 index d09d2d1f7913..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_no_authority.tf.tmpl +++ /dev/null @@ -1,88 +0,0 @@ -resource "google_privateca_ca_pool" "default" { - location = "us-central1" - name = "{{index $.Vars "ca_pool_id"}}" - tier = "ENTERPRISE" -} - -resource "google_privateca_certificate_authority" "default" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority_id = "my-authority" - config { - subject_config { - subject { - organization = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - digital_signature = true - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = true - } - } - } - } - lifetime = "86400s" - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - - // Disable CA deletion related safe checks for easier cleanup. - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true -} - - -resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - name = "{{index $.Vars "certificate_name"}}" - lifetime = "860s" - config { - subject_config { - subject { - common_name = "san1.example.com" - country_code = "us" - organization = "google" - organizational_unit = "enterprise" - locality = "mountain view" - province = "california" - street_address = "1600 amphitheatre parkway" - postal_code = "94109" - } - } - x509_config { - ca_options { - is_ca = false - } - key_usage { - base_key_usage { - crl_sign = true - } - extended_key_usage { - server_auth = true - } - } - } - public_key { - format = "PEM" - key = filebase64("test-fixtures/rsa_public.pem") - } - } - // Certificates require an authority to exist in the pool, though they don't - // need to be explicitly connected to it - depends_on = [google_privateca_certificate_authority.default] -} diff --git a/mmv1/templates/terraform/examples/go/privateca_certificate_with_template.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_certificate_with_template.tf.tmpl deleted file mode 100644 index 9d18151adbf7..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_certificate_with_template.tf.tmpl +++ /dev/null @@ -1,132 +0,0 @@ -resource "google_privateca_ca_pool" "default" { - location = "us-central1" - name = "{{index $.Vars "ca_pool_id"}}" - tier = "ENTERPRISE" -} - -resource "google_privateca_certificate_template" "default" { - location = "us-central1" - name = "{{index $.Vars "certificate_template_name"}}" - description = "An updated sample certificate template" - - identity_constraints { - allow_subject_alt_names_passthrough = true - allow_subject_passthrough = true - - cel_expression { - description = "Always true" - expression = "true" - location = "any.file.anywhere" - title = "Sample expression" - } - } - - passthrough_extensions { - additional_extensions { - object_id_path = [1, 6] - } - - known_extensions = ["EXTENDED_KEY_USAGE"] - } - - predefined_values { - additional_extensions { - object_id { - object_id_path = [1, 6] - } - - value = "c3RyaW5nCg==" - critical = true - } - - aia_ocsp_servers = ["string"] - - ca_options { - is_ca = false - max_issuer_path_length = 6 - } - - key_usage { - base_key_usage { - cert_sign = false - content_commitment = true - crl_sign = false - data_encipherment = true - decipher_only = true - digital_signature = true - encipher_only = true - key_agreement = true - key_encipherment = true - } - - extended_key_usage { - client_auth = true - code_signing = true - email_protection = true - ocsp_signing = true - server_auth = true - time_stamping = true - } - - unknown_extended_key_usages { - object_id_path = [1, 6] - } - } - - policy_ids { - object_id_path = [1, 6] - } - } -} - -resource "google_privateca_certificate_authority" "default" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority_id = "my-authority" - config { - subject_config { - subject { - organization = "HashiCorp" - common_name = "my-certificate-authority" - } - subject_alt_name { - dns_names = ["hashicorp.com"] - } - } - 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 { - server_auth = false - } - } - } - } - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } - - // Disable CA deletion related safe checks for easier cleanup. - deletion_protection = false - skip_grace_period = true - ignore_active_certificates_on_deletion = true -} - - -resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { - location = "us-central1" - pool = google_privateca_ca_pool.default.name - certificate_authority = google_privateca_certificate_authority.default.certificate_authority_id - name = "{{index $.Vars "certificate_name"}}" - lifetime = "860s" - pem_csr = file("test-fixtures/rsa_csr.pem") - certificate_template = google_privateca_certificate_template.default.id -} diff --git a/mmv1/templates/terraform/examples/go/privateca_quickstart.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_quickstart.tf.tmpl deleted file mode 100644 index 9f4328102c52..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_quickstart.tf.tmpl +++ /dev/null @@ -1,95 +0,0 @@ -provider google{} -provider tls{} - -resource "tls_private_key" "example" { - algorithm = "RSA" -} - -resource "tls_cert_request" "example" { - key_algorithm = "RSA" - private_key_pem = tls_private_key.example.private_key_pem - - subject { - common_name = "example.com" - organization = "ACME Examples, Inc" - } -} - -resource "google_privateca_ca_pool" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "my_ca_pool"}}" - location = "us-central1" - tier = "ENTERPRISE" - project = "project-id" - publishing_options { - publish_ca_cert = true - publish_crl = true - } - labels = { - foo = "bar" - } - issuance_policy { - baseline_values { - ca_options { - is_ca = false - } - key_usage { - base_key_usage { - digital_signature = true - key_encipherment = true - } - extended_key_usage { - server_auth = true - } - } - } - } -} - -resource "google_privateca_certificate_authority" "test-ca" { - certificate_authority_id = "my-authority" - location = "us-central1" - project = "project-id" - pool = google_privateca_ca_pool.pool.name - config { - subject_config { - subject { - country_code = "us" - organization = "google" - organizational_unit = "enterprise" - locality = "mountain view" - province = "california" - street_address = "1600 amphitheatre parkway" - postal_code = "94109" - common_name = "my-certificate-authority" - } - } - x509_config { - ca_options { - is_ca = true - } - key_usage { - base_key_usage { - cert_sign = true - crl_sign = true - } - extended_key_usage { - server_auth = true - } - } - } - } - type = "SELF_SIGNED" - key_spec { - algorithm = "RSA_PKCS1_4096_SHA256" - } -} - -resource "google_privateca_certificate" "default" { - pool = google_privateca_ca_pool.pool.name - certificate_authority = google_privateca_certificate_authority.test-ca.certificate_authority_id - project = "project-id" - location = "us-central1" - lifetime = "860s" - name = "{{index $.Vars "my_certificate"}}" - pem_csr = tls_cert_request.example.cert_request_pem -} diff --git a/mmv1/templates/terraform/examples/go/privateca_template_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/privateca_template_basic.tf.tmpl deleted file mode 100644 index 0661224a55fa..000000000000 --- a/mmv1/templates/terraform/examples/go/privateca_template_basic.tf.tmpl +++ /dev/null @@ -1,72 +0,0 @@ -resource "google_privateca_certificate_template" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "name"}}" - location = "us-central1" - description = "A sample certificate template" - - identity_constraints { - allow_subject_alt_names_passthrough = true - allow_subject_passthrough = true - - cel_expression { - description = "Always true" - expression = "true" - location = "any.file.anywhere" - title = "Sample expression" - } - } - - maximum_lifetime = "86400s" - - passthrough_extensions { - additional_extensions { - object_id_path = [1, 6] - } - known_extensions = ["EXTENDED_KEY_USAGE"] - } - - predefined_values { - additional_extensions { - object_id { - object_id_path = [1, 6] - } - value = "c3RyaW5nCg==" - critical = true - } - aia_ocsp_servers = ["string"] - ca_options { - is_ca = false - max_issuer_path_length = 6 - } - key_usage { - base_key_usage { - cert_sign = false - content_commitment = true - crl_sign = false - data_encipherment = true - decipher_only = true - digital_signature = true - encipher_only = true - key_agreement = true - key_encipherment = true - } - extended_key_usage { - client_auth = true - code_signing = true - email_protection = true - ocsp_signing = true - server_auth = true - time_stamping = true - } - unknown_extended_key_usages { - object_id_path = [1, 6] - } - } - policy_ids { - object_id_path = [1, 6] - } - } - - labels = { - label-one = "value-one" - } -} diff --git a/mmv1/templates/terraform/examples/go/privileged_access_manager_entitlement_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/privileged_access_manager_entitlement_basic.tf.tmpl deleted file mode 100644 index 53ee637bbca4..000000000000 --- a/mmv1/templates/terraform/examples/go/privileged_access_manager_entitlement_basic.tf.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -resource "google_privileged_access_manager_entitlement" "{{$.PrimaryResourceId}}" { - entitlement_id = "{{index $.Vars "entitlement_id"}}" - location = "global" - max_request_duration = "43200s" - parent = "projects/{{index $.TestEnvVars "project"}}" - requester_justification_config { - unstructured{} - } - eligible_users { - principals = [ - "group:test@google.com" - ] - } - privileged_access{ - gcp_iam_access{ - role_bindings{ - role = "roles/storage.admin" - condition_expression = "request.time < timestamp(\"2024-04-23T18:30:00.000Z\")" - } - resource = "//cloudresourcemanager.googleapis.com/projects/{{index $.TestEnvVars "project"}}" - resource_type = "cloudresourcemanager.googleapis.com/Project" - } - } - additional_notification_targets { - admin_email_recipients = [ - "user@example.com", - ] - requester_email_recipients = [ - "user@example.com" - ] - } - approval_workflow { - manual_approvals { - require_approver_justification = true - steps { - approvals_needed = 1 - approver_email_recipients = [ - "user@example.com" - ] - approvers { - principals = [ - "group:test@google.com" - ] - } - } - } - } -} diff --git a/mmv1/templates/terraform/examples/go/project_access_approval_active_key_version.tf.tmpl b/mmv1/templates/terraform/examples/go/project_access_approval_active_key_version.tf.tmpl deleted file mode 100644 index bf616dd04995..000000000000 --- a/mmv1/templates/terraform/examples/go/project_access_approval_active_key_version.tf.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -resource "google_kms_key_ring" "key_ring" { - name = "key-ring" - location = "global" - project = "{{index $.TestEnvVars "project"}}" -} - -resource "google_kms_crypto_key" "crypto_key" { - name = "crypto-key" - key_ring = google_kms_key_ring.key_ring.id - purpose = "ASYMMETRIC_SIGN" - - version_template { - algorithm = "EC_SIGN_P384_SHA384" - } -} - -data "google_access_approval_project_service_account" "service_account" { - project_id = "{{index $.TestEnvVars "project"}}" -} - -resource "google_kms_crypto_key_iam_member" "iam" { - crypto_key_id = google_kms_crypto_key.crypto_key.id - role = "roles/cloudkms.signerVerifier" - member = "serviceAccount:${data.google_access_approval_project_service_account.service_account.account_email}" -} - -data "google_kms_crypto_key_version" "crypto_key_version" { - crypto_key = google_kms_crypto_key.crypto_key.id -} - -resource "google_project_access_approval_settings" "{{$.PrimaryResourceId}}" { - project_id = "{{index $.TestEnvVars "project"}}" - active_key_version = data.google_kms_crypto_key_version.crypto_key_version.name - - enrolled_services { - cloud_product = "all" - } - - depends_on = [google_kms_crypto_key_iam_member.iam] -} diff --git a/mmv1/templates/terraform/examples/go/project_access_approval_full.tf.tmpl b/mmv1/templates/terraform/examples/go/project_access_approval_full.tf.tmpl deleted file mode 100644 index 68851cffc7e3..000000000000 --- a/mmv1/templates/terraform/examples/go/project_access_approval_full.tf.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -resource "google_project_access_approval_settings" "{{$.PrimaryResourceId}}" { - project_id = "{{index $.TestEnvVars "project"}}" - notification_emails = ["testuser@example.com", "example.user@example.com"] - - enrolled_services { - cloud_product = "all" - enrollment_level = "BLOCK_ALL" - } -} diff --git a/mmv1/templates/terraform/examples/go/public_advertised_prefixes_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/public_advertised_prefixes_basic.tf.tmpl deleted file mode 100644 index a9f888e5edd4..000000000000 --- a/mmv1/templates/terraform/examples/go/public_advertised_prefixes_basic.tf.tmpl +++ /dev/null @@ -1,6 +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" -} diff --git a/mmv1/templates/terraform/examples/go/public_ca_external_account_key.tf.tmpl b/mmv1/templates/terraform/examples/go/public_ca_external_account_key.tf.tmpl deleted file mode 100644 index 5f0510e28c4c..000000000000 --- a/mmv1/templates/terraform/examples/go/public_ca_external_account_key.tf.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -resource "google_public_ca_external_account_key" "{{$.PrimaryResourceId}}" { - project = "{{index $.TestEnvVars "project"}}" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/public_delegated_prefixes_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/public_delegated_prefixes_basic.tf.tmpl deleted file mode 100644 index b878e52d00bd..000000000000 --- a/mmv1/templates/terraform/examples/go/public_delegated_prefixes_basic.tf.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_compute_public_advertised_prefix" "advertised" { - name = "{{index $.Vars "prefixes_name"}}" - description = "{{index $.TestEnvVars "desc"}}" - dns_verification_ip = "127.127.0.0" - ip_cidr_range = "127.127.0.0/16" -} - -resource "google_compute_public_delegated_prefix" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "prefixes_name"}}" - region = "us-central1" - description = "my description" - ip_cidr_range = "127.127.0.0/24" - parent_prefix = google_compute_public_advertised_prefix.advertised.id -} diff --git a/mmv1/templates/terraform/examples/go/pubsub_lite_reservation_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/pubsub_lite_reservation_basic.tf.tmpl deleted file mode 100644 index f4fcccaf1247..000000000000 --- a/mmv1/templates/terraform/examples/go/pubsub_lite_reservation_basic.tf.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -resource "google_pubsub_lite_reservation" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "reservation_name"}}" - project = data.google_project.project.number - throughput_capacity = 2 -} - -data "google_project" "project" { -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/pubsub_lite_subscription_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/pubsub_lite_subscription_basic.tf.tmpl deleted file mode 100644 index b643cd9e3054..000000000000 --- a/mmv1/templates/terraform/examples/go/pubsub_lite_subscription_basic.tf.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -resource "google_pubsub_lite_topic" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "topic_name"}}" - project = data.google_project.project.number - partition_config { - count = 1 - capacity { - publish_mib_per_sec = 4 - subscribe_mib_per_sec = 8 - } - } - - retention_config { - per_partition_bytes = 32212254720 - } -} - -resource "google_pubsub_lite_subscription" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "subscription_name"}}" - topic = google_pubsub_lite_topic.{{$.PrimaryResourceId}}.name - delivery_config { - delivery_requirement = "DELIVER_AFTER_STORED" - } -} - -data "google_project" "project" { -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/pubsub_lite_topic_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/pubsub_lite_topic_basic.tf.tmpl deleted file mode 100644 index 9f110257f7d7..000000000000 --- a/mmv1/templates/terraform/examples/go/pubsub_lite_topic_basic.tf.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -resource "google_pubsub_lite_reservation" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "reservation_name"}}" - project = data.google_project.project.number - throughput_capacity = 2 -} - -resource "google_pubsub_lite_topic" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "topic_name"}}" - project = data.google_project.project.number - - partition_config { - count = 1 - capacity { - publish_mib_per_sec = 4 - subscribe_mib_per_sec = 8 - } - } - - retention_config { - per_partition_bytes = 32212254720 - } - - reservation_config { - throughput_reservation = google_pubsub_lite_reservation.{{$.PrimaryResourceId}}.name - } -} - -data "google_project" "project" { -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/pubsub_schema_basic.tf.tmpl b/mmv1/templates/terraform/examples/go/pubsub_schema_basic.tf.tmpl deleted file mode 100644 index 3f73ddde3899..000000000000 --- a/mmv1/templates/terraform/examples/go/pubsub_schema_basic.tf.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -resource "google_pubsub_schema" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "schema_name"}}" - type = "AVRO" - definition = "{\n \"type\" : \"record\",\n \"name\" : \"Avro\",\n \"fields\" : [\n {\n \"name\" : \"StringField\",\n \"type\" : \"string\"\n },\n {\n \"name\" : \"IntField\",\n \"type\" : \"int\"\n }\n ]\n}\n" -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/pubsub_schema_protobuf.tf.tmpl b/mmv1/templates/terraform/examples/go/pubsub_schema_protobuf.tf.tmpl deleted file mode 100644 index 42a4a0413f32..000000000000 --- a/mmv1/templates/terraform/examples/go/pubsub_schema_protobuf.tf.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -resource "google_pubsub_schema" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "schema_name"}}" - type = "PROTOCOL_BUFFER" - definition = "syntax = \"proto3\";\nmessage Results {\nstring message_request = 1;\nstring message_response = 2;\nstring timestamp_request = 3;\nstring timestamp_response = 4;\n}" -} - -resource "google_pubsub_topic" "example" { - name = "{{index $.Vars "schema_name"}}-topic" - - depends_on = [google_pubsub_schema.{{$.PrimaryResourceId}}] - schema_settings { - schema = "projects/{{index $.TestEnvVars "project_name"}}/schemas/{{index $.Vars "schema_name"}}" - encoding = "JSON" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/pubsub_subscription_dead_letter.tf.tmpl b/mmv1/templates/terraform/examples/go/pubsub_subscription_dead_letter.tf.tmpl deleted file mode 100644 index f8de6d6db178..000000000000 --- a/mmv1/templates/terraform/examples/go/pubsub_subscription_dead_letter.tf.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "topic_name"}}" -} - -resource "google_pubsub_topic" "{{$.PrimaryResourceId}}_dead_letter" { - name = "{{index $.Vars "topic_name"}}-dead-letter" -} - -resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "subscription_name"}}" - topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id - - dead_letter_policy { - dead_letter_topic = google_pubsub_topic.{{$.PrimaryResourceId}}_dead_letter.id - max_delivery_attempts = 10 - } -} diff --git a/mmv1/templates/terraform/examples/go/pubsub_subscription_pull.tf.tmpl b/mmv1/templates/terraform/examples/go/pubsub_subscription_pull.tf.tmpl deleted file mode 100644 index 952b5b47477b..000000000000 --- a/mmv1/templates/terraform/examples/go/pubsub_subscription_pull.tf.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "topic_name"}}" -} - -resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "subscription_name"}}" - topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id - - labels = { - foo = "bar" - } - - # 20 minutes - message_retention_duration = "1200s" - retain_acked_messages = true - - ack_deadline_seconds = 20 - - expiration_policy { - ttl = "300000.5s" - } - retry_policy { - minimum_backoff = "10s" - } - - enable_message_ordering = false -} diff --git a/mmv1/templates/terraform/examples/go/pubsub_subscription_pull_filter.tf.tmpl b/mmv1/templates/terraform/examples/go/pubsub_subscription_pull_filter.tf.tmpl deleted file mode 100644 index d9a9198e1a4b..000000000000 --- a/mmv1/templates/terraform/examples/go/pubsub_subscription_pull_filter.tf.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "topic_name"}}" -} - -resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { - name = "{{index $.Vars "subscription_name"}}" - topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id - - labels = { - foo = "bar" - } - - filter = <" { +resource "google_compute_ha_vpn_gateway" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['ha_vpn_gateway1_name'] %>" + name = "{{index $.Vars "ha_vpn_gateway1_name"}}" network = google_compute_network.network1.id } resource "google_compute_ha_vpn_gateway" "ha_gateway2" { region = "us-central1" - name = "<%= ctx[:vars]['ha_vpn_gateway2_name'] %>" + name = "{{index $.Vars "ha_vpn_gateway2_name"}}" network = google_compute_network.network2.id } resource "google_compute_network" "network1" { - name = "<%= ctx[:vars]['network1_name'] %>" + name = "{{index $.Vars "network1_name"}}" routing_mode = "GLOBAL" auto_create_subnetworks = false } resource "google_compute_network" "network2" { - name = "<%= ctx[:vars]['network2_name'] %>" + name = "{{index $.Vars "network2_name"}}" routing_mode = "GLOBAL" auto_create_subnetworks = false } @@ -51,7 +51,7 @@ resource "google_compute_subnetwork" "network2_subnet2" { } resource "google_compute_router" "router1" { - name = "<%= ctx[:vars]['router1_name'] %>" + name = "{{index $.Vars "router1_name"}}" network = google_compute_network.network1.name bgp { asn = 64514 @@ -59,7 +59,7 @@ resource "google_compute_router" "router1" { } resource "google_compute_router" "router2" { - name = "<%= ctx[:vars]['router2_name'] %>" + name = "{{index $.Vars "router2_name"}}" network = google_compute_network.network2.name bgp { asn = 64515 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 073befb37419..7c5efe0534d6 100644 --- a/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl +++ b/mmv1/templates/terraform/examples/ha_vpn_gateway_ipv6.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_ha_vpn_gateway" "ha_gateway1" { region = "us-central1" - name = "<%= ctx[:vars]['ha_vpn_gateway1_name'] %>" + name = "{{index $.Vars "ha_vpn_gateway1_name"}}" network = google_compute_network.network1.id stack_type = "IPV4_IPV6" } resource "google_compute_network" "network1" { - name = "<%= ctx[:vars]['network1_name'] %>" + name = "{{index $.Vars "network1_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/health_check_grpc.tf.tmpl b/mmv1/templates/terraform/examples/health_check_grpc.tf.tmpl index 01c0b3c5f30c..f1f5e9df739a 100644 --- a/mmv1/templates/terraform/examples/health_check_grpc.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_grpc.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "grpc-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_grpc_full.tf.tmpl b/mmv1/templates/terraform/examples/health_check_grpc_full.tf.tmpl index c4f69c4f0f1f..15ad978487f0 100644 --- a/mmv1/templates/terraform/examples/health_check_grpc_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_grpc_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "grpc-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_http.tf.tmpl b/mmv1/templates/terraform/examples/health_check_http.tf.tmpl index bb9c776bbb48..d1e8c1d6ca58 100644 --- a/mmv1/templates/terraform/examples/health_check_http.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_http.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "http-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_http2.tf.tmpl b/mmv1/templates/terraform/examples/health_check_http2.tf.tmpl index 95c57512b903..6a2af9194b6f 100644 --- a/mmv1/templates/terraform/examples/health_check_http2.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_http2.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "http2-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_http2_full.tf.tmpl b/mmv1/templates/terraform/examples/health_check_http2_full.tf.tmpl index 737c96d8ae8a..92e2e0b8f1cf 100644 --- a/mmv1/templates/terraform/examples/health_check_http2_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_http2_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "http2-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via http2" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_http_full.tf.tmpl b/mmv1/templates/terraform/examples/health_check_http_full.tf.tmpl index 4d8a430c3343..4834ee829d58 100644 --- a/mmv1/templates/terraform/examples/health_check_http_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_http_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "http-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via http" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_https.tf.tmpl b/mmv1/templates/terraform/examples/health_check_https.tf.tmpl index 2d6e932cb369..2a66a31df0e6 100644 --- a/mmv1/templates/terraform/examples/health_check_https.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_https.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "https-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_https_full.tf.tmpl b/mmv1/templates/terraform/examples/health_check_https_full.tf.tmpl index 0816179dd71d..4c0714f8d345 100644 --- a/mmv1/templates/terraform/examples/health_check_https_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_https_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "https-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via https" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_ssl.tf.tmpl b/mmv1/templates/terraform/examples/health_check_ssl.tf.tmpl index 5e340b3b429c..4134e34da522 100644 --- a/mmv1/templates/terraform/examples/health_check_ssl.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_ssl.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "ssl-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_ssl_full.tf.tmpl b/mmv1/templates/terraform/examples/health_check_ssl_full.tf.tmpl index 9ea722c5d49a..79d928ac48d8 100644 --- a/mmv1/templates/terraform/examples/health_check_ssl_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_ssl_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "ssl-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via ssl" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_tcp.tf.tmpl b/mmv1/templates/terraform/examples/health_check_tcp.tf.tmpl index c4ca9033189d..6e1ed144b137 100644 --- a/mmv1/templates/terraform/examples/health_check_tcp.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_tcp.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "tcp-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_tcp_full.tf.tmpl b/mmv1/templates/terraform/examples/health_check_tcp_full.tf.tmpl index 2baf567275a8..e70fcde14e37 100644 --- a/mmv1/templates/terraform/examples/health_check_tcp_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_tcp_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_health_check" "tcp-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via tcp" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/health_check_with_logging.tf.tmpl b/mmv1/templates/terraform/examples/health_check_with_logging.tf.tmpl index 2830336a3bc3..8cfd2f43cb02 100644 --- a/mmv1/templates/terraform/examples/health_check_with_logging.tf.tmpl +++ b/mmv1/templates/terraform/examples/health_check_with_logging.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_health_check" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_health_check" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/healthcare_consent_store_basic.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_consent_store_basic.tf.tmpl index 6d59c90f6159..2076a41f1a60 100644 --- a/mmv1/templates/terraform/examples/healthcare_consent_store_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_consent_store_basic.tf.tmpl @@ -1,9 +1,9 @@ resource "google_healthcare_dataset" "dataset" { location = "us-central1" - name = "<%= ctx[:vars]['dataset_id'] %>" + name = "{{index $.Vars "dataset_id"}}" } -resource "google_healthcare_consent_store" "<%= ctx[:primary_resource_id] %>" { +resource "google_healthcare_consent_store" "{{$.PrimaryResourceId}}" { dataset = google_healthcare_dataset.dataset.id - name = "<%= ctx[:vars]['consent_id'] %>" + name = "{{index $.Vars "consent_id"}}" } diff --git a/mmv1/templates/terraform/examples/healthcare_consent_store_full.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_consent_store_full.tf.tmpl index 272c864b9636..643e0d580711 100644 --- a/mmv1/templates/terraform/examples/healthcare_consent_store_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_consent_store_full.tf.tmpl @@ -1,12 +1,12 @@ resource "google_healthcare_dataset" "dataset" { location = "us-central1" - name = "<%= ctx[:vars]['dataset_id'] %>" + name = "{{index $.Vars "dataset_id"}}" } -resource "google_healthcare_consent_store" "<%= ctx[:primary_resource_id] %>" { +resource "google_healthcare_consent_store" "{{$.PrimaryResourceId}}" { dataset = google_healthcare_dataset.dataset.id - name = "<%= ctx[:vars]['consent_id'] %>" + name = "{{index $.Vars "consent_id"}}" enable_consent_create_on_update = true default_consent_ttl = "90000s" diff --git a/mmv1/templates/terraform/examples/healthcare_consent_store_iam.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_consent_store_iam.tf.tmpl index 96d1c9960fdd..a6c8dd7a0ae5 100644 --- a/mmv1/templates/terraform/examples/healthcare_consent_store_iam.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_consent_store_iam.tf.tmpl @@ -1,21 +1,21 @@ resource "google_healthcare_dataset" "dataset" { location = "us-central1" - name = "<%= ctx[:vars]['dataset_id'] %>" + name = "{{index $.Vars "dataset_id"}}" } -resource "google_healthcare_consent_store" "<%= ctx[:primary_resource_id] %>" { +resource "google_healthcare_consent_store" "{{$.PrimaryResourceId}}" { dataset = google_healthcare_dataset.dataset.id - name = "<%= ctx[:vars]['consent_id'] %>" + name = "{{index $.Vars "consent_id"}}" } resource "google_service_account" "test-account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Test Service Account" } resource "google_healthcare_consent_store_iam_member" "test-iam" { dataset = google_healthcare_dataset.dataset.id - consent_store_id = google_healthcare_consent_store.<%= ctx[:primary_resource_id] %>.name + consent_store_id = google_healthcare_consent_store.{{$.PrimaryResourceId}}.name role = "roles/editor" member = "serviceAccount:${google_service_account.test-account.email}" } diff --git a/mmv1/templates/terraform/examples/healthcare_dataset_basic.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_dataset_basic.tf.tmpl index 8f9719a6108d..c671662920e4 100644 --- a/mmv1/templates/terraform/examples/healthcare_dataset_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_dataset_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_healthcare_dataset" "default" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" time_zone = "UTC" } diff --git a/mmv1/templates/terraform/examples/healthcare_dataset_cmek.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_dataset_cmek.tf.tmpl index f841ed515a0f..a7f2a6244c99 100644 --- a/mmv1/templates/terraform/examples/healthcare_dataset_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_dataset_cmek.tf.tmpl @@ -1,7 +1,7 @@ data "google_project" "project" {} resource "google_healthcare_dataset" "default" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" time_zone = "UTC" @@ -15,13 +15,13 @@ resource "google_healthcare_dataset" "default" { } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id purpose = "ENCRYPT_DECRYPT" } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/healthcare_dicom_store_basic.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_dicom_store_basic.tf.tmpl index 00db67aba347..37ee460c0075 100644 --- a/mmv1/templates/terraform/examples/healthcare_dicom_store_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_dicom_store_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_healthcare_dicom_store" "default" { - name = "<%= ctx[:vars]['dicom_store_name'] %>" + name = "{{index $.Vars "dicom_store_name"}}" dataset = google_healthcare_dataset.dataset.id notification_config { @@ -12,10 +12,10 @@ resource "google_healthcare_dicom_store" "default" { } resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['pubsub_topic']%>" + name = "{{index $.Vars "pubsub_topic"}}" } resource "google_healthcare_dataset" "dataset" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/healthcare_dicom_store_bq_stream.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_dicom_store_bq_stream.tf.tmpl index 2d2b3df301cc..c376a5c41b0e 100644 --- a/mmv1/templates/terraform/examples/healthcare_dicom_store_bq_stream.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_dicom_store_bq_stream.tf.tmpl @@ -1,7 +1,7 @@ resource "google_healthcare_dicom_store" "default" { provider = google-beta - name = "<%= ctx[:vars]['dicom_store_name'] %>" + name = "{{index $.Vars "dicom_store_name"}}" dataset = google_healthcare_dataset.dataset.id notification_config { @@ -23,20 +23,20 @@ resource "google_healthcare_dicom_store" "default" { resource "google_pubsub_topic" "topic" { provider = google-beta - name = "<%= ctx[:vars]['pubsub_topic']%>" + name = "{{index $.Vars "pubsub_topic"}}" } resource "google_healthcare_dataset" "dataset" { provider = google-beta - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } resource "google_bigquery_dataset" "bq_dataset" { provider = google-beta - dataset_id = "<%= ctx[:vars]['bq_dataset_name'] %>" + dataset_id = "{{index $.Vars "bq_dataset_name"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -48,6 +48,6 @@ resource "google_bigquery_table" "bq_table" { deletion_protection = false dataset_id = google_bigquery_dataset.bq_dataset.dataset_id - table_id = "<%= ctx[:vars]['bq_table_name'] %>" + table_id = "{{index $.Vars "bq_table_name"}}" } diff --git a/mmv1/templates/terraform/examples/healthcare_fhir_store_basic.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_fhir_store_basic.tf.tmpl index 084363773765..a61cdf68c9f5 100644 --- a/mmv1/templates/terraform/examples/healthcare_fhir_store_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_fhir_store_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_healthcare_fhir_store" "default" { - name = "<%= ctx[:vars]['fhir_store_name'] %>" + name = "{{index $.Vars "fhir_store_name"}}" dataset = google_healthcare_dataset.dataset.id version = "R4" complex_data_type_reference_parsing = "DISABLED" @@ -20,10 +20,10 @@ resource "google_healthcare_fhir_store" "default" { } resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['pubsub_topic']%>" + name = "{{index $.Vars "pubsub_topic"}}" } resource "google_healthcare_dataset" "dataset" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/healthcare_fhir_store_notification_config.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_fhir_store_notification_config.tf.tmpl index cf4b6e431bed..4ae13979d4c0 100644 --- a/mmv1/templates/terraform/examples/healthcare_fhir_store_notification_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_fhir_store_notification_config.tf.tmpl @@ -1,5 +1,5 @@ resource "google_healthcare_fhir_store" "default" { - name = "<%= ctx[:vars]['fhir_store_name'] %>" + name = "{{index $.Vars "fhir_store_name"}}" dataset = google_healthcare_dataset.dataset.id version = "R4" @@ -18,10 +18,10 @@ resource "google_healthcare_fhir_store" "default" { } resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['pubsub_topic']%>" + name = "{{index $.Vars "pubsub_topic"}}" } resource "google_healthcare_dataset" "dataset" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/healthcare_fhir_store_notification_configs.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_fhir_store_notification_configs.tf.tmpl index 359f160b769b..219fadbc32b5 100644 --- a/mmv1/templates/terraform/examples/healthcare_fhir_store_notification_configs.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_fhir_store_notification_configs.tf.tmpl @@ -1,5 +1,5 @@ resource "google_healthcare_fhir_store" "default" { - name = "<%= ctx[:vars]['fhir_store_name'] %>" + name = "{{index $.Vars "fhir_store_name"}}" dataset = google_healthcare_dataset.dataset.id version = "R4" @@ -20,10 +20,10 @@ resource "google_healthcare_fhir_store" "default" { } resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['pubsub_topic']%>" + name = "{{index $.Vars "pubsub_topic"}}" } resource "google_healthcare_dataset" "dataset" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/healthcare_fhir_store_streaming_config.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_fhir_store_streaming_config.tf.tmpl index e7b0ae71f634..166e22b99977 100644 --- a/mmv1/templates/terraform/examples/healthcare_fhir_store_streaming_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_fhir_store_streaming_config.tf.tmpl @@ -1,5 +1,5 @@ resource "google_healthcare_fhir_store" "default" { - name = "<%= ctx[:vars]['fhir_store_name'] %>" + name = "{{index $.Vars "fhir_store_name"}}" dataset = google_healthcare_dataset.dataset.id version = "R4" @@ -28,16 +28,16 @@ resource "google_healthcare_fhir_store" "default" { } resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['pubsub_topic']%>" + name = "{{index $.Vars "pubsub_topic"}}" } resource "google_healthcare_dataset" "dataset" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } resource "google_bigquery_dataset" "bq_dataset" { - dataset_id = "<%= ctx[:vars]['bq_dataset_name'] %>" + dataset_id = "{{index $.Vars "bq_dataset_name"}}" friendly_name = "test" description = "This is a test description" location = "US" diff --git a/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_basic.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_basic.tf.tmpl index a75931fd02ae..1b7c060e73a5 100644 --- a/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_healthcare_hl7_v2_store" "store" { - name = "<%= ctx[:vars]['hl7_v2_store_name'] %>" + name = "{{index $.Vars "hl7_v2_store_name"}}" dataset = google_healthcare_dataset.dataset.id reject_duplicate_message = true @@ -13,10 +13,10 @@ resource "google_healthcare_hl7_v2_store" "store" { } resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['pubsub_topic']%>" + name = "{{index $.Vars "pubsub_topic"}}" } resource "google_healthcare_dataset" "dataset" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_parser_config.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_parser_config.tf.tmpl index c91c67e5db98..d507994f833d 100644 --- a/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_parser_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_parser_config.tf.tmpl @@ -1,6 +1,6 @@ resource "google_healthcare_hl7_v2_store" "store" { provider = google-beta - name = "<%= ctx[:vars]['hl7_v2_store_name'] %>" + name = "{{index $.Vars "hl7_v2_store_name"}}" dataset = google_healthcare_dataset.dataset.id parser_config { @@ -91,6 +91,6 @@ EOF resource "google_healthcare_dataset" "dataset" { provider = google-beta - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_unschematized.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_unschematized.tf.tmpl index a0c14acdde7d..878f40bacd3d 100644 --- a/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_unschematized.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_hl7_v2_store_unschematized.tf.tmpl @@ -1,6 +1,6 @@ resource "google_healthcare_hl7_v2_store" "store" { provider = google-beta - name = "<%= ctx[:vars]['hl7_v2_store_name'] %>" + name = "{{index $.Vars "hl7_v2_store_name"}}" dataset = google_healthcare_dataset.dataset.id parser_config { @@ -12,6 +12,6 @@ resource "google_healthcare_hl7_v2_store" "store" { resource "google_healthcare_dataset" "dataset" { provider = google-beta - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/healthcare_workspace_basic.tf.tmpl b/mmv1/templates/terraform/examples/healthcare_workspace_basic.tf.tmpl index 3fa7c5342eaf..8dee100b776a 100644 --- a/mmv1/templates/terraform/examples/healthcare_workspace_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/healthcare_workspace_basic.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_healthcare_workspace" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['workspace_name'] %>" +resource "google_healthcare_workspace" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "workspace_name"}}" dataset = google_healthcare_dataset.dataset.id settings { - data_project_ids = ["<%= ctx[:vars]['source_project_id'] %>"] + data_project_ids = ["{{index $.Vars "source_project_id"}}"] } labels = { @@ -13,6 +13,6 @@ resource "google_healthcare_workspace" "<%= ctx[:primary_resource_id] %>" { resource "google_healthcare_dataset" "dataset" { - name = "<%= ctx[:vars]['dataset_name'] %>" + name = "{{index $.Vars "dataset_name"}}" location = "us-central1" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/http_health_check_basic.tf.tmpl b/mmv1/templates/terraform/examples/http_health_check_basic.tf.tmpl index a3ed17aaac12..c9cbb9f033ef 100644 --- a/mmv1/templates/terraform/examples/http_health_check_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/http_health_check_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/health_check" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/https_health_check_basic.tf.tmpl b/mmv1/templates/terraform/examples/https_health_check_basic.tf.tmpl index 3827d3e256a5..6522dff11eb7 100644 --- a/mmv1/templates/terraform/examples/https_health_check_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/https_health_check_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_https_health_check" "default" { - name = "<%= ctx[:vars]['https_health_check_name'] %>" + name = "{{index $.Vars "https_health_check_name"}}" request_path = "/health_check" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/iam_access_boundary_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_access_boundary_policy_basic.tf.tmpl index 0fd56cf941be..d988b22f66e3 100644 --- a/mmv1/templates/terraform/examples/iam_access_boundary_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_access_boundary_policy_basic.tf.tmpl @@ -1,15 +1,15 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]["project_id"] %>" - name = "<%= ctx[:vars]["project_id"] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } resource "google_access_context_manager_access_level" "test-access" { parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}" - name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/<%= ctx[:vars]["access_level_title"] %>" - title = "<%= ctx[:vars]["access_level_title"] %>" + name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/{{index $.Vars "access_level_title"}}" + title = "{{index $.Vars "access_level_title"}}" basic { conditions { device_policy { @@ -32,9 +32,9 @@ resource "google_access_context_manager_access_policy" "access-policy" { title = "my policy" } -resource "google_iam_access_boundary_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_access_boundary_policy" "{{$.PrimaryResourceId}}" { parent = urlencode("cloudresourcemanager.googleapis.com/projects/${google_project.project.project_id}") - name = "<%= ctx[:vars]["policy_name"] %>" + name = "{{index $.Vars "policy_name"}}" display_name = "My AB policy" rules { description = "AB rule" diff --git a/mmv1/templates/terraform/examples/iam_deny_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_deny_policy_basic.tf.tmpl index 7242616fbfbf..90536245f8fb 100644 --- a/mmv1/templates/terraform/examples/iam_deny_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_deny_policy_basic.tf.tmpl @@ -1,14 +1,14 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]["project_name"] %>" - name = "<%= ctx[:vars]["project_name"] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "project_name"}}" + name = "{{index $.Vars "project_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } -resource "google_iam_deny_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_deny_policy" "{{$.PrimaryResourceId}}" { parent = urlencode("cloudresourcemanager.googleapis.com/projects/${google_project.project.project_id}") - name = "<%= ctx[:vars]["policy_name"] %>" + name = "{{index $.Vars "policy_name"}}" display_name = "A deny rule" rules { description = "First rule" @@ -36,7 +36,7 @@ resource "google_iam_deny_policy" "<%= ctx[:primary_resource_id] %>" { } resource "google_service_account" "test-account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Test Service Account" project = google_project.project.project_id } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_basic.tf.tmpl index 0c7e1be96a19..e65e0e1b7445 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_iam_workforce_pool" "<%= ctx[:primary_resource_id] %>" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" +resource "google_iam_workforce_pool" "{{$.PrimaryResourceId}}" { + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_full.tf.tmpl index 47f011c8fe8c..8485a98faf33 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_iam_workforce_pool" "<%= ctx[:primary_resource_id] %>" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" +resource "google_iam_workforce_pool" "{{$.PrimaryResourceId}}" { + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" display_name = "Display name" description = "A sample workforce pool." diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_basic.tf.tmpl index a6889e22043f..38ae61e22dd1 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_basic.tf.tmpl @@ -1,13 +1,13 @@ resource "google_iam_workforce_pool" "pool" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } -resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workforce_pool_provider" "{{$.PrimaryResourceId}}" { workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id location = google_iam_workforce_pool.pool.location - provider_id = "<%= ctx[:vars]["provider_id"] %>" + provider_id = "{{index $.Vars "provider_id"}}" attribute_mapping = { "google.subject" = "assertion.sub" } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_full.tf.tmpl index 1ade1acb8423..ddba0b621c85 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_extra_attributes_oauth2_config_client_full.tf.tmpl @@ -1,13 +1,13 @@ resource "google_iam_workforce_pool" "pool" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } -resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workforce_pool_provider" "{{$.PrimaryResourceId}}" { workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id location = google_iam_workforce_pool.pool.location - provider_id = "<%= ctx[:vars]["provider_id"] %>" + provider_id = "{{index $.Vars "provider_id"}}" attribute_mapping = { "google.subject" = "assertion.sub" } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_basic.tf.tmpl index a5adf114df0f..a2953bcace04 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_basic.tf.tmpl @@ -1,13 +1,13 @@ resource "google_iam_workforce_pool" "pool" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } -resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workforce_pool_provider" "{{$.PrimaryResourceId}}" { workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id location = google_iam_workforce_pool.pool.location - provider_id = "<%= ctx[:vars]["provider_id"] %>" + provider_id = "{{index $.Vars "provider_id"}}" attribute_mapping = { "google.subject" = "assertion.sub" } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.tf.tmpl index 45d5dee85bbb..c42fab228ace 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.tf.tmpl @@ -1,13 +1,13 @@ resource "google_iam_workforce_pool" "pool" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } -resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workforce_pool_provider" "{{$.PrimaryResourceId}}" { workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id location = google_iam_workforce_pool.pool.location - provider_id = "<%= ctx[:vars]["provider_id"] %>" + provider_id = "{{index $.Vars "provider_id"}}" attribute_mapping = { "google.subject" = "assertion.sub" } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_upload_key.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_upload_key.tf.tmpl index fb0b78eafed5..2fcedab96b63 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_upload_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_upload_key.tf.tmpl @@ -1,13 +1,13 @@ resource "google_iam_workforce_pool" "pool" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } -resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workforce_pool_provider" "{{$.PrimaryResourceId}}" { workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id location = google_iam_workforce_pool.pool.location - provider_id = "<%= ctx[:vars]["provider_id"] %>" + provider_id = "{{index $.Vars "provider_id"}}" attribute_mapping = { "google.subject" = "assertion.sub" } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_basic.tf.tmpl index d106953d8d9c..580e06c1b25e 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_basic.tf.tmpl @@ -1,13 +1,13 @@ resource "google_iam_workforce_pool" "pool" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } -resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workforce_pool_provider" "{{$.PrimaryResourceId}}" { workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id location = google_iam_workforce_pool.pool.location - provider_id = "<%= ctx[:vars]["provider_id"] %>" + provider_id = "{{index $.Vars "provider_id"}}" attribute_mapping = { "google.subject" = "assertion.sub" } diff --git a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_full.tf.tmpl index 4bd8d56c5fee..c74bfab882a1 100644 --- a/mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_full.tf.tmpl @@ -1,13 +1,13 @@ resource "google_iam_workforce_pool" "pool" { - workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" - parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" + workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } -resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workforce_pool_provider" "{{$.PrimaryResourceId}}" { workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id location = google_iam_workforce_pool.pool.location - provider_id = "<%= ctx[:vars]["provider_id"] %>" + provider_id = "{{index $.Vars "provider_id"}}" attribute_mapping = { "google.subject" = "assertion.sub" } diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_basic.tf.tmpl index 8bde554a9cda..ea32eb6ddbc8 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_basic.tf.tmpl @@ -1,3 +1,3 @@ -resource "google_iam_workload_identity_pool" "<%= ctx[:primary_resource_id] %>" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" +resource "google_iam_workload_identity_pool" "{{$.PrimaryResourceId}}" { + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_full.tf.tmpl index a4d16326780f..a46cc332b260 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_iam_workload_identity_pool" "<%= ctx[:primary_resource_id] %>" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" +resource "google_iam_workload_identity_pool" "{{$.PrimaryResourceId}}" { + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" display_name = "Name of pool" description = "Identity pool for automated test" disabled = true diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_aws_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_aws_basic.tf.tmpl index c16f0330fbaa..05bfb8727960 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_aws_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_aws_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" aws { account_id = "999999999999" } diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_aws_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_aws_full.tf.tmpl index c05a307c3d1a..b9ac672da3a2 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_aws_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_aws_full.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" display_name = "Name of provider" description = "AWS identity pool provider for automated test" disabled = true diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_basic.tf.tmpl index 964261dc38c9..4629a385b1b5 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" attribute_mapping = { "google.subject" = "assertion.sub" } diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_full.tf.tmpl index 502055afe8ca..b9513e50c5bd 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_full.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" display_name = "Name of provider" description = "OIDC identity pool provider for automated test" disabled = true diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_upload_key.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_upload_key.tf.tmpl index dc9cc2e22fd9..05405cdcbd1f 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_upload_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_oidc_upload_key.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" display_name = "Name of provider" description = "OIDC identity pool provider for automated test" disabled = true diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_saml_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_saml_basic.tf.tmpl index 6ec26e598c90..7c568dd25410 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_saml_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_saml_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" attribute_mapping = { "google.subject" = "assertion.arn" "attribute.aws_account" = "assertion.account" diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_saml_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_saml_full.tf.tmpl index 7bfa6bea5054..5b7ebc09efbc 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_saml_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_saml_full.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" display_name = "Name of provider" description = "SAML 2.0 identity pool provider for automated test" disabled = true diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_x509_basic.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_x509_basic.tf.tmpl index b049e6792304..a1ae8ab0d277 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_x509_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_x509_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" attribute_mapping = { "google.subject" = "assertion.subject.dn.cn" } diff --git a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_x509_full.tf.tmpl b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_x509_full.tf.tmpl index 6902c02b31ff..9b06b491408d 100644 --- a/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_x509_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/iam_workload_identity_pool_provider_x509_full.tf.tmpl @@ -1,10 +1,10 @@ resource "google_iam_workload_identity_pool" "pool" { - workload_identity_pool_id = "<%= ctx[:vars]["workload_identity_pool_id"] %>" + workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}" } -resource "google_iam_workload_identity_pool_provider" "<%= ctx[:primary_resource_id] %>" { +resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" { workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id - workload_identity_pool_provider_id = "<%= ctx[:vars]["workload_identity_pool_provider_id"] %>" + workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}" display_name = "Name of provider" description = "X.509 identity pool provider for automated test" disabled = true diff --git a/mmv1/templates/terraform/examples/iap_brand.tf.tmpl b/mmv1/templates/terraform/examples/iap_brand.tf.tmpl index d0dbffdc62b4..feec98ca93c8 100644 --- a/mmv1/templates/terraform/examples/iap_brand.tf.tmpl +++ b/mmv1/templates/terraform/examples/iap_brand.tf.tmpl @@ -1,7 +1,7 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } @@ -11,7 +11,7 @@ resource "google_project_service" "project_service" { } resource "google_iap_brand" "project_brand" { - support_email = "support@<%= ctx[:test_env_vars]['org_domain'] %>" + support_email = "support@{{index $.TestEnvVars "org_domain"}}" application_title = "Cloud IAP protected Application" project = google_project_service.project_service.project } diff --git a/mmv1/templates/terraform/examples/iap_client.tf.tmpl b/mmv1/templates/terraform/examples/iap_client.tf.tmpl index 126817dc9d10..88af2235248c 100644 --- a/mmv1/templates/terraform/examples/iap_client.tf.tmpl +++ b/mmv1/templates/terraform/examples/iap_client.tf.tmpl @@ -1,7 +1,7 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } @@ -11,7 +11,7 @@ resource "google_project_service" "project_service" { } resource "google_iap_brand" "project_brand" { - support_email = "support@<%= ctx[:test_env_vars]['org_domain'] %>" + support_email = "support@{{index $.TestEnvVars "org_domain"}}" application_title = "Cloud IAP protected Application" project = google_project_service.project_service.project } diff --git a/mmv1/templates/terraform/examples/identity_platform_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_config_basic.tf.tmpl index 5529d34c7fb3..445c1a377e0a 100644 --- a/mmv1/templates/terraform/examples/identity_platform_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_config_basic.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "default" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" deletion_policy = "DELETE" labels = { firebase = "enabled" @@ -45,7 +45,7 @@ resource "google_identity_platform_config" "default" { blocking_functions { triggers { event_type = "beforeSignIn" - function_uri = "https://us-east1-<%= ctx[:vars]['project_id'] %>.cloudfunctions.net/before-sign-in" + function_uri = "https://us-east1-{{index $.Vars "project_id"}}.cloudfunctions.net/before-sign-in" } forward_inbound_credentials { refresh_token = true @@ -56,13 +56,13 @@ resource "google_identity_platform_config" "default" { quota { sign_up_quota_config { quota = 1000 - start_time = "<%= ctx[:vars]['quota_start_time'] %>" + start_time = "{{index $.Vars "quota_start_time"}}" quota_duration = "7200s" } } authorized_domains = [ "localhost", - "<%= ctx[:vars]['project_id'] %>.firebaseapp.com", - "<%= ctx[:vars]['project_id'] %>.web.app", + "{{index $.Vars "project_id"}}.firebaseapp.com", + "{{index $.Vars "project_id"}}.web.app", ] } diff --git a/mmv1/templates/terraform/examples/identity_platform_config_minimal.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_config_minimal.tf.tmpl index 4c6186816d5d..f9a77e23061a 100644 --- a/mmv1/templates/terraform/examples/identity_platform_config_minimal.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_config_minimal.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "default" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_acct"}}" deletion_policy = "DELETE" labels = { firebase = "enabled" @@ -41,7 +41,7 @@ resource "google_identity_platform_config" "default" { } multi_tenant { allow_tenants = true - default_tenant_location = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + default_tenant_location = "organizations/{{index $.TestEnvVars "org_id"}}" } depends_on = [ diff --git a/mmv1/templates/terraform/examples/identity_platform_default_supported_idp_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_default_supported_idp_config_basic.tf.tmpl index f6d290a32ae3..59d7db4f6b05 100644 --- a/mmv1/templates/terraform/examples/identity_platform_default_supported_idp_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_default_supported_idp_config_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_identity_platform_default_supported_idp_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_identity_platform_default_supported_idp_config" "{{$.PrimaryResourceId}}" { enabled = true idp_id = "playgames.google.com" client_id = "client-id" diff --git a/mmv1/templates/terraform/examples/identity_platform_inbound_saml_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_inbound_saml_config_basic.tf.tmpl index 013c017b77a1..267075bcdba9 100644 --- a/mmv1/templates/terraform/examples/identity_platform_inbound_saml_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_inbound_saml_config_basic.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_identity_platform_inbound_saml_config" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_identity_platform_inbound_saml_config" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" display_name = "Display Name" idp_config { - idp_entity_id = "<%= ctx[:vars]["idp_entity_id"] %>" + idp_entity_id = "{{index $.Vars "idp_entity_id"}}" sign_request = true sso_url = "https://example.com" idp_certificates { @@ -11,7 +11,7 @@ resource "google_identity_platform_inbound_saml_config" "<%= ctx[:primary_resour } sp_config { - sp_entity_id = "<%= ctx[:vars]["sp_entity_id"] %>" + sp_entity_id = "{{index $.Vars "sp_entity_id"}}" callback_uri = "https://example.com" } } diff --git a/mmv1/templates/terraform/examples/identity_platform_oauth_idp_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_oauth_idp_config_basic.tf.tmpl index 65d655c6c331..0e5c31f6bb37 100644 --- a/mmv1/templates/terraform/examples/identity_platform_oauth_idp_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_oauth_idp_config_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_identity_platform_oauth_idp_config" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_identity_platform_oauth_idp_config" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" display_name = "Display Name" client_id = "client-id" issuer = "issuer" diff --git a/mmv1/templates/terraform/examples/identity_platform_tenant_basic.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_tenant_basic.tf.tmpl index 4d6a9515e78d..73b06d382448 100644 --- a/mmv1/templates/terraform/examples/identity_platform_tenant_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_tenant_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_identity_platform_tenant" "<%= ctx[:primary_resource_id] %>" { +resource "google_identity_platform_tenant" "{{$.PrimaryResourceId}}" { display_name = "tenant" allow_password_signup = true } diff --git a/mmv1/templates/terraform/examples/identity_platform_tenant_default_supported_idp_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_tenant_default_supported_idp_config_basic.tf.tmpl index 291297fd5553..f947b7317543 100644 --- a/mmv1/templates/terraform/examples/identity_platform_tenant_default_supported_idp_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_tenant_default_supported_idp_config_basic.tf.tmpl @@ -2,7 +2,7 @@ resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } -resource "google_identity_platform_tenant_default_supported_idp_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_identity_platform_tenant_default_supported_idp_config" "{{$.PrimaryResourceId}}" { enabled = true tenant = google_identity_platform_tenant.tenant.name idp_id = "playgames.google.com" diff --git a/mmv1/templates/terraform/examples/identity_platform_tenant_inbound_saml_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_tenant_inbound_saml_config_basic.tf.tmpl index f46062167927..218d194e24af 100644 --- a/mmv1/templates/terraform/examples/identity_platform_tenant_inbound_saml_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_tenant_inbound_saml_config_basic.tf.tmpl @@ -2,12 +2,12 @@ resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } -resource "google_identity_platform_tenant_inbound_saml_config" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_identity_platform_tenant_inbound_saml_config" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" display_name = "Display Name" tenant = google_identity_platform_tenant.tenant.name idp_config { - idp_entity_id = "<%= ctx[:vars]["idp_entity_id"] %>" + idp_entity_id = "{{index $.Vars "idp_entity_id"}}" sign_request = true sso_url = "https://example.com" idp_certificates { @@ -16,7 +16,7 @@ resource "google_identity_platform_tenant_inbound_saml_config" "<%= ctx[:primary } sp_config { - sp_entity_id = "<%= ctx[:vars]["sp_entity_id"] %>" + sp_entity_id = "{{index $.Vars "sp_entity_id"}}" callback_uri = "https://example.com" } } diff --git a/mmv1/templates/terraform/examples/identity_platform_tenant_oauth_idp_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/identity_platform_tenant_oauth_idp_config_basic.tf.tmpl index f430a9dbc431..93a3cfea2dd3 100644 --- a/mmv1/templates/terraform/examples/identity_platform_tenant_oauth_idp_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/identity_platform_tenant_oauth_idp_config_basic.tf.tmpl @@ -2,8 +2,8 @@ resource "google_identity_platform_tenant" "tenant" { display_name = "tenant" } -resource "google_identity_platform_tenant_oauth_idp_config" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_identity_platform_tenant_oauth_idp_config" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" tenant = google_identity_platform_tenant.tenant.name display_name = "Display Name" client_id = "client-id" diff --git a/mmv1/templates/terraform/examples/image_basic.tf.tmpl b/mmv1/templates/terraform/examples/image_basic.tf.tmpl index b0c4ce830dd4..2851c48b7abe 100644 --- a/mmv1/templates/terraform/examples/image_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/image_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_image" "example" { - name = "<%= ctx[:vars]['image_name'] %>" + name = "{{index $.Vars "image_name"}}" raw_disk { source = "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz" diff --git a/mmv1/templates/terraform/examples/image_basic_storage_location.tf.tmpl b/mmv1/templates/terraform/examples/image_basic_storage_location.tf.tmpl index 31afa377bf2a..83e09c951a06 100644 --- a/mmv1/templates/terraform/examples/image_basic_storage_location.tf.tmpl +++ b/mmv1/templates/terraform/examples/image_basic_storage_location.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_image" "example" { - name = "<%= ctx[:vars]['image_name'] %>" + name = "{{index $.Vars "image_name"}}" raw_disk { source = "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz" diff --git a/mmv1/templates/terraform/examples/image_guest_os.tf.tmpl b/mmv1/templates/terraform/examples/image_guest_os.tf.tmpl index 6b0446eda0bb..c1c6295eff6d 100644 --- a/mmv1/templates/terraform/examples/image_guest_os.tf.tmpl +++ b/mmv1/templates/terraform/examples/image_guest_os.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_image" "example" { - name = "<%= ctx[:vars]['image_name'] %>" + name = "{{index $.Vars "image_name"}}" raw_disk { source = "https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz" diff --git a/mmv1/templates/terraform/examples/instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/instance_basic.tf.tmpl index ba1857b1075d..ecbc1172ad0c 100644 --- a/mmv1/templates/terraform/examples/instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/instance_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" - zone = "<%= ctx[:vars]['zone_name'] %>" +resource "google_compute_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" + zone = "{{index $.Vars "zone_name"}}" machine_type = "e2-medium" boot_disk { diff --git a/mmv1/templates/terraform/examples/instance_custom_hostname.tf.tmpl b/mmv1/templates/terraform/examples/instance_custom_hostname.tf.tmpl index 2e6147d44e46..29e5e8ee0cbb 100644 --- a/mmv1/templates/terraform/examples/instance_custom_hostname.tf.tmpl +++ b/mmv1/templates/terraform/examples/instance_custom_hostname.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['custom_hostname_instance_name'] %>" +resource "google_compute_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "custom_hostname_instance_name"}}" machine_type = "f1-micro" zone = "us-central1-c" diff --git a/mmv1/templates/terraform/examples/instance_group_membership.tf.tmpl b/mmv1/templates/terraform/examples/instance_group_membership.tf.tmpl index 7c822015b54f..c82776b73e6c 100644 --- a/mmv1/templates/terraform/examples/instance_group_membership.tf.tmpl +++ b/mmv1/templates/terraform/examples/instance_group_membership.tf.tmpl @@ -1,9 +1,9 @@ resource "google_compute_network" "default-network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_instance" "default-instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" boot_disk { @@ -18,7 +18,7 @@ resource "google_compute_instance" "default-instance" { } resource "google_compute_instance_group" "default-instance-group" { - name = "<%= ctx[:vars]['instance_group_name'] %>" + name = "{{index $.Vars "instance_group_name"}}" } resource "google_compute_instance_group_membership" "default-ig-membership" { diff --git a/mmv1/templates/terraform/examples/instance_group_named_port_gke.tf.tmpl b/mmv1/templates/terraform/examples/instance_group_named_port_gke.tf.tmpl index 32d2d23c876e..7e2fd7b83fcb 100644 --- a/mmv1/templates/terraform/examples/instance_group_named_port_gke.tf.tmpl +++ b/mmv1/templates/terraform/examples/instance_group_named_port_gke.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_instance_group_named_port" "{{$.PrimaryResourceId}}" { group = google_container_cluster.my_cluster.node_pool[0].instance_group_urls[0] zone = "us-central1-a" @@ -6,7 +6,7 @@ resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_i port = 8080 } -resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_id] %>s" { +resource "google_compute_instance_group_named_port" "{{$.PrimaryResourceId}}s" { group = google_container_cluster.my_cluster.node_pool[0].instance_group_urls[0] zone = "us-central1-a" @@ -15,19 +15,19 @@ resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_i } resource "google_compute_network" "container_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "container_subnetwork" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" region = "us-central1" network = google_compute_network.container_network.name ip_cidr_range = "10.0.36.0/24" } resource "google_container_cluster" "my_cluster" { - name = "<%= ctx[:vars]['gke_cluster_name'] %>" + name = "{{index $.Vars "gke_cluster_name"}}" location = "us-central1-a" initial_node_count = 1 @@ -38,5 +38,5 @@ resource "google_container_cluster" "my_cluster" { cluster_ipv4_cidr_block = "/19" services_ipv4_cidr_block = "/22" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/instance_settings_basic.tf.tmpl b/mmv1/templates/terraform/examples/instance_settings_basic.tf.tmpl index c664f01a49f6..3ef1792a394a 100644 --- a/mmv1/templates/terraform/examples/instance_settings_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/instance_settings_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_instance_settings" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_instance_settings" "{{$.PrimaryResourceId}}" { zone = "us-east7-b" metadata { items = { diff --git a/mmv1/templates/terraform/examples/instance_virtual_display_enabled.tf.tmpl b/mmv1/templates/terraform/examples/instance_virtual_display_enabled.tf.tmpl index 6efb91a2e298..5785f9546ff6 100644 --- a/mmv1/templates/terraform/examples/instance_virtual_display_enabled.tf.tmpl +++ b/mmv1/templates/terraform/examples/instance_virtual_display_enabled.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_virtual_display'] %>" +resource "google_compute_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_virtual_display"}}" machine_type = "f1-micro" zone = "us-central1-c" # Set the below to true to enable virtual display diff --git a/mmv1/templates/terraform/examples/instance_with_ip.tf.tmpl b/mmv1/templates/terraform/examples/instance_with_ip.tf.tmpl index f3636e7c35b7..5bdcb0f14758 100644 --- a/mmv1/templates/terraform/examples/instance_with_ip.tf.tmpl +++ b/mmv1/templates/terraform/examples/instance_with_ip.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_address" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['address_name'] %>" +resource "google_compute_address" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "address_name"}}" } data "google_compute_image" "debian_image" { @@ -8,7 +8,7 @@ data "google_compute_image" "debian_image" { } resource "google_compute_instance" "instance_with_ip" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "f1-micro" zone = "us-central1-a" diff --git a/mmv1/templates/terraform/examples/int_https_lb_https_redirect.tf.tmpl b/mmv1/templates/terraform/examples/int_https_lb_https_redirect.tf.tmpl index 3e140403fc30..dcd31d306dbc 100644 --- a/mmv1/templates/terraform/examples/int_https_lb_https_redirect.tf.tmpl +++ b/mmv1/templates/terraform/examples/int_https_lb_https_redirect.tf.tmpl @@ -3,13 +3,13 @@ # VPC network resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['l7_ilb_network'] %>" + name = "{{index $.Vars "l7_ilb_network"}}" auto_create_subnetworks = false } # Proxy-only subnet resource "google_compute_subnetwork" "proxy_subnet" { - name = "<%= ctx[:vars]['l7_ilb_proxy_subnet'] %>" + name = "{{index $.Vars "l7_ilb_proxy_subnet"}}" ip_cidr_range = "10.0.0.0/24" region = "europe-west1" purpose = "REGIONAL_MANAGED_PROXY" @@ -19,7 +19,7 @@ resource "google_compute_subnetwork" "proxy_subnet" { # Backend subnet resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['l7_ilb_subnet'] %>" + name = "{{index $.Vars "l7_ilb_subnet"}}" ip_cidr_range = "10.0.1.0/24" region = "europe-west1" network = google_compute_network.default.id @@ -27,7 +27,7 @@ resource "google_compute_subnetwork" "default" { # Reserved internal address resource "google_compute_address" "default" { - name = "<%= ctx[:vars]['l7_ilb_ip'] %>" + name = "{{index $.Vars "l7_ilb_ip"}}" provider = google-beta subnetwork = google_compute_subnetwork.default.id address_type = "INTERNAL" @@ -38,7 +38,7 @@ resource "google_compute_address" "default" { # Regional forwarding rule resource "google_compute_forwarding_rule" "default" { - name = "<%= ctx[:vars]['l7_ilb_forwarding_rule'] %>" + name = "{{index $.Vars "l7_ilb_forwarding_rule"}}" region = "europe-west1" depends_on = [google_compute_subnetwork.proxy_subnet] ip_protocol = "TCP" @@ -95,7 +95,7 @@ resource "google_compute_region_ssl_certificate" "default" { # Regional target HTTPS proxy resource "google_compute_region_target_https_proxy" "default" { - name = "<%= ctx[:vars]['l7_ilb_target_https_proxy'] %>" + name = "{{index $.Vars "l7_ilb_target_https_proxy"}}" region = "europe-west1" url_map = google_compute_region_url_map.https_lb.id ssl_certificates = [google_compute_region_ssl_certificate.default.self_link] @@ -103,14 +103,14 @@ resource "google_compute_region_target_https_proxy" "default" { # Regional URL map resource "google_compute_region_url_map" "https_lb" { - name = "<%= ctx[:vars]['l7_ilb_regional_url_map'] %>" + name = "{{index $.Vars "l7_ilb_regional_url_map"}}" region = "europe-west1" default_service = google_compute_region_backend_service.default.id } # Regional backend service resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['l7_ilb_backend_service'] %>" + name = "{{index $.Vars "l7_ilb_backend_service"}}" region = "europe-west1" protocol = "HTTP" port_name = "http-server" @@ -126,7 +126,7 @@ resource "google_compute_region_backend_service" "default" { # Instance template resource "google_compute_instance_template" "default" { - name = "<%= ctx[:vars]['l7_ilb_mig_template'] %>" + name = "{{index $.Vars "l7_ilb_mig_template"}}" machine_type = "e2-small" tags = ["http-server"] network_interface { @@ -172,7 +172,7 @@ resource "google_compute_instance_template" "default" { # Regional health check resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['l7_ilb_hc'] %>" + name = "{{index $.Vars "l7_ilb_hc"}}" region = "europe-west1" http_health_check { port_specification = "USE_SERVING_PORT" @@ -181,7 +181,7 @@ resource "google_compute_region_health_check" "default" { # Regional MIG resource "google_compute_region_instance_group_manager" "default" { - name = "<%= ctx[:vars]['l7_ilb_mig1'] %>" + name = "{{index $.Vars "l7_ilb_mig1"}}" region = "europe-west1" version { instance_template = google_compute_instance_template.default.id @@ -197,7 +197,7 @@ resource "google_compute_region_instance_group_manager" "default" { # Allow all access to health check ranges resource "google_compute_firewall" "default" { - name = "<%= ctx[:vars]['l7_ilb_fw_allow_hc'] %>" + name = "{{index $.Vars "l7_ilb_fw_allow_hc"}}" direction = "INGRESS" network = google_compute_network.default.id source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] @@ -208,7 +208,7 @@ resource "google_compute_firewall" "default" { # Allow http from proxy subnet to backends resource "google_compute_firewall" "backends" { - name = "<%= ctx[:vars]['l7_ilb_fw_allow_ilb_to_backends'] %>" + name = "{{index $.Vars "l7_ilb_fw_allow_ilb_to_backends"}}" direction = "INGRESS" network = google_compute_network.default.id source_ranges = ["10.0.0.0/24"] @@ -221,7 +221,7 @@ resource "google_compute_firewall" "backends" { # Test instance resource "google_compute_instance" "default" { - name = "<%= ctx[:vars]['l7_ilb_test_vm'] %>" + name = "{{index $.Vars "l7_ilb_test_vm"}}" zone = "europe-west1-b" machine_type = "e2-small" network_interface { @@ -239,7 +239,7 @@ resource "google_compute_instance" "default" { # Regional forwarding rule resource "google_compute_forwarding_rule" "redirect" { - name = "<%= ctx[:vars]['l7_ilb_redirect'] %>" + name = "{{index $.Vars "l7_ilb_redirect"}}" region = "europe-west1" ip_protocol = "TCP" ip_address = google_compute_address.default.address # Same as HTTPS load balancer @@ -253,14 +253,14 @@ resource "google_compute_forwarding_rule" "redirect" { # Regional HTTP proxy resource "google_compute_region_target_http_proxy" "default" { - name = "<%= ctx[:vars]['l7_ilb_target_http_proxy'] %>" + name = "{{index $.Vars "l7_ilb_target_http_proxy"}}" region = "europe-west1" url_map = google_compute_region_url_map.redirect.id } # Regional URL map -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['l7_ilb_redirect_url_map'] %>" +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "l7_ilb_redirect_url_map"}}" region = "europe-west1" default_service = google_compute_region_backend_service.default.id host_rule { diff --git a/mmv1/templates/terraform/examples/integration_connectors_connection_advanced.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_connection_advanced.tf.tmpl index 7c40d7c53f77..266d4df5db33 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_connection_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_connection_advanced.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "test_project" { } resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { replicas { @@ -25,8 +25,8 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" { depends_on = [google_secret_manager_secret_version.secret-version-basic] } -resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['connection_name'] %>" +resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "connection_name"}}" description = "tf updated description" location = "us-central1" service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" diff --git a/mmv1/templates/terraform/examples/integration_connectors_connection_basic.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_connection_basic.tf.tmpl index a0261644a100..fe8b803fdd1e 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_connection_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_connection_basic.tf.tmpl @@ -1,8 +1,8 @@ data "google_project" "test_project" { } -resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['connection_name'] %>" +resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "connection_name"}}" location = "us-central1" connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/gcp/connectors/pubsub/versions/1" description = "tf created description" diff --git a/mmv1/templates/terraform/examples/integration_connectors_connection_oauth.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_connection_oauth.tf.tmpl index 8eba69da624f..8dcc0da0e69b 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_connection_oauth.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_connection_oauth.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "test_project" { } resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { replicas { @@ -25,8 +25,8 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" { depends_on = [google_secret_manager_secret_version.secret-version-basic] } -resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['connection_name'] %>" +resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "connection_name"}}" location = "us-central1" connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" description = "tf created description" diff --git a/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_cc.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_cc.tf.tmpl index b22e04c033d5..e9b7b1e3bf02 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_cc.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_cc.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "test_project" { } resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { replicas { @@ -25,8 +25,8 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" { depends_on = [google_secret_manager_secret_version.secret-version-basic] } -resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['connection_name'] %>" +resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "connection_name"}}" location = "us-central1" connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" diff --git a/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_jwt.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_jwt.tf.tmpl index baaebee91662..1ed95073b324 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_jwt.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_jwt.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "test_project" { } resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { replicas { @@ -25,8 +25,8 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" { depends_on = [google_secret_manager_secret_version.secret-version-basic] } -resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['connection_name'] %>" +resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "connection_name"}}" location = "us-central1" connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" diff --git a/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_ssh.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_ssh.tf.tmpl index 26d602f1bf58..2b5dd2298918 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_ssh.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_connection_oauth_ssh.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "test_project" { } resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { replicas { @@ -25,8 +25,8 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" { depends_on = [google_secret_manager_secret_version.secret-version-basic] } -resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['connection_name'] %>" +resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "connection_name"}}" location = "us-central1" connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" diff --git a/mmv1/templates/terraform/examples/integration_connectors_connection_sa.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_connection_sa.tf.tmpl index 9c3151fc820d..250e2e74ea37 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_connection_sa.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_connection_sa.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "test_project" { } resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { replicas { @@ -25,8 +25,8 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" { depends_on = [google_secret_manager_secret_version.secret-version-basic] } -resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['connection_name'] %>" +resource "google_integration_connectors_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "connection_name"}}" description = "tf updated description" location = "us-central1" service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com" diff --git a/mmv1/templates/terraform/examples/integration_connectors_endpoint_attachment.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_endpoint_attachment.tf.tmpl index 0a0ebaa8cb63..2d734b1cb351 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_endpoint_attachment.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_endpoint_attachment.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_integration_connectors_endpoint_attachment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['endpoint_attachment_name'] %>" +resource "google_integration_connectors_endpoint_attachment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "endpoint_attachment_name"}}" location = "us-central1" description = "tf created description" service_attachment = "projects/connectors-example/regions/us-central1/serviceAttachments/test" diff --git a/mmv1/templates/terraform/examples/integration_connectors_managed_zone.tf.tmpl b/mmv1/templates/terraform/examples/integration_connectors_managed_zone.tf.tmpl index fb5d58ad28c4..6ba34c480050 100644 --- a/mmv1/templates/terraform/examples/integration_connectors_managed_zone.tf.tmpl +++ b/mmv1/templates/terraform/examples/integration_connectors_managed_zone.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "target_project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -45,8 +45,8 @@ resource "google_dns_managed_zone" "zone" { data "google_project" "test_project" { } -resource "google_integration_connectors_managed_zone" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['managed_zone_name'] %>" +resource "google_integration_connectors_managed_zone" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "managed_zone_name"}}" description = "tf created description" labels = { intent = "example" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_advance.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_advance.tf.tmpl index d0f9ccb50233..8275e659a58f 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_advance.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_advance.tf.tmpl @@ -2,9 +2,9 @@ resource "google_integrations_client" "client" { location = "asia-east2" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "asia-east2" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" visibility = "CLIENT_VISIBLE" expiry_notification_duration = ["3.500s"] diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_auth_token.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_auth_token.tf.tmpl index 6444f0b21d56..381caeb0db7d 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_auth_token.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_auth_token.tf.tmpl @@ -2,9 +2,9 @@ resource "google_integrations_client" "client" { location = "us-west2" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "us-west2" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "AUTH_TOKEN" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_basic.tf.tmpl index 54393f47ef6a..09b52bbd258e 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_basic.tf.tmpl @@ -2,9 +2,9 @@ resource "google_integrations_client" "client" { location = "us-west1" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "us-west1" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "USERNAME_AND_PASSWORD" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_client_certificate_only.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_client_certificate_only.tf.tmpl index 9fc84c2f466b..3b868b1ffb24 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_client_certificate_only.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_client_certificate_only.tf.tmpl @@ -2,9 +2,9 @@ resource "google_integrations_client" "client" { location = "us-west3" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "us-west3" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "CLIENT_CERTIFICATE_ONLY" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_jwt.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_jwt.tf.tmpl index b1dbc3c7165e..91f7b2b33843 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_jwt.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_jwt.tf.tmpl @@ -2,9 +2,9 @@ resource "google_integrations_client" "client" { location = "us-west4" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "us-west4" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "JWT" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_oauth2_authorization_code.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_oauth2_authorization_code.tf.tmpl index 6cc6c256044d..18684fcbfabf 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_oauth2_authorization_code.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_oauth2_authorization_code.tf.tmpl @@ -2,9 +2,9 @@ resource "google_integrations_client" "client" { location = "asia-east1" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "asia-east1" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "OAUTH2_AUTHORIZATION_CODE" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_oauth2_client_credentials.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_oauth2_client_credentials.tf.tmpl index 6d40bf1f5b68..a99752b9ae20 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_oauth2_client_credentials.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_oauth2_client_credentials.tf.tmpl @@ -2,9 +2,9 @@ resource "google_integrations_client" "client" { location = "southamerica-east1" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "southamerica-east1" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "OAUTH2_CLIENT_CREDENTIALS" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_oidc_token.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_oidc_token.tf.tmpl index 9292e02ca31d..416be1b44903 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_oidc_token.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_oidc_token.tf.tmpl @@ -3,13 +3,13 @@ resource "google_integrations_client" "client" { } resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['service_account_id'] %>" + account_id = "{{index $.Vars "service_account_id"}}" display_name = "Service Account" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "us-south1" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "OIDC_TOKEN" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_service_account.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_service_account.tf.tmpl index 676014ca7cca..4f41fe3a89c0 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_service_account.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_service_account.tf.tmpl @@ -3,13 +3,13 @@ resource "google_integrations_client" "client" { } resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['service_account_id'] %>" + account_id = "{{index $.Vars "service_account_id"}}" display_name = "Service Account" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "northamerica-northeast1" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "SERVICE_ACCOUNT" diff --git a/mmv1/templates/terraform/examples/integrations_auth_config_username_and_password.tf.tmpl b/mmv1/templates/terraform/examples/integrations_auth_config_username_and_password.tf.tmpl index 5168aef8cc41..3e86843f8cb0 100644 --- a/mmv1/templates/terraform/examples/integrations_auth_config_username_and_password.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_auth_config_username_and_password.tf.tmpl @@ -2,9 +2,9 @@ resource "google_integrations_client" "client" { location = "northamerica-northeast2" } -resource "google_integrations_auth_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_auth_config" "{{$.PrimaryResourceId}}" { location = "northamerica-northeast2" - display_name = "<%= ctx[:vars]['auth_config_name'] %>" + display_name = "{{index $.Vars "auth_config_name"}}" description = "Test auth config created via terraform" decrypted_credential { credential_type = "USERNAME_AND_PASSWORD" diff --git a/mmv1/templates/terraform/examples/go/integrations_client_advance.tf.tmpl b/mmv1/templates/terraform/examples/integrations_client_advance.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/integrations_client_advance.tf.tmpl rename to mmv1/templates/terraform/examples/integrations_client_advance.tf.tmpl diff --git a/mmv1/templates/terraform/examples/integrations_client_basic.tf.tmpl b/mmv1/templates/terraform/examples/integrations_client_basic.tf.tmpl index 1fc724bcf539..92df8db0d2da 100644 --- a/mmv1/templates/terraform/examples/integrations_client_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_client_basic.tf.tmpl @@ -1,3 +1,3 @@ -resource "google_integrations_client" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_client" "{{$.PrimaryResourceId}}" { location = "us-central1" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/integrations_client_deprecated_fields.tf.tmpl b/mmv1/templates/terraform/examples/integrations_client_deprecated_fields.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/integrations_client_deprecated_fields.tf.tmpl rename to mmv1/templates/terraform/examples/integrations_client_deprecated_fields.tf.tmpl diff --git a/mmv1/templates/terraform/examples/integrations_client_full.tf.tmpl b/mmv1/templates/terraform/examples/integrations_client_full.tf.tmpl index 106df625062a..ce7f13f5124c 100644 --- a/mmv1/templates/terraform/examples/integrations_client_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/integrations_client_full.tf.tmpl @@ -2,7 +2,7 @@ data "google_project" "test_project" { } resource "google_kms_key_ring" "keyring" { - name = "<%= ctx[:vars]['key_ring_name'] %>" + name = "{{index $.Vars "key_ring_name"}}" location = "us-east1" } @@ -17,11 +17,11 @@ resource "google_kms_crypto_key_version" "test_key" { } resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['service_account_id'] %>" + account_id = "{{index $.Vars "service_account_id"}}" display_name = "Service Account" } -resource "google_integrations_client" "<%= ctx[:primary_resource_id] %>" { +resource "google_integrations_client" "{{$.PrimaryResourceId}}" { location = "us-east1" create_sample_integrations = true run_as_service_account = google_service_account.service_account.email diff --git a/mmv1/templates/terraform/examples/interconnect_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/interconnect_attachment_basic.tf.tmpl index 06e7cee5f565..fe85a23bc329 100644 --- a/mmv1/templates/terraform/examples/interconnect_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/interconnect_attachment_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_interconnect_attachment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['interconnect_attachment_name'] %>" +resource "google_compute_interconnect_attachment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "interconnect_attachment_name"}}" edge_availability_domain = "AVAILABILITY_DOMAIN_1" type = "PARTNER" router = google_compute_router.foobar.id @@ -7,7 +7,7 @@ resource "google_compute_interconnect_attachment" "<%= ctx[:primary_resource_id] } resource "google_compute_router" "foobar" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" network = google_compute_network.foobar.name bgp { asn = 16550 @@ -15,6 +15,6 @@ resource "google_compute_router" "foobar" { } resource "google_compute_network" "foobar" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/interconnect_attachment_dedicated.tf.tmpl b/mmv1/templates/terraform/examples/interconnect_attachment_dedicated.tf.tmpl index edba4fa91b90..b30e6bcab8ba 100644 --- a/mmv1/templates/terraform/examples/interconnect_attachment_dedicated.tf.tmpl +++ b/mmv1/templates/terraform/examples/interconnect_attachment_dedicated.tf.tmpl @@ -1,7 +1,7 @@ data "google_project" "project" {} resource "google_compute_interconnect" "foobar" { - name = "<%= ctx[:vars]['interconnect_name'] %>" + name = "{{index $.Vars "interconnect_name"}}" customer_name = "internal_customer" # Special customer only available for Google testing. interconnect_type = "DEDICATED" link_type = "LINK_TYPE_ETHERNET_10G_LR" @@ -9,8 +9,8 @@ resource "google_compute_interconnect" "foobar" { 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" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['interconnect_attachment_name'] %>" +resource "google_compute_interconnect_attachment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "interconnect_attachment_name"}}" type = "DEDICATED" interconnect = google_compute_interconnect.foobar.id router = google_compute_router.foobar.id @@ -22,7 +22,7 @@ resource "google_compute_interconnect_attachment" "<%= ctx[:primary_resource_id] } resource "google_compute_router" "foobar" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" network = google_compute_network.foobar.name region = "us-east4" bgp { @@ -31,6 +31,6 @@ resource "google_compute_router" "foobar" { } resource "google_compute_network" "foobar" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/internal_http_lb_with_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/internal_http_lb_with_mig_backend.tf.tmpl index 92c56b49f52f..3883a2acd688 100644 --- a/mmv1/templates/terraform/examples/internal_http_lb_with_mig_backend.tf.tmpl +++ b/mmv1/templates/terraform/examples/internal_http_lb_with_mig_backend.tf.tmpl @@ -2,14 +2,14 @@ # VPC network resource "google_compute_network" "ilb_network" { - name = "<%= ctx[:vars]['ilb_network_name'] %>" + name = "{{index $.Vars "ilb_network_name"}}" provider = google-beta auto_create_subnetworks = false } # proxy-only subnet resource "google_compute_subnetwork" "proxy_subnet" { - name = "<%= ctx[:vars]['proxy_subnet_name'] %>" + name = "{{index $.Vars "proxy_subnet_name"}}" provider = google-beta ip_cidr_range = "10.0.0.0/24" region = "europe-west1" @@ -20,7 +20,7 @@ resource "google_compute_subnetwork" "proxy_subnet" { # backend subnet resource "google_compute_subnetwork" "ilb_subnet" { - name = "<%= ctx[:vars]['backend_subnet_name'] %>" + name = "{{index $.Vars "backend_subnet_name"}}" provider = google-beta ip_cidr_range = "10.0.1.0/24" region = "europe-west1" @@ -28,8 +28,8 @@ resource "google_compute_subnetwork" "ilb_subnet" { } # forwarding rule -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" provider = google-beta region = "europe-west1" depends_on = [google_compute_subnetwork.proxy_subnet] @@ -44,7 +44,7 @@ resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { # HTTP target proxy resource "google_compute_region_target_http_proxy" "default" { - name = "<%= ctx[:vars]['target_http_proxy_name'] %>" + name = "{{index $.Vars "target_http_proxy_name"}}" provider = google-beta region = "europe-west1" url_map = google_compute_region_url_map.default.id @@ -52,7 +52,7 @@ resource "google_compute_region_target_http_proxy" "default" { # URL map resource "google_compute_region_url_map" "default" { - name = "<%= ctx[:vars]['regional_url_map_name'] %>" + name = "{{index $.Vars "regional_url_map_name"}}" provider = google-beta region = "europe-west1" default_service = google_compute_region_backend_service.default.id @@ -60,7 +60,7 @@ resource "google_compute_region_url_map" "default" { # backend service resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" provider = google-beta region = "europe-west1" protocol = "HTTP" @@ -76,7 +76,7 @@ resource "google_compute_region_backend_service" "default" { # instance template resource "google_compute_instance_template" "instance_template" { - name = "<%= ctx[:vars]['mig_template_name'] %>" + name = "{{index $.Vars "mig_template_name"}}" provider = google-beta machine_type = "e2-small" tags = ["http-server"] @@ -124,7 +124,7 @@ resource "google_compute_instance_template" "instance_template" { # health check resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['hc_name'] %>" + name = "{{index $.Vars "hc_name"}}" provider = google-beta region = "europe-west1" http_health_check { @@ -134,7 +134,7 @@ resource "google_compute_region_health_check" "default" { # MIG resource "google_compute_region_instance_group_manager" "mig" { - name = "<%= ctx[:vars]['mig_name'] %>" + name = "{{index $.Vars "mig_name"}}" provider = google-beta region = "europe-west1" version { @@ -147,7 +147,7 @@ resource "google_compute_region_instance_group_manager" "mig" { # allow all access from IAP and health check ranges resource "google_compute_firewall" "fw-iap" { - name = "<%= ctx[:vars]['fw_allow_iap_hc_name'] %>" + name = "{{index $.Vars "fw_allow_iap_hc_name"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.ilb_network.id @@ -159,7 +159,7 @@ resource "google_compute_firewall" "fw-iap" { # allow http from proxy subnet to backends resource "google_compute_firewall" "fw-ilb-to-backends" { - name = "<%= ctx[:vars]['fw_allow_ilb_to_backends_name'] %>" + name = "{{index $.Vars "fw_allow_ilb_to_backends_name"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.ilb_network.id @@ -173,7 +173,7 @@ resource "google_compute_firewall" "fw-ilb-to-backends" { # test instance resource "google_compute_instance" "vm-test" { - name = "<%= ctx[:vars]['vm_test_name'] %>" + name = "{{index $.Vars "vm_test_name"}}" provider = google-beta zone = "europe-west1-b" machine_type = "e2-small" diff --git a/mmv1/templates/terraform/examples/internal_tcp_udp_lb_with_mig_backend.tf.tmpl b/mmv1/templates/terraform/examples/internal_tcp_udp_lb_with_mig_backend.tf.tmpl index 191acdbb30f3..7205bc4ca755 100644 --- a/mmv1/templates/terraform/examples/internal_tcp_udp_lb_with_mig_backend.tf.tmpl +++ b/mmv1/templates/terraform/examples/internal_tcp_udp_lb_with_mig_backend.tf.tmpl @@ -2,14 +2,14 @@ # VPC resource "google_compute_network" "ilb_network" { - name = "<%= ctx[:vars]['ilb_network_name'] %>" + name = "{{index $.Vars "ilb_network_name"}}" provider = google-beta auto_create_subnetworks = false } # backed subnet resource "google_compute_subnetwork" "ilb_subnet" { - name = "<%= ctx[:vars]['backend_subnet_name'] %>" + name = "{{index $.Vars "backend_subnet_name"}}" provider = google-beta ip_cidr_range = "10.0.1.0/24" region = "europe-west1" @@ -17,8 +17,8 @@ resource "google_compute_subnetwork" "ilb_subnet" { } # forwarding rule -resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" +resource "google_compute_forwarding_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "forwarding_rule_name"}}" backend_service = google_compute_region_backend_service.default.id provider = google-beta region = "europe-west1" @@ -32,7 +32,7 @@ resource "google_compute_forwarding_rule" "<%= ctx[:primary_resource_id] %>" { # backend service resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" provider = google-beta region = "europe-west1" protocol = "TCP" @@ -46,7 +46,7 @@ resource "google_compute_region_backend_service" "default" { # instance template resource "google_compute_instance_template" "instance_template" { - name = "<%= ctx[:vars]['mig_template_name'] %>" + name = "{{index $.Vars "mig_template_name"}}" provider = google-beta machine_type = "e2-small" tags = ["allow-ssh","allow-health-check"] @@ -94,7 +94,7 @@ resource "google_compute_instance_template" "instance_template" { # health check resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['hc_name'] %>" + name = "{{index $.Vars "hc_name"}}" provider = google-beta region = "europe-west1" http_health_check { @@ -104,7 +104,7 @@ resource "google_compute_region_health_check" "default" { # MIG resource "google_compute_region_instance_group_manager" "mig" { - name = "<%= ctx[:vars]['mig_name'] %>" + name = "{{index $.Vars "mig_name"}}" provider = google-beta region = "europe-west1" version { @@ -117,7 +117,7 @@ resource "google_compute_region_instance_group_manager" "mig" { # allow all access from health check ranges resource "google_compute_firewall" "fw_hc" { - name = "<%= ctx[:vars]['fw_allow_hc_name'] %>" + name = "{{index $.Vars "fw_allow_hc_name"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.ilb_network.id @@ -130,7 +130,7 @@ resource "google_compute_firewall" "fw_hc" { # allow communication within the subnet resource "google_compute_firewall" "fw_ilb_to_backends" { - name = "<%= ctx[:vars]['fw_allow_ilb_to_backends_name'] %>" + name = "{{index $.Vars "fw_allow_ilb_to_backends_name"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.ilb_network.id @@ -148,7 +148,7 @@ resource "google_compute_firewall" "fw_ilb_to_backends" { # allow SSH resource "google_compute_firewall" "fw_ilb_ssh" { - name = "<%= ctx[:vars]['fw_allow_ilb_ssh_name'] %>" + name = "{{index $.Vars "fw_allow_ilb_ssh_name"}}" provider = google-beta direction = "INGRESS" network = google_compute_network.ilb_network.id @@ -162,7 +162,7 @@ resource "google_compute_firewall" "fw_ilb_ssh" { # test instance resource "google_compute_instance" "vm_test" { - name = "<%= ctx[:vars]['vm_test_name'] %>" + name = "{{index $.Vars "vm_test_name"}}" provider = google-beta zone = "europe-west1-b" machine_type = "e2-small" diff --git a/mmv1/templates/terraform/examples/kmsConfig_create.tf.tmpl b/mmv1/templates/terraform/examples/kmsConfig_create.tf.tmpl index b39c484e1fbc..6f9c80f60be4 100644 --- a/mmv1/templates/terraform/examples/kmsConfig_create.tf.tmpl +++ b/mmv1/templates/terraform/examples/kmsConfig_create.tf.tmpl @@ -1,16 +1,16 @@ resource "google_kms_key_ring" "keyring" { - name = "<%= ctx[:vars]['key_ring_value'] %>" + name = "{{index $.Vars "key_ring_value"}}" location = "us-central1" } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['crypto_name'] %>" + name = "{{index $.Vars "crypto_name"}}" key_ring = google_kms_key_ring.keyring.id # rotation_period = "7776000s" } -resource "google_netapp_kmsconfig" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['kms_name'] %>" +resource "google_netapp_kmsconfig" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "kms_name"}}" description="this is a test description" crypto_key_name=google_kms_crypto_key.crypto_key.id location="us-central1" diff --git a/mmv1/templates/terraform/examples/kms_autokey_config_all.tf.tmpl b/mmv1/templates/terraform/examples/kms_autokey_config_all.tf.tmpl index 26dc92ec97e5..aa3ad3661cc6 100644 --- a/mmv1/templates/terraform/examples/kms_autokey_config_all.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_autokey_config_all.tf.tmpl @@ -1,18 +1,18 @@ # Create Folder in GCP Organization resource "google_folder" "autokms_folder" { provider = google-beta - display_name = "<%= ctx[:vars]["folder_name"] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + display_name = "{{index $.Vars "folder_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" deletion_protection = false } # Create the key project resource "google_project" "key_project" { provider = google-beta - project_id = "<%= ctx[:vars]["key_project_name"] %>" - name = "<%= ctx[:vars]["key_project_name"] %>" + project_id = "{{index $.Vars "key_project_name"}}" + name = "{{index $.Vars "key_project_name"}}" folder_id = google_folder.autokms_folder.folder_id - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + billing_account = "{{index $.TestEnvVars "billing_account"}}" depends_on = [google_folder.autokms_folder] deletion_policy = "DELETE" } @@ -62,7 +62,7 @@ resource "time_sleep" "wait_srv_acc_permissions" { depends_on = [google_project_iam_member.autokey_project_admin] } -resource "google_kms_autokey_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_kms_autokey_config" "{{$.PrimaryResourceId}}" { provider = google-beta folder = google_folder.autokms_folder.id key_project = "projects/${google_project.key_project.project_id}" @@ -73,5 +73,5 @@ resource "google_kms_autokey_config" "<%= ctx[:primary_resource_id] %>" { # because setting the config takes a little to fully propagate. resource "time_sleep" "wait_autokey_propagation" { create_duration = "30s" - depends_on = [google_kms_autokey_config.<%= ctx[:primary_resource_id] %>] + depends_on = [google_kms_autokey_config.{{$.PrimaryResourceId}}] } diff --git a/mmv1/templates/terraform/examples/kms_crypto_key_asymmetric_sign.tf.tmpl b/mmv1/templates/terraform/examples/kms_crypto_key_asymmetric_sign.tf.tmpl index 9020af7f6854..7fa0a6bdf530 100644 --- a/mmv1/templates/terraform/examples/kms_crypto_key_asymmetric_sign.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_crypto_key_asymmetric_sign.tf.tmpl @@ -3,7 +3,7 @@ resource "google_kms_key_ring" "keyring" { location = "global" } -resource "google_kms_crypto_key" "<%= ctx[:primary_resource_id] %>" { +resource "google_kms_crypto_key" "{{$.PrimaryResourceId}}" { name = "crypto-key-example" key_ring = google_kms_key_ring.keyring.id purpose = "ASYMMETRIC_SIGN" diff --git a/mmv1/templates/terraform/examples/kms_crypto_key_basic.tf.tmpl b/mmv1/templates/terraform/examples/kms_crypto_key_basic.tf.tmpl index 8d77858f7bde..e996e99f3e26 100644 --- a/mmv1/templates/terraform/examples/kms_crypto_key_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_crypto_key_basic.tf.tmpl @@ -3,7 +3,7 @@ resource "google_kms_key_ring" "keyring" { location = "global" } -resource "google_kms_crypto_key" "<%= ctx[:primary_resource_id] %>" { +resource "google_kms_crypto_key" "{{$.PrimaryResourceId}}" { name = "crypto-key-example" key_ring = google_kms_key_ring.keyring.id rotation_period = "7776000s" diff --git a/mmv1/templates/terraform/examples/kms_crypto_key_version_basic.tf.tmpl b/mmv1/templates/terraform/examples/kms_crypto_key_version_basic.tf.tmpl index e3af914dba78..556d174b3e63 100644 --- a/mmv1/templates/terraform/examples/kms_crypto_key_version_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_crypto_key_version_basic.tf.tmpl @@ -9,6 +9,6 @@ resource "google_kms_crypto_key" "cryptokey" { rotation_period = "7776000s" } -resource "google_kms_crypto_key_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_kms_crypto_key_version" "{{$.PrimaryResourceId}}" { crypto_key = google_kms_crypto_key.cryptokey.id } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/kms_ekm_connection_basic.tf.tmpl b/mmv1/templates/terraform/examples/kms_ekm_connection_basic.tf.tmpl index 49fcd7f8769c..9ecf12b55ab2 100644 --- a/mmv1/templates/terraform/examples/kms_ekm_connection_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_ekm_connection_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_kms_ekm_connection" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['ekmconnection_name'] %>" +resource "google_kms_ekm_connection" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "ekmconnection_name"}}" location = "us-central1" key_management_mode = "MANUAL" service_resolvers { diff --git a/mmv1/templates/terraform/examples/kms_key_handle_basic.tf.tmpl b/mmv1/templates/terraform/examples/kms_key_handle_basic.tf.tmpl index 327cf589046c..2c87c30cb825 100644 --- a/mmv1/templates/terraform/examples/kms_key_handle_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_key_handle_basic.tf.tmpl @@ -2,17 +2,17 @@ resource "google_folder" "autokms_folder" { provider = google-beta display_name = "folder-example" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" deletion_protection = false } # Create the key project resource "google_project" "key_project" { provider = google-beta - project_id = "<%= ctx[:vars]["key_project_name"] %>" - name = "<%= ctx[:vars]["key_project_name"] %>" + project_id = "{{index $.Vars "key_project_name"}}" + name = "{{index $.Vars "key_project_name"}}" folder_id = google_folder.autokms_folder.folder_id - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + billing_account = "{{index $.TestEnvVars "billing_account"}}" depends_on = [google_folder.autokms_folder] deletion_policy = "DELETE" } @@ -20,10 +20,10 @@ resource "google_project" "key_project" { # Create the resource project resource "google_project" "resource_project" { provider = google-beta - project_id = "<%= ctx[:vars]["resource_project_name"] %>" - name = "<%= ctx[:vars]["resource_project_name"] %>" + project_id = "{{index $.Vars "resource_project_name"}}" + name = "{{index $.Vars "resource_project_name"}}" folder_id = google_folder.autokms_folder.folder_id - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + billing_account = "{{index $.TestEnvVars "billing_account"}}" depends_on = [google_folder.autokms_folder] deletion_policy = "DELETE" } @@ -86,7 +86,7 @@ resource "time_sleep" "wait_autokey_config" { depends_on = [google_kms_autokey_config.autokey_config] } -resource "google_kms_key_handle" "<%= ctx[:primary_resource_id] %>" { +resource "google_kms_key_handle" "{{$.PrimaryResourceId}}" { provider = google-beta project = google_project.resource_project.project_id name = "example-key-handle" diff --git a/mmv1/templates/terraform/examples/kms_key_ring_basic.tf.tmpl b/mmv1/templates/terraform/examples/kms_key_ring_basic.tf.tmpl index 998e29d1f832..b5c4f5c1ac23 100644 --- a/mmv1/templates/terraform/examples/kms_key_ring_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_key_ring_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_kms_key_ring" "<%= ctx[:primary_resource_id] %>" { +resource "google_kms_key_ring" "{{$.PrimaryResourceId}}" { name = "keyring-example" location = "global" } diff --git a/mmv1/templates/terraform/examples/kms_key_ring_import_job.tf.tmpl b/mmv1/templates/terraform/examples/kms_key_ring_import_job.tf.tmpl index 0a838c020372..5ca047e3b736 100644 --- a/mmv1/templates/terraform/examples/kms_key_ring_import_job.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_key_ring_import_job.tf.tmpl @@ -1,15 +1,15 @@ resource "google_kms_key_ring" "keyring" { - name = "<%= ctx[:vars]['keyring'] %>" + name = "{{index $.Vars "keyring"}}" location = "global" } resource "google_kms_crypto_key" "example-key" { - name = "<%= ctx[:vars]['cryptokey'] %>"" + name = "{{index $.Vars "cryptokey"}}"" key_ring = google_kms_key_ring.keyring.id skip_initial_version_creation = true } -resource "google_kms_key_ring_import_job" "<%= ctx[:primary_resource_id] %>" { +resource "google_kms_key_ring_import_job" "{{$.PrimaryResourceId}}" { key_ring = google_kms_key_ring.keyring.id import_job_id = "my-import-job" diff --git a/mmv1/templates/terraform/examples/kms_secret_ciphertext_basic.tf.tmpl b/mmv1/templates/terraform/examples/kms_secret_ciphertext_basic.tf.tmpl index 972a4eafaa25..117d51df8d26 100644 --- a/mmv1/templates/terraform/examples/kms_secret_ciphertext_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/kms_secret_ciphertext_basic.tf.tmpl @@ -13,13 +13,13 @@ resource "google_kms_crypto_key" "cryptokey" { } } -resource "google_kms_secret_ciphertext" "<%= ctx[:primary_resource_id] %>" { +resource "google_kms_secret_ciphertext" "{{$.PrimaryResourceId}}" { crypto_key = google_kms_crypto_key.cryptokey.id plaintext = "my-secret-password" } resource "google_compute_instance" "instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" zone = "us-central1-a" @@ -37,6 +37,6 @@ resource "google_compute_instance" "instance" { } metadata = { - password = google_kms_secret_ciphertext.<%= ctx[:primary_resource_id] %>.ciphertext + password = google_kms_secret_ciphertext.{{$.PrimaryResourceId}}.ciphertext } } diff --git a/mmv1/templates/terraform/examples/logging_folder_settings_all.tf.tmpl b/mmv1/templates/terraform/examples/logging_folder_settings_all.tf.tmpl index c9a44202cab3..fbd552c14b33 100644 --- a/mmv1/templates/terraform/examples/logging_folder_settings_all.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_folder_settings_all.tf.tmpl @@ -1,14 +1,14 @@ -resource "google_logging_folder_settings" "<%= ctx[:primary_resource_id] %>" { +resource "google_logging_folder_settings" "{{$.PrimaryResourceId}}" { disable_default_sink = true folder = google_folder.my_folder.folder_id - kms_key_name = "<%= ctx[:vars]['key_name'] %>" + kms_key_name = "{{index $.Vars "key_name"}}" storage_location = "us-central1" depends_on = [ google_kms_crypto_key_iam_member.iam ] } resource "google_folder" "my_folder" { - display_name = "<%= ctx[:vars]['folder_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + display_name = "{{index $.Vars "folder_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" deletion_protection = false } @@ -17,7 +17,7 @@ data "google_logging_folder_settings" "settings" { } resource "google_kms_crypto_key_iam_member" "iam" { - crypto_key_id = "<%= ctx[:vars]['key_name'] %>" + crypto_key_id = "{{index $.Vars "key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:${data.google_logging_folder_settings.settings.kms_service_account_id}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/logging_linked_dataset_all_params.tf.tmpl b/mmv1/templates/terraform/examples/logging_linked_dataset_all_params.tf.tmpl index 132ac37c59da..c50306e3e073 100644 --- a/mmv1/templates/terraform/examples/logging_linked_dataset_all_params.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_linked_dataset_all_params.tf.tmpl @@ -1,16 +1,16 @@ -resource "google_logging_project_bucket_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { location = "global" - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" enable_analytics = true - bucket_id = "<%= ctx[:vars]['bucket_id'] %>" + bucket_id = "{{index $.Vars "bucket_id"}}" } -resource "google_logging_linked_dataset" "<%= ctx[:primary_resource_id] %>" { - link_id = "<%= ctx[:vars]['link_id'] %>" - bucket = "<%= ctx[:vars]['bucket_id'] %>" - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_logging_linked_dataset" "{{$.PrimaryResourceId}}" { + link_id = "{{index $.Vars "link_id"}}" + bucket = "{{index $.Vars "bucket_id"}}" + parent = "projects/{{index $.TestEnvVars "project"}}" location = "global" description = "Linked dataset test" - depends_on = ["google_logging_project_bucket_config.<%= ctx[:primary_resource_id] %>"] + depends_on = ["google_logging_project_bucket_config.{{$.PrimaryResourceId}}"] } diff --git a/mmv1/templates/terraform/examples/logging_linked_dataset_basic.tf.tmpl b/mmv1/templates/terraform/examples/logging_linked_dataset_basic.tf.tmpl index 8843b7a082c1..11220dfe8c7e 100644 --- a/mmv1/templates/terraform/examples/logging_linked_dataset_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_linked_dataset_basic.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_logging_project_bucket_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { location = "global" - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" enable_analytics = true - bucket_id = "<%= ctx[:vars]['bucket_id'] %>" + bucket_id = "{{index $.Vars "bucket_id"}}" } -resource "google_logging_linked_dataset" "<%= ctx[:primary_resource_id] %>" { - link_id = "<%= ctx[:vars]['link_id'] %>" - bucket = google_logging_project_bucket_config.<%= ctx[:primary_resource_id] %>.id +resource "google_logging_linked_dataset" "{{$.PrimaryResourceId}}" { + link_id = "{{index $.Vars "link_id"}}" + bucket = google_logging_project_bucket_config.{{$.PrimaryResourceId}}.id description = "Linked dataset test" } diff --git a/mmv1/templates/terraform/examples/logging_log_view_basic.tf.tmpl b/mmv1/templates/terraform/examples/logging_log_view_basic.tf.tmpl index 6942268daabb..be900870a59a 100644 --- a/mmv1/templates/terraform/examples/logging_log_view_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_log_view_basic.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_logging_project_bucket_config" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project"}}" location = "global" retention_days = 30 bucket_id = "_Default" } -resource "google_logging_log_view" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['log_view_name'] %>" - bucket = google_logging_project_bucket_config.<%= ctx[:primary_resource_id] %>.id +resource "google_logging_log_view" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "log_view_name"}}" + bucket = google_logging_project_bucket_config.{{$.PrimaryResourceId}}.id description = "A logging view configured with Terraform" filter = "SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")" } diff --git a/mmv1/templates/terraform/examples/logging_log_view_long_name.tf.tmpl b/mmv1/templates/terraform/examples/logging_log_view_long_name.tf.tmpl index 6c953b034d0b..bc834e6dea38 100644 --- a/mmv1/templates/terraform/examples/logging_log_view_long_name.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_log_view_long_name.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_logging_project_bucket_config" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project"}}" location = "global" retention_days = 30 bucket_id = "_Default" } -resource "google_logging_log_view" "<%= ctx[:primary_resource_id] %>" { - name = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/global/buckets/_Default/views/tf-test-view%{random_suffix}" - bucket = google_logging_project_bucket_config.<%= ctx[:primary_resource_id] %>.id +resource "google_logging_log_view" "{{$.PrimaryResourceId}}" { + name = "projects/{{index $.TestEnvVars "project"}}/locations/global/buckets/_Default/views/tf-test-view%{random_suffix}" + bucket = google_logging_project_bucket_config.{{$.PrimaryResourceId}}.id description = "A logging view configured with Terraform" filter = "SOURCE(\"projects/myproject\") AND resource.type = \"gce_instance\" AND LOG_ID(\"stdout\")" } diff --git a/mmv1/templates/terraform/examples/logging_metric_basic.tf.tmpl b/mmv1/templates/terraform/examples/logging_metric_basic.tf.tmpl index 6f9f7afa7ca0..ff5a467f4729 100644 --- a/mmv1/templates/terraform/examples/logging_metric_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_metric_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["logging_metric_name"] %>" +resource "google_logging_metric" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "logging_metric_name"}}" filter = "resource.type=gae_app AND severity>=ERROR" metric_descriptor { metric_kind = "DELTA" diff --git a/mmv1/templates/terraform/examples/logging_metric_counter_basic.tf.tmpl b/mmv1/templates/terraform/examples/logging_metric_counter_basic.tf.tmpl index f6af100da121..d3fd6708fd1d 100644 --- a/mmv1/templates/terraform/examples/logging_metric_counter_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_metric_counter_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["logging_metric_name"] %>" +resource "google_logging_metric" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "logging_metric_name"}}" filter = "resource.type=gae_app AND severity>=ERROR" metric_descriptor { metric_kind = "DELTA" diff --git a/mmv1/templates/terraform/examples/logging_metric_counter_labels.tf.tmpl b/mmv1/templates/terraform/examples/logging_metric_counter_labels.tf.tmpl index b3a92374c915..408c18f94ea8 100644 --- a/mmv1/templates/terraform/examples/logging_metric_counter_labels.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_metric_counter_labels.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["logging_metric_name"] %>" +resource "google_logging_metric" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "logging_metric_name"}}" filter = "resource.type=gae_app AND severity>=ERROR" metric_descriptor { metric_kind = "DELTA" diff --git a/mmv1/templates/terraform/examples/logging_metric_disabled.tf.tmpl b/mmv1/templates/terraform/examples/logging_metric_disabled.tf.tmpl index 9efab7e6d497..a3420310141e 100644 --- a/mmv1/templates/terraform/examples/logging_metric_disabled.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_metric_disabled.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["logging_metric_name"] %>" +resource "google_logging_metric" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "logging_metric_name"}}" filter = "resource.type=gae_app AND severity>=ERROR" metric_descriptor { metric_kind = "DELTA" diff --git a/mmv1/templates/terraform/examples/logging_metric_logging_bucket.tf.tmpl b/mmv1/templates/terraform/examples/logging_metric_logging_bucket.tf.tmpl index d821bed52570..08dfacb2a201 100644 --- a/mmv1/templates/terraform/examples/logging_metric_logging_bucket.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_metric_logging_bucket.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_logging_project_bucket_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_logging_project_bucket_config" "{{$.PrimaryResourceId}}" { location = "global" - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" bucket_id = "_Default" } -resource "google_logging_metric" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["logging_metric_name"] %>" +resource "google_logging_metric" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "logging_metric_name"}}" filter = "resource.type=gae_app AND severity>=ERROR" - bucket_name = google_logging_project_bucket_config.<%= ctx[:primary_resource_id] %>.id + bucket_name = google_logging_project_bucket_config.{{$.PrimaryResourceId}}.id } diff --git a/mmv1/templates/terraform/examples/logging_organization_settings_all.tf.tmpl b/mmv1/templates/terraform/examples/logging_organization_settings_all.tf.tmpl index dd4b38bde6dd..fa2730168dee 100644 --- a/mmv1/templates/terraform/examples/logging_organization_settings_all.tf.tmpl +++ b/mmv1/templates/terraform/examples/logging_organization_settings_all.tf.tmpl @@ -1,17 +1,17 @@ -resource "google_logging_organization_settings" "<%= ctx[:primary_resource_id] %>" { +resource "google_logging_organization_settings" "{{$.PrimaryResourceId}}" { disable_default_sink = true - kms_key_name = "<%= ctx[:vars]['key_name'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" + kms_key_name = "{{index $.Vars "key_name"}}" + organization = "{{index $.TestEnvVars "org_id"}}" storage_location = "us-central1" depends_on = [ google_kms_crypto_key_iam_member.iam ] } data "google_logging_organization_settings" "settings" { - organization = "<%= ctx[:test_env_vars]['org_id'] %>" + organization = "{{index $.TestEnvVars "org_id"}}" } resource "google_kms_crypto_key_iam_member" "iam" { - crypto_key_id = "<%= ctx[:vars]['key_name'] %>" + crypto_key_id = "{{index $.Vars "key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:${data.google_logging_organization_settings.settings.kms_service_account_id}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/looker_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/looker_instance_basic.tf.tmpl index 8af74cd15bfa..5e7d34314cac 100644 --- a/mmv1/templates/terraform/examples/looker_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/looker_instance_basic.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_looker_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" platform_edition = "LOOKER_CORE_STANDARD_ANNUAL" region = "us-central1" oauth_config { - client_id = "<%= ctx[:vars]["client_id"] %>" - client_secret = "<%= ctx[:vars]["client_secret"] %>" + client_id = "{{index $.Vars "client_id"}}" + client_secret = "{{index $.Vars "client_secret"}}" } } diff --git a/mmv1/templates/terraform/examples/looker_instance_custom_domain.tf.tmpl b/mmv1/templates/terraform/examples/looker_instance_custom_domain.tf.tmpl index a615bf2cbf25..e86f5215539f 100644 --- a/mmv1/templates/terraform/examples/looker_instance_custom_domain.tf.tmpl +++ b/mmv1/templates/terraform/examples/looker_instance_custom_domain.tf.tmpl @@ -1,14 +1,14 @@ -resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_looker_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" platform_edition = "LOOKER_CORE_STANDARD_ANNUAL" region = "us-central1" oauth_config { - client_id = "<%= ctx[:vars]["client_id"] %>" - client_secret = "<%= ctx[:vars]["client_secret"] %>" + client_id = "{{index $.Vars "client_id"}}" + client_secret = "{{index $.Vars "client_secret"}}" } // After your Looker (Google Cloud core) instance has been created, you can set up, view information about, or delete a custom domain for your instance. // Therefore 2 terraform applies, one to create the instance, then another to set up the custom domain. custom_domain { - domain = "<%= ctx[:vars]["custom_domain"] %>.com" + domain = "{{index $.Vars "custom_domain"}}.com" } } diff --git a/mmv1/templates/terraform/examples/looker_instance_enterprise_full.tf.tmpl b/mmv1/templates/terraform/examples/looker_instance_enterprise_full.tf.tmpl index 54d74ad63d8e..b0069af15cee 100644 --- a/mmv1/templates/terraform/examples/looker_instance_enterprise_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/looker_instance_enterprise_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_looker_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" platform_edition = "LOOKER_CORE_ENTERPRISE_ANNUAL" region = "us-central1" private_ip_enabled = true @@ -10,7 +10,7 @@ resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { allowed_email_domains = ["google.com"] } encryption_config { - kms_key_name = "<%= ctx[:vars]["kms_key_name"] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } maintenance_window { day_of_week = "THURSDAY" @@ -40,8 +40,8 @@ resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { } } oauth_config { - client_id = "<%= ctx[:vars]["client_id"] %>" - client_secret = "<%= ctx[:vars]["client_secret"] %>" + client_id = "{{index $.Vars "client_id"}}" + client_secret = "{{index $.Vars "client_secret"}}" } depends_on = [ google_service_networking_connection.looker_vpc_connection @@ -55,7 +55,7 @@ resource "google_service_networking_connection" "looker_vpc_connection" { } resource "google_compute_global_address" "looker_range" { - name = "<%= ctx[:vars]["address_name"] %>" + name = "{{index $.Vars "address_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 20 @@ -65,11 +65,11 @@ resource "google_compute_global_address" "looker_range" { data "google_project" "project" {} resource "google_compute_network" "looker_network" { - name = "<%= ctx[:vars]["network_name"] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "<%= ctx[:vars]["kms_key_name"] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-looker.iam.gserviceaccount.com" } diff --git a/mmv1/templates/terraform/examples/looker_instance_enterprise_full_test.tf.tmpl b/mmv1/templates/terraform/examples/looker_instance_enterprise_full_test.tf.tmpl index dd697238cbce..b10bef84c797 100644 --- a/mmv1/templates/terraform/examples/looker_instance_enterprise_full_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/looker_instance_enterprise_full_test.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_looker_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" platform_edition = "LOOKER_CORE_ENTERPRISE_ANNUAL" region = "us-central1" private_ip_enabled = true @@ -10,7 +10,7 @@ resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { allowed_email_domains = ["google.com"] } encryption_config { - kms_key_name = "<%= ctx[:vars]["kms_key_name"] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } maintenance_window { day_of_week = "THURSDAY" @@ -40,25 +40,25 @@ resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { } } oauth_config { - client_id = "<%= ctx[:vars]["client_id"] %>" - client_secret = "<%= ctx[:vars]["client_secret"] %>" + client_id = "{{index $.Vars "client_id"}}" + client_secret = "{{index $.Vars "client_secret"}}" } depends_on = [google_kms_crypto_key_iam_member.crypto_key] } data "google_compute_global_address" "looker_range" { - name = "<%= ctx[:vars]["address_name"] %>" + name = "{{index $.Vars "address_name"}}" } data "google_project" "project" {} data "google_compute_network" "looker_network" { - name = "<%= ctx[:vars]["network_name"] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "<%= ctx[:vars]["kms_key_name"] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-looker.iam.gserviceaccount.com" } diff --git a/mmv1/templates/terraform/examples/looker_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/looker_instance_full.tf.tmpl index 09ee24e13a96..79e6c65721e5 100644 --- a/mmv1/templates/terraform/examples/looker_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/looker_instance_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_looker_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" platform_edition = "LOOKER_CORE_STANDARD_ANNUAL" region = "us-central1" public_ip_enabled = true @@ -34,7 +34,7 @@ resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" { } } oauth_config { - client_id = "<%= ctx[:vars]["client_id"] %>" - client_secret = "<%= ctx[:vars]["client_secret"] %>" + client_id = "{{index $.Vars "client_id"}}" + client_secret = "{{index $.Vars "client_secret"}}" } } diff --git a/mmv1/templates/terraform/examples/machine_image_basic.tf.tmpl b/mmv1/templates/terraform/examples/machine_image_basic.tf.tmpl index dbf17385bb90..d3e7e3790c29 100644 --- a/mmv1/templates/terraform/examples/machine_image_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/machine_image_basic.tf.tmpl @@ -1,6 +1,6 @@ resource "google_compute_instance" "vm" { provider = google-beta - name = "<%= ctx[:vars]['vm_name'] %>" + name = "{{index $.Vars "vm_name"}}" machine_type = "e2-medium" boot_disk { @@ -14,8 +14,8 @@ resource "google_compute_instance" "vm" { } } -resource "google_compute_machine_image" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_machine_image" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['image_name'] %>" + name = "{{index $.Vars "image_name"}}" source_instance = google_compute_instance.vm.self_link } diff --git a/mmv1/templates/terraform/examples/managed_ssl_certificate_basic.tf.tmpl b/mmv1/templates/terraform/examples/managed_ssl_certificate_basic.tf.tmpl index b367d3d6337a..9ed1db7e9f0c 100644 --- a/mmv1/templates/terraform/examples/managed_ssl_certificate_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/managed_ssl_certificate_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_managed_ssl_certificate" "default" { - name = "<%= ctx[:vars]['cert_name'] %>" + name = "{{index $.Vars "cert_name"}}" managed { domains = ["sslcert.tf-test.club."] @@ -7,13 +7,13 @@ resource "google_compute_managed_ssl_certificate" "default" { } resource "google_compute_target_https_proxy" "default" { - name = "<%= ctx[:vars]['proxy_name'] %>" + name = "{{index $.Vars "proxy_name"}}" url_map = google_compute_url_map.default.id ssl_certificates = [google_compute_managed_ssl_certificate.default.id] } resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -35,7 +35,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -44,14 +44,14 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } resource "google_compute_global_forwarding_rule" "default" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" target = google_compute_target_https_proxy.default.id port_range = 443 } diff --git a/mmv1/templates/terraform/examples/managedkafka_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/managedkafka_cluster_basic.tf.tmpl index 98ca01826485..7b85bb69ef83 100644 --- a/mmv1/templates/terraform/examples/managedkafka_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/managedkafka_cluster_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_managed_kafka_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['cluster_id'] %>" +resource "google_managed_kafka_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "cluster_id"}}" location = "us-central1" capacity_config { vcpu_count = 3 diff --git a/mmv1/templates/terraform/examples/managedkafka_cluster_cmek.tf.tmpl b/mmv1/templates/terraform/examples/managedkafka_cluster_cmek.tf.tmpl index 05d6d0829ba8..b8c8a8431bbf 100644 --- a/mmv1/templates/terraform/examples/managedkafka_cluster_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/managedkafka_cluster_cmek.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_managed_kafka_cluster" "<%= ctx[:primary_resource_id] %>" { - cluster_id = "<%= ctx[:vars]['cluster_id'] %>" +resource "google_managed_kafka_cluster" "{{$.PrimaryResourceId}}" { + cluster_id = "{{index $.Vars "cluster_id"}}" location = "us-central1" capacity_config { vcpu_count = 3 @@ -25,14 +25,14 @@ resource "google_project_service_identity" "kafka_service_identity" { } resource "google_kms_crypto_key" "key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id provider = google-beta } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['key_ring_name'] %>" + name = "{{index $.Vars "key_ring_name"}}" location = "us-central1" provider = google-beta diff --git a/mmv1/templates/terraform/examples/managedkafka_topic_basic.tf.tmpl b/mmv1/templates/terraform/examples/managedkafka_topic_basic.tf.tmpl index a0869e1e50c4..bf9c86760633 100644 --- a/mmv1/templates/terraform/examples/managedkafka_topic_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/managedkafka_topic_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_managed_kafka_cluster" "cluster" { - cluster_id = "<%= ctx[:vars]['cluster_id'] %>" + cluster_id = "{{index $.Vars "cluster_id"}}" location = "us-central1" capacity_config { vcpu_count = 3 @@ -16,8 +16,8 @@ resource "google_managed_kafka_cluster" "cluster" { provider = google-beta } -resource "google_managed_kafka_topic" "<%= ctx[:primary_resource_id] %>" { - topic_id = "<%= ctx[:vars]['topic_id'] %>" +resource "google_managed_kafka_topic" "{{$.PrimaryResourceId}}" { + topic_id = "{{index $.Vars "topic_id"}}" cluster = google_managed_kafka_cluster.cluster.cluster_id location = "us-central1" partition_count = 2 diff --git a/mmv1/templates/terraform/examples/memcache_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/memcache_instance_basic.tf.tmpl index 2744c21f85b4..932acaa30c92 100644 --- a/mmv1/templates/terraform/examples/memcache_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/memcache_instance_basic.tf.tmpl @@ -7,11 +7,11 @@ // config, add an additional network resource or change // this from "data"to "resource" resource "google_compute_network" "memcache_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "service_range" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 @@ -24,8 +24,8 @@ resource "google_service_networking_connection" "private_service_connection" { reserved_peering_ranges = [google_compute_global_address.service_range.name] } -resource "google_memcache_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_memcache_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" authorized_network = google_service_networking_connection.private_service_connection.network labels = { diff --git a/mmv1/templates/terraform/examples/memcache_instance_basic_test.tf.tmpl b/mmv1/templates/terraform/examples/memcache_instance_basic_test.tf.tmpl index fb4794bbabaa..c9f5c6b5f4b0 100644 --- a/mmv1/templates/terraform/examples/memcache_instance_basic_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/memcache_instance_basic_test.tf.tmpl @@ -7,11 +7,11 @@ // config, add an additional network resource or change // this from "data"to "resource" data "google_compute_network" "memcache_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } -resource "google_memcache_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_memcache_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" authorized_network = data.google_compute_network.memcache_network.id labels = { diff --git a/mmv1/templates/terraform/examples/memorystore_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/memorystore_instance_basic.tf.tmpl index 8d020bf4448a..c8db3451c720 100644 --- a/mmv1/templates/terraform/examples/memorystore_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/memorystore_instance_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_memorystore_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_memorystore_instance" "{{$.PrimaryResourceId}}" { provider = google-beta - instance_id = "<%= ctx[:vars]['instance_name'] %>" + instance_id = "{{index $.Vars "instance_name"}}" shard_count = 3 desired_psc_auto_connections { network = google_compute_network.producer_net.id @@ -13,13 +13,13 @@ resource "google_memorystore_instance" "<%= ctx[:primary_resource_id] %>" { ] lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } resource "google_network_connectivity_service_connection_policy" "default" { provider = google-beta - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" location = "us-central1" service_class = "gcp-memorystore" description = "my basic service connection policy" @@ -31,7 +31,7 @@ resource "google_network_connectivity_service_connection_policy" "default" { resource "google_compute_subnetwork" "producer_subnet" { provider = google-beta - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" ip_cidr_range = "10.0.0.248/29" region = "us-central1" network = google_compute_network.producer_net.id @@ -39,7 +39,7 @@ resource "google_compute_subnetwork" "producer_subnet" { resource "google_compute_network" "producer_net" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/memorystore_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/memorystore_instance_full.tf.tmpl index 59cbc24c408a..58128a095461 100644 --- a/mmv1/templates/terraform/examples/memorystore_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/memorystore_instance_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_memorystore_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_memorystore_instance" "{{$.PrimaryResourceId}}" { provider = google-beta - instance_id = "<%= ctx[:vars]['instance_name'] %>" + instance_id = "{{index $.Vars "instance_name"}}" shard_count = 3 desired_psc_auto_connections { network = google_compute_network.producer_net.id @@ -35,13 +35,13 @@ resource "google_memorystore_instance" "<%= ctx[:primary_resource_id] %>" { ] lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } resource "google_network_connectivity_service_connection_policy" "default" { provider = google-beta - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" location = "us-central1" service_class = "gcp-memorystore" description = "my basic service connection policy" @@ -53,7 +53,7 @@ resource "google_network_connectivity_service_connection_policy" "default" { resource "google_compute_subnetwork" "producer_subnet" { provider = google-beta - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" ip_cidr_range = "10.0.0.248/29" region = "us-central1" network = google_compute_network.producer_net.id @@ -61,7 +61,7 @@ resource "google_compute_subnetwork" "producer_subnet" { resource "google_compute_network" "producer_net" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/memorystore_instance_persistence_aof.tf.tmpl b/mmv1/templates/terraform/examples/memorystore_instance_persistence_aof.tf.tmpl index 6a1e9894c995..8bd11ec0f648 100644 --- a/mmv1/templates/terraform/examples/memorystore_instance_persistence_aof.tf.tmpl +++ b/mmv1/templates/terraform/examples/memorystore_instance_persistence_aof.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_memorystore_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_memorystore_instance" "{{$.PrimaryResourceId}}" { provider = google-beta - instance_id = "<%= ctx[:vars]['instance_name'] %>" + instance_id = "{{index $.Vars "instance_name"}}" shard_count = 3 desired_psc_auto_connections { network = google_compute_network.producer_net.id @@ -18,13 +18,13 @@ resource "google_memorystore_instance" "<%= ctx[:primary_resource_id] %>" { ] deletion_protection_enabled = false lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } resource "google_network_connectivity_service_connection_policy" "default" { provider = google-beta - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" location = "us-central1" service_class = "gcp-memorystore" description = "my basic service connection policy" @@ -36,7 +36,7 @@ resource "google_network_connectivity_service_connection_policy" "default" { resource "google_compute_subnetwork" "producer_subnet" { provider = google-beta - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" ip_cidr_range = "10.0.0.248/29" region = "us-central1" network = google_compute_network.producer_net.id @@ -44,7 +44,7 @@ resource "google_compute_subnetwork" "producer_subnet" { resource "google_compute_network" "producer_net" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/migration_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/migration_group_basic.tf.tmpl index 15610307269f..0be6b297b569 100644 --- a/mmv1/templates/terraform/examples/migration_group_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/migration_group_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_migration_center_group" "<%= ctx[:primary_resource_id] %>" { +resource "google_migration_center_group" "{{$.PrimaryResourceId}}" { location = "us-central1" - group_id = "<%= ctx[:vars]['group_name'] %>" + group_id = "{{index $.Vars "group_name"}}" description = "Terraform integration test description" display_name = "Terraform integration test display" labels = { diff --git a/mmv1/templates/terraform/examples/ml_model_basic.tf.tmpl b/mmv1/templates/terraform/examples/ml_model_basic.tf.tmpl index b99930e9f974..cd563d154a94 100644 --- a/mmv1/templates/terraform/examples/ml_model_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/ml_model_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_ml_engine_model" "<%= ctx[:primary_resource_id] -%>" { - name = "<%= ctx[:vars]['model_name'] -%>" +resource "google_ml_engine_model" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "model_name"}}" description = "My model" regions = ["us-central1"] } diff --git a/mmv1/templates/terraform/examples/ml_model_full.tf.tmpl b/mmv1/templates/terraform/examples/ml_model_full.tf.tmpl index 5bd76110e7e9..13ff69dc5754 100644 --- a/mmv1/templates/terraform/examples/ml_model_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/ml_model_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_ml_engine_model" "<%= ctx[:primary_resource_id] -%>" { - name = "<%= ctx[:vars]['model_name'] -%>" +resource "google_ml_engine_model" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "model_name"}}" description = "My model" regions = ["us-central1"] labels = { diff --git a/mmv1/templates/terraform/examples/monitoring_alert_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_alert_policy_basic.tf.tmpl index 0a3b2f487b40..3cc86dd89b11 100644 --- a/mmv1/templates/terraform/examples/monitoring_alert_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_alert_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_alert_policy" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["alert_policy_display_name"] %>" +resource "google_monitoring_alert_policy" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "alert_policy_display_name"}}" combiner = "OR" conditions { display_name = "test condition" diff --git a/mmv1/templates/terraform/examples/monitoring_alert_policy_evaluation_missing_data.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_alert_policy_evaluation_missing_data.tf.tmpl index b1cc53ac3133..c1f130774281 100644 --- a/mmv1/templates/terraform/examples/monitoring_alert_policy_evaluation_missing_data.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_alert_policy_evaluation_missing_data.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_alert_policy" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["alert_policy_display_name"] %>" +resource "google_monitoring_alert_policy" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "alert_policy_display_name"}}" combiner = "OR" conditions { display_name = "test condition" diff --git a/mmv1/templates/terraform/examples/monitoring_alert_policy_forecast_options.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_alert_policy_forecast_options.tf.tmpl index b624462640cb..32f87463f336 100644 --- a/mmv1/templates/terraform/examples/monitoring_alert_policy_forecast_options.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_alert_policy_forecast_options.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_alert_policy" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["alert_policy_display_name"] %>" +resource "google_monitoring_alert_policy" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "alert_policy_display_name"}}" combiner = "OR" conditions { display_name = "test condition" diff --git a/mmv1/templates/terraform/examples/monitoring_alert_policy_promql_condition.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_alert_policy_promql_condition.tf.tmpl index 4e20a3bbdf6e..78695c4f5be4 100644 --- a/mmv1/templates/terraform/examples/monitoring_alert_policy_promql_condition.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_alert_policy_promql_condition.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_alert_policy" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["alert_policy_display_name"] %>" +resource "google_monitoring_alert_policy" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "alert_policy_display_name"}}" combiner = "OR" conditions { display_name = "test condition" diff --git a/mmv1/templates/terraform/examples/monitoring_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_group_basic.tf.tmpl index 6ed600d79355..4e0170e7cdb1 100644 --- a/mmv1/templates/terraform/examples/monitoring_group_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_group_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_group" "<%= ctx[:primary_resource_id] %>" { - display_name = "tf-test <%= ctx[:vars]["display_name"] %>" +resource "google_monitoring_group" "{{$.PrimaryResourceId}}" { + display_name = "tf-test {{index $.Vars "display_name"}}" filter = "resource.metadata.region=\"europe-west2\"" } diff --git a/mmv1/templates/terraform/examples/monitoring_group_subgroup.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_group_subgroup.tf.tmpl index 058cfe924449..8a15d386d5c2 100644 --- a/mmv1/templates/terraform/examples/monitoring_group_subgroup.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_group_subgroup.tf.tmpl @@ -1,10 +1,10 @@ resource "google_monitoring_group" "parent" { - display_name = "tf-test <%= ctx[:vars]["display_name"] %>" + display_name = "tf-test {{index $.Vars "display_name"}}" filter = "resource.metadata.region=\"europe-west2\"" } -resource "google_monitoring_group" "<%= ctx[:primary_resource_id] %>" { - display_name = "tf-test <%= ctx[:vars]["display_name2"] %>" +resource "google_monitoring_group" "{{$.PrimaryResourceId}}" { + display_name = "tf-test {{index $.Vars "display_name2"}}" filter = "resource.metadata.region=\"europe-west2\"" parent_name = google_monitoring_group.parent.name } diff --git a/mmv1/templates/terraform/examples/monitoring_metric_descriptor_alert.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_metric_descriptor_alert.tf.tmpl index 8bb1d5355007..99076471e60f 100644 --- a/mmv1/templates/terraform/examples/monitoring_metric_descriptor_alert.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_metric_descriptor_alert.tf.tmpl @@ -1,19 +1,19 @@ -resource "google_monitoring_metric_descriptor" "<%= ctx[:primary_resource_id] %>" { +resource "google_monitoring_metric_descriptor" "{{$.PrimaryResourceId}}" { description = "Daily sales records from all branch stores." - display_name = "<%= ctx[:vars]["display_name"] %>" - type = "custom.googleapis.com/stores/<%= ctx[:vars]["type"] %>" + display_name = "{{index $.Vars "display_name"}}" + type = "custom.googleapis.com/stores/{{index $.Vars "type"}}" metric_kind = "GAUGE" value_type = "DOUBLE" unit = "{USD}" } resource "google_monitoring_alert_policy" "alert_policy" { - display_name = "<%= ctx[:vars]["display_name"] %>" + display_name = "{{index $.Vars "display_name"}}" combiner = "OR" conditions { display_name = "test condition" condition_threshold { - filter = "metric.type=\"${google_monitoring_metric_descriptor.<%= ctx[:primary_resource_id] %>.type}\" AND resource.type=\"gce_instance\"" + filter = "metric.type=\"${google_monitoring_metric_descriptor.{{$.PrimaryResourceId}}.type}\" AND resource.type=\"gce_instance\"" duration = "60s" comparison = "COMPARISON_GT" } diff --git a/mmv1/templates/terraform/examples/monitoring_metric_descriptor_basic.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_metric_descriptor_basic.tf.tmpl index 206c1df9535b..d21fb76c418e 100644 --- a/mmv1/templates/terraform/examples/monitoring_metric_descriptor_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_metric_descriptor_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_monitoring_metric_descriptor" "<%= ctx[:primary_resource_id] %>" { +resource "google_monitoring_metric_descriptor" "{{$.PrimaryResourceId}}" { description = "Daily sales records from all branch stores." - display_name = "<%= ctx[:vars]["display_name"] %>" - type = "custom.googleapis.com/stores/<%= ctx[:vars]["type"] %>" + display_name = "{{index $.Vars "display_name"}}" + type = "custom.googleapis.com/stores/{{index $.Vars "type"}}" metric_kind = "GAUGE" value_type = "DOUBLE" unit = "{USD}" diff --git a/mmv1/templates/terraform/examples/monitoring_monitored_project_basic.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_monitored_project_basic.tf.tmpl index 814a40f47a51..a043ba953711 100644 --- a/mmv1/templates/terraform/examples/monitoring_monitored_project_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_monitored_project_basic.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_monitoring_monitored_project" "<%= ctx[:primary_resource_id] %>" { - metrics_scope = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_monitoring_monitored_project" "{{$.PrimaryResourceId}}" { + metrics_scope = "{{index $.TestEnvVars "project_id"}}" name = google_project.basic.project_id } resource "google_project" "basic" { - project_id = "<%= ctx[:vars]['monitored_project'] %>" - name = "<%= ctx[:vars]['monitored_project'] %>-display" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "monitored_project"}}" + name = "{{index $.Vars "monitored_project"}}-display" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/monitoring_monitored_project_long_form.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_monitored_project_long_form.tf.tmpl index 086c9d5ac80e..c26cdc569f60 100644 --- a/mmv1/templates/terraform/examples/monitoring_monitored_project_long_form.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_monitored_project_long_form.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_monitoring_monitored_project" "<%= ctx[:primary_resource_id] %>" { - metrics_scope = "<%= ctx[:test_env_vars]['project_id'] %>" - name = "locations/global/metricsScopes/<%= ctx[:test_env_vars]['project_id'] %>/projects/${google_project.basic.project_id}" +resource "google_monitoring_monitored_project" "{{$.PrimaryResourceId}}" { + metrics_scope = "{{index $.TestEnvVars "project_id"}}" + name = "locations/global/metricsScopes/{{index $.TestEnvVars "project_id"}}/projects/${google_project.basic.project_id}" } resource "google_project" "basic" { - project_id = "<%= ctx[:vars]['monitored_project'] %>" - name = "<%= ctx[:vars]['monitored_project'] %>-display" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "monitored_project"}}" + name = "{{index $.Vars "monitored_project"}}-display" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/monitoring_service_custom.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_service_custom.tf.tmpl index 96d62d8e4c75..ccb6de98dfe8 100644 --- a/mmv1/templates/terraform/examples/monitoring_service_custom.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_service_custom.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_monitoring_custom_service" "<%= ctx[:primary_resource_id] -%>" { - service_id = "<%= ctx[:vars]['service_id'] -%>" - display_name = "My Custom Service <%= ctx[:vars]['service_id'] -%>" +resource "google_monitoring_custom_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "service_id"}}" + display_name = "My Custom Service {{index $.Vars "service_id"}}" telemetry { - resource_name = "<%= ctx[:vars]['resource_name'] -%>" + resource_name = "{{index $.Vars "resource_name"}}" } user_labels = { diff --git a/mmv1/templates/terraform/examples/monitoring_service_example.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_service_example.tf.tmpl index 2e84d2c0235e..7c8576e2415f 100644 --- a/mmv1/templates/terraform/examples/monitoring_service_example.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_service_example.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_monitoring_service" "<%= ctx[:primary_resource_id] -%>" { - service_id = "<%= ctx[:vars]['service_id'] -%>" - display_name = "My Service <%= ctx[:vars]['service_id'] -%>" +resource "google_monitoring_service" "{{$.PrimaryResourceId}}" { + service_id = "{{index $.Vars "service_id"}}" + display_name = "My Service {{index $.Vars "service_id"}}" user_labels = { my_key = "my_value" diff --git a/mmv1/templates/terraform/examples/monitoring_slo_appengine.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_slo_appengine.tf.tmpl index 7981fad59462..2d1d044aed22 100644 --- a/mmv1/templates/terraform/examples/monitoring_slo_appengine.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_slo_appengine.tf.tmpl @@ -2,10 +2,10 @@ data "google_monitoring_app_engine_service" "default" { module_id = "default" } -resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] -%>" { +resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { service = data.google_monitoring_app_engine_service.default.service_id - slo_id = "<%= ctx[:vars]['slo_id'] -%>" + slo_id = "{{index $.Vars "slo_id"}}" display_name = "Terraform Test SLO for App Engine" goal = 0.9 diff --git a/mmv1/templates/terraform/examples/monitoring_slo_request_based.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_slo_request_based.tf.tmpl index 19f5c726b444..982536a97636 100644 --- a/mmv1/templates/terraform/examples/monitoring_slo_request_based.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_slo_request_based.tf.tmpl @@ -1,11 +1,11 @@ resource "google_monitoring_custom_service" "customsrv" { - service_id = "<%= ctx[:vars]['service_id'] %>" + service_id = "{{index $.Vars "service_id"}}" display_name = "My Custom Service" } -resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" { +resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { service = google_monitoring_custom_service.customsrv.service_id - slo_id = "<%= ctx[:vars]['slo_id'] %>" + slo_id = "{{index $.Vars "slo_id"}}" display_name = "Terraform Test SLO with request based SLI (good total ratio)" goal = 0.9 diff --git a/mmv1/templates/terraform/examples/monitoring_slo_windows_based_good_bad_metric_filter.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_slo_windows_based_good_bad_metric_filter.tf.tmpl index f43f1adf18ab..aeda66fb1e8f 100644 --- a/mmv1/templates/terraform/examples/monitoring_slo_windows_based_good_bad_metric_filter.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_slo_windows_based_good_bad_metric_filter.tf.tmpl @@ -1,9 +1,9 @@ resource "google_monitoring_custom_service" "customsrv" { - service_id = "<%= ctx[:vars]['service_id'] %>" + service_id = "{{index $.Vars "service_id"}}" display_name = "My Custom Service" } -resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" { +resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { service = google_monitoring_custom_service.customsrv.service_id display_name = "Terraform Test SLO with window based SLI" diff --git a/mmv1/templates/terraform/examples/monitoring_slo_windows_based_metric_mean.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_slo_windows_based_metric_mean.tf.tmpl index f7a38919b97d..f9c9f26652ef 100644 --- a/mmv1/templates/terraform/examples/monitoring_slo_windows_based_metric_mean.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_slo_windows_based_metric_mean.tf.tmpl @@ -1,9 +1,9 @@ resource "google_monitoring_custom_service" "customsrv" { - service_id = "<%= ctx[:vars]['service_id'] %>" + service_id = "{{index $.Vars "service_id"}}" display_name = "My Custom Service" } -resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" { +resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { service = google_monitoring_custom_service.customsrv.service_id display_name = "Terraform Test SLO with window based SLI" diff --git a/mmv1/templates/terraform/examples/monitoring_slo_windows_based_metric_sum.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_slo_windows_based_metric_sum.tf.tmpl index aee54b150f02..df1e35b6842d 100644 --- a/mmv1/templates/terraform/examples/monitoring_slo_windows_based_metric_sum.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_slo_windows_based_metric_sum.tf.tmpl @@ -1,9 +1,9 @@ resource "google_monitoring_custom_service" "customsrv" { - service_id = "<%= ctx[:vars]['service_id'] %>" + service_id = "{{index $.Vars "service_id"}}" display_name = "My Custom Service" } -resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" { +resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { service = google_monitoring_custom_service.customsrv.service_id display_name = "Terraform Test SLO with window based SLI" diff --git a/mmv1/templates/terraform/examples/monitoring_slo_windows_based_ratio_threshold.tf.tmpl b/mmv1/templates/terraform/examples/monitoring_slo_windows_based_ratio_threshold.tf.tmpl index 0bacbe7e9c18..cf9619a4d88c 100644 --- a/mmv1/templates/terraform/examples/monitoring_slo_windows_based_ratio_threshold.tf.tmpl +++ b/mmv1/templates/terraform/examples/monitoring_slo_windows_based_ratio_threshold.tf.tmpl @@ -1,9 +1,9 @@ resource "google_monitoring_custom_service" "customsrv" { - service_id = "<%= ctx[:vars]['service_id'] %>" + service_id = "{{index $.Vars "service_id"}}" display_name = "My Custom Service" } -resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" { +resource "google_monitoring_slo" "{{$.PrimaryResourceId}}" { service = google_monitoring_custom_service.customsrv.service_id display_name = "Terraform Test SLO with window based SLI" diff --git a/mmv1/templates/terraform/examples/netapp_active_directory_full.tf.tmpl b/mmv1/templates/terraform/examples/netapp_active_directory_full.tf.tmpl index 7c60647b53a9..0337e2f9e0c7 100644 --- a/mmv1/templates/terraform/examples/netapp_active_directory_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/netapp_active_directory_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_netapp_active_directory" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['active_directory_full_name'] %>" +resource "google_netapp_active_directory" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "active_directory_full_name"}}" location = "us-central1" domain = "ad.internal" dns = "172.30.64.3" diff --git a/mmv1/templates/terraform/examples/netapp_backup.tf.tmpl b/mmv1/templates/terraform/examples/netapp_backup.tf.tmpl index e772b10d703e..bb066449286e 100644 --- a/mmv1/templates/terraform/examples/netapp_backup.tf.tmpl +++ b/mmv1/templates/terraform/examples/netapp_backup.tf.tmpl @@ -1,9 +1,9 @@ data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_netapp_storage_pool" "default" { - name = "<%= ctx[:vars]['pool_name'] %>" + name = "{{index $.Vars "pool_name"}}" location = "us-central1" service_level = "PREMIUM" capacity_gib = "2048" @@ -11,10 +11,10 @@ resource "google_netapp_storage_pool" "default" { } resource "google_netapp_volume" "default" { - name = "<%= ctx[:vars]['volume_name'] %>" + name = "{{index $.Vars "volume_name"}}" location = google_netapp_storage_pool.default.location capacity_gib = "100" - share_name = "<%= ctx[:vars]['volume_name'] %>" + share_name = "{{index $.Vars "volume_name"}}" storage_pool = google_netapp_storage_pool.default.name protocols = ["NFSV3"] deletion_policy = "FORCE" @@ -24,12 +24,12 @@ resource "google_netapp_volume" "default" { } resource "google_netapp_backup_vault" "default" { - name = "<%= ctx[:vars]['backup_vault_name'] %>" + name = "{{index $.Vars "backup_vault_name"}}" location = google_netapp_storage_pool.default.location } -resource "google_netapp_backup" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backup_name'] %>" +resource "google_netapp_backup" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backup_name"}}" location = google_netapp_backup_vault.default.location vault_name = google_netapp_backup_vault.default.name source_volume = google_netapp_volume.default.id diff --git a/mmv1/templates/terraform/examples/netapp_backup_policy_full.tf.tmpl b/mmv1/templates/terraform/examples/netapp_backup_policy_full.tf.tmpl index 15eff6ed2ae7..70f778fcf97c 100644 --- a/mmv1/templates/terraform/examples/netapp_backup_policy_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/netapp_backup_policy_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_netapp_backup_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backup_policy_full_name'] %>" +resource "google_netapp_backup_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backup_policy_full_name"}}" location = "us-central1" daily_backup_limit = 2 weekly_backup_limit = 1 diff --git a/mmv1/templates/terraform/examples/netapp_backup_vault.tf.tmpl b/mmv1/templates/terraform/examples/netapp_backup_vault.tf.tmpl index 0298cdc9b61b..5a6bbc9d3de9 100644 --- a/mmv1/templates/terraform/examples/netapp_backup_vault.tf.tmpl +++ b/mmv1/templates/terraform/examples/netapp_backup_vault.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_netapp_backup_vault" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['backup_vault_name'] %>" +resource "google_netapp_backup_vault" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "backup_vault_name"}}" location = "us-central1" description = "Terraform created vault" labels = { diff --git a/mmv1/templates/terraform/examples/netapp_volume_basic.tf.tmpl b/mmv1/templates/terraform/examples/netapp_volume_basic.tf.tmpl index 54702e41c441..fc71c1e25467 100644 --- a/mmv1/templates/terraform/examples/netapp_volume_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/netapp_volume_basic.tf.tmpl @@ -1,21 +1,21 @@ resource "google_netapp_storage_pool" "default" { - name = "<%= ctx[:vars]['pool_name'] %>" + 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" "<%= ctx[:primary_resource_id] %>" { +resource "google_netapp_volume" "{{$.PrimaryResourceId}}" { location = "us-west2" - name = "<%= ctx[:vars]['volume_name'] %>" + name = "{{index $.Vars "volume_name"}}" capacity_gib = "100" - share_name = "<%= ctx[:vars]['volume_name'] %>" + share_name = "{{index $.Vars "volume_name"}}" storage_pool = google_netapp_storage_pool.default.name protocols = ["NFSV3"] deletion_policy = "DEFAULT" } data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/netapp_volume_replication_create.tf.tmpl b/mmv1/templates/terraform/examples/netapp_volume_replication_create.tf.tmpl index 07b69c542b2b..a4a9e2cddedb 100644 --- a/mmv1/templates/terraform/examples/netapp_volume_replication_create.tf.tmpl +++ b/mmv1/templates/terraform/examples/netapp_volume_replication_create.tf.tmpl @@ -1,10 +1,10 @@ data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_netapp_storage_pool" "source_pool" { - name = "<%= ctx[:vars]['source_pool_name'] %>" + name = "{{index $.Vars "source_pool_name"}}" location = "us-central1" service_level = "PREMIUM" capacity_gib = 2048 @@ -12,7 +12,7 @@ resource "google_netapp_storage_pool" "source_pool" { } resource "google_netapp_storage_pool" "destination_pool" { - name = "<%= ctx[:vars]['destination_pool_name'] %>" + name = "{{index $.Vars "destination_pool_name"}}" location = "us-west2" service_level = "PREMIUM" capacity_gib = 2048 @@ -21,9 +21,9 @@ resource "google_netapp_storage_pool" "destination_pool" { resource "google_netapp_volume" "source_volume" { location = google_netapp_storage_pool.source_pool.location - name = "<%= ctx[:vars]['volume_name'] %>" + name = "{{index $.Vars "volume_name"}}" capacity_gib = 100 - share_name = "<%= ctx[:vars]['volume_name'] %>" + share_name = "{{index $.Vars "volume_name"}}" storage_pool = google_netapp_storage_pool.source_pool.name protocols = [ "NFSV3" @@ -31,19 +31,19 @@ resource "google_netapp_volume" "source_volume" { deletion_policy = "FORCE" } -resource "google_netapp_volume_replication" "<%= ctx[:primary_resource_id] %>" { +resource "google_netapp_volume_replication" "{{$.PrimaryResourceId}}" { depends_on = [google_netapp_volume.source_volume] location = google_netapp_volume.source_volume.location volume_name = google_netapp_volume.source_volume.name - name = "<%= ctx[:vars]['replication_name'] %>" + name = "{{index $.Vars "replication_name"}}" replication_schedule = "EVERY_10_MINUTES" description = "This is a replication resource" destination_volume_parameters { storage_pool = google_netapp_storage_pool.destination_pool.id - volume_id = "<%= ctx[:vars]['destination_volume'] %>" + volume_id = "{{index $.Vars "destination_volume"}}" # Keeping the share_name of source and destination the same # simplifies implementing client failover concepts - share_name = "<%= ctx[:vars]['volume_name'] %>" + share_name = "{{index $.Vars "volume_name"}}" description = "This is a replicated volume" } # WARNING: Setting delete_destination_volume to true, will delete the diff --git a/mmv1/templates/terraform/examples/network_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_attachment_basic.tf.tmpl index fadfe335ec09..ec9f23221b61 100644 --- a/mmv1/templates/terraform/examples/network_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_attachment_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_network_attachment" "default" { - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" region = "us-central1" description = "basic network attachment description" connection_preference = "ACCEPT_MANUAL" @@ -18,12 +18,12 @@ resource "google_compute_network_attachment" "default" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" region = "us-central1" network = google_compute_network.default.id @@ -31,17 +31,17 @@ resource "google_compute_subnetwork" "default" { } resource "google_project" "rejected_producer_project" { - project_id = "<%= ctx[:vars]['rejected_producer_project_name'] %>" - name = "<%= ctx[:vars]['rejected_producer_project_name'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "rejected_producer_project_name"}}" + name = "{{index $.Vars "rejected_producer_project_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } resource "google_project" "accepted_producer_project" { - project_id = "<%= ctx[:vars]['accepted_producer_project_name'] %>" - name = "<%= ctx[:vars]['accepted_producer_project_name'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + project_id = "{{index $.Vars "accepted_producer_project_name"}}" + name = "{{index $.Vars "accepted_producer_project_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/network_attachment_instance_usage.tf.tmpl b/mmv1/templates/terraform/examples/network_attachment_instance_usage.tf.tmpl index 6e5963d781c8..6a44bee01a67 100644 --- a/mmv1/templates/terraform/examples/network_attachment_instance_usage.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_attachment_instance_usage.tf.tmpl @@ -1,21 +1,21 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" region = "us-central1" network = google_compute_network.default.id ip_cidr_range = "10.0.0.0/16" } -resource "google_compute_network_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_network_attachment" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" region = "us-central1" description = "my basic network attachment" @@ -25,7 +25,7 @@ resource "google_compute_network_attachment" "<%= ctx[:primary_resource_id] %>" resource "google_compute_instance" "default" { provider = google-beta - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" zone = "us-central1-a" machine_type = "e2-micro" diff --git a/mmv1/templates/terraform/examples/network_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_basic.tf.tmpl index 34ee573ada32..5a8d71402914 100644 --- a/mmv1/templates/terraform/examples/network_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_basic.tf.tmpl @@ -1,3 +1,3 @@ -resource "google_compute_network" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['network_name'] %>" +resource "google_compute_network" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/network_connectivity_hub_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_hub_basic.tf.tmpl index bc884446e2c6..1bfba77d608a 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_hub_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_hub_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_connectivity_hub" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_connectivity_hub" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" description = "A sample hub" labels = { label-one = "value-one" diff --git a/mmv1/templates/terraform/examples/network_connectivity_hub_with_export_psc.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_hub_with_export_psc.tf.tmpl index 8269262bbf44..a07d2d0078bf 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_hub_with_export_psc.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_hub_with_export_psc.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_connectivity_hub" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_connectivity_hub" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" description = "A sample hub with Private Service Connect transitivity is enabled" export_psc = true } diff --git a/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_automatic_reservation.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_automatic_reservation.tf.tmpl index 70bd88c74663..d32adf23a7f4 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_automatic_reservation.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_automatic_reservation.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_connectivity_internal_range" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['internal_range_name'] %>" +resource "google_network_connectivity_internal_range" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "internal_range_name"}}" network = google_compute_network.default.id usage = "FOR_VPC" peering = "FOR_SELF" @@ -10,6 +10,6 @@ resource "google_network_connectivity_internal_range" "<%= ctx[:primary_resource } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_basic.tf.tmpl index 0bcea7f132af..9f89f49d6bcb 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_connectivity_internal_range" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['internal_range_name'] %>" +resource "google_network_connectivity_internal_range" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "internal_range_name"}}" description = "Test internal range" network = google_compute_network.default.self_link usage = "FOR_VPC" @@ -12,6 +12,6 @@ resource "google_network_connectivity_internal_range" "<%= ctx[:primary_resource } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_external_ranges.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_external_ranges.tf.tmpl index 15cf1f6488f3..9c7e4b8bd9df 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_external_ranges.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_external_ranges.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_connectivity_internal_range" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['internal_range_name'] %>" +resource "google_network_connectivity_internal_range" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "internal_range_name"}}" network = google_compute_network.default.id usage = "EXTERNAL_TO_VPC" peering = "FOR_SELF" @@ -11,6 +11,6 @@ resource "google_network_connectivity_internal_range" "<%= ctx[:primary_resource } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_reserve_with_overlap.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_reserve_with_overlap.tf.tmpl index 633ba180dd0d..e6d487d51a41 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_reserve_with_overlap.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_internal_ranges_reserve_with_overlap.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_connectivity_internal_range" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['internal_range_name'] %>" +resource "google_network_connectivity_internal_range" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "internal_range_name"}}" description = "Test internal range" network = google_compute_network.default.id usage = "FOR_VPC" @@ -16,7 +16,7 @@ resource "google_network_connectivity_internal_range" "<%= ctx[:primary_resource } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/network_connectivity_policy_based_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_policy_based_route_basic.tf.tmpl index 59e6a798d9b1..8e2bd940b957 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_policy_based_route_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_policy_based_route_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_connectivity_policy_based_route" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['pbr_name'] %>" +resource "google_network_connectivity_policy_based_route" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "pbr_name"}}" network = google_compute_network.my_network.id filter { protocol_version = "IPV4" @@ -8,6 +8,6 @@ resource "google_network_connectivity_policy_based_route" "<%= ctx[:primary_reso } resource "google_compute_network" "my_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/network_connectivity_policy_based_route_full.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_policy_based_route_full.tf.tmpl index 6d3ae8d3f211..b1b726f50692 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_policy_based_route_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_policy_based_route_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_connectivity_policy_based_route" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['pbr_name'] %>" +resource "google_network_connectivity_policy_based_route" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "pbr_name"}}" description = "My routing policy" network = google_compute_network.my_network.id priority = 2302 @@ -22,7 +22,7 @@ resource "google_network_connectivity_policy_based_route" "<%= ctx[:primary_reso } resource "google_compute_network" "my_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } @@ -30,5 +30,5 @@ resource "google_compute_network" "my_network" { # load balancer for brevity. Consult https://cloud.google.com/load-balancing/docs/internal # to set one up. resource "google_compute_global_address" "ilb" { - name = "<%= ctx[:vars]['ilb_name'] %>" + name = "{{index $.Vars "ilb_name"}}" } diff --git a/mmv1/templates/terraform/examples/network_connectivity_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_policy_basic.tf.tmpl index a51633e9170f..a85c0e245885 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_policy_basic.tf.tmpl @@ -1,19 +1,19 @@ resource "google_compute_network" "producer_net" { - name = "<%= ctx[:vars]['producer_network_name'] %>" + name = "{{index $.Vars "producer_network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "producer_subnet" { - name = "<%= ctx[:vars]['producer_subnetwork_name'] %>" + name = "{{index $.Vars "producer_subnetwork_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.producer_net.id } resource "google_network_connectivity_service_connection_policy" "default" { - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" location = "us-central1" - service_class = "<%= ctx[:vars]['service_class_name'] %>" + service_class = "{{index $.Vars "service_class_name"}}" description = "my basic service connection policy" network = google_compute_network.producer_net.id psc_config { diff --git a/mmv1/templates/terraform/examples/network_connectivity_regional_endpoint_global_access.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_regional_endpoint_global_access.tf.tmpl index 9b8232af8e08..0e9d1a71b7e9 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_regional_endpoint_global_access.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_regional_endpoint_global_access.tf.tmpl @@ -1,17 +1,17 @@ resource "google_compute_network" "my_network" { - name = "<%= ctx[:vars]['rep_network'] %>" + name = "{{index $.Vars "rep_network"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "my_subnetwork" { - name = "<%= ctx[:vars]['rep_subnetwork'] %>" + name = "{{index $.Vars "rep_subnetwork"}}" ip_cidr_range = "192.168.0.0/24" region = "us-central1" network = google_compute_network.my_network.id } -resource "google_network_connectivity_regional_endpoint" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['rep_name'] %>" +resource "google_network_connectivity_regional_endpoint" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "rep_name"}}" location = "us-central1" target_google_api = "storage.us-central1.p.rep.googleapis.com" access_type = "GLOBAL" diff --git a/mmv1/templates/terraform/examples/network_connectivity_regional_endpoint_regional_access.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_regional_endpoint_regional_access.tf.tmpl index 2cffa18f0734..a39621ba2ccb 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_regional_endpoint_regional_access.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_regional_endpoint_regional_access.tf.tmpl @@ -1,17 +1,17 @@ resource "google_compute_network" "my_network" { - name = "<%= ctx[:vars]['rep_network'] %>" + name = "{{index $.Vars "rep_network"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "my_subnetwork" { - name = "<%= ctx[:vars]['rep_subnetwork'] %>" + name = "{{index $.Vars "rep_subnetwork"}}" ip_cidr_range = "192.168.0.0/24" region = "us-central1" network = google_compute_network.my_network.id } -resource "google_network_connectivity_regional_endpoint" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['rep_name'] %>" +resource "google_network_connectivity_regional_endpoint" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "rep_name"}}" location = "us-central1" target_google_api = "storage.us-central1.p.rep.googleapis.com" access_type = "REGIONAL" diff --git a/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_basic.tf.tmpl index 7b95e795ad74..c53105428404 100644 --- a/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_basic.tf.tmpl @@ -1,18 +1,18 @@ resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_network_connectivity_hub" "basic_hub" { - name = "<%= ctx[:vars]['hub_name'] %>" + name = "{{index $.Vars "hub_name"}}" description = "A sample hub" labels = { label-two = "value-one" } } -resource "google_network_connectivity_spoke" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['spoke_name'] %>" +resource "google_network_connectivity_spoke" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "spoke_name"}}" location = "global" description = "A sample spoke with a linked router appliance instance" labels = { diff --git a/mmv1/templates/terraform/examples/network_custom_firewall_enforcement_order.tf.tmpl b/mmv1/templates/terraform/examples/network_custom_firewall_enforcement_order.tf.tmpl index f6525d486d24..d621d2a084bf 100644 --- a/mmv1/templates/terraform/examples/network_custom_firewall_enforcement_order.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_custom_firewall_enforcement_order.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_network" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]["project"] %>" - name = "<%= ctx[:vars]['network_name'] %>" +resource "google_compute_network" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = true network_firewall_policy_enforcement_order = "BEFORE_CLASSIC_FIREWALL" } diff --git a/mmv1/templates/terraform/examples/network_custom_mtu.tf.tmpl b/mmv1/templates/terraform/examples/network_custom_mtu.tf.tmpl index ffcf20bd6e33..0a075376d536 100644 --- a/mmv1/templates/terraform/examples/network_custom_mtu.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_custom_mtu.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_network" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]["project"] %>" - name = "<%= ctx[:vars]['network_name'] %>" +resource "google_compute_network" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = true mtu = 1460 } diff --git a/mmv1/templates/terraform/examples/network_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/network_endpoint.tf.tmpl index dd987962a1a0..22b8ad297b0f 100644 --- a/mmv1/templates/terraform/examples/network_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_endpoint.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_network_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_network_endpoint" "{{$.PrimaryResourceId}}" { network_endpoint_group = google_compute_network_endpoint_group.neg.name instance = google_compute_instance.endpoint-instance.name @@ -12,7 +12,7 @@ data "google_compute_image" "my_image" { } resource "google_compute_instance" "endpoint-instance" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" boot_disk { @@ -29,7 +29,7 @@ resource "google_compute_instance" "endpoint-instance" { } resource "google_compute_network_endpoint_group" "group" { - name = "<%= ctx[:vars]['neg_name'] %>" + name = "{{index $.Vars "neg_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id default_port = "90" @@ -37,12 +37,12 @@ resource "google_compute_network_endpoint_group" "group" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.1/16" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/network_endpoint_group.tf.tmpl b/mmv1/templates/terraform/examples/network_endpoint_group.tf.tmpl index 2001acc3c070..d25108a75310 100644 --- a/mmv1/templates/terraform/examples/network_endpoint_group.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_endpoint_group.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id default_port = "90" @@ -7,12 +7,12 @@ resource "google_compute_network_endpoint_group" "<%= ctx[:primary_resource_id] } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/network_endpoint_group_non_gcp.tf.tmpl b/mmv1/templates/terraform/examples/network_endpoint_group_non_gcp.tf.tmpl index e731f3b038d6..b20bcb391aa6 100644 --- a/mmv1/templates/terraform/examples/network_endpoint_group_non_gcp.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_endpoint_group_non_gcp.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" network = google_compute_network.default.id default_port = "90" zone = "us-central1-a" @@ -7,11 +7,11 @@ resource "google_compute_network_endpoint_group" "<%= ctx[:primary_resource_id] } resource "google_compute_network_endpoint" "default-endpoint" { - network_endpoint_group = google_compute_network_endpoint_group.<%= ctx[:primary_resource_id] %>.name - port = google_compute_network_endpoint_group.<%= ctx[:primary_resource_id] %>.default_port + network_endpoint_group = google_compute_network_endpoint_group.{{$.PrimaryResourceId}}.name + port = google_compute_network_endpoint_group.{{$.PrimaryResourceId}}.default_port ip_address = "127.0.0.1" } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/network_endpoints.tf.tmpl b/mmv1/templates/terraform/examples/network_endpoints.tf.tmpl index 212f61037b53..78b44128faaf 100644 --- a/mmv1/templates/terraform/examples/network_endpoints.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_endpoints.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_network_endpoints" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_network_endpoints" "{{$.PrimaryResourceId}}" { network_endpoint_group = google_compute_network_endpoint_group.neg.name network_endpoints { @@ -19,7 +19,7 @@ data "google_compute_image" "my_image" { } resource "google_compute_instance" "endpoint-instance1" { - name = "<%= ctx[:vars]['instance_name'] %>1" + name = "{{index $.Vars "instance_name"}}1" machine_type = "e2-medium" boot_disk { @@ -36,7 +36,7 @@ resource "google_compute_instance" "endpoint-instance1" { } resource "google_compute_instance" "endpoint-instance2" { - name = "<%= ctx[:vars]['instance_name'] %>2" + name = "{{index $.Vars "instance_name"}}2" machine_type = "e2-medium" boot_disk { @@ -53,7 +53,7 @@ resource "google_compute_instance" "endpoint-instance2" { } resource "google_compute_network_endpoint_group" "group" { - name = "<%= ctx[:vars]['neg_name'] %>" + name = "{{index $.Vars "neg_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id default_port = "90" @@ -61,12 +61,12 @@ resource "google_compute_network_endpoint_group" "group" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.1/16" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/network_firewall_policy_full.tf.tmpl b/mmv1/templates/terraform/examples/network_firewall_policy_full.tf.tmpl index 70c119d428e4..cef4b0f1d805 100644 --- a/mmv1/templates/terraform/examples/network_firewall_policy_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_firewall_policy_full.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_network_firewall_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['policy_name'] %>" +resource "google_compute_network_firewall_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "policy_name"}}" description = "Terraform test" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/network_management_connectivity_test_addresses.tf.tmpl b/mmv1/templates/terraform/examples/network_management_connectivity_test_addresses.tf.tmpl index f67260dd4f94..aa9a5ce8ef3c 100644 --- a/mmv1/templates/terraform/examples/network_management_connectivity_test_addresses.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_management_connectivity_test_addresses.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_management_connectivity_test" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['primary_resource_name'] %>" +resource "google_network_management_connectivity_test" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "primary_resource_name"}}" source { ip_address = google_compute_address.source-addr.address project_id = google_compute_address.source-addr.project @@ -17,18 +17,18 @@ resource "google_network_management_connectivity_test" "<%= ctx[:primary_resourc } resource "google_compute_network" "vpc" { - name = "<%= ctx[:vars]['network'] %>" + name = "{{index $.Vars "network"}}" } resource "google_compute_subnetwork" "subnet" { - name = "<%= ctx[:vars]['network'] %>-subnet" + name = "{{index $.Vars "network"}}-subnet" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.vpc.id } resource "google_compute_address" "source-addr" { - name = "<%= ctx[:vars]['source_addr'] %>" + name = "{{index $.Vars "source_addr"}}" subnetwork = google_compute_subnetwork.subnet.id address_type = "INTERNAL" address = "10.0.42.42" @@ -36,7 +36,7 @@ resource "google_compute_address" "source-addr" { } resource "google_compute_address" "dest-addr" { - name = "<%= ctx[:vars]['dest_addr'] %>" + name = "{{index $.Vars "dest_addr"}}" subnetwork = google_compute_subnetwork.subnet.id address_type = "INTERNAL" address = "10.0.43.43" diff --git a/mmv1/templates/terraform/examples/network_management_connectivity_test_instances.tf.tmpl b/mmv1/templates/terraform/examples/network_management_connectivity_test_instances.tf.tmpl index e3a712045aac..1ab2b32cea92 100644 --- a/mmv1/templates/terraform/examples/network_management_connectivity_test_instances.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_management_connectivity_test_instances.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_management_connectivity_test" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['primary_resource_name'] %>" +resource "google_network_management_connectivity_test" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "primary_resource_name"}}" source { instance = google_compute_instance.source.id } @@ -15,7 +15,7 @@ resource "google_network_management_connectivity_test" "<%= ctx[:primary_resourc } resource "google_compute_instance" "source" { - name = "<%= ctx[:vars]['source_instance'] %>" + name = "{{index $.Vars "source_instance"}}" machine_type = "e2-medium" boot_disk { @@ -32,7 +32,7 @@ resource "google_compute_instance" "source" { } resource "google_compute_instance" "destination" { - name = "<%= ctx[:vars]['dest_instance'] %>" + name = "{{index $.Vars "dest_instance"}}" machine_type = "e2-medium" boot_disk { @@ -49,7 +49,7 @@ resource "google_compute_instance" "destination" { } resource "google_compute_network" "vpc" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } data "google_compute_image" "debian_9" { diff --git a/mmv1/templates/terraform/examples/network_peering_routes_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_peering_routes_config_basic.tf.tmpl index 92fecd467a8c..4c67d3daa988 100644 --- a/mmv1/templates/terraform/examples/network_peering_routes_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_peering_routes_config_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_network_peering_routes_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_network_peering_routes_config" "{{$.PrimaryResourceId}}" { peering = google_compute_network_peering.peering_primary.name network = google_compute_network.network_primary.name @@ -7,7 +7,7 @@ resource "google_compute_network_peering_routes_config" "<%= ctx[:primary_resour } resource "google_compute_network_peering" "peering_primary" { - name = "<%= ctx[:vars]['peering_primary_name'] %>" + name = "{{index $.Vars "peering_primary_name"}}" network = google_compute_network.network_primary.id peer_network = google_compute_network.network_secondary.id @@ -16,17 +16,17 @@ resource "google_compute_network_peering" "peering_primary" { } resource "google_compute_network_peering" "peering_secondary" { - name = "<%= ctx[:vars]['peering_secondary_name'] %>" + name = "{{index $.Vars "peering_secondary_name"}}" network = google_compute_network.network_secondary.id peer_network = google_compute_network.network_primary.id } resource "google_compute_network" "network_primary" { - name = "<%= ctx[:vars]['network_primary_name'] %>" + name = "{{index $.Vars "network_primary_name"}}" auto_create_subnetworks = "false" } resource "google_compute_network" "network_secondary" { - name = "<%= ctx[:vars]['network_secondary_name'] %>" + name = "{{index $.Vars "network_secondary_name"}}" auto_create_subnetworks = "false" } diff --git a/mmv1/templates/terraform/examples/network_peering_routes_config_gke.tf.tmpl b/mmv1/templates/terraform/examples/network_peering_routes_config_gke.tf.tmpl index a75f44cafcb9..669f83afb3f7 100644 --- a/mmv1/templates/terraform/examples/network_peering_routes_config_gke.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_peering_routes_config_gke.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_network_peering_routes_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_network_peering_routes_config" "{{$.PrimaryResourceId}}" { peering = google_container_cluster.private_cluster.private_cluster_config[0].peering_name network = google_compute_network.container_network.name @@ -7,12 +7,12 @@ resource "google_compute_network_peering_routes_config" "<%= ctx[:primary_resour } resource "google_compute_network" "container_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "container_subnetwork" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" region = "us-central1" network = google_compute_network.container_network.name ip_cidr_range = "10.0.36.0/24" @@ -30,7 +30,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "private_cluster" { - name = "<%= ctx[:vars]['gke_cluster_name'] %>" + name = "{{index $.Vars "gke_cluster_name"}}" location = "us-central1-a" initial_node_count = 1 @@ -49,5 +49,5 @@ resource "google_container_cluster" "private_cluster" { cluster_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[0].range_name services_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[1].range_name } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/network_security_address_groups_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_security_address_groups_advanced.tf.tmpl index 4c69e316cea4..ddd8b75c490a 100644 --- a/mmv1/templates/terraform/examples/network_security_address_groups_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_address_groups_advanced.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_security_address_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_network_security_address_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" + parent = "projects/{{index $.TestEnvVars "project"}}" location = "us-central1" description = "my description" type = "IPV4" diff --git a/mmv1/templates/terraform/examples/network_security_address_groups_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_address_groups_basic.tf.tmpl index 00b78c6c92a0..db94e9e8c7ce 100644 --- a/mmv1/templates/terraform/examples/network_security_address_groups_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_address_groups_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_security_address_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_network_security_address_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" + parent = "projects/{{index $.TestEnvVars "project"}}" location = "us-central1" type = "IPV4" capacity = "100" diff --git a/mmv1/templates/terraform/examples/network_security_address_groups_cloud_armor.tf.tmpl b/mmv1/templates/terraform/examples/network_security_address_groups_cloud_armor.tf.tmpl index 123dd50e92b6..f33650525d12 100644 --- a/mmv1/templates/terraform/examples/network_security_address_groups_cloud_armor.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_address_groups_cloud_armor.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_network_security_address_group" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_security_address_group" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + name = "{{index $.Vars "resource_name"}}" + parent = "projects/{{index $.TestEnvVars "project"}}" location = "global" type = "IPV4" capacity = "100" diff --git a/mmv1/templates/terraform/examples/network_security_address_groups_organization_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_address_groups_organization_basic.tf.tmpl index fa85ab60d26c..7e8f37d38654 100644 --- a/mmv1/templates/terraform/examples/network_security_address_groups_organization_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_address_groups_organization_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_security_address_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_network_security_address_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "us-central1" type = "IPV4" capacity = "100" diff --git a/mmv1/templates/terraform/examples/network_security_authorization_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_authorization_policy_basic.tf.tmpl index 46ecfe4a20b7..e7214da8b41b 100644 --- a/mmv1/templates/terraform/examples/network_security_authorization_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_authorization_policy_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_security_authorization_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_security_authorization_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_security_authorization_policy_destinations.tf.tmpl b/mmv1/templates/terraform/examples/network_security_authorization_policy_destinations.tf.tmpl index 15e40b46c40c..4d517cc9598b 100644 --- a/mmv1/templates/terraform/examples/network_security_authorization_policy_destinations.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_authorization_policy_destinations.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_security_authorization_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_security_authorization_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_security_client_tls_policy_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_security_client_tls_policy_advanced.tf.tmpl index 860d951f4cda..3a9f7f396aad 100644 --- a/mmv1/templates/terraform/examples/network_security_client_tls_policy_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_client_tls_policy_advanced.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_security_client_tls_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_client_tls_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_security_client_tls_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_client_tls_policy_basic.tf.tmpl index abf74ca54d22..6c58a2792450 100644 --- a/mmv1/templates/terraform/examples/network_security_client_tls_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_client_tls_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_security_client_tls_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_client_tls_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_security_firewall_endpoint_association_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_firewall_endpoint_association_basic.tf.tmpl index 86229b7de681..4677de4095e8 100644 --- a/mmv1/templates/terraform/examples/network_security_firewall_endpoint_association_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_firewall_endpoint_association_basic.tf.tmpl @@ -3,23 +3,23 @@ resource "google_compute_network" "foobar" { auto_create_subnetworks = false } -resource "google_network_security_firewall_endpoint" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name_prefix'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_network_security_firewall_endpoint" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name_prefix"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "us-central1-a" - billing_project_id = "<%= ctx[:test_env_vars]['project'] %>" + billing_project_id = "{{index $.TestEnvVars "project"}}" labels = { foo = "bar" } } -resource "google_network_security_firewall_endpoint_association" "<%= ctx[:primary_resource_id] %>_association" { - name = "<%= ctx[:vars]['resource_name_prefix'] %>-association" - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" +resource "google_network_security_firewall_endpoint_association" "{{$.PrimaryResourceId}}_association" { + name = "{{index $.Vars "resource_name_prefix"}}-association" + parent = "projects/{{index $.TestEnvVars "project"}}" location = "us-central1-a" network = google_compute_network.foobar.id - firewall_endpoint = google_network_security_firewall_endpoint.<%= ctx[:primary_resource_id] %>.id + firewall_endpoint = google_network_security_firewall_endpoint.{{$.PrimaryResourceId}}.id disabled = false labels = { diff --git a/mmv1/templates/terraform/examples/network_security_firewall_endpoint_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_firewall_endpoint_basic.tf.tmpl index eb988c2554ad..e7b0f6f6bc9c 100644 --- a/mmv1/templates/terraform/examples/network_security_firewall_endpoint_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_firewall_endpoint_basic.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_network_security_firewall_endpoint" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_network_security_firewall_endpoint" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "us-central1-a" - billing_project_id = "<%= ctx[:test_env_vars]['project'] %>" + billing_project_id = "{{index $.TestEnvVars "project"}}" labels = { foo = "bar" diff --git a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_basic.tf.tmpl index 74b218af71a0..be88facae445 100644 --- a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_security_gateway_security_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_gateway_security_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" location = "us-central1" description = "my description" } diff --git a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_advanced.tf.tmpl index 0515e303da52..86c4196df668 100644 --- a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_advanced.tf.tmpl @@ -1,11 +1,11 @@ resource "google_network_security_gateway_security_policy" "default" { - name = "<%= ctx[:vars]['gateway_security_policy_id'] %>" + name = "{{index $.Vars "gateway_security_policy_id"}}" location = "us-central1" description = "gateway security policy created to be used as reference by the rule." } -resource "google_network_security_gateway_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_gateway_security_policy_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" location = "us-central1" gateway_security_policy = google_network_security_gateway_security_policy.default.name enabled = true diff --git a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_basic.tf.tmpl index b3a989df1d46..a24ce0e2464e 100644 --- a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_network_security_gateway_security_policy" "default" { - name = "<%= ctx[:vars]['gateway_security_policy_id'] %>" + name = "{{index $.Vars "gateway_security_policy_id"}}" location = "us-central1" description = "gateway security policy created to be used as reference by the rule." } -resource "google_network_security_gateway_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_gateway_security_policy_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" location = "us-central1" gateway_security_policy = google_network_security_gateway_security_policy.default.name enabled = true 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 85a7465faa30..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,6 +1,6 @@ resource "google_privateca_ca_pool" "default" { provider = google-beta - name = "<%= ctx[:vars]['privateca_ca_pool_name'] %>" + name = "{{index $.Vars "privateca_ca_pool_name"}}" location = "us-central1" tier = "DEVOPS" publishing_options { @@ -27,7 +27,7 @@ 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 = "<%= ctx[:vars]['privateca_certificate_authority_id'] %>" + certificate_authority_id = "{{index $.Vars "privateca_certificate_authority_id"}}" location = "us-central1" lifetime = "86400s" type = "SELF_SIGNED" @@ -75,15 +75,15 @@ resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" { resource "google_network_security_tls_inspection_policy" "default" { provider = google-beta - name = "<%= ctx[:vars]['privateca_ca_tls_name'] %>" + name = "{{index $.Vars "privateca_ca_tls_name"}}" location = "us-central1" ca_pool = google_privateca_ca_pool.default.id depends_on = [google_privateca_ca_pool.default, google_privateca_certificate_authority.default, google_privateca_ca_pool_iam_member.tls_inspection_permission] } -resource "google_network_security_gateway_security_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_security_gateway_security_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" location = "us-central1" description = "my description" tls_inspection_policy = google_network_security_tls_inspection_policy.default.id diff --git a/mmv1/templates/terraform/examples/network_security_security_profile_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_security_profile_basic.tf.tmpl index d4ea58501eb4..56dadb74c18d 100644 --- a/mmv1/templates/terraform/examples/network_security_security_profile_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_security_profile_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_security_security_profile" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_network_security_security_profile" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" description = "my description" type = "THREAT_PREVENTION" diff --git a/mmv1/templates/terraform/examples/network_security_security_profile_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_security_profile_group_basic.tf.tmpl index f1a7817da633..36779721d397 100644 --- a/mmv1/templates/terraform/examples/network_security_security_profile_group_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_security_profile_group_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_security_security_profile_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['security_profile_group_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_network_security_security_profile_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "security_profile_group_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" description = "my description" threat_prevention_profile = google_network_security_security_profile.security_profile.id @@ -10,8 +10,8 @@ resource "google_network_security_security_profile_group" "<%= ctx[:primary_reso } resource "google_network_security_security_profile" "security_profile" { - name = "<%= ctx[:vars]['security_profile_name'] %>" + name = "{{index $.Vars "security_profile_name"}}" type = "THREAT_PREVENTION" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" } diff --git a/mmv1/templates/terraform/examples/network_security_security_profile_overrides.tf.tmpl b/mmv1/templates/terraform/examples/network_security_security_profile_overrides.tf.tmpl index 5829b46937e3..88c3fd1a78d6 100644 --- a/mmv1/templates/terraform/examples/network_security_security_profile_overrides.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_security_profile_overrides.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_security_security_profile" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_network_security_security_profile" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" description = "my description" type = "THREAT_PREVENTION" diff --git a/mmv1/templates/terraform/examples/network_security_server_tls_policy_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_security_server_tls_policy_advanced.tf.tmpl index d71f5cd3cfe2..5ae27a9e44c9 100644 --- a/mmv1/templates/terraform/examples/network_security_server_tls_policy_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_server_tls_policy_advanced.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_security_server_tls_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_server_tls_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_security_server_tls_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_server_tls_policy_basic.tf.tmpl index f0ff53b2019d..09e6ceb7a8e7 100644 --- a/mmv1/templates/terraform/examples/network_security_server_tls_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_server_tls_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_security_server_tls_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_server_tls_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_security_server_tls_policy_mtls.tf.tmpl b/mmv1/templates/terraform/examples/network_security_server_tls_policy_mtls.tf.tmpl index a0002be15477..ad2b16fd30fd 100644 --- a/mmv1/templates/terraform/examples/network_security_server_tls_policy_mtls.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_server_tls_policy_mtls.tf.tmpl @@ -1,8 +1,8 @@ data "google_project" "project" { } -resource "google_network_security_server_tls_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_server_tls_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" description = "my description" location = "global" @@ -19,7 +19,7 @@ resource "google_network_security_server_tls_policy" "<%= ctx[:primary_resource_ } resource "google_certificate_manager_trust_config" "default" { - name = "<%= ctx[:vars]['trust_config_name'] %>" + name = "{{index $.Vars "trust_config_name"}}" description = "sample trust config description" location = "global" diff --git a/mmv1/templates/terraform/examples/network_security_server_tls_policy_server_cert.tf.tmpl b/mmv1/templates/terraform/examples/network_security_server_tls_policy_server_cert.tf.tmpl index 0e4d74441396..400c48c0255a 100644 --- a/mmv1/templates/terraform/examples/network_security_server_tls_policy_server_cert.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_server_tls_policy_server_cert.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_security_server_tls_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_server_tls_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_basic.tf.tmpl index 33edd179943a..77d23513b97a 100644 --- a/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_privateca_ca_pool" "default" { - name = "<%= ctx[:vars]['privateca_ca_pool_name'] %>" + name = "{{index $.Vars "privateca_ca_pool_name"}}" location = "us-central1" tier = "DEVOPS" publishing_options { @@ -24,7 +24,7 @@ resource "google_privateca_ca_pool" "default" { resource "google_privateca_certificate_authority" "default" { pool = google_privateca_ca_pool.default.name - certificate_authority_id = "<%= ctx[:vars]['privateca_certificate_authority_id'] %>" + certificate_authority_id = "{{index $.Vars "privateca_certificate_authority_id"}}" location = "us-central1" lifetime = "86400s" type = "SELF_SIGNED" @@ -67,8 +67,8 @@ resource "google_privateca_ca_pool_iam_member" "tls_inspection_permission" { member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-networksecurity.iam.gserviceaccount.com" } -resource "google_network_security_tls_inspection_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_tls_inspection_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" location = "us-central1" ca_pool = google_privateca_ca_pool.default.id exclude_public_ca_set = false diff --git a/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_custom.tf.tmpl b/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_custom.tf.tmpl index 1d1f785230bc..9a7bd4c8a0e6 100644 --- a/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_custom.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_tls_inspection_policy_custom.tf.tmpl @@ -1,6 +1,6 @@ resource "google_privateca_ca_pool" "default" { provider = google-beta - name = "<%= ctx[:vars]['privateca_ca_pool_name'] %>" + name = "{{index $.Vars "privateca_ca_pool_name"}}" location = "us-central1" tier = "DEVOPS" @@ -29,7 +29,7 @@ resource "google_privateca_certificate_authority" "default" { provider = google-beta pool = google_privateca_ca_pool.default.name - certificate_authority_id = "<%= ctx[:vars]['privateca_certificate_authority_id'] %>" + certificate_authority_id = "{{index $.Vars "privateca_certificate_authority_id"}}" location = "us-central1" lifetime = "86400s" type = "SELF_SIGNED" @@ -80,7 +80,7 @@ resource "google_privateca_ca_pool_iam_member" "default" { resource "google_certificate_manager_trust_config" "default" { provider = google-beta - name = "<%= ctx[:vars]['trust_config_name'] %>" + name = "{{index $.Vars "trust_config_name"}}" description = "sample trust config description" location = "us-central1" @@ -94,9 +94,9 @@ resource "google_certificate_manager_trust_config" "default" { } } -resource "google_network_security_tls_inspection_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_security_tls_inspection_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" location = "us-central1" ca_pool = google_privateca_ca_pool.default.id diff --git a/mmv1/templates/terraform/examples/network_security_url_lists_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_security_url_lists_advanced.tf.tmpl index 395f1596fd5f..cfb5d17bd967 100644 --- a/mmv1/templates/terraform/examples/network_security_url_lists_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_url_lists_advanced.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_security_url_lists" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_url_lists" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" location = "us-central1" description = "my description" values = ["www.example.com", "about.example.com", "github.com/example-org/*"] diff --git a/mmv1/templates/terraform/examples/network_security_url_lists_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_url_lists_basic.tf.tmpl index 363c6404930d..b3b1bdbde4ab 100644 --- a/mmv1/templates/terraform/examples/network_security_url_lists_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_security_url_lists_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_security_url_lists" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_security_url_lists" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" location = "us-central1" values = ["www.example.com"] } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/network_services_edge_cache_keyset_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_edge_cache_keyset_basic.tf.tmpl index 0fda4ed25955..f6b281c0f316 100644 --- a/mmv1/templates/terraform/examples/network_services_edge_cache_keyset_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_edge_cache_keyset_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_edge_cache_keyset" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_services_edge_cache_keyset" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" description = "The default keyset" public_key { id = "my-public-key" diff --git a/mmv1/templates/terraform/examples/network_services_edge_cache_keyset_dual_token.tf.tmpl b/mmv1/templates/terraform/examples/network_services_edge_cache_keyset_dual_token.tf.tmpl index f3de7e77986b..81d7673016c0 100644 --- a/mmv1/templates/terraform/examples/network_services_edge_cache_keyset_dual_token.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_edge_cache_keyset_dual_token.tf.tmpl @@ -1,5 +1,5 @@ resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_name'] %>" + secret_id = "{{index $.Vars "secret_name"}}" replication { auto {} @@ -12,8 +12,8 @@ resource "google_secret_manager_secret_version" "secret-version-basic" { secret_data = "secret-data" } -resource "google_network_services_edge_cache_keyset" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_services_edge_cache_keyset" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" description = "The default keyset" public_key { id = "my-public-key" diff --git a/mmv1/templates/terraform/examples/network_services_edge_cache_origin_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_services_edge_cache_origin_advanced.tf.tmpl index 982f3ce2e7df..fe371102219e 100644 --- a/mmv1/templates/terraform/examples/network_services_edge_cache_origin_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_edge_cache_origin_advanced.tf.tmpl @@ -1,5 +1,5 @@ resource "google_network_services_edge_cache_origin" "fallback" { - name = "<%= ctx[:vars]['resource_name_2'] %>" + name = "{{index $.Vars "resource_name_2"}}" origin_address = "fallback.example.com" description = "The default bucket for media edge test" max_attempts = 3 @@ -41,8 +41,8 @@ resource "google_network_services_edge_cache_origin" "fallback" { } } -resource "google_network_services_edge_cache_origin" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_services_edge_cache_origin" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" origin_address = "gs://media-edge-default" failover_origin = google_network_services_edge_cache_origin.fallback.id description = "The default bucket for media edge test" diff --git a/mmv1/templates/terraform/examples/network_services_edge_cache_origin_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_edge_cache_origin_basic.tf.tmpl index 97b0528180b4..e43bd03e2e5e 100644 --- a/mmv1/templates/terraform/examples/network_services_edge_cache_origin_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_edge_cache_origin_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_services_edge_cache_origin" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_services_edge_cache_origin" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" origin_address = "gs://media-edge-default" description = "The default bucket for media edge test" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/network_services_edge_cache_origin_v4auth.tf.tmpl b/mmv1/templates/terraform/examples/network_services_edge_cache_origin_v4auth.tf.tmpl index 3402b30dbed9..0dbd1880b380 100644 --- a/mmv1/templates/terraform/examples/network_services_edge_cache_origin_v4auth.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_edge_cache_origin_v4auth.tf.tmpl @@ -1,5 +1,5 @@ resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_name'] %>" + secret_id = "{{index $.Vars "secret_name"}}" replication { auto {} @@ -12,8 +12,8 @@ resource "google_secret_manager_secret_version" "secret-version-basic" { secret_data = "secret-data" } -resource "google_network_services_edge_cache_origin" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_services_edge_cache_origin" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" origin_address = "gs://media-edge-default" description = "The default bucket for V4 authentication" aws_v4_authentication { diff --git a/mmv1/templates/terraform/examples/network_services_edge_cache_service_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_services_edge_cache_service_advanced.tf.tmpl index a851d0319cf6..35039da20349 100644 --- a/mmv1/templates/terraform/examples/network_services_edge_cache_service_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_edge_cache_service_advanced.tf.tmpl @@ -1,11 +1,11 @@ resource "google_storage_bucket" "dest" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" force_destroy = true } resource "google_network_services_edge_cache_origin" "google" { - name = "<%= ctx[:vars]['origin_google'] %>" + name = "{{index $.Vars "origin_google"}}" origin_address = "google.com" description = "The default bucket for media edge test" max_attempts = 2 @@ -15,7 +15,7 @@ resource "google_network_services_edge_cache_origin" "google" { } resource "google_network_services_edge_cache_origin" "instance" { - name = "<%= ctx[:vars]['origin_name'] %>" + name = "{{index $.Vars "origin_name"}}" origin_address = google_storage_bucket.dest.url description = "The default bucket for media edge test" max_attempts = 2 @@ -24,8 +24,8 @@ resource "google_network_services_edge_cache_origin" "instance" { } } -resource "google_network_services_edge_cache_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['service_name'] %>" +resource "google_network_services_edge_cache_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "service_name"}}" description = "some description" disable_quic = true disable_http2 = true diff --git a/mmv1/templates/terraform/examples/network_services_edge_cache_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_edge_cache_service_basic.tf.tmpl index 2926fb6abd06..dde61b33b067 100644 --- a/mmv1/templates/terraform/examples/network_services_edge_cache_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_edge_cache_service_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_storage_bucket" "dest" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" force_destroy = true } resource "google_network_services_edge_cache_origin" "instance" { - name = "<%= ctx[:vars]['origin_name'] %>" + name = "{{index $.Vars "origin_name"}}" origin_address = google_storage_bucket.dest.url description = "The default bucket for media edge test" max_attempts = 2 @@ -14,8 +14,8 @@ resource "google_network_services_edge_cache_origin" "instance" { } } -resource "google_network_services_edge_cache_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['service_name'] %>" +resource "google_network_services_edge_cache_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "service_name"}}" description = "some description" routing { host_rule { diff --git a/mmv1/templates/terraform/examples/network_services_edge_cache_service_dual_token.tf.tmpl b/mmv1/templates/terraform/examples/network_services_edge_cache_service_dual_token.tf.tmpl index b86f61c44e12..b2b6b7a375bd 100644 --- a/mmv1/templates/terraform/examples/network_services_edge_cache_service_dual_token.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_edge_cache_service_dual_token.tf.tmpl @@ -1,5 +1,5 @@ resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_name'] %>" + secret_id = "{{index $.Vars "secret_name"}}" replication { auto {} @@ -13,7 +13,7 @@ resource "google_secret_manager_secret_version" "secret-version-basic" { } resource "google_network_services_edge_cache_keyset" "keyset" { - name = "<%= ctx[:vars]['keyset_name'] %>" + name = "{{index $.Vars "keyset_name"}}" description = "The default keyset" public_key { id = "my-public-key" @@ -25,13 +25,13 @@ resource "google_network_services_edge_cache_keyset" "keyset" { } resource "google_network_services_edge_cache_origin" "instance" { - name = "<%= ctx[:vars]['origin_name'] %>" + name = "{{index $.Vars "origin_name"}}" origin_address = "gs://media-edge-default" description = "The default bucket for media edge test" } -resource "google_network_services_edge_cache_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['service_name'] %>" +resource "google_network_services_edge_cache_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "service_name"}}" description = "some description" routing { host_rule { diff --git a/mmv1/templates/terraform/examples/network_services_endpoint_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_endpoint_policy_basic.tf.tmpl index 0a354c1800d1..6addafc3c07b 100644 --- a/mmv1/templates/terraform/examples/network_services_endpoint_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_endpoint_policy_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_endpoint_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_endpoint_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_endpoint_policy_empty_match.tf.tmpl b/mmv1/templates/terraform/examples/network_services_endpoint_policy_empty_match.tf.tmpl index cfc293e4b735..754caeecfdf4 100644 --- a/mmv1/templates/terraform/examples/network_services_endpoint_policy_empty_match.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_endpoint_policy_empty_match.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_endpoint_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_endpoint_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_gateway_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_services_gateway_advanced.tf.tmpl index 9904d7685b8f..a6ef2e0e45f8 100644 --- a/mmv1/templates/terraform/examples/network_services_gateway_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_gateway_advanced.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_gateway_basic.tf.tmpl index 9d46fcc890d5..1576b6cfefe6 100644 --- a/mmv1/templates/terraform/examples/network_services_gateway_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_gateway_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['resource_name'] %>" +resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "resource_name"}}" scope = "default-scope-basic" type = "OPEN_MESH" ports = [443] diff --git a/mmv1/templates/terraform/examples/network_services_gateway_multiple_swp_same_network.tf.tmpl b/mmv1/templates/terraform/examples/network_services_gateway_multiple_swp_same_network.tf.tmpl index 297e4312acc1..200f38d39928 100644 --- a/mmv1/templates/terraform/examples/network_services_gateway_multiple_swp_same_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_gateway_multiple_swp_same_network.tf.tmpl @@ -1,5 +1,5 @@ resource "google_certificate_manager_certificate" "default" { - name = "<%= ctx[:vars]['certificate_name'] %>" + name = "{{index $.Vars "certificate_name"}}" location = "us-south1" self_managed { pem_certificate = file("test-fixtures/cert.pem") @@ -8,13 +8,13 @@ resource "google_certificate_manager_certificate" "default" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" routing_mode = "REGIONAL" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" purpose = "PRIVATE" ip_cidr_range = "10.128.0.0/20" region = "us-south1" @@ -23,7 +23,7 @@ resource "google_compute_subnetwork" "default" { } resource "google_compute_subnetwork" "proxyonlysubnet" { - name = "<%= ctx[:vars]['proxy_only_subnetwork_name'] %>" + name = "{{index $.Vars "proxy_only_subnetwork_name"}}" purpose = "REGIONAL_MANAGED_PROXY" ip_cidr_range = "192.168.0.0/23" region = "us-south1" @@ -32,12 +32,12 @@ resource "google_compute_subnetwork" "proxyonlysubnet" { } resource "google_network_security_gateway_security_policy" "default" { - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" location = "us-south1" } resource "google_network_security_gateway_security_policy_rule" "default" { - name = "<%= ctx[:vars]['policy_rule_name'] %>" + name = "{{index $.Vars "policy_rule_name"}}" location = "us-south1" gateway_security_policy = google_network_security_gateway_security_policy.default.name enabled = true @@ -46,13 +46,13 @@ resource "google_network_security_gateway_security_policy_rule" "default" { basic_profile = "ALLOW" } -resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['gateway_name_1'] %>" +resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "gateway_name_1"}}" location = "us-south1" addresses = ["10.128.0.99"] type = "SECURE_WEB_GATEWAY" ports = [443] - scope = "<%= ctx[:vars]['scope_1'] %>" + scope = "{{index $.Vars "scope_1"}}" certificate_urls = [google_certificate_manager_certificate.default.id] gateway_security_policy = google_network_security_gateway_security_policy.default.id network = google_compute_network.default.id @@ -62,12 +62,12 @@ resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { } resource "google_network_services_gateway" "gateway2" { - name = "<%= ctx[:vars]['gateway_name_2'] %>" + name = "{{index $.Vars "gateway_name_2"}}" location = "us-south1" addresses = ["10.128.0.98"] type = "SECURE_WEB_GATEWAY" ports = [443] - scope = "<%= ctx[:vars]['scope_2'] %>" + scope = "{{index $.Vars "scope_2"}}" certificate_urls = [google_certificate_manager_certificate.default.id] gateway_security_policy = google_network_security_gateway_security_policy.default.id network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/network_services_gateway_secure_web_proxy.tf.tmpl b/mmv1/templates/terraform/examples/network_services_gateway_secure_web_proxy.tf.tmpl index aea4a1aec8e1..dd0446334b48 100644 --- a/mmv1/templates/terraform/examples/network_services_gateway_secure_web_proxy.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_gateway_secure_web_proxy.tf.tmpl @@ -1,5 +1,5 @@ resource "google_certificate_manager_certificate" "default" { - name = "<%= ctx[:vars]['certificate_name'] %>" + name = "{{index $.Vars "certificate_name"}}" location = "us-central1" self_managed { pem_certificate = file("test-fixtures/cert.pem") @@ -8,13 +8,13 @@ resource "google_certificate_manager_certificate" "default" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" routing_mode = "REGIONAL" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" purpose = "PRIVATE" ip_cidr_range = "10.128.0.0/20" region = "us-central1" @@ -23,7 +23,7 @@ resource "google_compute_subnetwork" "default" { } resource "google_compute_subnetwork" "proxyonlysubnet" { - name = "<%= ctx[:vars]['proxy_only_subnetwork_name'] %>" + name = "{{index $.Vars "proxy_only_subnetwork_name"}}" purpose = "REGIONAL_MANAGED_PROXY" ip_cidr_range = "192.168.0.0/23" region = "us-central1" @@ -32,12 +32,12 @@ resource "google_compute_subnetwork" "proxyonlysubnet" { } resource "google_network_security_gateway_security_policy" "default" { - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" location = "us-central1" } resource "google_network_security_gateway_security_policy_rule" "default" { - name = "<%= ctx[:vars]['policy_rule_name'] %>" + name = "{{index $.Vars "policy_rule_name"}}" location = "us-central1" gateway_security_policy = google_network_security_gateway_security_policy.default.name enabled = true @@ -46,13 +46,13 @@ resource "google_network_security_gateway_security_policy_rule" "default" { basic_profile = "ALLOW" } -resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['gateway_name_1'] %>" +resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "gateway_name_1"}}" location = "us-central1" addresses = ["10.128.0.99"] type = "SECURE_WEB_GATEWAY" ports = [443] - scope = "<%= ctx[:vars]['scope_1'] %>" + scope = "{{index $.Vars "scope_1"}}" certificate_urls = [google_certificate_manager_certificate.default.id] gateway_security_policy = google_network_security_gateway_security_policy.default.id network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/network_services_grpc_route_actions.tf.tmpl b/mmv1/templates/terraform/examples/network_services_grpc_route_actions.tf.tmpl index d12b4ad44473..cb5f24659c03 100644 --- a/mmv1/templates/terraform/examples/network_services_grpc_route_actions.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_grpc_route_actions.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_grpc_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_grpc_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_grpc_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_grpc_route_basic.tf.tmpl index ba6dec97ca0c..dee3bb8ef609 100644 --- a/mmv1/templates/terraform/examples/network_services_grpc_route_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_grpc_route_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_grpc_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_grpc_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_grpc_route_matches_and_actions.tf.tmpl b/mmv1/templates/terraform/examples/network_services_grpc_route_matches_and_actions.tf.tmpl index 19e8048a1a47..a4353b313945 100644 --- a/mmv1/templates/terraform/examples/network_services_grpc_route_matches_and_actions.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_grpc_route_matches_and_actions.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_grpc_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_grpc_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_http_route_actions.tf.tmpl b/mmv1/templates/terraform/examples/network_services_http_route_actions.tf.tmpl index d0531ef41027..0f8ebfe5f869 100644 --- a/mmv1/templates/terraform/examples/network_services_http_route_actions.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_http_route_actions.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_http_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_http_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_http_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_http_route_basic.tf.tmpl index 6c72915499e2..c01e1226d7a2 100644 --- a/mmv1/templates/terraform/examples/network_services_http_route_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_http_route_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_http_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_http_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_http_route_matches_and_actions.tf.tmpl b/mmv1/templates/terraform/examples/network_services_http_route_matches_and_actions.tf.tmpl index 7f1203c5dae2..e6e4a5c605a4 100644 --- a/mmv1/templates/terraform/examples/network_services_http_route_matches_and_actions.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_http_route_matches_and_actions.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_http_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_http_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_http_route_mesh_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_http_route_mesh_basic.tf.tmpl index c822119441bb..ff4acf3b3dda 100644 --- a/mmv1/templates/terraform/examples/network_services_http_route_mesh_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_http_route_mesh_basic.tf.tmpl @@ -1,22 +1,22 @@ -resource "google_network_services_mesh" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } description = "my description" } -resource "google_network_services_http_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_http_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } description = "my description" hostnames = ["example"] meshes = [ - google_network_services_mesh.<%= ctx[:primary_resource_id] %>.id + google_network_services_mesh.{{$.PrimaryResourceId}}.id ] rules { matches { diff --git a/mmv1/templates/terraform/examples/network_services_lb_route_extension_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_lb_route_extension_basic.tf.tmpl index c399190f5aca..ed012d98ccb0 100644 --- a/mmv1/templates/terraform/examples/network_services_lb_route_extension_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_lb_route_extension_basic.tf.tmpl @@ -1,13 +1,13 @@ # Internal HTTP load balancer with a managed instance group backend # VPC network resource "google_compute_network" "ilb_network" { - name = "<%= ctx[:vars]['ilb_network_name'] %>" + name = "{{index $.Vars "ilb_network_name"}}" auto_create_subnetworks = false } # proxy-only subnet resource "google_compute_subnetwork" "proxy_subnet" { - name = "<%= ctx[:vars]['proxy_subnet_name'] %>" + name = "{{index $.Vars "proxy_subnet_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-west1" purpose = "REGIONAL_MANAGED_PROXY" @@ -17,7 +17,7 @@ resource "google_compute_subnetwork" "proxy_subnet" { # backend subnet resource "google_compute_subnetwork" "ilb_subnet" { - name = "<%= ctx[:vars]['backend_subnet_name'] %>" + name = "{{index $.Vars "backend_subnet_name"}}" ip_cidr_range = "10.0.1.0/24" region = "us-west1" network = google_compute_network.ilb_network.id @@ -29,7 +29,7 @@ resource "google_compute_subnetwork" "ilb_subnet" { # forwarding rule resource "google_compute_forwarding_rule" "default" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-west1" ip_protocol = "TCP" load_balancing_scheme = "INTERNAL_MANAGED" @@ -46,7 +46,7 @@ resource "google_compute_forwarding_rule" "default" { # HTTP target proxy resource "google_compute_region_target_http_proxy" "default" { - name = "<%= ctx[:vars]['target_http_proxy_name'] %>" + name = "{{index $.Vars "target_http_proxy_name"}}" region = "us-west1" url_map = google_compute_region_url_map.default.id } @@ -70,7 +70,7 @@ resource "google_compute_region_url_map" "default" { # backend service resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" region = "us-west1" protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" @@ -86,7 +86,7 @@ resource "google_compute_region_backend_service" "default" { # instance template resource "google_compute_instance_template" "instance_template" { - name = "<%= ctx[:vars]['mig_template_name'] %>" + name = "{{index $.Vars "mig_template_name"}}" machine_type = "e2-small" tags = ["http-server"] @@ -136,7 +136,7 @@ resource "google_compute_instance_template" "instance_template" { # health check resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['hc_name'] %>" + name = "{{index $.Vars "hc_name"}}" region = "us-west1" http_health_check { @@ -146,7 +146,7 @@ resource "google_compute_region_health_check" "default" { # MIG resource "google_compute_region_instance_group_manager" "mig" { - name = "<%= ctx[:vars]['mig_name'] %>" + name = "{{index $.Vars "mig_name"}}" region = "us-west1" base_instance_name = "vm" @@ -160,7 +160,7 @@ resource "google_compute_region_instance_group_manager" "mig" { # allow all access from IAP and health check ranges resource "google_compute_firewall" "fw_iap" { - name = "<%= ctx[:vars]['fw_allow_iap_hc_name'] %>" + name = "{{index $.Vars "fw_allow_iap_hc_name"}}" direction = "INGRESS" network = google_compute_network.ilb_network.id source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] @@ -172,7 +172,7 @@ resource "google_compute_firewall" "fw_iap" { # allow http from proxy subnet to backends resource "google_compute_firewall" "fw_ilb_to_backends" { - name = "<%= ctx[:vars]['fw_allow_ilb_to_backends_name'] %>" + name = "{{index $.Vars "fw_allow_ilb_to_backends_name"}}" direction = "INGRESS" network = google_compute_network.ilb_network.id source_ranges = ["10.0.0.0/24"] @@ -188,8 +188,8 @@ resource "google_compute_firewall" "fw_ilb_to_backends" { ] } -resource "google_network_services_lb_route_extension" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['lb_route_extension_name'] %>" +resource "google_network_services_lb_route_extension" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "lb_route_extension_name"}}" description = "my route extension" location = "us-west1" load_balancing_scheme = "INTERNAL_MANAGED" @@ -220,7 +220,7 @@ resource "google_network_services_lb_route_extension" "<%= ctx[:primary_resource # test instance resource "google_compute_instance" "vm_test" { - name = "<%= ctx[:vars]['vm_test_name'] %>" + name = "{{index $.Vars "vm_test_name"}}" zone = "us-west1-b" machine_type = "e2-small" @@ -238,7 +238,7 @@ resource "google_compute_instance" "vm_test" { # Route Extension Backend Instance resource "google_compute_instance" "callouts_instance" { - name = "<%= ctx[:vars]['callouts_instance_name'] %>" + name = "{{index $.Vars "callouts_instance_name"}}" zone = "us-west1-a" machine_type = "e2-small" @@ -293,7 +293,7 @@ resource "google_compute_instance" "callouts_instance" { // callouts instance group resource "google_compute_instance_group" "callouts_instance_group" { - name = "<%= ctx[:vars]['callouts_instance_group'] %>" + name = "{{index $.Vars "callouts_instance_group"}}" description = "Terraform test instance group" zone = "us-west1-a" @@ -314,7 +314,7 @@ resource "google_compute_instance_group" "callouts_instance_group" { # callout health check resource "google_compute_region_health_check" "callouts_health_check" { - name = "<%= ctx[:vars]['callouts_hc_name'] %>" + name = "{{index $.Vars "callouts_hc_name"}}" region = "us-west1" http_health_check { @@ -328,7 +328,7 @@ resource "google_compute_region_health_check" "callouts_health_check" { # callout backend service resource "google_compute_region_backend_service" "callouts_backend" { - name = "<%= ctx[:vars]['callouts_backend_name'] %>" + name = "{{index $.Vars "callouts_backend_name"}}" region = "us-west1" protocol = "HTTP2" load_balancing_scheme = "INTERNAL_MANAGED" 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 5c5a4e78fc55..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 @@ -1,13 +1,13 @@ # Internal HTTP load balancer with a managed instance group backend # VPC network resource "google_compute_network" "ilb_network" { - name = "<%= ctx[:vars]['ilb_network_name'] %>" + name = "{{index $.Vars "ilb_network_name"}}" auto_create_subnetworks = false } # proxy-only subnet resource "google_compute_subnetwork" "proxy_subnet" { - name = "<%= ctx[:vars]['proxy_subnet_name'] %>" + name = "{{index $.Vars "proxy_subnet_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-west1" purpose = "REGIONAL_MANAGED_PROXY" @@ -17,7 +17,7 @@ resource "google_compute_subnetwork" "proxy_subnet" { # backend subnet resource "google_compute_subnetwork" "ilb_subnet" { - name = "<%= ctx[:vars]['backend_subnet_name'] %>" + name = "{{index $.Vars "backend_subnet_name"}}" ip_cidr_range = "10.0.1.0/24" region = "us-west1" network = google_compute_network.ilb_network.id @@ -29,7 +29,7 @@ resource "google_compute_subnetwork" "ilb_subnet" { # forwarding rule resource "google_compute_forwarding_rule" "default" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-west1" ip_protocol = "TCP" load_balancing_scheme = "INTERNAL_MANAGED" @@ -46,21 +46,21 @@ resource "google_compute_forwarding_rule" "default" { # HTTP target proxy resource "google_compute_region_target_http_proxy" "default" { - name = "<%= ctx[:vars]['target_http_proxy_name'] %>" + name = "{{index $.Vars "target_http_proxy_name"}}" region = "us-west1" url_map = google_compute_region_url_map.default.id } # URL map resource "google_compute_region_url_map" "default" { - name = "<%= ctx[:vars]['regional_url_map_name'] %>" + name = "{{index $.Vars "regional_url_map_name"}}" region = "us-west1" default_service = google_compute_region_backend_service.default.id } # backend service resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" region = "us-west1" protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" @@ -76,7 +76,7 @@ resource "google_compute_region_backend_service" "default" { # instance template resource "google_compute_instance_template" "instance_template" { - name = "<%= ctx[:vars]['mig_template_name'] %>" + name = "{{index $.Vars "mig_template_name"}}" machine_type = "e2-small" tags = ["http-server"] @@ -126,7 +126,7 @@ resource "google_compute_instance_template" "instance_template" { # health check resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['hc_name'] %>" + name = "{{index $.Vars "hc_name"}}" region = "us-west1" http_health_check { @@ -136,7 +136,7 @@ resource "google_compute_region_health_check" "default" { # MIG resource "google_compute_region_instance_group_manager" "mig" { - name = "<%= ctx[:vars]['mig_name'] %>" + name = "{{index $.Vars "mig_name"}}" region = "us-west1" base_instance_name = "vm" @@ -150,7 +150,7 @@ resource "google_compute_region_instance_group_manager" "mig" { # allow all access from IAP and health check ranges resource "google_compute_firewall" "fw_iap" { - name = "<%= ctx[:vars]['fw_allow_iap_hc_name'] %>" + name = "{{index $.Vars "fw_allow_iap_hc_name"}}" direction = "INGRESS" network = google_compute_network.ilb_network.id source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20"] @@ -162,7 +162,7 @@ resource "google_compute_firewall" "fw_iap" { # allow http from proxy subnet to backends resource "google_compute_firewall" "fw_ilb_to_backends" { - name = "<%= ctx[:vars]['fw_allow_ilb_to_backends_name'] %>" + name = "{{index $.Vars "fw_allow_ilb_to_backends_name"}}" direction = "INGRESS" network = google_compute_network.ilb_network.id source_ranges = ["10.0.0.0/24"] @@ -178,8 +178,8 @@ resource "google_compute_firewall" "fw_ilb_to_backends" { ] } -resource "google_network_services_lb_traffic_extension" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['lb_traffic_extension_name'] %>" +resource "google_network_services_lb_traffic_extension" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "lb_traffic_extension_name"}}" description = "my traffic extension" location = "us-west1" @@ -212,7 +212,7 @@ resource "google_network_services_lb_traffic_extension" "<%= ctx[:primary_resour # test instance resource "google_compute_instance" "vm_test" { - name = "<%= ctx[:vars]['vm_test_name'] %>" + name = "{{index $.Vars "vm_test_name"}}" zone = "us-west1-b" machine_type = "e2-small" @@ -230,7 +230,7 @@ resource "google_compute_instance" "vm_test" { # Traffic Extension Backend Instance resource "google_compute_instance" "callouts_instance" { - name = "<%= ctx[:vars]['callouts_instance_name'] %>" + name = "{{index $.Vars "callouts_instance_name"}}" zone = "us-west1-a" machine_type = "e2-small" @@ -279,7 +279,7 @@ resource "google_compute_instance" "callouts_instance" { // callouts instance group resource "google_compute_instance_group" "callouts_instance_group" { - name = "<%= ctx[:vars]['callouts_instance_group'] %>" + name = "{{index $.Vars "callouts_instance_group"}}" description = "Terraform test instance group" zone = "us-west1-a" @@ -300,7 +300,7 @@ resource "google_compute_instance_group" "callouts_instance_group" { # callout health check resource "google_compute_region_health_check" "callouts_health_check" { - name = "<%= ctx[:vars]['callouts_hc_name'] %>" + name = "{{index $.Vars "callouts_hc_name"}}" region = "us-west1" http_health_check { @@ -314,7 +314,7 @@ resource "google_compute_region_health_check" "callouts_health_check" { # callout backend service resource "google_compute_region_backend_service" "callouts_backend" { - name = "<%= ctx[:vars]['callouts_backend_name'] %>" + name = "{{index $.Vars "callouts_backend_name"}}" region = "us-west1" protocol = "HTTP2" load_balancing_scheme = "INTERNAL_MANAGED" diff --git a/mmv1/templates/terraform/examples/network_services_mesh_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_mesh_basic.tf.tmpl index 3c3b068f837d..c07c7fa5895c 100644 --- a/mmv1/templates/terraform/examples/network_services_mesh_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_mesh_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_mesh" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_mesh_no_port.tf.tmpl b/mmv1/templates/terraform/examples/network_services_mesh_no_port.tf.tmpl index c1499558c040..285ffb5e6fa1 100644 --- a/mmv1/templates/terraform/examples/network_services_mesh_no_port.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_mesh_no_port.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_mesh" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/network_services_service_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_service_binding_basic.tf.tmpl index f44a8294e3d7..b4e09d42bdb6 100644 --- a/mmv1/templates/terraform/examples/network_services_service_binding_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_service_binding_basic.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_service_directory_namespace" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" { provider = google-beta - namespace_id = "<%= ctx[:vars]["namespace_id"] %>" + namespace_id = "{{index $.Vars "namespace_id"}}" location = "us-central1" } -resource "google_service_directory_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_service" "{{$.PrimaryResourceId}}" { provider = google-beta - service_id = "<%= ctx[:vars]["service_id"] %>" - namespace = google_service_directory_namespace.<%= ctx[:primary_resource_id] %>.id + service_id = "{{index $.Vars "service_id"}}" + namespace = google_service_directory_namespace.{{$.PrimaryResourceId}}.id metadata = { stage = "prod" @@ -15,13 +15,13 @@ resource "google_service_directory_service" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_network_services_service_binding" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_service_binding" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } description = "my description" - service = google_service_directory_service.<%= ctx[:primary_resource_id] %>.id + service = google_service_directory_service.{{$.PrimaryResourceId}}.id } diff --git a/mmv1/templates/terraform/examples/network_services_service_lb_policies_advanced.tf.tmpl b/mmv1/templates/terraform/examples/network_services_service_lb_policies_advanced.tf.tmpl index 6e91dd464af9..51680aa0e867 100644 --- a/mmv1/templates/terraform/examples/network_services_service_lb_policies_advanced.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_service_lb_policies_advanced.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_network_services_service_lb_policies" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_service_lb_policies" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" location = "global" description = "my description" load_balancing_algorithm = "SPRAY_TO_REGION" @@ -22,9 +22,9 @@ resource "google_network_services_service_lb_policies" "<%= ctx[:primary_resourc resource "google_compute_backend_service" "default" { provider = google-beta - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" description = "my description" load_balancing_scheme = "INTERNAL_SELF_MANAGED" protocol = "HTTP" - service_lb_policy = "//networkservices.googleapis.com/${google_network_services_service_lb_policies.<%= ctx[:primary_resource_id] %>.id}" + service_lb_policy = "//networkservices.googleapis.com/${google_network_services_service_lb_policies.{{$.PrimaryResourceId}}.id}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_service_lb_policies_advanced.tmpl b/mmv1/templates/terraform/examples/network_services_service_lb_policies_advanced.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/network_services_service_lb_policies_advanced.tmpl rename to mmv1/templates/terraform/examples/network_services_service_lb_policies_advanced.tmpl diff --git a/mmv1/templates/terraform/examples/network_services_service_lb_policies_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_service_lb_policies_basic.tf.tmpl index caa7e088e26c..db6ea6cd28e2 100644 --- a/mmv1/templates/terraform/examples/network_services_service_lb_policies_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_service_lb_policies_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_network_services_service_lb_policies" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_service_lb_policies" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" location = "global" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/go/network_services_service_lb_policies_basic.tmpl b/mmv1/templates/terraform/examples/network_services_service_lb_policies_basic.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/network_services_service_lb_policies_basic.tmpl rename to mmv1/templates/terraform/examples/network_services_service_lb_policies_basic.tmpl diff --git a/mmv1/templates/terraform/examples/network_services_tcp_route_actions.tf.tmpl b/mmv1/templates/terraform/examples/network_services_tcp_route_actions.tf.tmpl index 699c72c33d6e..d978673267eb 100644 --- a/mmv1/templates/terraform/examples/network_services_tcp_route_actions.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_tcp_route_actions.tf.tmpl @@ -1,20 +1,20 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] } resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } -resource "google_network_services_tcp_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_tcp_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } @@ -22,7 +22,7 @@ resource "google_network_services_tcp_route" "<%= ctx[:primary_resource_id] %>" rules { action { destinations { - service_name = google_compute_backend_service.<%= ctx[:primary_resource_id] %>.id + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id weight = 1 } original_destination = false diff --git a/mmv1/templates/terraform/examples/network_services_tcp_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_tcp_route_basic.tf.tmpl index 25157482e251..773b5baf3752 100644 --- a/mmv1/templates/terraform/examples/network_services_tcp_route_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_tcp_route_basic.tf.tmpl @@ -1,20 +1,20 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] } resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } -resource "google_network_services_tcp_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_tcp_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } @@ -26,7 +26,7 @@ resource "google_network_services_tcp_route" "<%= ctx[:primary_resource_id] %>" } action { destinations { - service_name = google_compute_backend_service.<%= ctx[:primary_resource_id] %>.id + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id weight = 1 } original_destination = false diff --git a/mmv1/templates/terraform/examples/network_services_tcp_route_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_tcp_route_gateway_basic.tf.tmpl index 00a128faeaae..1e29035956f3 100644 --- a/mmv1/templates/terraform/examples/network_services_tcp_route_gateway_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_tcp_route_gateway_basic.tf.tmpl @@ -1,20 +1,20 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] } resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } -resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } @@ -25,15 +25,15 @@ resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { } -resource "google_network_services_tcp_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_tcp_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } description = "my description" gateways = [ - google_network_services_gateway.<%= ctx[:primary_resource_id] %>.id + google_network_services_gateway.{{$.PrimaryResourceId}}.id ] rules { matches { @@ -42,7 +42,7 @@ resource "google_network_services_tcp_route" "<%= ctx[:primary_resource_id] %>" } action { destinations { - service_name = google_compute_backend_service.<%= ctx[:primary_resource_id] %>.id + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id weight = 1 } original_destination = false diff --git a/mmv1/templates/terraform/examples/network_services_tcp_route_mesh_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_tcp_route_mesh_basic.tf.tmpl index fb89a36dcc47..2d739980a95c 100644 --- a/mmv1/templates/terraform/examples/network_services_tcp_route_mesh_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_tcp_route_mesh_basic.tf.tmpl @@ -1,20 +1,20 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] } resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } -resource "google_network_services_mesh" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } @@ -22,15 +22,15 @@ resource "google_network_services_mesh" "<%= ctx[:primary_resource_id] %>" { } -resource "google_network_services_tcp_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_tcp_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } description = "my description" meshes = [ - google_network_services_mesh.<%= ctx[:primary_resource_id] %>.id + google_network_services_mesh.{{$.PrimaryResourceId}}.id ] rules { matches { @@ -39,7 +39,7 @@ resource "google_network_services_tcp_route" "<%= ctx[:primary_resource_id] %>" } action { destinations { - service_name = google_compute_backend_service.<%= ctx[:primary_resource_id] %>.id + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id weight = 1 } original_destination = false diff --git a/mmv1/templates/terraform/examples/network_services_tls_route_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_tls_route_basic.tf.tmpl index 5df04b2d8b32..63898224d74f 100644 --- a/mmv1/templates/terraform/examples/network_services_tls_route_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_tls_route_basic.tf.tmpl @@ -1,20 +1,20 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] } resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } -resource "google_network_services_tls_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_tls_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" description = "my description" rules { matches { @@ -23,7 +23,7 @@ resource "google_network_services_tls_route" "<%= ctx[:primary_resource_id] %>" } action { destinations { - service_name = google_compute_backend_service.<%= ctx[:primary_resource_id] %>.id + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id weight = 1 } } diff --git a/mmv1/templates/terraform/examples/network_services_tls_route_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_tls_route_gateway_basic.tf.tmpl index e576c099d322..a7b11eec544d 100644 --- a/mmv1/templates/terraform/examples/network_services_tls_route_gateway_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_tls_route_gateway_basic.tf.tmpl @@ -1,20 +1,20 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] } resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } -resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_gateway" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } @@ -24,12 +24,12 @@ resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { ports = [443] } -resource "google_network_services_tls_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_tls_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" description = "my description" gateways = [ - google_network_services_gateway.<%= ctx[:primary_resource_id] %>.id + google_network_services_gateway.{{$.PrimaryResourceId}}.id ] rules { matches { @@ -38,7 +38,7 @@ resource "google_network_services_tls_route" "<%= ctx[:primary_resource_id] %>" } action { destinations { - service_name = google_compute_backend_service.<%= ctx[:primary_resource_id] %>.id + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id weight = 1 } } diff --git a/mmv1/templates/terraform/examples/network_services_tls_route_mesh_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_tls_route_mesh_basic.tf.tmpl index 346898492d30..692e818007ee 100644 --- a/mmv1/templates/terraform/examples/network_services_tls_route_mesh_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/network_services_tls_route_mesh_basic.tf.tmpl @@ -1,20 +1,20 @@ -resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" health_checks = [google_compute_http_health_check.default.id] } resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } -resource "google_network_services_mesh" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_mesh" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" labels = { foo = "bar" } @@ -22,12 +22,12 @@ resource "google_network_services_mesh" "<%= ctx[:primary_resource_id] %>" { } -resource "google_network_services_tls_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_network_services_tls_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['resource_name'] %>" + name = "{{index $.Vars "resource_name"}}" description = "my description" meshes = [ - google_network_services_mesh.<%= ctx[:primary_resource_id] %>.id + google_network_services_mesh.{{$.PrimaryResourceId}}.id ] rules { matches { @@ -36,7 +36,7 @@ resource "google_network_services_tls_route" "<%= ctx[:primary_resource_id] %>" } action { destinations { - service_name = google_compute_backend_service.<%= ctx[:primary_resource_id] %>.id + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id weight = 1 } } diff --git a/mmv1/templates/terraform/examples/node_group_autoscaling_policy.tf.tmpl b/mmv1/templates/terraform/examples/node_group_autoscaling_policy.tf.tmpl index e552ec74eea4..4a9b744f292d 100644 --- a/mmv1/templates/terraform/examples/node_group_autoscaling_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/node_group_autoscaling_policy.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_node_template" "soletenant-tmpl" { - name = "<%= ctx[:vars]['template_name'] %>" + name = "{{index $.Vars "template_name"}}" region = "us-central1" node_type = "n1-node-96-624" } -resource "google_compute_node_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['group_name'] %>" +resource "google_compute_node_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "group_name"}}" zone = "us-central1-f" description = "example google_compute_node_group for Terraform Google Provider" maintenance_policy = "RESTART_IN_PLACE" diff --git a/mmv1/templates/terraform/examples/node_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/node_group_basic.tf.tmpl index 3ed5b02dd02b..46215b216663 100644 --- a/mmv1/templates/terraform/examples/node_group_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/node_group_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_node_template" "soletenant-tmpl" { - name = "<%= ctx[:vars]['template_name'] %>" + name = "{{index $.Vars "template_name"}}" region = "us-central1" node_type = "n1-node-96-624" } -resource "google_compute_node_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['group_name'] %>" +resource "google_compute_node_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "group_name"}}" zone = "us-central1-f" description = "example google_compute_node_group for Terraform Google Provider" diff --git a/mmv1/templates/terraform/examples/node_group_maintenance_interval.tf.tmpl b/mmv1/templates/terraform/examples/node_group_maintenance_interval.tf.tmpl index 94f2cb55a7d6..f7e332c6a604 100644 --- a/mmv1/templates/terraform/examples/node_group_maintenance_interval.tf.tmpl +++ b/mmv1/templates/terraform/examples/node_group_maintenance_interval.tf.tmpl @@ -1,13 +1,13 @@ resource "google_compute_node_template" "soletenant-tmpl" { provider = google-beta - name = "<%= ctx[:vars]['template_name'] %>" + name = "{{index $.Vars "template_name"}}" region = "us-central1" node_type = "c2-node-60-240" } -resource "google_compute_node_group" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_node_group" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['group_name'] %>" + name = "{{index $.Vars "group_name"}}" zone = "us-central1-a" description = "example google_compute_node_group for Terraform Google Provider" diff --git a/mmv1/templates/terraform/examples/node_group_share_settings.tf.tmpl b/mmv1/templates/terraform/examples/node_group_share_settings.tf.tmpl index 64d2f3073139..94800793ec5c 100644 --- a/mmv1/templates/terraform/examples/node_group_share_settings.tf.tmpl +++ b/mmv1/templates/terraform/examples/node_group_share_settings.tf.tmpl @@ -1,18 +1,18 @@ resource "google_project" "guest_project" { - project_id = "<%= ctx[:vars]['guest_project_id'] %>" - name = "<%= ctx[:vars]['guest_project_name'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "guest_project_id"}}" + name = "{{index $.Vars "guest_project_name"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } resource "google_compute_node_template" "soletenant-tmpl" { - name = "<%= ctx[:vars]['template_name'] %>" + name = "{{index $.Vars "template_name"}}" region = "us-central1" node_type = "n1-node-96-624" } -resource "google_compute_node_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['group_name'] %>" +resource "google_compute_node_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "group_name"}}" zone = "us-central1-f" description = "example google_compute_node_group for Terraform Google Provider" diff --git a/mmv1/templates/terraform/examples/node_template_accelerators.tf.tmpl b/mmv1/templates/terraform/examples/node_template_accelerators.tf.tmpl index 14ba03a8cccd..a2066aa68599 100644 --- a/mmv1/templates/terraform/examples/node_template_accelerators.tf.tmpl +++ b/mmv1/templates/terraform/examples/node_template_accelerators.tf.tmpl @@ -2,8 +2,8 @@ data "google_compute_node_types" "central1a" { zone = "us-central1-a" } -resource "google_compute_node_template" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['template_name'] %>" +resource "google_compute_node_template" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "template_name"}}" region = "us-central1" node_type = "n1-node-96-624" diff --git a/mmv1/templates/terraform/examples/node_template_basic.tf.tmpl b/mmv1/templates/terraform/examples/node_template_basic.tf.tmpl index 4b932196b9b4..44ebd317a9d2 100644 --- a/mmv1/templates/terraform/examples/node_template_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/node_template_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_node_template" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['template_name'] %>" +resource "google_compute_node_template" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "template_name"}}" region = "us-central1" node_type = "n1-node-96-624" } diff --git a/mmv1/templates/terraform/examples/node_template_server_binding.tf.tmpl b/mmv1/templates/terraform/examples/node_template_server_binding.tf.tmpl index 73c71f8699a8..7ffc6c962ab0 100644 --- a/mmv1/templates/terraform/examples/node_template_server_binding.tf.tmpl +++ b/mmv1/templates/terraform/examples/node_template_server_binding.tf.tmpl @@ -2,8 +2,8 @@ data "google_compute_node_types" "central1a" { zone = "us-central1-a" } -resource "google_compute_node_template" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['template_name'] %>" +resource "google_compute_node_template" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "template_name"}}" region = "us-central1" node_type = "n1-node-96-624" diff --git a/mmv1/templates/terraform/examples/notebook_environment_basic.tf.tmpl b/mmv1/templates/terraform/examples/notebook_environment_basic.tf.tmpl index 8dd8727ad866..f9ef4114b963 100644 --- a/mmv1/templates/terraform/examples/notebook_environment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_environment_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_environment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["environment_name"] %>" +resource "google_notebooks_environment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "environment_name"}}" location = "us-west1-a" container_image { repository = "gcr.io/deeplearning-platform-release/base-cpu" diff --git a/mmv1/templates/terraform/examples/notebook_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/notebook_instance_basic.tf.tmpl index 6586b33cf4ea..c3a4e1e94acf 100644 --- a/mmv1/templates/terraform/examples/notebook_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_instance_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-west1-a" machine_type = "e2-medium" vm_image { diff --git a/mmv1/templates/terraform/examples/notebook_instance_basic_container.tf.tmpl b/mmv1/templates/terraform/examples/notebook_instance_basic_container.tf.tmpl index 0d93d9a5a3db..69a2f09a2f31 100644 --- a/mmv1/templates/terraform/examples/notebook_instance_basic_container.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_instance_basic_container.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-west1-a" machine_type = "e2-medium" metadata = { diff --git a/mmv1/templates/terraform/examples/notebook_instance_basic_gpu.tf.tmpl b/mmv1/templates/terraform/examples/notebook_instance_basic_gpu.tf.tmpl index 10ecfea6b54b..00be07fddb1d 100644 --- a/mmv1/templates/terraform/examples/notebook_instance_basic_gpu.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_instance_basic_gpu.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-west1-a" machine_type = "n1-standard-1" // can't be e2 because of accelerator diff --git a/mmv1/templates/terraform/examples/notebook_instance_basic_stopped.tf.tmpl b/mmv1/templates/terraform/examples/notebook_instance_basic_stopped.tf.tmpl index 41130bcca3ef..45b14362e670 100644 --- a/mmv1/templates/terraform/examples/notebook_instance_basic_stopped.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_instance_basic_stopped.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-west1-a" machine_type = "e2-medium" vm_image { diff --git a/mmv1/templates/terraform/examples/notebook_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/notebook_instance_full.tf.tmpl index 31de347bb0c6..930acc42a524 100644 --- a/mmv1/templates/terraform/examples/notebook_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_instance_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_notebooks_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-central1-a" machine_type = "e2-medium" @@ -8,8 +8,8 @@ resource "google_notebooks_instance" "<%= ctx[:primary_resource_id] %>" { image_family = "tf-latest-cpu" } - instance_owners = [ "<%= ctx[:test_env_vars]["service_account"] %>"] - service_account = "<%= ctx[:test_env_vars]["service_account"] %>" + instance_owners = [ "{{index $.TestEnvVars "service_account"}}"] + service_account = "{{index $.TestEnvVars "service_account"}}" install_gpu_driver = true boot_disk_type = "PD_SSD" @@ -38,7 +38,7 @@ resource "google_notebooks_instance" "<%= ctx[:primary_resource_id] %>" { tags = ["foo", "bar"] disk_encryption = "CMEK" - kms_key = "<%= ctx[:vars]['key_name'] %>" + kms_key = "{{index $.Vars "key_name"}}" desired_state = "ACTIVE" } diff --git a/mmv1/templates/terraform/examples/notebook_runtime_basic.tf.tmpl b/mmv1/templates/terraform/examples/notebook_runtime_basic.tf.tmpl index 897d680976dc..a2b6d4811892 100644 --- a/mmv1/templates/terraform/examples/notebook_runtime_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_runtime_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_runtime" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["runtime_name"] %>" +resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "runtime_name"}}" location = "us-central1" access_config { access_type = "SINGLE_USER" diff --git a/mmv1/templates/terraform/examples/notebook_runtime_basic_container.tf.tmpl b/mmv1/templates/terraform/examples/notebook_runtime_basic_container.tf.tmpl index 7967b5c5ea10..bce1ea07d351 100644 --- a/mmv1/templates/terraform/examples/notebook_runtime_basic_container.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_runtime_basic_container.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_runtime" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["runtime_name"] %>" +resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "runtime_name"}}" location = "us-central1" access_config { access_type = "SINGLE_USER" diff --git a/mmv1/templates/terraform/examples/notebook_runtime_basic_gpu.tf.tmpl b/mmv1/templates/terraform/examples/notebook_runtime_basic_gpu.tf.tmpl index 1edbd7af826f..939dbf16c46f 100644 --- a/mmv1/templates/terraform/examples/notebook_runtime_basic_gpu.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_runtime_basic_gpu.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_runtime" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["runtime_name"] %>" +resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "runtime_name"}}" location = "us-central1" access_config { access_type = "SINGLE_USER" diff --git a/mmv1/templates/terraform/examples/notebook_runtime_kernels.tf.tmpl b/mmv1/templates/terraform/examples/notebook_runtime_kernels.tf.tmpl index 1db5a97fe1b8..ca2cbaa4c487 100644 --- a/mmv1/templates/terraform/examples/notebook_runtime_kernels.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_runtime_kernels.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_runtime" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["runtime_name"] %>" +resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "runtime_name"}}" location = "us-central1" access_config { access_type = "SINGLE_USER" diff --git a/mmv1/templates/terraform/examples/notebook_runtime_script.tf.tmpl b/mmv1/templates/terraform/examples/notebook_runtime_script.tf.tmpl index 5dcb7e218896..0e36ed8a0af9 100644 --- a/mmv1/templates/terraform/examples/notebook_runtime_script.tf.tmpl +++ b/mmv1/templates/terraform/examples/notebook_runtime_script.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_notebooks_runtime" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["runtime_name"] %>" +resource "google_notebooks_runtime" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "runtime_name"}}" location = "us-central1" access_config { access_type = "SINGLE_USER" diff --git a/mmv1/templates/terraform/examples/notification_channel_basic.tf.tmpl b/mmv1/templates/terraform/examples/notification_channel_basic.tf.tmpl index 3657de15d68e..e0cc9f49b2e0 100644 --- a/mmv1/templates/terraform/examples/notification_channel_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/notification_channel_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_notification_channel" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["display_name"] %>" +resource "google_monitoring_notification_channel" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" type = "email" labels = { email_address = "fake_email@blahblah.com" diff --git a/mmv1/templates/terraform/examples/notification_channel_sensitive.tf.tmpl b/mmv1/templates/terraform/examples/notification_channel_sensitive.tf.tmpl index 3574eb00d003..35c6e51c35dc 100644 --- a/mmv1/templates/terraform/examples/notification_channel_sensitive.tf.tmpl +++ b/mmv1/templates/terraform/examples/notification_channel_sensitive.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_monitoring_notification_channel" "<%= ctx[:primary_resource_id] %>" { +resource "google_monitoring_notification_channel" "{{$.PrimaryResourceId}}" { display_name = "Test Slack Channel" type = "slack" labels = { diff --git a/mmv1/templates/terraform/examples/only_external_vpn_gateway_full.tf.tmpl b/mmv1/templates/terraform/examples/only_external_vpn_gateway_full.tf.tmpl index 08bde7a9dab8..a687fa867636 100644 --- a/mmv1/templates/terraform/examples/only_external_vpn_gateway_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/only_external_vpn_gateway_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_external_vpn_gateway" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['external_gateway_name'] %>" +resource "google_compute_external_vpn_gateway" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "external_gateway_name"}}" redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT" description = "An externally managed VPN gateway" interface { diff --git a/mmv1/templates/terraform/examples/org_policy_custom_constraint_basic.tf.tmpl b/mmv1/templates/terraform/examples/org_policy_custom_constraint_basic.tf.tmpl index 61a4805230b8..2c231aef13bf 100644 --- a/mmv1/templates/terraform/examples/org_policy_custom_constraint_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/org_policy_custom_constraint_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_org_policy_custom_constraint" "<%= ctx[:primary_resource_id] %>" { +resource "google_org_policy_custom_constraint" "{{$.PrimaryResourceId}}" { - name = "<%= ctx[:vars]['policy_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + name = "{{index $.Vars "policy_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" action_type = "ALLOW" condition = "resource.management.autoUpgrade == false" diff --git a/mmv1/templates/terraform/examples/org_policy_custom_constraint_full.tf.tmpl b/mmv1/templates/terraform/examples/org_policy_custom_constraint_full.tf.tmpl index cf08b9504acd..5d49a61ea126 100644 --- a/mmv1/templates/terraform/examples/org_policy_custom_constraint_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/org_policy_custom_constraint_full.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_org_policy_custom_constraint" "<%= ctx[:primary_resource_id] %>" { +resource "google_org_policy_custom_constraint" "{{$.PrimaryResourceId}}" { - name = "<%= ctx[:vars]['policy_name'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + name = "{{index $.Vars "policy_name"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" display_name = "Disable GKE auto upgrade" description = "Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced." @@ -13,8 +13,8 @@ resource "google_org_policy_custom_constraint" "<%= ctx[:primary_resource_id] %> resource "google_org_policy_policy" "bool" { - name = "organizations/<%= ctx[:test_env_vars]['org_id'] %>/policies/${google_org_policy_custom_constraint.constraint.name}" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + name = "organizations/{{index $.TestEnvVars "org_id"}}/policies/${google_org_policy_custom_constraint.constraint.name}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" spec { rules { diff --git a/mmv1/templates/terraform/examples/organization_access_approval_active_key_version.tf.tmpl b/mmv1/templates/terraform/examples/organization_access_approval_active_key_version.tf.tmpl index 52e8ccab0dbd..629a4195a5be 100644 --- a/mmv1/templates/terraform/examples/organization_access_approval_active_key_version.tf.tmpl +++ b/mmv1/templates/terraform/examples/organization_access_approval_active_key_version.tf.tmpl @@ -1,7 +1,7 @@ resource "google_project" "my_project" { name = "My Project" project_id = "your-project-id" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } @@ -22,7 +22,7 @@ resource "google_kms_crypto_key" "crypto_key" { } data "google_access_approval_organization_service_account" "service_account" { - organization_id = "<%= ctx[:test_env_vars]['org_id'] %>" + organization_id = "{{index $.TestEnvVars "org_id"}}" } resource "google_kms_crypto_key_iam_member" "iam" { @@ -35,8 +35,8 @@ data "google_kms_crypto_key_version" "crypto_key_version" { crypto_key = google_kms_crypto_key.crypto_key.id } -resource "google_organization_access_approval_settings" "<%= ctx[:primary_resource_id] %>" { - organization_id = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_organization_access_approval_settings" "{{$.PrimaryResourceId}}" { + organization_id = "{{index $.TestEnvVars "org_id"}}" active_key_version = data.google_kms_crypto_key_version.crypto_key_version.name enrolled_services { diff --git a/mmv1/templates/terraform/examples/organization_access_approval_full.tf.tmpl b/mmv1/templates/terraform/examples/organization_access_approval_full.tf.tmpl index e2911a265dfe..796f6fed6c23 100644 --- a/mmv1/templates/terraform/examples/organization_access_approval_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/organization_access_approval_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_organization_access_approval_settings" "<%= ctx[:primary_resource_id] %>" { - organization_id = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_organization_access_approval_settings" "{{$.PrimaryResourceId}}" { + organization_id = "{{index $.TestEnvVars "org_id"}}" notification_emails = ["testuser@example.com", "example.user@example.com"] enrolled_services { diff --git a/mmv1/templates/terraform/examples/organization_security_policy_association_basic.tf.tmpl b/mmv1/templates/terraform/examples/organization_security_policy_association_basic.tf.tmpl index dd02a5433776..a8fd86eef059 100644 --- a/mmv1/templates/terraform/examples/organization_security_policy_association_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/organization_security_policy_association_basic.tf.tmpl @@ -1,7 +1,7 @@ resource "google_folder" "security_policy_target" { provider = google-beta display_name = "tf-test-secpol-%{random_suffix}" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" deletion_protection = false } @@ -11,9 +11,9 @@ resource "google_compute_organization_security_policy" "policy" { parent = google_folder.security_policy_target.name } -resource "google_compute_organization_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_organization_security_policy_rule" "{{$.PrimaryResourceId}}" { provider = google-beta - policy_id = google_compute_organization_security_policy.<%= ctx[:primary_resource_id] %>.id + policy_id = google_compute_organization_security_policy.{{$.PrimaryResourceId}}.id action = "allow" direction = "INGRESS" @@ -33,9 +33,9 @@ resource "google_compute_organization_security_policy_rule" "<%= ctx[:primary_re priority = 100 } -resource "google_compute_organization_security_policy_association" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_organization_security_policy_association" "{{$.PrimaryResourceId}}" { provider = google-beta name = "tf-test%{random_suffix}" - attachment_id = google_compute_organization_security_policy.<%= ctx[:primary_resource_id] %>.parent - policy_id = google_compute_organization_security_policy.<%= ctx[:primary_resource_id] %>.id + attachment_id = google_compute_organization_security_policy.{{$.PrimaryResourceId}}.parent + policy_id = google_compute_organization_security_policy.{{$.PrimaryResourceId}}.id } diff --git a/mmv1/templates/terraform/examples/organization_security_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/organization_security_policy_basic.tf.tmpl index 65f8803d059f..7481d667726e 100644 --- a/mmv1/templates/terraform/examples/organization_security_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/organization_security_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_organization_security_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_organization_security_policy" "{{$.PrimaryResourceId}}" { provider = google-beta display_name = "tf-test%{random_suffix}" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" } diff --git a/mmv1/templates/terraform/examples/organization_security_policy_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/organization_security_policy_rule_basic.tf.tmpl index 77109004e888..2e87d6940984 100644 --- a/mmv1/templates/terraform/examples/organization_security_policy_rule_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/organization_security_policy_rule_basic.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_compute_organization_security_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_organization_security_policy" "{{$.PrimaryResourceId}}" { provider = google-beta display_name = "tf-test%{random_suffix}" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" } -resource "google_compute_organization_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_organization_security_policy_rule" "{{$.PrimaryResourceId}}" { provider = google-beta - policy_id = google_compute_organization_security_policy.<%= ctx[:primary_resource_id] %>.id + policy_id = google_compute_organization_security_policy.{{$.PrimaryResourceId}}.id action = "allow" direction = "INGRESS" diff --git a/mmv1/templates/terraform/examples/os_config_guest_policies_basic.tf.tmpl b/mmv1/templates/terraform/examples/os_config_guest_policies_basic.tf.tmpl index f8a13081619d..be07c04eed16 100644 --- a/mmv1/templates/terraform/examples/os_config_guest_policies_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_config_guest_policies_basic.tf.tmpl @@ -6,7 +6,7 @@ data "google_compute_image" "my_image" { resource "google_compute_instance" "foobar" { provider = google-beta - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" zone = "us-central1-a" can_ip_forward = false @@ -27,9 +27,9 @@ resource "google_compute_instance" "foobar" { } } -resource "google_os_config_guest_policies" "<%= ctx[:primary_resource_id] %>" { +resource "google_os_config_guest_policies" "{{$.PrimaryResourceId}}" { provider = google-beta - guest_policy_id = "<%= ctx[:vars]['guest_policy_id'] %>" + guest_policy_id = "{{index $.Vars "guest_policy_id"}}" assignment { instances = [google_compute_instance.foobar.id] diff --git a/mmv1/templates/terraform/examples/os_config_guest_policies_packages.tf.tmpl b/mmv1/templates/terraform/examples/os_config_guest_policies_packages.tf.tmpl index a8fe5e23332b..f844c63adc64 100644 --- a/mmv1/templates/terraform/examples/os_config_guest_policies_packages.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_config_guest_policies_packages.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_os_config_guest_policies" "<%= ctx[:primary_resource_id] %>" { +resource "google_os_config_guest_policies" "{{$.PrimaryResourceId}}" { provider = google-beta - guest_policy_id = "<%= ctx[:vars]['guest_policy_id'] %>" + guest_policy_id = "{{index $.Vars "guest_policy_id"}}" assignment { group_labels { diff --git a/mmv1/templates/terraform/examples/os_config_guest_policies_recipes.tf.tmpl b/mmv1/templates/terraform/examples/os_config_guest_policies_recipes.tf.tmpl index 718ca22a1154..bec9d8fcab2e 100644 --- a/mmv1/templates/terraform/examples/os_config_guest_policies_recipes.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_config_guest_policies_recipes.tf.tmpl @@ -1,17 +1,17 @@ -resource "google_os_config_guest_policies" "<%= ctx[:primary_resource_id] %>" { +resource "google_os_config_guest_policies" "{{$.PrimaryResourceId}}" { provider = google-beta - guest_policy_id = "<%= ctx[:vars]['guest_policy_id'] %>" + guest_policy_id = "{{index $.Vars "guest_policy_id"}}" assignment { zones = ["us-east1-b", "us-east1-d"] } recipes { - name = "<%= ctx[:vars]['guest_policy_id'] %>-recipe" + name = "{{index $.Vars "guest_policy_id"}}-recipe" desired_state = "INSTALLED" artifacts { - id = "<%= ctx[:vars]['guest_policy_id'] %>-artifact-id" + id = "{{index $.Vars "guest_policy_id"}}-artifact-id" gcs { bucket = "my-bucket" @@ -22,7 +22,7 @@ resource "google_os_config_guest_policies" "<%= ctx[:primary_resource_id] %>" { install_steps { msi_installation { - artifact_id = "<%= ctx[:vars]['guest_policy_id'] %>-artifact-id" + artifact_id = "{{index $.Vars "guest_policy_id"}}-artifact-id" } } } diff --git a/mmv1/templates/terraform/examples/os_config_patch_deployment_basic.tf.tmpl b/mmv1/templates/terraform/examples/os_config_patch_deployment_basic.tf.tmpl index d80c0cd9e93f..be12837cd57a 100644 --- a/mmv1/templates/terraform/examples/os_config_patch_deployment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_config_patch_deployment_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_os_config_patch_deployment" "<%= ctx[:primary_resource_id] %>" { - patch_deployment_id = "<%= ctx[:vars]['patch_deployment_id'] %>" +resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { + patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" instance_filter { all = true diff --git a/mmv1/templates/terraform/examples/os_config_patch_deployment_daily.tf.tmpl b/mmv1/templates/terraform/examples/os_config_patch_deployment_daily.tf.tmpl index 7ee009d374aa..46697c651a88 100644 --- a/mmv1/templates/terraform/examples/os_config_patch_deployment_daily.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_config_patch_deployment_daily.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_os_config_patch_deployment" "<%= ctx[:primary_resource_id] %>" { - patch_deployment_id = "<%= ctx[:vars]['patch_deployment_id'] %>" +resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { + patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" instance_filter { all = true diff --git a/mmv1/templates/terraform/examples/os_config_patch_deployment_daily_midnight.tf.tmpl b/mmv1/templates/terraform/examples/os_config_patch_deployment_daily_midnight.tf.tmpl index 3794ce1bd714..e1645921b46d 100644 --- a/mmv1/templates/terraform/examples/os_config_patch_deployment_daily_midnight.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_config_patch_deployment_daily_midnight.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_os_config_patch_deployment" "<%= ctx[:primary_resource_id] %>" { - patch_deployment_id = "<%= ctx[:vars]['patch_deployment_id'] %>" +resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { + patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" instance_filter { all = true diff --git a/mmv1/templates/terraform/examples/os_config_patch_deployment_full.tf.tmpl b/mmv1/templates/terraform/examples/os_config_patch_deployment_full.tf.tmpl index fa8db9e11d16..a4457437bbf5 100644 --- a/mmv1/templates/terraform/examples/os_config_patch_deployment_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_config_patch_deployment_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_os_config_patch_deployment" "<%= ctx[:primary_resource_id] %>" { - patch_deployment_id = "<%= ctx[:vars]['patch_deployment_id'] %>" +resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { + patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" instance_filter { group_labels { diff --git a/mmv1/templates/terraform/examples/os_config_patch_deployment_instance.tf.tmpl b/mmv1/templates/terraform/examples/os_config_patch_deployment_instance.tf.tmpl index d69f76761628..086ff1b7962c 100644 --- a/mmv1/templates/terraform/examples/os_config_patch_deployment_instance.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_config_patch_deployment_instance.tf.tmpl @@ -4,7 +4,7 @@ data "google_compute_image" "my_image" { } resource "google_compute_instance" "foobar" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" zone = "us-central1-a" can_ip_forward = false @@ -25,8 +25,8 @@ resource "google_compute_instance" "foobar" { } } -resource "google_os_config_patch_deployment" "<%= ctx[:primary_resource_id] %>" { - patch_deployment_id = "<%= ctx[:vars]['patch_deployment_id'] %>" +resource "google_os_config_patch_deployment" "{{$.PrimaryResourceId}}" { + patch_deployment_id = "{{index $.Vars "patch_deployment_id"}}" instance_filter { instances = [google_compute_instance.foobar.id] diff --git a/mmv1/templates/terraform/examples/os_login_ssh_key_basic.tf.tmpl b/mmv1/templates/terraform/examples/os_login_ssh_key_basic.tf.tmpl index 454cee64f0f7..48ac4dc7ae7c 100644 --- a/mmv1/templates/terraform/examples/os_login_ssh_key_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/os_login_ssh_key_basic.tf.tmpl @@ -1,7 +1,7 @@ data "google_client_openid_userinfo" "me" { } -resource "google_os_login_ssh_public_key" "<%= ctx[:primary_resource_id] %>" { +resource "google_os_login_ssh_public_key" "{{$.PrimaryResourceId}}" { user = data.google_client_openid_userinfo.me.email key = file("path/to/id_rsa.pub") } diff --git a/mmv1/templates/terraform/examples/parallelstore_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/parallelstore_instance_basic.tf.tmpl index 0c61106bd1bd..a7f67c16d9d3 100644 --- a/mmv1/templates/terraform/examples/parallelstore_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/parallelstore_instance_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_parallelstore_instance" "<%= ctx[:primary_resource_id] %>" { - instance_id = "<%= ctx[:vars]['name'] %>" +resource "google_parallelstore_instance" "{{$.PrimaryResourceId}}" { + instance_id = "{{index $.Vars "name"}}" location = "us-central1-a" description = "test instance" capacity_gib = 12000 @@ -14,7 +14,7 @@ resource "google_parallelstore_instance" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = true mtu = 8896 provider = google-beta @@ -22,7 +22,7 @@ resource "google_compute_network" "network" { # Create an IP address resource "google_compute_global_address" "private_ip_alloc" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 24 diff --git a/mmv1/templates/terraform/examples/preference_set_basic.tf.tmpl b/mmv1/templates/terraform/examples/preference_set_basic.tf.tmpl index ebe5c10263fa..530190fb0253 100644 --- a/mmv1/templates/terraform/examples/preference_set_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/preference_set_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_migration_center_preference_set" "<%= ctx[:primary_resource_id] %>" { +resource "google_migration_center_preference_set" "{{$.PrimaryResourceId}}" { location = "us-central1" - preference_set_id = "<%= ctx[:vars]['set_name'] %>" + preference_set_id = "{{index $.Vars "set_name"}}" description = "Terraform integration test description" display_name = "Terraform integration test display" virtual_machine_preferences { diff --git a/mmv1/templates/terraform/examples/preference_set_full.tf.tmpl b/mmv1/templates/terraform/examples/preference_set_full.tf.tmpl index 61acf00f5540..83703c9b4f64 100644 --- a/mmv1/templates/terraform/examples/preference_set_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/preference_set_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_migration_center_preference_set" "<%= ctx[:primary_resource_id] %>" { +resource "google_migration_center_preference_set" "{{$.PrimaryResourceId}}" { location = "us-central1" - preference_set_id = "<%= ctx[:vars]['set_name'] %>" + preference_set_id = "{{index $.Vars "set_name"}}" description = "Terraform integration test description" display_name = "Terraform integration test display" virtual_machine_preferences { diff --git a/mmv1/templates/terraform/examples/private_service_connect_google_apis.tf.tmpl b/mmv1/templates/terraform/examples/private_service_connect_google_apis.tf.tmpl index 33a0bfc10783..7434666761aa 100644 --- a/mmv1/templates/terraform/examples/private_service_connect_google_apis.tf.tmpl +++ b/mmv1/templates/terraform/examples/private_service_connect_google_apis.tf.tmpl @@ -1,14 +1,14 @@ resource "google_compute_network" "network" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project'] %>" - name = "<%= ctx[:vars]['network_name'] %>" + project = "{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "vpc_subnetwork" { provider = google-beta project = google_compute_network.network.project - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.2.0.0/16" region = "us-central1" network = google_compute_network.network.id @@ -18,7 +18,7 @@ resource "google_compute_subnetwork" "vpc_subnetwork" { resource "google_compute_global_address" "default" { provider = google-beta project = google_compute_network.network.project - name = "<%= ctx[:vars]['global_address_name'] %>" + name = "{{index $.Vars "global_address_name"}}" address_type = "INTERNAL" purpose = "PRIVATE_SERVICE_CONNECT" network = google_compute_network.network.id @@ -28,7 +28,7 @@ resource "google_compute_global_address" "default" { resource "google_compute_global_forwarding_rule" "default" { provider = google-beta project = google_compute_network.network.project - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" target = "all-apis" network = google_compute_network.network.id ip_address = google_compute_global_address.default.id diff --git a/mmv1/templates/terraform/examples/private_service_connect_google_apis_no_automate_dns.tf.tmpl b/mmv1/templates/terraform/examples/private_service_connect_google_apis_no_automate_dns.tf.tmpl index 4d8276eafb59..182ce72e366c 100644 --- a/mmv1/templates/terraform/examples/private_service_connect_google_apis_no_automate_dns.tf.tmpl +++ b/mmv1/templates/terraform/examples/private_service_connect_google_apis_no_automate_dns.tf.tmpl @@ -1,14 +1,14 @@ resource "google_compute_network" "network" { provider = google-beta - project = "<%= ctx[:test_env_vars]['project'] %>" - name = "<%= ctx[:vars]['network_name'] %>" + project = "{{index $.TestEnvVars "project"}}" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "vpc_subnetwork" { provider = google-beta project = google_compute_network.network.project - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.2.0.0/16" region = "us-central1" network = google_compute_network.network.id @@ -18,7 +18,7 @@ resource "google_compute_subnetwork" "vpc_subnetwork" { resource "google_compute_global_address" "default" { provider = google-beta project = google_compute_network.network.project - name = "<%= ctx[:vars]['global_address_name'] %>" + name = "{{index $.Vars "global_address_name"}}" address_type = "INTERNAL" purpose = "PRIVATE_SERVICE_CONNECT" network = google_compute_network.network.id @@ -28,7 +28,7 @@ resource "google_compute_global_address" "default" { resource "google_compute_global_forwarding_rule" "default" { provider = google-beta project = google_compute_network.network.project - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" target = "all-apis" network = google_compute_network.network.id ip_address = google_compute_global_address.default.id diff --git a/mmv1/templates/terraform/examples/privateca_capool_all_fields.tf.tmpl b/mmv1/templates/terraform/examples/privateca_capool_all_fields.tf.tmpl index bbc6dd4ccb45..1fce3dc083ef 100644 --- a/mmv1/templates/terraform/examples/privateca_capool_all_fields.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_capool_all_fields.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_privateca_ca_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_privateca_ca_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" tier = "ENTERPRISE" publishing_options { diff --git a/mmv1/templates/terraform/examples/privateca_capool_basic.tf.tmpl b/mmv1/templates/terraform/examples/privateca_capool_basic.tf.tmpl index 5c64b66dc306..c5f76a407a83 100644 --- a/mmv1/templates/terraform/examples/privateca_capool_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_capool_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_privateca_ca_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_privateca_ca_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" tier = "ENTERPRISE" publishing_options { diff --git a/mmv1/templates/terraform/examples/privateca_certificate_authority_basic.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_authority_basic.tf.tmpl index 8a0bc4b6e59a..82e718a57170 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_authority_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_authority_basic.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_privateca_certificate_authority" "<%= ctx[:primary_resource_id] %>" { +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 = "<%= ctx[:vars]["pool_name"] %>" - certificate_authority_id = "<%= ctx[:vars]["certificate_authority_id"] %>" - location = "<%= ctx[:vars]["pool_location"] %>" - deletion_protection = "<%= ctx[:vars]["deletion_protection"] %>" + 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 { diff --git a/mmv1/templates/terraform/examples/privateca_certificate_authority_byo_key.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_authority_byo_key.tf.tmpl index 765d92780bcc..5007897394c7 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_authority_byo_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_authority_byo_key.tf.tmpl @@ -3,27 +3,27 @@ resource "google_project_service_identity" "privateca_sa" { } resource "google_kms_crypto_key_iam_member" "privateca_sa_keyuser_signerverifier" { - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.signerVerifier" member = google_project_service_identity.privateca_sa.member } resource "google_kms_crypto_key_iam_member" "privateca_sa_keyuser_viewer" { - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/viewer" member = google_project_service_identity.privateca_sa.member } -resource "google_privateca_certificate_authority" "<%= ctx[:primary_resource_id] %>" { +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 = "<%= ctx[:vars]["pool_name"] %>" - certificate_authority_id = "<%= ctx[:vars]["certificate_authority_id"] %>" - location = "<%= ctx[:vars]["pool_location"] %>" - deletion_protection = "<%= ctx[:vars]["deletion_protection"] %>" + pool = "{{index $.Vars "pool_name"}}" + certificate_authority_id = "{{index $.Vars "certificate_authority_id"}}" + location = "{{index $.Vars "pool_location"}}" + deletion_protection = "{{index $.Vars "deletion_protection"}}" key_spec { - cloud_kms_key_version = "<%= ctx[:vars]['kms_key_name'] %>/cryptoKeyVersions/1" + cloud_kms_key_version = "{{index $.Vars "kms_key_name"}}/cryptoKeyVersions/1" } config { diff --git a/mmv1/templates/terraform/examples/privateca_certificate_authority_custom_ski.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_authority_custom_ski.tf.tmpl index b734f094c82e..6e898ab25e80 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_authority_custom_ski.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_authority_custom_ski.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_privateca_certificate_authority" "<%= ctx[:primary_resource_id] %>" { +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 = "<%= ctx[:vars]["pool_name"] %>" - certificate_authority_id = "<%= ctx[:vars]["certificate_authority_id"] %>" - location = "<%= ctx[:vars]["pool_location"] %>" - deletion_protection = "<%= ctx[:vars]["deletion_protection"] %>" + 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 { @@ -46,6 +46,6 @@ resource "google_privateca_certificate_authority" "<%= ctx[:primary_resource_id] } lifetime = "86400s" key_spec { - cloud_kms_key_version = "<%= ctx[:vars]["kms_key_name"] %>/cryptoKeyVersions/1" + cloud_kms_key_version = "{{index $.Vars "kms_key_name"}}/cryptoKeyVersions/1" } } diff --git a/mmv1/templates/terraform/examples/privateca_certificate_authority_subordinate.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_authority_subordinate.tf.tmpl index e664f695ec17..f468ba2d74b3 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_authority_subordinate.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_authority_subordinate.tf.tmpl @@ -1,6 +1,6 @@ resource "google_privateca_certificate_authority" "root-ca" { - pool = "<%= ctx[:vars]["pool_name"] %>" - certificate_authority_id = "<%= ctx[:vars]["certificate_authority_id"] %>-root" + pool = "{{index $.Vars "pool_name"}}" + certificate_authority_id = "{{index $.Vars "certificate_authority_id"}}-root" location = "us-central1" config { subject_config { @@ -39,13 +39,13 @@ resource "google_privateca_certificate_authority" "root-ca" { ignore_active_certificates_on_deletion = true } -resource "google_privateca_certificate_authority" "<%= ctx[:primary_resource_id] %>" { +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 = "<%= ctx[:vars]["pool_name"] %>" - certificate_authority_id = "<%= ctx[:vars]["certificate_authority_id"] %>-sub" - location = "<%= ctx[:vars]["pool_location"] %>" - deletion_protection = "<%= ctx[:vars]["deletion_protection"] %>" + pool = "{{index $.Vars "pool_name"}}" + certificate_authority_id = "{{index $.Vars "certificate_authority_id"}}-sub" + location = "{{index $.Vars "pool_location"}}" + deletion_protection = "{{index $.Vars "deletion_protection"}}" subordinate_config { certificate_authority = google_privateca_certificate_authority.root-ca.name } diff --git a/mmv1/templates/terraform/examples/privateca_certificate_config.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_config.tf.tmpl index a1195e873264..fb81cda6f900 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_config.tf.tmpl @@ -1,7 +1,7 @@ resource "google_privateca_ca_pool" "default" { location = "us-central1" - name = "<%= ctx[:vars]["ca_pool_id"] %>" + name = "{{index $.Vars "ca_pool_id"}}" tier = "ENTERPRISE" } @@ -44,12 +44,12 @@ resource "google_privateca_certificate_authority" "default" { ignore_active_certificates_on_deletion = true } -resource "google_privateca_certificate" "<%= ctx[:primary_resource_id] %>" { +resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { location = "us-central1" pool = google_privateca_ca_pool.default.name certificate_authority = google_privateca_certificate_authority.default.certificate_authority_id lifetime = "86000s" - name = "<%= ctx[:vars]["certificate_name"] %>" + name = "{{index $.Vars "certificate_name"}}" config { subject_config { subject { diff --git a/mmv1/templates/terraform/examples/privateca_certificate_csr.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_csr.tf.tmpl index 49968b90cf73..e2357245e0b8 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_csr.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_csr.tf.tmpl @@ -1,6 +1,6 @@ resource "google_privateca_ca_pool" "default" { location = "us-central1" - name = "<%= ctx[:vars]["ca_pool_id"] %>" + name = "{{index $.Vars "ca_pool_id"}}" tier = "ENTERPRISE" } @@ -46,11 +46,11 @@ resource "google_privateca_certificate_authority" "default" { } -resource "google_privateca_certificate" "<%= ctx[:primary_resource_id] %>" { +resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { location = "us-central1" pool = google_privateca_ca_pool.default.name certificate_authority = google_privateca_certificate_authority.default.certificate_authority_id - name = "<%= ctx[:vars]["certificate_name"] %>" + name = "{{index $.Vars "certificate_name"}}" lifetime = "860s" pem_csr = file("test-fixtures/rsa_csr.pem") } diff --git a/mmv1/templates/terraform/examples/privateca_certificate_custom_ski.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_custom_ski.tf.tmpl index df01c2b40205..81d37cec8816 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_custom_ski.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_custom_ski.tf.tmpl @@ -1,6 +1,6 @@ resource "google_privateca_ca_pool" "default" { location = "us-central1" - name = "<%= ctx[:vars]["ca_pool_id"] %>" + name = "{{index $.Vars "ca_pool_id"}}" tier = "ENTERPRISE" } @@ -46,10 +46,10 @@ resource "google_privateca_certificate_authority" "default" { } -resource "google_privateca_certificate" "<%= ctx[:primary_resource_id] %>" { +resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { location = "us-central1" pool = google_privateca_ca_pool.default.name - name = "<%= ctx[:vars]["certificate_name"] %>" + name = "{{index $.Vars "certificate_name"}}" lifetime = "860s" config { subject_config { diff --git a/mmv1/templates/terraform/examples/privateca_certificate_generated_key.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_generated_key.tf.tmpl index 23d870239f9f..7ef4fdedd780 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_generated_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_generated_key.tf.tmpl @@ -47,7 +47,7 @@ resource "tls_private_key" "cert_key" { algorithm = "RSA" } -resource "google_privateca_certificate" "<%= ctx[:primary_resource_id] %>" { +resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { location = "us-central1" pool = google_privateca_ca_pool.default.name certificate_authority = google_privateca_certificate_authority.default.certificate_authority_id diff --git a/mmv1/templates/terraform/examples/privateca_certificate_no_authority.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_no_authority.tf.tmpl index 73b985a7c551..d09d2d1f7913 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_no_authority.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_no_authority.tf.tmpl @@ -1,6 +1,6 @@ resource "google_privateca_ca_pool" "default" { location = "us-central1" - name = "<%= ctx[:vars]["ca_pool_id"] %>" + name = "{{index $.Vars "ca_pool_id"}}" tier = "ENTERPRISE" } @@ -46,10 +46,10 @@ resource "google_privateca_certificate_authority" "default" { } -resource "google_privateca_certificate" "<%= ctx[:primary_resource_id] %>" { +resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { location = "us-central1" pool = google_privateca_ca_pool.default.name - name = "<%= ctx[:vars]["certificate_name"] %>" + name = "{{index $.Vars "certificate_name"}}" lifetime = "860s" config { subject_config { diff --git a/mmv1/templates/terraform/examples/privateca_certificate_with_template.tf.tmpl b/mmv1/templates/terraform/examples/privateca_certificate_with_template.tf.tmpl index 34f46e4deb0b..9d18151adbf7 100644 --- a/mmv1/templates/terraform/examples/privateca_certificate_with_template.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_certificate_with_template.tf.tmpl @@ -1,12 +1,12 @@ resource "google_privateca_ca_pool" "default" { location = "us-central1" - name = "<%= ctx[:vars]["ca_pool_id"] %>" + name = "{{index $.Vars "ca_pool_id"}}" tier = "ENTERPRISE" } resource "google_privateca_certificate_template" "default" { location = "us-central1" - name = "<%= ctx[:vars]["certificate_template_name"] %>" + name = "{{index $.Vars "certificate_template_name"}}" description = "An updated sample certificate template" identity_constraints { @@ -121,11 +121,11 @@ resource "google_privateca_certificate_authority" "default" { } -resource "google_privateca_certificate" "<%= ctx[:primary_resource_id] %>" { +resource "google_privateca_certificate" "{{$.PrimaryResourceId}}" { location = "us-central1" pool = google_privateca_ca_pool.default.name certificate_authority = google_privateca_certificate_authority.default.certificate_authority_id - name = "<%= ctx[:vars]["certificate_name"] %>" + name = "{{index $.Vars "certificate_name"}}" lifetime = "860s" pem_csr = file("test-fixtures/rsa_csr.pem") certificate_template = google_privateca_certificate_template.default.id diff --git a/mmv1/templates/terraform/examples/privateca_quickstart.tf.tmpl b/mmv1/templates/terraform/examples/privateca_quickstart.tf.tmpl index 4fdd1504e837..9f4328102c52 100644 --- a/mmv1/templates/terraform/examples/privateca_quickstart.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_quickstart.tf.tmpl @@ -15,8 +15,8 @@ resource "tls_cert_request" "example" { } } -resource "google_privateca_ca_pool" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['my_ca_pool'] %>" +resource "google_privateca_ca_pool" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "my_ca_pool"}}" location = "us-central1" tier = "ENTERPRISE" project = "project-id" @@ -90,6 +90,6 @@ resource "google_privateca_certificate" "default" { project = "project-id" location = "us-central1" lifetime = "860s" - name = "<%= ctx[:vars]['my_certificate'] %>" + name = "{{index $.Vars "my_certificate"}}" pem_csr = tls_cert_request.example.cert_request_pem } diff --git a/mmv1/templates/terraform/examples/privateca_template_basic.tf.tmpl b/mmv1/templates/terraform/examples/privateca_template_basic.tf.tmpl index d9e29702a91c..0661224a55fa 100644 --- a/mmv1/templates/terraform/examples/privateca_template_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/privateca_template_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_privateca_certificate_template" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["name"] %>" +resource "google_privateca_certificate_template" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "us-central1" description = "A sample certificate template" diff --git a/mmv1/templates/terraform/examples/privileged_access_manager_entitlement_basic.tf.tmpl b/mmv1/templates/terraform/examples/privileged_access_manager_entitlement_basic.tf.tmpl index 530f1f987f67..53ee637bbca4 100644 --- a/mmv1/templates/terraform/examples/privileged_access_manager_entitlement_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/privileged_access_manager_entitlement_basic.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_privileged_access_manager_entitlement" "<%= ctx[:primary_resource_id] %>" { - entitlement_id = "<%= ctx[:vars]['entitlement_id'] %>" +resource "google_privileged_access_manager_entitlement" "{{$.PrimaryResourceId}}" { + entitlement_id = "{{index $.Vars "entitlement_id"}}" location = "global" max_request_duration = "43200s" - parent = "projects/<%= ctx[:test_env_vars]['project'] %>" + parent = "projects/{{index $.TestEnvVars "project"}}" requester_justification_config { unstructured{} } @@ -17,7 +17,7 @@ resource "google_privileged_access_manager_entitlement" "<%= ctx[:primary_resour role = "roles/storage.admin" condition_expression = "request.time < timestamp(\"2024-04-23T18:30:00.000Z\")" } - resource = "//cloudresourcemanager.googleapis.com/projects/<%= ctx[:test_env_vars]['project'] %>" + resource = "//cloudresourcemanager.googleapis.com/projects/{{index $.TestEnvVars "project"}}" resource_type = "cloudresourcemanager.googleapis.com/Project" } } diff --git a/mmv1/templates/terraform/examples/project_access_approval_active_key_version.tf.tmpl b/mmv1/templates/terraform/examples/project_access_approval_active_key_version.tf.tmpl index 7230464e2161..bf616dd04995 100644 --- a/mmv1/templates/terraform/examples/project_access_approval_active_key_version.tf.tmpl +++ b/mmv1/templates/terraform/examples/project_access_approval_active_key_version.tf.tmpl @@ -1,7 +1,7 @@ resource "google_kms_key_ring" "key_ring" { name = "key-ring" location = "global" - project = "<%= ctx[:test_env_vars]['project'] %>" + project = "{{index $.TestEnvVars "project"}}" } resource "google_kms_crypto_key" "crypto_key" { @@ -15,7 +15,7 @@ resource "google_kms_crypto_key" "crypto_key" { } data "google_access_approval_project_service_account" "service_account" { - project_id = "<%= ctx[:test_env_vars]['project'] %>" + project_id = "{{index $.TestEnvVars "project"}}" } resource "google_kms_crypto_key_iam_member" "iam" { @@ -28,8 +28,8 @@ data "google_kms_crypto_key_version" "crypto_key_version" { crypto_key = google_kms_crypto_key.crypto_key.id } -resource "google_project_access_approval_settings" "<%= ctx[:primary_resource_id] %>" { - project_id = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_project_access_approval_settings" "{{$.PrimaryResourceId}}" { + project_id = "{{index $.TestEnvVars "project"}}" active_key_version = data.google_kms_crypto_key_version.crypto_key_version.name enrolled_services { diff --git a/mmv1/templates/terraform/examples/project_access_approval_full.tf.tmpl b/mmv1/templates/terraform/examples/project_access_approval_full.tf.tmpl index b6d117629f05..68851cffc7e3 100644 --- a/mmv1/templates/terraform/examples/project_access_approval_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/project_access_approval_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_project_access_approval_settings" "<%= ctx[:primary_resource_id] %>" { - project_id = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_project_access_approval_settings" "{{$.PrimaryResourceId}}" { + project_id = "{{index $.TestEnvVars "project"}}" notification_emails = ["testuser@example.com", "example.user@example.com"] enrolled_services { diff --git a/mmv1/templates/terraform/examples/public_advertised_prefixes_basic.tf.tmpl b/mmv1/templates/terraform/examples/public_advertised_prefixes_basic.tf.tmpl index 8660344ed64f..a9f888e5edd4 100644 --- a/mmv1/templates/terraform/examples/public_advertised_prefixes_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/public_advertised_prefixes_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_public_advertised_prefix" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['prefixes_name'] %>" - description = "<%= ctx[:test_env_vars]['desc'] %>" +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" } diff --git a/mmv1/templates/terraform/examples/public_ca_external_account_key.tf.tmpl b/mmv1/templates/terraform/examples/public_ca_external_account_key.tf.tmpl index f0515bd5b89e..5f0510e28c4c 100644 --- a/mmv1/templates/terraform/examples/public_ca_external_account_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/public_ca_external_account_key.tf.tmpl @@ -1,3 +1,3 @@ -resource "google_public_ca_external_account_key" "<%= ctx[:primary_resource_id] %>" { - project = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_public_ca_external_account_key" "{{$.PrimaryResourceId}}" { + project = "{{index $.TestEnvVars "project"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/public_delegated_prefixes_basic.tf.tmpl b/mmv1/templates/terraform/examples/public_delegated_prefixes_basic.tf.tmpl index ec382f723627..b878e52d00bd 100644 --- a/mmv1/templates/terraform/examples/public_delegated_prefixes_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/public_delegated_prefixes_basic.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_public_advertised_prefix" "advertised" { - name = "<%= ctx[:vars]['prefixes_name'] %>" - description = "<%= ctx[:test_env_vars]['desc'] %>" + name = "{{index $.Vars "prefixes_name"}}" + description = "{{index $.TestEnvVars "desc"}}" dns_verification_ip = "127.127.0.0" ip_cidr_range = "127.127.0.0/16" } -resource "google_compute_public_delegated_prefix" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['prefixes_name'] %>" +resource "google_compute_public_delegated_prefix" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "prefixes_name"}}" region = "us-central1" description = "my description" ip_cidr_range = "127.127.0.0/24" diff --git a/mmv1/templates/terraform/examples/pubsub_lite_reservation_basic.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_lite_reservation_basic.tf.tmpl index ad6ae89bd99b..f4fcccaf1247 100644 --- a/mmv1/templates/terraform/examples/pubsub_lite_reservation_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_lite_reservation_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_pubsub_lite_reservation" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['reservation_name'] %>" +resource "google_pubsub_lite_reservation" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "reservation_name"}}" project = data.google_project.project.number throughput_capacity = 2 } diff --git a/mmv1/templates/terraform/examples/pubsub_lite_subscription_basic.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_lite_subscription_basic.tf.tmpl index 77df23802b90..b643cd9e3054 100644 --- a/mmv1/templates/terraform/examples/pubsub_lite_subscription_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_lite_subscription_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_pubsub_lite_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_lite_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" project = data.google_project.project.number partition_config { count = 1 @@ -14,9 +14,9 @@ resource "google_pubsub_lite_topic" "<%= ctx[:primary_resource_id] %>" { } } -resource "google_pubsub_lite_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_lite_topic.<%= ctx[:primary_resource_id] %>.name +resource "google_pubsub_lite_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_lite_topic.{{$.PrimaryResourceId}}.name delivery_config { delivery_requirement = "DELIVER_AFTER_STORED" } diff --git a/mmv1/templates/terraform/examples/pubsub_lite_topic_basic.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_lite_topic_basic.tf.tmpl index 7a534e999760..9f110257f7d7 100644 --- a/mmv1/templates/terraform/examples/pubsub_lite_topic_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_lite_topic_basic.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_pubsub_lite_reservation" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['reservation_name'] %>" +resource "google_pubsub_lite_reservation" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "reservation_name"}}" project = data.google_project.project.number throughput_capacity = 2 } -resource "google_pubsub_lite_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_lite_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" project = data.google_project.project.number partition_config { @@ -21,7 +21,7 @@ resource "google_pubsub_lite_topic" "<%= ctx[:primary_resource_id] %>" { } reservation_config { - throughput_reservation = google_pubsub_lite_reservation.<%= ctx[:primary_resource_id] %>.name + throughput_reservation = google_pubsub_lite_reservation.{{$.PrimaryResourceId}}.name } } diff --git a/mmv1/templates/terraform/examples/pubsub_schema_basic.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_schema_basic.tf.tmpl index 520cb4550f0b..3f73ddde3899 100644 --- a/mmv1/templates/terraform/examples/pubsub_schema_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_schema_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_pubsub_schema" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['schema_name'] %>" +resource "google_pubsub_schema" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "schema_name"}}" type = "AVRO" definition = "{\n \"type\" : \"record\",\n \"name\" : \"Avro\",\n \"fields\" : [\n {\n \"name\" : \"StringField\",\n \"type\" : \"string\"\n },\n {\n \"name\" : \"IntField\",\n \"type\" : \"int\"\n }\n ]\n}\n" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/pubsub_schema_protobuf.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_schema_protobuf.tf.tmpl index ff08adc95f69..42a4a0413f32 100644 --- a/mmv1/templates/terraform/examples/pubsub_schema_protobuf.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_schema_protobuf.tf.tmpl @@ -1,15 +1,15 @@ -resource "google_pubsub_schema" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['schema_name'] %>" +resource "google_pubsub_schema" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "schema_name"}}" type = "PROTOCOL_BUFFER" definition = "syntax = \"proto3\";\nmessage Results {\nstring message_request = 1;\nstring message_response = 2;\nstring timestamp_request = 3;\nstring timestamp_response = 4;\n}" } resource "google_pubsub_topic" "example" { - name = "<%= ctx[:vars]['schema_name'] %>-topic" + name = "{{index $.Vars "schema_name"}}-topic" - depends_on = [google_pubsub_schema.<%= ctx[:primary_resource_id] %>] + depends_on = [google_pubsub_schema.{{$.PrimaryResourceId}}] schema_settings { - schema = "projects/<%= ctx[:test_env_vars]['project_name'] %>/schemas/<%= ctx[:vars]['schema_name'] %>" + schema = "projects/{{index $.TestEnvVars "project_name"}}/schemas/{{index $.Vars "schema_name"}}" encoding = "JSON" } } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/pubsub_subscription_dead_letter.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_subscription_dead_letter.tf.tmpl index f5b66321767d..f8de6d6db178 100644 --- a/mmv1/templates/terraform/examples/pubsub_subscription_dead_letter.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_subscription_dead_letter.tf.tmpl @@ -1,17 +1,17 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>_dead_letter" { - name = "<%= ctx[:vars]['topic_name'] %>-dead-letter" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}_dead_letter" { + name = "{{index $.Vars "topic_name"}}-dead-letter" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id dead_letter_policy { - dead_letter_topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>_dead_letter.id + dead_letter_topic = google_pubsub_topic.{{$.PrimaryResourceId}}_dead_letter.id max_delivery_attempts = 10 } } diff --git a/mmv1/templates/terraform/examples/pubsub_subscription_pull.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_subscription_pull.tf.tmpl index 7daa29c14275..952b5b47477b 100644 --- a/mmv1/templates/terraform/examples/pubsub_subscription_pull.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_subscription_pull.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id labels = { foo = "bar" diff --git a/mmv1/templates/terraform/examples/pubsub_subscription_pull_filter.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_subscription_pull_filter.tf.tmpl index 48131724792a..d9a9198e1a4b 100644 --- a/mmv1/templates/terraform/examples/pubsub_subscription_pull_filter.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_subscription_pull_filter.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id labels = { foo = "bar" diff --git a/mmv1/templates/terraform/examples/pubsub_subscription_push.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_subscription_push.tf.tmpl index 631f19321888..8b28ffe0a8ba 100644 --- a/mmv1/templates/terraform/examples/pubsub_subscription_push.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_subscription_push.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id ack_deadline_seconds = 20 diff --git a/mmv1/templates/terraform/examples/pubsub_subscription_push_bq.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_subscription_push_bq.tf.tmpl index 77866e8e0b65..644231041216 100644 --- a/mmv1/templates/terraform/examples/pubsub_subscription_push_bq.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_subscription_push_bq.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id bigquery_config { table = "${google_bigquery_table.test.project}.${google_bigquery_table.test.dataset_id}.${google_bigquery_table.test.table_id}" @@ -29,12 +29,12 @@ resource "google_project_iam_member" "editor" { } resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_table" "test" { deletion_protection = false - table_id = "<%= ctx[:vars]['table_id'] %>" + table_id = "{{index $.Vars "table_id"}}" dataset_id = google_bigquery_dataset.test.dataset_id schema = <" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id bigquery_config { table = "${google_bigquery_table.test.project}.${google_bigquery_table.test.dataset_id}.${google_bigquery_table.test.table_id}" @@ -18,7 +18,7 @@ data "google_project" "project" { } resource "google_service_account" "bq_write_service_account" { - account_id = "<%= ctx[:vars]['service_account_id'] %>" + account_id = "{{index $.Vars "service_account_id"}}" display_name = "BQ Write Service Account" } @@ -35,12 +35,12 @@ resource "google_project_iam_member" "editor" { } resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_table" "test" { deletion_protection = false - table_id = "<%= ctx[:vars]['table_id'] %>" + table_id = "{{index $.Vars "table_id"}}" dataset_id = google_bigquery_dataset.test.dataset_id schema = <" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id bigquery_config { table = "${google_bigquery_table.test.project}.${google_bigquery_table.test.dataset_id}.${google_bigquery_table.test.table_id}" @@ -30,12 +30,12 @@ resource "google_project_iam_member" "editor" { } resource "google_bigquery_dataset" "test" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" } resource "google_bigquery_table" "test" { deletion_protection = false - table_id = "<%= ctx[:vars]['table_id'] %>" + table_id = "{{index $.Vars "table_id"}}" dataset_id = google_bigquery_dataset.test.dataset_id schema = <" { - name = "<%= ctx[:vars]['bucket_name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "bucket_name"}}" location = "US" uniform_bucket_level_access = true } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id cloud_storage_config { - bucket = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket = google_storage_bucket.{{$.PrimaryResourceId}}.name filename_prefix = "pre-" filename_suffix = "-%{random_suffix}" @@ -24,7 +24,7 @@ resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { max_messages = 1000 } depends_on = [ - google_storage_bucket.<%= ctx[:primary_resource_id] %>, + google_storage_bucket.{{$.PrimaryResourceId}}, google_storage_bucket_iam_member.admin, ] } @@ -33,7 +33,7 @@ data "google_project" "project" { } resource "google_storage_bucket_iam_member" "admin" { - bucket = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket = google_storage_bucket.{{$.PrimaryResourceId}}.name role = "roles/storage.admin" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-pubsub.iam.gserviceaccount.com" } diff --git a/mmv1/templates/terraform/examples/pubsub_subscription_push_cloudstorage_avro.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_subscription_push_cloudstorage_avro.tf.tmpl index 3a61c489517e..076588819af1 100644 --- a/mmv1/templates/terraform/examples/pubsub_subscription_push_cloudstorage_avro.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_subscription_push_cloudstorage_avro.tf.tmpl @@ -1,19 +1,19 @@ -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['bucket_name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "bucket_name"}}" location = "US" uniform_bucket_level_access = true } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id cloud_storage_config { - bucket = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket = google_storage_bucket.{{$.PrimaryResourceId}}.name filename_prefix = "pre-" filename_suffix = "-%{random_suffix}" @@ -29,7 +29,7 @@ resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { } } depends_on = [ - google_storage_bucket.<%= ctx[:primary_resource_id] %>, + google_storage_bucket.{{$.PrimaryResourceId}}, google_storage_bucket_iam_member.admin, ] } @@ -38,7 +38,7 @@ data "google_project" "project" { } resource "google_storage_bucket_iam_member" "admin" { - bucket = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket = google_storage_bucket.{{$.PrimaryResourceId}}.name role = "roles/storage.admin" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-pubsub.iam.gserviceaccount.com" } diff --git a/mmv1/templates/terraform/examples/pubsub_subscription_push_cloudstorage_service_account.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_subscription_push_cloudstorage_service_account.tf.tmpl index 21c18c10083f..1d16dae141d5 100644 --- a/mmv1/templates/terraform/examples/pubsub_subscription_push_cloudstorage_service_account.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_subscription_push_cloudstorage_service_account.tf.tmpl @@ -1,19 +1,19 @@ -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['bucket_name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "bucket_name"}}" location = "US" uniform_bucket_level_access = true } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" } -resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subscription_name'] %>" - topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id +resource "google_pubsub_subscription" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subscription_name"}}" + topic = google_pubsub_topic.{{$.PrimaryResourceId}}.id cloud_storage_config { - bucket = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket = google_storage_bucket.{{$.PrimaryResourceId}}.name filename_prefix = "pre-" filename_suffix = "-%{random_suffix}" @@ -26,7 +26,7 @@ resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { } depends_on = [ google_service_account.storage_write_service_account, - google_storage_bucket.<%= ctx[:primary_resource_id] %>, + google_storage_bucket.{{$.PrimaryResourceId}}, google_storage_bucket_iam_member.admin, ] } @@ -35,12 +35,12 @@ data "google_project" "project" { } resource "google_service_account" "storage_write_service_account" { - account_id = "<%= ctx[:vars]['service_account_id'] %>" + account_id = "{{index $.Vars "service_account_id"}}" display_name = "Storage Write Service Account" } resource "google_storage_bucket_iam_member" "admin" { - bucket = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket = google_storage_bucket.{{$.PrimaryResourceId}}.name role = "roles/storage.admin" member = "serviceAccount:${google_service_account.storage_write_service_account.email}" } diff --git a/mmv1/templates/terraform/examples/pubsub_topic_basic.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_topic_basic.tf.tmpl index 32bf56e82c1d..ad45de21d14b 100644 --- a/mmv1/templates/terraform/examples/pubsub_topic_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_topic_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" labels = { foo = "bar" diff --git a/mmv1/templates/terraform/examples/pubsub_topic_cmek.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_topic_cmek.tf.tmpl index 258dfacd5455..ea06ce2be358 100644 --- a/mmv1/templates/terraform/examples/pubsub_topic_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_topic_cmek.tf.tmpl @@ -1,14 +1,14 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" kms_key_name = google_kms_crypto_key.crypto_key.id } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id } resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "global" } 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 c082d009b841..48934419f82b 100644 --- a/mmv1/templates/terraform/examples/pubsub_topic_geo_restricted.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_topic_geo_restricted.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" message_storage_policy { allowed_persistence_regions = [ diff --git a/mmv1/templates/terraform/examples/pubsub_topic_ingestion_kinesis.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_topic_ingestion_kinesis.tf.tmpl index b47c80e8a9fa..657d32649a4c 100644 --- a/mmv1/templates/terraform/examples/pubsub_topic_ingestion_kinesis.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_topic_ingestion_kinesis.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +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 { diff --git a/mmv1/templates/terraform/examples/pubsub_topic_schema_settings.tf.tmpl b/mmv1/templates/terraform/examples/pubsub_topic_schema_settings.tf.tmpl index db39e8779554..697501be5c15 100644 --- a/mmv1/templates/terraform/examples/pubsub_topic_schema_settings.tf.tmpl +++ b/mmv1/templates/terraform/examples/pubsub_topic_schema_settings.tf.tmpl @@ -1,15 +1,15 @@ -resource "google_pubsub_schema" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['schema_name'] %>" +resource "google_pubsub_schema" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "schema_name"}}" type = "AVRO" definition = "{\n \"type\" : \"record\",\n \"name\" : \"Avro\",\n \"fields\" : [\n {\n \"name\" : \"StringField\",\n \"type\" : \"string\"\n },\n {\n \"name\" : \"IntField\",\n \"type\" : \"int\"\n }\n ]\n}\n" } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "topic_name"}}" - depends_on = [google_pubsub_schema.<%= ctx[:primary_resource_id] %>] + depends_on = [google_pubsub_schema.{{$.PrimaryResourceId}}] schema_settings { - schema = "projects/<%= ctx[:test_env_vars]['project_name'] %>/schemas/<%= ctx[:vars]['schema_name'] %>" + schema = "projects/{{index $.TestEnvVars "project_name"}}/schemas/{{index $.Vars "schema_name"}}" encoding = "JSON" } } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/queue_basic.tf.tmpl b/mmv1/templates/terraform/examples/queue_basic.tf.tmpl index 765ae4424ba2..f1ecb796fa3f 100644 --- a/mmv1/templates/terraform/examples/queue_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/queue_basic.tf.tmpl @@ -1,4 +1,4 @@ resource "google_cloud_tasks_queue" "default" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/redis_cluster_ha.tf.tmpl b/mmv1/templates/terraform/examples/redis_cluster_ha.tf.tmpl index 92ce9fa1e854..7bd40086559e 100644 --- a/mmv1/templates/terraform/examples/redis_cluster_ha.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_cluster_ha.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_redis_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cluster_name'] %>" +resource "google_redis_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cluster_name"}}" shard_count = 3 psc_configs { network = google_compute_network.producer_net.id @@ -12,7 +12,7 @@ resource "google_redis_cluster" "<%= ctx[:primary_resource_id] %>" { redis_configs = { maxmemory-policy = "volatile-ttl" } - deletion_protection_enabled = <%= ctx[:vars]['deletion_protection_enabled']%> + deletion_protection_enabled = {{index $.Vars "deletion_protection_enabled"}} zone_distribution_config { mode = "MULTI_ZONE" @@ -34,7 +34,7 @@ resource "google_redis_cluster" "<%= ctx[:primary_resource_id] %>" { } resource "google_network_connectivity_service_connection_policy" "default" { - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" location = "us-central1" service_class = "gcp-memorystore-redis" description = "my basic service connection policy" @@ -45,13 +45,13 @@ resource "google_network_connectivity_service_connection_policy" "default" { } resource "google_compute_subnetwork" "producer_subnet" { - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" ip_cidr_range = "10.0.0.248/29" region = "us-central1" network = google_compute_network.producer_net.id } resource "google_compute_network" "producer_net" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/redis_cluster_ha_single_zone.tf.tmpl b/mmv1/templates/terraform/examples/redis_cluster_ha_single_zone.tf.tmpl index d03efb412529..45e1f00573b7 100644 --- a/mmv1/templates/terraform/examples/redis_cluster_ha_single_zone.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_cluster_ha_single_zone.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_redis_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['cluster_name'] %>" +resource "google_redis_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "cluster_name"}}" shard_count = 3 psc_configs { network = google_compute_network.producer_net.id @@ -20,7 +20,7 @@ resource "google_redis_cluster" "<%= ctx[:primary_resource_id] %>" { } } } - deletion_protection_enabled = <%= ctx[:vars]['deletion_protection_enabled']%> + deletion_protection_enabled = {{index $.Vars "deletion_protection_enabled"}} depends_on = [ google_network_connectivity_service_connection_policy.default ] @@ -28,7 +28,7 @@ resource "google_redis_cluster" "<%= ctx[:primary_resource_id] %>" { } resource "google_network_connectivity_service_connection_policy" "default" { - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" location = "us-central1" service_class = "gcp-memorystore-redis" description = "my basic service connection policy" @@ -39,13 +39,13 @@ resource "google_network_connectivity_service_connection_policy" "default" { } resource "google_compute_subnetwork" "producer_subnet" { - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" ip_cidr_range = "10.0.0.248/29" region = "us-central1" network = google_compute_network.producer_net.id } resource "google_compute_network" "producer_net" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/redis_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/redis_instance_basic.tf.tmpl index 5cf774559a06..c28e779c5a91 100644 --- a/mmv1/templates/terraform/examples/redis_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_instance_basic.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["instance_name"] %>" +resource "google_redis_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" memory_size_gb = 1 lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> + prevent_destroy = {{index $.Vars "prevent_destroy"}} } } diff --git a/mmv1/templates/terraform/examples/redis_instance_cmek.tf.tmpl b/mmv1/templates/terraform/examples/redis_instance_cmek.tf.tmpl index c40840101d3f..a18f28dae0d1 100644 --- a/mmv1/templates/terraform/examples/redis_instance_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_instance_cmek.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_redis_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" tier = "STANDARD_HA" memory_size_gb = 1 @@ -19,7 +19,7 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { customer_managed_key = google_kms_crypto_key.redis_key.id lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> + prevent_destroy = {{index $.Vars "prevent_destroy"}} } } @@ -42,5 +42,5 @@ resource "google_kms_crypto_key" "redis_key" { // config, add an additional network resource or change // this from "data"to "resource" data "google_compute_network" "redis-network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/redis_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/redis_instance_full.tf.tmpl index 2bcac657ff0c..adeec52b088f 100644 --- a/mmv1/templates/terraform/examples/redis_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_instance_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_redis_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" tier = "STANDARD_HA" memory_size_gb = 1 @@ -30,7 +30,7 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { } lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> + prevent_destroy = {{index $.Vars "prevent_destroy"}} } } @@ -43,5 +43,5 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { // config, add an additional network resource or change // this from "data"to "resource" data "google_compute_network" "redis-network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/redis_instance_full_with_persistence_config.tf.tmpl b/mmv1/templates/terraform/examples/redis_instance_full_with_persistence_config.tf.tmpl index 4f8bbf2654c5..cdd61d1b68dc 100644 --- a/mmv1/templates/terraform/examples/redis_instance_full_with_persistence_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_instance_full_with_persistence_config.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_redis_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" tier = "STANDARD_HA" memory_size_gb = 1 location_id = "us-central1-a" @@ -11,6 +11,6 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { } lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> + prevent_destroy = {{index $.Vars "prevent_destroy"}} } } diff --git a/mmv1/templates/terraform/examples/redis_instance_mrr.tf.tmpl b/mmv1/templates/terraform/examples/redis_instance_mrr.tf.tmpl index 2b038101dedf..e366bb220da2 100644 --- a/mmv1/templates/terraform/examples/redis_instance_mrr.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_instance_mrr.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_redis_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" tier = "STANDARD_HA" memory_size_gb = 5 @@ -20,7 +20,7 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { } lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> + prevent_destroy = {{index $.Vars "prevent_destroy"}} } } @@ -33,5 +33,5 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { // config, add an additional network resource or change // this from "data"to "resource" data "google_compute_network" "redis-network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/redis_instance_private_service.tf.tmpl b/mmv1/templates/terraform/examples/redis_instance_private_service.tf.tmpl index 9eedaf4a9fb3..1a0c7b84baa7 100644 --- a/mmv1/templates/terraform/examples/redis_instance_private_service.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_instance_private_service.tf.tmpl @@ -7,11 +7,11 @@ // config, add an additional network resource or change // this from "data"to "resource" resource "google_compute_network" "redis-network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "service_range" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 @@ -24,8 +24,8 @@ resource "google_service_networking_connection" "private_service_connection" { reserved_peering_ranges = [google_compute_global_address.service_range.name] } -resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_redis_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" tier = "STANDARD_HA" memory_size_gb = 1 @@ -41,6 +41,6 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { depends_on = [google_service_networking_connection.private_service_connection] lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> + prevent_destroy = {{index $.Vars "prevent_destroy"}} } } diff --git a/mmv1/templates/terraform/examples/redis_instance_private_service_test.tf.tmpl b/mmv1/templates/terraform/examples/redis_instance_private_service_test.tf.tmpl index 0b69e81cf45b..f54737bab145 100644 --- a/mmv1/templates/terraform/examples/redis_instance_private_service_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/redis_instance_private_service_test.tf.tmpl @@ -7,11 +7,11 @@ // config, add an additional network resource or change // this from "data"to "resource" data "google_compute_network" "redis-network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } -resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_redis_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" tier = "STANDARD_HA" memory_size_gb = 1 @@ -25,6 +25,6 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" { display_name = "Terraform Test Instance" lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> + prevent_destroy = {{index $.Vars "prevent_destroy"}} } } diff --git a/mmv1/templates/terraform/examples/region_autoscaler_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_autoscaler_basic.tf.tmpl index 8550d9cfcb78..0623a608d612 100644 --- a/mmv1/templates/terraform/examples/region_autoscaler_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_autoscaler_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_autoscaler" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['region_autoscaler_name'] %>" +resource "google_compute_region_autoscaler" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "region_autoscaler_name"}}" region = "us-central1" target = google_compute_region_instance_group_manager.foobar.id @@ -15,7 +15,7 @@ resource "google_compute_region_autoscaler" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_instance_template" "foobar" { - name = "<%= ctx[:vars]['instance_template_name'] %>" + name = "{{index $.Vars "instance_template_name"}}" machine_type = "e2-standard-4" disk { @@ -47,11 +47,11 @@ resource "google_compute_instance_template" "foobar" { } resource "google_compute_target_pool" "foobar" { - name = "<%= ctx[:vars]['target_pool_name'] %>" + name = "{{index $.Vars "target_pool_name"}}" } resource "google_compute_region_instance_group_manager" "foobar" { - name = "<%= ctx[:vars]['rigm_name'] %>" + name = "{{index $.Vars "rigm_name"}}" region = "us-central1" version { diff --git a/mmv1/templates/terraform/examples/region_backend_service_balancing_mode.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_balancing_mode.tf.tmpl index 270223bf3cf7..be1bc742abba 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_balancing_mode.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_balancing_mode.tf.tmpl @@ -8,7 +8,7 @@ resource "google_compute_region_backend_service" "default" { } region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" protocol = "HTTP" timeout_sec = 10 @@ -22,7 +22,7 @@ data "google_compute_image" "debian_image" { resource "google_compute_region_instance_group_manager" "rigm" { region = "us-central1" - name = "<%= ctx[:vars]['rigm_name'] %>" + name = "{{index $.Vars "rigm_name"}}" version { instance_template = google_compute_instance_template.instance_template.id name = "primary" @@ -32,7 +32,7 @@ resource "google_compute_region_instance_group_manager" "rigm" { } resource "google_compute_instance_template" "instance_template" { - name = "template-<%= ctx[:vars]['region_backend_service_name'] %>" + name = "template-{{index $.Vars "region_backend_service_name"}}" machine_type = "e2-medium" network_interface { @@ -51,20 +51,20 @@ resource "google_compute_instance_template" "instance_template" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port_specification = "USE_SERVING_PORT" } } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false routing_mode = "REGIONAL" } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['network_name'] %>-default" + name = "{{index $.Vars "network_name"}}-default" ip_cidr_range = "10.1.2.0/24" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/region_backend_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_basic.tf.tmpl index acbc9a75e482..b48d5c675280 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['region_backend_service_name'] %>" +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "region_backend_service_name"}}" region = "us-central1" health_checks = [google_compute_health_check.default.id] connection_draining_timeout_sec = 10 @@ -7,7 +7,7 @@ resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_backend_service_cache.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_cache.tf.tmpl index 22e9d7fff774..fdc97814861e 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_cache.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_cache.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" region = "us-central1" health_checks = [google_compute_region_health_check.default.id] enable_cdn = true @@ -22,7 +22,7 @@ resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] resource "google_compute_region_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" region = "us-central1" http_health_check { diff --git a/mmv1/templates/terraform/examples/region_backend_service_connection_tracking.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_connection_tracking.tf.tmpl index 574f18bacc60..34552da36710 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_connection_tracking.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_connection_tracking.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" region = "us-central1" health_checks = [google_compute_region_health_check.health_check.id] connection_draining_timeout_sec = 10 @@ -17,7 +17,7 @@ resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] resource "google_compute_region_health_check" "health_check" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" region = "us-central1" tcp_health_check { diff --git a/mmv1/templates/terraform/examples/region_backend_service_external.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_external.tf.tmpl index 04dc840147d9..7a6a5b472c05 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_external.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_external.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" health_checks = [google_compute_region_health_check.health_check.id] protocol = "TCP" load_balancing_scheme = "EXTERNAL" @@ -9,7 +9,7 @@ resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] resource "google_compute_region_health_check" "health_check" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" region = "us-central1" tcp_health_check { diff --git a/mmv1/templates/terraform/examples/region_backend_service_external_iap.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_external_iap.tf.tmpl index 2f418bc0f037..77e486822940 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_external_iap.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_external_iap.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['region_backend_service_name'] %>" +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "region_backend_service_name"}}" region = "us-central1" protocol = "HTTP" load_balancing_scheme = "EXTERNAL" diff --git a/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.tmpl index a09a7c4295e9..e5329a429dee 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_external_weighted.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" health_checks = [google_compute_region_health_check.health_check.id] protocol = "TCP" load_balancing_scheme = "EXTERNAL" @@ -8,7 +8,7 @@ resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] } resource "google_compute_region_health_check" "health_check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" region = "us-central1" http_health_check { diff --git a/mmv1/templates/terraform/examples/region_backend_service_ilb_ring_hash.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_ilb_ring_hash.tf.tmpl index cce5eb0ae5c3..fcfce2670ff0 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_ilb_ring_hash.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_ilb_ring_hash.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" health_checks = [google_compute_health_check.health_check.id] load_balancing_scheme = "INTERNAL_MANAGED" locality_lb_policy = "RING_HASH" @@ -24,7 +24,7 @@ resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] } resource "google_compute_health_check" "health_check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_backend_service_ilb_round_robin.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_ilb_round_robin.tf.tmpl index 2d93c3b2c2f3..b307a7f2482f 100644 --- a/mmv1/templates/terraform/examples/region_backend_service_ilb_round_robin.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_backend_service_ilb_round_robin.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" health_checks = [google_compute_health_check.health_check.id] protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" @@ -8,7 +8,7 @@ resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] } resource "google_compute_health_check" "health_check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_consumer_quota_override.tf.tmpl b/mmv1/templates/terraform/examples/region_consumer_quota_override.tf.tmpl index ab9e111fc966..cf6953b9cffb 100644 --- a/mmv1/templates/terraform/examples/region_consumer_quota_override.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_consumer_quota_override.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "my_project" { provider = google-beta name = "tf-test-project" - project_id = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/region_disk_async.tf.tmpl b/mmv1/templates/terraform/examples/region_disk_async.tf.tmpl index 05a8e870d5b3..e775da24c063 100644 --- a/mmv1/templates/terraform/examples/region_disk_async.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_disk_async.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_disk" "primary" { - name = "<%= ctx[:vars]['region_disk_name'] %>" + name = "{{index $.Vars "region_disk_name"}}" type = "pd-ssd" region = "us-central1" physical_block_size_bytes = 4096 @@ -8,7 +8,7 @@ resource "google_compute_region_disk" "primary" { } resource "google_compute_region_disk" "secondary" { - name = "<%= ctx[:vars]['secondary_region_disk_name'] %>" + name = "{{index $.Vars "secondary_region_disk_name"}}" type = "pd-ssd" region = "us-east1" physical_block_size_bytes = 4096 diff --git a/mmv1/templates/terraform/examples/region_disk_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_disk_basic.tf.tmpl index 9376257b27d5..9b8a22c7aaca 100644 --- a/mmv1/templates/terraform/examples/region_disk_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_disk_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_disk" "regiondisk" { - name = "<%= ctx[:vars]['region_disk_name'] %>" + name = "{{index $.Vars "region_disk_name"}}" snapshot = google_compute_snapshot.snapdisk.id type = "pd-ssd" region = "us-central1" @@ -9,7 +9,7 @@ resource "google_compute_region_disk" "regiondisk" { } resource "google_compute_disk" "disk" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" image = "debian-cloud/debian-11" size = 50 type = "pd-ssd" @@ -17,7 +17,7 @@ resource "google_compute_disk" "disk" { } resource "google_compute_snapshot" "snapdisk" { - name = "<%= ctx[:vars]['snapshot_name'] %>" + name = "{{index $.Vars "snapshot_name"}}" source_disk = google_compute_disk.disk.name zone = "us-central1-a" } diff --git a/mmv1/templates/terraform/examples/region_disk_features.tf.tmpl b/mmv1/templates/terraform/examples/region_disk_features.tf.tmpl index 9a33c7b45fab..46d761c91c00 100644 --- a/mmv1/templates/terraform/examples/region_disk_features.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_disk_features.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_disk" "regiondisk" { - name = "<%= ctx[:vars]['region_disk_name'] %>" + name = "{{index $.Vars "region_disk_name"}}" type = "pd-ssd" region = "us-central1" physical_block_size_bytes = 4096 diff --git a/mmv1/templates/terraform/examples/region_disk_resource_policy_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_disk_resource_policy_attachment_basic.tf.tmpl index c3aea0e4f60c..7190a9f61d61 100644 --- a/mmv1/templates/terraform/examples/region_disk_resource_policy_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_disk_resource_policy_attachment_basic.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_compute_region_disk_resource_policy_attachment" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_disk_resource_policy_attachment" "{{$.PrimaryResourceId}}" { name = google_compute_resource_policy.policy.name disk = google_compute_region_disk.ssd.name region = "us-central1" } resource "google_compute_disk" "disk" { - name = "<%= ctx[:vars]['base_disk_name'] %>" + name = "{{index $.Vars "base_disk_name"}}" image = "debian-cloud/debian-11" size = 50 type = "pd-ssd" @@ -13,13 +13,13 @@ resource "google_compute_disk" "disk" { } resource "google_compute_snapshot" "snapdisk" { - name = "<%= ctx[:vars]['snapshot_name'] %>" + name = "{{index $.Vars "snapshot_name"}}" source_disk = google_compute_disk.disk.name zone = "us-central1-a" } resource "google_compute_region_disk" "ssd" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" replica_zones = ["us-central1-a", "us-central1-f"] snapshot = google_compute_snapshot.snapdisk.id size = 50 @@ -28,7 +28,7 @@ resource "google_compute_region_disk" "ssd" { } resource "google_compute_resource_policy" "policy" { - name = "<%= ctx[:vars]['policy_name'] %>" + name = "{{index $.Vars "policy_name"}}" region = "us-central1" snapshot_schedule_policy { schedule { diff --git a/mmv1/templates/terraform/examples/region_health_check_grpc.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_grpc.tf.tmpl index 34d52d6f7ef9..f3dd12a1719e 100644 --- a/mmv1/templates/terraform/examples/region_health_check_grpc.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_grpc.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "grpc-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_grpc_full.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_grpc_full.tf.tmpl index 26aa3433f811..ea792603ec0d 100644 --- a/mmv1/templates/terraform/examples/region_health_check_grpc_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_grpc_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "grpc-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_http.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_http.tf.tmpl index 5bb2369cebb2..de4e47206c45 100644 --- a/mmv1/templates/terraform/examples/region_health_check_http.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_http.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "http-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_http2.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_http2.tf.tmpl index e5399cab9971..f9585606b454 100644 --- a/mmv1/templates/terraform/examples/region_health_check_http2.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_http2.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "http2-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_http2_full.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_http2_full.tf.tmpl index d85e237ecc7a..2903e7611409 100644 --- a/mmv1/templates/terraform/examples/region_health_check_http2_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_http2_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "http2-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via http2" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_http_full.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_http_full.tf.tmpl index fbb286c60af6..bd6feed8cad9 100644 --- a/mmv1/templates/terraform/examples/region_health_check_http_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_http_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "http-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via http" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_http_logs.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_http_logs.tf.tmpl index a50558f4ad61..581c672b0e4c 100644 --- a/mmv1/templates/terraform/examples/region_health_check_http_logs.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_http_logs.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_health_check" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_health_check" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_https.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_https.tf.tmpl index a47f3ef19f86..6dff66931784 100644 --- a/mmv1/templates/terraform/examples/region_health_check_https.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_https.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "https-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_https_full.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_https_full.tf.tmpl index bbd496244f2f..14a6cf03439c 100644 --- a/mmv1/templates/terraform/examples/region_health_check_https_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_https_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "https-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via https" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_ssl.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_ssl.tf.tmpl index 1e176c104fad..128e83ecef29 100644 --- a/mmv1/templates/terraform/examples/region_health_check_ssl.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_ssl.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "ssl-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_ssl_full.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_ssl_full.tf.tmpl index 09591e861ae0..5c2c8e6262f6 100644 --- a/mmv1/templates/terraform/examples/region_health_check_ssl_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_ssl_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "ssl-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via ssl" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_tcp.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_tcp.tf.tmpl index 737343492ec3..5213bc0f16d4 100644 --- a/mmv1/templates/terraform/examples/region_health_check_tcp.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_tcp.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "tcp-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_health_check_tcp_full.tf.tmpl b/mmv1/templates/terraform/examples/region_health_check_tcp_full.tf.tmpl index ae11bf0f57da..376be2b0c1fd 100644 --- a/mmv1/templates/terraform/examples/region_health_check_tcp_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_health_check_tcp_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_region_health_check" "tcp-region-health-check" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" description = "Health check via tcp" timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_appengine.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_appengine.tf.tmpl index e041cf64f210..8d6671148cd6 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_appengine.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_appengine.tf.tmpl @@ -1,15 +1,15 @@ // App Engine Example -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" network_endpoint_type = "SERVERLESS" region = "us-central1" app_engine { - service = google_app_engine_flexible_app_version.<%= ctx[:primary_resource_id] %>.service - version = google_app_engine_flexible_app_version.<%= ctx[:primary_resource_id] %>.version_id + service = google_app_engine_flexible_app_version.{{$.PrimaryResourceId}}.service + version = google_app_engine_flexible_app_version.{{$.PrimaryResourceId}}.version_id } } -resource "google_app_engine_flexible_app_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_app_engine_flexible_app_version" "{{$.PrimaryResourceId}}" { version_id = "v1" service = "appengine-network-endpoint-group" runtime = "nodejs" @@ -24,7 +24,7 @@ resource "google_app_engine_flexible_app_version" "<%= ctx[:primary_resource_id] deployment { zip { - source_url = "https://storage.googleapis.com/${google_storage_bucket.<%= ctx[:primary_resource_id] %>.name}/${google_storage_bucket_object.<%= ctx[:primary_resource_id] %>.name}" + source_url = "https://storage.googleapis.com/${google_storage_bucket.{{$.PrimaryResourceId}}.name}/${google_storage_bucket_object.{{$.PrimaryResourceId}}.name}" } } @@ -62,13 +62,13 @@ resource "google_app_engine_flexible_app_version" "<%= ctx[:primary_resource_id] delete_service_on_destroy = true } -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" location = "US" } -resource "google_storage_bucket_object" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_bucket_object" "{{$.PrimaryResourceId}}" { name = "hello-world.zip" - bucket = google_storage_bucket.<%= ctx[:primary_resource_id] %>.name + bucket = google_storage_bucket.{{$.PrimaryResourceId}}.name source = "./test-fixtures/hello-world.zip" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_appengine_empty.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_appengine_empty.tf.tmpl index 3bcdffc62c20..0a221538ac12 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_appengine_empty.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_appengine_empty.tf.tmpl @@ -1,6 +1,6 @@ // App Engine Example -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" network_endpoint_type = "SERVERLESS" region = "us-central1" app_engine { diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_cloudrun.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_cloudrun.tf.tmpl index 9198102b398e..e6c5c2b58715 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_cloudrun.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_cloudrun.tf.tmpl @@ -1,15 +1,15 @@ // Cloud Run Example -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" network_endpoint_type = "SERVERLESS" region = "us-central1" cloud_run { - service = google_cloud_run_service.<%= ctx[:primary_resource_id] %>.name + service = google_cloud_run_service.{{$.PrimaryResourceId}}.name } } -resource "google_cloud_run_service" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_cloud_run_service" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" location = "us-central1" template { diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_functions.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_functions.tf.tmpl index 9a59ed734af8..bfe761fe05f6 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_functions.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_functions.tf.tmpl @@ -1,15 +1,15 @@ // Cloud Functions Example -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" network_endpoint_type = "SERVERLESS" region = "us-central1" cloud_function { - function = google_cloudfunctions_function.<%= ctx[:primary_resource_id] %>.name + function = google_cloudfunctions_function.{{$.PrimaryResourceId}}.name } } -resource "google_cloudfunctions_function" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_cloudfunctions_function" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" description = "My function" runtime = "nodejs10" @@ -22,12 +22,12 @@ resource "google_cloudfunctions_function" "<%= ctx[:primary_resource_id] %>" { } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } resource "google_storage_bucket_object" "archive" { name = "index.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" + source = "{{index $.Vars "zip_path"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_internet_fqdn_port.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_internet_fqdn_port.tf.tmpl index 268da6788eea..da686b147076 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_internet_fqdn_port.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_internet_fqdn_port.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" region = "us-central1" network = google_compute_network.default.id @@ -7,5 +7,5 @@ resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resour } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_internet_ip_port.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_internet_ip_port.tf.tmpl index 607eebdf4304..dff8b3dd3766 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_internet_ip_port.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_internet_ip_port.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" region = "us-central1" network = google_compute_network.default.id @@ -7,5 +7,5 @@ resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resour } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_portmap.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_portmap.tf.tmpl index f44bd8ee4c81..e4f502062ad8 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_portmap.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_portmap.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" region = "us-central1" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id @@ -9,12 +9,12 @@ resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resour } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" provider = google-beta } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.default.id diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_psc.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_psc.tf.tmpl index 5be427ffb6f0..cc836508c968 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_psc.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_psc.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" region = "asia-northeast3" network_endpoint_type = "PRIVATE_SERVICE_CONNECT" diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_group_psc_service_attachment.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_group_psc_service_attachment.tf.tmpl index 9072b523356a..1e5c99e23b09 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_group_psc_service_attachment.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_group_psc_service_attachment.tf.tmpl @@ -1,16 +1,16 @@ resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.0/16" region = "europe-west4" network = google_compute_network.default.id } resource "google_compute_subnetwork" "psc_subnetwork" { - name = "<%= ctx[:vars]['psc_subnetwork_name'] %>" + name = "{{index $.Vars "psc_subnetwork_name"}}" ip_cidr_range = "10.1.0.0/16" region = "europe-west4" purpose = "PRIVATE_SERVICE_CONNECT" @@ -18,7 +18,7 @@ resource "google_compute_subnetwork" "psc_subnetwork" { } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -27,14 +27,14 @@ resource "google_compute_health_check" "default" { } } resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" region = "europe-west4" health_checks = [google_compute_health_check.default.id] } resource "google_compute_forwarding_rule" "default" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "europe-west4" load_balancing_scheme = "INTERNAL" @@ -45,7 +45,7 @@ resource "google_compute_forwarding_rule" "default" { } resource "google_compute_service_attachment" "default" { - name = "<%= ctx[:vars]['service_attachment_name'] %>" + name = "{{index $.Vars "service_attachment_name"}}" region = "europe-west4" description = "A service attachment configured with Terraform" @@ -55,8 +55,8 @@ resource "google_compute_service_attachment" "default" { target_service = google_compute_forwarding_rule.default.self_link } -resource "google_compute_region_network_endpoint_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['neg_name'] %>" +resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "neg_name"}}" region = "europe-west4" network_endpoint_type = "PRIVATE_SERVICE_CONNECT" diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_internet_fqdn_port.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_internet_fqdn_port.tf.tmpl index 4f61fb3b10ab..246db2126c2d 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_internet_fqdn_port.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_internet_fqdn_port.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_region_network_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_network_endpoint" "{{$.PrimaryResourceId}}" { region_network_endpoint_group = google_compute_region_network_endpoint_group.group.name region = "us-central1" @@ -8,7 +8,7 @@ resource "google_compute_region_network_endpoint" "<%= ctx[:primary_resource_id] resource "google_compute_region_network_endpoint_group" "group" { - name = "<%= ctx[:vars]['neg_name'] %>" + name = "{{index $.Vars "neg_name"}}" network = google_compute_network.default.id region = "us-central1" @@ -16,6 +16,6 @@ resource "google_compute_region_network_endpoint_group" "group" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_internet_ip_port.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_internet_ip_port.tf.tmpl index 1936ca417402..149f0be9d770 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_internet_ip_port.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_internet_ip_port.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_region_network_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_network_endpoint" "{{$.PrimaryResourceId}}" { region_network_endpoint_group = google_compute_region_network_endpoint_group.group.name region = "us-central1" @@ -8,7 +8,7 @@ resource "google_compute_region_network_endpoint" "<%= ctx[:primary_resource_id] resource "google_compute_region_network_endpoint_group" "group" { - name = "<%= ctx[:vars]['neg_name'] %>" + name = "{{index $.Vars "neg_name"}}" network = google_compute_network.default.id region = "us-central1" @@ -16,6 +16,6 @@ resource "google_compute_region_network_endpoint_group" "group" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_network_endpoint_portmap.tf.tmpl b/mmv1/templates/terraform/examples/region_network_endpoint_portmap.tf.tmpl index f39e45d604d4..bc9b61702ddc 100644 --- a/mmv1/templates/terraform/examples/region_network_endpoint_portmap.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_endpoint_portmap.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false provider = google-beta } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.default.id @@ -13,7 +13,7 @@ resource "google_compute_subnetwork" "default" { } resource "google_compute_region_network_endpoint_group" default { - name = "<%= ctx[:vars]['neg_name'] %>" + name = "{{index $.Vars "neg_name"}}" region = "us-central1" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id @@ -22,7 +22,7 @@ resource "google_compute_region_network_endpoint_group" default { provider = google-beta } -resource "google_compute_region_network_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_network_endpoint" "{{$.PrimaryResourceId}}" { region_network_endpoint_group = google_compute_region_network_endpoint_group.default.name region = "us-central1" instance = google_compute_instance.default.self_link @@ -39,7 +39,7 @@ data "google_compute_image" "my_image" { } resource "google_compute_instance" "default" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" zone = "us-central1-a" diff --git a/mmv1/templates/terraform/examples/region_network_firewall_policy_full.tf.tmpl b/mmv1/templates/terraform/examples/region_network_firewall_policy_full.tf.tmpl index 61de87fc112a..f25fcedbf51e 100644 --- a/mmv1/templates/terraform/examples/region_network_firewall_policy_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_network_firewall_policy_full.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_compute_region_network_firewall_policy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['policy_name'] %>" +resource "google_compute_region_network_firewall_policy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "policy_name"}}" description = "Terraform test" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_security_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_security_policy_basic.tf.tmpl index b38444a44852..e437ad74c386 100644 --- a/mmv1/templates/terraform/examples/region_security_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_security_policy_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_security_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_security_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "basic region security policy" type = "CLOUD_ARMOR" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/region_security_policy_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_security_policy_rule_basic.tf.tmpl index d0d5453049a6..2de7a5dfc39c 100644 --- a/mmv1/templates/terraform/examples/region_security_policy_rule_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_security_policy_rule_basic.tf.tmpl @@ -2,12 +2,12 @@ resource "google_compute_region_security_policy" "default" { provider = google-beta region = "us-west2" - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "basic region security policy" type = "CLOUD_ARMOR" } -resource "google_compute_region_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_security_policy_rule" "{{$.PrimaryResourceId}}" { provider = google-beta region = "us-west2" diff --git a/mmv1/templates/terraform/examples/region_security_policy_rule_multiple_rules.tf.tmpl b/mmv1/templates/terraform/examples/region_security_policy_rule_multiple_rules.tf.tmpl index 7c31196a58c7..c66ed53fef15 100644 --- a/mmv1/templates/terraform/examples/region_security_policy_rule_multiple_rules.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_security_policy_rule_multiple_rules.tf.tmpl @@ -2,12 +2,12 @@ resource "google_compute_region_security_policy" "default" { provider = google-beta region = "us-west2" - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "basic region security policy" type = "CLOUD_ARMOR" } -resource "google_compute_region_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_security_policy_rule" "{{$.PrimaryResourceId}}" { provider = google-beta region = "us-west2" diff --git a/mmv1/templates/terraform/examples/region_security_policy_rule_with_network_match.tf.tmpl b/mmv1/templates/terraform/examples/region_security_policy_rule_with_network_match.tf.tmpl index 068b49124821..009626b6916c 100644 --- a/mmv1/templates/terraform/examples/region_security_policy_rule_with_network_match.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_security_policy_rule_with_network_match.tf.tmpl @@ -25,7 +25,7 @@ resource "google_compute_region_security_policy" "policynetworkmatch" { provider = google-beta region = "us-west2" - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "region security policy for network match" type = "CLOUD_ARMOR_NETWORK" user_defined_fields { @@ -38,7 +38,7 @@ resource "google_compute_region_security_policy" "policynetworkmatch" { depends_on = [google_compute_network_edge_security_service.edge_sec_service] } -resource "google_compute_region_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_security_policy_rule" "{{$.PrimaryResourceId}}" { provider = google-beta region = "us-west2" diff --git a/mmv1/templates/terraform/examples/region_security_policy_rule_with_preconfigured_waf_config.tf.tmpl b/mmv1/templates/terraform/examples/region_security_policy_rule_with_preconfigured_waf_config.tf.tmpl index ff166b17cb23..370460df558e 100644 --- a/mmv1/templates/terraform/examples/region_security_policy_rule_with_preconfigured_waf_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_security_policy_rule_with_preconfigured_waf_config.tf.tmpl @@ -2,12 +2,12 @@ resource "google_compute_region_security_policy" "default" { provider = google-beta region = "asia-southeast1" - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "basic region security policy" type = "CLOUD_ARMOR" } -resource "google_compute_region_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_security_policy_rule" "{{$.PrimaryResourceId}}" { provider = google-beta region = "asia-southeast1" diff --git a/mmv1/templates/terraform/examples/region_security_policy_with_ddos_protection_config.tf.tmpl b/mmv1/templates/terraform/examples/region_security_policy_with_ddos_protection_config.tf.tmpl index 852df5651986..f49d0da98857 100644 --- a/mmv1/templates/terraform/examples/region_security_policy_with_ddos_protection_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_security_policy_with_ddos_protection_config.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_security_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_security_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "with ddos protection config" type = "CLOUD_ARMOR_NETWORK" diff --git a/mmv1/templates/terraform/examples/region_security_policy_with_user_defined_fields.tf.tmpl b/mmv1/templates/terraform/examples/region_security_policy_with_user_defined_fields.tf.tmpl index cbb6714bbd9b..83d34ea0e08a 100644 --- a/mmv1/templates/terraform/examples/region_security_policy_with_user_defined_fields.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_security_policy_with_user_defined_fields.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_security_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_security_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "with user defined fields" type = "CLOUD_ARMOR_NETWORK" user_defined_fields { diff --git a/mmv1/templates/terraform/examples/region_ssl_certificate_target_https_proxies.tf.tmpl b/mmv1/templates/terraform/examples/region_ssl_certificate_target_https_proxies.tf.tmpl index 2c3805a51ef2..677b87f056b3 100644 --- a/mmv1/templates/terraform/examples/region_ssl_certificate_target_https_proxies.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_ssl_certificate_target_https_proxies.tf.tmpl @@ -21,14 +21,14 @@ resource "google_compute_region_ssl_certificate" "default" { resource "google_compute_region_target_https_proxy" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_target_https_proxy_name'] %>" + name = "{{index $.Vars "region_target_https_proxy_name"}}" url_map = google_compute_region_url_map.default.id ssl_certificates = [google_compute_region_ssl_certificate.default.id] } resource "google_compute_region_url_map" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.default.id @@ -51,7 +51,7 @@ resource "google_compute_region_url_map" "default" { resource "google_compute_region_backend_service" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" timeout_sec = 10 @@ -61,7 +61,7 @@ resource "google_compute_region_backend_service" "default" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_target_http_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_target_http_proxy_basic.tf.tmpl index e4dfac8ad51c..38bf7a930abc 100644 --- a/mmv1/templates/terraform/examples/region_target_http_proxy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_target_http_proxy_basic.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_region_target_http_proxy" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_target_http_proxy_name'] %>" + name = "{{index $.Vars "region_target_http_proxy_name"}}" url_map = google_compute_region_url_map.default.id } resource "google_compute_region_url_map" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" default_service = google_compute_region_backend_service.default.id host_rule { @@ -27,7 +27,7 @@ resource "google_compute_region_url_map" "default" { resource "google_compute_region_backend_service" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" protocol = "HTTP" timeout_sec = 10 load_balancing_scheme = "INTERNAL_MANAGED" @@ -37,7 +37,7 @@ resource "google_compute_region_backend_service" "default" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_target_http_proxy_http_keep_alive_timeout.tf.tmpl b/mmv1/templates/terraform/examples/region_target_http_proxy_http_keep_alive_timeout.tf.tmpl index ea7f224f6376..91abc2b866c1 100644 --- a/mmv1/templates/terraform/examples/region_target_http_proxy_http_keep_alive_timeout.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_target_http_proxy_http_keep_alive_timeout.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_compute_region_target_http_proxy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_target_http_proxy" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['region_target_http_proxy_name'] %>" + name = "{{index $.Vars "region_target_http_proxy_name"}}" http_keep_alive_timeout_sec = 600 url_map = google_compute_region_url_map.default.id } resource "google_compute_region_url_map" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" default_service = google_compute_region_backend_service.default.id host_rule { @@ -28,7 +28,7 @@ resource "google_compute_region_url_map" "default" { resource "google_compute_region_backend_service" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -39,7 +39,7 @@ resource "google_compute_region_backend_service" "default" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 diff --git a/mmv1/templates/terraform/examples/region_target_http_proxy_https_redirect.tf.tmpl b/mmv1/templates/terraform/examples/region_target_http_proxy_https_redirect.tf.tmpl index b4cca54587e9..e262461a7949 100644 --- a/mmv1/templates/terraform/examples/region_target_http_proxy_https_redirect.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_target_http_proxy_https_redirect.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_region_target_http_proxy" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_target_http_proxy_name'] %>" + name = "{{index $.Vars "region_target_http_proxy_name"}}" url_map = google_compute_region_url_map.default.id } resource "google_compute_region_url_map" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" default_url_redirect { https_redirect = true strip_query = false diff --git a/mmv1/templates/terraform/examples/region_target_https_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_target_https_proxy_basic.tf.tmpl index b23a49127030..334e2688c409 100644 --- a/mmv1/templates/terraform/examples/region_target_https_proxy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_target_https_proxy_basic.tf.tmpl @@ -1,20 +1,20 @@ resource "google_compute_region_target_https_proxy" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_target_https_proxy_name'] %>" + name = "{{index $.Vars "region_target_https_proxy_name"}}" url_map = google_compute_region_url_map.default.id ssl_certificates = [google_compute_region_ssl_certificate.default.id] } resource "google_compute_region_ssl_certificate" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_ssl_certificate_name'] %>" + name = "{{index $.Vars "region_ssl_certificate_name"}}" private_key = file("path/to/private.key") certificate = file("path/to/certificate.crt") } resource "google_compute_region_url_map" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.default.id @@ -37,7 +37,7 @@ resource "google_compute_region_url_map" "default" { resource "google_compute_region_backend_service" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" timeout_sec = 10 @@ -47,7 +47,7 @@ resource "google_compute_region_backend_service" "default" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_target_https_proxy_certificate_manager_certificate.tf.tmpl b/mmv1/templates/terraform/examples/region_target_https_proxy_certificate_manager_certificate.tf.tmpl index 05c8d90b46f9..b618d56aee8d 100644 --- a/mmv1/templates/terraform/examples/region_target_https_proxy_certificate_manager_certificate.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_target_https_proxy_certificate_manager_certificate.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_compute_region_target_https_proxy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['region_target_https_proxy_name'] %>" +resource "google_compute_region_target_https_proxy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "region_target_https_proxy_name"}}" url_map = google_compute_region_url_map.default.id certificate_manager_certificates = ["//certificatemanager.googleapis.com/${google_certificate_manager_certificate.default.id}"] # [google_certificate_manager_certificate.default.id] is also acceptable } resource "google_certificate_manager_certificate" "default" { - name = "<%= ctx[:vars]['certificate_manager_certificate_name'] %>" + name = "{{index $.Vars "certificate_manager_certificate_name"}}" location = "us-central1" self_managed { pem_certificate = file("test-fixtures/cert.pem") @@ -14,13 +14,13 @@ resource "google_certificate_manager_certificate" "default" { } resource "google_compute_region_url_map" "default" { - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" default_service = google_compute_region_backend_service.default.id region = "us-central1" } resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" region = "us-central1" protocol = "HTTPS" timeout_sec = 30 diff --git a/mmv1/templates/terraform/examples/region_target_https_proxy_http_keep_alive_timeout.tf.tmpl b/mmv1/templates/terraform/examples/region_target_https_proxy_http_keep_alive_timeout.tf.tmpl index f819c4fce39d..5e6306e52616 100644 --- a/mmv1/templates/terraform/examples/region_target_https_proxy_http_keep_alive_timeout.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_target_https_proxy_http_keep_alive_timeout.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_region_target_https_proxy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_target_https_proxy" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['region_target_https_proxy_name'] %>" + name = "{{index $.Vars "region_target_https_proxy_name"}}" http_keep_alive_timeout_sec = 600 url_map = google_compute_region_url_map.default.id ssl_certificates = [google_compute_region_ssl_certificate.default.id] @@ -8,14 +8,14 @@ resource "google_compute_region_target_https_proxy" "<%= ctx[:primary_resource_i resource "google_compute_region_ssl_certificate" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_ssl_certificate_name'] %>" + name = "{{index $.Vars "region_ssl_certificate_name"}}" private_key = file("path/to/private.key") certificate = file("path/to/certificate.crt") } resource "google_compute_region_url_map" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.default.id @@ -38,7 +38,7 @@ resource "google_compute_region_url_map" "default" { resource "google_compute_region_backend_service" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -49,7 +49,7 @@ resource "google_compute_region_backend_service" "default" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 diff --git a/mmv1/templates/terraform/examples/region_target_https_proxy_mtls.tf.tmpl b/mmv1/templates/terraform/examples/region_target_https_proxy_mtls.tf.tmpl index 7ad309adeb10..25cd56003eab 100644 --- a/mmv1/templates/terraform/examples/region_target_https_proxy_mtls.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_target_https_proxy_mtls.tf.tmpl @@ -2,10 +2,10 @@ data "google_project" "project" { provider = google-beta } -resource "google_compute_region_target_https_proxy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_target_https_proxy" "{{$.PrimaryResourceId}}" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['target_https_proxy_name'] %>" + name = "{{index $.Vars "target_https_proxy_name"}}" url_map = google_compute_region_url_map.default.id ssl_certificates = [google_compute_region_ssl_certificate.default.id] server_tls_policy = google_network_security_server_tls_policy.default.id @@ -14,7 +14,7 @@ resource "google_compute_region_target_https_proxy" "<%= ctx[:primary_resource_i resource "google_certificate_manager_trust_config" "default" { provider = google-beta location = "us-central1" - name = "<%= ctx[:vars]["trust_config_name"] %>" + name = "{{index $.Vars "trust_config_name"}}" description = "sample description for trust config" trust_stores { @@ -34,7 +34,7 @@ resource "google_certificate_manager_trust_config" "default" { resource "google_network_security_server_tls_policy" "default" { provider = google-beta location = "us-central1" - name = "<%= ctx[:vars]['server_tls_policy_name'] %>" + name = "{{index $.Vars "server_tls_policy_name"}}" description = "my description" allow_open = "false" mtls_policy { @@ -46,7 +46,7 @@ resource "google_network_security_server_tls_policy" "default" { resource "google_compute_region_ssl_certificate" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['ssl_certificate_name'] %>" + name = "{{index $.Vars "ssl_certificate_name"}}" private_key = file("path/to/private.key") certificate = file("path/to/certificate.crt") } @@ -54,7 +54,7 @@ resource "google_compute_region_ssl_certificate" "default" { resource "google_compute_region_url_map" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.default.id @@ -78,7 +78,7 @@ resource "google_compute_region_url_map" "default" { resource "google_compute_region_backend_service" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -91,7 +91,7 @@ resource "google_compute_region_backend_service" "default" { resource "google_compute_region_health_check" "default" { provider = google-beta region = "us-central1" - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_target_tcp_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_target_tcp_proxy_basic.tf.tmpl index 0237febc1db7..7c8c732c93d1 100644 --- a/mmv1/templates/terraform/examples/region_target_tcp_proxy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_target_tcp_proxy_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_region_target_tcp_proxy" "default" { - name = "<%= ctx[:vars]['region_target_tcp_proxy_name'] %>" + name = "{{index $.Vars "region_target_tcp_proxy_name"}}" region = "europe-west4" backend_service = google_compute_region_backend_service.default.id } resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['region_backend_service_name'] %>" + name = "{{index $.Vars "region_backend_service_name"}}" protocol = "TCP" timeout_sec = 10 region = "europe-west4" @@ -15,7 +15,7 @@ resource "google_compute_region_backend_service" "default" { } resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" region = "europe-west4" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/region_url_map_basic.tf.tmpl b/mmv1/templates/terraform/examples/region_url_map_basic.tf.tmpl index eb84ef5b2f3f..441af09addab 100644 --- a/mmv1/templates/terraform/examples/region_url_map_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_url_map_basic.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.home.id @@ -36,7 +36,7 @@ resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_region_backend_service" "login" { region = "us-central1" - name = "<%= ctx[:vars]['login_region_backend_service_name'] %>" + name = "{{index $.Vars "login_region_backend_service_name"}}" protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" timeout_sec = 10 @@ -47,7 +47,7 @@ resource "google_compute_region_backend_service" "login" { resource "google_compute_region_backend_service" "home" { region = "us-central1" - name = "<%= ctx[:vars]['home_region_backend_service_name'] %>" + name = "{{index $.Vars "home_region_backend_service_name"}}" protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" timeout_sec = 10 @@ -58,7 +58,7 @@ resource "google_compute_region_backend_service" "home" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 http_health_check { diff --git a/mmv1/templates/terraform/examples/region_url_map_default_route_action.tf.tmpl b/mmv1/templates/terraform/examples/region_url_map_default_route_action.tf.tmpl index 6f2d7980f064..2f462e8e0c46 100644 --- a/mmv1/templates/terraform/examples/region_url_map_default_route_action.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_url_map_default_route_action.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['region_url_map_name'] %>" + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_route_action { @@ -137,7 +137,7 @@ resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_region_backend_service" "login" { region = "us-central1" - name = "<%= ctx[:vars]['login_region_backend_service_name'] %>" + name = "{{index $.Vars "login_region_backend_service_name"}}" protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" timeout_sec = 10 @@ -148,7 +148,7 @@ resource "google_compute_region_backend_service" "login" { resource "google_compute_region_backend_service" "home" { region = "us-central1" - name = "<%= ctx[:vars]['home_region_backend_service_name'] %>" + name = "{{index $.Vars "home_region_backend_service_name"}}" protocol = "HTTP" load_balancing_scheme = "INTERNAL_MANAGED" timeout_sec = 10 @@ -159,7 +159,7 @@ resource "google_compute_region_backend_service" "home" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 http_health_check { diff --git a/mmv1/templates/terraform/examples/region_url_map_l7_ilb_path.tf.tmpl b/mmv1/templates/terraform/examples/region_url_map_l7_ilb_path.tf.tmpl index a4cf22b716db..c0a6e1560e2e 100644 --- a/mmv1/templates/terraform/examples/region_url_map_l7_ilb_path.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_url_map_l7_ilb_path.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['region_url_map_name'] %>" +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.home.id @@ -85,7 +85,7 @@ resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_region_backend_service" "home" { - name = "<%= ctx[:vars]['home_region_backend_service_name'] %>" + name = "{{index $.Vars "home_region_backend_service_name"}}" protocol = "HTTP" timeout_sec = 10 @@ -94,7 +94,7 @@ resource "google_compute_region_backend_service" "home" { } resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_url_map_l7_ilb_path_partial.tf.tmpl b/mmv1/templates/terraform/examples/region_url_map_l7_ilb_path_partial.tf.tmpl index c599b95bbadc..3e32c4d879dd 100644 --- a/mmv1/templates/terraform/examples/region_url_map_l7_ilb_path_partial.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_url_map_l7_ilb_path_partial.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['region_url_map_name'] %>" +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.home.id @@ -53,7 +53,7 @@ resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_region_backend_service" "home" { - name = "<%= ctx[:vars]['home_region_backend_service_name'] %>" + name = "{{index $.Vars "home_region_backend_service_name"}}" protocol = "HTTP" timeout_sec = 10 @@ -62,7 +62,7 @@ resource "google_compute_region_backend_service" "home" { } resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_url_map_l7_ilb_route.tf.tmpl b/mmv1/templates/terraform/examples/region_url_map_l7_ilb_route.tf.tmpl index 017cea1c1095..71c5d84b4d00 100644 --- a/mmv1/templates/terraform/examples/region_url_map_l7_ilb_route.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_url_map_l7_ilb_route.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['region_url_map_name'] %>" +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.home.id @@ -66,7 +66,7 @@ resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_region_backend_service" "home" { - name = "<%= ctx[:vars]['home_region_backend_service_name'] %>" + name = "{{index $.Vars "home_region_backend_service_name"}}" protocol = "HTTP" timeout_sec = 10 @@ -75,7 +75,7 @@ resource "google_compute_region_backend_service" "home" { } resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_url_map_l7_ilb_route_partial.tf.tmpl b/mmv1/templates/terraform/examples/region_url_map_l7_ilb_route_partial.tf.tmpl index a15b770a5a8d..0c92ac5e9204 100644 --- a/mmv1/templates/terraform/examples/region_url_map_l7_ilb_route_partial.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_url_map_l7_ilb_route_partial.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['region_url_map_name'] %>" +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "region_url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.home.id @@ -41,7 +41,7 @@ resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_region_backend_service" "home" { - name = "<%= ctx[:vars]['home_region_backend_service_name'] %>" + name = "{{index $.Vars "home_region_backend_service_name"}}" protocol = "HTTP" timeout_sec = 10 @@ -50,7 +50,7 @@ resource "google_compute_region_backend_service" "home" { } resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['region_health_check_name'] %>" + name = "{{index $.Vars "region_health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/region_url_map_path_template_match.tf.tmpl b/mmv1/templates/terraform/examples/region_url_map_path_template_match.tf.tmpl index 6c3218949f96..f313cfa20b62 100644 --- a/mmv1/templates/terraform/examples/region_url_map_path_template_match.tf.tmpl +++ b/mmv1/templates/terraform/examples/region_url_map_path_template_match.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_region_backend_service.home-backend.id @@ -41,7 +41,7 @@ resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_region_backend_service" "home-backend" { region = "us-central1" - name = "<%= ctx[:vars]['home_backend_service_name'] %>" + name = "{{index $.Vars "home_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -53,7 +53,7 @@ resource "google_compute_region_backend_service" "home-backend" { resource "google_compute_region_backend_service" "cart-backend" { region = "us-central1" - name = "<%= ctx[:vars]['cart_backend_service_name'] %>" + name = "{{index $.Vars "cart_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -65,7 +65,7 @@ resource "google_compute_region_backend_service" "cart-backend" { resource "google_compute_region_backend_service" "user-backend" { region = "us-central1" - name = "<%= ctx[:vars]['user_backend_service_name'] %>" + name = "{{index $.Vars "user_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -77,7 +77,7 @@ resource "google_compute_region_backend_service" "user-backend" { resource "google_compute_region_health_check" "default" { region = "us-central1" - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 http_health_check { diff --git a/mmv1/templates/terraform/examples/regional_external_http_load_balancer.tf.tmpl b/mmv1/templates/terraform/examples/regional_external_http_load_balancer.tf.tmpl index e8b369119734..bd95eafd6553 100644 --- a/mmv1/templates/terraform/examples/regional_external_http_load_balancer.tf.tmpl +++ b/mmv1/templates/terraform/examples/regional_external_http_load_balancer.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['lb_network'] %>" + name = "{{index $.Vars "lb_network"}}" auto_create_subnetworks = false routing_mode = "REGIONAL" } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['backend_subnet'] %>" + name = "{{index $.Vars "backend_subnet"}}" ip_cidr_range = "10.1.2.0/24" network = google_compute_network.default.id private_ipv6_google_access = "DISABLE_GOOGLE_ACCESS" @@ -16,7 +16,7 @@ resource "google_compute_subnetwork" "default" { } resource "google_compute_subnetwork" "proxy_only" { - name = "<%= ctx[:vars]['proxy_only_subnet'] %>" + name = "{{index $.Vars "proxy_only_subnet"}}" ip_cidr_range = "10.129.0.0/23" network = google_compute_network.default.id purpose = "REGIONAL_MANAGED_PROXY" @@ -25,7 +25,7 @@ resource "google_compute_subnetwork" "proxy_only" { } resource "google_compute_firewall" "default" { - name = "<%= ctx[:vars]['fw_allow_health_check'] %>" + name = "{{index $.Vars "fw_allow_health_check"}}" allow { protocol = "tcp" } @@ -37,7 +37,7 @@ resource "google_compute_firewall" "default" { } resource "google_compute_firewall" "allow_proxy" { - name = "<%= ctx[:vars]['fw_allow_proxies'] %>" + name = "{{index $.Vars "fw_allow_proxies"}}" allow { ports = ["443"] protocol = "tcp" @@ -58,7 +58,7 @@ resource "google_compute_firewall" "allow_proxy" { } resource "google_compute_instance_template" "default" { - name = "<%= ctx[:vars]['l7_xlb_backend_template'] %>" + name = "{{index $.Vars "l7_xlb_backend_template"}}" disk { auto_delete = true boot = true @@ -96,7 +96,7 @@ resource "google_compute_instance_template" "default" { } resource "google_compute_instance_group_manager" "default" { - name = "<%= ctx[:vars]['l7_xlb_backend_example'] %>" + name = "{{index $.Vars "l7_xlb_backend_example"}}" zone = "us-west1-a" named_port { name = "http" @@ -111,7 +111,7 @@ resource "google_compute_instance_group_manager" "default" { } resource "google_compute_address" "default" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" address_type = "EXTERNAL" network_tier = "STANDARD" region = "us-west1" @@ -119,7 +119,7 @@ resource "google_compute_address" "default" { resource "google_compute_region_health_check" "default" { - name = "<%= ctx[:vars]['l7_xlb_basic_check'] %>" + name = "{{index $.Vars "l7_xlb_basic_check"}}" check_interval_sec = 5 healthy_threshold = 2 http_health_check { @@ -133,7 +133,7 @@ resource "google_compute_region_health_check" "default" { } resource "google_compute_region_backend_service" "default" { - name = "<%= ctx[:vars]['l7_xlb_backend_service'] %>" + name = "{{index $.Vars "l7_xlb_backend_service"}}" region = "us-west1" load_balancing_scheme = "EXTERNAL_MANAGED" health_checks = [google_compute_region_health_check.default.id] @@ -147,14 +147,14 @@ resource "google_compute_region_backend_service" "default" { } } -resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['regional_l7_xlb_map'] %>" +resource "google_compute_region_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "regional_l7_xlb_map"}}" region = "us-west1" default_service = google_compute_region_backend_service.default.id } resource "google_compute_region_target_http_proxy" "default" { - name = "<%= ctx[:vars]['l7_xlb_proxy'] %>" + name = "{{index $.Vars "l7_xlb_proxy"}}" region = "us-west1" url_map = google_compute_region_url_map.default.id } diff --git a/mmv1/templates/terraform/examples/regional_secret_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/regional_secret_config_basic.tf.tmpl index a7754bd7b5fc..9b6f09711d16 100644 --- a/mmv1/templates/terraform/examples/regional_secret_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/regional_secret_config_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_secret_manager_regional_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_regional_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" location = "us-central1" labels = { diff --git a/mmv1/templates/terraform/examples/regional_secret_with_cmek.tf.tmpl b/mmv1/templates/terraform/examples/regional_secret_with_cmek.tf.tmpl index 19ff3c12338f..23c8fde37e7c 100644 --- a/mmv1/templates/terraform/examples/regional_secret_with_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/regional_secret_with_cmek.tf.tmpl @@ -1,17 +1,17 @@ data "google_project" "project" {} resource "google_kms_crypto_key_iam_member" "kms-secret-binding" { - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-secretmanager.iam.gserviceaccount.com" } -resource "google_secret_manager_regional_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_regional_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" location = "us-central1" customer_managed_encryption { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } depends_on = [ google_kms_crypto_key_iam_member.kms-secret-binding ] diff --git a/mmv1/templates/terraform/examples/regional_secret_with_expire_time.tf.tmpl b/mmv1/templates/terraform/examples/regional_secret_with_expire_time.tf.tmpl index 53b983ff587d..c4c501d09821 100644 --- a/mmv1/templates/terraform/examples/regional_secret_with_expire_time.tf.tmpl +++ b/mmv1/templates/terraform/examples/regional_secret_with_expire_time.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_secret_manager_regional_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_regional_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" location = "us-central1" labels = { @@ -12,5 +12,5 @@ resource "google_secret_manager_regional_secret" "<%= ctx[:primary_resource_id] key3 = "value3" } - expire_time = "<%= ctx[:vars]['timestamp'] %>" + expire_time = "{{index $.Vars "timestamp"}}" } diff --git a/mmv1/templates/terraform/examples/regional_secret_with_rotation.tf.tmpl b/mmv1/templates/terraform/examples/regional_secret_with_rotation.tf.tmpl index 21f2861f6b87..f8c7485a05b8 100644 --- a/mmv1/templates/terraform/examples/regional_secret_with_rotation.tf.tmpl +++ b/mmv1/templates/terraform/examples/regional_secret_with_rotation.tf.tmpl @@ -1,7 +1,7 @@ data "google_project" "project" {} resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['topic_id'] %>" + name = "{{index $.Vars "topic_id"}}" } resource "google_pubsub_topic_iam_member" "secrets_manager_access" { @@ -10,8 +10,8 @@ resource "google_pubsub_topic_iam_member" "secrets_manager_access" { member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-secretmanager.iam.gserviceaccount.com" } -resource "google_secret_manager_regional_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_regional_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" location = "us-central1" topics { @@ -20,7 +20,7 @@ resource "google_secret_manager_regional_secret" "<%= ctx[:primary_resource_id] rotation { rotation_period = "3600s" - next_rotation_time = "<%= ctx[:vars]['timestamp'] %>" + next_rotation_time = "{{index $.Vars "timestamp"}}" } depends_on = [ diff --git a/mmv1/templates/terraform/examples/regional_secret_with_ttl.tf.tmpl b/mmv1/templates/terraform/examples/regional_secret_with_ttl.tf.tmpl index 134680462403..0b5781646ef5 100644 --- a/mmv1/templates/terraform/examples/regional_secret_with_ttl.tf.tmpl +++ b/mmv1/templates/terraform/examples/regional_secret_with_ttl.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_secret_manager_regional_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_regional_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" location = "us-central1" labels = { diff --git a/mmv1/templates/terraform/examples/regional_secret_with_version_destroy_ttl.tf.tmpl b/mmv1/templates/terraform/examples/regional_secret_with_version_destroy_ttl.tf.tmpl index d2081c43eb85..2863feb442bd 100644 --- a/mmv1/templates/terraform/examples/regional_secret_with_version_destroy_ttl.tf.tmpl +++ b/mmv1/templates/terraform/examples/regional_secret_with_version_destroy_ttl.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_secret_manager_regional_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_regional_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" location = "us-central1" labels = { diff --git a/mmv1/templates/terraform/examples/reservation_basic.tf.tmpl b/mmv1/templates/terraform/examples/reservation_basic.tf.tmpl index 7163c95458cf..9c322dae83d1 100644 --- a/mmv1/templates/terraform/examples/reservation_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/reservation_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_reservation" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['reservation_name'] %>" +resource "google_compute_reservation" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "reservation_name"}}" zone = "us-central1-a" specific_reservation { diff --git a/mmv1/templates/terraform/examples/resource_manager_lien.tf.tmpl b/mmv1/templates/terraform/examples/resource_manager_lien.tf.tmpl index 5f64d49be9fb..e847ec9b4eac 100644 --- a/mmv1/templates/terraform/examples/resource_manager_lien.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_manager_lien.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_resource_manager_lien" "<%= ctx[:primary_resource_id] %>" { +resource "google_resource_manager_lien" "{{$.PrimaryResourceId}}" { parent = "projects/${google_project.project.number}" restrictions = ["resourcemanager.projects.delete"] origin = "machine-readable-explanation" @@ -6,7 +6,7 @@ resource "google_resource_manager_lien" "<%= ctx[:primary_resource_id] %>" { } resource "google_project" "project" { - project_id = "<%= ctx[:vars]["project_id"] %>" + project_id = "{{index $.Vars "project_id"}}" name = "A very important project!" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/resource_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_basic.tf.tmpl index 1aadc57370b3..d4cb35048241 100644 --- a/mmv1/templates/terraform/examples/resource_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_policy_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_resource_policy" "foo" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" snapshot_schedule_policy { schedule { diff --git a/mmv1/templates/terraform/examples/resource_policy_consistency_group.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_consistency_group.tf.tmpl index 87adb1ce9c77..88a44de52448 100644 --- a/mmv1/templates/terraform/examples/resource_policy_consistency_group.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_policy_consistency_group.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_resource_policy" "cgroup" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "europe-west1" disk_consistency_group_policy { enabled = true diff --git a/mmv1/templates/terraform/examples/resource_policy_full.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_full.tf.tmpl index d699543ed8c0..81d8d8e5fb75 100644 --- a/mmv1/templates/terraform/examples/resource_policy_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_policy_full.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_resource_policy" "bar" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" snapshot_schedule_policy { schedule { diff --git a/mmv1/templates/terraform/examples/resource_policy_hourly_format.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_hourly_format.tf.tmpl index 5a72ea50ba71..ec49dce4702b 100644 --- a/mmv1/templates/terraform/examples/resource_policy_hourly_format.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_policy_hourly_format.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_resource_policy" "foo" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" snapshot_schedule_policy { schedule { diff --git a/mmv1/templates/terraform/examples/resource_policy_instance_schedule_policy.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_instance_schedule_policy.tf.tmpl index c763238b7436..e7d38e1d810b 100644 --- a/mmv1/templates/terraform/examples/resource_policy_instance_schedule_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_policy_instance_schedule_policy.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_resource_policy" "hourly" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" description = "Start and stop instances" instance_schedule_policy { diff --git a/mmv1/templates/terraform/examples/resource_policy_placement_policy.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_placement_policy.tf.tmpl index d7b986612db4..0ea17ead41c9 100644 --- a/mmv1/templates/terraform/examples/resource_policy_placement_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_policy_placement_policy.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_resource_policy" "baz" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" group_placement_policy { vm_count = 2 diff --git a/mmv1/templates/terraform/examples/resource_policy_placement_policy_max_distance.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_placement_policy_max_distance.tf.tmpl index 1f4dab08d162..d7b0cde69b52 100644 --- a/mmv1/templates/terraform/examples/resource_policy_placement_policy_max_distance.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_policy_placement_policy_max_distance.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_resource_policy" "baz" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" provider = google-beta group_placement_policy { diff --git a/mmv1/templates/terraform/examples/resource_policy_snapshot_schedule_chain_name.tf.tmpl b/mmv1/templates/terraform/examples/resource_policy_snapshot_schedule_chain_name.tf.tmpl index 20d6003907df..630ed31c4cab 100644 --- a/mmv1/templates/terraform/examples/resource_policy_snapshot_schedule_chain_name.tf.tmpl +++ b/mmv1/templates/terraform/examples/resource_policy_snapshot_schedule_chain_name.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_resource_policy" "hourly" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" description = "chain name snapshot" snapshot_schedule_policy { diff --git a/mmv1/templates/terraform/examples/route_basic.tf.tmpl b/mmv1/templates/terraform/examples/route_basic.tf.tmpl index feb6b11d206c..756ad1171e04 100644 --- a/mmv1/templates/terraform/examples/route_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/route_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_route" "default" { - name = "<%= ctx[:vars]['route_name'] %>" + name = "{{index $.Vars "route_name"}}" dest_range = "15.0.0.0/24" network = google_compute_network.default.name next_hop_ip = "10.132.1.5" @@ -7,5 +7,5 @@ resource "google_compute_route" "default" { } resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/route_ilb.tf.tmpl b/mmv1/templates/terraform/examples/route_ilb.tf.tmpl index 8a6376c32031..b96ca85021cf 100644 --- a/mmv1/templates/terraform/examples/route_ilb.tf.tmpl +++ b/mmv1/templates/terraform/examples/route_ilb.tf.tmpl @@ -1,17 +1,17 @@ resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" ip_cidr_range = "10.0.1.0/24" region = "us-central1" network = google_compute_network.default.id } resource "google_compute_health_check" "hc" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -21,13 +21,13 @@ resource "google_compute_health_check" "hc" { } resource "google_compute_region_backend_service" "backend" { - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" region = "us-central1" health_checks = [google_compute_health_check.hc.id] } resource "google_compute_forwarding_rule" "default" { - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "INTERNAL" @@ -37,8 +37,8 @@ resource "google_compute_forwarding_rule" "default" { subnetwork = google_compute_subnetwork.default.name } -resource "google_compute_route" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['route_name'] %>" +resource "google_compute_route" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "route_name"}}" dest_range = "0.0.0.0/0" network = google_compute_network.default.name next_hop_ilb = google_compute_forwarding_rule.default.id diff --git a/mmv1/templates/terraform/examples/route_ilb_vip.tf.tmpl b/mmv1/templates/terraform/examples/route_ilb_vip.tf.tmpl index 7b9bc7d265a6..df9cda41e0b2 100644 --- a/mmv1/templates/terraform/examples/route_ilb_vip.tf.tmpl +++ b/mmv1/templates/terraform/examples/route_ilb_vip.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_network" "producer" { provider = google-beta - name = "<%= ctx[:vars]['producer_name'] %>-vpc" + name = "{{index $.Vars "producer_name"}}-vpc" auto_create_subnetworks = false } resource "google_compute_subnetwork" "producer" { provider = google-beta - name = "<%= ctx[:vars]['producer_name'] %>-subnet" + name = "{{index $.Vars "producer_name"}}-subnet" ip_cidr_range = "10.0.1.0/24" region = "us-central1" network = google_compute_network.producer.id @@ -14,13 +14,13 @@ resource "google_compute_subnetwork" "producer" { resource "google_compute_network" "consumer" { provider = google-beta - name = "<%= ctx[:vars]['consumer_name'] %>-vpc" + name = "{{index $.Vars "consumer_name"}}-vpc" auto_create_subnetworks = false } resource "google_compute_subnetwork" "consumer" { provider = google-beta - name = "<%= ctx[:vars]['consumer_name'] %>-subnet" + name = "{{index $.Vars "consumer_name"}}-subnet" ip_cidr_range = "10.0.2.0/24" region = "us-central1" network = google_compute_network.consumer.id @@ -28,21 +28,21 @@ resource "google_compute_subnetwork" "consumer" { resource "google_compute_network_peering" "peering1" { provider = google-beta - name = "peering-<%= ctx[:vars]['producer_name'] %>-to-<%= ctx[:vars]['consumer_name'] %>" + name = "peering-{{index $.Vars "producer_name"}}-to-{{index $.Vars "consumer_name"}}" network = google_compute_network.consumer.id peer_network = google_compute_network.producer.id } resource "google_compute_network_peering" "peering2" { provider = google-beta - name = "peering-<%= ctx[:vars]['consumer_name'] %>-to-<%= ctx[:vars]['producer_name'] %>" + name = "peering-{{index $.Vars "consumer_name"}}-to-{{index $.Vars "producer_name"}}" network = google_compute_network.producer.id peer_network = google_compute_network.consumer.id } resource "google_compute_health_check" "hc" { provider = google-beta - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -53,14 +53,14 @@ resource "google_compute_health_check" "hc" { resource "google_compute_region_backend_service" "backend" { provider = google-beta - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" region = "us-central1" health_checks = [google_compute_health_check.hc.id] } resource "google_compute_forwarding_rule" "default" { provider = google-beta - name = "<%= ctx[:vars]['forwarding_rule_name'] %>" + name = "{{index $.Vars "forwarding_rule_name"}}" region = "us-central1" load_balancing_scheme = "INTERNAL" @@ -70,9 +70,9 @@ resource "google_compute_forwarding_rule" "default" { subnetwork = google_compute_subnetwork.producer.name } -resource "google_compute_route" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_route" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['route_name'] %>" + name = "{{index $.Vars "route_name"}}" dest_range = "0.0.0.0/0" network = google_compute_network.consumer.name next_hop_ilb = google_compute_forwarding_rule.default.ip_address diff --git a/mmv1/templates/terraform/examples/router_basic.tf.tmpl b/mmv1/templates/terraform/examples/router_basic.tf.tmpl index efdb7182a370..589f29574c27 100644 --- a/mmv1/templates/terraform/examples/router_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_router" "foobar" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" network = google_compute_network.foobar.name bgp { asn = 64514 @@ -15,6 +15,6 @@ resource "google_compute_router" "foobar" { } resource "google_compute_network" "foobar" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/router_nat_basic.tf.tmpl b/mmv1/templates/terraform/examples/router_nat_basic.tf.tmpl index 7bb8629a90c1..8a976247e2a1 100644 --- a/mmv1/templates/terraform/examples/router_nat_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_nat_basic.tf.tmpl @@ -1,16 +1,16 @@ resource "google_compute_network" "net" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_subnetwork" "subnet" { - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" network = google_compute_network.net.id ip_cidr_range = "10.0.0.0/16" region = "us-central1" } resource "google_compute_router" "router" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" region = google_compute_subnetwork.subnet.region network = google_compute_network.net.id @@ -19,8 +19,8 @@ resource "google_compute_router" "router" { } } -resource "google_compute_router_nat" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['nat_name'] %>" +resource "google_compute_router_nat" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "nat_name"}}" router = google_compute_router.router.name region = google_compute_router.router.region nat_ip_allocate_option = "AUTO_ONLY" diff --git a/mmv1/templates/terraform/examples/router_nat_manual_ips.tf.tmpl b/mmv1/templates/terraform/examples/router_nat_manual_ips.tf.tmpl index bb0182c1c1b5..9a230c83cf38 100644 --- a/mmv1/templates/terraform/examples/router_nat_manual_ips.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_nat_manual_ips.tf.tmpl @@ -1,23 +1,23 @@ resource "google_compute_network" "net" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_subnetwork" "subnet" { - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" network = google_compute_network.net.id ip_cidr_range = "10.0.0.0/16" region = "us-central1" } resource "google_compute_router" "router" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" region = google_compute_subnetwork.subnet.region network = google_compute_network.net.id } resource "google_compute_address" "address" { count = 2 - name = "<%= ctx[:vars]['address_name'] %>-${count.index}" + name = "{{index $.Vars "address_name"}}-${count.index}" region = google_compute_subnetwork.subnet.region lifecycle { @@ -25,8 +25,8 @@ resource "google_compute_address" "address" { } } -resource "google_compute_router_nat" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['nat_name'] %>" +resource "google_compute_router_nat" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "nat_name"}}" router = google_compute_router.router.name region = google_compute_router.router.region diff --git a/mmv1/templates/terraform/examples/router_nat_private.tf.tmpl b/mmv1/templates/terraform/examples/router_nat_private.tf.tmpl index 8606db04c60a..db359a5e1108 100644 --- a/mmv1/templates/terraform/examples/router_nat_private.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_nat_private.tf.tmpl @@ -1,13 +1,13 @@ resource "google_compute_network" "net" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_subnetwork" "subnet" { provider = google-beta - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" network = google_compute_network.net.id ip_cidr_range = "10.0.0.0/16" region = "us-central1" @@ -17,7 +17,7 @@ resource "google_compute_subnetwork" "subnet" { resource "google_compute_router" "router" { provider = google-beta - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" region = google_compute_subnetwork.subnet.region network = google_compute_network.net.id } @@ -25,14 +25,14 @@ resource "google_compute_router" "router" { resource "google_network_connectivity_hub" "hub" { provider = google-beta - name = "<%= ctx[:vars]['hub_name'] %>" + name = "{{index $.Vars "hub_name"}}" description = "vpc hub for inter vpc nat" } resource "google_network_connectivity_spoke" "spoke" { provider = google-beta - name = "<%= ctx[:vars]['spoke_name'] %>" + name = "{{index $.Vars "spoke_name"}}" location = "global" description = "vpc spoke for inter vpc nat" hub = google_network_connectivity_hub.hub.id @@ -45,10 +45,10 @@ resource "google_network_connectivity_spoke" "spoke" { } } -resource "google_compute_router_nat" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_router_nat" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['nat_name'] %>" + name = "{{index $.Vars "nat_name"}}" router = google_compute_router.router.name region = google_compute_router.router.region source_subnetwork_ip_ranges_to_nat = "LIST_OF_SUBNETWORKS" @@ -63,7 +63,7 @@ resource "google_compute_router_nat" "<%= ctx[:primary_resource_id] %>" { rules { rule_number = 100 description = "rule for private nat" - match = "nexthop.hub == \"//networkconnectivity.googleapis.com/projects/acm-test-proj-123/locations/global/hubs/<%= ctx[:vars]['hub_name'] %>\"" + match = "nexthop.hub == \"//networkconnectivity.googleapis.com/projects/acm-test-proj-123/locations/global/hubs/{{index $.Vars "hub_name"}}\"" action { source_nat_active_ranges = [ google_compute_subnetwork.subnet.self_link diff --git a/mmv1/templates/terraform/examples/router_nat_rules.tf.tmpl b/mmv1/templates/terraform/examples/router_nat_rules.tf.tmpl index 94387e39a6ba..e29f82a0e471 100644 --- a/mmv1/templates/terraform/examples/router_nat_rules.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_nat_rules.tf.tmpl @@ -1,38 +1,38 @@ resource "google_compute_network" "net" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnet" { - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" network = google_compute_network.net.id ip_cidr_range = "10.0.0.0/16" region = "us-central1" } resource "google_compute_router" "router" { - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" region = google_compute_subnetwork.subnet.region network = google_compute_network.net.id } resource "google_compute_address" "addr1" { - name = "<%= ctx[:vars]['address_name1'] %>" + name = "{{index $.Vars "address_name1"}}" region = google_compute_subnetwork.subnet.region } resource "google_compute_address" "addr2" { - name = "<%= ctx[:vars]['address_name2'] %>" + name = "{{index $.Vars "address_name2"}}" region = google_compute_subnetwork.subnet.region } resource "google_compute_address" "addr3" { - name = "<%= ctx[:vars]['address_name3'] %>" + name = "{{index $.Vars "address_name3"}}" region = google_compute_subnetwork.subnet.region } -resource "google_compute_router_nat" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['nat_name'] %>" +resource "google_compute_router_nat" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "nat_name"}}" router = google_compute_router.router.name region = google_compute_router.router.region diff --git a/mmv1/templates/terraform/examples/router_peer_basic.tf.tmpl b/mmv1/templates/terraform/examples/router_peer_basic.tf.tmpl index b63b6d195d60..c1a95982b1dc 100644 --- a/mmv1/templates/terraform/examples/router_peer_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_peer_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_router_peer" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['peer_name'] %>" - router = "<%= ctx[:vars]['router_name'] %>" +resource "google_compute_router_peer" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "peer_name"}}" + router = "{{index $.Vars "router_name"}}" region = "us-central1" peer_asn = 65513 advertised_route_priority = 100 diff --git a/mmv1/templates/terraform/examples/router_peer_bfd.tf.tmpl b/mmv1/templates/terraform/examples/router_peer_bfd.tf.tmpl index 185914e74aed..98e18afc0081 100644 --- a/mmv1/templates/terraform/examples/router_peer_bfd.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_peer_bfd.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_router_peer" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['peer_name'] %>" - router = "<%= ctx[:vars]['router_name'] %>" +resource "google_compute_router_peer" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "peer_name"}}" + router = "{{index $.Vars "router_name"}}" region = "us-central1" peer_ip_address = "169.254.1.2" peer_asn = 65513 diff --git a/mmv1/templates/terraform/examples/router_peer_disabled.tf.tmpl b/mmv1/templates/terraform/examples/router_peer_disabled.tf.tmpl index abee06f2500e..2788cf29b8d3 100644 --- a/mmv1/templates/terraform/examples/router_peer_disabled.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_peer_disabled.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_router_peer" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['peer_name'] %>" - router = "<%= ctx[:vars]['router_name'] %>" +resource "google_compute_router_peer" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "peer_name"}}" + router = "{{index $.Vars "router_name"}}" region = "us-central1" peer_ip_address = "169.254.1.2" peer_asn = 65513 diff --git a/mmv1/templates/terraform/examples/router_peer_router_appliance.tf.tmpl b/mmv1/templates/terraform/examples/router_peer_router_appliance.tf.tmpl index d194c4154cc6..80970581a858 100644 --- a/mmv1/templates/terraform/examples/router_peer_router_appliance.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_peer_router_appliance.tf.tmpl @@ -1,31 +1,31 @@ resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['router_name'] %>-net" + name = "{{index $.Vars "router_name"}}-net" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnetwork" { - name = "<%= ctx[:vars]['router_name'] %>-sub" + name = "{{index $.Vars "router_name"}}-sub" network = google_compute_network.network.self_link ip_cidr_range = "10.0.0.0/16" region = "us-central1" } resource "google_compute_address" "addr_intf" { - name = "<%= ctx[:vars]['router_name'] %>-addr-intf" + name = "{{index $.Vars "router_name"}}-addr-intf" region = google_compute_subnetwork.subnetwork.region subnetwork = google_compute_subnetwork.subnetwork.id address_type = "INTERNAL" } resource "google_compute_address" "addr_intf_redundant" { - name = "<%= ctx[:vars]['router_name'] %>-addr-intf-red" + name = "{{index $.Vars "router_name"}}-addr-intf-red" region = google_compute_subnetwork.subnetwork.region subnetwork = google_compute_subnetwork.subnetwork.id address_type = "INTERNAL" } resource "google_compute_address" "addr_peer" { - name = "<%= ctx[:vars]['router_name'] %>-addr-peer" + name = "{{index $.Vars "router_name"}}-addr-peer" region = google_compute_subnetwork.subnetwork.region subnetwork = google_compute_subnetwork.subnetwork.id address_type = "INTERNAL" @@ -50,11 +50,11 @@ resource "google_compute_instance" "instance" { } resource "google_network_connectivity_hub" "hub" { - name = "<%= ctx[:vars]['router_name'] %>-hub" + name = "{{index $.Vars "router_name"}}-hub" } resource "google_network_connectivity_spoke" "spoke" { - name = "<%= ctx[:vars]['router_name'] %>-spoke" + name = "{{index $.Vars "router_name"}}-spoke" location = google_compute_subnetwork.subnetwork.region hub = google_network_connectivity_hub.hub.id @@ -68,7 +68,7 @@ resource "google_network_connectivity_spoke" "spoke" { } resource "google_compute_router" "router" { - name = "<%= ctx[:vars]['router_name'] %>-router" + name = "{{index $.Vars "router_name"}}-router" region = google_compute_subnetwork.subnetwork.region network = google_compute_network.network.self_link bgp { @@ -77,7 +77,7 @@ resource "google_compute_router" "router" { } resource "google_compute_router_interface" "interface_redundant" { - name = "<%= ctx[:vars]['router_name'] %>-intf-red" + name = "{{index $.Vars "router_name"}}-intf-red" region = google_compute_router.router.region router = google_compute_router.router.name subnetwork = google_compute_subnetwork.subnetwork.self_link @@ -85,7 +85,7 @@ resource "google_compute_router_interface" "interface_redundant" { } resource "google_compute_router_interface" "interface" { - name = "<%= ctx[:vars]['router_name'] %>-intf" + name = "{{index $.Vars "router_name"}}-intf" region = google_compute_router.router.region router = google_compute_router.router.name subnetwork = google_compute_subnetwork.subnetwork.self_link @@ -94,7 +94,7 @@ resource "google_compute_router_interface" "interface" { } resource "google_compute_router_peer" "peer" { - name = "<%= ctx[:vars]['peer_name'] %>" + name = "{{index $.Vars "peer_name"}}" router = google_compute_router.router.name region = google_compute_router.router.region interface = google_compute_router_interface.interface.name diff --git a/mmv1/templates/terraform/examples/router_route_policy_export.tf.tmpl b/mmv1/templates/terraform/examples/router_route_policy_export.tf.tmpl index 1f3bcd3d0552..d64f9eb44861 100644 --- a/mmv1/templates/terraform/examples/router_route_policy_export.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_route_policy_export.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_network" "net" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnet" { provider = google-beta - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" network = google_compute_network.net.id ip_cidr_range = "10.0.0.0/16" region = "us-central1" @@ -14,16 +14,16 @@ resource "google_compute_subnetwork" "subnet" { resource "google_compute_router" "router" { provider = google-beta - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" region = google_compute_subnetwork.subnet.region network = google_compute_network.net.id } -resource "google_compute_router_route_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_router_route_policy" "{{$.PrimaryResourceId}}" { provider = google-beta router = google_compute_router.router.name region = google_compute_router.router.region - name = "<%= ctx[:vars]['route_policy_name'] %>" + name = "{{index $.Vars "route_policy_name"}}" type = "ROUTE_POLICY_TYPE_EXPORT" terms { priority = 1 diff --git a/mmv1/templates/terraform/examples/router_route_policy_import.tf.tmpl b/mmv1/templates/terraform/examples/router_route_policy_import.tf.tmpl index d3f4a7ae527e..7253d78aa9c1 100644 --- a/mmv1/templates/terraform/examples/router_route_policy_import.tf.tmpl +++ b/mmv1/templates/terraform/examples/router_route_policy_import.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_network" "net" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnet" { provider = google-beta - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" network = google_compute_network.net.id ip_cidr_range = "10.0.0.0/16" region = "us-central1" @@ -14,14 +14,14 @@ resource "google_compute_subnetwork" "subnet" { resource "google_compute_router" "router" { provider = google-beta - name = "<%= ctx[:vars]['router_name'] %>" + name = "{{index $.Vars "router_name"}}" region = google_compute_subnetwork.subnet.region network = google_compute_network.net.id } -resource "google_compute_router_route_policy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_router_route_policy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['route_policy_name'] %>" + name = "{{index $.Vars "route_policy_name"}}" router = google_compute_router.router.name region = google_compute_router.router.region type = "ROUTE_POLICY_TYPE_IMPORT" diff --git a/mmv1/templates/terraform/examples/runtimeconfig_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/runtimeconfig_config_basic.tf.tmpl index 732f6c4d1f18..36a0cddd3a13 100644 --- a/mmv1/templates/terraform/examples/runtimeconfig_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/runtimeconfig_config_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_runtimeconfig_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_runtimeconfig_config" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['config_name'] %>" + name = "{{index $.Vars "config_name"}}" description = "Runtime configuration values for my service" } diff --git a/mmv1/templates/terraform/examples/scan_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scan_config_basic.tf.tmpl index e65978f0c36f..65459c8d5a3d 100644 --- a/mmv1/templates/terraform/examples/scan_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scan_config_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_compute_address" "scanner_static_ip" { provider = google-beta - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" } -resource "google_security_scanner_scan_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_security_scanner_scan_config" "{{$.PrimaryResourceId}}" { provider = google-beta - display_name = "<%= ctx[:vars]['scan_config_name'] %>" + display_name = "{{index $.Vars "scan_config_name"}}" starting_urls = ["http://${google_compute_address.scanner_static_ip.address}"] target_platforms = ["COMPUTE"] } diff --git a/mmv1/templates/terraform/examples/scc_event_threat_detection_custom_module.tf.tmpl b/mmv1/templates/terraform/examples/scc_event_threat_detection_custom_module.tf.tmpl index 8f7c08b49f8c..e56912cb99e2 100644 --- a/mmv1/templates/terraform/examples/scc_event_threat_detection_custom_module.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_event_threat_detection_custom_module.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_scc_event_threat_detection_custom_module" "<%= ctx[:primary_resource_id] %>" { - organization = "<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_scc_event_threat_detection_custom_module" "{{$.PrimaryResourceId}}" { + organization = "{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" - type = "<%= ctx[:vars]['type'] %>" + type = "{{index $.Vars "type"}}" description = "My Event Threat Detection Custom Module" config = jsonencode({ "metadata": { diff --git a/mmv1/templates/terraform/examples/scc_folder_big_query_export_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_folder_big_query_export_config_basic.tf.tmpl index 48b368ec2ac8..f2b22fa160fc 100644 --- a/mmv1/templates/terraform/examples/scc_folder_big_query_export_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_folder_big_query_export_config_basic.tf.tmpl @@ -1,12 +1,12 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" deletion_protection = false } resource "google_bigquery_dataset" "default" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -22,8 +22,8 @@ resource "google_bigquery_dataset" "default" { } } -resource "google_scc_folder_scc_big_query_export" "<%= ctx[:primary_resource_id] %>" { - big_query_export_id = "<%= ctx[:vars]['big_query_export_id'] %>" +resource "google_scc_folder_scc_big_query_export" "{{$.PrimaryResourceId}}" { + big_query_export_id = "{{index $.Vars "big_query_export_id"}}" folder = google_folder.folder.folder_id dataset = google_bigquery_dataset.default.id description = "Cloud Security Command Center Findings Big Query Export Config" diff --git a/mmv1/templates/terraform/examples/scc_folder_custom_module_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_folder_custom_module_basic.tf.tmpl index dd07ad92a244..594d8ee62d72 100644 --- a/mmv1/templates/terraform/examples/scc_folder_custom_module_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_folder_custom_module_basic.tf.tmpl @@ -1,12 +1,12 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" deletion_protection = false } -resource "google_scc_folder_custom_module" "<%= ctx[:primary_resource_id] %>" { +resource "google_scc_folder_custom_module" "{{$.PrimaryResourceId}}" { folder = google_folder.folder.folder_id - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_folder_custom_module_full.tf.tmpl b/mmv1/templates/terraform/examples/scc_folder_custom_module_full.tf.tmpl index cce74f61865d..56c049c3436b 100644 --- a/mmv1/templates/terraform/examples/scc_folder_custom_module_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_folder_custom_module_full.tf.tmpl @@ -1,12 +1,12 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" deletion_protection = false } -resource "google_scc_folder_custom_module" "<%= ctx[:primary_resource_id] %>" { +resource "google_scc_folder_custom_module" "{{$.PrimaryResourceId}}" { folder = google_folder.folder.folder_id - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_folder_notification_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_folder_notification_config_basic.tf.tmpl index b52d7e8c983e..a134f680be06 100644 --- a/mmv1/templates/terraform/examples/scc_folder_notification_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_folder_notification_config_basic.tf.tmpl @@ -1,14 +1,14 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" } resource "google_pubsub_topic" "scc_folder_notification_config" { - name = "<%= ctx[:vars]['topic_name'] %>" + name = "{{index $.Vars "topic_name"}}" } -resource "google_scc_folder_notification_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" +resource "google_scc_folder_notification_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" folder = google_folder.folder.folder_id location = "global" description = "My custom Cloud Security Command Center Finding Notification Configuration" diff --git a/mmv1/templates/terraform/examples/scc_management_folder_security_health_analytics_custom_module_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_management_folder_security_health_analytics_custom_module_basic.tf.tmpl index 7042af8d7d20..a06a45f0fab6 100644 --- a/mmv1/templates/terraform/examples/scc_management_folder_security_health_analytics_custom_module_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_management_folder_security_health_analytics_custom_module_basic.tf.tmpl @@ -1,13 +1,13 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" deletion_protection = false } -resource "google_scc_management_folder_security_health_analytics_custom_module" "<%= ctx[:primary_resource_id] %>" { +resource "google_scc_management_folder_security_health_analytics_custom_module" "{{$.PrimaryResourceId}}" { folder = google_folder.folder.folder_id location = "global" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_management_folder_security_health_analytics_custom_module_full.tf.tmpl b/mmv1/templates/terraform/examples/scc_management_folder_security_health_analytics_custom_module_full.tf.tmpl index c0974a7b35b5..1c328913e752 100644 --- a/mmv1/templates/terraform/examples/scc_management_folder_security_health_analytics_custom_module_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_management_folder_security_health_analytics_custom_module_full.tf.tmpl @@ -1,13 +1,13 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" deletion_protection = false } -resource "google_scc_management_folder_security_health_analytics_custom_module" "<%= ctx[:primary_resource_id] %>" { +resource "google_scc_management_folder_security_health_analytics_custom_module" "{{$.PrimaryResourceId}}" { folder = google_folder.folder.folder_id location = "global" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_management_organization_event_threat_detection_custom_module.tf.tmpl b/mmv1/templates/terraform/examples/scc_management_organization_event_threat_detection_custom_module.tf.tmpl index ad7fed178439..badc584445b3 100644 --- a/mmv1/templates/terraform/examples/scc_management_organization_event_threat_detection_custom_module.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_management_organization_event_threat_detection_custom_module.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_scc_management_organization_event_threat_detection_custom_module" "<%= ctx[:primary_resource_id] %>" { - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_management_organization_event_threat_detection_custom_module" "{{$.PrimaryResourceId}}" { + organization = "{{index $.TestEnvVars "org_id"}}" location = "global" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" - type = "<%= ctx[:vars]['type'] %>" + type = "{{index $.Vars "type"}}" description = "My Event Threat Detection Custom Module" config = jsonencode({ "metadata": { diff --git a/mmv1/templates/terraform/examples/scc_management_organization_project_security_health_analytics_custom_module_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_management_organization_project_security_health_analytics_custom_module_basic.tf.tmpl index f023f5490fc3..39ea244c1f06 100644 --- a/mmv1/templates/terraform/examples/scc_management_organization_project_security_health_analytics_custom_module_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_management_organization_project_security_health_analytics_custom_module_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_management_project_security_health_analytics_custom_module" "<%= ctx[:primary_resource_id] %>" { +resource "google_scc_management_project_security_health_analytics_custom_module" "{{$.PrimaryResourceId}}" { location = "global" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_management_organization_project_security_health_analytics_custom_module_full.tf.tmpl b/mmv1/templates/terraform/examples/scc_management_organization_project_security_health_analytics_custom_module_full.tf.tmpl index 78c99e2819b2..a986ac74a1ec 100644 --- a/mmv1/templates/terraform/examples/scc_management_organization_project_security_health_analytics_custom_module_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_management_organization_project_security_health_analytics_custom_module_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_management_project_security_health_analytics_custom_module" "<%= ctx[:primary_resource_id] %>" { +resource "google_scc_management_project_security_health_analytics_custom_module" "{{$.PrimaryResourceId}}" { location = "global" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_management_organization_security_health_analytics_custom_module_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_management_organization_security_health_analytics_custom_module_basic.tf.tmpl index 75e06a99b102..aec1c1fe7cbc 100644 --- a/mmv1/templates/terraform/examples/scc_management_organization_security_health_analytics_custom_module_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_management_organization_security_health_analytics_custom_module_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_management_organization_security_health_analytics_custom_module" "<%= ctx[:primary_resource_id] %>" { - organization = "<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_scc_management_organization_security_health_analytics_custom_module" "{{$.PrimaryResourceId}}" { + organization = "{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "display_name"}}" location = "global" enablement_state = "ENABLED" custom_config { diff --git a/mmv1/templates/terraform/examples/scc_management_organization_security_health_analytics_custom_module_full.tf.tmpl b/mmv1/templates/terraform/examples/scc_management_organization_security_health_analytics_custom_module_full.tf.tmpl index 57511f76d211..159ecea97f01 100644 --- a/mmv1/templates/terraform/examples/scc_management_organization_security_health_analytics_custom_module_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_management_organization_security_health_analytics_custom_module_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_management_organization_security_health_analytics_custom_module" "<%= ctx[:primary_resource_id] %>" { - organization = "<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_scc_management_organization_security_health_analytics_custom_module" "{{$.PrimaryResourceId}}" { + organization = "{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "display_name"}}" location = "global" enablement_state = "ENABLED" custom_config { diff --git a/mmv1/templates/terraform/examples/scc_mute_config.tf.tmpl b/mmv1/templates/terraform/examples/scc_mute_config.tf.tmpl index 8909878e3f77..c1656175b8c7 100644 --- a/mmv1/templates/terraform/examples/scc_mute_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_mute_config.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_mute_config" "<%= ctx[:primary_resource_id] %>" { - mute_config_id = "<%= ctx[:vars]['mute_config_id'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_mute_config" "{{$.PrimaryResourceId}}" { + mute_config_id = "{{index $.Vars "mute_config_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" filter = "category: \"OS_VULNERABILITY\"" description = "My Mute Config" } diff --git a/mmv1/templates/terraform/examples/scc_notification_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_notification_config_basic.tf.tmpl index c596a6c8f272..7fcdbd7cc78b 100644 --- a/mmv1/templates/terraform/examples/scc_notification_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_notification_config_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_pubsub_topic" "scc_notification" { - name = "<%= ctx[:vars]['topic_name'] %>" + name = "{{index $.Vars "topic_name"}}" } -resource "google_scc_notification_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_notification_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" + organization = "{{index $.TestEnvVars "org_id"}}" description = "My custom Cloud Security Command Center Finding Notification Configuration" pubsub_topic = google_pubsub_topic.scc_notification.id diff --git a/mmv1/templates/terraform/examples/scc_organization_big_query_export_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_organization_big_query_export_config_basic.tf.tmpl index 31be413053f2..dbde1f75982d 100644 --- a/mmv1/templates/terraform/examples/scc_organization_big_query_export_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_organization_big_query_export_config_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigquery_dataset" "default" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -15,10 +15,10 @@ resource "google_bigquery_dataset" "default" { } } -resource "google_scc_organization_scc_big_query_export" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" - big_query_export_id = "<%= ctx[:vars]['big_query_export_id'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_organization_scc_big_query_export" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" + big_query_export_id = "{{index $.Vars "big_query_export_id"}}" + organization = "{{index $.TestEnvVars "org_id"}}" dataset = google_bigquery_dataset.default.id description = "Cloud Security Command Center Findings Big Query Export Config" filter = "state=\"ACTIVE\" AND NOT mute=\"MUTED\"" diff --git a/mmv1/templates/terraform/examples/scc_organization_custom_module_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_organization_custom_module_basic.tf.tmpl index 841f40f5be13..430cc4052606 100644 --- a/mmv1/templates/terraform/examples/scc_organization_custom_module_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_organization_custom_module_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_organization_custom_module" "<%= ctx[:primary_resource_id] %>" { - organization = "<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_scc_organization_custom_module" "{{$.PrimaryResourceId}}" { + organization = "{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_organization_custom_module_full.tf.tmpl b/mmv1/templates/terraform/examples/scc_organization_custom_module_full.tf.tmpl index 2737451ae4c3..4f2f02187181 100644 --- a/mmv1/templates/terraform/examples/scc_organization_custom_module_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_organization_custom_module_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_organization_custom_module" "<%= ctx[:primary_resource_id] %>" { - organization = "<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_scc_organization_custom_module" "{{$.PrimaryResourceId}}" { + organization = "{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_project_big_query_export_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_project_big_query_export_config_basic.tf.tmpl index e0a9db0e4ba6..3a955741020b 100644 --- a/mmv1/templates/terraform/examples/scc_project_big_query_export_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_project_big_query_export_config_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigquery_dataset" "default" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -15,10 +15,10 @@ resource "google_bigquery_dataset" "default" { } } -resource "google_scc_project_scc_big_query_export" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" - big_query_export_id = "<%= ctx[:vars]['big_query_export_id'] %>" - project = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_scc_project_scc_big_query_export" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" + big_query_export_id = "{{index $.Vars "big_query_export_id"}}" + project = "{{index $.TestEnvVars "project"}}" dataset = google_bigquery_dataset.default.id description = "Cloud Security Command Center Findings Big Query Export Config" filter = "state=\"ACTIVE\" AND NOT mute=\"MUTED\"" diff --git a/mmv1/templates/terraform/examples/scc_project_custom_module_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_project_custom_module_basic.tf.tmpl index 8ec2a4bb9785..aa4f8167ca56 100644 --- a/mmv1/templates/terraform/examples/scc_project_custom_module_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_project_custom_module_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_scc_project_custom_module" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_scc_project_custom_module" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_project_custom_module_full.tf.tmpl b/mmv1/templates/terraform/examples/scc_project_custom_module_full.tf.tmpl index 4b8ed23aa7ad..00681d2c3c05 100644 --- a/mmv1/templates/terraform/examples/scc_project_custom_module_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_project_custom_module_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_scc_project_custom_module" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_scc_project_custom_module" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" enablement_state = "ENABLED" custom_config { predicate { diff --git a/mmv1/templates/terraform/examples/scc_project_notification_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_project_notification_config_basic.tf.tmpl index d353c3b667f8..15dd923e9b59 100644 --- a/mmv1/templates/terraform/examples/scc_project_notification_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_project_notification_config_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_pubsub_topic" "scc_project_notification" { - name = "<%= ctx[:vars]['topic_name'] %>" + name = "{{index $.Vars "topic_name"}}" } -resource "google_scc_project_notification_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" - project = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_scc_project_notification_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" + project = "{{index $.TestEnvVars "project"}}" description = "My custom Cloud Security Command Center Finding Notification Configuration" pubsub_topic = google_pubsub_topic.scc_project_notification.id diff --git a/mmv1/templates/terraform/examples/scc_source_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_source_basic.tf.tmpl index d8bcd1092509..7672ca07eccc 100644 --- a/mmv1/templates/terraform/examples/scc_source_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_source_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_scc_source" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['source_display_name'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_source" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "source_display_name"}}" + organization = "{{index $.TestEnvVars "org_id"}}" description = "My custom Cloud Security Command Center Finding Source" } diff --git a/mmv1/templates/terraform/examples/scc_v2_folder_big_query_export_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_folder_big_query_export_config_basic.tf.tmpl index 471b63eff42c..992235040377 100644 --- a/mmv1/templates/terraform/examples/scc_v2_folder_big_query_export_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_folder_big_query_export_config_basic.tf.tmpl @@ -1,12 +1,12 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" deletion_protection = false } resource "google_bigquery_dataset" "default" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -22,8 +22,8 @@ resource "google_bigquery_dataset" "default" { } } -resource "google_scc_v2_folder_scc_big_query_export" "<%= ctx[:primary_resource_id] %>" { - big_query_export_id = "<%= ctx[:vars]['big_query_export_id'] %>" +resource "google_scc_v2_folder_scc_big_query_export" "{{$.PrimaryResourceId}}" { + big_query_export_id = "{{index $.Vars "big_query_export_id"}}" folder = google_folder.folder.folder_id dataset = google_bigquery_dataset.default.id location = "global" diff --git a/mmv1/templates/terraform/examples/scc_v2_folder_mute_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_folder_mute_config_basic.tf.tmpl index 263d93b57442..1897b1a81f0e 100644 --- a/mmv1/templates/terraform/examples/scc_v2_folder_mute_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_folder_mute_config_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" } -resource "google_scc_v2_folder_mute_config" "<%= ctx[:primary_resource_id] %>" { - mute_config_id = "<%= ctx[:vars]['mute_config_id'] %>" +resource "google_scc_v2_folder_mute_config" "{{$.PrimaryResourceId}}" { + mute_config_id = "{{index $.Vars "mute_config_id"}}" folder = google_folder.folder.folder_id location = "global" description = "My custom Cloud Security Command Center Finding Folder mute Configuration" diff --git a/mmv1/templates/terraform/examples/scc_v2_folder_notification_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_folder_notification_config_basic.tf.tmpl index bca62552d6d0..da4c2dbe9dc0 100644 --- a/mmv1/templates/terraform/examples/scc_v2_folder_notification_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_folder_notification_config_basic.tf.tmpl @@ -1,14 +1,14 @@ resource "google_folder" "folder" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - display_name = "<%= ctx[:vars]['folder_display_name'] %>" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + display_name = "{{index $.Vars "folder_display_name"}}" } resource "google_pubsub_topic" "scc_v2_folder_notification_config" { - name = "<%= ctx[:vars]['topic_name'] %>" + name = "{{index $.Vars "topic_name"}}" } -resource "google_scc_v2_folder_notification_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" +resource "google_scc_v2_folder_notification_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" folder = google_folder.folder.folder_id location = "global" description = "My custom Cloud Security Command Center Finding Notification Configuration" diff --git a/mmv1/templates/terraform/examples/scc_v2_organization_big_query_export_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_organization_big_query_export_config_basic.tf.tmpl index 47003a9b15a3..0259e652f0e0 100644 --- a/mmv1/templates/terraform/examples/scc_v2_organization_big_query_export_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_organization_big_query_export_config_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigquery_dataset" "default" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -15,10 +15,10 @@ resource "google_bigquery_dataset" "default" { } } -resource "google_scc_v2_organization_scc_big_query_export" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" - big_query_export_id = "<%= ctx[:vars]['big_query_export_id'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_v2_organization_scc_big_query_export" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" + big_query_export_id = "{{index $.Vars "big_query_export_id"}}" + organization = "{{index $.TestEnvVars "org_id"}}" dataset = google_bigquery_dataset.default.id location = "global" description = "Cloud Security Command Center Findings Big Query Export Config" diff --git a/mmv1/templates/terraform/examples/scc_v2_organization_big_query_exports_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_organization_big_query_exports_config_basic.tf.tmpl index 69ca57a96214..94d3b526ebb2 100644 --- a/mmv1/templates/terraform/examples/scc_v2_organization_big_query_exports_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_organization_big_query_exports_config_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigquery_dataset" "default" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -15,10 +15,10 @@ resource "google_bigquery_dataset" "default" { } } -resource "google_scc_v2_organization_scc_big_query_exports" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" - big_query_export_id = "<%= ctx[:vars]['big_query_export_id'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_v2_organization_scc_big_query_exports" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" + big_query_export_id = "{{index $.Vars "big_query_export_id"}}" + organization = "{{index $.TestEnvVars "org_id"}}" dataset = google_bigquery_dataset.default.id location = "global" description = "Cloud Security Command Center Findings Big Query Export Config" diff --git a/mmv1/templates/terraform/examples/scc_v2_organization_mute_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_organization_mute_config_basic.tf.tmpl index 6d2e8b2b32c0..bc63676f01d2 100644 --- a/mmv1/templates/terraform/examples/scc_v2_organization_mute_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_organization_mute_config_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_v2_organization_mute_config" "<%= ctx[:primary_resource_id] %>" { - mute_config_id = "<%= ctx[:vars]['mute_config_id'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_v2_organization_mute_config" "{{$.PrimaryResourceId}}" { + mute_config_id = "{{index $.Vars "mute_config_id"}}" + organization = "{{index $.TestEnvVars "org_id"}}" location = "global" description = "My custom Cloud Security Command Center Finding Organization mute Configuration" filter = "severity = \"HIGH\"" diff --git a/mmv1/templates/terraform/examples/scc_v2_organization_notification_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_organization_notification_config_basic.tf.tmpl index c186e028d4ee..1d90cb7a579e 100644 --- a/mmv1/templates/terraform/examples/scc_v2_organization_notification_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_organization_notification_config_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_pubsub_topic" "scc_v2_organization_notification_config" { - name = "<%= ctx[:vars]['topic_name'] %>" + name = "{{index $.Vars "topic_name"}}" } -resource "google_scc_v2_organization_notification_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_v2_organization_notification_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" + organization = "{{index $.TestEnvVars "org_id"}}" location = "global" description = "My custom Cloud Security Command Center Finding Organization Notification Configuration" pubsub_topic = google_pubsub_topic.scc_v2_organization_notification_config.id diff --git a/mmv1/templates/terraform/examples/scc_v2_organization_source_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_organization_source_basic.tf.tmpl index 556dab9523a9..c32994a7c3ad 100644 --- a/mmv1/templates/terraform/examples/scc_v2_organization_source_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_organization_source_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_scc_v2_organization_source" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['source_display_name'] %>" - organization = "<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_scc_v2_organization_source" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "source_display_name"}}" + organization = "{{index $.TestEnvVars "org_id"}}" description = "My custom Cloud Security Command Center Finding Source" } diff --git a/mmv1/templates/terraform/examples/scc_v2_project_big_query_export_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_project_big_query_export_config_basic.tf.tmpl index 1f20867e722d..e64171114b48 100644 --- a/mmv1/templates/terraform/examples/scc_v2_project_big_query_export_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_project_big_query_export_config_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_bigquery_dataset" "default" { - dataset_id = "<%= ctx[:vars]['dataset_id'] %>" + dataset_id = "{{index $.Vars "dataset_id"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -15,10 +15,10 @@ resource "google_bigquery_dataset" "default" { } } -resource "google_scc_v2_project_scc_big_query_export" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" - big_query_export_id = "<%= ctx[:vars]['big_query_export_id'] %>" - project = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_scc_v2_project_scc_big_query_export" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" + big_query_export_id = "{{index $.Vars "big_query_export_id"}}" + project = "{{index $.TestEnvVars "project"}}" dataset = google_bigquery_dataset.default.id location = "global" description = "Cloud Security Command Center Findings Big Query Export Config" diff --git a/mmv1/templates/terraform/examples/scc_v2_project_mute_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_project_mute_config_basic.tf.tmpl index fc7de67d615c..833c133a76c6 100644 --- a/mmv1/templates/terraform/examples/scc_v2_project_mute_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_project_mute_config_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_scc_v2_project_mute_config" "<%= ctx[:primary_resource_id] %>" { - mute_config_id = "<%= ctx[:vars]['mute_config_id'] %>" - project = "<%= ctx[:test_env_vars]['project_id'] %>" +resource "google_scc_v2_project_mute_config" "{{$.PrimaryResourceId}}" { + mute_config_id = "{{index $.Vars "mute_config_id"}}" + project = "{{index $.TestEnvVars "project_id"}}" location = "global" description = "My custom Cloud Security Command Center Finding Project mute Configuration" filter = "severity = \"HIGH\"" diff --git a/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.tmpl index bba2eec443b9..97a92ed39c6a 100644 --- a/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/scc_v2_project_notification_config_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_pubsub_topic" "scc_v2_project_notification" { - name = "<%= ctx[:vars]['topic_name'] %>" + name = "{{index $.Vars "topic_name"}}" } -resource "google_scc_v2_project_notification_config" "<%= ctx[:primary_resource_id] %>" { - config_id = "<%= ctx[:vars]['config_id'] %>" - project = "<%= ctx[:test_env_vars]['project'] %>" +resource "google_scc_v2_project_notification_config" "{{$.PrimaryResourceId}}" { + config_id = "{{index $.Vars "config_id"}}" + project = "{{index $.TestEnvVars "project"}}" location = "global" description = "My custom Cloud Security Command Center Finding Notification Configuration" pubsub_topic = google_pubsub_topic.scc_v2_project_notification.id diff --git a/mmv1/templates/terraform/examples/scheduler_job_app_engine.tf.tmpl b/mmv1/templates/terraform/examples/scheduler_job_app_engine.tf.tmpl index 259b563b0ba0..d5d909119dca 100644 --- a/mmv1/templates/terraform/examples/scheduler_job_app_engine.tf.tmpl +++ b/mmv1/templates/terraform/examples/scheduler_job_app_engine.tf.tmpl @@ -1,5 +1,5 @@ resource "google_cloud_scheduler_job" "job" { - name = "<%= ctx[:vars]['job_name'] %>" + name = "{{index $.Vars "job_name"}}" schedule = "*/4 * * * *" description = "test app engine job" time_zone = "Europe/London" diff --git a/mmv1/templates/terraform/examples/scheduler_job_http.tf.tmpl b/mmv1/templates/terraform/examples/scheduler_job_http.tf.tmpl index 2a9d582d696e..970a25999520 100644 --- a/mmv1/templates/terraform/examples/scheduler_job_http.tf.tmpl +++ b/mmv1/templates/terraform/examples/scheduler_job_http.tf.tmpl @@ -1,5 +1,5 @@ resource "google_cloud_scheduler_job" "job" { - name = "<%= ctx[:vars]['job_name'] %>" + name = "{{index $.Vars "job_name"}}" description = "test http job" schedule = "*/8 * * * *" time_zone = "America/New_York" diff --git a/mmv1/templates/terraform/examples/scheduler_job_oauth.tf.tmpl b/mmv1/templates/terraform/examples/scheduler_job_oauth.tf.tmpl index 69f7038cf1ac..e75d33cb0eb6 100644 --- a/mmv1/templates/terraform/examples/scheduler_job_oauth.tf.tmpl +++ b/mmv1/templates/terraform/examples/scheduler_job_oauth.tf.tmpl @@ -2,7 +2,7 @@ data "google_compute_default_service_account" "default" { } resource "google_cloud_scheduler_job" "job" { - name = "<%= ctx[:vars]['job_name'] %>" + name = "{{index $.Vars "job_name"}}" description = "test http job" schedule = "*/8 * * * *" time_zone = "America/New_York" @@ -10,7 +10,7 @@ resource "google_cloud_scheduler_job" "job" { http_target { http_method = "GET" - uri = "https://cloudscheduler.googleapis.com/v1/projects/<%= ctx[:test_env_vars]['project_name'] %>/locations/<%= ctx[:test_env_vars]['region'] %>/jobs" + uri = "https://cloudscheduler.googleapis.com/v1/projects/{{index $.TestEnvVars "project_name"}}/locations/{{index $.TestEnvVars "region"}}/jobs" oauth_token { service_account_email = data.google_compute_default_service_account.default.email diff --git a/mmv1/templates/terraform/examples/scheduler_job_oidc.tf.tmpl b/mmv1/templates/terraform/examples/scheduler_job_oidc.tf.tmpl index cf0199b4da25..4b34ada4f88c 100644 --- a/mmv1/templates/terraform/examples/scheduler_job_oidc.tf.tmpl +++ b/mmv1/templates/terraform/examples/scheduler_job_oidc.tf.tmpl @@ -2,7 +2,7 @@ data "google_compute_default_service_account" "default" { } resource "google_cloud_scheduler_job" "job" { - name = "<%= ctx[:vars]['job_name'] %>" + name = "{{index $.Vars "job_name"}}" description = "test http job" schedule = "*/8 * * * *" time_zone = "America/New_York" diff --git a/mmv1/templates/terraform/examples/scheduler_job_paused.tf.tmpl b/mmv1/templates/terraform/examples/scheduler_job_paused.tf.tmpl index 0e8551a00eb4..f00860fea7ae 100644 --- a/mmv1/templates/terraform/examples/scheduler_job_paused.tf.tmpl +++ b/mmv1/templates/terraform/examples/scheduler_job_paused.tf.tmpl @@ -1,6 +1,6 @@ resource "google_cloud_scheduler_job" "job" { paused = true - name = "<%= ctx[:vars]['job_name'] %>" + name = "{{index $.Vars "job_name"}}" description = "test http job with updated fields" schedule = "*/8 * * * *" time_zone = "America/New_York" diff --git a/mmv1/templates/terraform/examples/scheduler_job_pubsub.tf.tmpl b/mmv1/templates/terraform/examples/scheduler_job_pubsub.tf.tmpl index 05c5bc88e70c..1a21c85281dd 100644 --- a/mmv1/templates/terraform/examples/scheduler_job_pubsub.tf.tmpl +++ b/mmv1/templates/terraform/examples/scheduler_job_pubsub.tf.tmpl @@ -1,9 +1,9 @@ resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['topic_name'] %>" + name = "{{index $.Vars "topic_name"}}" } resource "google_cloud_scheduler_job" "job" { - name = "<%= ctx[:vars]['job_name'] %>" + name = "{{index $.Vars "job_name"}}" description = "test job" schedule = "*/2 * * * *" diff --git a/mmv1/templates/terraform/examples/secret_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/secret_config_basic.tf.tmpl index 9e4daaa00033..ed2ffe869280 100644 --- a/mmv1/templates/terraform/examples/secret_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/secret_config_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_secret_manager_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" labels = { label = "my-label" diff --git a/mmv1/templates/terraform/examples/secret_version_basic.tf.tmpl b/mmv1/templates/terraform/examples/secret_version_basic.tf.tmpl index 3bcaa96bd77c..e0e0f4f61545 100644 --- a/mmv1/templates/terraform/examples/secret_version_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/secret_version_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" labels = { label = "my-label" @@ -11,8 +11,8 @@ resource "google_secret_manager_secret" "secret-basic" { } -resource "google_secret_manager_secret_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_secret_manager_secret_version" "{{$.PrimaryResourceId}}" { secret = google_secret_manager_secret.secret-basic.id - secret_data = "<%= ctx[:vars]['data'] %>" + secret_data = "{{index $.Vars "data"}}" } diff --git a/mmv1/templates/terraform/examples/secret_version_deletion_policy_abandon.tf.tmpl b/mmv1/templates/terraform/examples/secret_version_deletion_policy_abandon.tf.tmpl index d095cef163bc..ec443a6769c7 100644 --- a/mmv1/templates/terraform/examples/secret_version_deletion_policy_abandon.tf.tmpl +++ b/mmv1/templates/terraform/examples/secret_version_deletion_policy_abandon.tf.tmpl @@ -1,5 +1,5 @@ resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { @@ -10,9 +10,9 @@ resource "google_secret_manager_secret" "secret-basic" { } } -resource "google_secret_manager_secret_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_secret_manager_secret_version" "{{$.PrimaryResourceId}}" { secret = google_secret_manager_secret.secret-basic.id - secret_data = "<%= ctx[:vars]['data'] %>" + secret_data = "{{index $.Vars "data"}}" deletion_policy = "ABANDON" } diff --git a/mmv1/templates/terraform/examples/secret_version_deletion_policy_disable.tf.tmpl b/mmv1/templates/terraform/examples/secret_version_deletion_policy_disable.tf.tmpl index a5933f9fe85f..a13fcd375e4f 100644 --- a/mmv1/templates/terraform/examples/secret_version_deletion_policy_disable.tf.tmpl +++ b/mmv1/templates/terraform/examples/secret_version_deletion_policy_disable.tf.tmpl @@ -1,5 +1,5 @@ resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { @@ -10,9 +10,9 @@ resource "google_secret_manager_secret" "secret-basic" { } } -resource "google_secret_manager_secret_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_secret_manager_secret_version" "{{$.PrimaryResourceId}}" { secret = google_secret_manager_secret.secret-basic.id - secret_data = "<%= ctx[:vars]['data'] %>" + secret_data = "{{index $.Vars "data"}}" deletion_policy = "DISABLE" } diff --git a/mmv1/templates/terraform/examples/secret_version_with_base64_string_secret_data.tf.tmpl b/mmv1/templates/terraform/examples/secret_version_with_base64_string_secret_data.tf.tmpl index c9fd886c37a5..989c40d60633 100644 --- a/mmv1/templates/terraform/examples/secret_version_with_base64_string_secret_data.tf.tmpl +++ b/mmv1/templates/terraform/examples/secret_version_with_base64_string_secret_data.tf.tmpl @@ -1,5 +1,5 @@ resource "google_secret_manager_secret" "secret-basic" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" + secret_id = "{{index $.Vars "secret_id"}}" replication { user_managed { @@ -10,9 +10,9 @@ resource "google_secret_manager_secret" "secret-basic" { } } -resource "google_secret_manager_secret_version" "<%= ctx[:primary_resource_id] %>" { +resource "google_secret_manager_secret_version" "{{$.PrimaryResourceId}}" { secret = google_secret_manager_secret.secret-basic.id is_secret_data_base64 = true - secret_data = filebase64("<%= ctx[:vars]['data'] %>") + secret_data = filebase64("{{index $.Vars "data"}}") } diff --git a/mmv1/templates/terraform/examples/secret_with_annotations.tf.tmpl b/mmv1/templates/terraform/examples/secret_with_annotations.tf.tmpl index 3199ce7781eb..3c3a7ac8cd1e 100644 --- a/mmv1/templates/terraform/examples/secret_with_annotations.tf.tmpl +++ b/mmv1/templates/terraform/examples/secret_with_annotations.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_secret_manager_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" labels = { label = "my-label" diff --git a/mmv1/templates/terraform/examples/secret_with_automatic_cmek.tf.tmpl b/mmv1/templates/terraform/examples/secret_with_automatic_cmek.tf.tmpl index d268bcecaa08..d47f98984fe7 100644 --- a/mmv1/templates/terraform/examples/secret_with_automatic_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/secret_with_automatic_cmek.tf.tmpl @@ -1,18 +1,18 @@ data "google_project" "project" {} resource "google_kms_crypto_key_iam_member" "kms-secret-binding" { - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-secretmanager.iam.gserviceaccount.com" } -resource "google_secret_manager_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" replication { auto { customer_managed_encryption { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } } } diff --git a/mmv1/templates/terraform/examples/secret_with_version_destroy_ttl.tf.tmpl b/mmv1/templates/terraform/examples/secret_with_version_destroy_ttl.tf.tmpl index 9fd0e465ae71..9ea984e6a439 100644 --- a/mmv1/templates/terraform/examples/secret_with_version_destroy_ttl.tf.tmpl +++ b/mmv1/templates/terraform/examples/secret_with_version_destroy_ttl.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_secret_manager_secret" "<%= ctx[:primary_resource_id] %>" { - secret_id = "<%= ctx[:vars]['secret_id'] %>" +resource "google_secret_manager_secret" "{{$.PrimaryResourceId}}" { + secret_id = "{{index $.Vars "secret_id"}}" version_destroy_ttl = "2592000s" diff --git a/mmv1/templates/terraform/examples/secure_source_manager_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/secure_source_manager_instance_basic.tf.tmpl index e6b079fcd813..d00c77bcb263 100644 --- a/mmv1/templates/terraform/examples/secure_source_manager_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/secure_source_manager_instance_basic.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_secure_source_manager_instance" "{{$.PrimaryResourceId}}" { location = "us-central1" - instance_id = "<%= ctx[:vars]['instance_id'] %>" + instance_id = "{{index $.Vars "instance_id"}}" labels = { "foo" = "bar" } # Prevent accidental deletions. lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } diff --git a/mmv1/templates/terraform/examples/secure_source_manager_instance_cmek.tf.tmpl b/mmv1/templates/terraform/examples/secure_source_manager_instance_cmek.tf.tmpl index be32ff510c27..0cfbace45e3c 100644 --- a/mmv1/templates/terraform/examples/secure_source_manager_instance_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/secure_source_manager_instance_cmek.tf.tmpl @@ -1,10 +1,10 @@ resource "google_kms_key_ring" "key_ring" { - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "us-central1" } resource "google_kms_crypto_key" "crypto_key" { - name = "<%= ctx[:vars]['key_name'] %>" + name = "{{index $.Vars "key_name"}}" key_ring = google_kms_key_ring.key_ring.id } @@ -15,9 +15,9 @@ resource "google_kms_crypto_key_iam_member" "crypto_key_binding" { member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-sourcemanager.iam.gserviceaccount.com" } -resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_secure_source_manager_instance" "{{$.PrimaryResourceId}}" { location = "us-central1" - instance_id = "<%= ctx[:vars]['instance_id'] %>" + instance_id = "{{index $.Vars "instance_id"}}" kms_key = google_kms_crypto_key.crypto_key.id depends_on = [ @@ -26,7 +26,7 @@ resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] # Prevent accidental deletions. lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } diff --git a/mmv1/templates/terraform/examples/secure_source_manager_instance_private.tf.tmpl b/mmv1/templates/terraform/examples/secure_source_manager_instance_private.tf.tmpl index e360c16e018d..d4f1df7b60bd 100644 --- a/mmv1/templates/terraform/examples/secure_source_manager_instance_private.tf.tmpl +++ b/mmv1/templates/terraform/examples/secure_source_manager_instance_private.tf.tmpl @@ -1,5 +1,5 @@ resource "google_privateca_ca_pool" "ca_pool" { - name = "<%= ctx[:vars]['ca_pool_id'] %>" + name = "{{index $.Vars "ca_pool_id"}}" location = "us-central1" tier = "ENTERPRISE" publishing_options { @@ -10,7 +10,7 @@ resource "google_privateca_ca_pool" "ca_pool" { resource "google_privateca_certificate_authority" "root_ca" { pool = google_privateca_ca_pool.ca_pool.name - certificate_authority_id = "<%= ctx[:vars]['root_ca_id'] %>" + certificate_authority_id = "{{index $.Vars "root_ca_id"}}" location = "us-central1" config { subject_config { @@ -53,8 +53,8 @@ resource "google_privateca_ca_pool_iam_binding" "ca_pool_binding" { ] } -resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] %>" { - instance_id = "<%= ctx[:vars]['instance_id'] %>" +resource "google_secure_source_manager_instance" "{{$.PrimaryResourceId}}" { + instance_id = "{{index $.Vars "instance_id"}}" location = "us-central1" private_config { is_private = true @@ -63,7 +63,7 @@ resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] # Prevent accidental deletions. lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } depends_on = [ diff --git a/mmv1/templates/terraform/examples/secure_source_manager_instance_private_psc_backend.tf.tmpl b/mmv1/templates/terraform/examples/secure_source_manager_instance_private_psc_backend.tf.tmpl index 998067af9d39..db941e7fe8ed 100644 --- a/mmv1/templates/terraform/examples/secure_source_manager_instance_private_psc_backend.tf.tmpl +++ b/mmv1/templates/terraform/examples/secure_source_manager_instance_private_psc_backend.tf.tmpl @@ -1,7 +1,7 @@ data "google_project" "project" {} resource "google_privateca_ca_pool" "ca_pool" { - name = "<%= ctx[:vars]['ca_pool_id'] %>" + name = "{{index $.Vars "ca_pool_id"}}" location = "us-central1" tier = "ENTERPRISE" publishing_options { @@ -12,7 +12,7 @@ resource "google_privateca_ca_pool" "ca_pool" { resource "google_privateca_certificate_authority" "root_ca" { pool = google_privateca_ca_pool.ca_pool.name - certificate_authority_id = "<%= ctx[:vars]['root_ca_id'] %>" + certificate_authority_id = "{{index $.Vars "root_ca_id"}}" location = "us-central1" config { subject_config { @@ -56,8 +56,8 @@ resource "google_privateca_ca_pool_iam_binding" "ca_pool_binding" { } // See https://cloud.google.com/secure-source-manager/docs/create-private-service-connect-instance#root-ca-api -resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] %>" { - instance_id = "<%= ctx[:vars]['instance_id'] %>" +resource "google_secure_source_manager_instance" "{{$.PrimaryResourceId}}" { + instance_id = "{{index $.Vars "instance_id"}}" location = "us-central1" private_config { is_private = true @@ -66,7 +66,7 @@ resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] # Prevent accidental deletions. lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } depends_on = [ @@ -84,12 +84,12 @@ resource "time_sleep" "wait_120_seconds" { // Connect SSM private instance with L4 proxy ILB. resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnet" { - name = "<%= ctx[:vars]['subnet_id'] %>" + name = "{{index $.Vars "subnet_id"}}" region = "us-central1" network = google_compute_network.network.id ip_cidr_range = "10.0.1.0/24" @@ -97,18 +97,18 @@ resource "google_compute_subnetwork" "subnet" { } resource "google_compute_region_network_endpoint_group" "psc_neg" { - name = "<%= ctx[:vars]['neg_id'] %>" + name = "{{index $.Vars "neg_id"}}" region = "us-central1" network_endpoint_type = "PRIVATE_SERVICE_CONNECT" - psc_target_service = google_secure_source_manager_instance.<%= ctx[:primary_resource_id] %>.private_config.0.http_service_attachment + psc_target_service = google_secure_source_manager_instance.{{$.PrimaryResourceId}}.private_config.0.http_service_attachment network = google_compute_network.network.id subnetwork = google_compute_subnetwork.subnet.id } resource "google_compute_region_backend_service" "backend_service" { - name = "<%= ctx[:vars]['backend_id'] %>" + name = "{{index $.Vars "backend_id"}}" region = "us-central1" protocol = "TCP" load_balancing_scheme = "INTERNAL_MANAGED" @@ -120,7 +120,7 @@ resource "google_compute_region_backend_service" "backend_service" { } resource "google_compute_subnetwork" "proxy_subnet" { - name = "<%= ctx[:vars]['proxy_subnet_id'] %>" + name = "{{index $.Vars "proxy_subnet_id"}}" region = "us-central1" network = google_compute_network.network.id ip_cidr_range = "10.0.2.0/24" @@ -129,13 +129,13 @@ resource "google_compute_subnetwork" "proxy_subnet" { } resource "google_compute_region_target_tcp_proxy" "target_proxy" { - name = "<%= ctx[:vars]['target_proxy_id'] %>" + name = "{{index $.Vars "target_proxy_id"}}" region = "us-central1" backend_service = google_compute_region_backend_service.backend_service.id } resource "google_compute_forwarding_rule" "fw_rule_target_proxy" { - name = "<%= ctx[:vars]['fw_rule_to_target_proxy_id'] %>" + name = "{{index $.Vars "fw_rule_to_target_proxy_id"}}" region = "us-central1" load_balancing_scheme = "INTERNAL_MANAGED" @@ -149,7 +149,7 @@ resource "google_compute_forwarding_rule" "fw_rule_target_proxy" { } resource "google_dns_managed_zone" "private_zone" { - name = "<%= ctx[:vars]['dns_zone_id'] %>" + name = "{{index $.Vars "dns_zone_id"}}" dns_name = "p.sourcemanager.dev." visibility = "private" private_visibility_config { @@ -160,7 +160,7 @@ resource "google_dns_managed_zone" "private_zone" { } resource "google_dns_record_set" "ssm_instance_html_record" { - name = "${google_secure_source_manager_instance.<%= ctx[:primary_resource_id] %>.host_config.0.html}." + name = "${google_secure_source_manager_instance.{{$.PrimaryResourceId}}.host_config.0.html}." type = "A" ttl = 300 managed_zone = google_dns_managed_zone.private_zone.name @@ -168,7 +168,7 @@ resource "google_dns_record_set" "ssm_instance_html_record" { } resource "google_dns_record_set" "ssm_instance_api_record" { - name = "${google_secure_source_manager_instance.<%= ctx[:primary_resource_id] %>.host_config.0.api}." + name = "${google_secure_source_manager_instance.{{$.PrimaryResourceId}}.host_config.0.api}." type = "A" ttl = 300 managed_zone = google_dns_managed_zone.private_zone.name @@ -176,7 +176,7 @@ resource "google_dns_record_set" "ssm_instance_api_record" { } resource "google_dns_record_set" "ssm_instance_git_record" { - name = "${google_secure_source_manager_instance.<%= ctx[:primary_resource_id] %>.host_config.0.git_http}." + name = "${google_secure_source_manager_instance.{{$.PrimaryResourceId}}.host_config.0.git_http}." type = "A" ttl = 300 managed_zone = google_dns_managed_zone.private_zone.name diff --git a/mmv1/templates/terraform/examples/secure_source_manager_instance_private_psc_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/secure_source_manager_instance_private_psc_endpoint.tf.tmpl index 924dd79adf9a..167222bde11d 100644 --- a/mmv1/templates/terraform/examples/secure_source_manager_instance_private_psc_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/secure_source_manager_instance_private_psc_endpoint.tf.tmpl @@ -1,7 +1,7 @@ data "google_project" "project" {} resource "google_privateca_ca_pool" "ca_pool" { - name = "<%= ctx[:vars]['ca_pool_id'] %>" + name = "{{index $.Vars "ca_pool_id"}}" location = "us-central1" tier = "ENTERPRISE" publishing_options { @@ -12,7 +12,7 @@ resource "google_privateca_ca_pool" "ca_pool" { resource "google_privateca_certificate_authority" "root_ca" { pool = google_privateca_ca_pool.ca_pool.name - certificate_authority_id = "<%= ctx[:vars]['root_ca_id'] %>" + certificate_authority_id = "{{index $.Vars "root_ca_id"}}" location = "us-central1" config { subject_config { @@ -56,8 +56,8 @@ resource "google_privateca_ca_pool_iam_binding" "ca_pool_binding" { } // See https://cloud.google.com/secure-source-manager/docs/create-private-service-connect-instance#root-ca-api -resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] %>" { - instance_id = "<%= ctx[:vars]['instance_id'] %>" +resource "google_secure_source_manager_instance" "{{$.PrimaryResourceId}}" { + instance_id = "{{index $.Vars "instance_id"}}" location = "us-central1" private_config { is_private = true @@ -66,7 +66,7 @@ resource "google_secure_source_manager_instance" "<%= ctx[:primary_resource_id] # Prevent accidental deletions. lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } depends_on = [ @@ -84,12 +84,12 @@ resource "time_sleep" "wait_120_seconds" { // Connect SSM private instance with endpoint. resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnet" { - name = "<%= ctx[:vars]['subnet_id'] %>" + name = "{{index $.Vars "subnet_id"}}" region = "us-central1" network = google_compute_network.network.id ip_cidr_range = "10.0.60.0/24" @@ -97,7 +97,7 @@ resource "google_compute_subnetwork" "subnet" { } resource "google_compute_address" "address" { - name = "<%= ctx[:vars]['address_id'] %>" + name = "{{index $.Vars "address_id"}}" region = "us-central1" address = "10.0.60.100" address_type = "INTERNAL" @@ -105,18 +105,18 @@ resource "google_compute_address" "address" { } resource "google_compute_forwarding_rule" "fw_rule_service_attachment" { - name = "<%= ctx[:vars]['fw_rule_to_service_attachment_id'] %>" + name = "{{index $.Vars "fw_rule_to_service_attachment_id"}}" region = "us-central1" load_balancing_scheme = "" ip_address = google_compute_address.address.id network = google_compute_network.network.id - target = google_secure_source_manager_instance.<%= ctx[:primary_resource_id] %>.private_config.0.http_service_attachment + target = google_secure_source_manager_instance.{{$.PrimaryResourceId}}.private_config.0.http_service_attachment } resource "google_dns_managed_zone" "private_zone" { - name = "<%= ctx[:vars]['dns_zone_id'] %>" + name = "{{index $.Vars "dns_zone_id"}}" dns_name = "p.sourcemanager.dev." visibility = "private" private_visibility_config { @@ -127,7 +127,7 @@ resource "google_dns_managed_zone" "private_zone" { } resource "google_dns_record_set" "ssm_instance_html_record" { - name = "${google_secure_source_manager_instance.<%= ctx[:primary_resource_id] %>.host_config.0.html}." + name = "${google_secure_source_manager_instance.{{$.PrimaryResourceId}}.host_config.0.html}." type = "A" ttl = 300 managed_zone = google_dns_managed_zone.private_zone.name @@ -135,7 +135,7 @@ resource "google_dns_record_set" "ssm_instance_html_record" { } resource "google_dns_record_set" "ssm_instance_api_record" { - name = "${google_secure_source_manager_instance.<%= ctx[:primary_resource_id] %>.host_config.0.api}." + name = "${google_secure_source_manager_instance.{{$.PrimaryResourceId}}.host_config.0.api}." type = "A" ttl = 300 managed_zone = google_dns_managed_zone.private_zone.name @@ -143,7 +143,7 @@ resource "google_dns_record_set" "ssm_instance_api_record" { } resource "google_dns_record_set" "ssm_instance_git_record" { - name = "${google_secure_source_manager_instance.<%= ctx[:primary_resource_id] %>.host_config.0.git_http}." + name = "${google_secure_source_manager_instance.{{$.PrimaryResourceId}}.host_config.0.git_http}." type = "A" ttl = 300 managed_zone = google_dns_managed_zone.private_zone.name diff --git a/mmv1/templates/terraform/examples/secure_source_manager_repository_basic.tf.tmpl b/mmv1/templates/terraform/examples/secure_source_manager_repository_basic.tf.tmpl index 5a52e05c53bd..ac62f0cffcd4 100644 --- a/mmv1/templates/terraform/examples/secure_source_manager_repository_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/secure_source_manager_repository_basic.tf.tmpl @@ -1,20 +1,20 @@ resource "google_secure_source_manager_instance" "instance" { location = "us-central1" - instance_id = "<%= ctx[:vars]['instance_id'] %>" + instance_id = "{{index $.Vars "instance_id"}}" # Prevent accidental deletions. lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } -resource "google_secure_source_manager_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_secure_source_manager_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" + repository_id = "{{index $.Vars "repository_id"}}" instance = google_secure_source_manager_instance.instance.name # Prevent accidental deletions. lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } diff --git a/mmv1/templates/terraform/examples/secure_source_manager_repository_initial_config.tf.tmpl b/mmv1/templates/terraform/examples/secure_source_manager_repository_initial_config.tf.tmpl index 03adf80a6b15..b3b54bfdd790 100644 --- a/mmv1/templates/terraform/examples/secure_source_manager_repository_initial_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/secure_source_manager_repository_initial_config.tf.tmpl @@ -1,16 +1,16 @@ resource "google_secure_source_manager_instance" "instance" { location = "us-central1" - instance_id = "<%= ctx[:vars]['instance_id'] %>" + instance_id = "{{index $.Vars "instance_id"}}" # For preventing accidental deletions lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } -resource "google_secure_source_manager_repository" "<%= ctx[:primary_resource_id] %>" { +resource "google_secure_source_manager_repository" "{{$.PrimaryResourceId}}" { location = "us-central1" - repository_id = "<%= ctx[:vars]['repository_id'] %>" + repository_id = "{{index $.Vars "repository_id"}}" instance = google_secure_source_manager_instance.instance.name description = "This is a test repository" @@ -23,6 +23,6 @@ resource "google_secure_source_manager_repository" "<%= ctx[:primary_resource_id # Prevent accidental deletions. lifecycle { - prevent_destroy = "<%= ctx[:vars]['prevent_destroy'] %>" + prevent_destroy = "{{index $.Vars "prevent_destroy"}}" } } diff --git a/mmv1/templates/terraform/examples/security_policy_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/security_policy_rule_basic.tf.tmpl index 4206bd4ec389..4667ad26d55b 100644 --- a/mmv1/templates/terraform/examples/security_policy_rule_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/security_policy_rule_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_compute_security_policy" "default" { - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "basic global security policy" type = "CLOUD_ARMOR" } -resource "google_compute_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_security_policy_rule" "{{$.PrimaryResourceId}}" { security_policy = google_compute_security_policy.default.name description = "new rule" priority = 100 diff --git a/mmv1/templates/terraform/examples/security_policy_rule_default_rule.tf.tmpl b/mmv1/templates/terraform/examples/security_policy_rule_default_rule.tf.tmpl index b7b269030bf7..6e606b6624a3 100644 --- a/mmv1/templates/terraform/examples/security_policy_rule_default_rule.tf.tmpl +++ b/mmv1/templates/terraform/examples/security_policy_rule_default_rule.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_security_policy" "default" { - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "basic global security policy" type = "CLOUD_ARMOR" } # A default rule is generated when creating the security_policy resource, import is needed to patch it # import { -# id = "projects/<%= ctx[:test_env_vars]['project_id'] %>/global/securityPolicies/<%= ctx[:vars]['sec_policy_name'] %>/priority/2147483647" +# id = "projects/{{index $.TestEnvVars "project_id"}}/global/securityPolicies/{{index $.Vars "sec_policy_name"}}/priority/2147483647" # to = google_compute_security_policy_rule.default_rule # } resource "google_compute_security_policy_rule" "default_rule" { @@ -22,7 +22,7 @@ resource "google_compute_security_policy_rule" "default_rule" { } } -resource "google_compute_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_security_policy_rule" "{{$.PrimaryResourceId}}" { security_policy = google_compute_security_policy.default.name description = "new rule" priority = 100 diff --git a/mmv1/templates/terraform/examples/security_policy_rule_multiple_rules.tf.tmpl b/mmv1/templates/terraform/examples/security_policy_rule_multiple_rules.tf.tmpl index c2f42cd2f162..cba6ad3c7a74 100644 --- a/mmv1/templates/terraform/examples/security_policy_rule_multiple_rules.tf.tmpl +++ b/mmv1/templates/terraform/examples/security_policy_rule_multiple_rules.tf.tmpl @@ -1,10 +1,10 @@ resource "google_compute_security_policy" "default" { - name = "<%= ctx[:vars]['sec_policy_name'] %>" + name = "{{index $.Vars "sec_policy_name"}}" description = "basic global security policy" type = "CLOUD_ARMOR" } -resource "google_compute_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_security_policy_rule" "{{$.PrimaryResourceId}}" { security_policy = google_compute_security_policy.default.name description = "new rule one" priority = 100 diff --git a/mmv1/templates/terraform/examples/securityposture_posture_basic.tf.tmpl b/mmv1/templates/terraform/examples/securityposture_posture_basic.tf.tmpl index 7dcc5eba2f41..2b1f9d059cf0 100644 --- a/mmv1/templates/terraform/examples/securityposture_posture_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/securityposture_posture_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_securityposture_posture" "<%= ctx[:primary_resource_id] %>"{ - posture_id = "<%= ctx[:vars]['posture_id'] %>" - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" +resource "google_securityposture_posture" "{{$.PrimaryResourceId}}"{ + posture_id = "{{index $.Vars "posture_id"}}" + parent = "organizations/{{index $.TestEnvVars "org_id"}}" location = "global" state = "ACTIVE" description = "a new posture" @@ -28,7 +28,7 @@ resource "google_securityposture_posture" "<%= ctx[:primary_resource_id] %>"{ constraint { org_policy_constraint_custom { custom_constraint { - name = "organizations/<%= ctx[:test_env_vars]['org_id'] %>/customConstraints/custom.disableGkeAutoUpgrade" + name = "organizations/{{index $.TestEnvVars "org_id"}}/customConstraints/custom.disableGkeAutoUpgrade" display_name = "Disable GKE auto upgrade" description = "Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced." action_type = "ALLOW" diff --git a/mmv1/templates/terraform/examples/go/securityposture_posture_deployment_basic.tf.tmpl b/mmv1/templates/terraform/examples/securityposture_posture_deployment_basic.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/securityposture_posture_deployment_basic.tf.tmpl rename to mmv1/templates/terraform/examples/securityposture_posture_deployment_basic.tf.tmpl diff --git a/mmv1/templates/terraform/examples/service_attachment_basic.tf.tmpl b/mmv1/templates/terraform/examples/service_attachment_basic.tf.tmpl index 1c8de6184d07..f6ebbbb3a1b3 100644 --- a/mmv1/templates/terraform/examples/service_attachment_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_attachment_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_service_attachment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['service_attachment_name'] %>" +resource "google_compute_service_attachment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "service_attachment_name"}}" region = "us-west2" description = "A service attachment configured with Terraform" @@ -11,7 +11,7 @@ resource "google_compute_service_attachment" "<%= ctx[:primary_resource_id] %>" } resource "google_compute_address" "psc_ilb_consumer_address" { - name = "<%= ctx[:vars]['consumer_address_name'] %>" + name = "{{index $.Vars "consumer_address_name"}}" region = "us-west2" subnetwork = "default" @@ -19,7 +19,7 @@ resource "google_compute_address" "psc_ilb_consumer_address" { } resource "google_compute_forwarding_rule" "psc_ilb_consumer" { - name = "<%= ctx[:vars]['consumer_forwarding_rule_name'] %>" + name = "{{index $.Vars "consumer_forwarding_rule_name"}}" region = "us-west2" target = google_compute_service_attachment.psc_ilb_service_attachment.id @@ -29,7 +29,7 @@ resource "google_compute_forwarding_rule" "psc_ilb_consumer" { } resource "google_compute_forwarding_rule" "psc_ilb_target_service" { - name = "<%= ctx[:vars]['producer_forwarding_rule_name'] %>" + name = "{{index $.Vars "producer_forwarding_rule_name"}}" region = "us-west2" load_balancing_scheme = "INTERNAL" @@ -40,14 +40,14 @@ resource "google_compute_forwarding_rule" "psc_ilb_target_service" { } resource "google_compute_region_backend_service" "producer_service_backend" { - name = "<%= ctx[:vars]['producer_service_name'] %>" + name = "{{index $.Vars "producer_service_name"}}" region = "us-west2" health_checks = [google_compute_health_check.producer_service_health_check.id] } resource "google_compute_health_check" "producer_service_health_check" { - name = "<%= ctx[:vars]['producer_health_check_name'] %>" + name = "{{index $.Vars "producer_health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -57,12 +57,12 @@ resource "google_compute_health_check" "producer_service_health_check" { } resource "google_compute_network" "psc_ilb_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { - name = "<%= ctx[:vars]['producer_subnetwork_name'] %>" + name = "{{index $.Vars "producer_subnetwork_name"}}" region = "us-west2" network = google_compute_network.psc_ilb_network.id @@ -70,7 +70,7 @@ resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { } resource "google_compute_subnetwork" "psc_ilb_nat" { - name = "<%= ctx[:vars]['nat_subnetwork_name'] %>" + name = "{{index $.Vars "nat_subnetwork_name"}}" region = "us-west2" network = google_compute_network.psc_ilb_network.id diff --git a/mmv1/templates/terraform/examples/service_attachment_explicit_networks.tf.tmpl b/mmv1/templates/terraform/examples/service_attachment_explicit_networks.tf.tmpl index a66f689582af..d07bd41db553 100644 --- a/mmv1/templates/terraform/examples/service_attachment_explicit_networks.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_attachment_explicit_networks.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_service_attachment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['service_attachment_name'] %>" +resource "google_compute_service_attachment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "service_attachment_name"}}" region = "us-west2" description = "A service attachment configured with Terraform" @@ -16,19 +16,19 @@ resource "google_compute_service_attachment" "<%= ctx[:primary_resource_id] %>" } resource "google_compute_network" "psc_ilb_consumer_network" { - name = "<%= ctx[:vars]['consumer_network_name'] %>" + name = "{{index $.Vars "consumer_network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "psc_ilb_consumer_subnetwork" { - name = "<%= ctx[:vars]['consumer_network_name'] %>" + name = "{{index $.Vars "consumer_network_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-west2" network = google_compute_network.psc_ilb_consumer_network.id } resource "google_compute_address" "psc_ilb_consumer_address" { - name = "<%= ctx[:vars]['consumer_address_name'] %>" + name = "{{index $.Vars "consumer_address_name"}}" region = "us-west2" subnetwork = google_compute_subnetwork.psc_ilb_consumer_subnetwork.id @@ -36,7 +36,7 @@ resource "google_compute_address" "psc_ilb_consumer_address" { } resource "google_compute_forwarding_rule" "psc_ilb_consumer" { - name = "<%= ctx[:vars]['consumer_forwarding_rule_name'] %>" + name = "{{index $.Vars "consumer_forwarding_rule_name"}}" region = "us-west2" target = google_compute_service_attachment.psc_ilb_service_attachment.id @@ -47,7 +47,7 @@ resource "google_compute_forwarding_rule" "psc_ilb_consumer" { } resource "google_compute_forwarding_rule" "psc_ilb_target_service" { - name = "<%= ctx[:vars]['producer_forwarding_rule_name'] %>" + name = "{{index $.Vars "producer_forwarding_rule_name"}}" region = "us-west2" load_balancing_scheme = "INTERNAL" @@ -58,14 +58,14 @@ resource "google_compute_forwarding_rule" "psc_ilb_target_service" { } resource "google_compute_region_backend_service" "producer_service_backend" { - name = "<%= ctx[:vars]['producer_service_name'] %>" + name = "{{index $.Vars "producer_service_name"}}" region = "us-west2" health_checks = [google_compute_health_check.producer_service_health_check.id] } resource "google_compute_health_check" "producer_service_health_check" { - name = "<%= ctx[:vars]['producer_health_check_name'] %>" + name = "{{index $.Vars "producer_health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -75,12 +75,12 @@ resource "google_compute_health_check" "producer_service_health_check" { } resource "google_compute_network" "psc_ilb_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { - name = "<%= ctx[:vars]['producer_subnetwork_name'] %>" + name = "{{index $.Vars "producer_subnetwork_name"}}" region = "us-west2" network = google_compute_network.psc_ilb_network.id @@ -88,7 +88,7 @@ resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { } resource "google_compute_subnetwork" "psc_ilb_nat" { - name = "<%= ctx[:vars]['nat_subnetwork_name'] %>" + name = "{{index $.Vars "nat_subnetwork_name"}}" region = "us-west2" network = google_compute_network.psc_ilb_network.id diff --git a/mmv1/templates/terraform/examples/service_attachment_explicit_projects.tf.tmpl b/mmv1/templates/terraform/examples/service_attachment_explicit_projects.tf.tmpl index 79643658c139..ad1bd225abef 100644 --- a/mmv1/templates/terraform/examples/service_attachment_explicit_projects.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_attachment_explicit_projects.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_service_attachment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['service_attachment_name'] %>" +resource "google_compute_service_attachment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "service_attachment_name"}}" region = "us-west2" description = "A service attachment configured with Terraform" @@ -18,7 +18,7 @@ resource "google_compute_service_attachment" "<%= ctx[:primary_resource_id] %>" } resource "google_compute_address" "psc_ilb_consumer_address" { - name = "<%= ctx[:vars]['consumer_address_name'] %>" + name = "{{index $.Vars "consumer_address_name"}}" region = "us-west2" subnetwork = "default" @@ -26,7 +26,7 @@ resource "google_compute_address" "psc_ilb_consumer_address" { } resource "google_compute_forwarding_rule" "psc_ilb_consumer" { - name = "<%= ctx[:vars]['consumer_forwarding_rule_name'] %>" + name = "{{index $.Vars "consumer_forwarding_rule_name"}}" region = "us-west2" target = google_compute_service_attachment.psc_ilb_service_attachment.id @@ -36,7 +36,7 @@ resource "google_compute_forwarding_rule" "psc_ilb_consumer" { } resource "google_compute_forwarding_rule" "psc_ilb_target_service" { - name = "<%= ctx[:vars]['producer_forwarding_rule_name'] %>" + name = "{{index $.Vars "producer_forwarding_rule_name"}}" region = "us-west2" load_balancing_scheme = "INTERNAL" @@ -47,14 +47,14 @@ resource "google_compute_forwarding_rule" "psc_ilb_target_service" { } resource "google_compute_region_backend_service" "producer_service_backend" { - name = "<%= ctx[:vars]['producer_service_name'] %>" + name = "{{index $.Vars "producer_service_name"}}" region = "us-west2" health_checks = [google_compute_health_check.producer_service_health_check.id] } resource "google_compute_health_check" "producer_service_health_check" { - name = "<%= ctx[:vars]['producer_health_check_name'] %>" + name = "{{index $.Vars "producer_health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -64,12 +64,12 @@ resource "google_compute_health_check" "producer_service_health_check" { } resource "google_compute_network" "psc_ilb_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { - name = "<%= ctx[:vars]['producer_subnetwork_name'] %>" + name = "{{index $.Vars "producer_subnetwork_name"}}" region = "us-west2" network = google_compute_network.psc_ilb_network.id @@ -77,7 +77,7 @@ resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { } resource "google_compute_subnetwork" "psc_ilb_nat" { - name = "<%= ctx[:vars]['nat_subnetwork_name'] %>" + name = "{{index $.Vars "nat_subnetwork_name"}}" region = "us-west2" network = google_compute_network.psc_ilb_network.id diff --git a/mmv1/templates/terraform/examples/service_attachment_reconcile_connections.tf.tmpl b/mmv1/templates/terraform/examples/service_attachment_reconcile_connections.tf.tmpl index 7caef30f518e..54512ef7ec23 100644 --- a/mmv1/templates/terraform/examples/service_attachment_reconcile_connections.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_attachment_reconcile_connections.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_service_attachment" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['service_attachment_name'] %>" +resource "google_compute_service_attachment" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "service_attachment_name"}}" region = "us-west2" description = "A service attachment configured with Terraform" @@ -20,7 +20,7 @@ resource "google_compute_service_attachment" "<%= ctx[:primary_resource_id] %>" } resource "google_compute_forwarding_rule" "psc_ilb_target_service" { - name = "<%= ctx[:vars]['producer_forwarding_rule_name'] %>" + name = "{{index $.Vars "producer_forwarding_rule_name"}}" region = "us-west2" load_balancing_scheme = "INTERNAL" @@ -31,14 +31,14 @@ resource "google_compute_forwarding_rule" "psc_ilb_target_service" { } resource "google_compute_region_backend_service" "producer_service_backend" { - name = "<%= ctx[:vars]['producer_service_name'] %>" + name = "{{index $.Vars "producer_service_name"}}" region = "us-west2" health_checks = [google_compute_health_check.producer_service_health_check.id] } resource "google_compute_health_check" "producer_service_health_check" { - name = "<%= ctx[:vars]['producer_health_check_name'] %>" + name = "{{index $.Vars "producer_health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 @@ -48,12 +48,12 @@ resource "google_compute_health_check" "producer_service_health_check" { } resource "google_compute_network" "psc_ilb_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { - name = "<%= ctx[:vars]['producer_subnetwork_name'] %>" + name = "{{index $.Vars "producer_subnetwork_name"}}" region = "us-west2" network = google_compute_network.psc_ilb_network.id @@ -61,7 +61,7 @@ resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { } resource "google_compute_subnetwork" "psc_ilb_nat" { - name = "<%= ctx[:vars]['nat_subnetwork_name'] %>" + name = "{{index $.Vars "nat_subnetwork_name"}}" region = "us-west2" network = google_compute_network.psc_ilb_network.id diff --git a/mmv1/templates/terraform/examples/service_directory_endpoint_basic.tf.tmpl b/mmv1/templates/terraform/examples/service_directory_endpoint_basic.tf.tmpl index 2f55c715beff..8a9a7a8a04cc 100644 --- a/mmv1/templates/terraform/examples/service_directory_endpoint_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_directory_endpoint_basic.tf.tmpl @@ -1,19 +1,19 @@ -resource "google_service_directory_namespace" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" { provider = google-beta - namespace_id = "<%= ctx[:vars]["namespace_id"] %>" + namespace_id = "{{index $.Vars "namespace_id"}}" location = "us-central1" } -resource "google_service_directory_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_service" "{{$.PrimaryResourceId}}" { provider = google-beta - service_id = "<%= ctx[:vars]["service_id"] %>" - namespace = google_service_directory_namespace.<%= ctx[:primary_resource_id] %>.id + service_id = "{{index $.Vars "service_id"}}" + namespace = google_service_directory_namespace.{{$.PrimaryResourceId}}.id } -resource "google_service_directory_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_endpoint" "{{$.PrimaryResourceId}}" { provider = google-beta - endpoint_id = "<%= ctx[:vars]["endpoint_id"] %>" - service = google_service_directory_service.<%= ctx[:primary_resource_id] %>.id + endpoint_id = "{{index $.Vars "endpoint_id"}}" + service = google_service_directory_service.{{$.PrimaryResourceId}}.id metadata = { stage = "prod" diff --git a/mmv1/templates/terraform/examples/service_directory_endpoint_with_network.tf.tmpl b/mmv1/templates/terraform/examples/service_directory_endpoint_with_network.tf.tmpl index bce2a9a65b9c..12229782691a 100644 --- a/mmv1/templates/terraform/examples/service_directory_endpoint_with_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_directory_endpoint_with_network.tf.tmpl @@ -2,34 +2,34 @@ data "google_project" "project" { provider = google-beta } -resource "google_compute_network" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_network" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } -resource "google_service_directory_namespace" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" { provider = google-beta - namespace_id = "<%= ctx[:vars]["namespace_id"] %>" + namespace_id = "{{index $.Vars "namespace_id"}}" location = "us-central1" } -resource "google_service_directory_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_service" "{{$.PrimaryResourceId}}" { provider = google-beta - service_id = "<%= ctx[:vars]["service_id"] %>" - namespace = google_service_directory_namespace.<%= ctx[:primary_resource_id] %>.id + service_id = "{{index $.Vars "service_id"}}" + namespace = google_service_directory_namespace.{{$.PrimaryResourceId}}.id } -resource "google_service_directory_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_endpoint" "{{$.PrimaryResourceId}}" { provider = google-beta - endpoint_id = "<%= ctx[:vars]["endpoint_id"] %>" - service = google_service_directory_service.<%= ctx[:primary_resource_id] %>.id + endpoint_id = "{{index $.Vars "endpoint_id"}}" + service = google_service_directory_service.{{$.PrimaryResourceId}}.id metadata = { stage = "prod" region = "us-central1" } - network = "projects/${data.google_project.project.number}/locations/global/networks/${google_compute_network.<%= ctx[:primary_resource_id] %>.name}" + network = "projects/${data.google_project.project.number}/locations/global/networks/${google_compute_network.{{$.PrimaryResourceId}}.name}" address = "1.2.3.4" port = 5353 } diff --git a/mmv1/templates/terraform/examples/service_directory_namespace_basic.tf.tmpl b/mmv1/templates/terraform/examples/service_directory_namespace_basic.tf.tmpl index 28b6e4a5b5b9..5352383bdf52 100644 --- a/mmv1/templates/terraform/examples/service_directory_namespace_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_directory_namespace_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_service_directory_namespace" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" { provider = google-beta - namespace_id = "<%= ctx[:vars]["namespace_id"] %>" + namespace_id = "{{index $.Vars "namespace_id"}}" location = "us-central1" labels = { diff --git a/mmv1/templates/terraform/examples/service_directory_service_basic.tf.tmpl b/mmv1/templates/terraform/examples/service_directory_service_basic.tf.tmpl index c62ff6711961..119570512e10 100644 --- a/mmv1/templates/terraform/examples/service_directory_service_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_directory_service_basic.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_service_directory_namespace" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" { provider = google-beta - namespace_id = "<%= ctx[:vars]["namespace_id"] %>" + namespace_id = "{{index $.Vars "namespace_id"}}" location = "us-central1" } -resource "google_service_directory_service" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_directory_service" "{{$.PrimaryResourceId}}" { provider = google-beta - service_id = "<%= ctx[:vars]["service_id"] %>" - namespace = google_service_directory_namespace.<%= ctx[:primary_resource_id] %>.id + service_id = "{{index $.Vars "service_id"}}" + namespace = google_service_directory_namespace.{{$.PrimaryResourceId}}.id metadata = { stage = "prod" diff --git a/mmv1/templates/terraform/examples/service_networking_vpc_service_controls_basic.tf.tmpl b/mmv1/templates/terraform/examples/service_networking_vpc_service_controls_basic.tf.tmpl index 3ab1b6f308a9..f0e4f94fa7e6 100644 --- a/mmv1/templates/terraform/examples/service_networking_vpc_service_controls_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/service_networking_vpc_service_controls_basic.tf.tmpl @@ -1,11 +1,11 @@ # Create a VPC resource "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } # Create an IP address resource "google_compute_global_address" "default" { - name = "<%= ctx[:vars]['psa_range_name'] %>" + name = "{{index $.Vars "psa_range_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 @@ -20,7 +20,7 @@ resource "google_service_networking_connection" "default" { } # Enable VPC-SC on the producer network -resource "google_service_networking_vpc_service_controls" "<%= ctx[:primary_resource_id] %>" { +resource "google_service_networking_vpc_service_controls" "{{$.PrimaryResourceId}}" { network = google_compute_network.default.name service = "servicenetworking.googleapis.com" enabled = true diff --git a/mmv1/templates/terraform/examples/shared_reservation_basic.tf.tmpl b/mmv1/templates/terraform/examples/shared_reservation_basic.tf.tmpl index fc58d27f8605..202f64c469d6 100644 --- a/mmv1/templates/terraform/examples/shared_reservation_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/shared_reservation_basic.tf.tmpl @@ -1,8 +1,8 @@ resource "google_project" "owner_project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -16,12 +16,12 @@ resource "google_project_service" "compute" { resource "google_project" "guest_project" { project_id = "tf-test-2%{random_suffix}" name = "tf-test-2%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } resource "google_organization_policy" "shared_reservation_org_policy" { - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" constraint = "constraints/compute.sharedReservationsOwnerProjects" list_policy { allow { @@ -30,9 +30,9 @@ resource "google_organization_policy" "shared_reservation_org_policy" { } } -resource "google_compute_reservation" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_reservation" "{{$.PrimaryResourceId}}" { project = google_project.owner_project.project_id - name = "<%= ctx[:vars]['reservation_name'] %>" + name = "{{index $.Vars "reservation_name"}}" zone = "us-central1-a" specific_reservation { diff --git a/mmv1/templates/terraform/examples/site_verification_domain_record.tf.tmpl b/mmv1/templates/terraform/examples/site_verification_domain_record.tf.tmpl index ff83117f760a..9fad84824bee 100644 --- a/mmv1/templates/terraform/examples/site_verification_domain_record.tf.tmpl +++ b/mmv1/templates/terraform/examples/site_verification_domain_record.tf.tmpl @@ -1,18 +1,18 @@ data "google_site_verification_token" "token" { type = "INET_DOMAIN" - identifier = "<%= ctx[:vars]['domain'] %>" + identifier = "{{index $.Vars "domain"}}" verification_method = "DNS_TXT" } resource "google_dns_record_set" "example" { - managed_zone = "<%= ctx[:vars]['managed_zone'] %>" - name = "<%= ctx[:vars]['dns_name'] %>" + managed_zone = "{{index $.Vars "managed_zone"}}" + name = "{{index $.Vars "dns_name"}}" type = "TXT" rrdatas = [data.google_site_verification_token.token.token] ttl = 86400 } -resource "google_site_verification_web_resource" "<%= ctx[:primary_resource_id] %>" { +resource "google_site_verification_web_resource" "{{$.PrimaryResourceId}}" { site { type = data.google_site_verification_token.token.type identifier = data.google_site_verification_token.token.identifier diff --git a/mmv1/templates/terraform/examples/snapshot_basic.tf.tmpl b/mmv1/templates/terraform/examples/snapshot_basic.tf.tmpl index 292d53b849c3..f397cf34b47c 100644 --- a/mmv1/templates/terraform/examples/snapshot_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/snapshot_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_snapshot" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['snapshot_name'] %>" +resource "google_compute_snapshot" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "snapshot_name"}}" source_disk = google_compute_disk.persistent.id zone = "us-central1-a" labels = { @@ -14,7 +14,7 @@ data "google_compute_image" "debian" { } resource "google_compute_disk" "persistent" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" image = data.google_compute_image.debian.self_link size = 10 type = "pd-ssd" diff --git a/mmv1/templates/terraform/examples/snapshot_chainname.tf.tmpl b/mmv1/templates/terraform/examples/snapshot_chainname.tf.tmpl index bcff1ac5f561..052a83553eba 100644 --- a/mmv1/templates/terraform/examples/snapshot_chainname.tf.tmpl +++ b/mmv1/templates/terraform/examples/snapshot_chainname.tf.tmpl @@ -1,8 +1,8 @@ -resource "google_compute_snapshot" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['snapshot_name'] %>" +resource "google_compute_snapshot" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "snapshot_name"}}" source_disk = google_compute_disk.persistent.id zone = "us-central1-a" - chain_name = "<%= ctx[:vars]['chain_name'] %>" + chain_name = "{{index $.Vars "chain_name"}}" labels = { my_label = "value" } @@ -15,7 +15,7 @@ data "google_compute_image" "debian" { } resource "google_compute_disk" "persistent" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" image = data.google_compute_image.debian.self_link size = 10 type = "pd-ssd" diff --git a/mmv1/templates/terraform/examples/sourcerepo_repository_basic.tf.tmpl b/mmv1/templates/terraform/examples/sourcerepo_repository_basic.tf.tmpl index 868037c65df2..e01151bdcc58 100644 --- a/mmv1/templates/terraform/examples/sourcerepo_repository_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/sourcerepo_repository_basic.tf.tmpl @@ -1,3 +1,3 @@ -resource "google_sourcerepo_repository" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['repository_name'] %>" +resource "google_sourcerepo_repository" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "repository_name"}}" } diff --git a/mmv1/templates/terraform/examples/sourcerepo_repository_full.tf.tmpl b/mmv1/templates/terraform/examples/sourcerepo_repository_full.tf.tmpl index 82a0a9431a87..704324ef7e67 100644 --- a/mmv1/templates/terraform/examples/sourcerepo_repository_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/sourcerepo_repository_full.tf.tmpl @@ -1,14 +1,14 @@ resource "google_service_account" "test_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Test Service Account" } resource "google_pubsub_topic" "topic" { - name = "<%= ctx[:vars]['topic_name'] %>" + name = "{{index $.Vars "topic_name"}}" } -resource "google_sourcerepo_repository" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['repository_name'] %>" +resource "google_sourcerepo_repository" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "repository_name"}}" pubsub_configs { topic = google_pubsub_topic.topic.id message_format = "JSON" 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 2ce4c6460642..0e67b6c5289d 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 @@ -1,5 +1,5 @@ resource "google_spanner_instance" "main" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" config = "regional-europe-west1" display_name = "main-instance" num_nodes = 1 @@ -7,21 +7,21 @@ resource "google_spanner_instance" "main" { resource "google_spanner_database" "database" { instance = google_spanner_instance.main.name - name = "<%= ctx[:vars]['database_name'] %>" + name = "{{index $.Vars "database_name"}}" version_retention_period = "3d" ddl = [ "CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)", "CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)", ] - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_spanner_backup_schedule" "<%= ctx[:primary_resource_id] %>" { +resource "google_spanner_backup_schedule" "{{$.PrimaryResourceId}}" { instance = google_spanner_instance.main.name database = google_spanner_database.database.name - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" retention_duration = "31620000s" // 366 days (maximum possible retention) 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 857ed561d30d..6d1e57a547d7 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 @@ -1,5 +1,5 @@ resource "google_spanner_instance" "main" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" config = "regional-europe-west1" display_name = "main-instance" num_nodes = 1 @@ -7,21 +7,21 @@ resource "google_spanner_instance" "main" { resource "google_spanner_database" "database" { instance = google_spanner_instance.main.name - name = "<%= ctx[:vars]['database_name'] %>" + name = "{{index $.Vars "database_name"}}" version_retention_period = "3d" ddl = [ "CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)", "CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)", ] - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_spanner_backup_schedule" "<%= ctx[:primary_resource_id] %>" { +resource "google_spanner_backup_schedule" "{{$.PrimaryResourceId}}" { instance = google_spanner_instance.main.name database = google_spanner_database.database.name - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" retention_duration = "31620000s" // 366 days (maximum possible retention) diff --git a/mmv1/templates/terraform/examples/spanner_database_basic.tf.tmpl b/mmv1/templates/terraform/examples/spanner_database_basic.tf.tmpl index 1ac3f9798309..069aae72dcdc 100644 --- a/mmv1/templates/terraform/examples/spanner_database_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/spanner_database_basic.tf.tmpl @@ -6,7 +6,7 @@ resource "google_spanner_instance" "main" { resource "google_spanner_database" "database" { instance = google_spanner_instance.main.name - name = "<%= ctx[:vars]['database_name'] %>" + name = "{{index $.Vars "database_name"}}" version_retention_period = "3d" ddl = [ "CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)", diff --git a/mmv1/templates/terraform/examples/spanner_instance_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/spanner_instance_config_basic.tf.tmpl index c4c8e2723258..6aeb25862767 100644 --- a/mmv1/templates/terraform/examples/spanner_instance_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/spanner_instance_config_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_spanner_instance_config" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_config_name'] %>" +resource "google_spanner_instance_config" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_config_name"}}" display_name = "Test Spanner Instance Config" base_config = "nam11" replicas { diff --git a/mmv1/templates/terraform/examples/spot_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/spot_instance_basic.tf.tmpl index 5a8f04d91aad..a235283e7196 100644 --- a/mmv1/templates/terraform/examples/spot_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/spot_instance_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['spot_instance_name'] %>" +resource "google_compute_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "spot_instance_name"}}" machine_type = "f1-micro" zone = "us-central1-c" diff --git a/mmv1/templates/terraform/examples/sql_database_basic.tf.tmpl b/mmv1/templates/terraform/examples/sql_database_basic.tf.tmpl index 020d7b834b23..fa73d6564e15 100644 --- a/mmv1/templates/terraform/examples/sql_database_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_database_basic.tf.tmpl @@ -1,16 +1,16 @@ -resource "google_sql_database" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['database_name'] %>" +resource "google_sql_database" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "database_name"}}" instance = google_sql_database_instance.instance.name } # See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" region = "us-central1" database_version = "MYSQL_8_0" settings { tier = "db-f1-micro" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_database_deletion_policy.tf.tmpl b/mmv1/templates/terraform/examples/sql_database_deletion_policy.tf.tmpl index 4609d0a29934..94ee726216e9 100644 --- a/mmv1/templates/terraform/examples/sql_database_deletion_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_database_deletion_policy.tf.tmpl @@ -1,17 +1,17 @@ -resource "google_sql_database" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['database_name'] %>" +resource "google_sql_database" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "database_name"}}" instance = google_sql_database_instance.instance.name deletion_policy = "ABANDON" } # See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version resource "google_sql_database_instance" "instance" { - name = "<%= ctx[:vars]['database_instance_name'] %>" + name = "{{index $.Vars "database_instance_name"}}" region = "us-central1" database_version = "POSTGRES_14" settings { tier = "db-g1-small" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_database_instance_my_sql.tf.tmpl b/mmv1/templates/terraform/examples/sql_database_instance_my_sql.tf.tmpl index 79c06a034774..21a9c6082906 100644 --- a/mmv1/templates/terraform/examples/sql_database_instance_my_sql.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_database_instance_my_sql.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['database_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "database_instance_name"}}" region = "us-central1" database_version = "MYSQL_8_0" settings { tier = "db-n1-standard-2" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "random_password" "pwd" { diff --git a/mmv1/templates/terraform/examples/sql_database_instance_postgres.tf.tmpl b/mmv1/templates/terraform/examples/sql_database_instance_postgres.tf.tmpl index 82aa94afd586..ca0440f929fd 100644 --- a/mmv1/templates/terraform/examples/sql_database_instance_postgres.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_database_instance_postgres.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['database_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "database_instance_name"}}" region = "us-central1" database_version = "POSTGRES_14" settings { tier = "db-custom-2-7680" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "random_password" "pwd" { diff --git a/mmv1/templates/terraform/examples/sql_database_instance_sqlserver.tf.tmpl b/mmv1/templates/terraform/examples/sql_database_instance_sqlserver.tf.tmpl index 0be842147a82..da41d5d0ade6 100644 --- a/mmv1/templates/terraform/examples/sql_database_instance_sqlserver.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_database_instance_sqlserver.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['database_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "database_instance_name"}}" region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" settings { tier = "db-custom-2-7680" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "random_password" "pwd" { diff --git a/mmv1/templates/terraform/examples/sql_instance_cmek.tf.tmpl b/mmv1/templates/terraform/examples/sql_instance_cmek.tf.tmpl index a11d4cba34da..29e4ab2e606a 100644 --- a/mmv1/templates/terraform/examples/sql_instance_cmek.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_instance_cmek.tf.tmpl @@ -5,13 +5,13 @@ resource "google_project_service_identity" "gcp_sa_cloud_sql" { resource "google_kms_key_ring" "keyring" { provider = google-beta - name = "<%= ctx[:vars]['keyring_name'] %>" + name = "{{index $.Vars "keyring_name"}}" location = "us-central1" } resource "google_kms_crypto_key" "key" { provider = google-beta - name = "<%= ctx[:vars]['crypto_key_name'] %>" + name = "{{index $.Vars "crypto_key_name"}}" key_ring = google_kms_key_ring.keyring.id purpose = "ENCRYPT_DECRYPT" } @@ -25,7 +25,7 @@ resource "google_kms_crypto_key_iam_member" "crypto_key" { } resource "google_sql_database_instance" "mysql_instance_with_cmek" { - name = "<%= ctx[:vars]['mysql_instance_cmek'] %>" + name = "{{index $.Vars "mysql_instance_cmek"}}" provider = google-beta region = "us-central1" database_version = "MYSQL_8_0" @@ -33,11 +33,11 @@ resource "google_sql_database_instance" "mysql_instance_with_cmek" { settings { tier = "db-n1-standard-2" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_database_instance" "postgres_instance_with_cmek" { - name = "<%= ctx[:vars]['postgres_instance_cmek'] %>" + name = "{{index $.Vars "postgres_instance_cmek"}}" provider = google-beta region = "us-central1" database_version = "POSTGRES_14" @@ -45,11 +45,11 @@ resource "google_sql_database_instance" "postgres_instance_with_cmek" { settings { tier = "db-custom-2-7680" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance_cmek'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance_cmek"}}" provider = google-beta region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" @@ -58,5 +58,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { settings { tier = "db-custom-2-7680" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_instance_ha.tf.tmpl b/mmv1/templates/terraform/examples/sql_instance_ha.tf.tmpl index 9c068f2e207a..4c56199b3ed4 100644 --- a/mmv1/templates/terraform/examples/sql_instance_ha.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_instance_ha.tf.tmpl @@ -1,5 +1,5 @@ resource "google_sql_database_instance" "mysql_instance_ha" { - name = "<%= ctx[:vars]['mysql_instance_ha'] %>" + name = "{{index $.Vars "mysql_instance_ha"}}" region = "asia-northeast1" database_version = "MYSQL_8_0" settings { @@ -11,11 +11,11 @@ resource "google_sql_database_instance" "mysql_instance_ha" { start_time = "20:55" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_database_instance" "postgres_instance_ha" { - name = "<%= ctx[:vars]['postgres_instance_ha'] %>" + name = "{{index $.Vars "postgres_instance_ha"}}" region = "us-central1" database_version = "POSTGRES_14" settings { @@ -27,11 +27,11 @@ resource "google_sql_database_instance" "postgres_instance_ha" { start_time = "20:55" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance_ha'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance_ha"}}" region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" @@ -43,5 +43,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { start_time = "20:55" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_instance_iam_condition.tf.tmpl b/mmv1/templates/terraform/examples/sql_instance_iam_condition.tf.tmpl index 0165439da3c5..98fc75ef44ac 100644 --- a/mmv1/templates/terraform/examples/sql_instance_iam_condition.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_instance_iam_condition.tf.tmpl @@ -25,13 +25,13 @@ resource "google_project_iam_policy" "project" { policy_data = data.google_iam_policy.sql_iam_policy.policy_data } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_instance_iam_condition'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_instance_iam_condition"}}" provider = google-beta region = "us-central1" database_version = "MYSQL_8_0" settings { tier = "db-n1-standard-2" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_instance_labels.tf.tmpl b/mmv1/templates/terraform/examples/sql_instance_labels.tf.tmpl index ac5e13f7904b..9fa98a22dad8 100644 --- a/mmv1/templates/terraform/examples/sql_instance_labels.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_instance_labels.tf.tmpl @@ -1,5 +1,5 @@ resource "google_sql_database_instance" "mysql_instance_labels" { - name = "<%= ctx[:vars]['mysql_instance_labels'] %>" + name = "{{index $.Vars "mysql_instance_labels"}}" region = "us-central1" database_version = "MYSQL_8_0" settings { @@ -13,7 +13,7 @@ resource "google_sql_database_instance" "mysql_instance_labels" { } resource "google_sql_database_instance" "postgres_instance_labels" { - name = "<%= ctx[:vars]['postgres_instance_labels'] %>" + name = "{{index $.Vars "postgres_instance_labels"}}" region = "us-central1" database_version = "POSTGRES_14" settings { @@ -26,8 +26,8 @@ resource "google_sql_database_instance" "postgres_instance_labels" { deletion_protection = "false" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance_labels'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance_labels"}}" region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" diff --git a/mmv1/templates/terraform/examples/sql_instance_pitr.tf.tmpl b/mmv1/templates/terraform/examples/sql_instance_pitr.tf.tmpl index 2c22326bc3a3..3739b999506e 100644 --- a/mmv1/templates/terraform/examples/sql_instance_pitr.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_instance_pitr.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_instance_pitr'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_instance_pitr"}}" region = "asia-northeast1" database_version = "MYSQL_8_0" settings { @@ -11,11 +11,11 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { transaction_log_retention_days = "3" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_database_instance" "postgres_instance_pitr" { - name = "<%= ctx[:vars]['postgres_instance__pitr'] %>" + name = "{{index $.Vars "postgres_instance__pitr"}}" region = "us-central1" database_version = "POSTGRES_14" settings { @@ -27,5 +27,5 @@ resource "google_sql_database_instance" "postgres_instance_pitr" { transaction_log_retention_days = "3" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_instance_ssl_cert.tf.tmpl b/mmv1/templates/terraform/examples/sql_instance_ssl_cert.tf.tmpl index 9453223a0e9a..552191869738 100644 --- a/mmv1/templates/terraform/examples/sql_instance_ssl_cert.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_instance_ssl_cert.tf.tmpl @@ -1,5 +1,5 @@ resource "google_sql_database_instance" "mysql_instance" { - name = "<%= ctx[:vars]['mysql_instance'] %>" + name = "{{index $.Vars "mysql_instance"}}" region = "asia-northeast1" database_version = "MYSQL_8_0" settings { @@ -8,7 +8,7 @@ resource "google_sql_database_instance" "mysql_instance" { ssl_mode = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_ssl_cert" "mysql_client_cert" { @@ -17,7 +17,7 @@ resource "google_sql_ssl_cert" "mysql_client_cert" { } resource "google_sql_database_instance" "postgres_instance" { - name = "<%= ctx[:vars]['postgres_instance'] %>" + name = "{{index $.Vars "postgres_instance"}}" region = "asia-northeast1" database_version = "postgres_14" settings { @@ -26,7 +26,7 @@ resource "google_sql_database_instance" "postgres_instance" { ssl_mode = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_sql_ssl_cert" "postgres_client_cert" { @@ -34,8 +34,8 @@ resource "google_sql_ssl_cert" "postgres_client_cert" { instance = google_sql_database_instance.postgres_instance.name } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance"}}" region = "asia-northeast1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" @@ -45,5 +45,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { ssl_mode = "ENCRYPTED_ONLY" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_authorized_network.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_authorized_network.tf.tmpl index f4c14135fc8c..1cd16f0e408b 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_authorized_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_authorized_network.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_instance_with_authorized_network'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_instance_with_authorized_network"}}" region = "us-central1" database_version = "MYSQL_8_0" settings { @@ -12,5 +12,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_backup.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_backup.tf.tmpl index 64e86572e7de..fab77d0d506d 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_backup.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_backup.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_instance_backup'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_instance_backup"}}" region = "asia-northeast1" database_version = "MYSQL_8_0" settings { @@ -10,5 +10,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { start_time = "20:55" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_backup_location.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_backup_location.tf.tmpl index fdb5e6140199..96e138c64c2d 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_backup_location.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_backup_location.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_instance_backup_location'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_instance_backup_location"}}" region = "asia-northeast1" database_version = "MYSQL_8_0" settings { @@ -9,5 +9,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { location = "asia-northeast1" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_backup_retention.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_backup_retention.tf.tmpl index 0dd93f7b6904..ee7a1d41c254 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_backup_retention.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_backup_retention.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_instance_backup_retention'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_instance_backup_retention"}}" region = "asia-northeast1" database_version = "MYSQL_8_0" settings { @@ -12,5 +12,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_clone.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_clone.tf.tmpl index 0bc24a1121b4..134192af0268 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_clone.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_clone.tf.tmpl @@ -1,19 +1,19 @@ resource "google_sql_database_instance" "source" { - name = "<%= ctx[:vars]['mysql_instance_source_name'] %>" + name = "{{index $.Vars "mysql_instance_source_name"}}" region = "us-central1" database_version = "MYSQL_8_0" settings { tier = "db-n1-standard-2" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_instance_clone_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_instance_clone_name"}}" region = "us-central1" database_version = "MYSQL_8_0" clone { source_instance_name = google_sql_database_instance.source.id } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_flags.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_flags.tf.tmpl index 8dc76ac0b216..188242db640d 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_flags.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_flags.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { database_version = "MYSQL_8_0" - name = "<%= ctx[:vars]['mysql_instance'] %>" + name = "{{index $.Vars "mysql_instance"}}" region = "us-central1" settings { database_flags { @@ -18,5 +18,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { disk_type = "PD_SSD" tier = "db-n1-standard-2" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_public_ip.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_public_ip.tf.tmpl index a3088daa01be..93d0efe450fa 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_public_ip.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_public_ip.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { database_version = "MYSQL_5_7" - name = "<%= ctx[:vars]['mysql_public_ip_instance_name'] %>" + name = "{{index $.Vars "mysql_public_ip_instance_name"}}" region = "asia-southeast2" settings { availability_type = "ZONAL" @@ -18,5 +18,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } tier = "db-custom-4-26624" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_pvp.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_pvp.tf.tmpl index 43cf7746672c..feef53e47ab8 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_pvp.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_pvp.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_pvp_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_pvp_instance_name"}}" region = "asia-northeast1" database_version = "MYSQL_8_0" root_password = "abcABC123!" @@ -13,5 +13,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { enable_password_policy = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_mysql_instance_replica.tf.tmpl b/mmv1/templates/terraform/examples/sql_mysql_instance_replica.tf.tmpl index f872d84a9670..9664d733332e 100644 --- a/mmv1/templates/terraform/examples/sql_mysql_instance_replica.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_mysql_instance_replica.tf.tmpl @@ -1,5 +1,5 @@ resource "google_sql_database_instance" "primary" { - name = "<%= ctx[:vars]['mysql_primary_instance_name'] %>" + name = "{{index $.Vars "mysql_primary_instance_name"}}" region = "europe-west4" database_version = "MYSQL_8_0" settings { @@ -9,11 +9,11 @@ resource "google_sql_database_instance" "primary" { binary_log_enabled = "true" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['mysql_replica_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "mysql_replica_instance_name"}}" master_instance_name = google_sql_database_instance.primary.name region = "europe-west4" database_version = "MYSQL_8_0" @@ -27,5 +27,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { availability_type = "ZONAL" disk_size = "100" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_authorized_network.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_authorized_network.tf.tmpl index a470906e9409..1441006a0b88 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_authorized_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_authorized_network.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['postgres_instance_with_authorized_network'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "postgres_instance_with_authorized_network"}}" region = "us-central1" database_version = "POSTGRES_14" settings { @@ -12,5 +12,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_backup.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_backup.tf.tmpl index e96215a2983d..94043bb1c485 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_backup.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_backup.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['postgres_instance_backup'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "postgres_instance_backup"}}" region = "us-central1" database_version = "POSTGRES_14" settings { @@ -9,5 +9,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { start_time = "20:55" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_backup_location.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_backup_location.tf.tmpl index 4e8002c5aaee..93476520866b 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_backup_location.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_backup_location.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['postgres_instance_backup_location'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "postgres_instance_backup_location"}}" region = "us-central1" database_version = "POSTGRES_14" settings { @@ -9,5 +9,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { location = "us-central1" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_backup_retention.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_backup_retention.tf.tmpl index c8779aeca19d..b797a1f8e699 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_backup_retention.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_backup_retention.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['postgres_instance_backup_retention'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "postgres_instance_backup_retention"}}" region = "us-central1" database_version = "POSTGRES_14" settings { @@ -12,5 +12,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_clone.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_clone.tf.tmpl index b0c2db262099..fd519d57b23e 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_clone.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_clone.tf.tmpl @@ -1,19 +1,19 @@ resource "google_sql_database_instance" "source" { - name = "<%= ctx[:vars]['postgres_instance_source_name'] %>" + name = "{{index $.Vars "postgres_instance_source_name"}}" region = "us-central1" database_version = "POSTGRES_12" settings { tier = "db-n1-standard-2" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['postgres_instance_clone_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "postgres_instance_clone_name"}}" region = "us-central1" database_version = "POSTGRES_12" clone { source_instance_name = google_sql_database_instance.source.id } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_flags.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_flags.tf.tmpl index 094ee609fe86..eed5805b0096 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_flags.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_flags.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['postgres_instance'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "postgres_instance"}}" region = "us-central1" database_version = "POSTGRES_14" settings { @@ -13,5 +13,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } tier = "db-custom-2-7680" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_public_ip.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_public_ip.tf.tmpl index 2c69e6fecb35..4ab67a49c708 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_public_ip.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_public_ip.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { database_version = "POSTGRES_14" - name = "<%= ctx[:vars]['postgres_public_ip_instance_name'] %>" + name = "{{index $.Vars "postgres_public_ip_instance_name"}}" region = "asia-southeast2" settings { availability_type = "ZONAL" @@ -16,5 +16,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } tier = "db-custom-2-7680" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_pvp.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_pvp.tf.tmpl index 5676c1aab0dc..5181bd859d46 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_pvp.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_pvp.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['postgres_pvp_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "postgres_pvp_instance_name"}}" region = "asia-northeast1" database_version = "POSTGRES_14" root_password = "abcABC123!" @@ -14,5 +14,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { enable_password_policy = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_postgres_instance_replica.tf.tmpl b/mmv1/templates/terraform/examples/sql_postgres_instance_replica.tf.tmpl index 0ec218dd5b3d..180fa60611e5 100644 --- a/mmv1/templates/terraform/examples/sql_postgres_instance_replica.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_postgres_instance_replica.tf.tmpl @@ -1,5 +1,5 @@ resource "google_sql_database_instance" "primary" { - name = "<%= ctx[:vars]['postgres_primary_instance_name'] %>" + name = "{{index $.Vars "postgres_primary_instance_name"}}" region = "europe-west4" database_version = "POSTGRES_14" settings { @@ -8,11 +8,11 @@ resource "google_sql_database_instance" "primary" { enabled = "true" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['postgres_replica_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "postgres_replica_instance_name"}}" master_instance_name = google_sql_database_instance.primary.name region = "europe-west4" database_version = "POSTGRES_14" @@ -26,5 +26,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { availability_type = "ZONAL" disk_size = "100" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_source_representation_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/sql_source_representation_instance_basic.tf.tmpl index d4f8e13bf592..625d1f7e0b5d 100644 --- a/mmv1/templates/terraform/examples/sql_source_representation_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_source_representation_instance_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_source_representation_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_sql_source_representation_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" region = "us-central1" database_version = "MYSQL_8_0" host = "10.20.30.40" diff --git a/mmv1/templates/terraform/examples/sql_source_representation_instance_postgres.tf.tmpl b/mmv1/templates/terraform/examples/sql_source_representation_instance_postgres.tf.tmpl index 8c5578896401..30e8d69e92f1 100644 --- a/mmv1/templates/terraform/examples/sql_source_representation_instance_postgres.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_source_representation_instance_postgres.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_source_representation_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_sql_source_representation_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" region = "us-central1" database_version = "POSTGRES_9_6" host = "10.20.30.40" diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_instance_authorized_network.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_instance_authorized_network.tf.tmpl index 3b94e9f543fb..6cb660a5dfa9 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_instance_authorized_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_instance_authorized_network.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance_with_authorized_network'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance_with_authorized_network"}}" region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" @@ -13,5 +13,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup.tf.tmpl index dde6337eabb1..ea04446a312c 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance_backup'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance_backup"}}" region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" @@ -10,5 +10,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { start_time = "20:55" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup_location.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup_location.tf.tmpl index 711aeb9ec41c..ba2d19cc8eed 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup_location.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup_location.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance_backup_location'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance_backup_location"}}" region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" @@ -10,5 +10,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { location = "us-central1" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup_retention.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup_retention.tf.tmpl index 26ab7ac728fb..bcf2751fbac2 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup_retention.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_instance_backup_retention.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance_backup_retention'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance_backup_retention"}}" region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" @@ -13,5 +13,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_instance_clone.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_instance_clone.tf.tmpl index a233977ddfad..9122adc7ec14 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_instance_clone.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_instance_clone.tf.tmpl @@ -1,21 +1,21 @@ resource "google_sql_database_instance" "source" { - name = "<%= ctx[:vars]['sqlserver_instance_source_name'] %>" + name = "{{index $.Vars "sqlserver_instance_source_name"}}" region = "us-central1" database_version = "SQLSERVER_2017_STANDARD" root_password = "INSERT-PASSWORD-HERE" settings { tier = "db-custom-2-7680" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance_clone_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance_clone_name"}}" region = "us-central1" database_version = "SQLSERVER_2017_STANDARD" root_password = "INSERT-PASSWORD-HERE" clone { source_instance_name = google_sql_database_instance.source.id } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_instance_flags.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_instance_flags.tf.tmpl index b3c455736e07..31e878f1a9fc 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_instance_flags.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_instance_flags.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_instance'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_instance"}}" region = "us-central1" database_version = "SQLSERVER_2019_STANDARD" root_password = "INSERT-PASSWORD-HERE" @@ -18,5 +18,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { } tier = "db-custom-2-7680" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_instance_public_ip.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_instance_public_ip.tf.tmpl index 1404f6245e54..86b8090be47a 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_instance_public_ip.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_instance_public_ip.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_public_ip_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_public_ip_instance_name"}}" region = "europe-west4" database_version = "SQLSERVER_2019_ENTERPRISE" root_password = "INSERT-PASSWORD-HERE" @@ -17,5 +17,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { ipv4_enabled = true } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_instance_replica.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_instance_replica.tf.tmpl index 623bbac50c39..93c26ef17944 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_instance_replica.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_instance_replica.tf.tmpl @@ -1,5 +1,5 @@ resource "google_sql_database_instance" "primary" { - name = "<%= ctx[:vars]['sqlserver_primary_instance_name'] %>" + name = "{{index $.Vars "sqlserver_primary_instance_name"}}" region = "europe-west4" database_version = "SQLSERVER_2019_ENTERPRISE" root_password = "INSERT-PASSWORD-HERE" @@ -9,11 +9,11 @@ resource "google_sql_database_instance" "primary" { enabled = "true" } } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } -resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['sqlserver_replica_instance_name'] %>" +resource "google_sql_database_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "sqlserver_replica_instance_name"}}" master_instance_name = google_sql_database_instance.primary.name region = "europe-west4" database_version = "SQLSERVER_2019_ENTERPRISE" @@ -27,5 +27,5 @@ resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" { availability_type = "ZONAL" disk_size = "100" } - deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" + deletion_protection = "{{index $.Vars "deletion_protection"}}" } diff --git a/mmv1/templates/terraform/examples/sql_sqlserver_vm_instance.tf.tmpl b/mmv1/templates/terraform/examples/sql_sqlserver_vm_instance.tf.tmpl index 2b5d7e1a8a04..c1d7a1e1d5fa 100644 --- a/mmv1/templates/terraform/examples/sql_sqlserver_vm_instance.tf.tmpl +++ b/mmv1/templates/terraform/examples/sql_sqlserver_vm_instance.tf.tmpl @@ -1,22 +1,22 @@ # VPC network resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['vpc_network'] %>" + name = "{{index $.Vars "vpc_network"}}" auto_create_subnetworks = false } # Subnet resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['vpc_subnet'] %>" + name = "{{index $.Vars "vpc_subnet"}}" ip_cidr_range = "10.0.1.0/24" region = "europe-west1" network = google_compute_network.default.id } -resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_instance" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['sqlserver_vm'] %>" + name = "{{index $.Vars "sqlserver_vm"}}" boot_disk { auto_delete = true device_name = "persistent-disk-0" @@ -41,7 +41,7 @@ resource "google_compute_instance" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_firewall" "sql_server_1433" { provider = google-beta - name = "<%= ctx[:vars]['sql_server_1433_3'] %>" + name = "{{index $.Vars "sql_server_1433_3"}}" allow { ports = ["1433"] protocol = "tcp" diff --git a/mmv1/templates/terraform/examples/ssl_certificate_target_https_proxies.tf.tmpl b/mmv1/templates/terraform/examples/ssl_certificate_target_https_proxies.tf.tmpl index 62b3082dabd0..09d98bc85207 100644 --- a/mmv1/templates/terraform/examples/ssl_certificate_target_https_proxies.tf.tmpl +++ b/mmv1/templates/terraform/examples/ssl_certificate_target_https_proxies.tf.tmpl @@ -19,13 +19,13 @@ resource "google_compute_ssl_certificate" "default" { } resource "google_compute_target_https_proxy" "default" { - name = "<%= ctx[:vars]['target_https_proxy_name'] %>" + name = "{{index $.Vars "target_https_proxy_name"}}" url_map = google_compute_url_map.default.id ssl_certificates = [google_compute_ssl_certificate.default.id] } resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -47,7 +47,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -56,7 +56,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/ssl_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/ssl_policy_basic.tf.tmpl index f84bb67aef4d..e76e691a6d6f 100644 --- a/mmv1/templates/terraform/examples/ssl_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/ssl_policy_basic.tf.tmpl @@ -1,16 +1,16 @@ resource "google_compute_ssl_policy" "prod-ssl-policy" { - name = "<%= ctx[:vars]['production_ssl_policy_name'] %>" + name = "{{index $.Vars "production_ssl_policy_name"}}" profile = "MODERN" } resource "google_compute_ssl_policy" "nonprod-ssl-policy" { - name = "<%= ctx[:vars]['nonprod_ssl_policy_name'] %>" + name = "{{index $.Vars "nonprod_ssl_policy_name"}}" profile = "MODERN" min_tls_version = "TLS_1_2" } resource "google_compute_ssl_policy" "custom-ssl-policy" { - name = "<%= ctx[:vars]['custom_ssl_policy_name'] %>" + name = "{{index $.Vars "custom_ssl_policy_name"}}" min_tls_version = "TLS_1_2" profile = "CUSTOM" custom_features = ["TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"] diff --git a/mmv1/templates/terraform/examples/stateful_igm.tf.tmpl b/mmv1/templates/terraform/examples/stateful_igm.tf.tmpl index 10d05e1f5b3c..5ee43046a890 100644 --- a/mmv1/templates/terraform/examples/stateful_igm.tf.tmpl +++ b/mmv1/templates/terraform/examples/stateful_igm.tf.tmpl @@ -4,7 +4,7 @@ data "google_compute_image" "my_image" { } resource "google_compute_instance_template" "igm-basic" { - name = "<%= ctx[:vars]['template_name'] %>" + name = "{{index $.Vars "template_name"}}" machine_type = "e2-medium" can_ip_forward = false tags = ["foo", "bar"] @@ -26,7 +26,7 @@ resource "google_compute_instance_template" "igm-basic" { resource "google_compute_instance_group_manager" "igm-no-tp" { description = "Terraform test instance group manager" - name = "<%= ctx[:vars]['igm_name'] %>" + name = "{{index $.Vars "igm_name"}}" version { name = "prod" @@ -39,7 +39,7 @@ resource "google_compute_instance_group_manager" "igm-no-tp" { } resource "google_compute_disk" "default" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" type = "pd-ssd" zone = google_compute_instance_group_manager.igm.zone image = "debian-11-bullseye-v20220719" diff --git a/mmv1/templates/terraform/examples/stateful_rigm.tf.tmpl b/mmv1/templates/terraform/examples/stateful_rigm.tf.tmpl index c066fbbaa5ea..4d7e2f919ca3 100644 --- a/mmv1/templates/terraform/examples/stateful_rigm.tf.tmpl +++ b/mmv1/templates/terraform/examples/stateful_rigm.tf.tmpl @@ -4,7 +4,7 @@ data "google_compute_image" "my_image" { } resource "google_compute_instance_template" "igm-basic" { - name = "<%= ctx[:vars]['template_name'] %>" + name = "{{index $.Vars "template_name"}}" machine_type = "e2-medium" can_ip_forward = false tags = ["foo", "bar"] @@ -26,7 +26,7 @@ resource "google_compute_instance_template" "igm-basic" { resource "google_compute_region_instance_group_manager" "rigm" { description = "Terraform test instance group manager" - name = "<%= ctx[:vars]['igm_name'] %>" + name = "{{index $.Vars "igm_name"}}" version { name = "prod" @@ -45,7 +45,7 @@ resource "google_compute_region_instance_group_manager" "rigm" { } resource "google_compute_disk" "default" { - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" type = "pd-ssd" zone = "us-central1-a" image = "debian-11-bullseye-v20220719" diff --git a/mmv1/templates/terraform/examples/storage_bucket_access_control_public_bucket.tf.tmpl b/mmv1/templates/terraform/examples/storage_bucket_access_control_public_bucket.tf.tmpl index ffc6e6f236ac..6bc203c53060 100644 --- a/mmv1/templates/terraform/examples/storage_bucket_access_control_public_bucket.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_bucket_access_control_public_bucket.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_storage_bucket_access_control" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_bucket_access_control" "{{$.PrimaryResourceId}}" { bucket = google_storage_bucket.bucket.name role = "READER" entity = "allUsers" } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/storage_bucket_basic.tf.tmpl b/mmv1/templates/terraform/examples/storage_bucket_basic.tf.tmpl index 8b45d46caa8d..7b2514c8c8b7 100644 --- a/mmv1/templates/terraform/examples/storage_bucket_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_bucket_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "US" uniform_bucket_level_access = true } diff --git a/mmv1/templates/terraform/examples/storage_bucket_storage_class.tf.tmpl b/mmv1/templates/terraform/examples/storage_bucket_storage_class.tf.tmpl index 364b7005d59a..6859f6895e9c 100644 --- a/mmv1/templates/terraform/examples/storage_bucket_storage_class.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_bucket_storage_class.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" location = "US" storage_class = "ARCHIVE" } diff --git a/mmv1/templates/terraform/examples/storage_default_object_access_control_public.tf.tmpl b/mmv1/templates/terraform/examples/storage_default_object_access_control_public.tf.tmpl index 8dca9d1d3cd0..a68aaedf5f99 100644 --- a/mmv1/templates/terraform/examples/storage_default_object_access_control_public.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_default_object_access_control_public.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_storage_default_object_access_control" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_default_object_access_control" "{{$.PrimaryResourceId}}" { bucket = google_storage_bucket.bucket.name role = "READER" entity = "allUsers" } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/storage_hmac_key.tf.tmpl b/mmv1/templates/terraform/examples/storage_hmac_key.tf.tmpl index 22c86624cb86..189802fbc656 100644 --- a/mmv1/templates/terraform/examples/storage_hmac_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_hmac_key.tf.tmpl @@ -1,9 +1,9 @@ # Create a new service account resource "google_service_account" "service_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" } #Create the HMAC key for the associated service account -resource "google_storage_hmac_key" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_hmac_key" "{{$.PrimaryResourceId}}" { service_account_email = google_service_account.service_account.email } diff --git a/mmv1/templates/terraform/examples/storage_insights_report_config.tf.tmpl b/mmv1/templates/terraform/examples/storage_insights_report_config.tf.tmpl index 23fe21dd416d..54d489ffac65 100644 --- a/mmv1/templates/terraform/examples/storage_insights_report_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_insights_report_config.tf.tmpl @@ -1,7 +1,7 @@ data "google_project" "project" { } -resource "google_storage_insights_report_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_insights_report_config" "{{$.PrimaryResourceId}}" { display_name = "Test Report Config" location = "us-central1" frequency_options { @@ -39,7 +39,7 @@ resource "google_storage_insights_report_config" "<%= ctx[:primary_resource_id] } resource "google_storage_bucket" "report_bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "us-central1" force_destroy = true uniform_bucket_level_access = true diff --git a/mmv1/templates/terraform/examples/storage_make_data_public.tf.tmpl b/mmv1/templates/terraform/examples/storage_make_data_public.tf.tmpl index 04a34e657955..edc5c07db1f5 100644 --- a/mmv1/templates/terraform/examples/storage_make_data_public.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_make_data_public.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['example_bucket_name'] %>" + name = "{{index $.Vars "example_bucket_name"}}" location = "US" uniform_bucket_level_access = true } diff --git a/mmv1/templates/terraform/examples/storage_managed_folder_basic.tf.tmpl b/mmv1/templates/terraform/examples/storage_managed_folder_basic.tf.tmpl index e48eb4393fb2..11aefff8a46a 100644 --- a/mmv1/templates/terraform/examples/storage_managed_folder_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_managed_folder_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "EU" uniform_bucket_level_access = true } -resource "google_storage_managed_folder" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_managed_folder" "{{$.PrimaryResourceId}}" { bucket = google_storage_bucket.bucket.name name = "managed/folder/name/" force_destroy = true diff --git a/mmv1/templates/terraform/examples/storage_new_bucket.tf.tmpl b/mmv1/templates/terraform/examples/storage_new_bucket.tf.tmpl index 9b8312e8c769..b6557318d04c 100644 --- a/mmv1/templates/terraform/examples/storage_new_bucket.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_new_bucket.tf.tmpl @@ -1,7 +1,7 @@ # Create new storage bucket in the US multi-region # with coldline storage -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['new_bucket'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "new_bucket"}}" location = "US" storage_class = "COLDLINE" @@ -14,7 +14,7 @@ resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { # The text object in Cloud Storage resource "google_storage_bucket_object" "default" { - name = "<%= ctx[:vars]['new_object'] %>" + name = "{{index $.Vars "new_object"}}" # Uncomment and add valid path to an object. # source = "/path/to/an/object" content = "Data as string to be uploaded" diff --git a/mmv1/templates/terraform/examples/storage_object_access_control_public_object.tf.tmpl b/mmv1/templates/terraform/examples/storage_object_access_control_public_object.tf.tmpl index dce73451b65e..f804298c6902 100644 --- a/mmv1/templates/terraform/examples/storage_object_access_control_public_object.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_object_access_control_public_object.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_storage_object_access_control" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_object_access_control" "{{$.PrimaryResourceId}}" { object = google_storage_bucket_object.object.output_name bucket = google_storage_bucket.bucket.name role = "READER" @@ -6,12 +6,12 @@ resource "google_storage_object_access_control" "<%= ctx[:primary_resource_id] % } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "US" } resource "google_storage_bucket_object" "object" { - name = "<%= ctx[:vars]['object_name'] %>" + name = "{{index $.Vars "object_name"}}" bucket = google_storage_bucket.bucket.name source = "../static/img/header-logo.png" } diff --git a/mmv1/templates/terraform/examples/storage_object_lifecycle_setting.tf.tmpl b/mmv1/templates/terraform/examples/storage_object_lifecycle_setting.tf.tmpl index 82cbed0a9167..3beadc46890e 100644 --- a/mmv1/templates/terraform/examples/storage_object_lifecycle_setting.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_object_lifecycle_setting.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['example_bucket'] %>" + name = "{{index $.Vars "example_bucket"}}" location = "US" uniform_bucket_level_access = true diff --git a/mmv1/templates/terraform/examples/storage_pubsub_notifications.tf.tmpl b/mmv1/templates/terraform/examples/storage_pubsub_notifications.tf.tmpl index f1a5943a9de2..b73d62d3826c 100644 --- a/mmv1/templates/terraform/examples/storage_pubsub_notifications.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_pubsub_notifications.tf.tmpl @@ -22,13 +22,13 @@ resource "google_pubsub_topic_iam_binding" "binding" { // Create a new storage bucket. resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['example_bucket_name'] %>" + name = "{{index $.Vars "example_bucket_name"}}" provider = google-beta location = "US" uniform_bucket_level_access = true } -resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['your_topic_name'] %>" +resource "google_pubsub_topic" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "your_topic_name"}}" provider = google-beta } diff --git a/mmv1/templates/terraform/examples/storage_static_website.tf.tmpl b/mmv1/templates/terraform/examples/storage_static_website.tf.tmpl index d8e3dfa10007..6f7fa483a2b0 100644 --- a/mmv1/templates/terraform/examples/storage_static_website.tf.tmpl +++ b/mmv1/templates/terraform/examples/storage_static_website.tf.tmpl @@ -1,12 +1,12 @@ # Create new storage bucket in the US multi-region # with coldline storage and settings for main_page_suffix and not_found_page -resource "google_storage_bucket" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['static_website_bucket'] %>" +resource "google_storage_bucket" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "static_website_bucket"}}" location = "US" storage_class = "COLDLINE" website { - main_page_suffix = "<%= ctx[:vars]['main_page_suffix'] %>" - not_found_page = "<%= ctx[:vars]['main_page_suffix'] %>" + main_page_suffix = "{{index $.Vars "main_page_suffix"}}" + not_found_page = "{{index $.Vars "main_page_suffix"}}" } } @@ -19,7 +19,7 @@ resource "google_storage_bucket_access_control" "public_rule" { # Upload a simple index.html page to the bucket resource "google_storage_bucket_object" "indexpage" { - name = "<%= ctx[:vars]['main_page_suffix'] %>" + name = "{{index $.Vars "main_page_suffix"}}" content = "Hello World!" content_type = "text/html" bucket = google_storage_bucket.static_website.id @@ -27,7 +27,7 @@ resource "google_storage_bucket_object" "indexpage" { # Upload a simple 404 / error page to the bucket resource "google_storage_bucket_object" "errorpage" { - name = "<%= ctx[:vars]['not_found_page'] %>" + name = "{{index $.Vars "not_found_page"}}" content = "404!" content_type = "text/html" bucket = google_storage_bucket.static_website.id diff --git a/mmv1/templates/terraform/examples/subnetwork_basic.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_basic.tf.tmpl index f5e224b07d2e..71c30cddc144 100644 --- a/mmv1/templates/terraform/examples/subnetwork_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.2.0.0/16" region = "us-central1" network = google_compute_network.custom-test.id @@ -10,6 +10,6 @@ resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" } resource "google_compute_network" "custom-test" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/subnetwork_cidr_overlap.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_cidr_overlap.tf.tmpl index 137f0ccc784c..030881251503 100644 --- a/mmv1/templates/terraform/examples/subnetwork_cidr_overlap.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_cidr_overlap.tf.tmpl @@ -1,7 +1,7 @@ resource "google_compute_subnetwork" "subnetwork-cidr-overlap" { provider = google-beta - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" region = "us-west2" ip_cidr_range = "192.168.1.0/24" allow_subnet_cidr_routes_overlap = true @@ -11,6 +11,6 @@ resource "google_compute_subnetwork" "subnetwork-cidr-overlap" { resource "google_compute_network" "net-cidr-overlap" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/subnetwork_internal_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_internal_ipv6.tf.tmpl index 3acfdc443d30..95515345fe5a 100644 --- a/mmv1/templates/terraform/examples/subnetwork_internal_ipv6.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_internal_ipv6.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_subnetwork" "subnetwork-internal-ipv6" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.0/22" region = "us-west2" @@ -11,7 +11,7 @@ resource "google_compute_subnetwork" "subnetwork-internal-ipv6" { } resource "google_compute_network" "custom-test" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false enable_ula_internal_ipv6 = true } diff --git a/mmv1/templates/terraform/examples/subnetwork_internal_l7lb.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_internal_l7lb.tf.tmpl index efe262037ba6..70f007bdd713 100644 --- a/mmv1/templates/terraform/examples/subnetwork_internal_l7lb.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_internal_l7lb.tf.tmpl @@ -1,7 +1,7 @@ resource "google_compute_subnetwork" "network-for-l7lb" { provider = google-beta - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.0/22" region = "us-central1" purpose = "REGIONAL_MANAGED_PROXY" @@ -12,6 +12,6 @@ resource "google_compute_subnetwork" "network-for-l7lb" { resource "google_compute_network" "custom-test" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/subnetwork_ipv6.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_ipv6.tf.tmpl index 25955e8958f4..b1a1693b9980 100644 --- a/mmv1/templates/terraform/examples/subnetwork_ipv6.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_ipv6.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_subnetwork" "subnetwork-ipv6" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.0.0.0/22" region = "us-west2" @@ -11,6 +11,6 @@ resource "google_compute_subnetwork" "subnetwork-ipv6" { } resource "google_compute_network" "custom-test" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/subnetwork_logging_config.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_logging_config.tf.tmpl index 159c6df99094..9e854573e852 100644 --- a/mmv1/templates/terraform/examples/subnetwork_logging_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_logging_config.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_subnetwork" "subnet-with-logging" { - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" ip_cidr_range = "10.2.0.0/16" region = "us-central1" network = google_compute_network.custom-test.id @@ -12,6 +12,6 @@ resource "google_compute_subnetwork" "subnet-with-logging" { } resource "google_compute_network" "custom-test" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/subnetwork_purpose_private_nat.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_purpose_private_nat.tf.tmpl index 198e86759998..7f6a49ecf5fe 100644 --- a/mmv1/templates/terraform/examples/subnetwork_purpose_private_nat.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_purpose_private_nat.tf.tmpl @@ -1,7 +1,7 @@ resource "google_compute_subnetwork" "subnetwork-purpose-private-nat" { provider = google-beta - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" region = "us-west2" ip_cidr_range = "192.168.1.0/24" purpose = "PRIVATE_NAT" @@ -11,6 +11,6 @@ resource "google_compute_subnetwork" "subnetwork-purpose-private-nat" { resource "google_compute_network" "custom-test" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/subnetwork_reserved_internal_range.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_reserved_internal_range.tf.tmpl index 7ab6053aba55..bae8ce6def55 100644 --- a/mmv1/templates/terraform/examples/subnetwork_reserved_internal_range.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_reserved_internal_range.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_subnetwork" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_subnetwork" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" region = "us-central1" network = google_compute_network.default.id reserved_internal_range = "networkconnectivity.googleapis.com/${google_network_connectivity_internal_range.reserved.id}" @@ -8,7 +8,7 @@ resource "google_compute_subnetwork" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/subnetwork_reserved_secondary_range.tf.tmpl b/mmv1/templates/terraform/examples/subnetwork_reserved_secondary_range.tf.tmpl index 7016615f74ad..612fb7dd0c4a 100644 --- a/mmv1/templates/terraform/examples/subnetwork_reserved_secondary_range.tf.tmpl +++ b/mmv1/templates/terraform/examples/subnetwork_reserved_secondary_range.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_subnetwork" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_subnetwork" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['subnetwork_name'] %>" + name = "{{index $.Vars "subnetwork_name"}}" region = "us-central1" network = google_compute_network.default.id reserved_internal_range = "networkconnectivity.googleapis.com/${google_network_connectivity_internal_range.reserved.id}" @@ -13,7 +13,7 @@ resource "google_compute_subnetwork" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } diff --git a/mmv1/templates/terraform/examples/tag_binding_basic.tf.tmpl b/mmv1/templates/terraform/examples/tag_binding_basic.tf.tmpl index 570f74c5e471..e66f8369874d 100644 --- a/mmv1/templates/terraform/examples/tag_binding_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/tag_binding_basic.tf.tmpl @@ -1,23 +1,23 @@ resource "google_project" "project" { - project_id = "<%= ctx[:vars]['project_id'] %>" - name = "<%= ctx[:vars]['project_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" + project_id = "{{index $.Vars "project_id"}}" + name = "{{index $.Vars "project_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" deletion_policy = "DELETE" } resource "google_tags_tag_key" "key" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - short_name = "<%= ctx[:vars]['key_short_name'] %>" - description = "For <%= ctx[:vars]['key_short_name'] %> resources." + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + short_name = "{{index $.Vars "key_short_name"}}" + description = "For {{index $.Vars "key_short_name"}} resources." } resource "google_tags_tag_value" "value" { parent = "tagKeys/${google_tags_tag_key.key.name}" - short_name = "<%= ctx[:vars]['value_short_name'] %>" - description = "For <%= ctx[:vars]['value_short_name'] %> resources." + short_name = "{{index $.Vars "value_short_name"}}" + description = "For {{index $.Vars "value_short_name"}} resources." } -resource "google_tags_tag_binding" "<%= ctx[:primary_resource_id] %>" { +resource "google_tags_tag_binding" "{{$.PrimaryResourceId}}" { parent = "//cloudresourcemanager.googleapis.com/projects/${google_project.project.number}" tag_value = "tagValues/${google_tags_tag_value.value.name}" } diff --git a/mmv1/templates/terraform/examples/tag_key_basic.tf.tmpl b/mmv1/templates/terraform/examples/tag_key_basic.tf.tmpl index 53b7f7dbfc05..3ddd587cdf73 100644 --- a/mmv1/templates/terraform/examples/tag_key_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/tag_key_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_tags_tag_key" "<%= ctx[:primary_resource_id] %>" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - short_name = "<%= ctx[:vars]['short_name'] %>" - description = "For <%= ctx[:vars]['short_name'] %> resources." +resource "google_tags_tag_key" "{{$.PrimaryResourceId}}" { + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + short_name = "{{index $.Vars "short_name"}}" + description = "For {{index $.Vars "short_name"}} resources." } diff --git a/mmv1/templates/terraform/examples/tag_value_basic.tf.tmpl b/mmv1/templates/terraform/examples/tag_value_basic.tf.tmpl index 869022c39b3f..f63b0d7d10cf 100644 --- a/mmv1/templates/terraform/examples/tag_value_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/tag_value_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_tags_tag_key" "key" { - parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" - short_name = "<%= ctx[:vars]['key_short_name'] %>" - description = "For <%= ctx[:vars]['key_short_name'] %> resources." + parent = "organizations/{{index $.TestEnvVars "org_id"}}" + short_name = "{{index $.Vars "key_short_name"}}" + description = "For {{index $.Vars "key_short_name"}} resources." } -resource "google_tags_tag_value" "<%= ctx[:primary_resource_id] %>" { +resource "google_tags_tag_value" "{{$.PrimaryResourceId}}" { parent = "tagKeys/${google_tags_tag_key.key.name}" - short_name = "<%= ctx[:vars]['value_short_name'] %>" - description = "For <%= ctx[:vars]['value_short_name'] %> resources." + short_name = "{{index $.Vars "value_short_name"}}" + description = "For {{index $.Vars "value_short_name"}} resources." } diff --git a/mmv1/templates/terraform/examples/target_grpc_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/target_grpc_proxy_basic.tf.tmpl index 4a1bc8552af3..900565b2a1d1 100644 --- a/mmv1/templates/terraform/examples/target_grpc_proxy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_grpc_proxy_basic.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_target_grpc_proxy" "default" { - name = "<%= ctx[:vars]['proxy_name'] %>" + name = "{{index $.Vars "proxy_name"}}" url_map = google_compute_url_map.urlmap.id validate_for_proxyless = true } resource "google_compute_url_map" "urlmap" { - name = "<%= ctx[:vars]['urlmap_name'] %>" + name = "{{index $.Vars "urlmap_name"}}" description = "a description" default_service = google_compute_backend_service.home.id host_rule { @@ -68,7 +68,7 @@ resource "google_compute_url_map" "urlmap" { } } resource "google_compute_backend_service" "home" { - name = "<%= ctx[:vars]['backend_name'] %>" + name = "{{index $.Vars "backend_name"}}" port_name = "grpc" protocol = "GRPC" timeout_sec = 10 @@ -76,7 +76,7 @@ resource "google_compute_backend_service" "home" { load_balancing_scheme = "INTERNAL_SELF_MANAGED" } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['healthcheck_name'] %>" + name = "{{index $.Vars "healthcheck_name"}}" timeout_sec = 1 check_interval_sec = 1 grpc_health_check { diff --git a/mmv1/templates/terraform/examples/target_http_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/target_http_proxy_basic.tf.tmpl index a61871f01920..dcce57816ab9 100644 --- a/mmv1/templates/terraform/examples/target_http_proxy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_http_proxy_basic.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_compute_target_http_proxy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target_http_proxy_name'] %>" +resource "google_compute_target_http_proxy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target_http_proxy_name"}}" url_map = google_compute_url_map.default.id } resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" default_service = google_compute_backend_service.default.id host_rule { @@ -24,7 +24,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -33,7 +33,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/target_http_proxy_http_keep_alive_timeout.tf.tmpl b/mmv1/templates/terraform/examples/target_http_proxy_http_keep_alive_timeout.tf.tmpl index f4d1ea5cfb08..9927dcd35ffb 100644 --- a/mmv1/templates/terraform/examples/target_http_proxy_http_keep_alive_timeout.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_http_proxy_http_keep_alive_timeout.tf.tmpl @@ -1,11 +1,11 @@ -resource "google_compute_target_http_proxy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target_http_proxy_name'] %>" +resource "google_compute_target_http_proxy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target_http_proxy_name"}}" http_keep_alive_timeout_sec = 610 url_map = google_compute_url_map.default.id } resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" default_service = google_compute_backend_service.default.id host_rule { @@ -25,7 +25,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -35,7 +35,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/target_http_proxy_https_redirect.tf.tmpl b/mmv1/templates/terraform/examples/target_http_proxy_https_redirect.tf.tmpl index a23beb01b55a..9b25f866cf5d 100644 --- a/mmv1/templates/terraform/examples/target_http_proxy_https_redirect.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_http_proxy_https_redirect.tf.tmpl @@ -1,10 +1,10 @@ -resource "google_compute_target_http_proxy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target_http_proxy_name'] %>" +resource "google_compute_target_http_proxy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target_http_proxy_name"}}" url_map = google_compute_url_map.default.id } resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" default_url_redirect { https_redirect = true strip_query = false diff --git a/mmv1/templates/terraform/examples/target_https_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/target_https_proxy_basic.tf.tmpl index e6481bb07bff..087268c78f28 100644 --- a/mmv1/templates/terraform/examples/target_https_proxy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_https_proxy_basic.tf.tmpl @@ -1,17 +1,17 @@ -resource "google_compute_target_https_proxy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target_https_proxy_name'] %>" +resource "google_compute_target_https_proxy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target_https_proxy_name"}}" url_map = google_compute_url_map.default.id ssl_certificates = [google_compute_ssl_certificate.default.id] } resource "google_compute_ssl_certificate" "default" { - name = "<%= ctx[:vars]['ssl_certificate_name'] %>" + name = "{{index $.Vars "ssl_certificate_name"}}" private_key = file("path/to/private.key") certificate = file("path/to/certificate.crt") } resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -33,7 +33,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -42,7 +42,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/target_https_proxy_certificate_manager_certificate.tf.tmpl b/mmv1/templates/terraform/examples/target_https_proxy_certificate_manager_certificate.tf.tmpl index 32856ea91677..42dc269039bc 100644 --- a/mmv1/templates/terraform/examples/target_https_proxy_certificate_manager_certificate.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_https_proxy_certificate_manager_certificate.tf.tmpl @@ -1,12 +1,12 @@ -resource "google_compute_target_https_proxy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target_https_proxy_name'] %>" +resource "google_compute_target_https_proxy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target_https_proxy_name"}}" url_map = google_compute_url_map.default.id certificate_manager_certificates = ["//certificatemanager.googleapis.com/${google_certificate_manager_certificate.default.id}"] # [google_certificate_manager_certificate.default.id] is also acceptable } resource "google_certificate_manager_certificate" "default" { - name = "<%= ctx[:vars]['certificate_manager_certificate_name'] %>" + name = "{{index $.Vars "certificate_manager_certificate_name"}}" scope = "ALL_REGIONS" self_managed { pem_certificate = file("test-fixtures/cert.pem") @@ -15,7 +15,7 @@ resource "google_certificate_manager_certificate" "default" { } resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -37,7 +37,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 diff --git a/mmv1/templates/terraform/examples/target_https_proxy_http_keep_alive_timeout.tf.tmpl b/mmv1/templates/terraform/examples/target_https_proxy_http_keep_alive_timeout.tf.tmpl index f4afae77e3b9..075c573196f7 100644 --- a/mmv1/templates/terraform/examples/target_https_proxy_http_keep_alive_timeout.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_https_proxy_http_keep_alive_timeout.tf.tmpl @@ -1,18 +1,18 @@ -resource "google_compute_target_https_proxy" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target_https_proxy_name'] %>" +resource "google_compute_target_https_proxy" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target_https_proxy_name"}}" http_keep_alive_timeout_sec = 610 url_map = google_compute_url_map.default.id ssl_certificates = [google_compute_ssl_certificate.default.id] } resource "google_compute_ssl_certificate" "default" { - name = "<%= ctx[:vars]['ssl_certificate_name'] %>" + name = "{{index $.Vars "ssl_certificate_name"}}" private_key = file("path/to/private.key") certificate = file("path/to/certificate.crt") } resource "google_compute_url_map" "default" { - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -34,7 +34,7 @@ resource "google_compute_url_map" "default" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -44,7 +44,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/target_https_proxy_mtls.tf.tmpl b/mmv1/templates/terraform/examples/target_https_proxy_mtls.tf.tmpl index 62ec99bc0832..11c28dfea258 100644 --- a/mmv1/templates/terraform/examples/target_https_proxy_mtls.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_https_proxy_mtls.tf.tmpl @@ -2,9 +2,9 @@ data "google_project" "project" { provider = google-beta } -resource "google_compute_target_https_proxy" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_target_https_proxy" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['target_https_proxy_name'] %>" + name = "{{index $.Vars "target_https_proxy_name"}}" url_map = google_compute_url_map.default.id ssl_certificates = [google_compute_ssl_certificate.default.id] server_tls_policy = google_network_security_server_tls_policy.default.id @@ -12,7 +12,7 @@ resource "google_compute_target_https_proxy" "<%= ctx[:primary_resource_id] %>" resource "google_certificate_manager_trust_config" "default" { provider = google-beta - name = "<%= ctx[:vars]["trust_config_name"] %>" + name = "{{index $.Vars "trust_config_name"}}" description = "sample description for the trust config" location = "global" @@ -32,7 +32,7 @@ resource "google_certificate_manager_trust_config" "default" { resource "google_network_security_server_tls_policy" "default" { provider = google-beta - name = "<%= ctx[:vars]['server_tls_policy_name'] %>" + name = "{{index $.Vars "server_tls_policy_name"}}" description = "my description" location = "global" allow_open = "false" @@ -44,14 +44,14 @@ resource "google_network_security_server_tls_policy" "default" { resource "google_compute_ssl_certificate" "default" { provider = google-beta - name = "<%= ctx[:vars]['ssl_certificate_name'] %>" + name = "{{index $.Vars "ssl_certificate_name"}}" private_key = file("path/to/private.key") certificate = file("path/to/certificate.crt") } resource "google_compute_url_map" "default" { provider = google-beta - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.default.id @@ -74,7 +74,7 @@ resource "google_compute_url_map" "default" { resource "google_compute_backend_service" "default" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -84,7 +84,7 @@ resource "google_compute_backend_service" "default" { resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/target_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/target_instance_basic.tf.tmpl index 21993487776b..cbda03e1386b 100644 --- a/mmv1/templates/terraform/examples/target_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_instance_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_target_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['target_name'] %>" +resource "google_compute_target_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "target_name"}}" instance = google_compute_instance.target-vm.id } @@ -9,7 +9,7 @@ data "google_compute_image" "vmimage" { } resource "google_compute_instance" "target-vm" { - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" zone = "us-central1-a" diff --git a/mmv1/templates/terraform/examples/target_instance_custom_network.tf.tmpl b/mmv1/templates/terraform/examples/target_instance_custom_network.tf.tmpl index f84dd6007ac6..41d29bc7246a 100644 --- a/mmv1/templates/terraform/examples/target_instance_custom_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_instance_custom_network.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_target_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_target_instance" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['target_name'] %>" + name = "{{index $.Vars "target_name"}}" instance = google_compute_instance.target-vm.id network = data.google_compute_network.target-vm.self_link } @@ -18,7 +18,7 @@ data "google_compute_image" "vmimage" { resource "google_compute_instance" "target-vm" { provider = google-beta - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" zone = "us-central1-a" diff --git a/mmv1/templates/terraform/examples/target_instance_with_security_policy.tf.tmpl b/mmv1/templates/terraform/examples/target_instance_with_security_policy.tf.tmpl index f3ab7b16471b..ae5720d9b0c1 100644 --- a/mmv1/templates/terraform/examples/target_instance_with_security_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_instance_with_security_policy.tf.tmpl @@ -1,13 +1,13 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false routing_mode = "REGIONAL" } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['subnetname_name'] %>" + name = "{{index $.Vars "subnetname_name"}}" ip_cidr_range = "10.1.2.0/24" network = google_compute_network.default.id private_ipv6_google_access = "DISABLE_GOOGLE_ACCESS" @@ -24,7 +24,7 @@ data "google_compute_image" "vmimage" { resource "google_compute_instance" "target-vm" { provider = google-beta - name = "<%= ctx[:vars]['instance_name'] %>" + name = "{{index $.Vars "instance_name"}}" machine_type = "e2-medium" zone = "southamerica-west1-a" @@ -62,16 +62,16 @@ resource "google_compute_network_edge_security_service" "edge_sec_service" { resource "google_compute_region_security_policy" "regionsecuritypolicy" { provider = google-beta - name = "<%= ctx[:vars]['region_sec_policy'] %>" + name = "{{index $.Vars "region_sec_policy"}}" region = "southamerica-west1" description = "basic security policy for target instance" type = "CLOUD_ARMOR_NETWORK" depends_on = [google_compute_network_edge_security_service.edge_sec_service] } -resource "google_compute_target_instance" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_target_instance" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['target_name'] %>" + name = "{{index $.Vars "target_name"}}" zone = "southamerica-west1-a" instance = google_compute_instance.target-vm.id security_policy = google_compute_region_security_policy.regionsecuritypolicy.self_link diff --git a/mmv1/templates/terraform/examples/target_ssl_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/target_ssl_proxy_basic.tf.tmpl index 8bbfcf259643..7533c8ab2c1a 100644 --- a/mmv1/templates/terraform/examples/target_ssl_proxy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_ssl_proxy_basic.tf.tmpl @@ -1,23 +1,23 @@ resource "google_compute_target_ssl_proxy" "default" { - name = "<%= ctx[:vars]['target_ssl_proxy_name'] %>" + name = "{{index $.Vars "target_ssl_proxy_name"}}" backend_service = google_compute_backend_service.default.id ssl_certificates = [google_compute_ssl_certificate.default.id] } resource "google_compute_ssl_certificate" "default" { - name = "<%= ctx[:vars]['ssl_certificate_name'] %>" + name = "{{index $.Vars "ssl_certificate_name"}}" private_key = file("path/to/private.key") certificate = file("path/to/certificate.crt") } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" protocol = "SSL" health_checks = [google_compute_health_check.default.id] } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" check_interval_sec = 1 timeout_sec = 1 tcp_health_check { diff --git a/mmv1/templates/terraform/examples/target_tcp_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/target_tcp_proxy_basic.tf.tmpl index 69ad592fdeb0..ebd96724985b 100644 --- a/mmv1/templates/terraform/examples/target_tcp_proxy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_tcp_proxy_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_compute_target_tcp_proxy" "default" { - name = "<%= ctx[:vars]['target_tcp_proxy_name'] %>" + name = "{{index $.Vars "target_tcp_proxy_name"}}" backend_service = google_compute_backend_service.default.id } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" protocol = "TCP" timeout_sec = 10 @@ -12,7 +12,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" timeout_sec = 1 check_interval_sec = 1 diff --git a/mmv1/templates/terraform/examples/target_vpn_gateway_basic.tf.tmpl b/mmv1/templates/terraform/examples/target_vpn_gateway_basic.tf.tmpl index 0b57481df59d..82f4900ec891 100644 --- a/mmv1/templates/terraform/examples/target_vpn_gateway_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/target_vpn_gateway_basic.tf.tmpl @@ -1,25 +1,25 @@ resource "google_compute_vpn_gateway" "target_gateway" { - name = "<%= ctx[:vars]['target_vpn_gateway_name'] %>" + name = "{{index $.Vars "target_vpn_gateway_name"}}" network = google_compute_network.network1.id } resource "google_compute_network" "network1" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_address" "vpn_static_ip" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" } resource "google_compute_forwarding_rule" "fr_esp" { - name = "<%= ctx[:vars]['esp_forwarding_rule_name'] %>" + name = "{{index $.Vars "esp_forwarding_rule_name"}}" ip_protocol = "ESP" ip_address = google_compute_address.vpn_static_ip.address target = google_compute_vpn_gateway.target_gateway.id } resource "google_compute_forwarding_rule" "fr_udp500" { - name = "<%= ctx[:vars]['udp500_forwarding_rule_name'] %>" + name = "{{index $.Vars "udp500_forwarding_rule_name"}}" ip_protocol = "UDP" port_range = "500" ip_address = google_compute_address.vpn_static_ip.address @@ -27,7 +27,7 @@ resource "google_compute_forwarding_rule" "fr_udp500" { } resource "google_compute_forwarding_rule" "fr_udp4500" { - name = "<%= ctx[:vars]['udp4500_forwarding_rule_name'] %>" + name = "{{index $.Vars "udp4500_forwarding_rule_name"}}" ip_protocol = "UDP" port_range = "4500" ip_address = google_compute_address.vpn_static_ip.address @@ -35,7 +35,7 @@ resource "google_compute_forwarding_rule" "fr_udp4500" { } resource "google_compute_vpn_tunnel" "tunnel1" { - name = "<%= ctx[:vars]['vpn_tunnel_name'] %>" + name = "{{index $.Vars "vpn_tunnel_name"}}" peer_ip = "15.0.0.120" shared_secret = "a secret message" @@ -49,7 +49,7 @@ resource "google_compute_vpn_tunnel" "tunnel1" { } resource "google_compute_route" "route1" { - name = "<%= ctx[:vars]['route_name'] %>" + name = "{{index $.Vars "route_name"}}" network = google_compute_network.network1.name dest_range = "15.0.0.0/24" priority = 1000 diff --git a/mmv1/templates/terraform/examples/tpu_node_basic.tf.tmpl b/mmv1/templates/terraform/examples/tpu_node_basic.tf.tmpl index 90701ef38ee5..9f516fd9ad65 100644 --- a/mmv1/templates/terraform/examples/tpu_node_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/tpu_node_basic.tf.tmpl @@ -1,14 +1,12 @@ -<%#- - WARNING: cidr_block must not overlap with other existing TPU blocks +{{/* WARNING: cidr_block must not overlap with other existing TPU blocks Make sure if you change this value that it does not overlap with the - autogenerated examples. --%> + autogenerated examples. */ -}} data "google_tpu_tensorflow_versions" "available" { } -resource "google_tpu_node" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["node_name"] %>" +resource "google_tpu_node" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "node_name"}}" zone = "us-central1-b" accelerator_type = "v3-8" diff --git a/mmv1/templates/terraform/examples/tpu_node_full.tf.tmpl b/mmv1/templates/terraform/examples/tpu_node_full.tf.tmpl index 2ae3e8a2a597..af0c39fd7ef5 100644 --- a/mmv1/templates/terraform/examples/tpu_node_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/tpu_node_full.tf.tmpl @@ -1,14 +1,12 @@ data "google_tpu_tensorflow_versions" "available" { } -<%#- - WARNING: cidr_block must not overlap with other existing TPU blocks +{{/* WARNING: cidr_block must not overlap with other existing TPU blocks Make sure if you change this value that it does not overlap with the - autogenerated examples. --%> + autogenerated examples. */ -}} -resource "google_tpu_node" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["node_name"] %>" +resource "google_tpu_node" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "node_name"}}" zone = "us-central1-b" accelerator_type = "v3-8" @@ -17,12 +15,10 @@ resource "google_tpu_node" "<%= ctx[:primary_resource_id] %>" { description = "Terraform Google Provider test TPU" use_service_networking = true -<%#- - We previously used a separate network resource here, but TPUs only allow using 50 +{{/* We previously used a separate network resource here, but TPUs only allow using 50 different network names, ever. This caused our tests to start failing, so just use the default network in order to still demonstrate using as many fields as - possible on the resource. --%> + possible on the resource. */ -}} network = google_service_networking_connection.private_service_connection.network @@ -36,11 +32,11 @@ resource "google_tpu_node" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_global_address" "service_range" { - name = "<%= ctx[:vars]['global_address_name'] %>" + name = "{{index $.Vars "global_address_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 diff --git a/mmv1/templates/terraform/examples/tpu_node_full_test.tf.tmpl b/mmv1/templates/terraform/examples/tpu_node_full_test.tf.tmpl index 8ed22bd87a51..01ce73d6c2cf 100644 --- a/mmv1/templates/terraform/examples/tpu_node_full_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/tpu_node_full_test.tf.tmpl @@ -1,11 +1,9 @@ -<%#- - WARNING: cidr_block must not overlap with other existing TPU blocks +{{/* WARNING: cidr_block must not overlap with other existing TPU blocks Make sure if you change this value that it does not overlap with the - autogenerated examples. --%> + autogenerated examples. */ -}} -resource "google_tpu_node" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]["node_name"] %>" +resource "google_tpu_node" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "node_name"}}" zone = "us-central1-b" accelerator_type = "v3-8" @@ -27,5 +25,5 @@ resource "google_tpu_node" "<%= ctx[:primary_resource_id] %>" { } data "google_compute_network" "network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/tpu_v2_vm_basic.tf.tmpl b/mmv1/templates/terraform/examples/tpu_v2_vm_basic.tf.tmpl index 9888f0e30cbb..adc56de842de 100644 --- a/mmv1/templates/terraform/examples/tpu_v2_vm_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/tpu_v2_vm_basic.tf.tmpl @@ -2,10 +2,10 @@ data "google_tpu_v2_runtime_versions" "available" { provider = google-beta } -resource "google_tpu_v2_vm" "<%= ctx[:primary_resource_id] %>" { +resource "google_tpu_v2_vm" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]["vm_name"] %>" + name = "{{index $.Vars "vm_name"}}" zone = "us-central1-c" runtime_version = "tpu-vm-tf-2.13.0" diff --git a/mmv1/templates/terraform/examples/tpu_v2_vm_full.tf.tmpl b/mmv1/templates/terraform/examples/tpu_v2_vm_full.tf.tmpl index 2e5fe2a82689..f42f025d71b5 100644 --- a/mmv1/templates/terraform/examples/tpu_v2_vm_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/tpu_v2_vm_full.tf.tmpl @@ -6,10 +6,10 @@ data "google_tpu_v2_accelerator_types" "available" { provider = google-beta } -resource "google_tpu_v2_vm" "<%= ctx[:primary_resource_id] %>" { +resource "google_tpu_v2_vm" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]["vm_name"] %>" + name = "{{index $.Vars "vm_name"}}" zone = "us-central1-c" description = "Text description of the TPU." @@ -65,7 +65,7 @@ resource "google_tpu_v2_vm" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_subnetwork" "subnet" { provider = google-beta - name = "<%= ctx[:vars]['subnet_name'] %>" + name = "{{index $.Vars "subnet_name"}}" ip_cidr_range = "10.0.0.0/16" region = "us-central1" network = google_compute_network.network.id @@ -74,21 +74,21 @@ resource "google_compute_subnetwork" "subnet" { resource "google_compute_network" "network" { provider = google-beta - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_service_account" "sa" { provider = google-beta - account_id = "<%= ctx[:vars]['sa_id'] %>" + account_id = "{{index $.Vars "sa_id"}}" display_name = "Test TPU VM" } resource "google_compute_disk" "disk" { provider = google-beta - name = "<%= ctx[:vars]['disk_name'] %>" + name = "{{index $.Vars "disk_name"}}" image = "debian-cloud/debian-11" size = 10 type = "pd-ssd" diff --git a/mmv1/templates/terraform/examples/uptime_check_config_http.tf.tmpl b/mmv1/templates/terraform/examples/uptime_check_config_http.tf.tmpl index 3d13d3ab99f5..14aa4ae4dea8 100644 --- a/mmv1/templates/terraform/examples/uptime_check_config_http.tf.tmpl +++ b/mmv1/templates/terraform/examples/uptime_check_config_http.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["display_name"] %>" +resource "google_monitoring_uptime_check_config" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" timeout = "60s" user_labels = { example-key = "example-value" @@ -20,7 +20,7 @@ resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] monitored_resource { type = "uptime_url" labels = { - project_id = "<%= ctx[:test_env_vars]["project_id"] %>" + project_id = "{{index $.TestEnvVars "project_id"}}" host = "192.168.1.1" } } diff --git a/mmv1/templates/terraform/examples/uptime_check_config_https.tf.tmpl b/mmv1/templates/terraform/examples/uptime_check_config_https.tf.tmpl index 96dd14266bc5..76468c0f860d 100644 --- a/mmv1/templates/terraform/examples/uptime_check_config_https.tf.tmpl +++ b/mmv1/templates/terraform/examples/uptime_check_config_https.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["display_name"] %>" +resource "google_monitoring_uptime_check_config" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" timeout = "60s" http_check { @@ -15,7 +15,7 @@ resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] monitored_resource { type = "uptime_url" labels = { - project_id = "<%= ctx[:test_env_vars]["project_id"] %>" + project_id = "{{index $.TestEnvVars "project_id"}}" host = "192.168.1.1" } } diff --git a/mmv1/templates/terraform/examples/uptime_check_config_status_code.tf.tmpl b/mmv1/templates/terraform/examples/uptime_check_config_status_code.tf.tmpl index 05d2e1660808..3c9a21cfc5b2 100644 --- a/mmv1/templates/terraform/examples/uptime_check_config_status_code.tf.tmpl +++ b/mmv1/templates/terraform/examples/uptime_check_config_status_code.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["display_name"] %>" +resource "google_monitoring_uptime_check_config" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" timeout = "60s" http_check { @@ -23,7 +23,7 @@ resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] monitored_resource { type = "uptime_url" labels = { - project_id = "<%= ctx[:test_env_vars]["project_id"] %>" + project_id = "{{index $.TestEnvVars "project_id"}}" host = "192.168.1.1" } } diff --git a/mmv1/templates/terraform/examples/uptime_check_config_synthetic_monitor.tf.tmpl b/mmv1/templates/terraform/examples/uptime_check_config_synthetic_monitor.tf.tmpl index 98b73b74d8c8..87b1f6703314 100644 --- a/mmv1/templates/terraform/examples/uptime_check_config_synthetic_monitor.tf.tmpl +++ b/mmv1/templates/terraform/examples/uptime_check_config_synthetic_monitor.tf.tmpl @@ -1,5 +1,5 @@ resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:test_env_vars]["project_id"] %>-<%= ctx[:vars]['bucket_name'] %>" # Every bucket name must be globally unique + name = "{{index $.TestEnvVars "project_id"}}-{{index $.Vars "bucket_name"}}" # Every bucket name must be globally unique location = "US" uniform_bucket_level_access = true } @@ -7,11 +7,11 @@ resource "google_storage_bucket" "bucket" { resource "google_storage_bucket_object" "object" { name = "function-source.zip" bucket = google_storage_bucket.bucket.name - source = "<%= ctx[:vars]['zip_path'] %>" # Add path to the zipped function source code + source = "{{index $.Vars "zip_path"}}" # Add path to the zipped function source code } resource "google_cloudfunctions2_function" "function" { - name = "<%= ctx[:vars]['function_name'] %>" + name = "{{index $.Vars "function_name"}}" location = "us-central1" build_config { @@ -32,8 +32,8 @@ resource "google_cloudfunctions2_function" "function" { } } -resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["display_name"] %>" +resource "google_monitoring_uptime_check_config" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" timeout = "60s" synthetic_monitor { diff --git a/mmv1/templates/terraform/examples/uptime_check_tcp.tf.tmpl b/mmv1/templates/terraform/examples/uptime_check_tcp.tf.tmpl index 46e4e78374b1..d96e816a9b84 100644 --- a/mmv1/templates/terraform/examples/uptime_check_tcp.tf.tmpl +++ b/mmv1/templates/terraform/examples/uptime_check_tcp.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]["display_name"] %>" +resource "google_monitoring_uptime_check_config" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" timeout = "60s" tcp_check { @@ -16,6 +16,6 @@ resource "google_monitoring_uptime_check_config" "<%= ctx[:primary_resource_id] } resource "google_monitoring_group" "check" { - display_name = "<%= ctx[:vars]["group_display_name"] %>" + display_name = "{{index $.Vars "group_display_name"}}" filter = "resource.metadata.name=has_substring(\"foo\")" } diff --git a/mmv1/templates/terraform/examples/url_map_bucket_and_service.tf.tmpl b/mmv1/templates/terraform/examples/url_map_bucket_and_service.tf.tmpl index d6aeb563f47b..42c461403bf6 100644 --- a/mmv1/templates/terraform/examples/url_map_bucket_and_service.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_bucket_and_service.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['url_map_name'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_bucket.static.id @@ -47,7 +47,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_backend_service" "login" { - name = "<%= ctx[:vars]['login_backend_service_name'] %>" + name = "{{index $.Vars "login_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -56,19 +56,19 @@ resource "google_compute_backend_service" "login" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } resource "google_compute_backend_bucket" "static" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" + name = "{{index $.Vars "backend_bucket_name"}}" bucket_name = google_storage_bucket.static.name enable_cdn = true } resource "google_storage_bucket" "static" { - name = "<%= ctx[:vars]['storage_bucket_name'] %>" + name = "{{index $.Vars "storage_bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/url_map_custom_error_response_policy.tf.tmpl b/mmv1/templates/terraform/examples/url_map_custom_error_response_policy.tf.tmpl index 32c94d52e68d..6b3a72411f47 100644 --- a/mmv1/templates/terraform/examples/url_map_custom_error_response_policy.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_custom_error_response_policy.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['url_map_name'] %>" + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.example.id @@ -55,7 +55,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { resource "google_compute_backend_service" "example" { provider = google-beta - name = "<%= ctx[:vars]['backend_service_name'] %>" + name = "{{index $.Vars "backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -66,7 +66,7 @@ resource "google_compute_backend_service" "example" { resource "google_compute_http_health_check" "default" { provider = google-beta - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 @@ -74,13 +74,13 @@ resource "google_compute_http_health_check" "default" { resource "google_compute_backend_bucket" "error" { provider = google-beta - name = "<%= ctx[:vars]['error_backend_bucket_name'] %>" + name = "{{index $.Vars "error_backend_bucket_name"}}" bucket_name = google_storage_bucket.error.name enable_cdn = true } resource "google_storage_bucket" "error" { provider = google-beta - name = "<%= ctx[:vars]['storage_bucket_name'] %>" + name = "{{index $.Vars "storage_bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/url_map_header_based_routing.tf.tmpl b/mmv1/templates/terraform/examples/url_map_header_based_routing.tf.tmpl index eea9d8b7e2f6..7d58d12765c4 100644 --- a/mmv1/templates/terraform/examples/url_map_header_based_routing.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_header_based_routing.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['url_map_name'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "url_map_name"}}" description = "header-based routing example" default_service = google_compute_backend_service.default.id @@ -40,7 +40,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['default_backend_service_name'] %>" + name = "{{index $.Vars "default_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -49,7 +49,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_backend_service" "service-a" { - name = "<%= ctx[:vars]['service_a_backend_service_name'] %>" + name = "{{index $.Vars "service_a_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -58,7 +58,7 @@ resource "google_compute_backend_service" "service-a" { } resource "google_compute_backend_service" "service-b" { - name = "<%= ctx[:vars]['service_b_backend_service_name'] %>" + name = "{{index $.Vars "service_b_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -67,7 +67,7 @@ resource "google_compute_backend_service" "service-b" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/url_map_parameter_based_routing.tf.tmpl b/mmv1/templates/terraform/examples/url_map_parameter_based_routing.tf.tmpl index ee88140a1561..5b9994af38f9 100644 --- a/mmv1/templates/terraform/examples/url_map_parameter_based_routing.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_parameter_based_routing.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['url_map_name'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "url_map_name"}}" description = "parameter-based routing example" default_service = google_compute_backend_service.default.id @@ -40,7 +40,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_backend_service" "default" { - name = "<%= ctx[:vars]['default_backend_service_name'] %>" + name = "{{index $.Vars "default_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -49,7 +49,7 @@ resource "google_compute_backend_service" "default" { } resource "google_compute_backend_service" "service-a" { - name = "<%= ctx[:vars]['service_a_backend_service_name'] %>" + name = "{{index $.Vars "service_a_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -58,7 +58,7 @@ resource "google_compute_backend_service" "service-a" { } resource "google_compute_backend_service" "service-b" { - name = "<%= ctx[:vars]['service_b_backend_service_name'] %>" + name = "{{index $.Vars "service_b_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -67,7 +67,7 @@ resource "google_compute_backend_service" "service-b" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 diff --git a/mmv1/templates/terraform/examples/url_map_path_template_match.tf.tmpl b/mmv1/templates/terraform/examples/url_map_path_template_match.tf.tmpl index 612f669aaae4..74fd0795d039 100644 --- a/mmv1/templates/terraform/examples/url_map_path_template_match.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_path_template_match.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['url_map_name'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_bucket.static.id @@ -37,7 +37,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_backend_service" "cart-backend" { - name = "<%= ctx[:vars]['cart_backend_service_name'] %>" + name = "{{index $.Vars "cart_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -47,7 +47,7 @@ resource "google_compute_backend_service" "cart-backend" { } resource "google_compute_backend_service" "user-backend" { - name = "<%= ctx[:vars]['user_backend_service_name'] %>" + name = "{{index $.Vars "user_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -57,19 +57,19 @@ resource "google_compute_backend_service" "user-backend" { } resource "google_compute_http_health_check" "default" { - name = "<%= ctx[:vars]['http_health_check_name'] %>" + name = "{{index $.Vars "http_health_check_name"}}" request_path = "/" check_interval_sec = 1 timeout_sec = 1 } resource "google_compute_backend_bucket" "static" { - name = "<%= ctx[:vars]['backend_bucket_name'] %>" + name = "{{index $.Vars "backend_bucket_name"}}" bucket_name = google_storage_bucket.static.name enable_cdn = true } resource "google_storage_bucket" "static" { - name = "<%= ctx[:vars]['storage_bucket_name'] %>" + name = "{{index $.Vars "storage_bucket_name"}}" location = "US" } diff --git a/mmv1/templates/terraform/examples/url_map_traffic_director_path.tf.tmpl b/mmv1/templates/terraform/examples/url_map_traffic_director_path.tf.tmpl index 71a326b5614b..f401ca61a072 100644 --- a/mmv1/templates/terraform/examples/url_map_traffic_director_path.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_traffic_director_path.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['url_map_name'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.home.id @@ -86,7 +86,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_backend_service" "home" { - name = "<%= ctx[:vars]['home_backend_service_name'] %>" + name = "{{index $.Vars "home_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -96,7 +96,7 @@ resource "google_compute_backend_service" "home" { } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/url_map_traffic_director_path_partial.tf.tmpl b/mmv1/templates/terraform/examples/url_map_traffic_director_path_partial.tf.tmpl index aea9bc2f8333..b35f1cca09fd 100644 --- a/mmv1/templates/terraform/examples/url_map_traffic_director_path_partial.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_traffic_director_path_partial.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['url_map_name'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.home.id @@ -55,7 +55,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_backend_service" "home" { - name = "<%= ctx[:vars]['home_backend_service_name'] %>" + name = "{{index $.Vars "home_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -65,7 +65,7 @@ resource "google_compute_backend_service" "home" { } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/url_map_traffic_director_route.tf.tmpl b/mmv1/templates/terraform/examples/url_map_traffic_director_route.tf.tmpl index e959621a45e1..9f75e5b169de 100644 --- a/mmv1/templates/terraform/examples/url_map_traffic_director_route.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_traffic_director_route.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['url_map_name'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.home.id @@ -66,7 +66,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_backend_service" "home" { - name = "<%= ctx[:vars]['home_backend_service_name'] %>" + name = "{{index $.Vars "home_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -76,7 +76,7 @@ resource "google_compute_backend_service" "home" { } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/url_map_traffic_director_route_partial.tf.tmpl b/mmv1/templates/terraform/examples/url_map_traffic_director_route_partial.tf.tmpl index c0c8777ee9f6..1d1ea0c74ffd 100644 --- a/mmv1/templates/terraform/examples/url_map_traffic_director_route_partial.tf.tmpl +++ b/mmv1/templates/terraform/examples/url_map_traffic_director_route_partial.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['url_map_name'] %>" +resource "google_compute_url_map" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "url_map_name"}}" description = "a description" default_service = google_compute_backend_service.home.id @@ -37,7 +37,7 @@ resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { } resource "google_compute_backend_service" "home" { - name = "<%= ctx[:vars]['home_backend_service_name'] %>" + name = "{{index $.Vars "home_backend_service_name"}}" port_name = "http" protocol = "HTTP" timeout_sec = 10 @@ -47,7 +47,7 @@ resource "google_compute_backend_service" "home" { } resource "google_compute_health_check" "default" { - name = "<%= ctx[:vars]['health_check_name'] %>" + name = "{{index $.Vars "health_check_name"}}" http_health_check { port = 80 } diff --git a/mmv1/templates/terraform/examples/vertex_ai_dataset.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_dataset.tf.tmpl index 17b7440b4288..04704bc3c682 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_dataset.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_dataset.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vertex_ai_dataset" "dataset" { - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" metadata_schema_uri = "gs://google-cloud-aiplatform/schema/dataset/metadata/image_1.0.0.yaml" region = "us-central1" diff --git a/mmv1/templates/terraform/examples/vertex_ai_deployment_resource_pool.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_deployment_resource_pool.tf.tmpl index 2d98269c69f2..7fc79e48fb8c 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_deployment_resource_pool.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_deployment_resource_pool.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_vertex_ai_deployment_resource_pool" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_deployment_resource_pool" "{{$.PrimaryResourceId}}" { region = "us-central1" - name = "<%= ctx[:vars]['deployment_resource_pool_id'] %>" + name = "{{index $.Vars "deployment_resource_pool_id"}}" dedicated_resources { machine_spec { machine_type = "n1-standard-4" diff --git a/mmv1/templates/terraform/examples/vertex_ai_endpoint_network.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_endpoint_network.tf.tmpl index 752c25264502..2f380f11cc81 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_endpoint_network.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_endpoint_network.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_vertex_ai_endpoint" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['endpoint_name'] %>" +resource "google_vertex_ai_endpoint" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "endpoint_name"}}" display_name = "sample-endpoint" description = "A sample vertex endpoint" location = "us-central1" @@ -9,7 +9,7 @@ resource "google_vertex_ai_endpoint" "<%= ctx[:primary_resource_id] %>" { } network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.vertex_network.name}" encryption_spec { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } depends_on = [ google_service_networking_connection.vertex_vpc_connection @@ -23,7 +23,7 @@ resource "google_service_networking_connection" "vertex_vpc_connection" { } resource "google_compute_global_address" "vertex_range" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 24 @@ -31,11 +31,11 @@ resource "google_compute_global_address" "vertex_range" { } resource "google_compute_network" "vertex_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-aiplatform.iam.gserviceaccount.com" } diff --git a/mmv1/templates/terraform/examples/vertex_ai_feature_group.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_feature_group.tf.tmpl index 8bab10127d28..09b281489881 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_feature_group.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_feature_group.tf.tmpl @@ -1,5 +1,5 @@ - resource "google_vertex_ai_feature_group" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['feature_group_name'] %>" + resource "google_vertex_ai_feature_group" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "feature_group_name"}}" description = "A sample feature group" region = "us-central1" labels = { @@ -15,7 +15,7 @@ } resource "google_bigquery_dataset" "sample_dataset" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" @@ -24,7 +24,7 @@ resource "google_bigquery_dataset" "sample_dataset" { resource "google_bigquery_table" "sample_table" { deletion_protection = false dataset_id = google_bigquery_dataset.sample_dataset.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" schema = <" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vertex_ai_feature_group_feature" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" region = "us-central1" feature_group = google_vertex_ai_feature_group.sample_feature_group.name description = "A sample feature" @@ -10,7 +10,7 @@ resource "google_vertex_ai_feature_group_feature" "<%= ctx[:primary_resource_id] resource "google_vertex_ai_feature_group" "sample_feature_group" { - name = "<%= ctx[:vars]['feature_group_name'] %>" + name = "{{index $.Vars "feature_group_name"}}" description = "A sample feature group" region = "us-central1" labels = { @@ -26,7 +26,7 @@ resource "google_vertex_ai_feature_group" "sample_feature_group" { } resource "google_bigquery_dataset" "sample_dataset" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" @@ -35,7 +35,7 @@ resource "google_bigquery_dataset" "sample_dataset" { resource "google_bigquery_table" "sample_table" { deletion_protection = false dataset_id = google_bigquery_dataset.sample_dataset.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" schema = <", + "name": "{{index $.Vars "name"}}", "type": "STRING", "mode": "NULLABLE" }, diff --git a/mmv1/templates/terraform/examples/vertex_ai_feature_group_feature_with_version_column_name.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_feature_group_feature_with_version_column_name.tf.tmpl index e3976c8db777..a743d6b1f1f6 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_feature_group_feature_with_version_column_name.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_feature_group_feature_with_version_column_name.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_vertex_ai_feature_group_feature" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vertex_ai_feature_group_feature" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" region = "us-central1" feature_group = google_vertex_ai_feature_group.sample_feature_group.name description = "A sample feature" @@ -11,7 +11,7 @@ resource "google_vertex_ai_feature_group_feature" "<%= ctx[:primary_resource_id] resource "google_vertex_ai_feature_group" "sample_feature_group" { - name = "<%= ctx[:vars]['feature_group_name'] %>" + name = "{{index $.Vars "feature_group_name"}}" description = "A sample feature group" region = "us-central1" labels = { @@ -27,7 +27,7 @@ resource "google_vertex_ai_feature_group" "sample_feature_group" { } resource "google_bigquery_dataset" "sample_dataset" { - dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + dataset_id = "{{index $.Vars "job_id"}}_dataset" friendly_name = "test" description = "This is a test description" location = "US" @@ -36,7 +36,7 @@ resource "google_bigquery_dataset" "sample_dataset" { resource "google_bigquery_table" "sample_table" { deletion_protection = false dataset_id = google_bigquery_dataset.sample_dataset.dataset_id - table_id = "<%= ctx[:vars]['job_id'] %>_table" + table_id = "{{index $.Vars "job_id"}}_table" schema = <" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vertex_ai_feature_online_store" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview.tf.tmpl index 6474c970b6e7..adf7bf02367f 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vertex_ai_feature_online_store" "featureonlinestore" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -15,7 +15,7 @@ resource "google_vertex_ai_feature_online_store" "featureonlinestore" { resource "google_bigquery_dataset" "tf-test-dataset" { - dataset_id = "<%= ctx[:vars]['name'] %>" + dataset_id = "{{index $.Vars "name"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -25,7 +25,7 @@ resource "google_bigquery_table" "tf-test-table" { deletion_protection = false dataset_id = google_bigquery_dataset.tf-test-dataset.dataset_id - table_id = "<%= ctx[:vars]['name'] %>" + table_id = "{{index $.Vars "name"}}" schema = <" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vertex_ai_feature_online_store_featureview" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" region = "us-central1" feature_online_store = google_vertex_ai_feature_online_store.featureonlinestore.name sync_config { diff --git a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_cross_project.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_cross_project.tf.tmpl index 0608b40ec410..e81d0081edc8 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_cross_project.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_cross_project.tf.tmpl @@ -4,8 +4,8 @@ data "google_project" "test_project" { resource "google_project" "project" { project_id = "tf-test%{random_suffix}" name = "tf-test%{random_suffix}" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } @@ -42,7 +42,7 @@ resource "google_bigquery_dataset_iam_member" "viewer" { } resource "google_vertex_ai_feature_online_store" "featureonlinestore" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" project = google_project.project.project_id labels = { foo = "bar" @@ -59,7 +59,7 @@ resource "google_vertex_ai_feature_online_store" "featureonlinestore" { } resource "google_bigquery_dataset" "sample_dataset" { - dataset_id = "<%= ctx[:vars]['name'] %>" + dataset_id = "{{index $.Vars "name"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -68,7 +68,7 @@ resource "google_bigquery_dataset" "sample_dataset" { resource "google_bigquery_table" "sample_table" { deletion_protection = false dataset_id = google_bigquery_dataset.sample_dataset.dataset_id - table_id = "<%= ctx[:vars]['name'] %>" + table_id = "{{index $.Vars "name"}}" schema = <", + "name": "{{index $.Vars "name"}}", "type": "STRING", "mode": "NULLABLE" }, @@ -92,7 +92,7 @@ EOF } resource "google_vertex_ai_feature_group" "sample_feature_group" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" description = "A sample feature group" region = "us-central1" labels = { @@ -110,7 +110,7 @@ resource "google_vertex_ai_feature_group" "sample_feature_group" { resource "google_vertex_ai_feature_group_feature" "sample_feature" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" feature_group = google_vertex_ai_feature_group.sample_feature_group.name description = "A sample feature" @@ -120,8 +120,8 @@ resource "google_vertex_ai_feature_group_feature" "sample_feature" { } -resource "google_vertex_ai_feature_online_store_featureview" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vertex_ai_feature_online_store_featureview" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" project = google_project.project.project_id region = "us-central1" feature_online_store = google_vertex_ai_feature_online_store.featureonlinestore.name diff --git a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_feature_registry.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_feature_registry.tf.tmpl index e82ea2a0c104..e9f5a93814fe 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_feature_registry.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_feature_registry.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vertex_ai_feature_online_store" "featureonlinestore" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -14,7 +14,7 @@ resource "google_vertex_ai_feature_online_store" "featureonlinestore" { } resource "google_bigquery_dataset" "sample_dataset" { - dataset_id = "<%= ctx[:vars]['name'] %>" + dataset_id = "{{index $.Vars "name"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -23,7 +23,7 @@ resource "google_bigquery_dataset" "sample_dataset" { resource "google_bigquery_table" "sample_table" { deletion_protection = false dataset_id = google_bigquery_dataset.sample_dataset.dataset_id - table_id = "<%= ctx[:vars]['name'] %>" + table_id = "{{index $.Vars "name"}}" schema = <", + "name": "{{index $.Vars "name"}}", "type": "STRING", "mode": "NULLABLE" }, @@ -47,7 +47,7 @@ EOF } resource "google_vertex_ai_feature_group" "sample_feature_group" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" description = "A sample feature group" region = "us-central1" labels = { @@ -65,7 +65,7 @@ resource "google_vertex_ai_feature_group" "sample_feature_group" { resource "google_vertex_ai_feature_group_feature" "sample_feature" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" feature_group = google_vertex_ai_feature_group.sample_feature_group.name description = "A sample feature" @@ -75,8 +75,8 @@ resource "google_vertex_ai_feature_group_feature" "sample_feature" { } -resource "google_vertex_ai_feature_online_store_featureview" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vertex_ai_feature_online_store_featureview" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" region = "us-central1" feature_online_store = google_vertex_ai_feature_online_store.featureonlinestore.name sync_config { diff --git a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_with_vector_search.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_with_vector_search.tf.tmpl index e5e03320089c..54d1158c6ba3 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_with_vector_search.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_featureview_with_vector_search.tf.tmpl @@ -1,6 +1,6 @@ resource "google_vertex_ai_feature_online_store" "featureonlinestore" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -19,7 +19,7 @@ resource "google_vertex_ai_feature_online_store" "featureonlinestore" { resource "google_bigquery_dataset" "tf-test-dataset" { provider = google-beta - dataset_id = "<%= ctx[:vars]['name'] %>" + dataset_id = "{{index $.Vars "name"}}" friendly_name = "test" description = "This is a test description" location = "US" @@ -29,7 +29,7 @@ resource "google_bigquery_table" "tf-test-table" { provider = google-beta deletion_protection = false dataset_id = google_bigquery_dataset.tf-test-dataset.dataset_id - table_id = "<%= ctx[:vars]['name'] %>" + table_id = "{{index $.Vars "name"}}" schema = <" { +resource "google_vertex_ai_feature_online_store_featureview" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" region = "us-central1" feature_online_store = google_vertex_ai_feature_online_store.featureonlinestore.name sync_config { diff --git a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_beta_fields_bigtable.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_beta_fields_bigtable.tf.tmpl index 8fd2f931607d..c3866ed602d4 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_beta_fields_bigtable.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_beta_fields_bigtable.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_vertex_ai_feature_online_store" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_feature_online_store" "{{$.PrimaryResourceId}}" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/go/vertex_ai_featureonlinestore_with_beta_fields_optimized.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_beta_fields_optimized.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/go/vertex_ai_featureonlinestore_with_beta_fields_optimized.tf.tmpl rename to mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_beta_fields_optimized.tf.tmpl diff --git a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_optimized.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_optimized.tf.tmpl index d3e5e3c85edc..acbdcb5b461c 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_optimized.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featureonlinestore_with_optimized.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_vertex_ai_feature_online_store" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_feature_online_store" "{{$.PrimaryResourceId}}" { provider = google - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/vertex_ai_featurestore.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featurestore.tf.tmpl index db6057a6f5fc..2d62e7b46dd6 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featurestore.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featurestore.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vertex_ai_featurestore" "featurestore" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -8,7 +8,7 @@ resource "google_vertex_ai_featurestore" "featurestore" { fixed_node_count = 2 } encryption_spec { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } force_destroy = true } diff --git a/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype.tf.tmpl index 7518beee02ea..640c9956062a 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vertex_ai_featurestore" "featurestore" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -8,12 +8,12 @@ resource "google_vertex_ai_featurestore" "featurestore" { fixed_node_count = 2 } encryption_spec { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } } resource "google_vertex_ai_featurestore_entitytype" "entity" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_feature.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_feature.tf.tmpl index dd296cb57741..75d34452b175 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_feature.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_feature.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vertex_ai_featurestore" "featurestore" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -10,7 +10,7 @@ resource "google_vertex_ai_featurestore" "featurestore" { } resource "google_vertex_ai_featurestore_entitytype" "entity" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -18,7 +18,7 @@ resource "google_vertex_ai_featurestore_entitytype" "entity" { } resource "google_vertex_ai_featurestore_entitytype_feature" "feature" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_feature_with_beta_fields.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_feature_with_beta_fields.tf.tmpl index 8468f230ddd6..f2cfc18e96be 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_feature_with_beta_fields.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_feature_with_beta_fields.tf.tmpl @@ -1,6 +1,6 @@ resource "google_vertex_ai_featurestore" "featurestore" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -12,7 +12,7 @@ resource "google_vertex_ai_featurestore" "featurestore" { resource "google_vertex_ai_featurestore_entitytype" "entity" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -35,7 +35,7 @@ resource "google_vertex_ai_featurestore_entitytype" "entity" { resource "google_vertex_ai_featurestore_entitytype_feature" "feature" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_with_beta_fields.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_with_beta_fields.tf.tmpl index 36e0277a1b49..5beed653eb74 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_with_beta_fields.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featurestore_entitytype_with_beta_fields.tf.tmpl @@ -1,6 +1,6 @@ resource "google_vertex_ai_featurestore" "featurestore" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -9,13 +9,13 @@ resource "google_vertex_ai_featurestore" "featurestore" { fixed_node_count = 2 } encryption_spec { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } } resource "google_vertex_ai_featurestore_entitytype" "entity" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } diff --git a/mmv1/templates/terraform/examples/vertex_ai_featurestore_scaling.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featurestore_scaling.tf.tmpl index b13881788bcf..562a1903e45b 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featurestore_scaling.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featurestore_scaling.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vertex_ai_featurestore" "featurestore" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -11,7 +11,7 @@ resource "google_vertex_ai_featurestore" "featurestore" { } } encryption_spec { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } force_destroy = true } diff --git a/mmv1/templates/terraform/examples/vertex_ai_featurestore_with_beta_fields.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_featurestore_with_beta_fields.tf.tmpl index 81d5cee1bb0e..5a55fd743e9c 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_featurestore_with_beta_fields.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_featurestore_with_beta_fields.tf.tmpl @@ -1,6 +1,6 @@ resource "google_vertex_ai_featurestore" "featurestore" { provider = google-beta - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" labels = { foo = "bar" } @@ -9,7 +9,7 @@ resource "google_vertex_ai_featurestore" "featurestore" { fixed_node_count = 2 } encryption_spec { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } online_storage_ttl_days = 30 force_destroy = true diff --git a/mmv1/templates/terraform/examples/vertex_ai_index.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index.tf.tmpl index 1a1e90b2c329..6f1d57d4877c 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index.tf.tmpl @@ -1,5 +1,5 @@ resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "us-central1" uniform_bucket_level_access = true } @@ -20,7 +20,7 @@ resource "google_vertex_ai_index" "index" { foo = "bar" } region = "us-central1" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" description = "index for test" metadata { contents_delta_uri = "gs://${google_storage_bucket.bucket.name}/contents" diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint.tf.tmpl index 2c0b78e4e339..51fe07f123bc 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_vertex_ai_index_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint" "{{$.PrimaryResourceId}}" { display_name = "sample-endpoint" description = "A sample vertex endpoint" region = "us-central1" @@ -18,7 +18,7 @@ resource "google_service_networking_connection" "vertex_vpc_connection" { } resource "google_compute_global_address" "vertex_range" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 24 @@ -26,7 +26,7 @@ resource "google_compute_global_address" "vertex_range" { } resource "google_compute_network" "vertex_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } data "google_project" "project" {} diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_automatic_resources.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_automatic_resources.tf.tmpl index be7081cb8fb8..42b020b82784 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_automatic_resources.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_automatic_resources.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_vertex_ai_index_endpoint_deployed_index" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint_deployed_index" "{{$.PrimaryResourceId}}" { depends_on = [ google_vertex_ai_index_endpoint.vertex_endpoint ] index_endpoint = google_vertex_ai_index_endpoint.vertex_endpoint.id index = google_vertex_ai_index.index.id // this is the index that will be deployed onto an endpoint - deployed_index_id = "<%= ctx[:vars]['deployed_index_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" + deployed_index_id = "{{index $.Vars "deployed_index_id"}}" + display_name = "{{index $.Vars "display_name"}}" automatic_resources{ max_replica_count = 2 min_replica_count = 1 @@ -12,7 +12,7 @@ resource "google_vertex_ai_index_endpoint_deployed_index" "<%= ctx[:primary_reso } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "us-central1" uniform_bucket_level_access = true } @@ -33,7 +33,7 @@ resource "google_vertex_ai_index" "index" { foo = "bar" } region = "us-central1" - display_name = "<%= ctx[:vars]['display_name_index'] %>" + display_name = "{{index $.Vars "display_name_index"}}" description = "index for test" metadata { contents_delta_uri = "gs://${google_storage_bucket.bucket.name}/contents" diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_basic.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_basic.tf.tmpl index 22abd3cc7a5c..a11bab0eff01 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_basic.tf.tmpl @@ -1,15 +1,15 @@ resource "google_service_account" "sa" { - account_id = "<%= ctx[:vars]['service_account_id'] %>" + account_id = "{{index $.Vars "service_account_id"}}" } -resource "google_vertex_ai_index_endpoint_deployed_index" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint_deployed_index" "{{$.PrimaryResourceId}}" { depends_on = [ google_vertex_ai_index_endpoint.vertex_index_endpoint_deployed, google_service_account.sa ] index_endpoint = google_vertex_ai_index_endpoint.vertex_index_endpoint_deployed.id index = google_vertex_ai_index.index.id // this is the index that will be deployed onto an endpoint - deployed_index_id = "<%= ctx[:vars]['deployed_index_id'] %>" - reserved_ip_ranges = ["<%= ctx[:vars]['address_name'] %>"] + deployed_index_id = "{{index $.Vars "deployed_index_id"}}" + reserved_ip_ranges = ["{{index $.Vars "address_name"}}"] enable_access_logging = false - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" deployed_index_auth_config{ auth_provider{ audiences = ["123456-my-app"] @@ -19,7 +19,7 @@ resource "google_vertex_ai_index_endpoint_deployed_index" "<%= ctx[:primary_reso } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "us-central1" uniform_bucket_level_access = true } @@ -40,7 +40,7 @@ resource "google_vertex_ai_index" "index" { foo = "bar" } region = "us-central1" - display_name = "<%= ctx[:vars]['display_name_index'] %>" + display_name = "{{index $.Vars "display_name_index"}}" description = "index for test" metadata { contents_delta_uri = "gs://${google_storage_bucket.bucket.name}/contents" @@ -71,7 +71,7 @@ resource "google_vertex_ai_index_endpoint" "vertex_index_endpoint_deployed" { } data "google_compute_network" "vertex_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } data "google_project" "project" {} diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_basic_two.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_basic_two.tf.tmpl index 5357111a52e7..18c94047d44c 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_basic_two.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_basic_two.tf.tmpl @@ -1,15 +1,15 @@ resource "google_service_account" "sa" { - account_id = "<%= ctx[:vars]['service_account_id'] %>" + account_id = "{{index $.Vars "service_account_id"}}" } -resource "google_vertex_ai_index_endpoint_deployed_index" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint_deployed_index" "{{$.PrimaryResourceId}}" { depends_on = [ google_vertex_ai_index_endpoint.vertex_index_endpoint_deployed, google_service_account.sa ] index_endpoint = google_vertex_ai_index_endpoint.vertex_index_endpoint_deployed.id index = google_vertex_ai_index.index.id // this is the index that will be deployed onto an endpoint - deployed_index_id = "<%= ctx[:vars]['deployed_index_id'] %>" - reserved_ip_ranges = ["<%= ctx[:vars]['address_name'] %>"] + deployed_index_id = "{{index $.Vars "deployed_index_id"}}" + reserved_ip_ranges = ["{{index $.Vars "address_name"}}"] enable_access_logging = false - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" deployed_index_auth_config{ auth_provider{ audiences = ["123456-my-app"] @@ -22,7 +22,7 @@ resource "google_vertex_ai_index_endpoint_deployed_index" "<%= ctx[:primary_reso } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "us-central1" uniform_bucket_level_access = true } @@ -43,7 +43,7 @@ resource "google_vertex_ai_index" "index" { foo = "bar" } region = "us-central1" - display_name = "<%= ctx[:vars]['display_name_index'] %>" + display_name = "{{index $.Vars "display_name_index"}}" description = "index for test" metadata { contents_delta_uri = "gs://${google_storage_bucket.bucket.name}/contents" @@ -74,7 +74,7 @@ resource "google_vertex_ai_index_endpoint" "vertex_index_endpoint_deployed" { } data "google_compute_network" "vertex_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } data "google_project" "project" {} diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_dedicated_resources.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_dedicated_resources.tf.tmpl index db4acfd82b7e..1de7cc122c69 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_dedicated_resources.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_deployed_index_dedicated_resources.tf.tmpl @@ -1,9 +1,9 @@ -resource "google_vertex_ai_index_endpoint_deployed_index" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint_deployed_index" "{{$.PrimaryResourceId}}" { depends_on = [ google_vertex_ai_index_endpoint.vertex_endpoint ] index_endpoint = google_vertex_ai_index_endpoint.vertex_endpoint.id index = google_vertex_ai_index.index.id // this is the index that will be deployed onto an endpoint - deployed_index_id = "<%= ctx[:vars]['deployed_index_id'] %>" - display_name = "<%= ctx[:vars]['display_name'] %>" + deployed_index_id = "{{index $.Vars "deployed_index_id"}}" + display_name = "{{index $.Vars "display_name"}}" dedicated_resources { machine_spec { machine_type = "n1-standard-32" @@ -14,7 +14,7 @@ resource "google_vertex_ai_index_endpoint_deployed_index" "<%= ctx[:primary_reso } resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "us-central1" uniform_bucket_level_access = true } @@ -35,7 +35,7 @@ resource "google_vertex_ai_index" "index" { foo = "bar" } region = "us-central1" - display_name = "<%= ctx[:vars]['display_name_index'] %>" + display_name = "{{index $.Vars "display_name_index"}}" description = "index for test" metadata { contents_delta_uri = "gs://${google_storage_bucket.bucket.name}/contents" diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_test.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_test.tf.tmpl index 323c08e69c3a..fe9e41c7bb0f 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_test.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_vertex_ai_index_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint" "{{$.PrimaryResourceId}}" { display_name = "sample-endpoint" description = "A sample vertex endpoint" region = "us-central1" @@ -9,7 +9,7 @@ resource "google_vertex_ai_index_endpoint" "<%= ctx[:primary_resource_id] %>" { } data "google_compute_network" "vertex_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } data "google_project" "project" {} diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_false_psc.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_false_psc.tf.tmpl index 83d069c229e9..6174a390c2cd 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_false_psc.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_false_psc.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_vertex_ai_index_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint" "{{$.PrimaryResourceId}}" { display_name = "sample-endpoint" description = "A sample vertex endpoint" region = "us-central1" diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_psc.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_psc.tf.tmpl index 1f52eaf2d962..792a18f9e750 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_psc.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_psc.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_vertex_ai_index_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint" "{{$.PrimaryResourceId}}" { display_name = "sample-endpoint" description = "A sample vertex endpoint" region = "us-central1" diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_public_endpoint.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_public_endpoint.tf.tmpl index df17d058cb9e..76b33617fb93 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_public_endpoint.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_public_endpoint.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_vertex_ai_index_endpoint" "<%= ctx[:primary_resource_id] %>" { +resource "google_vertex_ai_index_endpoint" "{{$.PrimaryResourceId}}" { display_name = "sample-endpoint" description = "A sample vertex endpoint with an public endpoint" region = "us-central1" diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_streaming.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_streaming.tf.tmpl index acaf268b8254..2a9212a9129a 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_streaming.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_streaming.tf.tmpl @@ -1,5 +1,5 @@ resource "google_storage_bucket" "bucket" { - name = "<%= ctx[:vars]['bucket_name'] %>" + name = "{{index $.Vars "bucket_name"}}" location = "us-central1" uniform_bucket_level_access = true } @@ -20,7 +20,7 @@ resource "google_vertex_ai_index" "index" { foo = "bar" } region = "us-central1" - display_name = "<%= ctx[:vars]['display_name'] %>" + display_name = "{{index $.Vars "display_name"}}" description = "index for test" metadata { contents_delta_uri = "gs://${google_storage_bucket.bucket.name}/contents" diff --git a/mmv1/templates/terraform/examples/vertex_ai_metadata_store.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_metadata_store.tf.tmpl index 96bca61ed117..3f957d771a46 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_metadata_store.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_metadata_store.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vertex_ai_metadata_store" "store" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" description = "Store to test the terraform module" region = "us-central1" } diff --git a/mmv1/templates/terraform/examples/vertex_ai_tensorboard.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_tensorboard.tf.tmpl index 1552516b3d6b..8f71ce516c0b 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_tensorboard.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_tensorboard.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_vertex_ai_tensorboard" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_vertex_ai_tensorboard" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" description = "sample description" labels = { "key1" : "value1", diff --git a/mmv1/templates/terraform/examples/vertex_ai_tensorboard_full.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_tensorboard_full.tf.tmpl index ab59cee9ed7c..66123d05a643 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_tensorboard_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_tensorboard_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_vertex_ai_tensorboard" "<%= ctx[:primary_resource_id] %>" { - display_name = "<%= ctx[:vars]['display_name'] %>" +resource "google_vertex_ai_tensorboard" "{{$.PrimaryResourceId}}" { + display_name = "{{index $.Vars "display_name"}}" description = "sample description" labels = { "key1" : "value1", @@ -7,13 +7,13 @@ resource "google_vertex_ai_tensorboard" "<%= ctx[:primary_resource_id] %>" { } region = "us-central1" encryption_spec { - kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>" + kms_key_name = "{{index $.Vars "kms_key_name"}}" } depends_on = [google_kms_crypto_key_iam_member.crypto_key] } resource "google_kms_crypto_key_iam_member" "crypto_key" { - crypto_key_id = "<%= ctx[:vars]['kms_key_name'] %>" + crypto_key_id = "{{index $.Vars "kms_key_name"}}" role = "roles/cloudkms.cryptoKeyEncrypterDecrypter" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-aiplatform.iam.gserviceaccount.com" } diff --git a/mmv1/templates/terraform/examples/vmware_engine_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_cluster_basic.tf.tmpl index ef7152569e08..841e1a73882d 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_cluster_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_vmwareengine_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vmwareengine_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" parent = google_vmwareengine_private_cloud.cluster-pc.id node_type_configs { node_type_id = "standard-72" @@ -8,8 +8,8 @@ resource "google_vmwareengine_cluster" "<%= ctx[:primary_resource_id] %>" { } resource "google_vmwareengine_private_cloud" "cluster-pc" { - location = "<%= ctx[:test_env_vars]['region'] %>-a" - name = "<%= ctx[:vars]['private_cloud_id'] %>" + location = "{{index $.TestEnvVars "region"}}-a" + name = "{{index $.Vars "private_cloud_id"}}" description = "Sample test PC." network_config { management_cidr = "192.168.30.0/24" @@ -17,7 +17,7 @@ resource "google_vmwareengine_private_cloud" "cluster-pc" { } management_cluster { - cluster_id = "<%= ctx[:vars]['management_cluster_id'] %>" + cluster_id = "{{index $.Vars "management_cluster_id"}}" node_type_configs { node_type_id = "standard-72" node_count = 3 @@ -26,7 +26,7 @@ resource "google_vmwareengine_private_cloud" "cluster-pc" { } resource "google_vmwareengine_network" "cluster-nw" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" type = "STANDARD" location = "global" description = "PC network description." diff --git a/mmv1/templates/terraform/examples/vmware_engine_cluster_full.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_cluster_full.tf.tmpl index ce2584a72549..2bc712154026 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_cluster_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_cluster_full.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_vmwareengine_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vmwareengine_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" parent = google_vmwareengine_private_cloud.cluster-pc.id node_type_configs { node_type_id = "standard-72" @@ -9,8 +9,8 @@ resource "google_vmwareengine_cluster" "<%= ctx[:primary_resource_id] %>" { } resource "google_vmwareengine_private_cloud" "cluster-pc" { - location = "<%= ctx[:test_env_vars]['region'] %>-a" - name = "<%= ctx[:vars]['private_cloud_id'] %>" + location = "{{index $.TestEnvVars "region"}}-a" + name = "{{index $.Vars "private_cloud_id"}}" description = "Sample test PC." network_config { management_cidr = "192.168.30.0/24" @@ -18,7 +18,7 @@ resource "google_vmwareengine_private_cloud" "cluster-pc" { } management_cluster { - cluster_id = "<%= ctx[:vars]['management_cluster_id'] %>" + cluster_id = "{{index $.Vars "management_cluster_id"}}" node_type_configs { node_type_id = "standard-72" node_count = 3 @@ -28,7 +28,7 @@ resource "google_vmwareengine_private_cloud" "cluster-pc" { } resource "google_vmwareengine_network" "cluster-nw" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" type = "STANDARD" location = "global" description = "PC network description." diff --git a/mmv1/templates/terraform/examples/vmware_engine_external_access_rule_basic.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_external_access_rule_basic.tf.tmpl index 1275a365c536..b03ab0084bfa 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_external_access_rule_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_external_access_rule_basic.tf.tmpl @@ -1,19 +1,19 @@ resource "google_vmwareengine_network" "external-access-rule-nw" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" location = "global" type = "STANDARD" description = "PC network description." } resource "google_vmwareengine_network_policy" "external-access-rule-np" { - location = "<%= ctx[:test_env_vars]['region'] %>" - name = "<%= ctx[:vars]['network_policy_id'] %>" + location = "{{index $.TestEnvVars "region"}}" + name = "{{index $.Vars "network_policy_id"}}" edge_services_cidr = "192.168.30.0/26" vmware_engine_network = google_vmwareengine_network.external-access-rule-nw.id } -resource "google_vmwareengine_external_access_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vmwareengine_external_access_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" parent = google_vmwareengine_network_policy.external-access-rule-np.id priority = 101 action = "DENY" diff --git a/mmv1/templates/terraform/examples/vmware_engine_external_access_rule_full.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_external_access_rule_full.tf.tmpl index bd3c867144fc..f3035b19215b 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_external_access_rule_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_external_access_rule_full.tf.tmpl @@ -1,13 +1,13 @@ resource "google_vmwareengine_network" "external-access-rule-nw" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" location = "global" type = "STANDARD" description = "PC network description." } resource "google_vmwareengine_private_cloud" "external-access-rule-pc" { - location = "<%= ctx[:test_env_vars]['region'] %>-a" - name = "<%= ctx[:vars]['private_cloud_id'] %>" + location = "{{index $.TestEnvVars "region"}}-a" + name = "{{index $.Vars "private_cloud_id"}}" description = "Sample test PC." network_config { management_cidr = "192.168.50.0/24" @@ -15,7 +15,7 @@ resource "google_vmwareengine_private_cloud" "external-access-rule-pc" { } management_cluster { - cluster_id = "<%= ctx[:vars]['management_cluster_id'] %>" + cluster_id = "{{index $.Vars "management_cluster_id"}}" node_type_configs { node_type_id = "standard-72" node_count = 3 @@ -24,20 +24,20 @@ resource "google_vmwareengine_private_cloud" "external-access-rule-pc" { } resource "google_vmwareengine_network_policy" "external-access-rule-np" { - location = "<%= ctx[:test_env_vars]['region'] %>" - name = "<%= ctx[:vars]['network_policy_id'] %>" + location = "{{index $.TestEnvVars "region"}}" + name = "{{index $.Vars "network_policy_id"}}" edge_services_cidr = "192.168.30.0/26" vmware_engine_network = google_vmwareengine_network.external-access-rule-nw.id } resource "google_vmwareengine_external_address" "external-access-rule-ea" { - name = "<%= ctx[:vars]['external_address_id'] %>" + name = "{{index $.Vars "external_address_id"}}" parent = google_vmwareengine_private_cloud.external-access-rule-pc.id internal_ip = "192.168.0.65" } -resource "google_vmwareengine_external_access_rule" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vmwareengine_external_access_rule" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" parent = google_vmwareengine_network_policy.external-access-rule-np.id description = "Sample Description" priority = 101 diff --git a/mmv1/templates/terraform/examples/vmware_engine_external_address_basic.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_external_address_basic.tf.tmpl index 874fbe25b5cf..ee58f15d0dfc 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_external_address_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_external_address_basic.tf.tmpl @@ -1,13 +1,13 @@ resource "google_vmwareengine_network" "external-address-nw" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" location = "global" type = "STANDARD" description = "PC network description." } resource "google_vmwareengine_private_cloud" "external-address-pc" { - location = "<%= ctx[:test_env_vars]['region'] %>-a" - name = "<%= ctx[:vars]['private_cloud_id'] %>" + location = "{{index $.TestEnvVars "region"}}-a" + name = "{{index $.Vars "private_cloud_id"}}" description = "Sample test PC." network_config { management_cidr = "192.168.50.0/24" @@ -15,7 +15,7 @@ resource "google_vmwareengine_private_cloud" "external-address-pc" { } management_cluster { - cluster_id = "<%= ctx[:vars]['management_cluster_id'] %>" + cluster_id = "{{index $.Vars "management_cluster_id"}}" node_type_configs { node_type_id = "standard-72" node_count = 3 @@ -24,14 +24,14 @@ resource "google_vmwareengine_private_cloud" "external-address-pc" { } resource "google_vmwareengine_network_policy" "external-address-np" { - location = "<%= ctx[:test_env_vars]['region'] %>" - name = "<%= ctx[:vars]['network_policy_id'] %>" + location = "{{index $.TestEnvVars "region"}}" + name = "{{index $.Vars "network_policy_id"}}" edge_services_cidr = "192.168.30.0/26" vmware_engine_network = google_vmwareengine_network.external-address-nw.id } -resource "google_vmwareengine_external_address" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vmwareengine_external_address" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" parent = google_vmwareengine_private_cloud.external-address-pc.id internal_ip = "192.168.0.66" description = "Sample description." diff --git a/mmv1/templates/terraform/examples/vmware_engine_network_legacy.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_network_legacy.tf.tmpl index f3e033249b4a..9936dabd3275 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_network_legacy.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_network_legacy.tf.tmpl @@ -1,7 +1,7 @@ -resource "google_vmwareengine_network" "<%= ctx[:primary_resource_id] %>" { +resource "google_vmwareengine_network" "{{$.PrimaryResourceId}}" { project = google_project_service.acceptance.project - name = "<%= ctx[:test_env_vars]['location'] %>-default" #Legacy network IDs are in the format: {region-id}-default - location = "<%= ctx[:test_env_vars]['location'] %>" + name = "{{index $.TestEnvVars "location"}}-default" #Legacy network IDs are in the format: {region-id}-default + location = "{{index $.TestEnvVars "location"}}" type = "LEGACY" description = "VMwareEngine legacy network sample" } @@ -17,10 +17,10 @@ resource "google_project_service" "acceptance" { # there can be only 1 Legacy network per region for a given project, # so creating new project for isolation in CI. resource "google_project" "acceptance" { - name = "<%= ctx[:vars]['proj_id'] %>" - project_id = "<%= ctx[:vars]['proj_id'] %>" - org_id = "<%= ctx[:test_env_vars]['org_id'] %>" - billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" + name = "{{index $.Vars "proj_id"}}" + project_id = "{{index $.Vars "proj_id"}}" + org_id = "{{index $.TestEnvVars "org_id"}}" + billing_account = "{{index $.TestEnvVars "billing_account"}}" deletion_policy = "DELETE" } diff --git a/mmv1/templates/terraform/examples/vmware_engine_network_peering_standard.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_network_peering_standard.tf.tmpl index 0f298b862cf3..a4cc13b36877 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_network_peering_standard.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_network_peering_standard.tf.tmpl @@ -6,8 +6,8 @@ resource "google_vmwareengine_network" "network-peering-standard-nw" { location = "global" type = "STANDARD" } -resource "google_vmwareengine_network_peering" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vmwareengine_network_peering" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" description = "Sample description" peer_network = google_compute_network.network-peering-vpc.id peer_network_type = "STANDARD" diff --git a/mmv1/templates/terraform/examples/vmware_engine_network_peering_ven.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_network_peering_ven.tf.tmpl index 1b11b0e49414..3ff009495c10 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_network_peering_ven.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_network_peering_ven.tf.tmpl @@ -8,8 +8,8 @@ resource "google_vmwareengine_network" "network-peering-peer-nw" { location = "global" type = "STANDARD" } -resource "google_vmwareengine_network_peering" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_vmwareengine_network_peering" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" description = "Sample description" vmware_engine_network = google_vmwareengine_network.network-peering-nw.id peer_network = google_vmwareengine_network.network-peering-peer-nw.id diff --git a/mmv1/templates/terraform/examples/vmware_engine_network_policy_basic.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_network_policy_basic.tf.tmpl index 1e0e82a8d222..34bdf8add954 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_network_policy_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_network_policy_basic.tf.tmpl @@ -1,13 +1,13 @@ resource "google_vmwareengine_network" "network-policy-nw" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" location = "global" type = "STANDARD" description = "VMwareEngine standard network sample" } -resource "google_vmwareengine_network_policy" "<%= ctx[:primary_resource_id] %>" { - location = "<%= ctx[:test_env_vars]['region'] %>" - name = "<%= ctx[:vars]['network_policy_name'] %>" +resource "google_vmwareengine_network_policy" "{{$.PrimaryResourceId}}" { + location = "{{index $.TestEnvVars "region"}}" + name = "{{index $.Vars "network_policy_name"}}" edge_services_cidr = "192.168.30.0/26" vmware_engine_network = google_vmwareengine_network.network-policy-nw.id } diff --git a/mmv1/templates/terraform/examples/vmware_engine_network_policy_full.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_network_policy_full.tf.tmpl index 5a31da112a49..03d0442ef30e 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_network_policy_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_network_policy_full.tf.tmpl @@ -1,13 +1,13 @@ resource "google_vmwareengine_network" "network-policy-nw" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" location = "global" type = "STANDARD" description = "VMwareEngine standard network sample" } -resource "google_vmwareengine_network_policy" "<%= ctx[:primary_resource_id] %>" { - location = "<%= ctx[:test_env_vars]['region'] %>" - name = "<%= ctx[:vars]['network_policy_name'] %>" +resource "google_vmwareengine_network_policy" "{{$.PrimaryResourceId}}" { + location = "{{index $.TestEnvVars "region"}}" + name = "{{index $.Vars "network_policy_name"}}" edge_services_cidr = "192.168.30.0/26" vmware_engine_network = google_vmwareengine_network.network-policy-nw.id description = "Sample Network Policy" diff --git a/mmv1/templates/terraform/examples/vmware_engine_network_standard.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_network_standard.tf.tmpl index 1c889bb09f78..a2c9588389c6 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_network_standard.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_network_standard.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_vmwareengine_network" "<%= ctx[:primary_resource_id] %>" { +resource "google_vmwareengine_network" "{{$.PrimaryResourceId}}" { name = "standard-nw" location = "global" # Standard network needs to be global type = "STANDARD" diff --git a/mmv1/templates/terraform/examples/vmware_engine_private_cloud_basic.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_private_cloud_basic.tf.tmpl index 697f1d713f2d..5ecb127c7638 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_private_cloud_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_private_cloud_basic.tf.tmpl @@ -1,13 +1,13 @@ -resource "google_vmwareengine_private_cloud" "<%= ctx[:primary_resource_id] %>" { - location = "<%= ctx[:test_env_vars]['region'] %>-a" - name = "<%= ctx[:vars]['private_cloud_id'] %>" +resource "google_vmwareengine_private_cloud" "{{$.PrimaryResourceId}}" { + location = "{{index $.TestEnvVars "region"}}-a" + name = "{{index $.Vars "private_cloud_id"}}" description = "Sample test PC." network_config { management_cidr = "192.168.30.0/24" vmware_engine_network = google_vmwareengine_network.pc-nw.id } management_cluster { - cluster_id = "<%= ctx[:vars]['management_cluster_id'] %>" + cluster_id = "{{index $.Vars "management_cluster_id"}}" node_type_configs { node_type_id = "standard-72" node_count = 3 @@ -16,7 +16,7 @@ resource "google_vmwareengine_private_cloud" "<%= ctx[:primary_resource_id] %>" } resource "google_vmwareengine_network" "pc-nw" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" location = "global" type = "STANDARD" description = "PC network description." diff --git a/mmv1/templates/terraform/examples/vmware_engine_private_cloud_full.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_private_cloud_full.tf.tmpl index 20ada7f3f902..4c9f4349b90b 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_private_cloud_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_private_cloud_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_vmwareengine_private_cloud" "<%= ctx[:primary_resource_id] %>" { - location = "<%= ctx[:test_env_vars]['region'] %>-a" - name = "<%= ctx[:vars]['private_cloud_id'] %>" +resource "google_vmwareengine_private_cloud" "{{$.PrimaryResourceId}}" { + location = "{{index $.TestEnvVars "region"}}-a" + name = "{{index $.Vars "private_cloud_id"}}" description = "Sample test PC." type = "TIME_LIMITED" network_config { @@ -8,7 +8,7 @@ resource "google_vmwareengine_private_cloud" "<%= ctx[:primary_resource_id] %>" vmware_engine_network = google_vmwareengine_network.pc-nw.id } management_cluster { - cluster_id = "<%= ctx[:vars]['management_cluster_id'] %>" + cluster_id = "{{index $.Vars "management_cluster_id"}}" node_type_configs { node_type_id = "standard-72" node_count = 1 @@ -20,7 +20,7 @@ resource "google_vmwareengine_private_cloud" "<%= ctx[:primary_resource_id] %>" } resource "google_vmwareengine_network" "pc-nw" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" location = "global" type = "STANDARD" description = "PC network description." diff --git a/mmv1/templates/terraform/examples/vmware_engine_subnet_user_defined.tf.tmpl b/mmv1/templates/terraform/examples/vmware_engine_subnet_user_defined.tf.tmpl index aeedd117bac4..91b7b6fea488 100644 --- a/mmv1/templates/terraform/examples/vmware_engine_subnet_user_defined.tf.tmpl +++ b/mmv1/templates/terraform/examples/vmware_engine_subnet_user_defined.tf.tmpl @@ -1,13 +1,13 @@ resource "google_vmwareengine_network" "subnet-nw" { - name = "<%= ctx[:vars]['network_id'] %>" + name = "{{index $.Vars "network_id"}}" location = "global" type = "STANDARD" description = "PC network description." } resource "google_vmwareengine_private_cloud" "subnet-pc" { - location = "<%= ctx[:test_env_vars]['region'] %>-a" - name = "<%= ctx[:vars]['private_cloud_id'] %>" + location = "{{index $.TestEnvVars "region"}}-a" + name = "{{index $.Vars "private_cloud_id"}}" description = "Sample test PC." network_config { management_cidr = "192.168.50.0/24" @@ -15,7 +15,7 @@ resource "google_vmwareengine_private_cloud" "subnet-pc" { } management_cluster { - cluster_id = "<%= ctx[:vars]['management_cluster_id'] %>" + cluster_id = "{{index $.Vars "management_cluster_id"}}" node_type_configs { node_type_id = "standard-72" node_count = 3 @@ -23,8 +23,8 @@ resource "google_vmwareengine_private_cloud" "subnet-pc" { } } -resource "google_vmwareengine_subnet" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['subnet_id'] %>" +resource "google_vmwareengine_subnet" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "subnet_id"}}" parent = google_vmwareengine_private_cloud.subnet-pc.id ip_cidr_range = "192.168.100.0/26" } diff --git a/mmv1/templates/terraform/examples/volume_snapshot_create.tf.tmpl b/mmv1/templates/terraform/examples/volume_snapshot_create.tf.tmpl index 552019daabd5..5d171d98b722 100644 --- a/mmv1/templates/terraform/examples/volume_snapshot_create.tf.tmpl +++ b/mmv1/templates/terraform/examples/volume_snapshot_create.tf.tmpl @@ -1,5 +1,5 @@ resource "google_netapp_storage_pool" "default" { - name = "<%= ctx[:vars]['pool_name'] %>" + name = "{{index $.Vars "pool_name"}}" location = "us-west2" service_level = "PREMIUM" capacity_gib = 2048 @@ -8,20 +8,20 @@ resource "google_netapp_storage_pool" "default" { resource "google_netapp_volume" "default" { location = google_netapp_storage_pool.default.location - name = "<%= ctx[:vars]['volume_name'] %>" + name = "{{index $.Vars "volume_name"}}" capacity_gib = 100 - share_name = "<%= ctx[:vars]['volume_name'] %>" + share_name = "{{index $.Vars "volume_name"}}" storage_pool = google_netapp_storage_pool.default.name protocols = ["NFSV3"] } -resource "google_netapp_volume_snapshot" "<%= ctx[:primary_resource_id] %>" { +resource "google_netapp_volume_snapshot" "{{$.PrimaryResourceId}}" { depends_on = [google_netapp_volume.default] location = google_netapp_volume.default.location volume_name = google_netapp_volume.default.name - name = "<%= ctx[:vars]['snap_name'] %>" + name = "{{index $.Vars "snap_name"}}" } data "google_compute_network" "default" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } diff --git a/mmv1/templates/terraform/examples/vpc_access_connector.tf.tmpl b/mmv1/templates/terraform/examples/vpc_access_connector.tf.tmpl index 57fa413a5a36..71c8fbb54a14 100644 --- a/mmv1/templates/terraform/examples/vpc_access_connector.tf.tmpl +++ b/mmv1/templates/terraform/examples/vpc_access_connector.tf.tmpl @@ -1,7 +1,7 @@ resource "google_vpc_access_connector" "connector" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" ip_cidr_range = "10.8.0.0/28" - network = "<%= ctx[:vars]['network_name'] %>" + network = "{{index $.Vars "network_name"}}" min_instances = 2 max_instances = 3 } diff --git a/mmv1/templates/terraform/examples/vpc_access_connector_shared_vpc.tf.tmpl b/mmv1/templates/terraform/examples/vpc_access_connector_shared_vpc.tf.tmpl index 822e5f9eb02d..8a67bc49484e 100644 --- a/mmv1/templates/terraform/examples/vpc_access_connector_shared_vpc.tf.tmpl +++ b/mmv1/templates/terraform/examples/vpc_access_connector_shared_vpc.tf.tmpl @@ -1,5 +1,5 @@ resource "google_vpc_access_connector" "connector" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" subnet { name = google_compute_subnetwork.custom_test.name } @@ -9,8 +9,8 @@ resource "google_vpc_access_connector" "connector" { } resource "google_compute_subnetwork" "custom_test" { - name = "<%= ctx[:vars]['name'] %>" + name = "{{index $.Vars "name"}}" ip_cidr_range = "10.2.0.0/28" region = "us-central1" - network = "<%= ctx[:vars]['network_name'] %>" + network = "{{index $.Vars "network_name"}}" } \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/vpn_tunnel_basic.tf.tmpl b/mmv1/templates/terraform/examples/vpn_tunnel_basic.tf.tmpl index e22c3e4f07c5..b9582b8d211c 100644 --- a/mmv1/templates/terraform/examples/vpn_tunnel_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/vpn_tunnel_basic.tf.tmpl @@ -1,5 +1,5 @@ resource "google_compute_vpn_tunnel" "tunnel1" { - name = "<%= ctx[:vars]['vpn_tunnel_name'] %>" + name = "{{index $.Vars "vpn_tunnel_name"}}" peer_ip = "15.0.0.120" shared_secret = "a secret message" @@ -17,27 +17,27 @@ resource "google_compute_vpn_tunnel" "tunnel1" { } resource "google_compute_vpn_gateway" "target_gateway" { - name = "<%= ctx[:vars]['target_vpn_gateway_name'] %>" + name = "{{index $.Vars "target_vpn_gateway_name"}}" network = google_compute_network.network1.id } resource "google_compute_network" "network1" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_compute_address" "vpn_static_ip" { - name = "<%= ctx[:vars]['address_name'] %>" + name = "{{index $.Vars "address_name"}}" } resource "google_compute_forwarding_rule" "fr_esp" { - name = "<%= ctx[:vars]['esp_forwarding_rule_name'] %>" + name = "{{index $.Vars "esp_forwarding_rule_name"}}" ip_protocol = "ESP" ip_address = google_compute_address.vpn_static_ip.address target = google_compute_vpn_gateway.target_gateway.id } resource "google_compute_forwarding_rule" "fr_udp500" { - name = "<%= ctx[:vars]['udp500_forwarding_rule_name'] %>" + name = "{{index $.Vars "udp500_forwarding_rule_name"}}" ip_protocol = "UDP" port_range = "500" ip_address = google_compute_address.vpn_static_ip.address @@ -45,7 +45,7 @@ resource "google_compute_forwarding_rule" "fr_udp500" { } resource "google_compute_forwarding_rule" "fr_udp4500" { - name = "<%= ctx[:vars]['udp4500_forwarding_rule_name'] %>" + name = "{{index $.Vars "udp4500_forwarding_rule_name"}}" ip_protocol = "UDP" port_range = "4500" ip_address = google_compute_address.vpn_static_ip.address @@ -53,7 +53,7 @@ resource "google_compute_forwarding_rule" "fr_udp4500" { } resource "google_compute_route" "route1" { - name = "<%= ctx[:vars]['route_name'] %>" + name = "{{index $.Vars "route_name"}}" network = google_compute_network.network1.name dest_range = "15.0.0.0/24" priority = 1000 diff --git a/mmv1/templates/terraform/examples/workbench_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/workbench_instance_basic.tf.tmpl index 3a2cac94277d..da0d0ef80658 100644 --- a/mmv1/templates/terraform/examples/workbench_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/workbench_instance_basic.tf.tmpl @@ -1,4 +1,4 @@ -resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_workbench_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-west1-a" } diff --git a/mmv1/templates/terraform/examples/workbench_instance_basic_container.tf.tmpl b/mmv1/templates/terraform/examples/workbench_instance_basic_container.tf.tmpl index 55ba370ffee1..e337bf536edd 100644 --- a/mmv1/templates/terraform/examples/workbench_instance_basic_container.tf.tmpl +++ b/mmv1/templates/terraform/examples/workbench_instance_basic_container.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_workbench_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-west1-a" gce_setup { diff --git a/mmv1/templates/terraform/examples/workbench_instance_basic_gpu.tf.tmpl b/mmv1/templates/terraform/examples/workbench_instance_basic_gpu.tf.tmpl index 8bdede64efd0..4f2bff3f8d61 100644 --- a/mmv1/templates/terraform/examples/workbench_instance_basic_gpu.tf.tmpl +++ b/mmv1/templates/terraform/examples/workbench_instance_basic_gpu.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_workbench_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-central1-a" gce_setup { machine_type = "n1-standard-1" // cant be e2 because of accelerator diff --git a/mmv1/templates/terraform/examples/workbench_instance_full.tf.tmpl b/mmv1/templates/terraform/examples/workbench_instance_full.tf.tmpl index 1c2d0fef71a5..2252af59b8e1 100644 --- a/mmv1/templates/terraform/examples/workbench_instance_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/workbench_instance_full.tf.tmpl @@ -1,29 +1,29 @@ resource "google_compute_network" "my_network" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "my_subnetwork" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" network = google_compute_network.my_network.id region = "us-central1" ip_cidr_range = "10.0.1.0/24" } resource "google_compute_address" "static" { - name = "<%= ctx[:vars]['network_name'] %>" + name = "{{index $.Vars "network_name"}}" } resource "google_service_account_iam_binding" "act_as_permission" { - service_account_id = "projects/<%= ctx[:test_env_vars]['project_id'] %>/serviceAccounts/<%= ctx[:test_env_vars]['service_account'] %>" + service_account_id = "projects/{{index $.TestEnvVars "project_id"}}/serviceAccounts/{{index $.TestEnvVars "service_account"}}" role = "roles/iam.serviceAccountUser" members = [ "user:example@example.com", ] } -resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_workbench_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-central1-a" gce_setup { @@ -42,21 +42,21 @@ resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" { disable_public_ip = false service_accounts { - email = "<%= ctx[:test_env_vars]['service_account'] %>" + email = "{{index $.TestEnvVars "service_account"}}" } boot_disk { disk_size_gb = 310 disk_type = "PD_SSD" disk_encryption = "CMEK" - kms_key = "<%= ctx[:vars]['key_name'] %>" + kms_key = "{{index $.Vars "key_name"}}" } data_disks { disk_size_gb = 330 disk_type = "PD_SSD" disk_encryption = "CMEK" - kms_key = "<%= ctx[:vars]['key_name'] %>" + kms_key = "{{index $.Vars "key_name"}}" } network_interfaces { diff --git a/mmv1/templates/terraform/examples/workbench_instance_labels_stopped.tf.tmpl b/mmv1/templates/terraform/examples/workbench_instance_labels_stopped.tf.tmpl index 80d867fccf03..b74825e5446d 100644 --- a/mmv1/templates/terraform/examples/workbench_instance_labels_stopped.tf.tmpl +++ b/mmv1/templates/terraform/examples/workbench_instance_labels_stopped.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['instance_name'] %>" +resource "google_workbench_instance" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "instance_name"}}" location = "us-central1-a" gce_setup { @@ -12,7 +12,7 @@ resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" { } service_accounts { - email = "<%= ctx[:test_env_vars]['service_account'] %>" + email = "{{index $.TestEnvVars "service_account"}}" } metadata = { diff --git a/mmv1/templates/terraform/examples/workflow_basic.tf.tmpl b/mmv1/templates/terraform/examples/workflow_basic.tf.tmpl index a58a127e10b7..4c18dff601d3 100644 --- a/mmv1/templates/terraform/examples/workflow_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/workflow_basic.tf.tmpl @@ -1,10 +1,10 @@ resource "google_service_account" "test_account" { - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Test Service Account" } -resource "google_workflows_workflow" "<%= ctx[:primary_resource_id] %>" { - name = "<%= ctx[:vars]['name'] %>" +resource "google_workflows_workflow" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" region = "us-central1" description = "Magic" service_account = google_service_account.test_account.id diff --git a/mmv1/templates/terraform/examples/workstation_basic.tf.tmpl b/mmv1/templates/terraform/examples/workstation_basic.tf.tmpl index b5432bd1c060..b904e856d41f 100644 --- a/mmv1/templates/terraform/examples/workstation_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_basic.tf.tmpl @@ -1,20 +1,20 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -28,10 +28,10 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id } } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" host { @@ -43,11 +43,11 @@ resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] } } -resource "google_workstations_workstation" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_id = "<%= ctx[:vars]['workstation_name'] %>" - workstation_config_id = google_workstations_workstation_config.<%= ctx[:primary_resource_id] %>.workstation_config_id - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_id = "{{index $.Vars "workstation_name"}}" + workstation_config_id = google_workstations_workstation_config.{{$.PrimaryResourceId}}.workstation_config_id + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" labels = { diff --git a/mmv1/templates/terraform/examples/workstation_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/workstation_cluster_basic.tf.tmpl index 61aac70b30fd..ab3d06a1c739 100644 --- a/mmv1/templates/terraform/examples/workstation_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_cluster_basic.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -20,13 +20,13 @@ data "google_project" "project" { resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name diff --git a/mmv1/templates/terraform/examples/workstation_cluster_custom_domain.tf.tmpl b/mmv1/templates/terraform/examples/workstation_cluster_custom_domain.tf.tmpl index d11e4a828ae2..fa7dfe419a9e 100644 --- a/mmv1/templates/terraform/examples/workstation_cluster_custom_domain.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_cluster_custom_domain.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -28,13 +28,13 @@ data "google_project" "project" { resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name diff --git a/mmv1/templates/terraform/examples/workstation_cluster_private.tf.tmpl b/mmv1/templates/terraform/examples/workstation_cluster_private.tf.tmpl index 167dfb32fa6d..73c063656e5e 100644 --- a/mmv1/templates/terraform/examples/workstation_cluster_private.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_cluster_private.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -24,13 +24,13 @@ data "google_project" "project" { resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name diff --git a/mmv1/templates/terraform/examples/workstation_config_accelerators.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_accelerators.tf.tmpl index c9e819ec40bf..9a7b8a31c4f7 100644 --- a/mmv1/templates/terraform/examples/workstation_config_accelerators.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_accelerators.tf.tmpl @@ -1,20 +1,20 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -28,10 +28,10 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id } } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" host { diff --git a/mmv1/templates/terraform/examples/workstation_config_basic.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_basic.tf.tmpl index a70cc2c0a054..128aae10a59f 100644 --- a/mmv1/templates/terraform/examples/workstation_config_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_basic.tf.tmpl @@ -1,32 +1,32 @@ resource "google_tags_tag_key" "tag_key1" { provider = google-beta - parent = "organizations/<%= ctx[:vars]['org_id'] %>" - short_name = "<%= ctx[:vars]['key_short_name'] %>" + parent = "organizations/{{index $.Vars "org_id"}}" + short_name = "{{index $.Vars "key_short_name"}}" } resource "google_tags_tag_value" "tag_value1" { provider = google-beta parent = "tagKeys/${google_tags_tag_key.tag_key1.name}" - short_name = "<%= ctx[:vars]['value_short_name'] %>" + short_name = "{{index $.Vars "value_short_name"}}" } resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -40,10 +40,10 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id } } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" idle_timeout = "600s" diff --git a/mmv1/templates/terraform/examples/workstation_config_boost.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_boost.tf.tmpl index a9ac67997ed6..39ae0d19bf1d 100644 --- a/mmv1/templates/terraform/examples/workstation_config_boost.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_boost.tf.tmpl @@ -1,20 +1,20 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -28,10 +28,10 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id } } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" host { diff --git a/mmv1/templates/terraform/examples/workstation_config_container.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_container.tf.tmpl index 0e7862559992..725ec74a8c1b 100644 --- a/mmv1/templates/terraform/examples/workstation_config_container.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_container.tf.tmpl @@ -1,20 +1,20 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -28,10 +28,10 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id } } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" host { diff --git a/mmv1/templates/terraform/examples/workstation_config_encryption_key.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_encryption_key.tf.tmpl index bedf3aad7c2d..8ccb2270a7ef 100644 --- a/mmv1/templates/terraform/examples/workstation_config_encryption_key.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_encryption_key.tf.tmpl @@ -1,23 +1,23 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -34,29 +34,29 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id resource "google_kms_key_ring" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" location = "us-central1" } resource "google_kms_crypto_key" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" key_ring = google_kms_key_ring.default.id } resource "google_service_account" "default" { provider = google-beta - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Service Account" } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" host { diff --git a/mmv1/templates/terraform/examples/workstation_config_persistent_directories.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_persistent_directories.tf.tmpl index 21b8807c0412..9cea6e3d900b 100644 --- a/mmv1/templates/terraform/examples/workstation_config_persistent_directories.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_persistent_directories.tf.tmpl @@ -1,20 +1,20 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -28,10 +28,10 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id } } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" host { diff --git a/mmv1/templates/terraform/examples/workstation_config_service_account.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_service_account.tf.tmpl index 18e1b07cbd34..34f193521bbc 100644 --- a/mmv1/templates/terraform/examples/workstation_config_service_account.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_service_account.tf.tmpl @@ -1,20 +1,20 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -31,14 +31,14 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id resource "google_service_account" "default" { provider = google-beta - account_id = "<%= ctx[:vars]['account_id'] %>" + account_id = "{{index $.Vars "account_id"}}" display_name = "Service Account" } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" enable_audit_agent = true diff --git a/mmv1/templates/terraform/examples/workstation_config_shielded_instance_config.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_shielded_instance_config.tf.tmpl index 11f39189959d..0a21d36ac4da 100644 --- a/mmv1/templates/terraform/examples/workstation_config_shielded_instance_config.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_shielded_instance_config.tf.tmpl @@ -1,20 +1,20 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name } -resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" @@ -28,10 +28,10 @@ resource "google_workstations_workstation_cluster" "<%= ctx[:primary_resource_id } } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" - workstation_cluster_id = google_workstations_workstation_cluster.<%= ctx[:primary_resource_id] %>.workstation_cluster_id + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" + workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id location = "us-central1" host { diff --git a/mmv1/templates/terraform/examples/workstation_config_source_snapshot.tf.tmpl b/mmv1/templates/terraform/examples/workstation_config_source_snapshot.tf.tmpl index 9613762fd7a5..f33c6055f079 100644 --- a/mmv1/templates/terraform/examples/workstation_config_source_snapshot.tf.tmpl +++ b/mmv1/templates/terraform/examples/workstation_config_source_snapshot.tf.tmpl @@ -1,12 +1,12 @@ resource "google_compute_network" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { provider = google-beta - name = "<%= ctx[:vars]['workstation_cluster_name'] %>" + name = "{{index $.Vars "workstation_cluster_name"}}" ip_cidr_range = "10.0.0.0/24" region = "us-central1" network = google_compute_network.default.name @@ -14,7 +14,7 @@ resource "google_compute_subnetwork" "default" { resource "google_compute_disk" "my_source_disk" { provider = google-beta - name = "<%= ctx[:vars]['workstation_config_name'] %>" + name = "{{index $.Vars "workstation_config_name"}}" size = 10 type = "pd-ssd" zone = "us-central1-a" @@ -22,22 +22,22 @@ resource "google_compute_disk" "my_source_disk" { resource "google_compute_snapshot" "my_source_snapshot" { provider = google-beta - name = "<%= ctx[:vars]['workstation_config_name'] %>" + name = "{{index $.Vars "workstation_config_name"}}" source_disk = google_compute_disk.my_source_disk.name zone = "us-central1-a" } resource "google_workstations_workstation_cluster" "default" { provider = google-beta - workstation_cluster_id = "<%= ctx[:vars]['workstation_cluster_name'] %>" + workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}" network = google_compute_network.default.id subnetwork = google_compute_subnetwork.default.id location = "us-central1" } -resource "google_workstations_workstation_config" "<%= ctx[:primary_resource_id] %>" { +resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" { provider = google-beta - workstation_config_id = "<%= ctx[:vars]['workstation_config_name'] %>" + workstation_config_id = "{{index $.Vars "workstation_config_name"}}" workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id location = google_workstations_workstation_cluster.default.location diff --git a/mmv1/templates/terraform/extra_schema_entry/bigquery_dataset_access.go.tmpl b/mmv1/templates/terraform/extra_schema_entry/bigquery_dataset_access.go.tmpl index 43c02ebc2482..a6f154a96d76 100644 --- a/mmv1/templates/terraform/extra_schema_entry/bigquery_dataset_access.go.tmpl +++ b/mmv1/templates/terraform/extra_schema_entry/bigquery_dataset_access.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} "api_updated_member": { Type: schema.TypeBool, Computed: true, diff --git a/mmv1/templates/terraform/extra_schema_entry/bigtable_app_profile.go.tmpl b/mmv1/templates/terraform/extra_schema_entry/bigtable_app_profile.go.tmpl index 45ad6a1a181e..aada9ae9cd0c 100644 --- a/mmv1/templates/terraform/extra_schema_entry/bigtable_app_profile.go.tmpl +++ b/mmv1/templates/terraform/extra_schema_entry/bigtable_app_profile.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} "multi_cluster_routing_cluster_ids": { Type: schema.TypeList, Optional: true, diff --git a/mmv1/templates/terraform/extra_schema_entry/firewall.tmpl b/mmv1/templates/terraform/extra_schema_entry/firewall.tmpl index 2997c9083647..9eec75232514 100644 --- a/mmv1/templates/terraform/extra_schema_entry/firewall.tmpl +++ b/mmv1/templates/terraform/extra_schema_entry/firewall.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} "enable_logging": { Type: schema.TypeBool, Optional: true, diff --git a/mmv1/templates/terraform/extra_schema_entry/go/api_config.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/api_config.tmpl deleted file mode 100644 index 2873476f657e..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/api_config.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -"api_config_id_prefix": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ConflictsWith: []string{"api_config_id"}, - Description: `Creates a unique name beginning with the specified prefix. If this and api_config_id are unspecified, a random value is chosen for the name.`, -}, diff --git a/mmv1/templates/terraform/extra_schema_entry/go/bigquery_dataset_access.go.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/bigquery_dataset_access.go.tmpl deleted file mode 100644 index a6f154a96d76..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/bigquery_dataset_access.go.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} -"api_updated_member": { - Type: schema.TypeBool, - Computed: true, - Description: "If true, represents that that the iam_member in the config was translated to a different member type by the API, and is stored in state as a different member type", -}, \ No newline at end of file diff --git a/mmv1/templates/terraform/extra_schema_entry/go/bigtable_app_profile.go.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/bigtable_app_profile.go.tmpl deleted file mode 100644 index aada9ae9cd0c..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/bigtable_app_profile.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -"multi_cluster_routing_cluster_ids": { - Type: schema.TypeList, - Optional: true, - Description: `The set of clusters to route to. The order is ignored; clusters will be tried in order of distance. If left empty, all clusters are eligible.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - ConflictsWith: []string{"single_cluster_routing"}, -}, \ No newline at end of file diff --git a/mmv1/templates/terraform/extra_schema_entry/go/firewall.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/firewall.tmpl deleted file mode 100644 index 9eec75232514..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/firewall.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} -"enable_logging": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - Deprecated: "Deprecated in favor of log_config", - Description: "This field denotes whether to enable logging for a particular firewall rule. If logging is enabled, logs will be exported to Stackdriver.", -}, \ No newline at end of file diff --git a/mmv1/templates/terraform/extra_schema_entry/go/redis_instance.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/redis_instance.tmpl deleted file mode 100644 index fea34e1686d2..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/redis_instance.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -"auth_string": { - Type: schema.TypeString, - Description: "AUTH String set on the instance. This field will only be populated if auth_enabled is true.", - Computed: true, - Sensitive: true, -}, \ No newline at end of file diff --git a/mmv1/templates/terraform/extra_schema_entry/go/route.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/route.tmpl deleted file mode 100644 index 703d043d4696..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/route.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -"next_hop_instance_zone": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Computed: true, - Description: "The zone of the instance specified in next_hop_instance. Omit if next_hop_instance is specified as a URL.", -}, diff --git a/mmv1/templates/terraform/extra_schema_entry/go/secret_version_is_secret_data_base64.go.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/secret_version_is_secret_data_base64.go.tmpl deleted file mode 100644 index 8228154b95cf..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/secret_version_is_secret_data_base64.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} -"is_secret_data_base64": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Default: false, - Description: `If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.`, -}, diff --git a/mmv1/templates/terraform/extra_schema_entry/go/ssl_certificate.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/ssl_certificate.tmpl deleted file mode 100644 index e23b16ed87ec..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/ssl_certificate.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -"name_prefix": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ConflictsWith: []string{"name"}, - Description: "Creates a unique name beginning with the specified prefix. Conflicts with name.", - ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { - // https://cloud.google.com/compute/docs/reference/latest/sslCertificates#resource - // uuid is 9 characters, limit the prefix to 54. - value := v.(string) - if len(value) > 54 { - errors = append(errors, fmt.Errorf( - "%q cannot be longer than 54 characters, name is limited to 63", k)) - } - return - }, -}, diff --git a/mmv1/templates/terraform/extra_schema_entry/go/subnetwork.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/subnetwork.tmpl deleted file mode 100644 index d147fe98e21f..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/subnetwork.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -"fingerprint": { - Type: schema.TypeString, - Computed: true, - Description: "Fingerprint of this resource. This field is used internally during updates of this resource.", - Deprecated: "This field is not useful for users, and has been removed as an output.", -}, diff --git a/mmv1/templates/terraform/extra_schema_entry/go/vertex_ai_featurestore_entitytype.go.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/vertex_ai_featurestore_entitytype.go.tmpl deleted file mode 100644 index ef3520411c52..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/vertex_ai_featurestore_entitytype.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -"region": { - Type: schema.TypeString, - Computed: true, - Description: "The region of the EntityType.", -}, diff --git a/mmv1/templates/terraform/extra_schema_entry/go/vertex_ai_featurestore_entitytype_feature.go.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/vertex_ai_featurestore_entitytype_feature.go.tmpl deleted file mode 100644 index 9f78c3ba2dc5..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/vertex_ai_featurestore_entitytype_feature.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -"region": { - Type: schema.TypeString, - Computed: true, - Description: "The region of the feature", -}, diff --git a/mmv1/templates/terraform/extra_schema_entry/go/workflow.tmpl b/mmv1/templates/terraform/extra_schema_entry/go/workflow.tmpl deleted file mode 100644 index 8696cae22b92..000000000000 --- a/mmv1/templates/terraform/extra_schema_entry/go/workflow.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -"name_prefix": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ConflictsWith: []string{"name"}, -}, diff --git a/mmv1/templates/terraform/extra_schema_entry/secret_version_is_secret_data_base64.go.tmpl b/mmv1/templates/terraform/extra_schema_entry/secret_version_is_secret_data_base64.go.tmpl index 4a7326ae8a22..8228154b95cf 100644 --- a/mmv1/templates/terraform/extra_schema_entry/secret_version_is_secret_data_base64.go.tmpl +++ b/mmv1/templates/terraform/extra_schema_entry/secret_version_is_secret_data_base64.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} "is_secret_data_base64": { Type: schema.TypeBool, Optional: true, diff --git a/mmv1/templates/terraform/extra_schema_entry/subnetwork.tmpl b/mmv1/templates/terraform/extra_schema_entry/subnetwork.tmpl index 0a935cc19ff4..d147fe98e21f 100644 --- a/mmv1/templates/terraform/extra_schema_entry/subnetwork.tmpl +++ b/mmv1/templates/terraform/extra_schema_entry/subnetwork.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} "fingerprint": { Type: schema.TypeString, Computed: true, diff --git a/mmv1/templates/terraform/iam/go/iam_attributes.go.tmpl b/mmv1/templates/terraform/iam/go/iam_attributes.go.tmpl deleted file mode 100644 index 0be3e707e4dd..000000000000 --- a/mmv1/templates/terraform/iam/go/iam_attributes.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{- $primaryResourceId := $.ExamplePrimaryResourceId }} -{{- $ids := $.IamSelfLinkIdentifiers }} -{{- range $i, $attribue := $.IamAttributes}} - {{ $attribue }} = {{ $.IamParentSourceType }}.{{ $primaryResourceId }}.{{ underscore (index $ids $i)}} -{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/iam/go/iam_context.go.tmpl b/mmv1/templates/terraform/iam/go/iam_context.go.tmpl deleted file mode 100644 index 61df201660dd..000000000000 --- a/mmv1/templates/terraform/iam/go/iam_context.go.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -{{- define "IamContext" }} - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - "role": "{{ $.IamPolicy.AllowedIamRole }}", -{{- if $.IamPolicy.AdminIamRole }} - "admin_role": "{{ $.IamPolicy.AdminIamRole }}", -{{- end }} -{{- if $.IamPolicy.TestProjectName }} - "project_id" : fmt.Sprintf("{{ $.IamPolicy.TestProjectName }}%s", acctest.RandString(t, 10)), -{{- end }} -{{- template "EnvVarContext" dict "TestEnvVars" $.FirstTestExample.TestEnvVars "HasNewLine" true}} -{{- if $.FirstTestExample.TestVarsOverrides }} -{{- range $varName, $override := $.FirstTestExample.TestVarsOverrides }} - "{{ $varName }}": {{ $override }}, -{{- end }} -{{- end }} -{{- if $.IamPolicy.IamConditionsRequestType }} - "condition_title": "expires_after_2019_12_31", - "condition_expr": `request.time < timestamp(\"2020-01-01T00:00:00Z\")`, - "condition_desc": "Expiring at midnight of 2019-12-31", - "condition_title_no_desc": "expires_after_2019_12_31-no-description", - "condition_expr_no_desc": `request.time < timestamp(\"2020-01-01T00:00:00Z\")`, -{{- end }} - } -{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/iam/go/iap_web_appengine_diff_suppress.go.tmpl b/mmv1/templates/terraform/iam/go/iap_web_appengine_diff_suppress.go.tmpl deleted file mode 100644 index ebc24d980980..000000000000 --- a/mmv1/templates/terraform/iam/go/iap_web_appengine_diff_suppress.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -func {{$.ResourceName}}DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - newParts := strings.Split(new, "appengine-") - - if len(newParts) == 1 { - // `new` is only the app engine id - // `old` is always a long name - if strings.HasSuffix(old, fmt.Sprintf("appengine-%s", new)) { - return true - } - } - return old == new -} \ No newline at end of file diff --git a/mmv1/templates/terraform/iam/go/sourcerepo_diff_suppress.go.tmpl b/mmv1/templates/terraform/iam/go/sourcerepo_diff_suppress.go.tmpl deleted file mode 100644 index 3e389f734e6e..000000000000 --- a/mmv1/templates/terraform/iam/go/sourcerepo_diff_suppress.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -func {{$.ResourceName}}DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - oldParts := regexp.MustCompile("projects/[^/]+/repos/").Split(old, -1) - if len(oldParts) == 2 { - return oldParts[1] == new - } - return new == old -} \ No newline at end of file diff --git a/mmv1/templates/terraform/iam/go/storage_bucket_diff_suppress.go.tmpl b/mmv1/templates/terraform/iam/go/storage_bucket_diff_suppress.go.tmpl deleted file mode 100644 index 8d54ebd20a15..000000000000 --- a/mmv1/templates/terraform/iam/go/storage_bucket_diff_suppress.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -func {{$.ResourceName}}DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { - return tpgresource.CompareResourceNames("", old, new, nil) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/iam/iam_attributes.go.tmpl b/mmv1/templates/terraform/iam/iam_attributes.go.tmpl index 171e3f258e28..0be3e707e4dd 100644 --- a/mmv1/templates/terraform/iam/iam_attributes.go.tmpl +++ b/mmv1/templates/terraform/iam/iam_attributes.go.tmpl @@ -1,19 +1,5 @@ -<% example = object.examples.reject(&:skip_test) - .reject { |e| @api.version_obj_or_closest(version) < @api.version_obj_or_closest(e.min_version) } - .first -%> -<% if !example -%> -<% example = object.examples - .reject { |e| @api.version_obj_or_closest(version) < @api.version_obj_or_closest(e.min_version) } - .first -%> -<% end -%> -<% self_link_url = object.iam_policy.self_link || object.self_link_url -%> -<% parent_resource_last_param_name = extract_identifiers(self_link_url).last -%> -<% parent_resource_type_type = object.iam_policy.parent_resource_type || resource_ns -%> -<% extract_identifiers(self_link_url).each_with_index do |p, i| -%> -<% if i == extract_identifiers(self_link_url).size - 1 -%> -<% attribute_val = object.iam_policy.parent_resource_attribute || parent_resource_last_param_name.underscore -%> -<% else -%> -<% attribute_val = p.underscore -%> -<% end -%> - <%= attribute_val.underscore -%> = <%= parent_resource_type_type -%>.<%= example.primary_resource_id -%>.<%= p.underscore %> -<% end -%> +{{- $primaryResourceId := $.ExamplePrimaryResourceId }} +{{- $ids := $.IamSelfLinkIdentifiers }} +{{- range $i, $attribue := $.IamAttributes}} + {{ $attribue }} = {{ $.IamParentSourceType }}.{{ $primaryResourceId }}.{{ underscore (index $ids $i)}} +{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/iam/iam_context.go.tmpl b/mmv1/templates/terraform/iam/iam_context.go.tmpl index a05331f10099..61df201660dd 100644 --- a/mmv1/templates/terraform/iam/iam_context.go.tmpl +++ b/mmv1/templates/terraform/iam/iam_context.go.tmpl @@ -1,23 +1,25 @@ -context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - "role": "<%= object.iam_policy.allowed_iam_role -%>", -<% unless object.iam_policy.admin_iam_role.nil? -%> - "admin_role": "<%= object.iam_policy.admin_iam_role-%>", -<% end -%> -<% unless object.iam_policy.test_project_name.nil? -%> - "project_id" : fmt.Sprintf("<%= object.iam_policy.test_project_name -%>%s", acctest.RandString(t, 10)), -<% end -%> -<%= lines(compile(pwd + '/templates/terraform/env_var_context.go.erb')) -%> -<% unless example.test_vars_overrides.nil? -%> -<% example.test_vars_overrides.each do |var_name, override| -%> - "<%= var_name %>": <%= override %>, -<% end -%> -<% end -%> -<% unless object.iam_policy.iam_conditions_request_type.nil? -%> - "condition_title": "expires_after_2019_12_31", - "condition_expr": `request.time < timestamp(\"2020-01-01T00:00:00Z\")`, - "condition_desc": "Expiring at midnight of 2019-12-31", - "condition_title_no_desc": "expires_after_2019_12_31-no-description", - "condition_expr_no_desc": `request.time < timestamp(\"2020-01-01T00:00:00Z\")`, -<% end -%> -} \ No newline at end of file +{{- define "IamContext" }} + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + "role": "{{ $.IamPolicy.AllowedIamRole }}", +{{- if $.IamPolicy.AdminIamRole }} + "admin_role": "{{ $.IamPolicy.AdminIamRole }}", +{{- end }} +{{- if $.IamPolicy.TestProjectName }} + "project_id" : fmt.Sprintf("{{ $.IamPolicy.TestProjectName }}%s", acctest.RandString(t, 10)), +{{- end }} +{{- template "EnvVarContext" dict "TestEnvVars" $.FirstTestExample.TestEnvVars "HasNewLine" true}} +{{- if $.FirstTestExample.TestVarsOverrides }} +{{- range $varName, $override := $.FirstTestExample.TestVarsOverrides }} + "{{ $varName }}": {{ $override }}, +{{- end }} +{{- end }} +{{- if $.IamPolicy.IamConditionsRequestType }} + "condition_title": "expires_after_2019_12_31", + "condition_expr": `request.time < timestamp(\"2020-01-01T00:00:00Z\")`, + "condition_desc": "Expiring at midnight of 2019-12-31", + "condition_title_no_desc": "expires_after_2019_12_31-no-description", + "condition_expr_no_desc": `request.time < timestamp(\"2020-01-01T00:00:00Z\")`, +{{- end }} + } +{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/iam/iap_web_appengine_diff_suppress.go.tmpl b/mmv1/templates/terraform/iam/iap_web_appengine_diff_suppress.go.tmpl index 9ac859987c48..ebc24d980980 100644 --- a/mmv1/templates/terraform/iam/iap_web_appengine_diff_suppress.go.tmpl +++ b/mmv1/templates/terraform/iam/iap_web_appengine_diff_suppress.go.tmpl @@ -1,4 +1,4 @@ -func <%= object.resource_name -%>DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { +func {{$.ResourceName}}DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { newParts := strings.Split(new, "appengine-") if len(newParts) == 1 { diff --git a/mmv1/templates/terraform/iam/sourcerepo_diff_suppress.go.tmpl b/mmv1/templates/terraform/iam/sourcerepo_diff_suppress.go.tmpl index aa8b3cb506e6..3e389f734e6e 100644 --- a/mmv1/templates/terraform/iam/sourcerepo_diff_suppress.go.tmpl +++ b/mmv1/templates/terraform/iam/sourcerepo_diff_suppress.go.tmpl @@ -1,4 +1,4 @@ -func <%= object.resource_name -%>DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { +func {{$.ResourceName}}DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { oldParts := regexp.MustCompile("projects/[^/]+/repos/").Split(old, -1) if len(oldParts) == 2 { return oldParts[1] == new diff --git a/mmv1/templates/terraform/iam/storage_bucket_diff_suppress.go.tmpl b/mmv1/templates/terraform/iam/storage_bucket_diff_suppress.go.tmpl index 7c85beac7793..8d54ebd20a15 100644 --- a/mmv1/templates/terraform/iam/storage_bucket_diff_suppress.go.tmpl +++ b/mmv1/templates/terraform/iam/storage_bucket_diff_suppress.go.tmpl @@ -1,3 +1,3 @@ -func <%= object.resource_name -%>DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { +func {{$.ResourceName}}DiffSuppress(_, old, new string, _ *schema.ResourceData) bool { return tpgresource.CompareResourceNames("", old, new, nil) } \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/KMS_Verify.go.tmpl b/mmv1/templates/terraform/post_create/KMS_Verify.go.tmpl index d75fb1402674..1f3100cba31d 100644 --- a/mmv1/templates/terraform/post_create/KMS_Verify.go.tmpl +++ b/mmv1/templates/terraform/post_create/KMS_Verify.go.tmpl @@ -1,4 +1,4 @@ -url_kms_verify, err := tpgresource.ReplaceVars(d, config, "{{NetappBasePath}}projects/{{project}}/locations/{{location}}/kmsConfigs/{{name}}:verify") +url_kms_verify, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/kmsConfigs/{{"{{"}}name{{"}}"}}:verify") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_create/bigquery_connection_id.go.tmpl b/mmv1/templates/terraform/post_create/bigquery_connection_id.go.tmpl index 67b9ec1ea0a3..a9233e746abe 100644 --- a/mmv1/templates/terraform/post_create/bigquery_connection_id.go.tmpl +++ b/mmv1/templates/terraform/post_create/bigquery_connection_id.go.tmpl @@ -7,7 +7,7 @@ if tpgresource.IsEmptyValue(reflect.ValueOf(d.Get("connection_id"))) { } // Reset id to make sure connection_id is not empty -id2, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/connections/{{connection_id}}") +id2, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/connections/{{"{{"}}connection_id{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/post_create/bigquery_dataset_access.go.tmpl b/mmv1/templates/terraform/post_create/bigquery_dataset_access.go.tmpl index 5621cc2e6c5b..3b21c93806be 100644 --- a/mmv1/templates/terraform/post_create/bigquery_dataset_access.go.tmpl +++ b/mmv1/templates/terraform/post_create/bigquery_dataset_access.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // by default, we are not updating the member if err := d.Set("api_updated_member", false); err != nil { diff --git a/mmv1/templates/terraform/post_create/cloud_scheduler.go.tmpl b/mmv1/templates/terraform/post_create/cloud_scheduler.go.tmpl index 0f6ffc8d5922..19881b2c60bd 100644 --- a/mmv1/templates/terraform/post_create/cloud_scheduler.go.tmpl +++ b/mmv1/templates/terraform/post_create/cloud_scheduler.go.tmpl @@ -5,7 +5,7 @@ if paused, pausedOk := d.GetOk("paused"); pausedOk && paused.(bool) { logSuccessMsg = "Job state has been set to PAUSED" } -linkTmpl := fmt.Sprintf("{{CloudSchedulerBasePath}}projects/{{project}}/locations/{{region}}/jobs/{{name}}:%s", endpoint) +linkTmpl := fmt.Sprintf("{{"{{"}}CloudSchedulerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/jobs/{{"{{"}}name{{"}}"}}:%s", endpoint) url, err = tpgresource.ReplaceVars(d, config, linkTmpl) if err != nil { return err diff --git a/mmv1/templates/terraform/post_create/cloudbuild_bitbucketserver_config.go.tmpl b/mmv1/templates/terraform/post_create/cloudbuild_bitbucketserver_config.go.tmpl index 2c8362d816ad..49f026ce494f 100644 --- a/mmv1/templates/terraform/post_create/cloudbuild_bitbucketserver_config.go.tmpl +++ b/mmv1/templates/terraform/post_create/cloudbuild_bitbucketserver_config.go.tmpl @@ -21,7 +21,7 @@ if v, ok := d.GetOkExists("connected_repositories"); !tpgresource.IsEmptyValue(r obj = make(map[string]interface{}) obj["requests"] = requests - url, err = tpgresource.ReplaceVars(d, config, "{{CloudBuildBasePath}}projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}/connectedRepositories:batchCreate") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudBuildBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}/connectedRepositories:batchCreate") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_create/cloudbuild_trigger_id.go.tmpl b/mmv1/templates/terraform/post_create/cloudbuild_trigger_id.go.tmpl index bc51c030bcd9..e14ecb55adc9 100644 --- a/mmv1/templates/terraform/post_create/cloudbuild_trigger_id.go.tmpl +++ b/mmv1/templates/terraform/post_create/cloudbuild_trigger_id.go.tmpl @@ -9,7 +9,7 @@ if err := d.Set("trigger_id", triggerId.(string)); err != nil { // Store the ID now. We tried to set it before and it failed because // trigger_id didn't exist yet. -id, err = tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/triggers/{{trigger_id}}") +id, err = tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/triggers/{{"{{"}}trigger_id{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/post_create/compute_backend_bucket_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/compute_backend_bucket_security_policy.go.tmpl index cc594d0f20bb..204e0d6f8c12 100644 --- a/mmv1/templates/terraform/post_create/compute_backend_bucket_security_policy.go.tmpl +++ b/mmv1/templates/terraform/post_create/compute_backend_bucket_security_policy.go.tmpl @@ -2,14 +2,14 @@ if o, n := d.GetChange("edge_security_policy"); o.(string) != n.(string) { pol, err := tpgresource.ParseSecurityPolicyFieldValue(n.(string), d, config) if err != nil { - return errwrap.Wrapf("Error parsing Backend Service security policy: {{err}}", err) + return errwrap.Wrapf("Error parsing Backend Service security policy: {{"{{"}}err{{"}}"}}", err) } spr := emptySecurityPolicyReference() spr.SecurityPolicy = pol.RelativeLink() op, err := config.NewComputeClient(userAgent).BackendBuckets.SetEdgeSecurityPolicy(project, obj["name"].(string), spr).Do() if err != nil { - return errwrap.Wrapf("Error setting Backend Service security policy: {{err}}", err) + return errwrap.Wrapf("Error setting Backend Service security policy: {{"{{"}}err{{"}}"}}", err) } // This uses the create timeout for simplicity, though technically this code appears in both create and update waitErr := ComputeOperationWaitTime(config, op, project, "Setting Backend Service Security Policy", userAgent, d.Timeout(schema.TimeoutCreate)) diff --git a/mmv1/templates/terraform/post_create/compute_backend_service_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/compute_backend_service_security_policy.go.tmpl index 0ee0d93b02b7..0d70f9a5e16e 100644 --- a/mmv1/templates/terraform/post_create/compute_backend_service_security_policy.go.tmpl +++ b/mmv1/templates/terraform/post_create/compute_backend_service_security_policy.go.tmpl @@ -2,14 +2,14 @@ if o, n := d.GetChange("security_policy"); o.(string) != n.(string) { pol, err := tpgresource.ParseSecurityPolicyFieldValue(n.(string), d, config) if err != nil { - return errwrap.Wrapf("Error parsing Backend Service security policy: {{err}}", err) + return errwrap.Wrapf("Error parsing Backend Service security policy: {{"{{"}}err{{"}}"}}", err) } spr := emptySecurityPolicyReference() spr.SecurityPolicy = pol.RelativeLink() op, err := config.NewComputeClient(userAgent).BackendServices.SetSecurityPolicy(project, obj["name"].(string), spr).Do() if err != nil { - return errwrap.Wrapf("Error setting Backend Service security policy: {{err}}", err) + return errwrap.Wrapf("Error setting Backend Service security policy: {{"{{"}}err{{"}}"}}", err) } // This uses the create timeout for simplicity, though technically this code appears in both create and update waitErr := ComputeOperationWaitTime(config, op, project, "Setting Backend Service Security Policy", userAgent, d.Timeout(schema.TimeoutCreate)) @@ -21,14 +21,14 @@ if o, n := d.GetChange("security_policy"); o.(string) != n.(string) { if o, n := d.GetChange("edge_security_policy"); o.(string) != n.(string) { pol, err := tpgresource.ParseSecurityPolicyFieldValue(n.(string), d, config) if err != nil { - return errwrap.Wrapf("Error parsing Backend Service edge security policy: {{err}}", err) + return errwrap.Wrapf("Error parsing Backend Service edge security policy: {{"{{"}}err{{"}}"}}", err) } spr := emptySecurityPolicyReference() spr.SecurityPolicy = pol.RelativeLink() op, err := config.NewComputeClient(userAgent).BackendServices.SetEdgeSecurityPolicy(project, obj["name"].(string), spr).Do() if err != nil { - return errwrap.Wrapf("Error setting Backend Service edge security policy: {{err}}", err) + return errwrap.Wrapf("Error setting Backend Service edge security policy: {{"{{"}}err{{"}}"}}", err) } // This uses the create timeout for simplicity, though technically this code appears in both create and update waitErr := ComputeOperationWaitTime(config, op, project, "Setting Backend Service Edge Security Policy", userAgent, d.Timeout(schema.TimeoutCreate)) diff --git a/mmv1/templates/terraform/post_create/compute_region_backend_service_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/compute_region_backend_service_security_policy.go.tmpl index b80146f6077f..e83d020220b5 100644 --- a/mmv1/templates/terraform/post_create/compute_region_backend_service_security_policy.go.tmpl +++ b/mmv1/templates/terraform/post_create/compute_region_backend_service_security_policy.go.tmpl @@ -1,4 +1,4 @@ -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} // security_policy isn't set by Create if v, ok := d.GetOkExists("security_policy"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, securityPolicyProp)) { err = resourceComputeRegionBackendServiceRead(d, meta) @@ -13,7 +13,7 @@ if v, ok := d.GetOkExists("security_policy"); !tpgresource.IsEmptyValue(reflect. } obj["security_policy"] = securityPolicyProp - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/backendServices/{{name}}/setSecurityPolicy") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/backendServices/{{"{{"}}name{{"}}"}}/setSecurityPolicy") if err != nil { return err } @@ -36,4 +36,4 @@ if v, ok := d.GetOkExists("security_policy"); !tpgresource.IsEmptyValue(reflect. return err } } -<% end -%> +{{- end }} diff --git a/mmv1/templates/terraform/post_create/compute_target_instance_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/compute_target_instance_security_policy.go.tmpl index 14dd1fc916aa..e26b30970c46 100644 --- a/mmv1/templates/terraform/post_create/compute_target_instance_security_policy.go.tmpl +++ b/mmv1/templates/terraform/post_create/compute_target_instance_security_policy.go.tmpl @@ -1,4 +1,4 @@ -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} // security_policy isn't set by Create if v, ok := d.GetOkExists("security_policy"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, securityPolicyProp)) { obj := make(map[string]interface{}) @@ -8,7 +8,7 @@ if v, ok := d.GetOkExists("security_policy"); !tpgresource.IsEmptyValue(reflect. } obj["security_policy"] = securityPolicyProp - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}/setSecurityPolicy") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/targetInstances/{{"{{"}}name{{"}}"}}/setSecurityPolicy") if err != nil { return err } @@ -31,4 +31,4 @@ if v, ok := d.GetOkExists("security_policy"); !tpgresource.IsEmptyValue(reflect. return err } } -<% end -%> \ No newline at end of file +{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/datastream_stream.go.tmpl b/mmv1/templates/terraform/post_create/datastream_stream.go.tmpl index 1d916bd6e1d8..6a63968a5bc6 100644 --- a/mmv1/templates/terraform/post_create/datastream_stream.go.tmpl +++ b/mmv1/templates/terraform/post_create/datastream_stream.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} if err := waitForDatastreamStreamReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { return fmt.Errorf("Error waiting for Stream %q to be NOT_STARTED or RUNNING during creation: %q", d.Get("name").(string), err) } diff --git a/mmv1/templates/terraform/post_create/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/post_create/firebase_database_instance.go.tmpl index c23b696f2221..5869fe3cfb77 100644 --- a/mmv1/templates/terraform/post_create/firebase_database_instance.go.tmpl +++ b/mmv1/templates/terraform/post_create/firebase_database_instance.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} // start of customized code if p, ok := d.GetOk("desired_state"); ok && p.(string) == "DISABLED" { diff --git a/mmv1/templates/terraform/post_create/firebasehosting_version_immediate_finalize.tmpl b/mmv1/templates/terraform/post_create/firebasehosting_version_immediate_finalize.tmpl index d21a15d5ac85..21fa8b8d9611 100644 --- a/mmv1/templates/terraform/post_create/firebasehosting_version_immediate_finalize.tmpl +++ b/mmv1/templates/terraform/post_create/firebasehosting_version_immediate_finalize.tmpl @@ -8,7 +8,7 @@ obj = make(map[string]interface{}) obj["status"] = "FINALIZED" - url, err = tpgresource.ReplaceVars(d, config, "{{FirebaseHostingBasePath}}{{name}}") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseHostingBasePath{{"}}"}}{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_create/gcip_tenant.go.tmpl b/mmv1/templates/terraform/post_create/gcip_tenant.go.tmpl index 930c33b84cef..e9a0de49ec1d 100644 --- a/mmv1/templates/terraform/post_create/gcip_tenant.go.tmpl +++ b/mmv1/templates/terraform/post_create/gcip_tenant.go.tmpl @@ -7,7 +7,7 @@ if err := d.Set("name", tpgresource.GetResourceNameFromSelfLink(name.(string))); return fmt.Errorf("Error setting name: %s", err) } // Store the ID now that we have set the computed name -id, err = tpgresource.ReplaceVars(d, config, "projects/{{project}}/tenants/{{name}}") +id, err = tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/tenants/{{"{{"}}name{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/post_create/global_network_endpoint_group.go.tmpl b/mmv1/templates/terraform/post_create/global_network_endpoint_group.go.tmpl index 93c9c7e72ac7..6731a58c4df7 100644 --- a/mmv1/templates/terraform/post_create/global_network_endpoint_group.go.tmpl +++ b/mmv1/templates/terraform/post_create/global_network_endpoint_group.go.tmpl @@ -13,7 +13,7 @@ wrappedReq := map[string]interface{}{ "networkEndpoints": []interface{}{endpointObj}, } -attachUrl, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/global/networkEndpointGroups/{{name}}/attachNetworkEndpoints") +attachUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/global/networkEndpointGroups/{{"{{"}}name{{"}}"}}/attachNetworkEndpoints") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_create/go/KMS_Verify.go.tmpl b/mmv1/templates/terraform/post_create/go/KMS_Verify.go.tmpl deleted file mode 100644 index 1f3100cba31d..000000000000 --- a/mmv1/templates/terraform/post_create/go/KMS_Verify.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -url_kms_verify, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/kmsConfigs/{{"{{"}}name{{"}}"}}:verify") - if err != nil { - return err - } - - res_kms_verify, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url_kms_verify, - UserAgent: userAgent, - Timeout: d.Timeout(schema.TimeoutCreate), - }) - if err != nil { - return fmt.Errorf("Error verifying kmsconfig: %s", err) - } - log.Printf("[DEBUG] Finished verifying kmsconfig : %#v",res_kms_verify) \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/accesspolicy.tmpl b/mmv1/templates/terraform/post_create/go/accesspolicy.tmpl deleted file mode 100644 index b6590cdf11cb..000000000000 --- a/mmv1/templates/terraform/post_create/go/accesspolicy.tmpl +++ /dev/null @@ -1,11 +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 AccessPolicy name, id to %s", name) -if err := d.Set("name", name); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} -d.SetId(name) diff --git a/mmv1/templates/terraform/post_create/go/agent_pool.go.tmpl b/mmv1/templates/terraform/post_create/go/agent_pool.go.tmpl deleted file mode 100644 index 379d65fe7de4..000000000000 --- a/mmv1/templates/terraform/post_create/go/agent_pool.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitForAgentPoolReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Error waiting for AgentPool %q to be CREATED during creation: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/bigquery_connection_id.go.tmpl b/mmv1/templates/terraform/post_create/go/bigquery_connection_id.go.tmpl deleted file mode 100644 index a9233e746abe..000000000000 --- a/mmv1/templates/terraform/post_create/go/bigquery_connection_id.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -if tpgresource.IsEmptyValue(reflect.ValueOf(d.Get("connection_id"))) { - // connection id is set by API when unset 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("connection_id", flattenBigqueryConnectionConnectionConnectionId("", d, config)); err != nil { - return fmt.Errorf("Error reading Connection: %s", err) - } -} - -// Reset id to make sure connection_id is not empty -id2, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/connections/{{"{{"}}connection_id{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id2) \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/bigquery_dataset_access.go.tmpl b/mmv1/templates/terraform/post_create/go/bigquery_dataset_access.go.tmpl deleted file mode 100644 index 3b21c93806be..000000000000 --- a/mmv1/templates/terraform/post_create/go/bigquery_dataset_access.go.tmpl +++ /dev/null @@ -1,40 +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. -*/ -}} - -// by default, we are not updating the member -if err := d.Set("api_updated_member", false); err != nil { - return fmt.Errorf("Error setting api_updated_member: %s", err) -} - -// iam_member is a generalized attribute, if the API can map it to a different member type on the backend, it will return -// the correct member_type in the response. If it cannot be mapped to a different member type, it will stay in iam_member. -if iamMemberProp != "" { - member_type, member, err := resourceBigQueryDatasetAccessReassignIamMemberInNestedObjectList(d, meta, res["access"].([]interface{})) - if err != nil { - fmt.Println(err) - } - - // if the member type changed, we set that member_type in state (it's already in the response) and we clear iam_member - // and we set "api_updated_member" to true to acknowledge that we are making this change - if member_type != "" { - if err := d.Set(member_type, member.(string)); err != nil { - return fmt.Errorf("Error setting member_type: %s", err) - } - if err := d.Set("iam_member", ""); err != nil { - return fmt.Errorf("Error setting iam_member: %s", err) - } - if err := d.Set("api_updated_member", true); err != nil { - return fmt.Errorf("Error setting api_updated_member: %s", err) - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/cloud_asset_feed.go.tmpl b/mmv1/templates/terraform/post_create/go/cloud_asset_feed.go.tmpl deleted file mode 100644 index ea3cf4fe41b0..000000000000 --- a/mmv1/templates/terraform/post_create/go/cloud_asset_feed.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -// Restore the original value of user_project_override. -config.UserProjectOverride = origUserProjectOverride \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/cloud_scheduler.go.tmpl b/mmv1/templates/terraform/post_create/go/cloud_scheduler.go.tmpl deleted file mode 100644 index 19881b2c60bd..000000000000 --- a/mmv1/templates/terraform/post_create/go/cloud_scheduler.go.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -endpoint := "resume" // Default to enabled -logSuccessMsg := "Job state has been set to ENABLED" -if paused, pausedOk := d.GetOk("paused"); pausedOk && paused.(bool) { - endpoint = "pause" - logSuccessMsg = "Job state has been set to PAUSED" -} - -linkTmpl := fmt.Sprintf("{{"{{"}}CloudSchedulerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/jobs/{{"{{"}}name{{"}}"}}:%s", endpoint) -url, err = tpgresource.ReplaceVars(d, config, linkTmpl) -if err != nil { - return err -} - -emptyReqBody := make(map[string]interface{}) - -_, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: emptyReqBody, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) -if err != nil { - return fmt.Errorf("Error setting Cloud Scheduler Job status: %s", err) -} - -log.Printf("[DEBUG] Finished updating Job %q status: %s", d.Id(), logSuccessMsg) \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/cloudbuild_bitbucketserver_config.go.tmpl b/mmv1/templates/terraform/post_create/go/cloudbuild_bitbucketserver_config.go.tmpl deleted file mode 100644 index 49f026ce494f..000000000000 --- a/mmv1/templates/terraform/post_create/go/cloudbuild_bitbucketserver_config.go.tmpl +++ /dev/null @@ -1,50 +0,0 @@ -log.Printf("[DEBUG] Finished creating BitbucketServerConfig without connected repos: %q: %#v", d.Id(), res) - -if v, ok := d.GetOkExists("connected_repositories"); !tpgresource.IsEmptyValue(reflect.ValueOf(connectedRepositoriesProp)) && (ok || !reflect.DeepEqual(v, connectedRepositoriesProp)) { - connectedReposPropArray, ok := connectedRepositoriesProp.([]interface{}) - if !ok { - return fmt.Errorf("Error reading connected_repositories") - } - - requests := make([]interface{}, len(connectedReposPropArray)) - for i := 0; i < len(connectedReposPropArray); i++ { - connectedRepo := make(map[string]interface{}) - connectedRepo["parent"] = id - connectedRepo["repo"] = connectedReposPropArray[i] - - connectedRepoRequest := make(map[string]interface{}) - connectedRepoRequest["parent"] = id - connectedRepoRequest["bitbucketServerConnectedRepository"] = connectedRepo - - requests[i] = connectedRepoRequest - } - obj = make(map[string]interface{}) - obj["requests"] = requests - - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudBuildBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}/connectedRepositories:batchCreate") - if err != nil { - return err - } - - res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutCreate), - }) - if err != nil { - return fmt.Errorf("Error creating connected_repositories: %s", err) - } - - err = CloudBuildOperationWaitTime( - config, res, project, "Creating connected_repositories on BitbucketServerConfig", userAgent, - d.Timeout(schema.TimeoutCreate)) - if err != nil { - return fmt.Errorf("Error waiting to create connected_repositories: %s", err) - } -} else { - log.Printf("[DEBUG] No connected repositories found to create: %#v", connectedRepositoriesProp) -} diff --git a/mmv1/templates/terraform/post_create/go/cloudbuild_trigger_id.go.tmpl b/mmv1/templates/terraform/post_create/go/cloudbuild_trigger_id.go.tmpl deleted file mode 100644 index e14ecb55adc9..000000000000 --- a/mmv1/templates/terraform/post_create/go/cloudbuild_trigger_id.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -// `name` is autogenerated from the api so needs to be set post-create -triggerId, ok := res["id"] -if !ok { - return fmt.Errorf("Create response didn't contain id. Create may not have succeeded.") -} -if err := d.Set("trigger_id", triggerId.(string)); err != nil { - return fmt.Errorf("Error setting trigger_id: %s", err) -} - -// Store the ID now. We tried to set it before and it failed because -// trigger_id didn't exist yet. -id, err = tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/triggers/{{"{{"}}trigger_id{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -// Force legacy id format for global triggers. -id = strings.ReplaceAll(id, "/locations/global/", "/") -d.SetId(id) diff --git a/mmv1/templates/terraform/post_create/go/clouddomains_registration.go.tmpl b/mmv1/templates/terraform/post_create/go/clouddomains_registration.go.tmpl deleted file mode 100644 index e4dbffadddf0..000000000000 --- a/mmv1/templates/terraform/post_create/go/clouddomains_registration.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitForRegistrationActive(d, config, d.Timeout(schema.TimeoutCreate)-time.Minute); err != nil { - return fmt.Errorf("Error waiting for Registration %q to be ACTIVE during creation: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/compute_backend_bucket_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/go/compute_backend_bucket_security_policy.go.tmpl deleted file mode 100644 index 204e0d6f8c12..000000000000 --- a/mmv1/templates/terraform/post_create/go/compute_backend_bucket_security_policy.go.tmpl +++ /dev/null @@ -1,19 +0,0 @@ -// security_policy isn't set by Create / Update -if o, n := d.GetChange("edge_security_policy"); o.(string) != n.(string) { - pol, err := tpgresource.ParseSecurityPolicyFieldValue(n.(string), d, config) - if err != nil { - return errwrap.Wrapf("Error parsing Backend Service security policy: {{"{{"}}err{{"}}"}}", err) - } - - spr := emptySecurityPolicyReference() - spr.SecurityPolicy = pol.RelativeLink() - op, err := config.NewComputeClient(userAgent).BackendBuckets.SetEdgeSecurityPolicy(project, obj["name"].(string), spr).Do() - if err != nil { - return errwrap.Wrapf("Error setting Backend Service security policy: {{"{{"}}err{{"}}"}}", err) - } - // This uses the create timeout for simplicity, though technically this code appears in both create and update - waitErr := ComputeOperationWaitTime(config, op, project, "Setting Backend Service Security Policy", userAgent, d.Timeout(schema.TimeoutCreate)) - if waitErr != nil { - return waitErr - } -} diff --git a/mmv1/templates/terraform/post_create/go/compute_backend_service_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/go/compute_backend_service_security_policy.go.tmpl deleted file mode 100644 index 0d70f9a5e16e..000000000000 --- a/mmv1/templates/terraform/post_create/go/compute_backend_service_security_policy.go.tmpl +++ /dev/null @@ -1,38 +0,0 @@ -// security_policy isn't set by Create / Update -if o, n := d.GetChange("security_policy"); o.(string) != n.(string) { - pol, err := tpgresource.ParseSecurityPolicyFieldValue(n.(string), d, config) - if err != nil { - return errwrap.Wrapf("Error parsing Backend Service security policy: {{"{{"}}err{{"}}"}}", err) - } - - spr := emptySecurityPolicyReference() - spr.SecurityPolicy = pol.RelativeLink() - op, err := config.NewComputeClient(userAgent).BackendServices.SetSecurityPolicy(project, obj["name"].(string), spr).Do() - if err != nil { - return errwrap.Wrapf("Error setting Backend Service security policy: {{"{{"}}err{{"}}"}}", err) - } - // This uses the create timeout for simplicity, though technically this code appears in both create and update - waitErr := ComputeOperationWaitTime(config, op, project, "Setting Backend Service Security Policy", userAgent, d.Timeout(schema.TimeoutCreate)) - if waitErr != nil { - return waitErr - } -} -// edge security_policy isn't set by Create / Update -if o, n := d.GetChange("edge_security_policy"); o.(string) != n.(string) { - pol, err := tpgresource.ParseSecurityPolicyFieldValue(n.(string), d, config) - if err != nil { - return errwrap.Wrapf("Error parsing Backend Service edge security policy: {{"{{"}}err{{"}}"}}", err) - } - - spr := emptySecurityPolicyReference() - spr.SecurityPolicy = pol.RelativeLink() - op, err := config.NewComputeClient(userAgent).BackendServices.SetEdgeSecurityPolicy(project, obj["name"].(string), spr).Do() - if err != nil { - return errwrap.Wrapf("Error setting Backend Service edge security policy: {{"{{"}}err{{"}}"}}", err) - } - // This uses the create timeout for simplicity, though technically this code appears in both create and update - waitErr := ComputeOperationWaitTime(config, op, project, "Setting Backend Service Edge Security Policy", userAgent, d.Timeout(schema.TimeoutCreate)) - if waitErr != nil { - return waitErr - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/compute_network_delete_default_route.tmpl b/mmv1/templates/terraform/post_create/go/compute_network_delete_default_route.tmpl deleted file mode 100644 index 9d9ddbbb33ee..000000000000 --- a/mmv1/templates/terraform/post_create/go/compute_network_delete_default_route.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -if d.Get("delete_default_routes_on_create").(bool) { - token := "" - for paginate := true; paginate; { - network, err := config.NewComputeClient(userAgent).Networks.Get(project, d.Get("name").(string)).Do() - if err != nil { - return fmt.Errorf("Error finding network in proj: %s", err) - } - filter := fmt.Sprintf("(network=\"%s\") AND (destRange=\"0.0.0.0/0\")", network.SelfLink) - log.Printf("[DEBUG] Getting routes for network %q with filter '%q'", d.Get("name").(string), filter) - resp, err := config.NewComputeClient(userAgent).Routes.List(project).Filter(filter).Do() - if err != nil { - return fmt.Errorf("Error listing routes in proj: %s", err) - } - - log.Printf("[DEBUG] Found %d routes rules in %q network", len(resp.Items), d.Get("name").(string)) - - for _, route := range resp.Items { - op, err := config.NewComputeClient(userAgent).Routes.Delete(project, route.Name).Do() - if err != nil { - return fmt.Errorf("Error deleting route: %s", err) - } - err = ComputeOperationWaitTime(config, op, project, "Deleting Route", userAgent, d.Timeout(schema.TimeoutCreate)) - if err != nil { - return err - } - } - - token = resp.NextPageToken - paginate = token != "" - } -} diff --git a/mmv1/templates/terraform/post_create/go/compute_region_backend_service_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/go/compute_region_backend_service_security_policy.go.tmpl deleted file mode 100644 index e83d020220b5..000000000000 --- a/mmv1/templates/terraform/post_create/go/compute_region_backend_service_security_policy.go.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -{{- if ne $.TargetVersionName "ga" }} -// security_policy isn't set by Create -if v, ok := d.GetOkExists("security_policy"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, securityPolicyProp)) { - err = resourceComputeRegionBackendServiceRead(d, meta) - if err != nil { - return err - } - - obj := make(map[string]interface{}) - securityPolicyProp, err := expandComputeRegionBackendServiceSecurityPolicy(v, d, config) - if err != nil { - return err - } - obj["security_policy"] = securityPolicyProp - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/backendServices/{{"{{"}}name{{"}}"}}/setSecurityPolicy") - 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 err != nil { - return fmt.Errorf("Error adding SecurityPolicy to RegionBackendService %q: %s", d.Id(), err) - } - - err = ComputeOperationWaitTime(config, res, project, "Updating RegionBackendService SecurityPolicy", userAgent, d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err - } -} -{{- end }} diff --git a/mmv1/templates/terraform/post_create/go/compute_target_instance_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/go/compute_target_instance_security_policy.go.tmpl deleted file mode 100644 index e26b30970c46..000000000000 --- a/mmv1/templates/terraform/post_create/go/compute_target_instance_security_policy.go.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -{{- if ne $.TargetVersionName "ga" }} -// security_policy isn't set by Create -if v, ok := d.GetOkExists("security_policy"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, securityPolicyProp)) { - obj := make(map[string]interface{}) - securityPolicyProp, err := expandComputeTargetInstanceSecurityPolicy(v, d, config) - if err != nil { - return err - } - obj["security_policy"] = securityPolicyProp - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/targetInstances/{{"{{"}}name{{"}}"}}/setSecurityPolicy") - 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 err != nil { - return fmt.Errorf("Error adding SecurityPolicy to TargetInstance %q: %s", d.Id(), err) - } - - err = ComputeOperationWaitTime(config, res, project, "Updating TargetInstance SecurityPolicy", userAgent, d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err - } -} -{{- end }} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/datastream_stream.go.tmpl b/mmv1/templates/terraform/post_create/go/datastream_stream.go.tmpl deleted file mode 100644 index 6a63968a5bc6..000000000000 --- a/mmv1/templates/terraform/post_create/go/datastream_stream.go.tmpl +++ /dev/null @@ -1,22 +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. -*/ -}} -if err := waitForDatastreamStreamReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Error waiting for Stream %q to be NOT_STARTED or RUNNING during creation: %q", d.Get("name").(string), err) -} - -if d.Get("state") != d.Get("desired_state") { - log.Printf("[DEBUG] Desired state %s not equal to state = %s, updating stream %q", d.Get("desired_state"), d.Get("state"), d.Id()) - if err = resourceDatastreamStreamUpdate(d, meta); err != nil { - return fmt.Errorf("Error updating Stream %q during creation: %q", d.Get("name").(string), err) - } -} diff --git a/mmv1/templates/terraform/post_create/go/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/post_create/go/firebase_database_instance.go.tmpl deleted file mode 100644 index 5869fe3cfb77..000000000000 --- a/mmv1/templates/terraform/post_create/go/firebase_database_instance.go.tmpl +++ /dev/null @@ -1,20 +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. -*/ -}} - -// start of customized code -if p, ok := d.GetOk("desired_state"); ok && p.(string) == "DISABLED" { - if err := disableRTDB(config, d, project, billingProject, userAgent); err != nil { - return err - } -} -// end of customized code diff --git a/mmv1/templates/terraform/post_create/go/firebasehosting_custom_domain_wait_dns_verification.tmpl b/mmv1/templates/terraform/post_create/go/firebasehosting_custom_domain_wait_dns_verification.tmpl deleted file mode 100644 index 3772581bc2bc..000000000000 --- a/mmv1/templates/terraform/post_create/go/firebasehosting_custom_domain_wait_dns_verification.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -if d.Get("wait_dns_verification") == true { - // Wait for the creation operation to complete before treating the resource - // as created - var opRes map[string]interface{} - err = FirebaseHostingOperationWaitTimeWithResponse( - config, res, &opRes, project, "Creating CustomDomain", userAgent, - d.Timeout(schema.TimeoutCreate)) - if err != nil { - // The resource didn't actually create - d.SetId("") - - return fmt.Errorf("Error waiting to create CustomDomain: %s", err) - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/firebasehosting_release.tmpl b/mmv1/templates/terraform/post_create/go/firebasehosting_release.tmpl deleted file mode 100644 index 0c1463abb1c4..000000000000 --- a/mmv1/templates/terraform/post_create/go/firebasehosting_release.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -// Store the name as ID -d.SetId(res["name"].(string)) - -if err = d.Set("release_id", tpgresource.GetResourceNameFromSelfLink(res["name"].(string))); err != nil { - return fmt.Errorf("Error setting release_id: %s", err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/firebasehosting_version_immediate_finalize.tmpl b/mmv1/templates/terraform/post_create/go/firebasehosting_version_immediate_finalize.tmpl deleted file mode 100644 index 21fa8b8d9611..000000000000 --- a/mmv1/templates/terraform/post_create/go/firebasehosting_version_immediate_finalize.tmpl +++ /dev/null @@ -1,39 +0,0 @@ - // Store the name as ID - d.SetId(res["name"].(string)) - - if err = d.Set("version_id", tpgresource.GetResourceNameFromSelfLink(res["name"].(string))); err != nil { - return fmt.Errorf("Error setting version_id: %s", err) - } - - obj = make(map[string]interface{}) - obj["status"] = "FINALIZED" - - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseHostingBasePath{{"}}"}}{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - log.Printf("[DEBUG] Updating Version %q: %#v", d.Id(), obj) - updateMask := []string{} - - updateMask = append(updateMask, "status") - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) - if err != nil { - return err - } - - 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), - }) - - if err != nil { - return fmt.Errorf("Error finalizing Version %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished finalizing Version %q: %#v", d.Id(), res) - } \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/gcip_tenant.go.tmpl b/mmv1/templates/terraform/post_create/go/gcip_tenant.go.tmpl deleted file mode 100644 index e9a0de49ec1d..000000000000 --- a/mmv1/templates/terraform/post_create/go/gcip_tenant.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -// `name` is autogenerated from the api so needs to be set post-create -name, ok := res["name"] -if !ok { - return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.") -} -if err := d.Set("name", tpgresource.GetResourceNameFromSelfLink(name.(string))); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} -// Store the ID now that we have set the computed name -id, err = tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/tenants/{{"{{"}}name{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) diff --git a/mmv1/templates/terraform/post_create/go/global_network_endpoint_group.go.tmpl b/mmv1/templates/terraform/post_create/go/global_network_endpoint_group.go.tmpl deleted file mode 100644 index 6731a58c4df7..000000000000 --- a/mmv1/templates/terraform/post_create/go/global_network_endpoint_group.go.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -endpointObj := make(map[string]interface{}) -if v, ok := d.GetOkExists("fqdn"); !tpgresource.IsEmptyValue(reflect.ValueOf(fqdnProp)) && (ok || !reflect.DeepEqual(v, fqdnProp)) { - endpointObj["fqdn"] = fqdnProp -} -if v, ok := d.GetOkExists("port"); !tpgresource.IsEmptyValue(reflect.ValueOf(portProp)) && (ok || !reflect.DeepEqual(v, portProp)) { - endpointObj["port"] = portProp -} -if v, ok := d.GetOkExists("ip_address"); !tpgresource.IsEmptyValue(reflect.ValueOf(ipAddressProp)) && (ok || !reflect.DeepEqual(v, ipAddressProp)) { - endpointObj["ipAddress"] = ipAddressProp -} - -wrappedReq := map[string]interface{}{ - "networkEndpoints": []interface{}{endpointObj}, -} - -attachUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/global/networkEndpointGroups/{{"{{"}}name{{"}}"}}/attachNetworkEndpoints") -if err != nil { - return err -} - -log.Printf("[DEBUG] Creating new GlobalNetworkEndpoint: %#v", wrappedReq) -_, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: attachUrl, - UserAgent: userAgent, - Body: wrappedReq, - Timeout: d.Timeout(schema.TimeoutCreate), -}) -if err != nil { - return fmt.Errorf("Error creating GlobalNetworkEndpoint: %s", err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/group.tmpl b/mmv1/templates/terraform/post_create/go/group.tmpl deleted file mode 100644 index 158d4b5021e6..000000000000 --- a/mmv1/templates/terraform/post_create/go/group.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -d.SetId(flattenMonitoringGroupName(res["name"]).(string)) -if err := d.Set("name", flattenMonitoringGroupName(res["name"])); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/iam_workforce_pool_provider.go.tmpl b/mmv1/templates/terraform/post_create/go/iam_workforce_pool_provider.go.tmpl deleted file mode 100644 index 56594c36c4ac..000000000000 --- a/mmv1/templates/terraform/post_create/go/iam_workforce_pool_provider.go.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -createdOidcClientSecret := d.Get("oidc.0.client_secret.0.value.0.plain_text") -createdExtraAttributesClientSecret := d.Get("extra_attributes_oauth2_client.0.client_secret.0.value.0.plain_text") - -if (createdOidcClientSecret != nil && createdOidcClientSecret != "") || (createdExtraAttributesClientSecret != nil && createdExtraAttributesClientSecret != "") { - // After the create, reading from the API returns a new thumbprint - // for the client secret value, which clears the plain_text. We set the plain_text since - // this case should not warrant a diff. - if err := resourceIAMWorkforcePoolWorkforcePoolProviderRead(d, meta); err != nil { - return err - } - - // Populate ExtraAttributesOauth2Client the client secret plain text - if createdExtraAttributesClientSecret != nil && createdExtraAttributesClientSecret != "" { - extraAttributesOauth2Client := d.Get("extra_attributes_oauth2_client") - clientSecret := extraAttributesOauth2Client.([]interface{})[0].(map[string]interface{})["client_secret"] - clientSecretValue := clientSecret.([]interface{})[0].(map[string]interface{})["value"] - clientSecretValue.([]interface{})[0].(map[string]interface{})["plain_text"] = createdExtraAttributesClientSecret - if err := d.Set("extra_attributes_oauth2_client", extraAttributesOauth2Client); err != nil { - return err - } - } - - // Populate OIDC the client secret plain text - if createdOidcClientSecret != nil && createdOidcClientSecret != "" { - oidc := d.Get("oidc") - clientSecret := oidc.([]interface{})[0].(map[string]interface{})["client_secret"] - clientSecretValue := clientSecret.([]interface{})[0].(map[string]interface{})["value"] - clientSecretValue.([]interface{})[0].(map[string]interface{})["plain_text"] = createdOidcClientSecret - if err := d.Set("oidc", oidc); err != nil { - return err - } - } - return nil -} - diff --git a/mmv1/templates/terraform/post_create/go/iap_client.go.tmpl b/mmv1/templates/terraform/post_create/go/iap_client.go.tmpl deleted file mode 100644 index 391bc3c6488c..000000000000 --- a/mmv1/templates/terraform/post_create/go/iap_client.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -brand := d.Get("brand") -clientId := flattenIapClientClientId(res["name"], d, config) - -if err := d.Set("client_id", clientId); err != nil { - return fmt.Errorf("Error setting client_id: %s", err) -} -d.SetId(fmt.Sprintf("%s/identityAwareProxyClients/%s", brand, clientId)) diff --git a/mmv1/templates/terraform/post_create/go/index.go.tmpl b/mmv1/templates/terraform/post_create/go/index.go.tmpl deleted file mode 100644 index be0711cb05a8..000000000000 --- a/mmv1/templates/terraform/post_create/go/index.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// The operation for this resource contains the generated name that we need -// in order to perform a READ. -metadata := res["metadata"].(map[string]interface{}) -name := metadata["index"].(string) -log.Printf("[DEBUG] Setting Index name, id to %s", name) -if err := d.Set("name", name); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} -d.SetId(name) diff --git a/mmv1/templates/terraform/post_create/go/integration_connectors_connection.go.tmpl b/mmv1/templates/terraform/post_create/go/integration_connectors_connection.go.tmpl deleted file mode 100644 index 07fd1790b3d6..000000000000 --- a/mmv1/templates/terraform/post_create/go/integration_connectors_connection.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitforConnectionReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Error waiting for Connection %q to finish being in CREATING state during creation: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/interconnect_attachment.go.tmpl b/mmv1/templates/terraform/post_create/go/interconnect_attachment.go.tmpl deleted file mode 100644 index 03e41d0e5da3..000000000000 --- a/mmv1/templates/terraform/post_create/go/interconnect_attachment.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -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) -} diff --git a/mmv1/templates/terraform/post_create/go/kms_autokey_config_folder.go.tmpl b/mmv1/templates/terraform/post_create/go/kms_autokey_config_folder.go.tmpl deleted file mode 100644 index 7404b3c78e93..000000000000 --- a/mmv1/templates/terraform/post_create/go/kms_autokey_config_folder.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -id = strings.Replace(id, "folders/folders/", "folders/", 1) -d.SetId(id) diff --git a/mmv1/templates/terraform/post_create/go/kms_secret_ciphertext.go.tmpl b/mmv1/templates/terraform/post_create/go/kms_secret_ciphertext.go.tmpl deleted file mode 100644 index 112605b2f1a4..000000000000 --- a/mmv1/templates/terraform/post_create/go/kms_secret_ciphertext.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -// we don't set anything on read and instead do it all in create -ciphertext, ok := res["ciphertext"] -if !ok { - return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.") -} -if err := d.Set("ciphertext", ciphertext.(string)); err != nil { - return fmt.Errorf("Error setting ciphertext: %s", err) -} - -id, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}crypto_key{{"}}"}}/{{"{{"}}ciphertext{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) diff --git a/mmv1/templates/terraform/post_create/go/labels.tmpl b/mmv1/templates/terraform/post_create/go/labels.tmpl deleted file mode 100644 index 427d911cee87..000000000000 --- a/mmv1/templates/terraform/post_create/go/labels.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -{{- 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 }} diff --git a/mmv1/templates/terraform/post_create/go/lien.tmpl b/mmv1/templates/terraform/post_create/go/lien.tmpl deleted file mode 100644 index 466d699b1129..000000000000 --- a/mmv1/templates/terraform/post_create/go/lien.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -// This resource is unusual - instead of returning an Operation from -// Create, it returns the created object itself. We don't parse -// any of the values there, preferring to centralize that logic in -// Read(). In this resource, Read is also unusual - it requires -// us to know the server-side generated name of the object we're -// trying to fetch, and the only way to know that is to capture -// it here. The following two lines do that. -d.SetId(flattenNestedResourceManagerLienName(res["name"], d, config).(string)) -if err := d.Set("name", flattenNestedResourceManagerLienName(res["name"], d, config)); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} diff --git a/mmv1/templates/terraform/post_create/go/netapp_volume_replication_post_create.go.tmpl b/mmv1/templates/terraform/post_create/go/netapp_volume_replication_post_create.go.tmpl deleted file mode 100644 index b73fa981dc8a..000000000000 --- a/mmv1/templates/terraform/post_create/go/netapp_volume_replication_post_create.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -if d.Get("wait_for_mirror").(bool) == true { - // Wait for mirrorState=MIRRORED before treating the resource as created - err = NetappVolumeReplicationWaitForMirror(d, meta, "MIRRORED") - if err != nil { - return fmt.Errorf("Error waiting for volume replication to reach mirror_state==MIRRORED: %s", err) - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/notebooks_instance.go.tmpl b/mmv1/templates/terraform/post_create/go/notebooks_instance.go.tmpl deleted file mode 100644 index a70d7cb313a5..000000000000 --- a/mmv1/templates/terraform/post_create/go/notebooks_instance.go.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -if err := waitForNotebooksInstanceActive(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Notebook instance %q did not reach ACTIVE state: %q", d.Get("name").(string), err) -} - -if p, ok := d.GetOk("desired_state"); ok && p.(string) == "STOPPED" { - dRes, err := modifyNotebooksInstanceState(config, d, project, billingProject, userAgent, "stop") - if err != nil { - return err - } - if err := waitForNotebooksOperation(config, d, project, billingProject, userAgent, dRes); err != nil { - return fmt.Errorf("Error stopping Notebook Instance: %s", err) - } -} diff --git a/mmv1/templates/terraform/post_create/go/org_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/go/org_security_policy.go.tmpl deleted file mode 100644 index fe59801b201e..000000000000 --- a/mmv1/templates/terraform/post_create/go/org_security_policy.go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -parent := d.Get("parent").(string) -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, parent, "Creating OrganizationSecurityPolicy", userAgent, - d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually create - d.SetId("") - return fmt.Errorf("Error waiting to create OrganizationSecurityPolicy: %s", err) -} - -policyId, ok := opRes["targetId"] -if !ok { - return fmt.Errorf("Create response didn't contain targetId. Create may not have succeeded.") -} -if err := d.Set("policy_id", policyId.(string)); err != nil { - return fmt.Errorf("Error setting policy_id: %s", err) -} - -// Store the ID now. -id, err = tpgresource.ReplaceVars(d, config, "locations/global/securityPolicies/{{"{{"}}policy_id{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) diff --git a/mmv1/templates/terraform/post_create/go/org_security_policy_association.go.tmpl b/mmv1/templates/terraform/post_create/go/org_security_policy_association.go.tmpl deleted file mode 100644 index 6a2f47f6eefd..000000000000 --- a/mmv1/templates/terraform/post_create/go/org_security_policy_association.go.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -// `parent` is needed to poll the asynchronous operations but its available only on the policy. - -policyUrl := fmt.Sprintf("{{"{{"}}ComputeBasePath{{"}}"}}%s", d.Get("policy_id")) -url, err = tpgresource.ReplaceVars(d, config, policyUrl) -if err != nil { - return err -} - -policyRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: userAgent, -}) -if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ComputeOrganizationSecurityPolicy %q", d.Get("policy_id"))) -} - -parent := flattenComputeOrganizationSecurityPolicyParent(policyRes["parent"], d, config) -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, parent.(string), "Creating OrganizationSecurityPolicyAssociation", userAgent, - d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually create - d.SetId("") - return fmt.Errorf("Error waiting to create OrganizationSecurityPolicyAssociation: %s", err) -} diff --git a/mmv1/templates/terraform/post_create/go/org_security_policy_rule.go.tmpl b/mmv1/templates/terraform/post_create/go/org_security_policy_rule.go.tmpl deleted file mode 100644 index 201ad072e5f3..000000000000 --- a/mmv1/templates/terraform/post_create/go/org_security_policy_rule.go.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -// `parent` is needed to poll the asynchronous operations but its available only on the policy. - -policyUrl := fmt.Sprintf("{{"{{"}}ComputeBasePath{{"}}"}}%s", d.Get("policy_id")) -url, err = tpgresource.ReplaceVars(d, config, policyUrl) -if err != nil { - return err -} - -policyRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - RawURL: url, - UserAgent: userAgent, -}) -if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ComputeOrganizationSecurityPolicy %q", d.Get("policy_id"))) -} - -parent := flattenComputeOrganizationSecurityPolicyParent(policyRes["parent"], d, config) -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, parent.(string), "Creating OrganizationSecurityPolicyRule", userAgent, - d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually create - d.SetId("") - return fmt.Errorf("Error waiting to create OrganizationSecurityPolicyRule: %s", err) -} diff --git a/mmv1/templates/terraform/post_create/go/private_connection.go.tmpl b/mmv1/templates/terraform/post_create/go/private_connection.go.tmpl deleted file mode 100644 index 7bd986d100bb..000000000000 --- a/mmv1/templates/terraform/post_create/go/private_connection.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitForPrivateConnectionReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Error waiting for PrivateConnection %q to be CREATED. %q", d.Get("name").(string), err) -} diff --git a/mmv1/templates/terraform/post_create/go/privateca_certificate_authority.go.tmpl b/mmv1/templates/terraform/post_create/go/privateca_certificate_authority.go.tmpl deleted file mode 100644 index fac4ffece9ef..000000000000 --- a/mmv1/templates/terraform/post_create/go/privateca_certificate_authority.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -staged := d.Get("type").(string) == "SELF_SIGNED" - -if d.Get("type").(string) == "SUBORDINATE" { - if _, ok := d.GetOk("subordinate_config"); ok { - // First party issuer - log.Printf("[DEBUG] Activating CertificateAuthority with first party issuer") - if err := activateSubCAWithFirstPartyIssuer(config, d, project, billingProject, userAgent); err != nil { - return fmt.Errorf("Error activating subordinate CA with first party issuer: %v", err) - } - staged = true - log.Printf("[DEBUG] CertificateAuthority activated") - } -} - - -// Enable the CA if `desired_state` is unspecified or specified as `ENABLED`. -if p, ok := d.GetOk("desired_state"); !ok || p.(string) == "ENABLED" { - // Skip enablement on SUBORDINATE CA for backward compatible. - if staged { - if err := enableCA(config, d, project, billingProject, userAgent); err != nil { - return fmt.Errorf("Error enabling CertificateAuthority: %v", err) - } - } -} diff --git a/mmv1/templates/terraform/post_create/go/resource_compute_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/post_create/go/resource_compute_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index 399d97ec29fb..000000000000 --- a/mmv1/templates/terraform/post_create/go/resource_compute_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,56 +0,0 @@ -parent := d.Get("parent").(string) -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, parent, "Creating FirewallPolicy", 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) -} - -policyId, ok := opRes["targetId"] -if !ok { - return fmt.Errorf("Create response didn't contain targetId. Create may not have succeeded.") -} -if err := d.Set("policy_id", policyId.(string)); err != nil { - return fmt.Errorf("Error setting policy_id: %s", err) -} - -// Store the ID now. -id, err = tpgresource.ReplaceVars(d, config, "locations/global/firewallPolicies/{{"{{"}}policy_id{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) - -url, err = tpgresource.ReplaceVarsForId(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}locations/global/firewallPolicies/{{"{{"}}policy_id{{"}}"}}") -if err != nil { - return err -} - -headers = make(http.Header) -res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Headers: headers, -}) -if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ComputeFirewallPolicyWithRules %q", d.Id())) -} - -if err := d.Set("fingerprint", flattenComputeFirewallPolicyWithRulesFingerprint(res["fingerprint"], d, config)); err != nil { - return fmt.Errorf("Error reading FirewallPolicyWithRules: %s", err) -} - -res, err = resourceComputeFirewallPolicyWithRulesDecoder(d, meta, res) -if err != nil { - return err -} - -log.Printf("[DEBUG] Updating FirewallPolicyWithRules %q", d.Id()) -return resourceComputeFirewallPolicyWithRulesUpdate(d, meta) diff --git a/mmv1/templates/terraform/post_create/go/resource_compute_network_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/post_create/go/resource_compute_network_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index ebc4901aa798..000000000000 --- a/mmv1/templates/terraform/post_create/go/resource_compute_network_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -log.Printf("[DEBUG] Post-create for NetworkFirewallPolicyWithRules %q", d.Id()) - -url, err = tpgresource.ReplaceVarsForId(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/global/firewallPolicies/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} - -headers = make(http.Header) -res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Headers: headers, -}) -if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ComputeNetworkFirewallPolicyWithRules %q", d.Id())) -} - -if err := d.Set("fingerprint", flattenComputeNetworkFirewallPolicyWithRulesFingerprint(res["fingerprint"], d, config)); err != nil { - return fmt.Errorf("Error reading NetworkFirewallPolicyWithRules: %s", err) -} - -res, err = resourceComputeNetworkFirewallPolicyWithRulesDecoder(d, meta, res) -if err != nil { - return err -} - -log.Printf("[DEBUG] Updating NetworkFirewallPolicyWithRules %q", d.Id()) -return resourceComputeNetworkFirewallPolicyWithRulesUpdate(d, meta) diff --git a/mmv1/templates/terraform/post_create/go/secret_version.go.tmpl b/mmv1/templates/terraform/post_create/go/secret_version.go.tmpl deleted file mode 100644 index a718b67bee3a..000000000000 --- a/mmv1/templates/terraform/post_create/go/secret_version.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -// `name` is autogenerated from the api so needs to be set post-create -name, ok := res["name"] -if !ok { - return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.") -} -if err := d.Set("name", name.(string)); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} -d.SetId(name.(string)) - -_, err = expandSecretManagerSecretVersionEnabled(d.Get("enabled"), d, config) -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/set_computed_name.tmpl b/mmv1/templates/terraform/post_create/go/set_computed_name.tmpl deleted file mode 100644 index bd3ed030748b..000000000000 --- a/mmv1/templates/terraform/post_create/go/set_computed_name.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -// `name` is autogenerated from the api so needs to be set post-create -name, ok := res["name"] -if !ok { - respBody, ok := res["response"] - if !ok { - return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.") - } - - name, ok = respBody.(map[string]interface{})["name"] - if !ok { - return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.") - } -} -if err := d.Set("name", name.(string)); err != nil { - return fmt.Errorf("Error setting name: %s", err) -} -d.SetId(name.(string)) diff --git a/mmv1/templates/terraform/post_create/go/sleep.go.tmpl b/mmv1/templates/terraform/post_create/go/sleep.go.tmpl deleted file mode 100644 index 30b726f3bebc..000000000000 --- a/mmv1/templates/terraform/post_create/go/sleep.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// This is useful if the resource in question doesn't have a perfectly consistent API -// That is, the Operation for Create might return before the Get operation shows the -// completed state of the resource. -time.Sleep(5 * time.Second) diff --git a/mmv1/templates/terraform/post_create/go/sleep_2_min.go.tmpl b/mmv1/templates/terraform/post_create/go/sleep_2_min.go.tmpl deleted file mode 100644 index df48ca805713..000000000000 --- a/mmv1/templates/terraform/post_create/go/sleep_2_min.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// This is useful if the resource in question doesn't have a perfectly consistent API -// That is, the Operation for Create might return before the Get operation shows the -// completed state of the resource. -time.Sleep(2 * time.Minute) diff --git a/mmv1/templates/terraform/post_create/go/source_repo_repository_update.go.tmpl b/mmv1/templates/terraform/post_create/go/source_repo_repository_update.go.tmpl deleted file mode 100644 index 82a1b3402630..000000000000 --- a/mmv1/templates/terraform/post_create/go/source_repo_repository_update.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -if v, ok := d.GetOkExists("pubsub_configs"); !tpgresource.IsEmptyValue(reflect.ValueOf(pubsubConfigsProp)) && (ok || !reflect.DeepEqual(v, pubsubConfigsProp)) { - log.Printf("[DEBUG] Calling update after create to patch in pubsub_configs") - // pubsub_configs cannot be added on create - return resourceSourceRepoRepositoryUpdate(d, meta) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/spanner_database.go.tmpl b/mmv1/templates/terraform/post_create/go/spanner_database.go.tmpl deleted file mode 100644 index b49f43559e4d..000000000000 --- a/mmv1/templates/terraform/post_create/go/spanner_database.go.tmpl +++ /dev/null @@ -1,107 +0,0 @@ -// Note: Databases that are created with POSTGRESQL dialect do not support extra DDL -// statements at the time of database creation. To avoid users needing to run -// `terraform apply` twice to get their desired outcome, the provider does not set -// `extraStatements` in the call to the `create` endpoint and all DDL (other than -// ) is run post-create, by calling the `updateDdl` endpoint - -_, ok := opRes["name"] -if !ok { - return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.") -} - -retention, retentionPeriodOk := d.GetOk("version_retention_period") -retentionPeriod := retention.(string) -ddl, ddlOk := d.GetOk("ddl") -ddlStatements := ddl.([]interface{}) - -if retentionPeriodOk || ddlOk { - - obj := make(map[string]interface{}) - updateDdls := []string{} - - if ddlOk { - for i := 0; i < len(ddlStatements); i++ { - if ddlStatements[i] != nil { - updateDdls = append(updateDdls, ddlStatements[i].(string)) - } - } - } - - if retentionPeriodOk { - dbName := d.Get("name") - retentionDdl := fmt.Sprintf("ALTER DATABASE `%s` SET OPTIONS (version_retention_period=\"%s\")", dbName, retentionPeriod) - if dialect, ok := d.GetOk("database_dialect"); ok && dialect == "POSTGRESQL" { - retentionDdl = fmt.Sprintf("ALTER DATABASE \"%s\" SET spanner.version_retention_period TO \"%s\"", dbName, retentionPeriod) - } - updateDdls = append(updateDdls, retentionDdl) - } - - // Skip API call if there are no new ddl entries (due to ignoring nil values) - if len(updateDdls) > 0 { - log.Printf("[DEBUG] Applying extra DDL statements to the new Database: %#v", updateDdls) - - obj["statements"] = updateDdls - - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}SpannerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/instances/{{"{{"}}instance{{"}}"}}/databases/{{"{{"}}name{{"}}"}}/ddl") - if err != nil { - return err - } - - 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), - }) - if err != nil { - return fmt.Errorf("Error executing DDL statements on Database: %s", err) - } - - // Use the resource in the operation response to populate - // identity fields and d.Id() before read - var opRes map[string]interface{} - err = SpannerOperationWaitTimeWithResponse( - config, res, &opRes, project, "Creating Database", userAgent, - d.Timeout(schema.TimeoutCreate)) - if err != nil { - // The resource didn't actually create - d.SetId("") - return fmt.Errorf("Error waiting to run DDL against newly-created Database: %s", err) - } - } -} - -enableDropProtection, enableDropProtectionOk := d.GetOk("enable_drop_protection") -dropProtection := enableDropProtection.(bool) -if enableDropProtectionOk && dropProtection { - updateMask := []string{"enableDropProtection"} - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SpannerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/instances/{{"{{"}}instance{{"}}"}}/databases/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - // 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 - } - obj := map[string]interface{}{"enableDropProtection": dropProtection} - 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), - }) - if err != nil { - return fmt.Errorf("Error updating enableDropDatabaseProtection on Database: %s", err) - } else { - log.Printf("[DEBUG] Finished updating enableDropDatabaseProtection %q: %#v", d.Id(), res) - } -} - diff --git a/mmv1/templates/terraform/post_create/go/sshkeyfingerprint.go.tmpl b/mmv1/templates/terraform/post_create/go/sshkeyfingerprint.go.tmpl deleted file mode 100644 index 87964bac14b9..000000000000 --- a/mmv1/templates/terraform/post_create/go/sshkeyfingerprint.go.tmpl +++ /dev/null @@ -1,23 +0,0 @@ - -loginProfile, ok := res["loginProfile"] -if !ok { - return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.") -} - -// `fingerprint` is autogenerated from the api so needs to be set post-create -sshPublicKeys := loginProfile.(map[string]interface{})["sshPublicKeys"] -for _,sshPublicKey := range sshPublicKeys.(map[string]interface{}) { - if sshPublicKey.(map[string]interface{})["key"].(string)== d.Get("key") { - if err := d.Set("fingerprint", sshPublicKey.(map[string]interface{})["fingerprint"].(string)); err != nil { - return fmt.Errorf("Error setting fingerprint: %s", err) - } - break - } -} - -// Store the ID now -id, err = tpgresource.ReplaceVars(d, config, "users/{{"{{"}}user{{"}}"}}/sshPublicKeys/{{"{{"}}fingerprint{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} -d.SetId(id) \ No newline at end of file diff --git a/mmv1/templates/terraform/post_create/go/storage_hmac_key.go.tmpl b/mmv1/templates/terraform/post_create/go/storage_hmac_key.go.tmpl deleted file mode 100644 index 42999c347a67..000000000000 --- a/mmv1/templates/terraform/post_create/go/storage_hmac_key.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -// `secret` and `access_id` are generated by the API upon successful CREATE. The following -// ensures terraform has the correct values based on the Projects.hmacKeys response object. -secret, ok := res["secret"].(string) -if !ok { - return fmt.Errorf("The response to CREATE was missing an expected field. Your create did not work.") -} - -if err := d.Set("secret", secret); err != nil { - return fmt.Errorf("Error setting secret: %s", err) -} - -metadata := res["metadata"].(map[string]interface{}) -accessId, ok := metadata["accessId"].(string) -if !ok { - return fmt.Errorf("The response to CREATE was missing an expected field. Your create did not work.") -} - -if err := d.Set("access_id", accessId); err != nil { - return fmt.Errorf("Error setting access_id: %s", err) -} - -id, err = tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/hmacKeys/{{"{{"}}access_id{{"}}"}}") -if err != nil { - return fmt.Errorf("Error constructing id: %s", err) -} - -d.SetId(id) diff --git a/mmv1/templates/terraform/post_create/go/workbench_instance.go.tmpl b/mmv1/templates/terraform/post_create/go/workbench_instance.go.tmpl deleted file mode 100644 index 25128f95f821..000000000000 --- a/mmv1/templates/terraform/post_create/go/workbench_instance.go.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -if err := waitForWorkbenchInstanceActive(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Workbench instance %q did not reach ACTIVE state: %q", d.Get("name").(string), err) -} - -if p, ok := d.GetOk("desired_state"); ok && p.(string) == "STOPPED" { - dRes, err := modifyWorkbenchInstanceState(config, d, project, billingProject, userAgent, "stop") - if err != nil { - return err - } - if err := waitForWorkbenchOperation(config, d, project, billingProject, userAgent, dRes); err != nil { - return fmt.Errorf("Error stopping Workbench Instance: %s", err) - } -} diff --git a/mmv1/templates/terraform/post_create/index.go.tmpl b/mmv1/templates/terraform/post_create/index.go.tmpl index c87e6bc9b20b..be0711cb05a8 100644 --- a/mmv1/templates/terraform/post_create/index.go.tmpl +++ b/mmv1/templates/terraform/post_create/index.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // The operation for this resource contains the generated name that we need // in order to perform a READ. metadata := res["metadata"].(map[string]interface{}) diff --git a/mmv1/templates/terraform/post_create/kms_secret_ciphertext.go.tmpl b/mmv1/templates/terraform/post_create/kms_secret_ciphertext.go.tmpl index 5b93ba34204d..112605b2f1a4 100644 --- a/mmv1/templates/terraform/post_create/kms_secret_ciphertext.go.tmpl +++ b/mmv1/templates/terraform/post_create/kms_secret_ciphertext.go.tmpl @@ -7,7 +7,7 @@ if err := d.Set("ciphertext", ciphertext.(string)); err != nil { return fmt.Errorf("Error setting ciphertext: %s", err) } -id, err = tpgresource.ReplaceVars(d, config, "{{crypto_key}}/{{ciphertext}}") +id, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}crypto_key{{"}}"}}/{{"{{"}}ciphertext{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/post_create/labels.tmpl b/mmv1/templates/terraform/post_create/labels.tmpl index f49515d97832..427d911cee87 100644 --- a/mmv1/templates/terraform/post_create/labels.tmpl +++ b/mmv1/templates/terraform/post_create/labels.tmpl @@ -1,17 +1,17 @@ -<% if object.properties.any?{ |p| p.name == "labels" } -%> +{{- 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<%= object.resource_name -%>Read(d, meta) + 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<%= object.resource_name -%>EffectiveLabels(v, d, config) + labelsProp, err := expand{{$.ResourceName}}EffectiveLabels(v, d, config) if err != nil { return err } @@ -19,7 +19,7 @@ if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect labelFingerprintProp := d.Get("label_fingerprint") obj["labelFingerprint"] = labelFingerprintProp - url, err = tpgresource.ReplaceVars(d, config, "{{<%=object.__product.name-%>BasePath}}<%=object.self_link_uri-%>/setLabels") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.SelfLinkUri}}/setLabels") if err != nil { return err } @@ -30,19 +30,19 @@ if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect RawURL: url, UserAgent: userAgent, Body: obj, - <% if object.error_retry_predicates -%> - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_retry_predicates.join(',') -%>}, - <% end -%> - <% if object.error_abort_predicates -%> - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_abort_predicates.join(',') -%>}, - <% end -%> + {{- 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 <%= object.resource_name -%> %q: %s", d.Id(), err) + return fmt.Errorf("Error adding labels to {{$.ResourceName}} %q: %s", d.Id(), err) } err = ComputeOperationWaitTime( - config, res, project, "Updating <%= object.resource_name -%> Labels", userAgent, + config, res, project, "Updating {{$.ResourceName}} Labels", userAgent, d.Timeout(schema.TimeoutUpdate)) if err != nil { @@ -64,4 +64,4 @@ if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect return fmt.Errorf("Error setting back effective_labels: %s", err) } } -<% end -%> +{{- end }} diff --git a/mmv1/templates/terraform/post_create/org_security_policy.go.tmpl b/mmv1/templates/terraform/post_create/org_security_policy.go.tmpl index a1161b2bb857..fe59801b201e 100644 --- a/mmv1/templates/terraform/post_create/org_security_policy.go.tmpl +++ b/mmv1/templates/terraform/post_create/org_security_policy.go.tmpl @@ -19,7 +19,7 @@ if err := d.Set("policy_id", policyId.(string)); err != nil { } // Store the ID now. -id, err = tpgresource.ReplaceVars(d, config, "locations/global/securityPolicies/{{policy_id}}") +id, err = tpgresource.ReplaceVars(d, config, "locations/global/securityPolicies/{{"{{"}}policy_id{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/post_create/org_security_policy_association.go.tmpl b/mmv1/templates/terraform/post_create/org_security_policy_association.go.tmpl index 1d48fa0111a4..6a2f47f6eefd 100644 --- a/mmv1/templates/terraform/post_create/org_security_policy_association.go.tmpl +++ b/mmv1/templates/terraform/post_create/org_security_policy_association.go.tmpl @@ -1,6 +1,6 @@ // `parent` is needed to poll the asynchronous operations but its available only on the policy. -policyUrl := fmt.Sprintf("{{ComputeBasePath}}%s", d.Get("policy_id")) +policyUrl := fmt.Sprintf("{{"{{"}}ComputeBasePath{{"}}"}}%s", d.Get("policy_id")) url, err = tpgresource.ReplaceVars(d, config, policyUrl) if err != nil { return err diff --git a/mmv1/templates/terraform/post_create/org_security_policy_rule.go.tmpl b/mmv1/templates/terraform/post_create/org_security_policy_rule.go.tmpl index 76a0462a4833..201ad072e5f3 100644 --- a/mmv1/templates/terraform/post_create/org_security_policy_rule.go.tmpl +++ b/mmv1/templates/terraform/post_create/org_security_policy_rule.go.tmpl @@ -1,6 +1,6 @@ // `parent` is needed to poll the asynchronous operations but its available only on the policy. -policyUrl := fmt.Sprintf("{{ComputeBasePath}}%s", d.Get("policy_id")) +policyUrl := fmt.Sprintf("{{"{{"}}ComputeBasePath{{"}}"}}%s", d.Get("policy_id")) url, err = tpgresource.ReplaceVars(d, config, policyUrl) if err != nil { return err diff --git a/mmv1/templates/terraform/post_create/resource_compute_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/post_create/resource_compute_firewall_policy_with_rules.go.tmpl index 07f879af397a..399d97ec29fb 100644 --- a/mmv1/templates/terraform/post_create/resource_compute_firewall_policy_with_rules.go.tmpl +++ b/mmv1/templates/terraform/post_create/resource_compute_firewall_policy_with_rules.go.tmpl @@ -19,13 +19,13 @@ if err := d.Set("policy_id", policyId.(string)); err != nil { } // Store the ID now. -id, err = tpgresource.ReplaceVars(d, config, "locations/global/firewallPolicies/{{policy_id}}") +id, err = tpgresource.ReplaceVars(d, config, "locations/global/firewallPolicies/{{"{{"}}policy_id{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } d.SetId(id) -url, err = tpgresource.ReplaceVarsForId(d, config, "{{ComputeBasePath}}locations/global/firewallPolicies/{{policy_id}}") +url, err = tpgresource.ReplaceVarsForId(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}locations/global/firewallPolicies/{{"{{"}}policy_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_create/resource_compute_network_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/post_create/resource_compute_network_firewall_policy_with_rules.go.tmpl index ec4b1a1c5ce1..ebc4901aa798 100644 --- a/mmv1/templates/terraform/post_create/resource_compute_network_firewall_policy_with_rules.go.tmpl +++ b/mmv1/templates/terraform/post_create/resource_compute_network_firewall_policy_with_rules.go.tmpl @@ -1,6 +1,6 @@ log.Printf("[DEBUG] Post-create for NetworkFirewallPolicyWithRules %q", d.Id()) -url, err = tpgresource.ReplaceVarsForId(d, config, "{{ComputeBasePath}}projects/{{project}}/global/firewallPolicies/{{name}}") +url, err = tpgresource.ReplaceVarsForId(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/global/firewallPolicies/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_create/spanner_database.go.tmpl b/mmv1/templates/terraform/post_create/spanner_database.go.tmpl index 23897fef9632..b49f43559e4d 100644 --- a/mmv1/templates/terraform/post_create/spanner_database.go.tmpl +++ b/mmv1/templates/terraform/post_create/spanner_database.go.tmpl @@ -42,7 +42,7 @@ if retentionPeriodOk || ddlOk { obj["statements"] = updateDdls - url, err = tpgresource.ReplaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}/ddl") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}SpannerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/instances/{{"{{"}}instance{{"}}"}}/databases/{{"{{"}}name{{"}}"}}/ddl") if err != nil { return err } @@ -78,7 +78,7 @@ enableDropProtection, enableDropProtectionOk := d.GetOk("enable_drop_protection" dropProtection := enableDropProtection.(bool) if enableDropProtectionOk && dropProtection { updateMask := []string{"enableDropProtection"} - url, err := tpgresource.ReplaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{instance}}/databases/{{name}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SpannerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/instances/{{"{{"}}instance{{"}}"}}/databases/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_create/sshkeyfingerprint.go.tmpl b/mmv1/templates/terraform/post_create/sshkeyfingerprint.go.tmpl index 9f602695e478..87964bac14b9 100644 --- a/mmv1/templates/terraform/post_create/sshkeyfingerprint.go.tmpl +++ b/mmv1/templates/terraform/post_create/sshkeyfingerprint.go.tmpl @@ -16,7 +16,7 @@ for _,sshPublicKey := range sshPublicKeys.(map[string]interface{}) { } // Store the ID now -id, err = tpgresource.ReplaceVars(d, config, "users/{{user}}/sshPublicKeys/{{fingerprint}}") +id, err = tpgresource.ReplaceVars(d, config, "users/{{"{{"}}user{{"}}"}}/sshPublicKeys/{{"{{"}}fingerprint{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/post_create/storage_hmac_key.go.tmpl b/mmv1/templates/terraform/post_create/storage_hmac_key.go.tmpl index 20b19f76c287..42999c347a67 100644 --- a/mmv1/templates/terraform/post_create/storage_hmac_key.go.tmpl +++ b/mmv1/templates/terraform/post_create/storage_hmac_key.go.tmpl @@ -19,7 +19,7 @@ if err := d.Set("access_id", accessId); err != nil { return fmt.Errorf("Error setting access_id: %s", err) } -id, err = tpgresource.ReplaceVars(d, config, "projects/{{project}}/hmacKeys/{{access_id}}") +id, err = tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/hmacKeys/{{"{{"}}access_id{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/post_create_failure/delete_on_failure.go.tmpl b/mmv1/templates/terraform/post_create_failure/delete_on_failure.go.tmpl index e7ee1aa003ee..c837747bffba 100644 --- a/mmv1/templates/terraform/post_create_failure/delete_on_failure.go.tmpl +++ b/mmv1/templates/terraform/post_create_failure/delete_on_failure.go.tmpl @@ -1,14 +1,14 @@ -log.Printf("[WARN] Attempt to clean up <%= object.name -%> if it still exists") +log.Printf("[WARN] Attempt to clean up {{$.Name}} if it still exists") var cleanErr error -if cleanErr = resource<%= object.resource_name -%>Read(d, meta); cleanErr == nil { +if cleanErr = resource{{$.ResourceName}}Read(d, meta); cleanErr == nil { if d.Id() != "" { - log.Printf("[WARN] <%= object.name -%> %q still exists, attempting to delete...", d.Id()) - if cleanErr = resource<%= object.resource_name -%>Delete(d, meta); cleanErr == nil { - log.Printf("[WARN] Invalid <%= object.name -%> was successfully deleted") + log.Printf("[WARN] {{$.Name}} %q still exists, attempting to delete...", d.Id()) + if cleanErr = resource{{$.ResourceName}}Delete(d, meta); cleanErr == nil { + log.Printf("[WARN] Invalid {{$.Name}} was successfully deleted") d.SetId("") } } } if cleanErr != nil { - log.Printf("[WARN] Could not confirm cleanup of <%= object.name -%> if created in error state: %v", cleanErr) + log.Printf("[WARN] Could not confirm cleanup of {{$.Name}} if created in error state: %v", cleanErr) } diff --git a/mmv1/templates/terraform/post_create_failure/go/delete_on_failure.go.tmpl b/mmv1/templates/terraform/post_create_failure/go/delete_on_failure.go.tmpl deleted file mode 100644 index c837747bffba..000000000000 --- a/mmv1/templates/terraform/post_create_failure/go/delete_on_failure.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -log.Printf("[WARN] Attempt to clean up {{$.Name}} if it still exists") -var cleanErr error -if cleanErr = resource{{$.ResourceName}}Read(d, meta); cleanErr == nil { - if d.Id() != "" { - log.Printf("[WARN] {{$.Name}} %q still exists, attempting to delete...", d.Id()) - if cleanErr = resource{{$.ResourceName}}Delete(d, meta); cleanErr == nil { - log.Printf("[WARN] Invalid {{$.Name}} was successfully deleted") - d.SetId("") - } - } -} -if cleanErr != nil { - log.Printf("[WARN] Could not confirm cleanup of {{$.Name}} if created in error state: %v", cleanErr) -} diff --git a/mmv1/templates/terraform/post_delete/go/netapp_volume_replication_delete_destination_volume.go.tmpl b/mmv1/templates/terraform/post_delete/go/netapp_volume_replication_delete_destination_volume.go.tmpl deleted file mode 100644 index caab159c485f..000000000000 --- a/mmv1/templates/terraform/post_delete/go/netapp_volume_replication_delete_destination_volume.go.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -// A replication CREATE also created a destination volume -// A user can chooses to delete the destination volume after deleting the replication -if d.Get("delete_destination_volume").(bool) == true { - log.Printf("[DEBUG] delete_destination_volume is true. Deleting destination volume %v", d.Get("destination_volume")) - destination_volume := d.Get("destination_volume").(string) - del_url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}"+destination_volume+"?force=true") - if err != nil { - return err - } - - var obj map[string]interface{} - res_del, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "DELETE", - Project: billingProject, - RawURL: del_url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutDelete), - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, "Volume") - } - - err = NetappOperationWaitTime( - config, res_del, project, "Deleting destination volume", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - - log.Printf("[DEBUG] Finished deleting destination Volume %q: %#v", destination_volume, res_del) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_delete/go/network_services_gateway.go.tmpl b/mmv1/templates/terraform/post_delete/go/network_services_gateway.go.tmpl deleted file mode 100644 index 90b06bc46791..000000000000 --- a/mmv1/templates/terraform/post_delete/go/network_services_gateway.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -if d.Get("delete_swg_autogen_router_on_destroy").(bool) { - log.Print("[DEBUG] The field delete_swg_autogen_router_on_destroy is true. Deleting swg_autogen_router.") - gateways, err := gatewaysSameLocation(d, config, billingProject, userAgent) - if err != nil { - return err - } - - network := d.Get("network").(string) - if isLastSWGGateway(gateways, network) { - err := deleteSWGAutoGenRouter(d, config, billingProject, userAgent) - if err != nil { - return err - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_delete/go/org_security_policy.go.tmpl b/mmv1/templates/terraform/post_delete/go/org_security_policy.go.tmpl deleted file mode 100644 index ad5cd2f70cf9..000000000000 --- a/mmv1/templates/terraform/post_delete/go/org_security_policy.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -parent := d.Get("parent").(string) -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, parent, "Creating OrganizationSecurityPolicy", userAgent, - d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually delete - return fmt.Errorf("Error waiting to delete OrganizationSecurityPolicy: %s", err) -} diff --git a/mmv1/templates/terraform/post_delete/go/private_cloud.go.tmpl b/mmv1/templates/terraform/post_delete/go/private_cloud.go.tmpl deleted file mode 100644 index 3a72050de8b7..000000000000 --- a/mmv1/templates/terraform/post_delete/go/private_cloud.go.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -privateCloudPollRead := func(d *schema.ResourceData, meta interface{}) transport_tpg.PollReadFunc { - return func() (map[string]interface{}, error) { - config := meta.(*transport_tpg.Config) - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.SelfLinkUri}}") - if err != nil { - return nil, err - } - billingProject := "" - project, err := tpgresource.GetProject(d, config) - if err != nil { - return nil, fmt.Errorf("Error fetching project for PrivateCloud: %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 - } - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) - if err != nil { - return nil, err - } - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - }) - if err != nil { - return res, err - } - return res, nil - } - } - -err = transport_tpg.PollingWaitTime(privateCloudPollRead(d, meta), pollCheckForPrivateCloudAbsence, "Deleting {{$.Name}}", d.Timeout(schema.TimeoutDelete), 10) -if err != nil { - return fmt.Errorf("Error waiting to delete PrivateCloud: %s", err) -} diff --git a/mmv1/templates/terraform/post_delete/go/resource_compute_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/post_delete/go/resource_compute_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index 7aafd3d08c77..000000000000 --- a/mmv1/templates/terraform/post_delete/go/resource_compute_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -parent := d.Get("parent").(string) -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, parent, "Deleting FirewallPolicy", userAgent, - d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually delete - return fmt.Errorf("Error waiting to delete FirewallPolicy: %s", err) -} diff --git a/mmv1/templates/terraform/post_delete/netapp_volume_replication_delete_destination_volume.go.tmpl b/mmv1/templates/terraform/post_delete/netapp_volume_replication_delete_destination_volume.go.tmpl index 5a14f1fb407c..caab159c485f 100644 --- a/mmv1/templates/terraform/post_delete/netapp_volume_replication_delete_destination_volume.go.tmpl +++ b/mmv1/templates/terraform/post_delete/netapp_volume_replication_delete_destination_volume.go.tmpl @@ -3,7 +3,7 @@ if d.Get("delete_destination_volume").(bool) == true { log.Printf("[DEBUG] delete_destination_volume is true. Deleting destination volume %v", d.Get("destination_volume")) destination_volume := d.Get("destination_volume").(string) - del_url, err := tpgresource.ReplaceVars(d, config, "{{NetappBasePath}}"+destination_volume+"?force=true") + del_url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}"+destination_volume+"?force=true") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_delete/private_cloud.go.tmpl b/mmv1/templates/terraform/post_delete/private_cloud.go.tmpl index e472a06fc7a7..3a72050de8b7 100644 --- a/mmv1/templates/terraform/post_delete/private_cloud.go.tmpl +++ b/mmv1/templates/terraform/post_delete/private_cloud.go.tmpl @@ -1,7 +1,7 @@ privateCloudPollRead := func(d *schema.ResourceData, meta interface{}) transport_tpg.PollReadFunc { return func() (map[string]interface{}, error) { config := meta.(*transport_tpg.Config) - url, err := tpgresource.ReplaceVars(d, config, "{{<%=object.__product.name-%>BasePath}}<%=object.self_link_uri-%>") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.SelfLinkUri}}") if err != nil { return nil, err } @@ -33,7 +33,7 @@ privateCloudPollRead := func(d *schema.ResourceData, meta interface{}) transport } } -err = transport_tpg.PollingWaitTime(privateCloudPollRead(d, meta), pollCheckForPrivateCloudAbsence, "Deleting <%= object.name -%>", d.Timeout(schema.TimeoutDelete), 10) +err = transport_tpg.PollingWaitTime(privateCloudPollRead(d, meta), pollCheckForPrivateCloudAbsence, "Deleting {{$.Name}}", d.Timeout(schema.TimeoutDelete), 10) if err != nil { return fmt.Errorf("Error waiting to delete PrivateCloud: %s", err) } diff --git a/mmv1/templates/terraform/post_import/cloud_identity_group_membership.go.tmpl b/mmv1/templates/terraform/post_import/cloud_identity_group_membership.go.tmpl index 892fd8e3514e..d229dde2dd0f 100644 --- a/mmv1/templates/terraform/post_import/cloud_identity_group_membership.go.tmpl +++ b/mmv1/templates/terraform/post_import/cloud_identity_group_membership.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // Configure "group" property, which does not appear in the response body. group := regexp.MustCompile(`groups/[^/]+`).FindString(id) if err := d.Set("group", group); err != nil { diff --git a/mmv1/templates/terraform/post_import/cloudbuild_trigger.go.tmpl b/mmv1/templates/terraform/post_import/cloudbuild_trigger.go.tmpl index 98aeba337dfc..8ba409e608c4 100644 --- a/mmv1/templates/terraform/post_import/cloudbuild_trigger.go.tmpl +++ b/mmv1/templates/terraform/post_import/cloudbuild_trigger.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} // Force legacy id format for global triggers. id = strings.ReplaceAll(id, "/locations//", "/") id = strings.ReplaceAll(id, "/locations/global/", "/") diff --git a/mmv1/templates/terraform/post_import/datastream_stream.go.tmpl b/mmv1/templates/terraform/post_import/datastream_stream.go.tmpl index 7e1d083b2528..f404dbf1b983 100644 --- a/mmv1/templates/terraform/post_import/datastream_stream.go.tmpl +++ b/mmv1/templates/terraform/post_import/datastream_stream.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} if err := waitForDatastreamStreamReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { return nil, fmt.Errorf("Error waiting for Stream %q to be NOT_STARTED, RUNNING, or PAUSED during import: %q", d.Get("name").(string), err) } \ No newline at end of file diff --git a/mmv1/templates/terraform/post_import/go/agent_pool.go.tmpl b/mmv1/templates/terraform/post_import/go/agent_pool.go.tmpl deleted file mode 100644 index d32a8563bbbb..000000000000 --- a/mmv1/templates/terraform/post_import/go/agent_pool.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitForAgentPoolReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return nil, fmt.Errorf("Error waiting for AgentPool %q to be CREATED during importing: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_import/go/cloud_identity_group_membership.go.tmpl b/mmv1/templates/terraform/post_import/go/cloud_identity_group_membership.go.tmpl deleted file mode 100644 index d229dde2dd0f..000000000000 --- a/mmv1/templates/terraform/post_import/go/cloud_identity_group_membership.go.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} - // Configure "group" property, which does not appear in the response body. - group := regexp.MustCompile(`groups/[^/]+`).FindString(id) - if err := d.Set("group", group); err != nil { - return nil, fmt.Errorf("Error setting group property: %s", err) - } diff --git a/mmv1/templates/terraform/post_import/go/cloudbuild_trigger.go.tmpl b/mmv1/templates/terraform/post_import/go/cloudbuild_trigger.go.tmpl deleted file mode 100644 index 8ba409e608c4..000000000000 --- a/mmv1/templates/terraform/post_import/go/cloudbuild_trigger.go.tmpl +++ /dev/null @@ -1,20 +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. -*/ -}} - // Force legacy id format for global triggers. - id = strings.ReplaceAll(id, "/locations//", "/") - id = strings.ReplaceAll(id, "/locations/global/", "/") - d.SetId(id) - if d.Get("location") == "" { - // Happens when imported with legacy import format. - d.Set("location", "global") - } diff --git a/mmv1/templates/terraform/post_import/go/datastream_stream.go.tmpl b/mmv1/templates/terraform/post_import/go/datastream_stream.go.tmpl deleted file mode 100644 index f404dbf1b983..000000000000 --- a/mmv1/templates/terraform/post_import/go/datastream_stream.go.tmpl +++ /dev/null @@ -1,15 +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. -*/ -}} -if err := waitForDatastreamStreamReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return nil, fmt.Errorf("Error waiting for Stream %q to be NOT_STARTED, RUNNING, or PAUSED during import: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_import/go/integration_connectors_connection.go.tmpl b/mmv1/templates/terraform/post_import/go/integration_connectors_connection.go.tmpl deleted file mode 100644 index c78d42a26036..000000000000 --- a/mmv1/templates/terraform/post_import/go/integration_connectors_connection.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitforConnectionReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return nil, fmt.Errorf("Error waiting for Connection %q to be in a stable state: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_import/go/lien_import.tmpl b/mmv1/templates/terraform/post_import/go/lien_import.tmpl deleted file mode 100644 index 3bd7626ef78c..000000000000 --- a/mmv1/templates/terraform/post_import/go/lien_import.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -parent, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}parent{{"}}"}}") -if err != nil { - return nil, err -} -if err := d.Set("parent", parent); err != nil { - return nil, fmt.Errorf("Error setting parent: %s", err) -} diff --git a/mmv1/templates/terraform/post_import/go/private_connection.go.tmpl b/mmv1/templates/terraform/post_import/go/private_connection.go.tmpl deleted file mode 100644 index cba72c4e2289..000000000000 --- a/mmv1/templates/terraform/post_import/go/private_connection.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitForPrivateConnectionReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return nil, fmt.Errorf("Error waiting for PrivateConnection %q to be CREATED during importing: %q", d.Get("name").(string), err) -} diff --git a/mmv1/templates/terraform/post_import/go/privateca_import.go.tmpl b/mmv1/templates/terraform/post_import/go/privateca_import.go.tmpl deleted file mode 100644 index a023ec96530b..000000000000 --- a/mmv1/templates/terraform/post_import/go/privateca_import.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := d.Set("ignore_active_certificates_on_deletion", false); err != nil { - return nil, err -} diff --git a/mmv1/templates/terraform/post_import/go/scc_v1_folder_notification_config.go.tmpl b/mmv1/templates/terraform/post_import/go/scc_v1_folder_notification_config.go.tmpl deleted file mode 100644 index d7d3e0d8e21c..000000000000 --- a/mmv1/templates/terraform/post_import/go/scc_v1_folder_notification_config.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -idParts := strings.Split(d.Id(), "/") -if len(idParts) != 4 { - return nil, fmt.Errorf("unexpected format of ID (%q), expected folders/{{"{{"}}folder{{"}}"}}/notificationConfigs/{{"{{"}}config_id{{"}}"}}", d.Id()) -} - -if err := d.Set("folder", idParts[1]); err != nil { - return nil, fmt.Errorf("error setting folder: %s", err) -} - -if err := d.Set("config_id", idParts[3]); err != nil { - return nil, fmt.Errorf("error setting config_id: %s", err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_import/go/scc_v2_folder_notification_config.go.tmpl b/mmv1/templates/terraform/post_import/go/scc_v2_folder_notification_config.go.tmpl deleted file mode 100644 index 10ebbe8b3032..000000000000 --- a/mmv1/templates/terraform/post_import/go/scc_v2_folder_notification_config.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -idParts := strings.Split(d.Id(), "/") -if len(idParts) != 6 { - return nil, fmt.Errorf("unexpected format of ID (%q), expected folders/{{"{{"}}folder{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/notificationConfigs/{{"{{"}}config_id{{"}}"}}", d.Id()) -} - -if err := d.Set("folder", idParts[1]); err != nil { - return nil, fmt.Errorf("error setting folder: %s", err) -} - -if err := d.Set("config_id", idParts[5]); err != nil { - return nil, fmt.Errorf("error setting config_id: %s", err) -} diff --git a/mmv1/templates/terraform/post_import/go/scc_v2_organization_big_query_export_config.go.tmpl b/mmv1/templates/terraform/post_import/go/scc_v2_organization_big_query_export_config.go.tmpl deleted file mode 100644 index 6449eb1851f9..000000000000 --- a/mmv1/templates/terraform/post_import/go/scc_v2_organization_big_query_export_config.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -idParts := strings.Split(d.Id(), "/") -if len(idParts) != 6 { - return nil, fmt.Errorf("unexpected format of ID (%q), expected organizations/{{"{{"}}organization{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bigQueryExports/{{"{{"}}big_query_export_id{{"}}"}}", d.Id()) -} - -if err := d.Set("organization", idParts[1]); err != nil { - return nil, fmt.Errorf("error setting organization: %s", err) -} - -if err := d.Set("big_query_export_id", idParts[5]); err != nil { - return nil, fmt.Errorf("error setting big_query_export_id: %s", err) -} diff --git a/mmv1/templates/terraform/post_import/lien_import.tmpl b/mmv1/templates/terraform/post_import/lien_import.tmpl index 1021ec8ff898..3bd7626ef78c 100644 --- a/mmv1/templates/terraform/post_import/lien_import.tmpl +++ b/mmv1/templates/terraform/post_import/lien_import.tmpl @@ -1,4 +1,4 @@ -parent, err := tpgresource.ReplaceVars(d, config, "projects/{{parent}}") +parent, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}parent{{"}}"}}") if err != nil { return nil, err } diff --git a/mmv1/templates/terraform/post_import/scc_v1_folder_notification_config.go.tmpl b/mmv1/templates/terraform/post_import/scc_v1_folder_notification_config.go.tmpl index 536f8156818a..d7d3e0d8e21c 100644 --- a/mmv1/templates/terraform/post_import/scc_v1_folder_notification_config.go.tmpl +++ b/mmv1/templates/terraform/post_import/scc_v1_folder_notification_config.go.tmpl @@ -1,6 +1,6 @@ idParts := strings.Split(d.Id(), "/") if len(idParts) != 4 { - return nil, fmt.Errorf("unexpected format of ID (%q), expected folders/{{folder}}/notificationConfigs/{{config_id}}", d.Id()) + return nil, fmt.Errorf("unexpected format of ID (%q), expected folders/{{"{{"}}folder{{"}}"}}/notificationConfigs/{{"{{"}}config_id{{"}}"}}", d.Id()) } if err := d.Set("folder", idParts[1]); err != nil { diff --git a/mmv1/templates/terraform/post_import/scc_v2_folder_notification_config.go.tmpl b/mmv1/templates/terraform/post_import/scc_v2_folder_notification_config.go.tmpl index 4cceffdf9d0f..10ebbe8b3032 100644 --- a/mmv1/templates/terraform/post_import/scc_v2_folder_notification_config.go.tmpl +++ b/mmv1/templates/terraform/post_import/scc_v2_folder_notification_config.go.tmpl @@ -1,6 +1,6 @@ idParts := strings.Split(d.Id(), "/") if len(idParts) != 6 { - return nil, fmt.Errorf("unexpected format of ID (%q), expected folders/{{folder}}/locations/{{location}}/notificationConfigs/{{config_id}}", d.Id()) + return nil, fmt.Errorf("unexpected format of ID (%q), expected folders/{{"{{"}}folder{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/notificationConfigs/{{"{{"}}config_id{{"}}"}}", d.Id()) } if err := d.Set("folder", idParts[1]); err != nil { diff --git a/mmv1/templates/terraform/post_import/scc_v2_organization_big_query_export_config.go.tmpl b/mmv1/templates/terraform/post_import/scc_v2_organization_big_query_export_config.go.tmpl index bd193f49aa72..6449eb1851f9 100644 --- a/mmv1/templates/terraform/post_import/scc_v2_organization_big_query_export_config.go.tmpl +++ b/mmv1/templates/terraform/post_import/scc_v2_organization_big_query_export_config.go.tmpl @@ -1,6 +1,6 @@ idParts := strings.Split(d.Id(), "/") if len(idParts) != 6 { - return nil, fmt.Errorf("unexpected format of ID (%q), expected organizations/{{organization}}/locations/{{location}}/bigQueryExports/{{big_query_export_id}}", d.Id()) + return nil, fmt.Errorf("unexpected format of ID (%q), expected organizations/{{"{{"}}organization{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bigQueryExports/{{"{{"}}big_query_export_id{{"}}"}}", d.Id()) } if err := d.Set("organization", idParts[1]); err != nil { diff --git a/mmv1/templates/terraform/post_update/cloud_scheduler.go.tmpl b/mmv1/templates/terraform/post_update/cloud_scheduler.go.tmpl index 8401b10cd77a..7bdceda67aa1 100644 --- a/mmv1/templates/terraform/post_update/cloud_scheduler.go.tmpl +++ b/mmv1/templates/terraform/post_update/cloud_scheduler.go.tmpl @@ -8,7 +8,7 @@ if d.HasChange("paused") { } } - linkTmpl := fmt.Sprintf("{{CloudSchedulerBasePath}}projects/{{project}}/locations/{{region}}/jobs/{{name}}:%s", endpoint) + linkTmpl := fmt.Sprintf("{{"{{"}}CloudSchedulerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/jobs/{{"{{"}}name{{"}}"}}:%s", endpoint) url, err = tpgresource.ReplaceVars(d, config, linkTmpl) if err != nil { return err diff --git a/mmv1/templates/terraform/post_update/cloudbuild_bitbucketserver_config.go.tmpl b/mmv1/templates/terraform/post_update/cloudbuild_bitbucketserver_config.go.tmpl index c8368000fbed..5bd9b8cfe9ca 100644 --- a/mmv1/templates/terraform/post_update/cloudbuild_bitbucketserver_config.go.tmpl +++ b/mmv1/templates/terraform/post_update/cloudbuild_bitbucketserver_config.go.tmpl @@ -12,7 +12,7 @@ if d.HasChange("connected_repositories") { removeRepos := oReposSet.Difference(nReposSet).List() createRepos := nReposSet.Difference(oReposSet).List() - url, err = tpgresource.ReplaceVars(d, config, "{{CloudBuildBasePath}}projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}:removeBitbucketServerConnectedRepository") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudBuildBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}:removeBitbucketServerConnectedRepository") if err != nil { return err } @@ -37,7 +37,7 @@ if d.HasChange("connected_repositories") { // if repos to create, prepare and send batchCreate request if len(createRepos) > 0 { - parent, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}") + parent, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } @@ -56,7 +56,7 @@ if d.HasChange("connected_repositories") { obj = make(map[string]interface{}) obj["requests"] = requests - url, err = tpgresource.ReplaceVars(d, config, "{{CloudBuildBasePath}}projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}/connectedRepositories:batchCreate") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudBuildBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}/connectedRepositories:batchCreate") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_update/compute_per_instance_config.go.tmpl b/mmv1/templates/terraform/post_update/compute_per_instance_config.go.tmpl index f04f7de12f72..b8b89436aac5 100644 --- a/mmv1/templates/terraform/post_update/compute_per_instance_config.go.tmpl +++ b/mmv1/templates/terraform/post_update/compute_per_instance_config.go.tmpl @@ -1,5 +1,5 @@ // Instance name in applyUpdatesToInstances request must include zone -instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{zone}}/instances/{{name}}") +instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{"{{"}}zone{{"}}"}}/instances/{{"{{"}}name{{"}}"}}") if err != nil { return err } @@ -19,7 +19,7 @@ if tpgresource.IsEmptyValue(reflect.ValueOf(mostDisruptiveAction)) { } obj["mostDisruptiveAllowedAction"] = mostDisruptiveAction -url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/instanceGroupManagers/{{instance_group_manager}}/applyUpdatesToInstances") +url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/applyUpdatesToInstances") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_update/compute_region_per_instance_config.go.tmpl b/mmv1/templates/terraform/post_update/compute_region_per_instance_config.go.tmpl index 53e9d2e15e13..54c1dc2bd63b 100644 --- a/mmv1/templates/terraform/post_update/compute_region_per_instance_config.go.tmpl +++ b/mmv1/templates/terraform/post_update/compute_region_per_instance_config.go.tmpl @@ -19,7 +19,7 @@ if tpgresource.IsEmptyValue(reflect.ValueOf(mostDisruptiveAction)) { } obj["mostDisruptiveAllowedAction"] = mostDisruptiveAction -url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/instanceGroupManagers/{{region_instance_group_manager}}/applyUpdatesToInstances") +url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/instanceGroupManagers/{{"{{"}}region_instance_group_manager{{"}}"}}/applyUpdatesToInstances") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_update/compute_subnetwork.go.tmpl b/mmv1/templates/terraform/post_update/compute_subnetwork.go.tmpl index 84133b3bf39b..9fd468471617 100644 --- a/mmv1/templates/terraform/post_update/compute_subnetwork.go.tmpl +++ b/mmv1/templates/terraform/post_update/compute_subnetwork.go.tmpl @@ -10,7 +10,7 @@ if v, ok := d.GetOk("send_secondary_ip_range_if_empty"); ok && v.(bool) { // The rest is the same as the secondary_ip_range generated update code // without the secondaryIpRangesProp logic - getUrl, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") + getUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/subnetworks/{{"{{"}}name{{"}}"}}") if err != nil { return err } @@ -33,7 +33,7 @@ if v, ok := d.GetOk("send_secondary_ip_range_if_empty"); ok && v.(bool) { obj["fingerprint"] = getRes["fingerprint"] - url, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/subnetworks/{{name}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/subnetworks/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_update/datastream_stream.go.tmpl b/mmv1/templates/terraform/post_update/datastream_stream.go.tmpl index c56e295a62bc..c594a3e85729 100644 --- a/mmv1/templates/terraform/post_update/datastream_stream.go.tmpl +++ b/mmv1/templates/terraform/post_update/datastream_stream.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} if err := waitForDatastreamStreamReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { return fmt.Errorf("Error waiting for Stream %q to be NOT_STARTED, RUNNING, or PAUSED during update: %q", d.Get("name").(string), err) } \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/cloud_scheduler.go.tmpl b/mmv1/templates/terraform/post_update/go/cloud_scheduler.go.tmpl deleted file mode 100644 index 7bdceda67aa1..000000000000 --- a/mmv1/templates/terraform/post_update/go/cloud_scheduler.go.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -if d.HasChange("paused") { - endpoint := "resume" // Default to enabled - logSuccessMsg := "Job state has been set to ENABLED" - if paused, pausedOk := d.GetOk("paused"); pausedOk { - if paused.(bool) { - endpoint = "pause" - logSuccessMsg = "Job state has been set to PAUSED" - } - } - - linkTmpl := fmt.Sprintf("{{"{{"}}CloudSchedulerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}region{{"}}"}}/jobs/{{"{{"}}name{{"}}"}}:%s", endpoint) - url, err = tpgresource.ReplaceVars(d, config, linkTmpl) - if err != nil { - return err - } - - emptyReqBody := make(map[string]interface{}) - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: emptyReqBody, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - if err != nil { - return fmt.Errorf("Error setting Cloud Scheduler Job status: %s", err) - } - - log.Printf("[DEBUG] Finished updating Job %q status: %s", d.Id(), logSuccessMsg) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/cloudbuild_bitbucketserver_config.go.tmpl b/mmv1/templates/terraform/post_update/go/cloudbuild_bitbucketserver_config.go.tmpl deleted file mode 100644 index 5bd9b8cfe9ca..000000000000 --- a/mmv1/templates/terraform/post_update/go/cloudbuild_bitbucketserver_config.go.tmpl +++ /dev/null @@ -1,86 +0,0 @@ -if d.HasChange("connected_repositories") { - o, n := d.GetChange("connected_repositories") - oReposSet, ok := o.(*schema.Set) - if !ok { - return fmt.Errorf("Error reading old connected repositories") - } - nReposSet, ok := n.(*schema.Set) - if !ok { - return fmt.Errorf("Error reading new connected repositories") - } - - removeRepos := oReposSet.Difference(nReposSet).List() - createRepos := nReposSet.Difference(oReposSet).List() - - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudBuildBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}:removeBitbucketServerConnectedRepository") - if err != nil { - return err - } - - // send remove repo requests. - for _, repo := range removeRepos { - obj := make(map[string]interface{}) - obj["connectedRepository"] = repo - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutCreate), - }) - if err != nil { - return fmt.Errorf("Error removing connected_repositories: %s", err) - } - } - - // if repos to create, prepare and send batchCreate request - if len(createRepos) > 0 { - parent, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}") - if err != nil { - return fmt.Errorf("Error constructing id: %s", err) - } - var requests []interface{} - for _, repo := range createRepos { - connectedRepo := make(map[string]interface{}) - connectedRepo["parent"] = parent - connectedRepo["repo"] = repo - - connectedRepoRequest := make(map[string]interface{}) - connectedRepoRequest["parent"] = parent - connectedRepoRequest["bitbucketServerConnectedRepository"] = connectedRepo - - requests = append(requests, connectedRepoRequest) - } - obj = make(map[string]interface{}) - obj["requests"] = requests - - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudBuildBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}/connectedRepositories:batchCreate") - if err != nil { - return err - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutCreate), - }) - if err != nil { - return fmt.Errorf("Error creating connected_repositories: %s", err) - } - - err = CloudBuildOperationWaitTime( - config, res, project, "Updating connected_repositories on BitbucketServerConfig", userAgent, - d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return fmt.Errorf("Error waiting to create connected_repositories: %s", err) - } - } -} else { - log.Printf("[DEBUG] connected_repositories have no changes") -} diff --git a/mmv1/templates/terraform/post_update/go/compute_per_instance_config.go.tmpl b/mmv1/templates/terraform/post_update/go/compute_per_instance_config.go.tmpl deleted file mode 100644 index b8b89436aac5..000000000000 --- a/mmv1/templates/terraform/post_update/go/compute_per_instance_config.go.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -// Instance name in applyUpdatesToInstances request must include zone -instanceName, err := tpgresource.ReplaceVars(d, config, "zones/{{"{{"}}zone{{"}}"}}/instances/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} - -obj = make(map[string]interface{}) -obj["instances"] = []string{instanceName} - -minAction := d.Get("minimal_action") -if minAction == "" { - minAction = "NONE" -} -obj["minimalAction"] = minAction - -mostDisruptiveAction := d.Get("most_disruptive_allowed_action") -if tpgresource.IsEmptyValue(reflect.ValueOf(mostDisruptiveAction)) { - mostDisruptiveAction = "REPLACE" -} -obj["mostDisruptiveAllowedAction"] = mostDisruptiveAction - -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/instanceGroupManagers/{{"{{"}}instance_group_manager{{"}}"}}/applyUpdatesToInstances") -if err != nil { - return err -} - -log.Printf("[DEBUG] Applying updates to PerInstanceConfig %q: %#v", d.Id(), obj) -res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error updating PerInstanceConfig %q: %s", d.Id(), err) -} - -err = ComputeOperationWaitTime( - config, res, project, "Applying update to PerInstanceConfig", userAgent, - d.Timeout(schema.TimeoutUpdate)) - -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/compute_region_per_instance_config.go.tmpl b/mmv1/templates/terraform/post_update/go/compute_region_per_instance_config.go.tmpl deleted file mode 100644 index 54c1dc2bd63b..000000000000 --- a/mmv1/templates/terraform/post_update/go/compute_region_per_instance_config.go.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -// Instance name in applyUpdatesToInstances request must include zone -instanceName, err := findInstanceName(d, config) -if err != nil { - return err -} - -obj = make(map[string]interface{}) -obj["instances"] = []string{instanceName} - -minAction := d.Get("minimal_action") -if minAction == "" { - minAction = "NONE" -} -obj["minimalAction"] = minAction - -mostDisruptiveAction := d.Get("most_disruptive_allowed_action") -if tpgresource.IsEmptyValue(reflect.ValueOf(mostDisruptiveAction)) { - mostDisruptiveAction = "REPLACE" -} -obj["mostDisruptiveAllowedAction"] = mostDisruptiveAction - -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/instanceGroupManagers/{{"{{"}}region_instance_group_manager{{"}}"}}/applyUpdatesToInstances") -if err != nil { - return err -} - -log.Printf("[DEBUG] Applying updates to PerInstanceConfig %q: %#v", d.Id(), obj) -res, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), -}) - -if err != nil { - return fmt.Errorf("Error updating PerInstanceConfig %q: %s", d.Id(), err) -} - -err = ComputeOperationWaitTime( - config, res, project, "Applying update to PerInstanceConfig", userAgent, - d.Timeout(schema.TimeoutUpdate)) - -if err != nil { - return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/compute_subnetwork.go.tmpl b/mmv1/templates/terraform/post_update/go/compute_subnetwork.go.tmpl deleted file mode 100644 index 9fd468471617..000000000000 --- a/mmv1/templates/terraform/post_update/go/compute_subnetwork.go.tmpl +++ /dev/null @@ -1,72 +0,0 @@ -if v, ok := d.GetOk("send_secondary_ip_range_if_empty"); ok && v.(bool) { - if sv, ok := d.GetOk("secondary_ip_range"); ok { - configValue := d.GetRawConfig().GetAttr("secondary_ip_range") - stateValue := sv.([]interface{}) - if configValue.LengthInt() == 0 && len(stateValue) != 0 { - log.Printf("[DEBUG] Sending empty secondary_ip_range in update") - obj := make(map[string]interface{}) - obj["secondaryIpRanges"] = make([]interface{}, 0) - - // The rest is the same as the secondary_ip_range generated update code - // without the secondaryIpRangesProp logic - - getUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/subnetworks/{{"{{"}}name{{"}}"}}") - 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 - } - - getRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: getUrl, - UserAgent: userAgent, - }) - if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ComputeSubnetwork %q", d.Id())) - } - - obj["fingerprint"] = getRes["fingerprint"] - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/subnetworks/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - headers := make(http.Header) - - // err == nil indicates that the billing_project value was found - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: billingProject, - RawURL: url, - UserAgent: userAgent, - Body: obj, - Timeout: d.Timeout(schema.TimeoutUpdate), - Headers: headers, - }) - if err != nil { - return fmt.Errorf("Error updating Subnetwork %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished updating Subnetwork %q: %#v", d.Id(), res) - } - - err = ComputeOperationWaitTime( - config, res, project, "Updating Subnetwork", userAgent, - d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err - } - } - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/datastream_stream.go.tmpl b/mmv1/templates/terraform/post_update/go/datastream_stream.go.tmpl deleted file mode 100644 index c594a3e85729..000000000000 --- a/mmv1/templates/terraform/post_update/go/datastream_stream.go.tmpl +++ /dev/null @@ -1,15 +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. -*/ -}} -if err := waitForDatastreamStreamReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Error waiting for Stream %q to be NOT_STARTED, RUNNING, or PAUSED during update: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/iam_workforce_pool_provider.go.tmpl b/mmv1/templates/terraform/post_update/go/iam_workforce_pool_provider.go.tmpl deleted file mode 100644 index 2dfb9e3db151..000000000000 --- a/mmv1/templates/terraform/post_update/go/iam_workforce_pool_provider.go.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -if d.HasChange("oidc") || d.HasChange("extra_attributes_oauth2_client") { - updatedOidcClientSecret := d.Get("oidc.0.client_secret.0.value.0.plain_text") - updatedExtraAttributesOauth2ClientSecret := d.Get("extra_attributes_oauth2_client.0.client_secret.0.value.0.plain_text") - // After the update, reading from the API returns a different thumbprint - // for the client secret value, which clears the plain_text. We set the plain_text since - // this case should not warrant a diff. - if err := resourceIAMWorkforcePoolWorkforcePoolProviderRead(d, meta); err != nil { - return err - } - - if updatedOidcClientSecret != nil && updatedOidcClientSecret != "" { - oidc := d.Get("oidc") - clientSecret := oidc.([]interface{})[0].(map[string]interface{})["client_secret"] - clientSecretValue := clientSecret.([]interface{})[0].(map[string]interface{})["value"] - clientSecretValue.([]interface{})[0].(map[string]interface{})["plain_text"] = updatedOidcClientSecret - if err := d.Set("oidc", oidc); err != nil { - return err - } - } - - if updatedExtraAttributesOauth2ClientSecret != nil && updatedExtraAttributesOauth2ClientSecret != "" { - extraAttributesOauth2Client := d.Get("extra_attributes_oauth2_client") - clientSecret := extraAttributesOauth2Client.([]interface{})[0].(map[string]interface{})["client_secret"] - clientSecretValue := clientSecret.([]interface{})[0].(map[string]interface{})["value"] - clientSecretValue.([]interface{})[0].(map[string]interface{})["plain_text"] = updatedExtraAttributesOauth2ClientSecret - if err := d.Set("extra_attributes_oauth2_client", extraAttributesOauth2Client); err != nil { - return err - } - } - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/integration_connectors_connection.go.tmpl b/mmv1/templates/terraform/post_update/go/integration_connectors_connection.go.tmpl deleted file mode 100644 index db66cc890e3e..000000000000 --- a/mmv1/templates/terraform/post_update/go/integration_connectors_connection.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitforConnectionReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Error waiting for Connection %q to finish being in UPDATING state during updation: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/netapp_volume_replication_mirror_state.go.tmpl b/mmv1/templates/terraform/post_update/go/netapp_volume_replication_mirror_state.go.tmpl deleted file mode 100644 index 71724395b40d..000000000000 --- a/mmv1/templates/terraform/post_update/go/netapp_volume_replication_mirror_state.go.tmpl +++ /dev/null @@ -1,89 +0,0 @@ -// Manage stopping and resuming a mirror - -var obj2 map[string]interface{} -do_change := false -var action string -var targetState string -// state transitions -// there can be a glitch is a transfer starts/ends between reading mirrorState -// and sending the action. This will be very rare. No workaround. -if d.Get("replication_enabled").(bool) == true { - switch d.Get("mirror_state").(string) { - case "STOPPED": - // replication_enabled==true, mirrorState==STOPPED -> resume - action = "resume" - targetState = "MIRRORED" - do_change = true - default: - // replication_enabled==true, mirrorState!=STOPPED -> NOOP - do_change = false - } -} else { - switch d.Get("mirror_state").(string) { - case "MIRRORED": - // replication_enabled==false, mirrorState==MIRRORED -> stop - action = "stop" - targetState = "STOPPED" - do_change = true - case "TRANSFERRING": - // replication_enabled==false, mirrorState==TRANSFERRING -> force stop - // User needs to add force_stopping = true, otherwise will receive error - action = "stop" - targetState = "STOPPED" - do_change = true - case "PREPARING": - // replication_enabled==false, mirrorState==PREPARING -> stop - // Currently cannot be stopped. User will receive following error: - // Error code 3, message: invalid request error: "Replication in preparing state. Please wait until replication is in 'READY' STATE and try again later.". - // User needs to wait until mirrorState=MIRRORED - action = "stop" - targetState = "STOPPED" - do_change = true - default: - // replication_enabled==false, mirrorState==STOPPED -> NOOP - do_change = false - } - - if do_change == true && d.Get("force_stopping").(bool) == true { - obj2 = map[string]interface{}{ - "force": true, - } - } -} - -if do_change { - // We need to send STOP/RESUME API calls - rawurl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/volumes/{{"{{"}}volume_name{{"}}"}}/replications/{{"{{"}}name{{"}}"}}:"+action) - if err != nil { - return err - } - - res2, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: rawurl, - UserAgent: userAgent, - Body: obj2, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - if err != nil { - return fmt.Errorf("Error stopping/resuming replication %q: %s", d.Id(), err) - } - - err = NetappOperationWaitTime( - config, res2, project, "volume replication "+action, userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - - // If user specified to wait for mirror operations, wait to reach target state - if d.Get("wait_for_mirror").(bool) == true { - err = NetappVolumeReplicationWaitForMirror(d, meta, targetState) - if err != nil { - return fmt.Errorf("Error waiting for volume replication to reach mirror_state==%s: %s", targetState, err) - } - } -} diff --git a/mmv1/templates/terraform/post_update/go/notebooks_instance.go.tmpl b/mmv1/templates/terraform/post_update/go/notebooks_instance.go.tmpl deleted file mode 100644 index 819cff2d1dd2..000000000000 --- a/mmv1/templates/terraform/post_update/go/notebooks_instance.go.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -name := d.Get("name").(string) -state := d.Get("state").(string) -desired_state := d.Get("desired_state").(string) - -if state != desired_state { - verb := "start" - if desired_state == "STOPPED" { - verb = "stop" - } - pRes, err := modifyNotebooksInstanceState(config, d, project, billingProject, userAgent, verb) - if err != nil { - return err - } - - if err := waitForNotebooksOperation(config, d, project, billingProject, userAgent, pRes); err != nil { - return fmt.Errorf("Error waiting to modify Notebook Instance state: %s", err) - } - -} else { - log.Printf("[DEBUG] Notebook Instance %q has state %q.", name, state) -} diff --git a/mmv1/templates/terraform/post_update/go/org_security_policy.go.tmpl b/mmv1/templates/terraform/post_update/go/org_security_policy.go.tmpl deleted file mode 100644 index 8c3f8b47dd17..000000000000 --- a/mmv1/templates/terraform/post_update/go/org_security_policy.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -parent := d.Get("parent").(string) -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, parent, "Creating OrganizationSecurityPolicy", userAgent, - d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually update - return fmt.Errorf("Error waiting to update OrganizationSecurityPolicy: %s", err) -} diff --git a/mmv1/templates/terraform/post_update/go/private_cloud.go.tmpl b/mmv1/templates/terraform/post_update/go/private_cloud.go.tmpl deleted file mode 100644 index a20adb96e5fc..000000000000 --- a/mmv1/templates/terraform/post_update/go/private_cloud.go.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -mgmtClusterProp, err := expandVmwareenginePrivateCloudManagementCluster(d.Get("management_cluster"), d, config) -if v, ok := d.GetOkExists("management_cluster"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, mgmtClusterProp)) { - obj["managementCluster"] = mgmtClusterProp -} - -mgmtMap := mgmtClusterProp.(map[string]interface{}) -parentUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}VmwareengineBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/privateClouds/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} - -clusterUrl := fmt.Sprintf("%s/clusters/%s", parentUrl, mgmtMap["clusterId"]) -clusterUpdateMask := []string{} -clusterObj := make(map[string]interface{}) - -if v, ok := d.GetOkExists("management_cluster"); !tpgresource.IsEmptyValue(reflect.ValueOf(mgmtClusterProp)) && (ok || !reflect.DeepEqual(v, mgmtClusterProp)) { - clusterObj["nodeTypeConfigs"] = mgmtMap["nodeTypeConfigs"] -} - -if d.HasChange("management_cluster") { - clusterUpdateMask = append(clusterUpdateMask, "nodeTypeConfigs.*.nodeCount") -} - -clusterPatchUrl, err := transport_tpg.AddQueryParams(clusterUrl, map[string]string{"updateMask": strings.Join(clusterUpdateMask, ",")}) -if err != nil { - return err -} - -// check if there is anything to update to avoid API call if not required. -if len(clusterUpdateMask) > 0 { - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: billingProject, - RawURL: clusterPatchUrl, - UserAgent: userAgent, - Body: clusterObj, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - - if err != nil { - return fmt.Errorf("Error updating magament cluster %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished updating magament cluster %q: %#v", d.Id(), res) - } - - err = VmwareengineOperationWaitTime( - config, res, project, "Updating Managment Cluster", userAgent, - d.Timeout(schema.TimeoutUpdate)) - - if err != nil { - return err - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/resource_compute_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/post_update/go/resource_compute_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index e2f74c48342f..000000000000 --- a/mmv1/templates/terraform/post_update/go/resource_compute_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -parent := d.Get("parent").(string) -var opRes map[string]interface{} -err = ComputeOrgOperationWaitTimeWithResponse( - config, res, &opRes, parent, "Updating FirewallPolicy", userAgent, -d.Timeout(schema.TimeoutCreate)) - -if err != nil { - // The resource didn't actually update - return fmt.Errorf("Error waiting to update FirewallPolicy: %s", err) -} diff --git a/mmv1/templates/terraform/post_update/go/tagtemplate_fields.go.tmpl b/mmv1/templates/terraform/post_update/go/tagtemplate_fields.go.tmpl deleted file mode 100644 index fac8f72d0a98..000000000000 --- a/mmv1/templates/terraform/post_update/go/tagtemplate_fields.go.tmpl +++ /dev/null @@ -1,133 +0,0 @@ -} - - -// since fields have a separate endpoint, -// we need to handle it manually - -type FieldChange struct { - Old, New map[string]interface{} -} - -o, n := d.GetChange("fields") -vals := make(map[string]*FieldChange) - -// this will create a dictionary with the value -// of field_id as the key that will contain the -// maps of old and new values -for _, raw := range o.(*schema.Set).List() { - obj := raw.(map[string]interface{}) - k := obj["field_id"].(string) - vals[k] = &FieldChange{Old: obj} -} - -for _, raw := range n.(*schema.Set).List() { - obj := raw.(map[string]interface{}) - k := obj["field_id"].(string) - if _, ok := vals[k]; !ok { - // if key is not present in the vals, - // then create an empty object to hold the new value - vals[k] = &FieldChange{} - } - vals[k].New = obj -} - -// fields schema to create schema.set below -dataCatalogTagTemplateFieldsSchema := &schema.Resource{ - Schema: ResourceDataCatalogTagTemplate().Schema["fields"].Elem.(*schema.Resource).Schema, -} - -for name, change := range vals { - // A few different situations to deal with in here: - // - change.Old is nil: create a new role - // - change.New is nil: remove an existing role - // - both are set: test if New is different than Old and update if so - - changeOldSet := schema.NewSet(schema.HashResource(dataCatalogTagTemplateFieldsSchema), []interface{}{}) - changeOldSet.Add(change.Old) - var changeOldProp map[string]interface{} - if len(change.Old) != 0 { - changeOldProp, _ = expandDataCatalogTagTemplateFields(changeOldSet, nil, nil) - changeOldProp = changeOldProp[name].(map[string]interface{}) - } - - changeNewSet := schema.NewSet(schema.HashResource(dataCatalogTagTemplateFieldsSchema), []interface{}{}) - changeNewSet.Add(change.New) - var changeNewProp map[string]interface{} - if len(change.New) != 0 { - changeNewProp, _ = expandDataCatalogTagTemplateFields(changeNewSet, nil, nil) - changeNewProp = changeNewProp[name].(map[string]interface{}) - } - - // if old state is empty, then we have a new field to create - if len(change.Old) == 0 { - err := createTagTemplateField(d, config, changeNewProp, name, billingProject, userAgent) - if err != nil { - return err - } - - continue - } - - // if new state is empty, then we need to delete the current field - if len(change.New) == 0 { - err := deleteTagTemplateField(d, config, name, billingProject, userAgent) - if err != nil { - return err - } - - continue - } - - // if we have old and new values, but are not equal, update with the new state - if !reflect.DeepEqual(changeOldProp, changeNewProp) { - url1, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DataCatalogBasePath{{"}}"}}{{"{{"}}name{{"}}"}}/fields/"+name) - if err != nil { - return err - } - - oldType := changeOldProp["type"].(map[string]interface{}) - newType := changeNewProp["type"].(map[string]interface{}) - - if oldType["primitiveType"] != newType["primitiveType"] { - // As primitiveType can't be changed, it is considered as ForceNew which triggers the deletion of old field and recreation of a new field - // Before that, we need to check that is_required is True for the newType or not, as we don't have support to add new required field in the existing TagTemplate, - // So in such cases, we can simply return the error - - // Reason for checking the isRequired in changeNewProp - - // Because this changeNewProp check should be ignored when the user wants to update the primitive type and make it optional rather than keeping it required. - if changeNewProp["isRequired"] != nil && changeNewProp["isRequired"].(bool) { - return fmt.Errorf("Updating the primitive type for a required field on an existing tag template is not supported as TagTemplateField %q is required", name) - } - - // delete changeOldProp - err_delete := deleteTagTemplateField(d, config, name, billingProject, userAgent) - if err_delete != nil { - return err_delete - } - - // recreate changeNewProp - err_create := createTagTemplateField(d, config, changeNewProp, name, billingProject, userAgent) - if err_create != nil { - return err_create - } - - log.Printf("[DEBUG] Finished updating TagTemplate Field %q", name) - return resourceDataCatalogTagTemplateRead(d, meta) - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: billingProject, - RawURL: url1, - UserAgent: userAgent, - Body: changeNewProp, - Timeout: d.Timeout(schema.TimeoutDelete), - }) - if err != nil { - return fmt.Errorf("Error updating TagTemplate Field %v: %s", name, err) - } - - log.Printf("[DEBUG] Finished updating TagTemplate Field %q: %#v", name, res) - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/post_update/go/workbench_instance.go.tmpl b/mmv1/templates/terraform/post_update/go/workbench_instance.go.tmpl deleted file mode 100644 index 604ee537a488..000000000000 --- a/mmv1/templates/terraform/post_update/go/workbench_instance.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -state := d.Get("state").(string) -desired_state := d.Get("desired_state").(string) - -if state != desired_state || stopInstance{ - verb := "start" - if desired_state == "STOPPED" { - verb = "stop" - } - pRes, err := modifyWorkbenchInstanceState(config, d, project, billingProject, userAgent, verb) - if err != nil { - return err - } - - if err := waitForWorkbenchOperation(config, d, project, billingProject, userAgent, pRes); err != nil { - return fmt.Errorf("Error waiting to modify Workbench Instance state: %s", err) - } - - if verb == "start"{ - if err := waitForWorkbenchInstanceActive(d, config, d.Timeout(schema.TimeoutUpdate) - time.Minute); err != nil { - return fmt.Errorf("Workbench instance %q did not reach ACTIVE state: %q", d.Get("name").(string), err) - } - - } - -} else { - log.Printf("[DEBUG] Workbench Instance %q has state %q.", name, state) -} diff --git a/mmv1/templates/terraform/post_update/netapp_volume_replication_mirror_state.go.tmpl b/mmv1/templates/terraform/post_update/netapp_volume_replication_mirror_state.go.tmpl index 1c6c32387561..71724395b40d 100644 --- a/mmv1/templates/terraform/post_update/netapp_volume_replication_mirror_state.go.tmpl +++ b/mmv1/templates/terraform/post_update/netapp_volume_replication_mirror_state.go.tmpl @@ -53,7 +53,7 @@ if d.Get("replication_enabled").(bool) == true { if do_change { // We need to send STOP/RESUME API calls - rawurl, err := tpgresource.ReplaceVars(d, config, "{{NetappBasePath}}projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/replications/{{name}}:"+action) + rawurl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/volumes/{{"{{"}}volume_name{{"}}"}}/replications/{{"{{"}}name{{"}}"}}:"+action) if err != nil { return err } diff --git a/mmv1/templates/terraform/post_update/private_cloud.go.tmpl b/mmv1/templates/terraform/post_update/private_cloud.go.tmpl index 32ce46ef3268..a20adb96e5fc 100644 --- a/mmv1/templates/terraform/post_update/private_cloud.go.tmpl +++ b/mmv1/templates/terraform/post_update/private_cloud.go.tmpl @@ -4,7 +4,7 @@ if v, ok := d.GetOkExists("management_cluster"); !tpgresource.IsEmptyValue(refle } mgmtMap := mgmtClusterProp.(map[string]interface{}) -parentUrl, err := tpgresource.ReplaceVars(d, config, "{{VmwareengineBasePath}}projects/{{project}}/locations/{{location}}/privateClouds/{{name}}") +parentUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}VmwareengineBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/privateClouds/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/post_update/tagtemplate_fields.go.tmpl b/mmv1/templates/terraform/post_update/tagtemplate_fields.go.tmpl index 51a91b24cc33..fac8f72d0a98 100644 --- a/mmv1/templates/terraform/post_update/tagtemplate_fields.go.tmpl +++ b/mmv1/templates/terraform/post_update/tagtemplate_fields.go.tmpl @@ -80,7 +80,7 @@ for name, change := range vals { // if we have old and new values, but are not equal, update with the new state if !reflect.DeepEqual(changeOldProp, changeNewProp) { - url1, err := tpgresource.ReplaceVars(d, config, "{{DataCatalogBasePath}}{{name}}/fields/"+name) + url1, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DataCatalogBasePath{{"}}"}}{{"{{"}}name{{"}}"}}/fields/"+name) if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_create/go/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 similarity index 100% rename from mmv1/templates/terraform/pre_create/go/access_context_manager_service_perimeter_dry_run_resource.go.tmpl rename to mmv1/templates/terraform/pre_create/access_context_manager_service_perimeter_dry_run_resource.go.tmpl diff --git a/mmv1/templates/terraform/pre_create/dialogflow_set_location.go.tmpl b/mmv1/templates/terraform/pre_create/dialogflow_set_location.go.tmpl index 604713fe3a6b..68e83e1317e0 100644 --- a/mmv1/templates/terraform/pre_create/dialogflow_set_location.go.tmpl +++ b/mmv1/templates/terraform/pre_create/dialogflow_set_location.go.tmpl @@ -7,7 +7,7 @@ if parts := regexp.MustCompile(`locations\/([^\/]*)\/`).FindStringSubmatch(d.Get return fmt.Errorf( "Saw %s when the parent is expected to contains location %s", d.Get("parent"), - "projects/{{project}}/locations/{{location}}/...", + "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/...", ) } diff --git a/mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.tmpl b/mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.tmpl index 40b08950ad01..79be0a450d28 100644 --- a/mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.tmpl +++ b/mmv1/templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.tmpl @@ -7,7 +7,7 @@ if parts := regexp.MustCompile(`locations\/([^\/]*)\/`).FindStringSubmatch(d.Get return fmt.Errorf( "Saw %s when the parent is expected to contains location %s", d.Get("parent"), - "projects/{{project}}/locations/{{location}}/...", + "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/...", ) } @@ -30,13 +30,13 @@ if isDefaultStartFlow || isDefaultWelcomeIntent || isDefaultNegativeIntent { // Store the ID d.Set("name", defaultObjName) - id, err := tpgresource.ReplaceVars(d, config, "<%= id_format(object) -%>") + id, err := tpgresource.ReplaceVars(d, config, "{{$.GetIdFormat}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } d.SetId(id) // and defer to the Update method: - log.Printf("[DEBUG] Updating default <%= object.resource_name -%>") - return resource<%= object.resource_name -%>Update(d, meta) + log.Printf("[DEBUG] Updating default {{$.ResourceName}}") + return resource{{$.ResourceName}}Update(d, meta) } \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/filestore_instance.go.tmpl b/mmv1/templates/terraform/pre_create/filestore_instance.go.tmpl index 28144ef10c8e..937aa46ab4c8 100644 --- a/mmv1/templates/terraform/pre_create/filestore_instance.go.tmpl +++ b/mmv1/templates/terraform/pre_create/filestore_instance.go.tmpl @@ -10,7 +10,7 @@ } if strings.Contains(url, "locations//") { // re-compute url now that location must be set - url, err = tpgresource.ReplaceVars(d, config, "{{<%=object.__product.name-%>BasePath}}<%=object.create_uri-%>") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.CreateUri}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl b/mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl index 3989189d0049..f31de67be01f 100644 --- a/mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl +++ b/mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl @@ -1,7 +1,7 @@ // Check if the Firebase hostng site already exits. Do an update if so. -getUrl, err := tpgresource.ReplaceVars(d, config, "{{FirebaseHostingBasePath}}projects/{{project}}/sites/{{site_id}}") +getUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseHostingBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/sites/{{"{{"}}site_id{{"}}"}}") if err != nil { return err } @@ -18,7 +18,7 @@ if err == nil { // Hosting site already exists log.Printf("[DEBUG] Firebase hosting site already exists %s", d.Get("site_id")) // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/sites/{{site_id}}") + id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/sites/{{"{{"}}site_id{{"}}"}}") if err != nil { return fmt.Errorf("Error constructing id: %s", err) } diff --git a/mmv1/templates/terraform/pre_create/go/access_context_manager_dry_run_resource.go.tmpl b/mmv1/templates/terraform/pre_create/go/access_context_manager_dry_run_resource.go.tmpl deleted file mode 100644 index 7e9f036c027b..000000000000 --- a/mmv1/templates/terraform/pre_create/go/access_context_manager_dry_run_resource.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -obj["use_explicit_dry_run_spec"] = true diff --git a/mmv1/templates/terraform/pre_create/go/alloydb_cluster.go.tmpl b/mmv1/templates/terraform/pre_create/go/alloydb_cluster.go.tmpl deleted file mode 100644 index 87ac9c897160..000000000000 --- a/mmv1/templates/terraform/pre_create/go/alloydb_cluster.go.tmpl +++ /dev/null @@ -1,65 +0,0 @@ -// Read the restore variables from obj and remove them, since they do not map to anything in the cluster -var backupSource interface{} -var continuousBackupSource interface{} -if val, ok := obj["restoreBackupSource"]; ok { - backupSource = val - delete(obj, "restoreBackupSource") -} -if val, ok := obj["restoreContinuousBackupSource"]; ok { - continuousBackupSource = val - delete(obj, "restoreContinuousBackupSource") -} - -restoreClusterRequestBody := make(map[string]interface{}) -if backupSource != nil { - // If restoring from a backup, set the backupSource - restoreClusterRequestBody["backup_source"] = backupSource -} else if continuousBackupSource != nil { - // Otherwise if restoring via PITR, set the continuousBackupSource - restoreClusterRequestBody["continuous_backup_source"] = continuousBackupSource -} - -if backupSource != nil || continuousBackupSource != nil { - // Use restore API if this is a restore instead of a create cluster call - url = strings.Replace(url, "clusters?clusterId", "clusters:restore?clusterId", 1) - - // Copy obj which contains the cluster into a cluster map - cluster := make(map[string]interface{}) - for k,v := range obj { - cluster[k] = v - } - restoreClusterRequestBody["cluster"] = cluster - obj = restoreClusterRequestBody -} - - -// Read the secondary cluster config to call the api for creating secondary cluster - -var secondaryConfig interface{} -var clusterType interface{} - -if val, ok := obj["secondaryConfig"]; ok { - secondaryConfig = val -} - -if val, ok := obj["clusterType"]; ok { - clusterType = val -} - -if clusterType == "SECONDARY" { - if secondaryConfig != nil { - // Use createsecondary API if this is a secondary cluster - url = strings.Replace(url, "clusters?clusterId", "clusters:createsecondary?cluster_id", 1) - - // Validation error if secondary_config is not defined - } else { - return fmt.Errorf("Error creating cluster. Can not create secondary cluster without secondary_config field.") - } -} - -// Validation error if secondary_config is defined but, cluster type is not secondary -if secondaryConfig != nil { - if clusterType != "SECONDARY" { - return fmt.Errorf("Error creating cluster. Add {cluster_type: \"SECONDARY\"} if attempting to create a secondary cluster, otherwise remove the secondary_config.") - } -} diff --git a/mmv1/templates/terraform/pre_create/go/alloydb_instance.go.tmpl b/mmv1/templates/terraform/pre_create/go/alloydb_instance.go.tmpl deleted file mode 100644 index ba3d97920cd4..000000000000 --- a/mmv1/templates/terraform/pre_create/go/alloydb_instance.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -// Read the config and call createsecondary api if instance_type is SECONDARY - -if instanceType := d.Get("instance_type"); instanceType == "SECONDARY" { - url = strings.Replace(url, "instances?instanceId", "instances:createsecondary?instanceId", 1) -} diff --git a/mmv1/templates/terraform/pre_create/go/artifact_registry_remote_repository.go.tmpl b/mmv1/templates/terraform/pre_create/go/artifact_registry_remote_repository.go.tmpl deleted file mode 100644 index bad5d0a9599b..000000000000 --- a/mmv1/templates/terraform/pre_create/go/artifact_registry_remote_repository.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -// This file should be deleted in the next major terraform release, alongside -// the default values for 'publicRepository'. - -// deletePublicRepoIfCustom deletes the publicRepository key for a given -// pkg type from the remote repository config if customRepository is set. -deletePublicRepoIfCustom := func(pkgType string) { - if _, ok := d.GetOk(fmt.Sprintf("remote_repository_config.0.%s_repository.0.custom_repository", pkgType)); ok { - rrcfg := obj["remoteRepositoryConfig"].(map[string]interface{}) - repo := rrcfg[fmt.Sprintf("%sRepository", pkgType)].(map[string]interface{}) - delete(repo, "publicRepository") - } -} - -// Call above func for all pkg types that support custom remote repos. -deletePublicRepoIfCustom("docker") -deletePublicRepoIfCustom("maven") -deletePublicRepoIfCustom("npm") -deletePublicRepoIfCustom("python") \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/bigquery_reservation_assignment.go.tmpl b/mmv1/templates/terraform/pre_create/go/bigquery_reservation_assignment.go.tmpl deleted file mode 100644 index c4a0cdfda0f2..000000000000 --- a/mmv1/templates/terraform/pre_create/go/bigquery_reservation_assignment.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ - if _, ok := d.GetOkExists("location"); !ok { - // Extract location from parent reservation. - reservation := d.Get("reservation").(string) - - tableRef := regexp.MustCompile("projects/(.+)/locations/(.+)/reservations/(.+)") - if parts := tableRef.FindStringSubmatch(reservation); parts != nil { - err := d.Set("location", parts[2]) - if err != nil { - return err - } - } - - if strings.Contains(url, "locations//") { - // re-compute url now that location must be set - url = strings.ReplaceAll(url, "/locations//", "/locations/"+d.Get("location").(string)+"/") - if err != nil { - return err - } - } - } diff --git a/mmv1/templates/terraform/pre_create/go/cloud_asset_feed.go.tmpl b/mmv1/templates/terraform/pre_create/go/cloud_asset_feed.go.tmpl deleted file mode 100644 index 3f6167a7f11d..000000000000 --- a/mmv1/templates/terraform/pre_create/go/cloud_asset_feed.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ - -// Send the project ID in the X-Goog-User-Project header. -origUserProjectOverride := config.UserProjectOverride -config.UserProjectOverride = true diff --git a/mmv1/templates/terraform/pre_create/go/compute_forwarding_rule.go.tmpl b/mmv1/templates/terraform/pre_create/go/compute_forwarding_rule.go.tmpl deleted file mode 100644 index 19886cd88124..000000000000 --- a/mmv1/templates/terraform/pre_create/go/compute_forwarding_rule.go.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -// Labels cannot be set in a create for PSC forwarding rules, so remove it from the CREATE request. -if targetProp != nil && strings.Contains(targetProp.(string), "/serviceAttachments/") { - if _, ok := obj["labels"]; ok { - delete(obj, "labels") - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/compute_global_address.go.tmpl b/mmv1/templates/terraform/pre_create/go/compute_global_address.go.tmpl deleted file mode 100644 index bdf5ae5d293f..000000000000 --- a/mmv1/templates/terraform/pre_create/go/compute_global_address.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -// Note: Global external IP addresses and internal IP addresses are always Premium Tier. -// An address with type INTERNAL cannot have a network tier -if addressTypeProp != "INTERNAL" { - obj["networkTier"] = "PREMIUM" -} diff --git a/mmv1/templates/terraform/pre_create/go/compute_node_group_url_replace.go.tmpl b/mmv1/templates/terraform/pre_create/go/compute_node_group_url_replace.go.tmpl deleted file mode 100644 index a85b927ba68a..000000000000 --- a/mmv1/templates/terraform/pre_create/go/compute_node_group_url_replace.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -var sizeParam string -if v, ok := d.GetOkExists("initial_size"); ok { - sizeParam = fmt.Sprintf("%v", v) -}else{ - if _, ok := d.GetOkExists("autoscaling_policy"); ok{ - sizeParam = fmt.Sprintf("%v", d.Get("autoscaling_policy.min_nodes")) - }else{ - return errors.New("An initial_size or autoscaling_policy must be configured on node group creation.") - } -} - -url = regexp.MustCompile("PRE_CREATE_REPLACE_ME").ReplaceAllLiteralString(url, sizeParam) diff --git a/mmv1/templates/terraform/pre_create/go/compute_snapshot_precreate_url.go.tmpl b/mmv1/templates/terraform/pre_create/go/compute_snapshot_precreate_url.go.tmpl deleted file mode 100644 index 58a6aba3800c..000000000000 --- a/mmv1/templates/terraform/pre_create/go/compute_snapshot_precreate_url.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ - -url = regexp.MustCompile("PRE_CREATE_REPLACE_ME").ReplaceAllLiteralString(url, sourceDiskProp.(string)) diff --git a/mmv1/templates/terraform/pre_create/go/dialogflow_set_location.go.tmpl b/mmv1/templates/terraform/pre_create/go/dialogflow_set_location.go.tmpl deleted file mode 100644 index 68e83e1317e0..000000000000 --- a/mmv1/templates/terraform/pre_create/go/dialogflow_set_location.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -// extract location from the parent -location := "" - -if parts := regexp.MustCompile(`locations\/([^\/]*)\/`).FindStringSubmatch(d.Get("parent").(string)); parts != nil { - location = parts[1] -} else { - return fmt.Errorf( - "Saw %s when the parent is expected to contains location %s", - d.Get("parent"), - "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/...", - ) -} - -url = strings.Replace(url, "-dialogflow", fmt.Sprintf("%s-dialogflow", location), 1) diff --git a/mmv1/templates/terraform/pre_create/go/dialogflowcx_set_location_skip_default_obj.go.tmpl b/mmv1/templates/terraform/pre_create/go/dialogflowcx_set_location_skip_default_obj.go.tmpl deleted file mode 100644 index 79be0a450d28..000000000000 --- a/mmv1/templates/terraform/pre_create/go/dialogflowcx_set_location_skip_default_obj.go.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -// extract location from the parent -location := "" - -if parts := regexp.MustCompile(`locations\/([^\/]*)\/`).FindStringSubmatch(d.Get("parent").(string)); parts != nil { - location = parts[1] -} else { - return fmt.Errorf( - "Saw %s when the parent is expected to contains location %s", - d.Get("parent"), - "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/...", - ) -} - -url = strings.Replace(url,"-dialogflow",fmt.Sprintf("%s-dialogflow",location),1) - -// if it's a default object Dialogflow creates for you, "Update" instead of "Create" -// Note: below we try to access fields that aren't present in the resource, because this custom code is reused across multiple Dialogflow resources that contain different fields. When the field isn't present, we deliberately ignore the error and the boolean is false. -isDefaultStartFlow, _ := d.Get("is_default_start_flow").(bool) -isDefaultWelcomeIntent, _ := d.Get("is_default_welcome_intent").(bool) -isDefaultNegativeIntent, _ := d.Get("is_default_negative_intent").(bool) -if isDefaultStartFlow || isDefaultWelcomeIntent || isDefaultNegativeIntent { - // hardcode the default object ID: - var defaultObjName string - if isDefaultStartFlow || isDefaultWelcomeIntent { - defaultObjName = "00000000-0000-0000-0000-000000000000" - } - if isDefaultNegativeIntent { - defaultObjName = "00000000-0000-0000-0000-000000000001" - } - - // Store the ID - d.Set("name", defaultObjName) - id, err := tpgresource.ReplaceVars(d, config, "{{$.GetIdFormat}}") - if err != nil { - return fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - // and defer to the Update method: - log.Printf("[DEBUG] Updating default {{$.ResourceName}}") - return resource{{$.ResourceName}}Update(d, meta) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/document_ai_processor_default_version_interpolate_location.go.tmpl b/mmv1/templates/terraform/pre_create/go/document_ai_processor_default_version_interpolate_location.go.tmpl deleted file mode 100644 index c9a6a3942a59..000000000000 --- a/mmv1/templates/terraform/pre_create/go/document_ai_processor_default_version_interpolate_location.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -if strings.Contains(url,"https://-"){ - location := tpgresource.GetRegionFromRegionalSelfLink(url) - url = strings.TrimPrefix(url, "https://") - url = "https://" + location + url -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/filestore_instance.go.tmpl b/mmv1/templates/terraform/pre_create/go/filestore_instance.go.tmpl deleted file mode 100644 index 937aa46ab4c8..000000000000 --- a/mmv1/templates/terraform/pre_create/go/filestore_instance.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ - if d.Get("location") == "" { - zone, err := tpgresource.GetZone(d, config) - if err != nil { - return err - } - err = d.Set("location", zone) - if err != nil { - return err - } - } - if strings.Contains(url, "locations//") { - // re-compute url now that location must be set - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.CreateUri}}") - if err != nil { - return err - } - } diff --git a/mmv1/templates/terraform/pre_create/go/firebase_project.go.tmpl b/mmv1/templates/terraform/pre_create/go/firebase_project.go.tmpl deleted file mode 100644 index 22173c673173..000000000000 --- a/mmv1/templates/terraform/pre_create/go/firebase_project.go.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -// Check if Firebase has already been enabled -existingId, err := getExistingFirebaseProjectId(config, d, billingProject, userAgent) -if err != nil { - return fmt.Errorf("Error checking if Firebase is already enabled: %s", err) -} - -if existingId != "" { - log.Printf("[DEBUG] Firebase is already enabled for project %s", project) - d.SetId(existingId) - return resourceFirebaseProjectRead(d, meta) -} diff --git a/mmv1/templates/terraform/pre_create/go/firebasehosting_site.go.tmpl b/mmv1/templates/terraform/pre_create/go/firebasehosting_site.go.tmpl deleted file mode 100644 index f31de67be01f..000000000000 --- a/mmv1/templates/terraform/pre_create/go/firebasehosting_site.go.tmpl +++ /dev/null @@ -1,27 +0,0 @@ - -// Check if the Firebase hostng site already exits. Do an update if so. - -getUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}FirebaseHostingBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/sites/{{"{{"}}site_id{{"}}"}}") -if err != nil { - return err -} -_, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: getUrl, - UserAgent: userAgent, - Headers: headers, -}) - -if err == nil { - // Hosting site already exists - log.Printf("[DEBUG] Firebase hosting site already exists %s", d.Get("site_id")) - // Replace import id for the resource id - id, err := tpgresource.ReplaceVars(d, config, "projects/{{"{{"}}project{{"}}"}}/sites/{{"{{"}}site_id{{"}}"}}") - if err != nil { - return fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - return resourceFirebaseHostingSiteUpdate(d, meta) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/integrations_auth_config.go.tmpl b/mmv1/templates/terraform/pre_create/go/integrations_auth_config.go.tmpl deleted file mode 100644 index 05a310754583..000000000000 --- a/mmv1/templates/terraform/pre_create/go/integrations_auth_config.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -// Move client certificate to url param from request body -if cc, ok := obj["client_certificate"]; ok { - ccm := cc.(map[string]any) - - params := map[string]string { - "clientCertificate.sslCertificate": ccm["ssl_certificate"].(string), - "clientCertificate.encryptedPrivateKey": ccm["encrypted_private_key"].(string), - } - if pp, ok := ccm["passphrase"]; ok { - params["clientCertificate.passphrase"] = pp.(string) - } - url, err = transport_tpg.AddQueryParams(url, params) - if err != nil { - return err - } - delete(obj, "client_certificate") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/integrations_client.go.tmpl b/mmv1/templates/terraform/pre_create/go/integrations_client.go.tmpl deleted file mode 100644 index 8e40faf8ba58..000000000000 --- a/mmv1/templates/terraform/pre_create/go/integrations_client.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -// Translate `createSampleIntegrations` to `createSampleWorkflows` -if val, ok := obj["createSampleIntegrations"]; ok { - delete(obj, "createSampleIntegrations") - obj["createSampleWorkflows"] = val -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/kms_autokey_config_folder.go.tmpl b/mmv1/templates/terraform/pre_create/go/kms_autokey_config_folder.go.tmpl deleted file mode 100644 index ffbef5e2eb69..000000000000 --- a/mmv1/templates/terraform/pre_create/go/kms_autokey_config_folder.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -url = strings.Replace(url, "folders/folders/", "folders/", 1) -folderValue := d.Get("folder").(string) -folderValue = strings.Replace(folderValue, "folders/", "", 1) -d.Set("folder", folderValue) diff --git a/mmv1/templates/terraform/pre_create/go/network_endpoints.go.tmpl b/mmv1/templates/terraform/pre_create/go/network_endpoints.go.tmpl deleted file mode 100644 index c4cb461a6669..000000000000 --- a/mmv1/templates/terraform/pre_create/go/network_endpoints.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -chunkSize := 500 // API only accepts 500 endpoints at a time -lastPage, err := networkEndpointsPaginatedMutate(d, obj["networkEndpoints"].([]interface{}), config, userAgent, url, project, billingProject, chunkSize, true) -if err != nil { - // networkEndpointsPaginatedMutate already adds error description - return err -} -obj["networkEndpoints"] = lastPage \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/os_login_ssh_public_key.go.tmpl b/mmv1/templates/terraform/pre_create/go/os_login_ssh_public_key.go.tmpl deleted file mode 100644 index 945572907711..000000000000 --- a/mmv1/templates/terraform/pre_create/go/os_login_ssh_public_key.go.tmpl +++ /dev/null @@ -1,20 +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. -*/ -}} -// Don't use `GetProject()` because we only want to set the project in the URL -// if the user set it explicitly on the resource. -if p, ok := d.GetOk("project"); ok { - url, err = transport_tpg.AddQueryParams(url, map[string]string{"projectId": p.(string)}) - if err != nil { - return err - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/privateca_certificate.go.tmpl b/mmv1/templates/terraform/pre_create/go/privateca_certificate.go.tmpl deleted file mode 100644 index fb73fc84caee..000000000000 --- a/mmv1/templates/terraform/pre_create/go/privateca_certificate.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} -// Only include linked certificate authority if the user specified it -if p, ok := d.GetOk("certificate_authority"); ok { - url, err = transport_tpg.AddQueryParams(url, map[string]string{"issuingCertificateAuthorityId": p.(string)}) - if err != nil { - return err - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_create/go/privateca_certificate_authority.go.tmpl b/mmv1/templates/terraform/pre_create/go/privateca_certificate_authority.go.tmpl deleted file mode 100644 index 7f109cffe5ec..000000000000 --- a/mmv1/templates/terraform/pre_create/go/privateca_certificate_authority.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -// Drop `subordinateConfig` as it can not be set during CA creation. -// It can be used to activate CA during post_create or pre_update. -delete(obj, "subordinateConfig") diff --git a/mmv1/templates/terraform/pre_create/go/vmwareengine_private_cloud.go.tmpl b/mmv1/templates/terraform/pre_create/go/vmwareengine_private_cloud.go.tmpl deleted file mode 100644 index 2e0de80e70e8..000000000000 --- a/mmv1/templates/terraform/pre_create/go/vmwareengine_private_cloud.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -// Check if the project exists in a deleted state -pcMarkedForDeletion, err := isPrivateCloudInDeletedState(config, d, billingProject, userAgent) -if err != nil { - return fmt.Errorf("Error checking if Private Cloud exists and is marked for deletion: %s", err) -} -if pcMarkedForDeletion { - log.Printf("[DEBUG] Private Cloud exists and is marked for deletion. Triggering UNDELETE of the Private Cloud.\n") - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}VmwareengineBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/privateClouds/{{"{{"}}name{{"}}"}}:undelete") - if err != nil { - return err - } - obj = make(map[string]interface{}) -} else { - log.Printf("[DEBUG] Private Cloud is not found to be marked for deletion. Triggering CREATE of the Private Cloud.\n") -} diff --git a/mmv1/templates/terraform/pre_create/os_login_ssh_public_key.go.tmpl b/mmv1/templates/terraform/pre_create/os_login_ssh_public_key.go.tmpl index c34bfbd550f4..945572907711 100644 --- a/mmv1/templates/terraform/pre_create/os_login_ssh_public_key.go.tmpl +++ b/mmv1/templates/terraform/pre_create/os_login_ssh_public_key.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // Don't use `GetProject()` because we only want to set the project in the URL // if the user set it explicitly on the resource. if p, ok := d.GetOk("project"); ok { diff --git a/mmv1/templates/terraform/pre_create/privateca_certificate.go.tmpl b/mmv1/templates/terraform/pre_create/privateca_certificate.go.tmpl index 7c7f9baf64ed..fb73fc84caee 100644 --- a/mmv1/templates/terraform/pre_create/privateca_certificate.go.tmpl +++ b/mmv1/templates/terraform/pre_create/privateca_certificate.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // Only include linked certificate authority if the user specified it if p, ok := d.GetOk("certificate_authority"); ok { url, err = transport_tpg.AddQueryParams(url, map[string]string{"issuingCertificateAuthorityId": p.(string)}) diff --git a/mmv1/templates/terraform/pre_create/vmwareengine_private_cloud.go.tmpl b/mmv1/templates/terraform/pre_create/vmwareengine_private_cloud.go.tmpl index 2a858dd8b14c..2e0de80e70e8 100644 --- a/mmv1/templates/terraform/pre_create/vmwareengine_private_cloud.go.tmpl +++ b/mmv1/templates/terraform/pre_create/vmwareengine_private_cloud.go.tmpl @@ -5,7 +5,7 @@ if err != nil { } if pcMarkedForDeletion { log.Printf("[DEBUG] Private Cloud exists and is marked for deletion. Triggering UNDELETE of the Private Cloud.\n") - url, err = tpgresource.ReplaceVars(d, config, "{{VmwareengineBasePath}}projects/{{project}}/locations/{{location}}/privateClouds/{{name}}:undelete") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}VmwareengineBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/privateClouds/{{"{{"}}name{{"}}"}}:undelete") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_delete/compute_region_network_endpoint.go.tmpl b/mmv1/templates/terraform/pre_delete/compute_region_network_endpoint.go.tmpl index 3a873c959b80..e17a021da2d6 100644 --- a/mmv1/templates/terraform/pre_delete/compute_region_network_endpoint.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/compute_region_network_endpoint.go.tmpl @@ -27,7 +27,7 @@ if fqdnProp != "" { toDelete["fqdn"] = fqdnProp } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} // Instance instanceProp, err := expandNestedComputeRegionNetworkEndpointInstance(d.Get("instance"), d, config) if err != nil { @@ -45,7 +45,7 @@ if err != nil { if clientDestinationPortProp != "" && d.Get("client_destination_port").(int) > 0 { toDelete["clientDestinationPort"] = clientDestinationPortProp } -<% end -%> +{{- end }} obj = map[string]interface{}{ "networkEndpoints": []map[string]interface{}{toDelete}, diff --git a/mmv1/templates/terraform/pre_delete/detach_disk.tmpl b/mmv1/templates/terraform/pre_delete/detach_disk.tmpl index cda955083ba3..5af9ef6a2274 100644 --- a/mmv1/templates/terraform/pre_delete/detach_disk.tmpl +++ b/mmv1/templates/terraform/pre_delete/detach_disk.tmpl @@ -4,12 +4,12 @@ readRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ Project: project, RawURL: url, UserAgent: userAgent, -<% if object.error_retry_predicates -%> - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_retry_predicates.join(',') -%>}, -<% end -%> -<% if object.error_abort_predicates -%> - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_abort_predicates.join(',') -%>}, -<% end -%> +{{- if $.ErrorRetryPredicates }} + ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorRetryPredicates "," -}} }, +{{- end }} +{{- if $.ErrorAbortPredicates }} + ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorAbortPredicates "," -}} }, +{{- end }} }) if err != nil { return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ComputeDisk %q", d.Id())) diff --git a/mmv1/templates/terraform/pre_delete/detach_network.tmpl b/mmv1/templates/terraform/pre_delete/detach_network.tmpl index b50cb6125eea..efe93514b428 100644 --- a/mmv1/templates/terraform/pre_delete/detach_network.tmpl +++ b/mmv1/templates/terraform/pre_delete/detach_network.tmpl @@ -3,7 +3,7 @@ if d.Get("networks.#").(int) > 0 { patched := make(map[string]interface{}) patched["networks"] = nil - url, err := tpgresource.ReplaceVars(d, config, "{{DNSBasePath}}projects/{{project}}/policies/{{name}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DNSBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/policies/{{"{{"}}name{{"}}"}}") if err != nil { return err } @@ -16,12 +16,12 @@ if d.Get("networks.#").(int) > 0 { UserAgent: userAgent, Body: patched, Timeout: d.Timeout(schema.TimeoutUpdate), -<% if object.error_retry_predicates -%> - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_retry_predicates.join(',') -%>}, -<% end -%> -<% if object.error_abort_predicates -%> - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_abort_predicates.join(',') -%>}, -<% end -%> +{{- 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 updating Policy %q: %s", d.Id(), err) diff --git a/mmv1/templates/terraform/pre_delete/dialogflowcx_set_location_skip_default_obj.go.tmpl b/mmv1/templates/terraform/pre_delete/dialogflowcx_set_location_skip_default_obj.go.tmpl index a405208e8c80..b228e4a8b760 100644 --- a/mmv1/templates/terraform/pre_delete/dialogflowcx_set_location_skip_default_obj.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/dialogflowcx_set_location_skip_default_obj.go.tmpl @@ -7,7 +7,7 @@ if parts := regexp.MustCompile(`locations\/([^\/]*)\/`).FindStringSubmatch(d.Get return fmt.Errorf( "Saw %s when the parent is expected to contains location %s", d.Get("parent"), - "projects/{{project}}/locations/{{location}}/...", + "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/...", ) } @@ -20,6 +20,6 @@ isDefaultWelcomeIntent, _ := d.Get("is_default_welcome_intent").(bool) isDefaultNegativeIntent, _ := d.Get("is_default_negative_intent").(bool) if isDefaultStartFlow || isDefaultWelcomeIntent || isDefaultNegativeIntent { // we can't delete these resources so do nothing - log.Printf("[DEBUG] Not deleting default <%= object.resource_name -%>") + log.Printf("[DEBUG] Not deleting default {{$.ResourceName}}") return nil } \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/pre_delete/firebase_database_instance.go.tmpl index 79a11fe76782..46417a2fe5fc 100644 --- a/mmv1/templates/terraform/pre_delete/firebase_database_instance.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/firebase_database_instance.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} // start of customized code if d.Get("state").(string) == "ACTIVE" { diff --git a/mmv1/templates/terraform/pre_delete/go/active_directory_domain.go.tmpl b/mmv1/templates/terraform/pre_delete/go/active_directory_domain.go.tmpl deleted file mode 100644 index 511c002f5e1c..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/active_directory_domain.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if d.Get("deletion_protection").(bool) { - return fmt.Errorf("cannot destroy domain without setting deletion_protection=false and running `terraform apply`") -} diff --git a/mmv1/templates/terraform/pre_delete/go/alloydb_cluster.go.tmpl b/mmv1/templates/terraform/pre_delete/go/alloydb_cluster.go.tmpl deleted file mode 100644 index 743d7e857912..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/alloydb_cluster.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// Forcefully delete the secondary cluster and the dependent instances because deletion of secondary instance is not supported. -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/go/alloydb_instance.go.tmpl b/mmv1/templates/terraform/pre_delete/go/alloydb_instance.go.tmpl deleted file mode 100644 index 68d0ca605bc4..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/alloydb_instance.go.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -// Read the config and avoid calling the delete API if the instance_type is SECONDARY and instead return nil -// Returning nil is equivalent of returning a success message to the users -// This is done because deletion of secondary instance is not supported -// Instead users should be deleting the secondary cluster which will forcefully delete the associated secondary instance -// A warning message prompts the user to delete the associated secondary cluster. -// Users can always undo the delete secondary instance action by importing the deleted secondary instance by calling terraform import - -var instanceType interface{} -instanceTypeProp, err := expandAlloydbInstanceInstanceType(d.Get("instance_type"), d, config) -if err != nil { - return err -} else if v, ok := d.GetOkExists("instance_type"); !tpgresource.IsEmptyValue(reflect.ValueOf(instanceTypeProp)) && (ok || !reflect.DeepEqual(v, instanceTypeProp)) { - instanceType = instanceTypeProp -} -if instanceType != nil && instanceType == "SECONDARY" { - log.Printf("[WARNING] This operation didn't delete the Secondary Instance %q. Please delete the associated Secondary Cluster as well to delete the entire cluster and the secondary instance.\n", d.Id()) - return nil -} diff --git a/mmv1/templates/terraform/pre_delete/go/cloudrunv2_job_deletion_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/go/cloudrunv2_job_deletion_policy.go.tmpl deleted file mode 100644 index 38c30189ea27..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/cloudrunv2_job_deletion_policy.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if d.Get("deletion_protection").(bool) { - return fmt.Errorf("cannot destroy job without setting deletion_protection=false and running `terraform apply`") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/cloudrunv2_service_deletion_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/go/cloudrunv2_service_deletion_policy.go.tmpl deleted file mode 100644 index 444ac1bfe13c..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/cloudrunv2_service_deletion_policy.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if d.Get("deletion_protection").(bool) { - return fmt.Errorf("cannot destroy service without setting deletion_protection=false and running `terraform apply`") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/compute_disk_resource_policies_attachment.go.tmpl b/mmv1/templates/terraform/pre_delete/go/compute_disk_resource_policies_attachment.go.tmpl deleted file mode 100644 index 3eb72439e907..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/compute_disk_resource_policies_attachment.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -obj = make(map[string]interface{}) - -zone, err := tpgresource.GetZone(d, config) -if err != nil { - return err -} -if zone == "" { - return fmt.Errorf("zone must be non-empty - set in resource or at provider-level") -} - -// resourcePolicies are referred to by region but affixed to zonal disks. -// We construct the regional name from the zone: -// projects/{project}/regions/{region}/resourcePolicies/{resourceId} -region := tpgresource.GetRegionFromZone(zone) -if region == "" { - return fmt.Errorf("invalid zone %q, unable to infer region from zone", zone) -} - -name, err := expandNestedComputeDiskResourcePolicyAttachmentName(d.Get("name"), d, config) -if err != nil { - return err -} else if v, ok := d.GetOkExists("name"); !tpgresource.IsEmptyValue(reflect.ValueOf(name)) && (ok || !reflect.DeepEqual(v, name)) { - obj["resourcePolicies"] = []interface{}{fmt.Sprintf("projects/%s/regions/%s/resourcePolicies/%s", project, region, name)} -} diff --git a/mmv1/templates/terraform/pre_delete/go/compute_global_network_endpoint.go.tmpl b/mmv1/templates/terraform/pre_delete/go/compute_global_network_endpoint.go.tmpl deleted file mode 100644 index 53144f4d14b6..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/compute_global_network_endpoint.go.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -toDelete := make(map[string]interface{}) -portProp, err := expandNestedComputeGlobalNetworkEndpointPort(d.Get("port"), d, config) -if err != nil { - return err -} -if portProp != "" && portProp != 0 { - toDelete["port"] = portProp -} - -ipAddressProp, err := expandNestedComputeGlobalNetworkEndpointIpAddress(d.Get("ip_address"), d, config) -if err != nil { - return err -} -if ipAddressProp != "" { - toDelete["ipAddress"] = ipAddressProp -} - -fqdnProp, err := expandNestedComputeGlobalNetworkEndpointFqdn(d.Get("fqdn"), d, config) -if err != nil { - return err -} -if fqdnProp != "" { - toDelete["fqdn"] = fqdnProp -} - -obj = map[string]interface{}{ - "networkEndpoints": []map[string]interface{}{toDelete}, -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/compute_instance_group_membership.go.tmpl b/mmv1/templates/terraform/pre_delete/go/compute_instance_group_membership.go.tmpl deleted file mode 100644 index e0320e2cefa7..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/compute_instance_group_membership.go.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -toDelete := make(map[string]interface{}) - -// Instance -instanceProp := flattenNestedComputeInstanceGroupMembershipInstance(d.Get("instance"), d, config) - -if instanceProp != "" { - toDelete["instance"] = instanceProp -} - -obj = map[string]interface{}{ - "instances": []map[string]interface{}{toDelete}, -} diff --git a/mmv1/templates/terraform/pre_delete/go/compute_network_endpoint.go.tmpl b/mmv1/templates/terraform/pre_delete/go/compute_network_endpoint.go.tmpl deleted file mode 100644 index 6ea4af458237..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/compute_network_endpoint.go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -toDelete := make(map[string]interface{}) -instanceProp, err := expandNestedComputeNetworkEndpointInstance(d.Get("instance"), d, config) -if err != nil { - return err -} -if instanceProp != "" { - toDelete["instance"] = instanceProp -} - -portProp, err := expandNestedComputeNetworkEndpointPort(d.Get("port"), d, config) -if err != nil { - return err -} -if portProp != 0 { - toDelete["port"] = portProp -} - -ipAddressProp, err := expandNestedComputeNetworkEndpointIpAddress(d.Get("ip_address"), d, config) -if err != nil { - return err -} -toDelete["ipAddress"] = ipAddressProp - -obj = map[string]interface{}{ - "networkEndpoints": []map[string]interface{}{toDelete}, -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/compute_network_endpoints.go.tmpl b/mmv1/templates/terraform/pre_delete/go/compute_network_endpoints.go.tmpl deleted file mode 100644 index d718daac7b4c..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/compute_network_endpoints.go.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -var endpointsToDelete []interface{} - -endpoints := d.Get("network_endpoints").(*schema.Set).List() - -for _, e := range(endpoints) { - endpoint := e.(map[string]interface{}) - toDelete := make(map[string]interface{}) - instanceProp, err := expandNestedComputeNetworkEndpointInstance(endpoint["instance"], d, config) - if err != nil { - return err - } - if instanceProp != "" { - toDelete["instance"] = instanceProp - } - - portProp, err := expandNestedComputeNetworkEndpointPort(endpoint["port"], d, config) - if err != nil { - return err - } - if portProp != 0 { - toDelete["port"] = portProp - } - - ipAddressProp, err := expandNestedComputeNetworkEndpointIpAddress(endpoint["ip_address"], d, config) - if err != nil { - return err - } - toDelete["ipAddress"] = ipAddressProp - endpointsToDelete = append(endpointsToDelete, toDelete) -} - -chunkSize := 500 // API only accepts 500 endpoints at a time -lastPage, err := networkEndpointsPaginatedMutate(d, endpointsToDelete, config, userAgent, url, project, billingProject, chunkSize, true) -if err != nil { - // networkEndpointsPaginatedMutate already adds error description - return err -} - -obj = map[string]interface{}{ - "networkEndpoints": lastPage, -} diff --git a/mmv1/templates/terraform/pre_delete/go/compute_region_disk_resource_policies_attachment.go.tmpl b/mmv1/templates/terraform/pre_delete/go/compute_region_disk_resource_policies_attachment.go.tmpl deleted file mode 100644 index e1358b1ee4f7..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/compute_region_disk_resource_policies_attachment.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -obj = make(map[string]interface{}) - -region, err := tpgresource.GetRegion(d, config) -if err != nil { - return err -} -if region == "" { - return fmt.Errorf("region must be non-empty - set in resource or at provider-level") -} - -name, err := expandNestedComputeDiskResourcePolicyAttachmentName(d.Get("name"), d, config) -if err != nil { - return err -} else if v, ok := d.GetOkExists("name"); !tpgresource.IsEmptyValue(reflect.ValueOf(name)) && (ok || !reflect.DeepEqual(v, name)) { - obj["resourcePolicies"] = []interface{}{fmt.Sprintf("projects/%s/regions/%s/resourcePolicies/%s", project, region, name)} -} diff --git a/mmv1/templates/terraform/pre_delete/go/compute_region_network_endpoint.go.tmpl b/mmv1/templates/terraform/pre_delete/go/compute_region_network_endpoint.go.tmpl deleted file mode 100644 index e17a021da2d6..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/compute_region_network_endpoint.go.tmpl +++ /dev/null @@ -1,52 +0,0 @@ -toDelete := make(map[string]interface{}) - -// Port -portProp, err := expandNestedComputeRegionNetworkEndpointPort(d.Get("port"), d, config) -if err != nil { - return err -} -if portProp != 0 { - toDelete["port"] = portProp -} - -// IP address -ipAddressProp, err := expandNestedComputeRegionNetworkEndpointIpAddress(d.Get("ip_address"), d, config) -if err != nil { - return err -} -if ipAddressProp != "" { - toDelete["ipAddress"] = ipAddressProp -} - -// FQDN -fqdnProp, err := expandNestedComputeRegionNetworkEndpointFqdn(d.Get("fqdn"), d, config) -if err != nil { - return err -} -if fqdnProp != "" { - toDelete["fqdn"] = fqdnProp -} - -{{ if ne $.TargetVersionName `ga` -}} -// Instance -instanceProp, err := expandNestedComputeRegionNetworkEndpointInstance(d.Get("instance"), d, config) -if err != nil { - return err -} -if instanceProp != "" { - toDelete["instance"] = instanceProp -} - -// Client Destination Port -clientDestinationPortProp, err := expandNestedComputeRegionNetworkEndpointClientDestinationPort(d.Get("client_destination_port"), d, config) -if err != nil { - return err -} -if clientDestinationPortProp != "" && d.Get("client_destination_port").(int) > 0 { - toDelete["clientDestinationPort"] = clientDestinationPortProp -} -{{- end }} - -obj = map[string]interface{}{ - "networkEndpoints": []map[string]interface{}{toDelete}, -} diff --git a/mmv1/templates/terraform/pre_delete/go/container_attached_deletion_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/go/container_attached_deletion_policy.go.tmpl deleted file mode 100644 index a1dc101783f4..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/container_attached_deletion_policy.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -if v, ok := d.GetOk("deletion_policy"); ok { - if v == "DELETE_IGNORE_ERRORS" { - url, err = transport_tpg.AddQueryParams(url, map[string]string{"ignore_errors": "true"}) - if err != nil { - return err - } - } -} diff --git a/mmv1/templates/terraform/pre_delete/go/detach_disk.tmpl b/mmv1/templates/terraform/pre_delete/go/detach_disk.tmpl deleted file mode 100644 index 5af9ef6a2274..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/detach_disk.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -readRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: url, - UserAgent: userAgent, -{{- if $.ErrorRetryPredicates }} - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorRetryPredicates "," -}} }, -{{- end }} -{{- if $.ErrorAbortPredicates }} - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{ {{- join $.ErrorAbortPredicates "," -}} }, -{{- end }} -}) -if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("ComputeDisk %q", d.Id())) -} - -// if disks are attached to instances, they must be detached before the disk can be deleted -if v, ok := readRes["users"].([]interface{}); ok { - type detachArgs struct{ project, zone, instance, deviceName string } - var detachCalls []detachArgs - - for _, instance := range tpgresource.ConvertStringArr(v) { - self := d.Get("self_link").(string) - instanceProject, instanceZone, instanceName, err := tpgresource.GetLocationalResourcePropertiesFromSelfLinkString(instance) - if err != nil { - return err - } - - i, err := config.NewComputeClient(userAgent).Instances.Get(instanceProject, instanceZone, instanceName).Do() - if err != nil { - if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 { - log.Printf("[WARN] instance %q not found, not bothering to detach disks", instance) - continue - } - return fmt.Errorf("Error retrieving instance %s: %s", instance, err.Error()) - } - for _, disk := range i.Disks { - if tpgresource.CompareSelfLinkOrResourceName("", disk.Source, self, nil) { - detachCalls = append(detachCalls, detachArgs{ - project: instanceProject, - zone: tpgresource.GetResourceNameFromSelfLink(i.Zone), - instance: i.Name, - deviceName: disk.DeviceName, - }) - } - } - } - - for _, call := range detachCalls { - op, err := config.NewComputeClient(userAgent).Instances.DetachDisk(call.project, call.zone, call.instance, call.deviceName).Do() - if err != nil { - return fmt.Errorf("Error detaching disk %s from instance %s/%s/%s: %s", call.deviceName, call.project, - call.zone, call.instance, err.Error()) - } - err = ComputeOperationWaitTime(config, op, call.project, - fmt.Sprintf("Detaching disk from %s/%s/%s", call.project, call.zone, call.instance), userAgent, d.Timeout(schema.TimeoutDelete)) - if err != nil { - var opErr ComputeOperationError - if errors.As(err, &opErr) && len(opErr.Errors) == 1 && opErr.Errors[0].Code == "RESOURCE_NOT_FOUND" { - log.Printf("[WARN] instance %q was deleted while awaiting detach", call.instance) - continue - } - return err - } - } -} diff --git a/mmv1/templates/terraform/pre_delete/go/detach_network.tmpl b/mmv1/templates/terraform/pre_delete/go/detach_network.tmpl deleted file mode 100644 index efe93514b428..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/detach_network.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -// if networks are attached, they need to be detached before the policy can be deleted -if d.Get("networks.#").(int) > 0 { - patched := make(map[string]interface{}) - patched["networks"] = nil - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DNSBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/policies/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: patched, - Timeout: d.Timeout(schema.TimeoutUpdate), -{{- 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 updating Policy %q: %s", d.Id(), err) - } -} diff --git a/mmv1/templates/terraform/pre_delete/go/dialogflowcx_set_location_skip_default_obj.go.tmpl b/mmv1/templates/terraform/pre_delete/go/dialogflowcx_set_location_skip_default_obj.go.tmpl deleted file mode 100644 index b228e4a8b760..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/dialogflowcx_set_location_skip_default_obj.go.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -// extract location from the parent -location := "" - -if parts := regexp.MustCompile(`locations\/([^\/]*)\/`).FindStringSubmatch(d.Get("parent").(string)); parts != nil { - location = parts[1] -} else { - return fmt.Errorf( - "Saw %s when the parent is expected to contains location %s", - d.Get("parent"), - "projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/...", - ) -} - -url = strings.Replace(url, "-dialogflow", fmt.Sprintf("%s-dialogflow", location), 1) - -// if it's a default object Dialogflow creates for you, skip deletion -// Note: below we try to access fields that aren't present in the resource, because this custom code is reused across multiple Dialogflow resources that contain different fields. When the field isn't present, we deliberately ignore the error and the boolean is false. -isDefaultStartFlow, _ := d.Get("is_default_start_flow").(bool) -isDefaultWelcomeIntent, _ := d.Get("is_default_welcome_intent").(bool) -isDefaultNegativeIntent, _ := d.Get("is_default_negative_intent").(bool) -if isDefaultStartFlow || isDefaultWelcomeIntent || isDefaultNegativeIntent { - // we can't delete these resources so do nothing - log.Printf("[DEBUG] Not deleting default {{$.ResourceName}}") - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/pre_delete/go/firebase_database_instance.go.tmpl deleted file mode 100644 index 46417a2fe5fc..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/firebase_database_instance.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. -*/ -}} - -// start of customized code -if d.Get("state").(string) == "ACTIVE" { - if err := disableRTDB(config, d, project, billingProject, userAgent); err != nil { - return err - } -} -if d.Get("type").(string) == "DEFAULT_DATABASE" { - log.Printf("[WARN] Default Firebase Database Instance %q cannot be deleted, left disabled", d.Id()) - return nil -} -// end of customized code diff --git a/mmv1/templates/terraform/pre_delete/go/firestore_database.go.tmpl b/mmv1/templates/terraform/pre_delete/go/firestore_database.go.tmpl deleted file mode 100644 index 2f396d07df3d..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/firestore_database.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -if deletionPolicy := d.Get("deletion_policy"); deletionPolicy != "DELETE" { - log.Printf("[WARN] Firestore database %q deletion_policy is not set to 'DELETE', skipping deletion", d.Get("name").(string)) - return nil -} -if deleteProtection := d.Get("delete_protection_state"); deleteProtection == "DELETE_PROTECTION_ENABLED" { - return fmt.Errorf("Cannot delete Firestore database %s: Delete Protection is enabled. Set delete_protection_state to DELETE_PROTECTION_DISABLED for this resource and run \"terraform apply\" before attempting to delete it.", d.Get("name").(string)) -} diff --git a/mmv1/templates/terraform/pre_delete/go/interconnect_attachment.go.tmpl b/mmv1/templates/terraform/pre_delete/go/interconnect_attachment.go.tmpl deleted file mode 100644 index 03e41d0e5da3..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/interconnect_attachment.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -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) -} diff --git a/mmv1/templates/terraform/pre_delete/go/kms_autokey_config_folder.go.tmpl b/mmv1/templates/terraform/pre_delete/go/kms_autokey_config_folder.go.tmpl deleted file mode 100644 index db8c46af1299..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/kms_autokey_config_folder.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -url = strings.Replace(url, "folders/folders/", "folders/", 1) diff --git a/mmv1/templates/terraform/pre_delete/go/managed_dns_zone.go.tmpl b/mmv1/templates/terraform/pre_delete/go/managed_dns_zone.go.tmpl deleted file mode 100644 index d5f4c64a7a51..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/managed_dns_zone.go.tmpl +++ /dev/null @@ -1,70 +0,0 @@ -if d.Get("force_destroy").(bool) { - zone := d.Get("name").(string) - token := "" - for paginate := true; paginate; { - var resp *dns.ResourceRecordSetsListResponse - if token == "" { - resp, err = config.NewDnsClient(userAgent).ResourceRecordSets.List(project, zone).Do() - if err != nil { - return fmt.Errorf("Error reading ResourceRecordSets: %s", err) - } - } else { - resp, err = config.NewDnsClient(userAgent).ResourceRecordSets.List(project, zone).PageToken(token).Do() - if err != nil { - return fmt.Errorf("Error reading ResourceRecordSets: %s", err) - } - } - - for _, rr := range resp.Rrsets { - // Build the change - chg := &dns.Change{ - Deletions: []*dns.ResourceRecordSet{ - { - Name: rr.Name, - Type: rr.Type, - Ttl: rr.Ttl, - Rrdatas: rr.Rrdatas, - }, - }, - } - - if rr.Type == "NS" { - mz, err := config.NewDnsClient(userAgent).ManagedZones.Get(project, zone).Do() - if err != nil { - return fmt.Errorf("Error retrieving managed zone %q from %q: %s", zone, project, err) - } - domain := mz.DnsName - - if domain == rr.Name { - log.Println("[DEBUG] NS records can't be deleted due to API restrictions, so they're being left in place. See https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_record_set for more information.") - continue - } - } - - if rr.Type == "SOA" { - log.Println("[DEBUG] SOA records can't be deleted due to API restrictions, so they're being left in place.") - continue - } - - log.Printf("[DEBUG] DNS Record delete request via MZ: %#v", chg) - chg, err = config.NewDnsClient(userAgent).Changes.Create(project, zone, chg).Do() - if err != nil { - return fmt.Errorf("Unable to delete ResourceRecordSets: %s", err) - } - - w := &DnsChangeWaiter{ - Service: config.NewDnsClient(userAgent), - Change: chg, - Project: project, - ManagedZone: zone, - } - _, err = w.Conf().WaitForState() - if err != nil { - return fmt.Errorf("Error waiting for Google DNS change: %s", err) - } - } - - token = resp.NextPageToken - paginate = token != "" - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/modify_delete_url.tmpl b/mmv1/templates/terraform/pre_delete/go/modify_delete_url.tmpl deleted file mode 100644 index 331772bb0b17..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/modify_delete_url.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// log the old URL to make the ineffassign linter happy -// in theory, we should find a way to disable the default URL and not construct -// both, but that's a problem for another day. Today, we cheat. -log.Printf("[DEBUG] replacing URL %q with a custom delete URL", url) -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.BaseUrl}}/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_delete/go/netapp_volume_force_delete.go.tmpl b/mmv1/templates/terraform/pre_delete/go/netapp_volume_force_delete.go.tmpl deleted file mode 100644 index d8fd2927332f..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/netapp_volume_force_delete.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -// Delete volume even when nested snapshots do exist -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/go/netapp_volume_replication_stop_before_delete.go.tmpl b/mmv1/templates/terraform/pre_delete/go/netapp_volume_replication_stop_before_delete.go.tmpl deleted file mode 100644 index c609365ff492..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/netapp_volume_replication_stop_before_delete.go.tmpl +++ /dev/null @@ -1,33 +0,0 @@ -// A replication can only be deleted if mirrorState==STOPPED -// We are about to delete the replication and need to stop the mirror before. -// FYI: Stopping a PREPARING mirror currently doesn't work. User have to wait until -// mirror reaches MIRRORED. -if d.Get("mirror_state") != "STOPPED" { - rawurl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/volumes/{{"{{"}}volume_name{{"}}"}}/replications/{{"{{"}}name{{"}}"}}:stop") - if err != nil { - return err - } - - reso, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: rawurl, - UserAgent: userAgent, - // We delete anyway, so lets always use force stop - Body: map[string]interface{}{ - "force": true, - }, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - if err != nil { - return fmt.Errorf("Error stopping volume replication %q before deleting it: %s", d.Id(), err) - } - - err = NetappOperationWaitTime( - config, reso, project, "Deleting volume replication", userAgent, - d.Timeout(schema.TimeoutDelete)) - if err != nil { - return err - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/private_connection.go.tmpl b/mmv1/templates/terraform/pre_delete/go/private_connection.go.tmpl deleted file mode 100644 index e182b8aa347c..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/private_connection.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -// Add force=true query param to force deletion of private connection sub resources like Routes -url, err = transport_tpg.AddQueryParams(url, map[string]string{"force": strconv.FormatBool(true)}) -if err != nil { -return err -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/privateca_authority_disable.go.tmpl b/mmv1/templates/terraform/pre_delete/go/privateca_authority_disable.go.tmpl deleted file mode 100644 index 09bb198ab02b..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/privateca_authority_disable.go.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -if d.Get("deletion_protection").(bool) { - return fmt.Errorf("cannot destroy CertificateAuthority without setting deletion_protection=false and running `terraform apply`") -} - -if d.Get("state").(string) == "ENABLED" { - disableUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}PrivatecaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/caPools/{{"{{"}}pool{{"}}"}}/certificateAuthorities/{{"{{"}}certificate_authority_id{{"}}"}}:disable") - if err != nil { - return err - } - - log.Printf("[DEBUG] Disabling CertificateAuthority: %#v", obj) - - dRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: disableUrl, - UserAgent: userAgent, - }) - if err != nil { - return fmt.Errorf("Error disabling CertificateAuthority: %s", err) - } - - var opRes map[string]interface{} - err = PrivatecaOperationWaitTimeWithResponse( - config, dRes, &opRes, project, "Disabling CertificateAuthority", userAgent, - d.Timeout(schema.TimeoutDelete)) - if err != nil { - return fmt.Errorf("Error waiting to disable CertificateAuthority: %s", err) - } -} diff --git a/mmv1/templates/terraform/pre_delete/go/response_policy_detach_network_gke.tmpl b/mmv1/templates/terraform/pre_delete/go/response_policy_detach_network_gke.tmpl deleted file mode 100644 index 6358cd83bac8..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/response_policy_detach_network_gke.tmpl +++ /dev/null @@ -1,59 +0,0 @@ -// if gke clusters are attached, they need to be detached before the response policy can be deleted -if d.Get("gke_clusters.#").(int) > 0 { - patched := make(map[string]interface{}) - patched["gkeClusters"] = nil - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DNSBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/responsePolicies/{{"{{"}}response_policy_name{{"}}"}}") - if err != nil { - return err - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: patched, - Timeout: d.Timeout(schema.TimeoutUpdate), -{{- 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 updating Policy %q: %s", d.Id(), err) - } -} - -// if networks are attached, they need to be detached before the response policy can be deleted -if d.Get("networks.#").(int) > 0 { - patched := make(map[string]interface{}) - patched["networks"] = nil - - url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DNSBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/responsePolicies/{{"{{"}}response_policy_name{{"}}"}}") - if err != nil { - return err - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PATCH", - Project: project, - RawURL: url, - UserAgent: userAgent, - Body: patched, - Timeout: d.Timeout(schema.TimeoutUpdate), -{{- 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 updating Policy %q: %s", d.Id(), err) - } -} diff --git a/mmv1/templates/terraform/pre_delete/go/restore_default_binaryauthorization_policy.tmpl b/mmv1/templates/terraform/pre_delete/go/restore_default_binaryauthorization_policy.tmpl deleted file mode 100644 index 4c481a0b08f4..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/restore_default_binaryauthorization_policy.tmpl +++ /dev/null @@ -1,13 +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. -*/ -}} -obj = DefaultBinaryAuthorizationPolicy(d.Get("project").(string)) diff --git a/mmv1/templates/terraform/pre_delete/go/secret_version_deletion_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/go/secret_version_deletion_policy.go.tmpl deleted file mode 100644 index cba329bad5ed..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/secret_version_deletion_policy.go.tmpl +++ /dev/null @@ -1,22 +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. -*/ -}} -deletionPolicy := d.Get("deletion_policy"); - -if deletionPolicy == "ABANDON" { - return nil -} else if deletionPolicy == "DISABLE" { - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}SecretManagerBasePath{{"}}"}}{{"{{"}}name{{"}}"}}:disable") - if err != nil { - return err - } -} diff --git a/mmv1/templates/terraform/pre_delete/go/spanner_instance.go.tmpl b/mmv1/templates/terraform/pre_delete/go/spanner_instance.go.tmpl deleted file mode 100644 index c4319d1d2ad8..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/spanner_instance.go.tmpl +++ /dev/null @@ -1,24 +0,0 @@ - -if d.Get("force_destroy").(bool) { - backupsUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SpannerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/instances/{{"{{"}}name{{"}}"}}/backups") - if err != nil { - return err - } - - resp, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: backupsUrl, - UserAgent: userAgent, - }) - if err != nil { - // API returns 200 if no backups exist but the instance still exists, hence the error check. - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("SpannerInstance %q", d.Id())) - } - - 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_delete/go/sql_database_deletion_policy.tmpl b/mmv1/templates/terraform/pre_delete/go/sql_database_deletion_policy.tmpl deleted file mode 100644 index c111f346b167..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/sql_database_deletion_policy.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -if deletionPolicy := d.Get("deletion_policy"); deletionPolicy == "ABANDON" { - // Allows for database to be abandoned without deletion to avoid deletion failing - // for Postgres databases in some circumstances due to existing SQL users - return nil -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/storage_hmac_key.go.tmpl b/mmv1/templates/terraform/pre_delete/go/storage_hmac_key.go.tmpl deleted file mode 100644 index cfcf3bb185ff..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/storage_hmac_key.go.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -getUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}StorageBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/hmacKeys/{{"{{"}}access_id{{"}}"}}") -if err != nil { - return err -} - -getRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: project, - RawURL: getUrl, - UserAgent: userAgent, -}) -if err != nil { - return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("StorageHmacKey %q", d.Id())) -} - -// HmacKeys need to be INACTIVE to be deleted and the API doesn't accept noop -// updates -if v := getRes["state"]; v == "ACTIVE" { - getRes["state"] = "INACTIVE" - updateUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}StorageBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/hmacKeys/{{"{{"}}access_id{{"}}"}}") - if err != nil { - return err - } - - log.Printf("[DEBUG] Deactivating HmacKey %q: %#v", d.Id(), getRes) - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "PUT", - Project: project, - RawURL: updateUrl, - UserAgent: userAgent, - Body: getRes, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - if err != nil { - return fmt.Errorf("Error deactivating HmacKey %q: %s", d.Id(), err) - } -} - diff --git a/mmv1/templates/terraform/pre_delete/go/vertex_ai_force_delete.go.tmpl b/mmv1/templates/terraform/pre_delete/go/vertex_ai_force_delete.go.tmpl deleted file mode 100644 index 08b164d8136f..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/vertex_ai_force_delete.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ - -if v, ok := d.GetOk("force_destroy"); ok { - url, err = transport_tpg.AddQueryParams(url, map[string]string{"force": fmt.Sprintf("%v", v)}) - if err != nil { - return err - } -} diff --git a/mmv1/templates/terraform/pre_delete/go/vertex_ai_index_endpoint_deployed_index.go.tmpl b/mmv1/templates/terraform/pre_delete/go/vertex_ai_index_endpoint_deployed_index.go.tmpl deleted file mode 100644 index 22b6172e267e..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/vertex_ai_index_endpoint_deployed_index.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -obj = map[string]interface{}{ - "deployedIndexId": d.Get("deployed_index_id"), -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/go/vmwareengine_private_cloud.go.tmpl b/mmv1/templates/terraform/pre_delete/go/vmwareengine_private_cloud.go.tmpl deleted file mode 100644 index 459238f69f00..000000000000 --- a/mmv1/templates/terraform/pre_delete/go/vmwareengine_private_cloud.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -// Delay deletion of the Private Cloud if delationDelayHours value is set -delationDelayHours := d.Get("deletion_delay_hours").(int) -if delationDelayHours > 0 || (delationDelayHours == 0 && d.Get("send_deletion_delay_hours_if_zero").(bool) == true) { - log.Printf("[DEBUG] Triggering delete of the Private Cloud with a delay of %v hours.\n", delationDelayHours) - url = url + "?delay_hours=" + fmt.Sprintf("%v", delationDelayHours) -} else { - log.Printf("[DEBUG] No deletion delay provided, triggering DELETE API without setting delay hours.\n") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_delete/modify_delete_url.tmpl b/mmv1/templates/terraform/pre_delete/modify_delete_url.tmpl index 738e5a9ad755..331772bb0b17 100644 --- a/mmv1/templates/terraform/pre_delete/modify_delete_url.tmpl +++ b/mmv1/templates/terraform/pre_delete/modify_delete_url.tmpl @@ -2,7 +2,7 @@ // in theory, we should find a way to disable the default URL and not construct // both, but that's a problem for another day. Today, we cheat. log.Printf("[DEBUG] replacing URL %q with a custom delete URL", url) -url, err = tpgresource.ReplaceVars(d, config, "{{<%=object.__product.name-%>BasePath}}<%=object.base_url-%>/{{name}}") +url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}{{$.ProductMetadata.Name}}BasePath{{"}}"}}{{$.BaseUrl}}/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_delete/netapp_volume_replication_stop_before_delete.go.tmpl b/mmv1/templates/terraform/pre_delete/netapp_volume_replication_stop_before_delete.go.tmpl index 4e5c188acf2a..c609365ff492 100644 --- a/mmv1/templates/terraform/pre_delete/netapp_volume_replication_stop_before_delete.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/netapp_volume_replication_stop_before_delete.go.tmpl @@ -3,7 +3,7 @@ // FYI: Stopping a PREPARING mirror currently doesn't work. User have to wait until // mirror reaches MIRRORED. if d.Get("mirror_state") != "STOPPED" { - rawurl, err := tpgresource.ReplaceVars(d, config, "{{NetappBasePath}}projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/replications/{{name}}:stop") + rawurl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/volumes/{{"{{"}}volume_name{{"}}"}}/replications/{{"{{"}}name{{"}}"}}:stop") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_delete/privateca_authority_disable.go.tmpl b/mmv1/templates/terraform/pre_delete/privateca_authority_disable.go.tmpl index 2a91b77ad321..09bb198ab02b 100644 --- a/mmv1/templates/terraform/pre_delete/privateca_authority_disable.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/privateca_authority_disable.go.tmpl @@ -3,7 +3,7 @@ if d.Get("deletion_protection").(bool) { } if d.Get("state").(string) == "ENABLED" { - disableUrl, err := tpgresource.ReplaceVars(d, config, "{{PrivatecaBasePath}}projects/{{project}}/locations/{{location}}/caPools/{{pool}}/certificateAuthorities/{{certificate_authority_id}}:disable") + disableUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}PrivatecaBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/caPools/{{"{{"}}pool{{"}}"}}/certificateAuthorities/{{"{{"}}certificate_authority_id{{"}}"}}:disable") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_delete/go/resource_spanner_database.go.tmpl b/mmv1/templates/terraform/pre_delete/resource_spanner_database.go.tmpl similarity index 100% rename from mmv1/templates/terraform/pre_delete/go/resource_spanner_database.go.tmpl rename to mmv1/templates/terraform/pre_delete/resource_spanner_database.go.tmpl diff --git a/mmv1/templates/terraform/pre_delete/response_policy_detach_network_gke.tmpl b/mmv1/templates/terraform/pre_delete/response_policy_detach_network_gke.tmpl index ff125e3acd33..6358cd83bac8 100644 --- a/mmv1/templates/terraform/pre_delete/response_policy_detach_network_gke.tmpl +++ b/mmv1/templates/terraform/pre_delete/response_policy_detach_network_gke.tmpl @@ -3,7 +3,7 @@ if d.Get("gke_clusters.#").(int) > 0 { patched := make(map[string]interface{}) patched["gkeClusters"] = nil - url, err := tpgresource.ReplaceVars(d, config, "{{DNSBasePath}}projects/{{project}}/responsePolicies/{{response_policy_name}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DNSBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/responsePolicies/{{"{{"}}response_policy_name{{"}}"}}") if err != nil { return err } @@ -16,12 +16,12 @@ if d.Get("gke_clusters.#").(int) > 0 { UserAgent: userAgent, Body: patched, Timeout: d.Timeout(schema.TimeoutUpdate), -<% if object.error_retry_predicates -%> - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_retry_predicates.join(',') -%>}, -<% end -%> -<% if object.error_abort_predicates -%> - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_abort_predicates.join(',') -%>}, -<% end -%> +{{- 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 updating Policy %q: %s", d.Id(), err) @@ -33,7 +33,7 @@ if d.Get("networks.#").(int) > 0 { patched := make(map[string]interface{}) patched["networks"] = nil - url, err := tpgresource.ReplaceVars(d, config, "{{DNSBasePath}}projects/{{project}}/responsePolicies/{{response_policy_name}}") + url, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}DNSBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/responsePolicies/{{"{{"}}response_policy_name{{"}}"}}") if err != nil { return err } @@ -46,12 +46,12 @@ if d.Get("networks.#").(int) > 0 { UserAgent: userAgent, Body: patched, Timeout: d.Timeout(schema.TimeoutUpdate), -<% if object.error_retry_predicates -%> - ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_retry_predicates.join(',') -%>}, -<% end -%> -<% if object.error_abort_predicates -%> - ErrorAbortPredicates: []transport_tpg.RetryErrorPredicateFunc{<%= object.error_abort_predicates.join(',') -%>}, -<% end -%> +{{- 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 updating Policy %q: %s", d.Id(), err) diff --git a/mmv1/templates/terraform/pre_delete/restore_default_binaryauthorization_policy.tmpl b/mmv1/templates/terraform/pre_delete/restore_default_binaryauthorization_policy.tmpl index 27257a19c7a1..4c481a0b08f4 100644 --- a/mmv1/templates/terraform/pre_delete/restore_default_binaryauthorization_policy.tmpl +++ b/mmv1/templates/terraform/pre_delete/restore_default_binaryauthorization_policy.tmpl @@ -1,15 +1,13 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} obj = DefaultBinaryAuthorizationPolicy(d.Get("project").(string)) diff --git a/mmv1/templates/terraform/pre_delete/secret_version_deletion_policy.go.tmpl b/mmv1/templates/terraform/pre_delete/secret_version_deletion_policy.go.tmpl index 4e91b9d3e79f..cba329bad5ed 100644 --- a/mmv1/templates/terraform/pre_delete/secret_version_deletion_policy.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/secret_version_deletion_policy.go.tmpl @@ -1,23 +1,21 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} deletionPolicy := d.Get("deletion_policy"); if deletionPolicy == "ABANDON" { return nil } else if deletionPolicy == "DISABLE" { - url, err = tpgresource.ReplaceVars(d, config, "{{SecretManagerBasePath}}{{name}}:disable") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}SecretManagerBasePath{{"}}"}}{{"{{"}}name{{"}}"}}:disable") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_delete/spanner_instance.go.tmpl b/mmv1/templates/terraform/pre_delete/spanner_instance.go.tmpl index 4104430b19ed..c4319d1d2ad8 100644 --- a/mmv1/templates/terraform/pre_delete/spanner_instance.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/spanner_instance.go.tmpl @@ -1,6 +1,6 @@ if d.Get("force_destroy").(bool) { - backupsUrl, err := tpgresource.ReplaceVars(d, config, "{{SpannerBasePath}}projects/{{project}}/instances/{{name}}/backups") + backupsUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}SpannerBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/instances/{{"{{"}}name{{"}}"}}/backups") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_delete/storage_hmac_key.go.tmpl b/mmv1/templates/terraform/pre_delete/storage_hmac_key.go.tmpl index ec08daf8df98..cfcf3bb185ff 100644 --- a/mmv1/templates/terraform/pre_delete/storage_hmac_key.go.tmpl +++ b/mmv1/templates/terraform/pre_delete/storage_hmac_key.go.tmpl @@ -1,4 +1,4 @@ -getUrl, err := tpgresource.ReplaceVars(d, config, "{{StorageBasePath}}projects/{{project}}/hmacKeys/{{access_id}}") +getUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}StorageBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/hmacKeys/{{"{{"}}access_id{{"}}"}}") if err != nil { return err } @@ -18,7 +18,7 @@ if err != nil { // updates if v := getRes["state"]; v == "ACTIVE" { getRes["state"] = "INACTIVE" - updateUrl, err := tpgresource.ReplaceVars(d, config, "{{StorageBasePath}}projects/{{project}}/hmacKeys/{{access_id}}") + updateUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}StorageBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/hmacKeys/{{"{{"}}access_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_read/cloudbuild_trigger.go.tmpl b/mmv1/templates/terraform/pre_read/cloudbuild_trigger.go.tmpl index 0a71090f0b4c..a667df5b7aad 100644 --- a/mmv1/templates/terraform/pre_read/cloudbuild_trigger.go.tmpl +++ b/mmv1/templates/terraform/pre_read/cloudbuild_trigger.go.tmpl @@ -1,16 +1,14 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} // To support import with the legacy id format. url = strings.ReplaceAll(url, "/locations//", "/locations/global/") diff --git a/mmv1/templates/terraform/pre_read/go/cloudbuild_trigger.go.tmpl b/mmv1/templates/terraform/pre_read/go/cloudbuild_trigger.go.tmpl deleted file mode 100644 index a667df5b7aad..000000000000 --- a/mmv1/templates/terraform/pre_read/go/cloudbuild_trigger.go.tmpl +++ /dev/null @@ -1,14 +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. -*/ -}} - // To support import with the legacy id format. - url = strings.ReplaceAll(url, "/locations//", "/locations/global/") diff --git a/mmv1/templates/terraform/pre_read/go/kms_autokey_config_folder.go.tmpl b/mmv1/templates/terraform/pre_read/go/kms_autokey_config_folder.go.tmpl deleted file mode 100644 index db8c46af1299..000000000000 --- a/mmv1/templates/terraform/pre_read/go/kms_autokey_config_folder.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -url = strings.Replace(url, "folders/folders/", "folders/", 1) diff --git a/mmv1/templates/terraform/pre_read/go/logging_log_view.go.tmpl b/mmv1/templates/terraform/pre_read/go/logging_log_view.go.tmpl deleted file mode 100644 index 60010522f115..000000000000 --- a/mmv1/templates/terraform/pre_read/go/logging_log_view.go.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} -resourceLoggingLogViewEncoder(d, nil, nil) -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}LoggingBasePath{{"}}"}}{{"{{"}}parent{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/buckets/{{"{{"}}bucket{{"}}"}}/views/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_read/go/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/pre_read/go/monitoring_monitored_project.go.tmpl deleted file mode 100644 index 128b7d413c8b..000000000000 --- a/mmv1/templates/terraform/pre_read/go/monitoring_monitored_project.go.tmpl +++ /dev/null @@ -1,22 +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 := d.Get("name").(string) -name = tpgresource.GetResourceNameFromSelfLink(name) -d.Set("name", name) -metricsScope := d.Get("metrics_scope").(string) -metricsScope = tpgresource.GetResourceNameFromSelfLink(metricsScope) -d.Set("metrics_scope", metricsScope) -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}MonitoringBasePath{{"}}"}}v1/locations/global/metricsScopes/{{"{{"}}metrics_scope{{"}}"}}") -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_read/go/org_policy_policy.go.tmpl b/mmv1/templates/terraform/pre_read/go/org_policy_policy.go.tmpl deleted file mode 100644 index 694de3890aa9..000000000000 --- a/mmv1/templates/terraform/pre_read/go/org_policy_policy.go.tmpl +++ /dev/null @@ -1,19 +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. -*/ -}} -// Call the encoder to shorten name even if the resource is created by another provider version. -resourceOrgPolicyPolicyEncoder(d, nil, nil) -// Re-create the url. -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}OrgPolicyBasePath{{"}}"}}{{"{{"}}parent{{"}}"}}/policies/{{"{{"}}name{{"}}"}}") -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_read/go/secret_version_is_secret_data_base64.go.tmpl b/mmv1/templates/terraform/pre_read/go/secret_version_is_secret_data_base64.go.tmpl deleted file mode 100644 index 2be63e64d3ce..000000000000 --- a/mmv1/templates/terraform/pre_read/go/secret_version_is_secret_data_base64.go.tmpl +++ /dev/null @@ -1,18 +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. -*/ -}} -// Explicitly set the field to default value if unset -if _, ok := d.GetOkExists("is_secret_data_base64"); !ok { - if err := d.Set("is_secret_data_base64", false); err != nil { - return fmt.Errorf("Error setting is_secret_data_base64: %s", err) - } -} diff --git a/mmv1/templates/terraform/pre_read/go/service_networking_vpc_service_controls.go.tmpl b/mmv1/templates/terraform/pre_read/go/service_networking_vpc_service_controls.go.tmpl deleted file mode 100644 index dcfef3524bc1..000000000000 --- a/mmv1/templates/terraform/pre_read/go/service_networking_vpc_service_controls.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -project, err := tpgresource.GetProject(d, config) -if err != nil { - return err -} -projectNumber, err := getProjectNumber(d, config, project, userAgent) -if err != nil { - return err -} - -service := d.Get("service").(string) -network := d.Get("network").(string) -parent := fmt.Sprintf("services/%s/projects/%s/global/networks/%s", service, projectNumber, network) -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ServiceNetworkingBasePath{{"}}"}}"+parent+"/vpcServiceControls") -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_read/logging_log_view.go.tmpl b/mmv1/templates/terraform/pre_read/logging_log_view.go.tmpl index 8722c8235d77..60010522f115 100644 --- a/mmv1/templates/terraform/pre_read/logging_log_view.go.tmpl +++ b/mmv1/templates/terraform/pre_read/logging_log_view.go.tmpl @@ -1,19 +1,17 @@ -<%- # 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. --%> +{{/* + 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. +*/ -}} resourceLoggingLogViewEncoder(d, nil, nil) -url, err = tpgresource.ReplaceVars(d, config, "{{LoggingBasePath}}{{parent}}/locations/{{location}}/buckets/{{bucket}}/views/{{name}}") +url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}LoggingBasePath{{"}}"}}{{"{{"}}parent{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/buckets/{{"{{"}}bucket{{"}}"}}/views/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_read/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/pre_read/monitoring_monitored_project.go.tmpl index 0c73fb8b4eea..128b7d413c8b 100644 --- a/mmv1/templates/terraform/pre_read/monitoring_monitored_project.go.tmpl +++ b/mmv1/templates/terraform/pre_read/monitoring_monitored_project.go.tmpl @@ -1,24 +1,22 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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 := d.Get("name").(string) name = tpgresource.GetResourceNameFromSelfLink(name) d.Set("name", name) metricsScope := d.Get("metrics_scope").(string) metricsScope = tpgresource.GetResourceNameFromSelfLink(metricsScope) d.Set("metrics_scope", metricsScope) -url, err = tpgresource.ReplaceVars(d, config, "{{MonitoringBasePath}}v1/locations/global/metricsScopes/{{metrics_scope}}") +url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}MonitoringBasePath{{"}}"}}v1/locations/global/metricsScopes/{{"{{"}}metrics_scope{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_read/org_policy_policy.go.tmpl b/mmv1/templates/terraform/pre_read/org_policy_policy.go.tmpl index eea754c96478..694de3890aa9 100644 --- a/mmv1/templates/terraform/pre_read/org_policy_policy.go.tmpl +++ b/mmv1/templates/terraform/pre_read/org_policy_policy.go.tmpl @@ -1,21 +1,19 @@ -<%- # 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. --%> +{{/* + 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. +*/ -}} // Call the encoder to shorten name even if the resource is created by another provider version. resourceOrgPolicyPolicyEncoder(d, nil, nil) // Re-create the url. -url, err = tpgresource.ReplaceVars(d, config, "{{OrgPolicyBasePath}}{{parent}}/policies/{{name}}") +url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}OrgPolicyBasePath{{"}}"}}{{"{{"}}parent{{"}}"}}/policies/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_read/secret_version_is_secret_data_base64.go.tmpl b/mmv1/templates/terraform/pre_read/secret_version_is_secret_data_base64.go.tmpl index e51b366178d9..2be63e64d3ce 100644 --- a/mmv1/templates/terraform/pre_read/secret_version_is_secret_data_base64.go.tmpl +++ b/mmv1/templates/terraform/pre_read/secret_version_is_secret_data_base64.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} // Explicitly set the field to default value if unset if _, ok := d.GetOkExists("is_secret_data_base64"); !ok { if err := d.Set("is_secret_data_base64", false); err != nil { diff --git a/mmv1/templates/terraform/pre_read/service_networking_vpc_service_controls.go.tmpl b/mmv1/templates/terraform/pre_read/service_networking_vpc_service_controls.go.tmpl index 9d797f67b310..dcfef3524bc1 100644 --- a/mmv1/templates/terraform/pre_read/service_networking_vpc_service_controls.go.tmpl +++ b/mmv1/templates/terraform/pre_read/service_networking_vpc_service_controls.go.tmpl @@ -10,7 +10,7 @@ if err != nil { service := d.Get("service").(string) network := d.Get("network").(string) parent := fmt.Sprintf("services/%s/projects/%s/global/networks/%s", service, projectNumber, network) -url, err = tpgresource.ReplaceVars(d, config, "{{ServiceNetworkingBasePath}}"+parent+"/vpcServiceControls") +url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ServiceNetworkingBasePath{{"}}"}}"+parent+"/vpcServiceControls") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_update/bigquerydatatransfer_config.tmpl b/mmv1/templates/terraform/pre_update/bigquerydatatransfer_config.tmpl index 9302553ed7df..e51ba35af4c3 100644 --- a/mmv1/templates/terraform/pre_update/bigquerydatatransfer_config.tmpl +++ b/mmv1/templates/terraform/pre_update/bigquerydatatransfer_config.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} updateMask := []string{} if v, ok := d.GetOk("service_account_name"); ok { if v != nil && d.HasChange("service_account_name") { diff --git a/mmv1/templates/terraform/pre_update/bigtable_app_profile.go.tmpl b/mmv1/templates/terraform/pre_update/bigtable_app_profile.go.tmpl index bd5d18746cf4..307208274cb2 100644 --- a/mmv1/templates/terraform/pre_update/bigtable_app_profile.go.tmpl +++ b/mmv1/templates/terraform/pre_update/bigtable_app_profile.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/}} if d.HasChange("multi_cluster_routing_cluster_ids") && !tpgresource.StringInSlice(updateMask, "multiClusterRoutingUseAny") { updateMask = append(updateMask, "multiClusterRoutingUseAny") @@ -47,4 +45,4 @@ if hasStandardIsolation && hasDataBoostIsolationReadOnly { 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_update/cloudbuild_bitbucketserver_config.go.tmpl b/mmv1/templates/terraform/pre_update/cloudbuild_bitbucketserver_config.go.tmpl index 3220c5647e03..48660dc6a80b 100644 --- a/mmv1/templates/terraform/pre_update/cloudbuild_bitbucketserver_config.go.tmpl +++ b/mmv1/templates/terraform/pre_update/cloudbuild_bitbucketserver_config.go.tmpl @@ -6,7 +6,7 @@ for i, field := range updateMask { } } // reconstruct url -url, err = tpgresource.ReplaceVars(d, config, "{{CloudBuildBasePath}}projects/{{project}}/locations/{{location}}/bitbucketServerConfigs/{{config_id}}") +url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudBuildBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_update/cloudbuild_trigger.go.tmpl b/mmv1/templates/terraform/pre_update/cloudbuild_trigger.go.tmpl index 145ad821d145..43cb1b465549 100644 --- a/mmv1/templates/terraform/pre_update/cloudbuild_trigger.go.tmpl +++ b/mmv1/templates/terraform/pre_update/cloudbuild_trigger.go.tmpl @@ -1,15 +1,13 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} obj["id"] = d.Get("trigger_id") diff --git a/mmv1/templates/terraform/pre_update/containeranalysis_note.tmpl b/mmv1/templates/terraform/pre_update/containeranalysis_note.tmpl index 4b3ef4879028..0682fd417cba 100644 --- a/mmv1/templates/terraform/pre_update/containeranalysis_note.tmpl +++ b/mmv1/templates/terraform/pre_update/containeranalysis_note.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} updateMask := []string{} if d.HasChange("attestation_authority.0.hint.0.human_readable_name") { updateMask = append(updateMask, "attestationAuthority.hint.humanReadableName") diff --git a/mmv1/templates/terraform/pre_update/datafusion_instance_update.go.tmpl b/mmv1/templates/terraform/pre_update/datafusion_instance_update.go.tmpl index 0aadbe247fb7..4c4b3d392082 100644 --- a/mmv1/templates/terraform/pre_update/datafusion_instance_update.go.tmpl +++ b/mmv1/templates/terraform/pre_update/datafusion_instance_update.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} updateMask := []string{} if d.HasChange("enable_stackdriver_logging") { diff --git a/mmv1/templates/terraform/pre_update/datastream_stream.go.tmpl b/mmv1/templates/terraform/pre_update/datastream_stream.go.tmpl index 661a52faa84b..abe6ebfe8c38 100644 --- a/mmv1/templates/terraform/pre_update/datastream_stream.go.tmpl +++ b/mmv1/templates/terraform/pre_update/datastream_stream.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/}} if d.HasChange("desired_state") { updateMask = append(updateMask, "state") diff --git a/mmv1/templates/terraform/pre_update/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/pre_update/firebase_database_instance.go.tmpl index 63163447c301..fefaac30ce84 100644 --- a/mmv1/templates/terraform/pre_update/firebase_database_instance.go.tmpl +++ b/mmv1/templates/terraform/pre_update/firebase_database_instance.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} // start of customized code if d.HasChange("desired_state") { diff --git a/mmv1/templates/terraform/pre_update/go/agent_pool.go.tmpl b/mmv1/templates/terraform/pre_update/go/agent_pool.go.tmpl deleted file mode 100644 index 0a62105efaf3..000000000000 --- a/mmv1/templates/terraform/pre_update/go/agent_pool.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -if err := waitForAgentPoolReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Error waiting for AgentPool %q to be CREATED before updating: %q", d.Get("name").(string), err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/alloydb_cluster.go.tmpl b/mmv1/templates/terraform/pre_update/go/alloydb_cluster.go.tmpl deleted file mode 100644 index dcbd075fb019..000000000000 --- a/mmv1/templates/terraform/pre_update/go/alloydb_cluster.go.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -// 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.") -} - -// Implementation for cluster promotion -if d.HasChange("cluster_type") && d.Get("cluster_type") == "PRIMARY" { - - if !d.HasChange("secondary_config") || !tpgresource.IsEmptyValue(reflect.ValueOf(d.Get("secondary_config"))) { - return fmt.Errorf("Remove the secondary_config field to promote the cluster to primary cluster.") - } - - // If necassary precondition checks for cluster promotion is fine ONLY then - // Promote cluster as a separate implementation within the update logic - - promoteUrl := strings.Split(url, "?updateMask=")[0] + ":promote" - emptyObj := make(map[string]interface{}) - - // Remove promote changes from obj and updateMask - delete(obj, "clusterType") - delete(obj, "secondaryConfig") - - index := 0 - for _, label := range updateMask { - if label != "clusterType" && label != "secondaryConfig" { - 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 - } - - // err == nil indicates that the billing_project value was found - if bp, err := tpgresource.GetBillingProject(d, config); err == nil { - billingProject = bp - } - - res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: promoteUrl, - UserAgent: userAgent, - Body: emptyObj, - Timeout: d.Timeout(schema.TimeoutCreate), - }) - if err != nil { - return fmt.Errorf("Error promoting Cluster: %s", err) - } - - err = AlloydbOperationWaitTime( - config, res, project, "Promoting Cluster", userAgent, - d.Timeout(schema.TimeoutCreate)) - - if err != nil { - return fmt.Errorf("Error waiting to promote Cluster: %s", err) - } - - log.Printf("[DEBUG] Finished promoting Cluster %q: %#v", d.Id(), res) - -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/bigquerydatatransfer_config.tmpl b/mmv1/templates/terraform/pre_update/go/bigquerydatatransfer_config.tmpl deleted file mode 100644 index e51ba35af4c3..000000000000 --- a/mmv1/templates/terraform/pre_update/go/bigquerydatatransfer_config.tmpl +++ /dev/null @@ -1,52 +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. -*/ -}} -updateMask := []string{} -if v, ok := d.GetOk("service_account_name"); ok { - if v != nil && d.HasChange("service_account_name") { - updateMask = append(updateMask, "serviceAccountName") - } -} -if d.HasChange("display_name") { - updateMask = append(updateMask, "displayName") -} -if d.HasChange("destination_dataset_id") { - updateMask = append(updateMask, "destinationDatasetId") -} -if d.HasChange("schedule") { - updateMask = append(updateMask, "schedule") -} -if d.HasChange("schedule_options") { - updateMask = append(updateMask, "scheduleOptions") -} -if d.HasChange("email_preferences") { - updateMask = append(updateMask, "emailPreferences") -} -if d.HasChange("notification_pubsub_topic") { - updateMask = append(updateMask, "notificationPubsubTopic") -} -if d.HasChange("data_refresh_window_days") { - updateMask = append(updateMask, "dataRefreshWindowDays") -} -if d.HasChange("disabled") { - updateMask = append(updateMask, "disabled") -} -if d.HasChange("params") { - updateMask = append(updateMask, "params") -} - -// 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 -} diff --git a/mmv1/templates/terraform/pre_update/go/bigtable_app_profile.go.tmpl b/mmv1/templates/terraform/pre_update/go/bigtable_app_profile.go.tmpl deleted file mode 100644 index 307208274cb2..000000000000 --- a/mmv1/templates/terraform/pre_update/go/bigtable_app_profile.go.tmpl +++ /dev/null @@ -1,48 +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. -*/}} - -if d.HasChange("multi_cluster_routing_cluster_ids") && !tpgresource.StringInSlice(updateMask, "multiClusterRoutingUseAny") { - updateMask = append(updateMask, "multiClusterRoutingUseAny") -} - -// this api requires the body to define something for all values passed into -// the update mask, however, multi-cluster routing and single-cluster routing -// are conflicting, so we can't have them both in the update mask, despite -// both of them registering as changing. thus, we need to remove whichever -// one is not defined. -newRouting, oldRouting := d.GetChange("multi_cluster_routing_use_any") -if newRouting != oldRouting { - for i, val := range updateMask { - if val == "multiClusterRoutingUseAny" && newRouting.(bool) || - val == "singleClusterRouting" && oldRouting.(bool) { - updateMask = append(updateMask[0:i], updateMask[i+1:]...) - break - } - } -} - -_, hasStandardIsolation := obj["standardIsolation"] -_, hasDataBoostIsolationReadOnly := obj["dataBoostIsolationReadOnly"] -if hasStandardIsolation && hasDataBoostIsolationReadOnly { - // Due to the "conflicts" both fields should be present only if neither was - // previously specified and the user is now manually adding dataBoostIsolationReadOnly. - delete(obj, "standardIsolation") - updateMask = append(updateMask, "dataBoostIsolationReadOnly") -} - -// 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 -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/certificate_manager_trust_config.go.tmpl b/mmv1/templates/terraform/pre_update/go/certificate_manager_trust_config.go.tmpl deleted file mode 100644 index a966dd00aa40..000000000000 --- a/mmv1/templates/terraform/pre_update/go/certificate_manager_trust_config.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": "*" }) -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_update/go/cloudbuild_bitbucketserver_config.go.tmpl b/mmv1/templates/terraform/pre_update/go/cloudbuild_bitbucketserver_config.go.tmpl deleted file mode 100644 index 48660dc6a80b..000000000000 --- a/mmv1/templates/terraform/pre_update/go/cloudbuild_bitbucketserver_config.go.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -// remove connectedRepositories from updateMask -for i, field := range updateMask { - if field == "connectedRepositories" { - updateMask = append(updateMask[:i], updateMask[i+1:]...) - break - } -} -// reconstruct url -url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}CloudBuildBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/bitbucketServerConfigs/{{"{{"}}config_id{{"}}"}}") -if err != nil { - return err -} -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_update/go/cloudbuild_trigger.go.tmpl b/mmv1/templates/terraform/pre_update/go/cloudbuild_trigger.go.tmpl deleted file mode 100644 index 43cb1b465549..000000000000 --- a/mmv1/templates/terraform/pre_update/go/cloudbuild_trigger.go.tmpl +++ /dev/null @@ -1,13 +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. -*/ -}} - obj["id"] = d.Get("trigger_id") diff --git a/mmv1/templates/terraform/pre_update/go/containeranalysis_note.tmpl b/mmv1/templates/terraform/pre_update/go/containeranalysis_note.tmpl deleted file mode 100644 index 0682fd417cba..000000000000 --- a/mmv1/templates/terraform/pre_update/go/containeranalysis_note.tmpl +++ /dev/null @@ -1,22 +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. -*/ -}} -updateMask := []string{} -if d.HasChange("attestation_authority.0.hint.0.human_readable_name") { - updateMask = append(updateMask, "attestationAuthority.hint.humanReadableName") -} -// 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 -} diff --git a/mmv1/templates/terraform/pre_update/go/containerattached_update.go.tmpl b/mmv1/templates/terraform/pre_update/go/containerattached_update.go.tmpl deleted file mode 100644 index f24227122e00..000000000000 --- a/mmv1/templates/terraform/pre_update/go/containerattached_update.go.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -// The generated code sets the wrong masks for the following fields. -newUpdateMask := []string{} -if d.HasChange("authorization.0.admin_users") { - newUpdateMask = append(newUpdateMask, "authorization.admin_users") -} -if d.HasChange("authorization.0.admin_groups") { - newUpdateMask = append(newUpdateMask, "authorization.admin_groups") -} -if d.HasChange("logging_config") { - newUpdateMask = append(newUpdateMask, "logging_config.component_config.enable_components") -} -if d.HasChange("monitoring_config") { - newUpdateMask = append(newUpdateMask, "monitoring_config.managed_prometheus_config.enabled") -} -if d.HasChange("binary_authorization") { - newUpdateMask = append(newUpdateMask, "binary_authorization.evaluation_mode") -} -if d.HasChange("proxy_config") { - newUpdateMask = append(newUpdateMask, "proxy_config.kubernetes_secret.name") - newUpdateMask = append(newUpdateMask, "proxy_config.kubernetes_secret.namespace") -} -if d.HasChange("security_posture_config") { - newUpdateMask = append(newUpdateMask, "security_posture_config.vulnerability_mode") -} -// Pull out any other set fields from the generated mask. -for _, mask := range updateMask { - if mask == "authorization" || mask == "loggingConfig" || mask == "monitoringConfig" || mask == "binaryAuthorization" || mask == "proxyConfig" || mask == "securityPostureConfig" { - continue - } - newUpdateMask = append(newUpdateMask, mask) -} -// Overwrite the previously set mask. -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(newUpdateMask, ",")}) -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_update/go/datafusion_instance_update.go.tmpl b/mmv1/templates/terraform/pre_update/go/datafusion_instance_update.go.tmpl deleted file mode 100644 index 4c4b3d392082..000000000000 --- a/mmv1/templates/terraform/pre_update/go/datafusion_instance_update.go.tmpl +++ /dev/null @@ -1,33 +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. -*/ -}} -updateMask := []string{} - -if d.HasChange("enable_stackdriver_logging") { - updateMask = append(updateMask, "enableStackdriverLogging") -} - -if d.HasChange("enable_stackdriver_monitoring") { - updateMask = append(updateMask, "enableStackdriverMonitoring") -} - -if d.HasChange("enable_rbac") { - updateMask = append(updateMask, "enableRbac") -} - -// 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 -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/datastream_stream.go.tmpl b/mmv1/templates/terraform/pre_update/go/datastream_stream.go.tmpl deleted file mode 100644 index abe6ebfe8c38..000000000000 --- a/mmv1/templates/terraform/pre_update/go/datastream_stream.go.tmpl +++ /dev/null @@ -1,39 +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. -*/}} - -if d.HasChange("desired_state") { - updateMask = append(updateMask, "state") -} - -// Override the previous setting of updateMask to include state. -// 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 -} - -// lables and terraform_labels fields are overriden with the labels before updating inside the function waitForDatastreamStreamReady -labels := d.Get("labels") -terraformLabels := d.Get("terraform_labels") - -if err := waitForDatastreamStreamReady(d, config, d.Timeout(schema.TimeoutCreate) - time.Minute); err != nil { - return fmt.Errorf("Error waiting for Stream %q to be NOT_STARTED, RUNNING, or PAUSED before updating: %q", d.Get("name").(string), err) -} - -if err := d.Set("labels", labels); err != nil { - return fmt.Errorf("Error setting back labels field: %s", err) -} -if err := d.Set("terraform_labels", terraformLabels); err != nil { - return fmt.Errorf("Error setting back terraform_labels field: %s", err) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/firebase_database_instance.go.tmpl b/mmv1/templates/terraform/pre_update/go/firebase_database_instance.go.tmpl deleted file mode 100644 index fefaac30ce84..000000000000 --- a/mmv1/templates/terraform/pre_update/go/firebase_database_instance.go.tmpl +++ /dev/null @@ -1,33 +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. -*/ -}} - -// start of customized code -if d.HasChange("desired_state") { - if p, ok := d.GetOk("desired_state"); ok && p.(string) != d.Get("state").(string) { - switch p.(string) { - case "ACTIVE": - if err := enableRTDB(config, d, project, billingProject, userAgent); err != nil { - return err - } - case "DISABLED": - if err := disableRTDB(config, d, project, billingProject, userAgent); err != nil { - return err - } - default: - return fmt.Errorf("Unsupported value in field `desired_state`: %v", p) - } - } - // firebasedatabase does not update UpdateDatabaseInstance endpoint now. - return nil -} -// end of customized code diff --git a/mmv1/templates/terraform/pre_update/go/integrations_auth_config.go.tmpl b/mmv1/templates/terraform/pre_update/go/integrations_auth_config.go.tmpl deleted file mode 100644 index fce7a33fa0ee..000000000000 --- a/mmv1/templates/terraform/pre_update/go/integrations_auth_config.go.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -params := map[string]string {} - -// Move client certificate to url param from request body -if cc, ok := obj["client_certificate"]; ok { - ccm := cc.(map[string]any) - - params["clientCertificate.sslCertificate"] = ccm["ssl_certificate"].(string) - params["clientCertificate.encryptedPrivateKey"] = ccm["encrypted_private_key"].(string) - if pp, ok := ccm["passphrase"]; ok { - params["clientCertificate.passphrase"] = pp.(string) - } - delete(obj, "client_certificate") -} - -// By default allow all fields to be updated via terraform -params["updateMask"] = "*" - -url, err = transport_tpg.AddQueryParams(url, params) -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_update/go/kms_autokey_config_folder.go.tmpl b/mmv1/templates/terraform/pre_update/go/kms_autokey_config_folder.go.tmpl deleted file mode 100644 index db8c46af1299..000000000000 --- a/mmv1/templates/terraform/pre_update/go/kms_autokey_config_folder.go.tmpl +++ /dev/null @@ -1 +0,0 @@ -url = strings.Replace(url, "folders/folders/", "folders/", 1) diff --git a/mmv1/templates/terraform/pre_update/go/kms_crypto_key_version.go.tmpl b/mmv1/templates/terraform/pre_update/go/kms_crypto_key_version.go.tmpl deleted file mode 100644 index 7db52d15e778..000000000000 --- a/mmv1/templates/terraform/pre_update/go/kms_crypto_key_version.go.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -// The generated code does not support conditional update masks. -newUpdateMask := []string{} -if d.HasChange("state") { - newUpdateMask = append(newUpdateMask, "state") -} - -// Validate updated fields based on protection level (EXTERNAL vs EXTERNAL_VPC) -if d.HasChange("external_protection_level_options") { - if d.Get("protection_level") == "EXTERNAL" { - newUpdateMask = append(newUpdateMask, "externalProtectionLevelOptions.externalKeyUri") - } else if d.Get("protection_level") == "EXTERNAL_VPC" { - newUpdateMask = append(newUpdateMask, "externalProtectionLevelOptions.ekmConnectionKeyPath") - } -} -// 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(newUpdateMask, ",")}) -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_update/go/netapp_storagepool.go.tmpl b/mmv1/templates/terraform/pre_update/go/netapp_storagepool.go.tmpl deleted file mode 100644 index f2a44072f39d..000000000000 --- a/mmv1/templates/terraform/pre_update/go/netapp_storagepool.go.tmpl +++ /dev/null @@ -1,65 +0,0 @@ -// detect manual zone switches for service level FLEX - -if d.Get("service_level").(string) == "FLEX" { - // Check if this is zonal or regional Flex. Only continue for regional pool - _, hasZone := d.GetOk("zone") - _, hasReplicaZone := d.GetOk("replica_zone") - if hasZone && hasReplicaZone { - // For a zone switch, user needs to swap zone and replica_zone. Other changes are not allowed - if d.HasChange("zone") && d.HasChange("replica_zone") { - oldZone, newZone := d.GetChange("zone") - oldReplicaZone, newReplicaZone := d.GetChange("replica_zone") - if newZone == oldReplicaZone && newReplicaZone == oldZone { - rawurl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/storagePools/{{"{{"}}name{{"}}"}}:switch") - if err != nil { - return err - } - - reso, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - Project: billingProject, - RawURL: rawurl, - UserAgent: userAgent, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - if err != nil { - return fmt.Errorf("Error switching active zone for pool: %s, %v", d.Id(), err) - } - - err = NetappOperationWaitTime( - config, reso, project, "Switching active pool zone", userAgent, - d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return err - } - - //remove zone and replicaZone from updateMask - n := 0 - for _, v := range updateMask { - if v != "zone" && v != "replicaZone" { - updateMask[n] = v - n++ - } - } - updateMask = updateMask[:n] - - // delete from payload too - delete(obj, "zone") - delete(obj, "replicaZone") - - // PATCH URL was already build prior to this code. We need to rebuild it to catch our changes - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/storagePools/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) - if err != nil { - return err - } - } else { - return fmt.Errorf("Incorrect zone change for pool: %s. Supported zone, replica_zone are : %s, %s", d.Id(), oldZone, oldReplicaZone) - } - } - } -} diff --git a/mmv1/templates/terraform/pre_update/go/network_endpoints.go.tmpl b/mmv1/templates/terraform/pre_update/go/network_endpoints.go.tmpl deleted file mode 100644 index 72ed12375f8a..000000000000 --- a/mmv1/templates/terraform/pre_update/go/network_endpoints.go.tmpl +++ /dev/null @@ -1,62 +0,0 @@ -detachUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/networkEndpointGroups/{{"{{"}}network_endpoint_group{{"}}"}}/detachNetworkEndpoints") -o, n := d.GetChange("network_endpoints") - -oldEndpoints := make(map[NetworkEndpointsNetworkEndpoint]struct{}) -newEndpoints := make(map[NetworkEndpointsNetworkEndpoint]struct{}) - -for _, e := range o.(*schema.Set).List() { - oldEndpoints[NetworkEndpointsNetworkEndpointConvertToStruct(e)] = struct{}{} -} - -for _, e := range n.(*schema.Set).List() { - newEndpoints[NetworkEndpointsNetworkEndpointConvertToStruct(e)] = struct{}{} -} - -// We want to ignore any endpoints that are shared between the two. -endpointsToKeep := make(map[NetworkEndpointsNetworkEndpoint]struct{}) -for e := range oldEndpoints { - if _, ok := newEndpoints[e]; ok { - endpointsToKeep[e] = struct{}{} - } -} -log.Printf("number of old endpoints: %v\n", len(oldEndpoints)) -log.Printf("number of new endpoints: %v\n", len(newEndpoints)) -log.Printf("number of shared endpoints: %v\n", len(endpointsToKeep)) - -for e := range endpointsToKeep { - // Removing all shared endpoints from the old endpoints yields the list of endpoints to detach. - delete(oldEndpoints, e) - // Removing all shared endpoints from the new endpoints yields the list of endpoints to attch. - delete(newEndpoints, e) -} - -var endpointsToDetach []interface{} -for e := range oldEndpoints { - endpointsToDetach = append(endpointsToDetach, NetworkEndpointsNetworkEndpointConvertToAny(e)) -} -var endpointsToAttach []interface{} -for e := range newEndpoints { - endpointsToAttach = append(endpointsToAttach, NetworkEndpointsNetworkEndpointConvertToAny(e)) -} - -log.Printf("number of endpoints to detach: %v\n", len(endpointsToDetach)) -log.Printf("number of endpoints to attach: %v\n", len(endpointsToAttach)) - - -chunkSize := 500 // API only accepts 500 endpoints at a time - -_, err = networkEndpointsPaginatedMutate(d, endpointsToDetach, config, userAgent, detachUrl, project, billingProject, chunkSize, false) -if err != nil { - // networkEndpointsPaginatedMutate already adds error description - return err -} - -lastPage, err := networkEndpointsPaginatedMutate(d, endpointsToAttach, config, userAgent, url, project, billingProject, chunkSize, true) -if err != nil { - // networkEndpointsPaginatedMutate already adds error description - return err -} - -obj = map[string]interface{}{ - "networkEndpoints": lastPage, -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/network_services_gateway.tmpl b/mmv1/templates/terraform/pre_update/go/network_services_gateway.tmpl deleted file mode 100644 index feed1adcc26e..000000000000 --- a/mmv1/templates/terraform/pre_update/go/network_services_gateway.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -if d.Get("type") == "SECURE_WEB_GATEWAY" { - obj["name"] = d.Get("name") - obj["type"] = d.Get("type") -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/notebooks_runtime.go.tmpl b/mmv1/templates/terraform/pre_update/go/notebooks_runtime.go.tmpl deleted file mode 100644 index 34d7c37fd14d..000000000000 --- a/mmv1/templates/terraform/pre_update/go/notebooks_runtime.go.tmpl +++ /dev/null @@ -1,67 +0,0 @@ -// remove virtualMachine from updateMask -callSwitch := false -for i, field := range updateMask { - if field == "virtualMachine" { - callSwitch = true - updateMask = append(updateMask[:i], updateMask[i+1:]...) - break - } -} - -if callSwitch { - // reconstruct url - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}NotebooksBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/runtimes/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) - if err != nil { - return err - } - - state := d.Get("state").(string) - if state == "INITIALIZING" { - time.Sleep(300 * time.Second) - } - - switchURL, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NotebooksBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/runtimes/{{"{{"}}name{{"}}"}}:switch") - if err != nil { - return err - } - log.Printf("[DEBUG] Switching Runtime: %q", d.Id()) - - switchObj := make(map[string]interface{}) - machineType := d.Get("virtual_machine.0.virtual_machine_config.0.machine_type") - switchObj["machineType"] = machineType - - acceleratorConfigInterface := make(map[string]interface{}) - _, ok := d.GetOk("virtual_machine.0.virtual_machine_config.0.accelerator_config") - if ok { - acceleratorConfigInterface["coreCount"] = d.Get("virtual_machine.0.virtual_machine_config.0.accelerator_config.0.core_count") - acceleratorConfigInterface["type"] = d.Get("virtual_machine.0.virtual_machine_config.0.accelerator_config.0.type") - } - switchObj["acceleratorConfig"] = acceleratorConfigInterface - - - dRes, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "POST", - RawURL: switchURL, - UserAgent: userAgent, - Body: switchObj, - Timeout: d.Timeout(schema.TimeoutUpdate), - }) - - if err != nil { - return fmt.Errorf("Error switching Runtime: %s", err) - } - - var opRes map[string]interface{} - err = NotebooksOperationWaitTimeWithResponse( - config, dRes, &opRes, project, "Switching runtime", userAgent, - d.Timeout(schema.TimeoutUpdate)) - if err != nil { - return fmt.Errorf("Error switching runtime: %s", err) - } - -} diff --git a/mmv1/templates/terraform/pre_update/go/org_policy_policy.go.tmpl b/mmv1/templates/terraform/pre_update/go/org_policy_policy.go.tmpl deleted file mode 100644 index dd539a098b9a..000000000000 --- a/mmv1/templates/terraform/pre_update/go/org_policy_policy.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. -*/ -}} -updateMask := []string{} - -if d.HasChange("spec") { - updateMask = append(updateMask, "policy.spec") -} - -if d.HasChange("dry_run_spec") { - updateMask = append(updateMask, "policy.dryRunSpec") -} - -// 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 -} diff --git a/mmv1/templates/terraform/pre_update/go/privateca_certificate_authority.go.tmpl b/mmv1/templates/terraform/pre_update/go/privateca_certificate_authority.go.tmpl deleted file mode 100644 index a921cf480800..000000000000 --- a/mmv1/templates/terraform/pre_update/go/privateca_certificate_authority.go.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -if d.HasChange("subordinate_config") { - if d.Get("type").(string) != "SUBORDINATE" { - return fmt.Errorf("`subordinate_config` can only be configured on subordinate CA") - } - - // Activate subordinate CA in `AWAITING_USER_ACTIVATION` state. - if d.Get("state") == "AWAITING_USER_ACTIVATION" { - if _, ok := d.GetOk("pem_ca_certificate"); ok { - // Third party issuer - log.Printf("[DEBUG] Activating CertificateAuthority with third party issuer") - if err := activateSubCAWithThirdPartyIssuer(config, d, project, billingProject, userAgent); err != nil { - return fmt.Errorf("Error activating subordinate CA with third party issuer: %v", err) - } - } else { - // First party issuer - log.Printf("[DEBUG] Activating CertificateAuthority with first party issuer") - if err := activateSubCAWithFirstPartyIssuer(config, d, project, billingProject, userAgent); err != nil { - return fmt.Errorf("Error activating subordinate CA with first party issuer: %v", err) - } - } - log.Printf("[DEBUG] CertificateAuthority activated") - } -} - -log.Printf("[DEBUG] checking desired_state") -if d.HasChange("desired_state") { - // Currently, most CA state update operations are not idempotent. - // Try to change state only if the current `state` does not match the `desired_state`. - if p, ok := d.GetOk("desired_state"); ok && p.(string) != d.Get("state").(string) { - switch p.(string) { - case "ENABLED": - if err := enableCA(config, d, project, billingProject, userAgent); err != nil { - return fmt.Errorf("Error enabling CertificateAuthority: %v", err) - } - case "DISABLED": - if err := disableCA(config, d, project, billingProject, userAgent); err != nil { - return fmt.Errorf("Error disabling CertificateAuthority: %v", err) - } - default: - return fmt.Errorf("Unsupported value in field `desired_state`") - } - } -} diff --git a/mmv1/templates/terraform/pre_update/go/privileged_access_manager_entitlement.go.tmpl b/mmv1/templates/terraform/pre_update/go/privileged_access_manager_entitlement.go.tmpl deleted file mode 100644 index 3855742cd66c..000000000000 --- a/mmv1/templates/terraform/pre_update/go/privileged_access_manager_entitlement.go.tmpl +++ /dev/null @@ -1,13 +0,0 @@ - approvalWorkflowProp, err := expandPrivilegedAccessManagerEntitlementApprovalWorkflow(d.Get("approval_workflow"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("approval_workflow"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, approvalWorkflowProp)) { - obj["approvalWorkflow"] = approvalWorkflowProp - } - if d.HasChange("approval_workflow") { - updateMask = append(updateMask, "approvalWorkflow") - } - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) - if err != nil { - return err - } diff --git a/mmv1/templates/terraform/pre_update/go/secret_manager_regional_secret.go.tmpl b/mmv1/templates/terraform/pre_update/go/secret_manager_regional_secret.go.tmpl deleted file mode 100644 index d8e8c9875701..000000000000 --- a/mmv1/templates/terraform/pre_update/go/secret_manager_regional_secret.go.tmpl +++ /dev/null @@ -1,16 +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. -*/ -}} -// As the API expects only one of ttl or expireTime -if d.HasChange("ttl") && !d.HasChange("expire_time") { - delete(obj, "expireTime") -} diff --git a/mmv1/templates/terraform/pre_update/go/secret_manager_secret.go.tmpl b/mmv1/templates/terraform/pre_update/go/secret_manager_secret.go.tmpl deleted file mode 100644 index 9148003b9a23..000000000000 --- a/mmv1/templates/terraform/pre_update/go/secret_manager_secret.go.tmpl +++ /dev/null @@ -1,35 +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. -*/ -}} -replicationProp, err := expandSecretManagerSecretReplication(d.Get("replication"), d, config) -if err != nil { - return err -} else if v, ok := d.GetOkExists("replication"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, replicationProp)) { - obj["replication"] = replicationProp -} - -if d.HasChange("replication") { - updateMask = append(updateMask, "replication") -} - -// As the API expects only one of ttl or expireTime -if d.HasChange("ttl") && !d.HasChange("expire_time") { - delete(obj, "expireTime") -} - -// Refreshing updateMask after adding extra schema entries -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -if err != nil { - return err -} - -log.Printf("[DEBUG] Update URL %q: %v", d.Id(), url) diff --git a/mmv1/templates/terraform/pre_update/go/shared_reservation_update.go.tmpl b/mmv1/templates/terraform/pre_update/go/shared_reservation_update.go.tmpl deleted file mode 100644 index fa4b9203fbce..000000000000 --- a/mmv1/templates/terraform/pre_update/go/shared_reservation_update.go.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -if d.HasChange("share_settings") { - url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/reservations/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - urlUpdateMask := obj["urlUpdateMask"] - if urlUpdateMask != nil { - url = url + urlUpdateMask.(string) - delete(obj, "urlUpdateMask") - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/spanner_database.go.tmpl b/mmv1/templates/terraform/pre_update/go/spanner_database.go.tmpl deleted file mode 100644 index f0ad51601fd6..000000000000 --- a/mmv1/templates/terraform/pre_update/go/spanner_database.go.tmpl +++ /dev/null @@ -1,30 +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. -*/ -}} - -if obj["statements"] != nil { - if len(obj["statements"].([]string)) == 0 { - // Return early to avoid making an API call that errors, - // due to containing no DDL SQL statements - d.Partial(false) - return resourceSpannerDatabaseRead(d, meta) - } -} - -if resourceSpannerDBVirtualUpdate(d, ResourceSpannerDatabase().Schema) { - if d.Get("deletion_protection") != nil { - if err := d.Set("deletion_protection", d.Get("deletion_protection")); err != nil { - return fmt.Errorf("Error reading Instance: %s", err) - } - } - return nil -} diff --git a/mmv1/templates/terraform/pre_update/go/spanner_instance.go.tmpl b/mmv1/templates/terraform/pre_update/go/spanner_instance.go.tmpl deleted file mode 100644 index f916db0a5364..000000000000 --- a/mmv1/templates/terraform/pre_update/go/spanner_instance.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -if resourceSpannerInstanceVirtualUpdate(d, ResourceSpannerInstance().Schema) { - if d.Get("force_destroy") != nil { - if err := d.Set("force_destroy", d.Get("force_destroy")); err != nil { - return fmt.Errorf("Error reading Instance: %s", err) - } - } - return nil -} diff --git a/mmv1/templates/terraform/pre_update/go/spanner_schedule_backup.go.tmpl b/mmv1/templates/terraform/pre_update/go/spanner_schedule_backup.go.tmpl deleted file mode 100644 index c4ce350594b3..000000000000 --- a/mmv1/templates/terraform/pre_update/go/spanner_schedule_backup.go.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -// The generated code sets the wrong masks for the following fields. -newUpdateMask := []string{} -if d.HasChange("spec.0.cron_spec.0.text") { - newUpdateMask = append(newUpdateMask, "spec.cron_spec.text") -} -// Pull out any other set fields from the generated mask. -for _, mask := range updateMask { - if mask == "spec" { - continue - } - newUpdateMask = append(newUpdateMask, mask) -} -// Overwrite the previously set mask. -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(newUpdateMask, ",")}) -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_update/go/tagtemplate_fields.go.tmpl b/mmv1/templates/terraform/pre_update/go/tagtemplate_fields.go.tmpl deleted file mode 100644 index 325df245db41..000000000000 --- a/mmv1/templates/terraform/pre_update/go/tagtemplate_fields.go.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -updateMask := []string{} - -if d.HasChange("display_name") { - updateMask = append(updateMask, "displayName") -} - -// 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 -} - -if len(updateMask) > 0 { \ No newline at end of file diff --git a/mmv1/templates/terraform/pre_update/go/vertex_ai_index.go.tmpl b/mmv1/templates/terraform/pre_update/go/vertex_ai_index.go.tmpl deleted file mode 100644 index 8f5c37a87477..000000000000 --- a/mmv1/templates/terraform/pre_update/go/vertex_ai_index.go.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -newUpdateMask := []string{} - -if d.HasChange("metadata.0.contents_delta_uri") { - // Use the current value of isCompleteOverwrite when updating contentsDeltaUri - newUpdateMask = append(newUpdateMask, "metadata.contentsDeltaUri") - newUpdateMask = append(newUpdateMask, "metadata.isCompleteOverwrite") -} - -for _, mask := range updateMask { - // Use granular update masks instead of 'metadata' to avoid the following error: - // 'If `contents_delta_gcs_uri` is set as part of `index.metadata`, then no other Index fields can be also updated as part of the same update call.' - if mask == "metadata" { - continue - } - newUpdateMask = append(newUpdateMask, mask) -} - -// Refreshing updateMask after adding extra schema entries -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(newUpdateMask, ",")}) -if err != nil { - return err -} diff --git a/mmv1/templates/terraform/pre_update/go/workbench_instance.go.tmpl b/mmv1/templates/terraform/pre_update/go/workbench_instance.go.tmpl deleted file mode 100644 index b1fb82cd28c9..000000000000 --- a/mmv1/templates/terraform/pre_update/go/workbench_instance.go.tmpl +++ /dev/null @@ -1,64 +0,0 @@ -// Build custom mask since the notebooks API does not support gce_setup as a valid mask -stopInstance := false -newUpdateMask := []string{} -if d.HasChange("gce_setup.0.machine_type") { - newUpdateMask = append(newUpdateMask, "gce_setup.machine_type") - stopInstance = true -} -if d.HasChange("gce_setup.0.accelerator_configs") { - newUpdateMask = append(newUpdateMask, "gce_setup.accelerator_configs") - stopInstance = true -} -if d.HasChange("gce_setup.0.shielded_instance_config.0.enable_secure_boot") { - newUpdateMask = append(newUpdateMask, "gce_setup.shielded_instance_config.enable_secure_boot") - stopInstance = true -} -if d.HasChange("gce_setup.0.shielded_instance_config.0.enable_vtpm") { - newUpdateMask = append(newUpdateMask, "gce_setup.shielded_instance_config.enable_vtpm") - stopInstance = true -} -if d.HasChange("gce_setup.0.shielded_instance_config.0.enable_integrity_monitoring") { - newUpdateMask = append(newUpdateMask, "gce_setup.shielded_instance_config.enable_integrity_monitoring") - stopInstance = true -} -if d.HasChange("gce_setup.0.metadata") { - newUpdateMask = append(newUpdateMask, "gceSetup.metadata") -} -if d.HasChange("effective_labels") { - newUpdateMask = append(newUpdateMask, "labels") -} -updateMask = newUpdateMask -// Overwrite the previously set mask. -url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(newUpdateMask, ",")}) -if err != nil { - return err -} - -name := d.Get("name").(string) -if stopInstance{ - state := d.Get("state").(string) - - if state != "STOPPED" { - dRes, err := modifyWorkbenchInstanceState(config, d, project, billingProject, userAgent, "stop") - if err != nil { - return err - } - - if err := waitForWorkbenchOperation(config, d, project, billingProject, userAgent, dRes); err != nil { - return fmt.Errorf("Error stopping Workbench Instance: %s", err) - } - - } else { - log.Printf("[DEBUG] Workbench Instance %q has state %q.", name, state) - } - -} else { - log.Printf("[DEBUG] Workbench Instance %q need not be stopped for the update.", name) -} - -if d.HasChange("gce_setup.0.boot_disk.0.disk_size_gb") { - resizeWorkbenchInstanceDisk(config, d, project, userAgent, true) -} -if d.HasChange("gce_setup.0.data_disks.0.disk_size_gb") { - resizeWorkbenchInstanceDisk(config, d, project, userAgent, false) -} diff --git a/mmv1/templates/terraform/pre_update/netapp_storagepool.go.tmpl b/mmv1/templates/terraform/pre_update/netapp_storagepool.go.tmpl index 86e47f1349e2..f2a44072f39d 100644 --- a/mmv1/templates/terraform/pre_update/netapp_storagepool.go.tmpl +++ b/mmv1/templates/terraform/pre_update/netapp_storagepool.go.tmpl @@ -10,7 +10,7 @@ if d.Get("service_level").(string) == "FLEX" { oldZone, newZone := d.GetChange("zone") oldReplicaZone, newReplicaZone := d.GetChange("replica_zone") if newZone == oldReplicaZone && newReplicaZone == oldZone { - rawurl, err := tpgresource.ReplaceVars(d, config, "{{NetappBasePath}}projects/{{project}}/locations/{{location}}/storagePools/{{name}}:switch") + rawurl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/storagePools/{{"{{"}}name{{"}}"}}:switch") if err != nil { return err } @@ -49,7 +49,7 @@ if d.Get("service_level").(string) == "FLEX" { delete(obj, "replicaZone") // PATCH URL was already build prior to this code. We need to rebuild it to catch our changes - url, err = tpgresource.ReplaceVars(d, config, "{{NetappBasePath}}projects/{{project}}/locations/{{location}}/storagePools/{{name}}") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}NetappBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/storagePools/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_update/network_endpoints.go.tmpl b/mmv1/templates/terraform/pre_update/network_endpoints.go.tmpl index 4770aa3797d1..72ed12375f8a 100644 --- a/mmv1/templates/terraform/pre_update/network_endpoints.go.tmpl +++ b/mmv1/templates/terraform/pre_update/network_endpoints.go.tmpl @@ -1,4 +1,4 @@ -detachUrl, err := tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/detachNetworkEndpoints") +detachUrl, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/networkEndpointGroups/{{"{{"}}network_endpoint_group{{"}}"}}/detachNetworkEndpoints") o, n := d.GetChange("network_endpoints") oldEndpoints := make(map[NetworkEndpointsNetworkEndpoint]struct{}) diff --git a/mmv1/templates/terraform/pre_update/notebooks_runtime.go.tmpl b/mmv1/templates/terraform/pre_update/notebooks_runtime.go.tmpl index 7dabeefc1683..34d7c37fd14d 100644 --- a/mmv1/templates/terraform/pre_update/notebooks_runtime.go.tmpl +++ b/mmv1/templates/terraform/pre_update/notebooks_runtime.go.tmpl @@ -10,7 +10,7 @@ for i, field := range updateMask { if callSwitch { // reconstruct url - url, err = tpgresource.ReplaceVars(d, config, "{{NotebooksBasePath}}projects/{{project}}/locations/{{location}}/runtimes/{{name}}") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}NotebooksBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/runtimes/{{"{{"}}name{{"}}"}}") if err != nil { return err } @@ -24,7 +24,7 @@ if callSwitch { time.Sleep(300 * time.Second) } - switchURL, err := tpgresource.ReplaceVars(d, config, "{{NotebooksBasePath}}projects/{{project}}/locations/{{location}}/runtimes/{{name}}:switch") + switchURL, err := tpgresource.ReplaceVars(d, config, "{{"{{"}}NotebooksBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/locations/{{"{{"}}location{{"}}"}}/runtimes/{{"{{"}}name{{"}}"}}:switch") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_update/org_policy_policy.go.tmpl b/mmv1/templates/terraform/pre_update/org_policy_policy.go.tmpl index 325e52fd16b6..dd539a098b9a 100644 --- a/mmv1/templates/terraform/pre_update/org_policy_policy.go.tmpl +++ b/mmv1/templates/terraform/pre_update/org_policy_policy.go.tmpl @@ -1,17 +1,15 @@ -<%- # 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. --%> +{{/* + 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. +*/ -}} updateMask := []string{} if d.HasChange("spec") { diff --git a/mmv1/templates/terraform/pre_update/secret_manager_regional_secret.go.tmpl b/mmv1/templates/terraform/pre_update/secret_manager_regional_secret.go.tmpl index 2032bfc61d54..d8e8c9875701 100644 --- a/mmv1/templates/terraform/pre_update/secret_manager_regional_secret.go.tmpl +++ b/mmv1/templates/terraform/pre_update/secret_manager_regional_secret.go.tmpl @@ -1,17 +1,15 @@ -<%- # 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. --%> +{{/* + 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. +*/ -}} // As the API expects only one of ttl or expireTime if d.HasChange("ttl") && !d.HasChange("expire_time") { delete(obj, "expireTime") diff --git a/mmv1/templates/terraform/pre_update/secret_manager_secret.go.tmpl b/mmv1/templates/terraform/pre_update/secret_manager_secret.go.tmpl index 138b27ab4308..9148003b9a23 100644 --- a/mmv1/templates/terraform/pre_update/secret_manager_secret.go.tmpl +++ b/mmv1/templates/terraform/pre_update/secret_manager_secret.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} replicationProp, err := expandSecretManagerSecretReplication(d.Get("replication"), d, config) if err != nil { return err diff --git a/mmv1/templates/terraform/pre_update/shared_reservation_update.go.tmpl b/mmv1/templates/terraform/pre_update/shared_reservation_update.go.tmpl index 95deb08b80be..fa4b9203fbce 100644 --- a/mmv1/templates/terraform/pre_update/shared_reservation_update.go.tmpl +++ b/mmv1/templates/terraform/pre_update/shared_reservation_update.go.tmpl @@ -1,5 +1,5 @@ if d.HasChange("share_settings") { - url, err = tpgresource.ReplaceVars(d, config, "{{ComputeBasePath}}projects/{{project}}/zones/{{zone}}/reservations/{{name}}") + url, err = tpgresource.ReplaceVars(d, config, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/zones/{{"{{"}}zone{{"}}"}}/reservations/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/templates/terraform/pre_update/spanner_database.go.tmpl b/mmv1/templates/terraform/pre_update/spanner_database.go.tmpl index b7f3d4eecc9b..f0ad51601fd6 100644 --- a/mmv1/templates/terraform/pre_update/spanner_database.go.tmpl +++ b/mmv1/templates/terraform/pre_update/spanner_database.go.tmpl @@ -1,17 +1,15 @@ -<%- # the license inside this block applies to this file - # Copyright 2022 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. --%> +{{/* + 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. +*/ -}} if obj["statements"] != nil { if len(obj["statements"].([]string)) == 0 { diff --git a/mmv1/templates/terraform/state_migrations/big_query_job.go.tmpl b/mmv1/templates/terraform/state_migrations/big_query_job.go.tmpl index 53fe4496e0cc..71381431439a 100644 --- a/mmv1/templates/terraform/state_migrations/big_query_job.go.tmpl +++ b/mmv1/templates/terraform/state_migrations/big_query_job.go.tmpl @@ -21,8 +21,8 @@ func resourceBigQueryJobResourceV0() *schema.Resource { Required: true, ForceNew: true, DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{table_id}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}' if not.`, + Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, +or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, }, "dataset_id": { Type: schema.TypeString, @@ -88,8 +88,8 @@ The BigQuery Service Account associated with your project requires access to thi Required: true, ForceNew: true, DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{table_id}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}' if not.`, + Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, +or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, }, "dataset_id": { Type: schema.TypeString, @@ -217,8 +217,8 @@ Default is ','`, Required: true, ForceNew: true, DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{table_id}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}' if not.`, + Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, +or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, }, "dataset_id": { Type: schema.TypeString, @@ -286,8 +286,8 @@ Please refer to the field 'effective_labels' for all of the labels present on th Required: true, ForceNew: true, DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{table_id}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}' if not.`, + Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, +or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, }, "dataset_id": { Type: schema.TypeString, @@ -616,8 +616,8 @@ Creation, truncation and append actions occur as one atomic update upon job comp Required: true, ForceNew: true, DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The dataset. Can be specified '{{dataset_id}}' if 'project_id' is also set, -or of the form 'projects/{{project}}/datasets/{{dataset_id}}' if not.`, + Description: `The dataset. Can be specified '{{"{{"}}dataset_id{{"}}"}}' if 'project_id' is also set, +or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}' if not.`, }, "project_id": { Type: schema.TypeString, @@ -668,8 +668,8 @@ For queries that produce anonymous (cached) results, this field will be populate Required: true, ForceNew: true, DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{table_id}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}' if not.`, + Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, +or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, }, "dataset_id": { Type: schema.TypeString, diff --git a/mmv1/templates/terraform/state_migrations/cloud_run_service.go.tmpl b/mmv1/templates/terraform/state_migrations/cloud_run_service.go.tmpl index 9c807cef403f..f5d3d215d3e2 100644 --- a/mmv1/templates/terraform/state_migrations/cloud_run_service.go.tmpl +++ b/mmv1/templates/terraform/state_migrations/cloud_run_service.go.tmpl @@ -567,7 +567,7 @@ will use the project's default service account.`, Required: true, Description: `Volume's name.`, }, -<% unless version == "ga" -%> +{{- if ne $.TargetVersionName "ga" }} "empty_dir": { Type: schema.TypeList, Optional: true, @@ -588,7 +588,7 @@ will use the project's default service account.`, }, }, }, -<% end -%> +{{- end }} "secret": { Type: schema.TypeList, Optional: true, diff --git a/mmv1/templates/terraform/state_migrations/go/beyondcorp_app_gateway.go.tmpl b/mmv1/templates/terraform/state_migrations/go/beyondcorp_app_gateway.go.tmpl deleted file mode 100644 index fd604b2d6042..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/beyondcorp_app_gateway.go.tmpl +++ /dev/null @@ -1,106 +0,0 @@ -func resourceBeyondcorpAppGatewayResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `ID of the AppGateway.`, - }, - "display_name": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `An arbitrary user-provided name for the AppGateway.`, - }, - "host_type": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"HOST_TYPE_UNSPECIFIED", "GCP_REGIONAL_MIG", ""}), - Description: `The type of hosting used by the AppGateway. Default value: "HOST_TYPE_UNSPECIFIED" Possible values: ["HOST_TYPE_UNSPECIFIED", "GCP_REGIONAL_MIG"]`, - Default: "HOST_TYPE_UNSPECIFIED", - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Description: `Resource labels to represent user provided metadata. - - -**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}, - }, - "region": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The region of the AppGateway.`, - }, - "type": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"TYPE_UNSPECIFIED", "TCP_PROXY", ""}), - Description: `The type of network connectivity used by the AppGateway. Default value: "TYPE_UNSPECIFIED" Possible values: ["TYPE_UNSPECIFIED", "TCP_PROXY"]`, - Default: "TYPE_UNSPECIFIED", - }, - "allocated_connections": { - Type: schema.TypeList, - Computed: true, - Description: `A list of connections allocated for the Gateway.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "ingress_port": { - Type: schema.TypeInt, - Optional: true, - Description: `The ingress port of an allocated connection.`, - }, - "psc_uri": { - Type: schema.TypeString, - Optional: true, - Description: `The PSC uri of an allocated connection.`, - }, - }, - }, - }, - "effective_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: 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}, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `Represents the different states of a AppGateway.`, - }, - "terraform_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: true, - Description: `The combination of labels configured directly on the resource - and default labels configured on the provider.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "uri": { - Type: schema.TypeString, - Computed: true, - Description: `Server-defined URI for this resource.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceBeyondcorpAppGatewayUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - return tpgresource.TerraformLabelsStateUpgrade(rawState) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/big_query_job.go.tmpl b/mmv1/templates/terraform/state_migrations/go/big_query_job.go.tmpl deleted file mode 100644 index 71381431439a..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/big_query_job.go.tmpl +++ /dev/null @@ -1,948 +0,0 @@ -func resourceBigQueryJobResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "copy": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Copies a table.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "source_tables": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `Source tables to copy.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "table_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, - }, - "dataset_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the dataset containing this table.`, - }, - "project_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the project containing this table.`, - }, - }, - }, - }, - "create_disposition": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"CREATE_IF_NEEDED", "CREATE_NEVER", ""}), - Description: `Specifies whether the job is allowed to create new tables. The following values are supported: -CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. -CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. -Creation, truncation and append actions occur as one atomic update upon job completion Default value: "CREATE_IF_NEEDED" Possible values: ["CREATE_IF_NEEDED", "CREATE_NEVER"]`, - Default: "CREATE_IF_NEEDED", - }, - "destination_encryption_configuration": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Custom encryption configuration (e.g., Cloud KMS keys)`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "kms_key_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. -The BigQuery Service Account associated with your project requires access to this encryption key.`, - }, - "kms_key_version": { - Type: schema.TypeString, - Computed: true, - Description: `Describes the Cloud KMS encryption key version used to protect destination BigQuery table.`, - }, - }, - }, - }, - "destination_table": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `The destination table.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "table_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, - }, - "dataset_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the dataset containing this table.`, - }, - "project_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the project containing this table.`, - }, - }, - }, - }, - "write_disposition": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"WRITE_TRUNCATE", "WRITE_APPEND", "WRITE_EMPTY", ""}), - Description: `Specifies the action that occurs if the destination table already exists. The following values are supported: -WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data and uses the schema from the query result. -WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. -WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. -Each action is atomic and only occurs if BigQuery is able to complete the job successfully. -Creation, truncation and append actions occur as one atomic update upon job completion. Default value: "WRITE_EMPTY" Possible values: ["WRITE_TRUNCATE", "WRITE_APPEND", "WRITE_EMPTY"]`, - Default: "WRITE_EMPTY", - }, - }, - }, - ExactlyOneOf: []string{"query", "load", "copy", "extract"}, - }, - "extract": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Configures an extract job.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "destination_uris": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "compression": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The compression type to use for exported files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. -The default value is NONE. DEFLATE and SNAPPY are only supported for Avro.`, - Default: "NONE", - }, - "destination_format": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO for tables and SAVED_MODEL for models. -The default value for tables is CSV. Tables with nested or repeated fields cannot be exported as CSV. -The default value for models is SAVED_MODEL.`, - }, - "field_delimiter": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `When extracting data in CSV format, this defines the delimiter to use between fields in the exported data. -Default is ','`, - }, - "print_header": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Whether to print out a header row in the results. Default is true.`, - Default: true, - }, - "source_model": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `A reference to the model being exported.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "dataset_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The ID of the dataset containing this model.`, - }, - "model_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The ID of the model.`, - }, - "project_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The ID of the project containing this model.`, - }, - }, - }, - ExactlyOneOf: []string{"extract.0.source_table", "extract.0.source_model"}, - }, - "source_table": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `A reference to the table being exported.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "table_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, - }, - "dataset_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the dataset containing this table.`, - }, - "project_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the project containing this table.`, - }, - }, - }, - ExactlyOneOf: []string{"extract.0.source_table", "extract.0.source_model"}, - }, - "use_avro_logical_types": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Whether to use logical types when extracting to AVRO format.`, - }, - }, - }, - ExactlyOneOf: []string{"query", "load", "copy", "extract"}, - }, - "job_timeout_ms": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Description: `The labels associated with this job. You can use these to organize and group your jobs. - - -**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}, - }, - "load": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Configures a load job.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "destination_table": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `The destination table to load the data into.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "table_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, - }, - "dataset_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the dataset containing this table.`, - }, - "project_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the project containing this table.`, - }, - }, - }, - }, - "source_uris": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `The fully-qualified URIs that point to your data in Google Cloud. -For Google Cloud Storage URIs: Each URI can contain one '\*' wildcard character -and it must come after the 'bucket' name. Size limits related to load jobs apply -to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be -specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. -For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '\*' wildcard character is not allowed.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "allow_jagged_rows": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Accept rows that are missing trailing optional columns. The missing values are treated as nulls. -If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, -an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.`, - Default: false, - }, - "allow_quoted_newlines": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. -The default value is false.`, - Default: false, - }, - "autodetect": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Indicates if we should automatically infer the options and schema for CSV and JSON sources.`, - }, - "create_disposition": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"CREATE_IF_NEEDED", "CREATE_NEVER", ""}), - Description: `Specifies whether the job is allowed to create new tables. The following values are supported: -CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. -CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. -Creation, truncation and append actions occur as one atomic update upon job completion Default value: "CREATE_IF_NEEDED" Possible values: ["CREATE_IF_NEEDED", "CREATE_NEVER"]`, - Default: "CREATE_IF_NEEDED", - }, - "destination_encryption_configuration": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Custom encryption configuration (e.g., Cloud KMS keys)`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "kms_key_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. -The BigQuery Service Account associated with your project requires access to this encryption key.`, - }, - "kms_key_version": { - Type: schema.TypeString, - Computed: true, - Description: `Describes the Cloud KMS encryption key version used to protect destination BigQuery table.`, - }, - }, - }, - }, - "encoding": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. -The default value is UTF-8. BigQuery decodes the data after the raw, binary data -has been split using the values of the quote and fieldDelimiter properties.`, - Default: "UTF-8", - }, - "field_delimiter": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. -To use a character in the range 128-255, you must encode the character as UTF8. BigQuery converts -the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the -data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. -The default value is a comma (',').`, - }, - "ignore_unknown_values": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Indicates if BigQuery should allow extra values that are not represented in the table schema. -If true, the extra values are ignored. If false, records with extra columns are treated as bad records, -and if there are too many bad records, an invalid error is returned in the job result. -The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: -CSV: Trailing columns -JSON: Named values that don't match any column names`, - Default: false, - }, - "json_extension": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `If sourceFormat is set to newline-delimited JSON, indicates whether it should be processed as a JSON variant such as GeoJSON. -For a sourceFormat other than JSON, omit this field. If the sourceFormat is newline-delimited JSON: - for newline-delimited -GeoJSON: set to GEOJSON.`, - }, - "max_bad_records": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: `The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, -an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.`, - Default: 0, - }, - "null_marker": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value -when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an -empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as -an empty value.`, - Default: "", - }, - "parquet_options": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Parquet Options for load and make external tables.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "enable_list_inference": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `If sourceFormat is set to PARQUET, indicates whether to use schema inference specifically for Parquet LIST logical type.`, - AtLeastOneOf: []string{"load.0.parquet_options.0.enum_as_string", "load.0.parquet_options.0.enable_list_inference"}, - }, - "enum_as_string": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `If sourceFormat is set to PARQUET, indicates whether to infer Parquet ENUM logical type as STRING instead of BYTES by default.`, - }, - }, - }, - }, - "projection_fields": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. -Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. -If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "quote": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, -and then uses the first byte of the encoded string to split the data in its raw, binary state. -The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. -If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.`, - }, - "schema_update_options": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or -supplied in the job configuration. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; -when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. -For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: -ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. -ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "skip_leading_rows": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IntAtLeast(0), - Description: `The number of rows at the top of a CSV file that BigQuery will skip when loading the data. -The default value is 0. This property is useful if you have header rows in the file that should be skipped. -When autodetect is on, the behavior is the following: -skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, -the row is read as data. Otherwise data is read starting from the second row. -skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. -skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, -row N is just skipped. Otherwise row N is used to extract column names for the detected schema.`, - Default: 0, - }, - "source_format": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". -For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO". For parquet, specify "PARQUET". -For orc, specify "ORC". [Beta] For Bigtable, specify "BIGTABLE". -The default value is CSV.`, - Default: "CSV", - }, - "time_partitioning": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Time-based partitioning specification for the destination table.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "type": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The only type supported is DAY, which will generate one partition per day. Providing an empty string used to cause an error, -but in OnePlatform the field will be treated as unset.`, - }, - "expiration_ms": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Number of milliseconds for which to keep the storage for a partition. A wrapper is used here because 0 is an invalid value.`, - }, - "field": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `If not set, the table is partitioned by pseudo column '_PARTITIONTIME'; if set, the table is partitioned by this field. -The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED. -A wrapper is used here because an empty string is an invalid value.`, - }, - }, - }, - }, - "write_disposition": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"WRITE_TRUNCATE", "WRITE_APPEND", "WRITE_EMPTY", ""}), - Description: `Specifies the action that occurs if the destination table already exists. The following values are supported: -WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data and uses the schema from the query result. -WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. -WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. -Each action is atomic and only occurs if BigQuery is able to complete the job successfully. -Creation, truncation and append actions occur as one atomic update upon job completion. Default value: "WRITE_EMPTY" Possible values: ["WRITE_TRUNCATE", "WRITE_APPEND", "WRITE_EMPTY"]`, - Default: "WRITE_EMPTY", - }, - }, - }, - ExactlyOneOf: []string{"query", "load", "copy", "extract"}, - }, - "query": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Configures a query job.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "query": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `SQL query text to execute. The useLegacySql field can be used to indicate whether the query uses legacy SQL or standard SQL. -*NOTE*: queries containing [DML language](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language) -('DELETE', 'UPDATE', 'MERGE', 'INSERT') must specify 'create_disposition = ""' and 'write_disposition = ""'.`, - }, - "allow_large_results": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `If true and query uses legacy SQL dialect, allows the query to produce arbitrarily large result tables at a slight cost in performance. -Requires destinationTable to be set. For standard SQL queries, this flag is ignored and large results are always allowed. -However, you must still set destinationTable when result size exceeds the allowed maximum response size.`, - }, - "create_disposition": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"CREATE_IF_NEEDED", "CREATE_NEVER", ""}), - Description: `Specifies whether the job is allowed to create new tables. The following values are supported: -CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. -CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. -Creation, truncation and append actions occur as one atomic update upon job completion Default value: "CREATE_IF_NEEDED" Possible values: ["CREATE_IF_NEEDED", "CREATE_NEVER"]`, - Default: "CREATE_IF_NEEDED", - }, - "default_dataset": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Specifies the default dataset to use for unqualified table names in the query. Note that this does not alter behavior of unqualified dataset names.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "dataset_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The dataset. Can be specified '{{"{{"}}dataset_id{{"}}"}}' if 'project_id' is also set, -or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}' if not.`, - }, - "project_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the project containing this table.`, - }, - }, - }, - }, - "destination_encryption_configuration": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Custom encryption configuration (e.g., Cloud KMS keys)`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "kms_key_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. -The BigQuery Service Account associated with your project requires access to this encryption key.`, - }, - "kms_key_version": { - Type: schema.TypeString, - Computed: true, - Description: `Describes the Cloud KMS encryption key version used to protect destination BigQuery table.`, - }, - }, - }, - }, - "destination_table": { - Type: schema.TypeList, - Computed: true, - Optional: true, - ForceNew: true, - Description: `Describes the table where the query results should be stored. -This property must be set for large results that exceed the maximum response size. -For queries that produce anonymous (cached) results, this field will be populated by BigQuery.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "table_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths, - Description: `The table. Can be specified '{{"{{"}}table_id{{"}}"}}' if 'project_id' and 'dataset_id' are also set, -or of the form 'projects/{{"{{"}}project{{"}}"}}/datasets/{{"{{"}}dataset_id{{"}}"}}/tables/{{"{{"}}table_id{{"}}"}}' if not.`, - }, - "dataset_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the dataset containing this table.`, - }, - "project_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The ID of the project containing this table.`, - }, - }, - }, - }, - "flatten_results": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `If true and query uses legacy SQL dialect, flattens all nested and repeated fields in the query results. -allowLargeResults must be true if this is set to false. For standard SQL queries, this flag is ignored and results are never flattened.`, - }, - "maximum_billing_tier": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: `Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). -If unspecified, this will be set to your project default.`, - }, - "maximum_bytes_billed": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). -If unspecified, this will be set to your project default.`, - }, - "parameter_mode": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.`, - }, - "priority": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"INTERACTIVE", "BATCH", ""}), - Description: `Specifies a priority for the query. Default value: "INTERACTIVE" Possible values: ["INTERACTIVE", "BATCH"]`, - Default: "INTERACTIVE", - }, - "schema_update_options": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Allows the schema of the destination table to be updated as a side effect of the query job. -Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; -when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, -specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. -One or more of the following values are specified: -ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. -ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "script_options": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Options controlling the execution of scripts.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "key_result_statement": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"LAST", "FIRST_SELECT", ""}), - Description: `Determines which statement in the script represents the "key result", -used to populate the schema and query results of the script job. Possible values: ["LAST", "FIRST_SELECT"]`, - AtLeastOneOf: []string{"query.0.script_options.0.statement_timeout_ms", "query.0.script_options.0.statement_byte_budget", "query.0.script_options.0.key_result_statement"}, - }, - "statement_byte_budget": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Limit on the number of bytes billed per statement. Exceeding this budget results in an error.`, - AtLeastOneOf: []string{"query.0.script_options.0.statement_timeout_ms", "query.0.script_options.0.statement_byte_budget", "query.0.script_options.0.key_result_statement"}, - }, - "statement_timeout_ms": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Timeout period for each statement in a script.`, - AtLeastOneOf: []string{"query.0.script_options.0.statement_timeout_ms", "query.0.script_options.0.statement_byte_budget", "query.0.script_options.0.key_result_statement"}, - }, - }, - }, - }, - "use_legacy_sql": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. -If set to false, the query will use BigQuery's standard SQL.`, - }, - "use_query_cache": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever -tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. -The default value is true.`, - Default: true, - }, - "user_defined_function_resources": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Describes user-defined function resources used in the query.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "inline_code": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `An inline resource that contains code for a user-defined function (UDF). -Providing a inline code resource is equivalent to providing a URI for a file containing the same code.`, - }, - "resource_uri": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `A code resource to load from a Google Cloud Storage URI (gs://bucket/path).`, - }, - }, - }, - }, - "write_disposition": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"WRITE_TRUNCATE", "WRITE_APPEND", "WRITE_EMPTY", ""}), - Description: `Specifies the action that occurs if the destination table already exists. The following values are supported: -WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data and uses the schema from the query result. -WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. -WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. -Each action is atomic and only occurs if BigQuery is able to complete the job successfully. -Creation, truncation and append actions occur as one atomic update upon job completion. Default value: "WRITE_EMPTY" Possible values: ["WRITE_TRUNCATE", "WRITE_APPEND", "WRITE_EMPTY"]`, - Default: "WRITE_EMPTY", - }, - }, - }, - ExactlyOneOf: []string{"query", "load", "copy", "extract"}, - }, - "effective_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: 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}, - }, - "job_type": { - Type: schema.TypeString, - Computed: true, - Description: `The type of the job.`, - }, - "terraform_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: true, - Description: `The combination of labels configured directly on the resource - and default labels configured on the provider.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - - "job_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.`, - }, - "location": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The geographic location of the job. The default value is US.`, - Default: "US", - }, - - "status": { - Type: schema.TypeList, - Computed: true, - Description: `The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "error_result": { - Type: schema.TypeList, - Computed: true, - Description: `Final error result of the job. If present, indicates that the job has completed and was unsuccessful.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "location": { - Type: schema.TypeString, - Optional: true, - Description: `Specifies where the error occurred, if present.`, - }, - "message": { - Type: schema.TypeString, - Optional: true, - Description: `A human-readable description of the error.`, - }, - "reason": { - Type: schema.TypeString, - Optional: true, - Description: `A short error code that summarizes the error.`, - }, - }, - }, - }, - "errors": { - Type: schema.TypeList, - Computed: true, - Description: `The first errors encountered during the running of the job. The final message -includes the number of errors that caused the process to stop. Errors here do -not necessarily mean that the job has not completed or was unsuccessful.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "location": { - Type: schema.TypeString, - Optional: true, - Description: `Specifies where the error occurred, if present.`, - }, - "message": { - Type: schema.TypeString, - Optional: true, - Description: `A human-readable description of the error.`, - }, - "reason": { - Type: schema.TypeString, - Optional: true, - Description: `A short error code that summarizes the error.`, - }, - }, - }, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `Running state of the job. Valid states include 'PENDING', 'RUNNING', and 'DONE'.`, - }, - }, - }, - }, - "user_email": { - Type: schema.TypeString, - Computed: true, - Description: `Email address of the user who ran the job.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceBigQueryJobUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - return tpgresource.TerraformLabelsStateUpgrade(rawState) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/billing_budget.go.tmpl b/mmv1/templates/terraform/state_migrations/go/billing_budget.go.tmpl deleted file mode 100644 index 1487eb03fc2e..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/billing_budget.go.tmpl +++ /dev/null @@ -1,251 +0,0 @@ -func resourceBillingBudgetResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "amount": { - Type: schema.TypeList, - Required: true, - Description: `The budgeted amount for each usage period.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "last_period_amount": { - Type: schema.TypeBool, - Optional: true, - Description: `Configures a budget amount that is automatically set to 100% of -last period's spend. -Boolean. Set value to true to use. Do not set to false, instead -use the 'specified_amount' block.`, - ExactlyOneOf: []string{"amount.0.specified_amount", "amount.0.last_period_amount"}, - }, - "specified_amount": { - Type: schema.TypeList, - Optional: true, - Description: `A specified amount to use as the budget. currencyCode is -optional. If specified, it must match the currency of the -billing account. The currencyCode is provided on output.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "currency_code": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `The 3-letter currency code defined in ISO 4217.`, - }, - "nanos": { - Type: schema.TypeInt, - Optional: true, - Description: `Number of nano (10^-9) units of the amount. -The value must be between -999,999,999 and +999,999,999 -inclusive. If units is positive, nanos must be positive or -zero. If units is zero, nanos can be positive, zero, or -negative. If units is negative, nanos must be negative or -zero. For example $-1.75 is represented as units=-1 and -nanos=-750,000,000.`, - }, - "units": { - Type: schema.TypeString, - Optional: true, - Description: `The whole units of the amount. For example if currencyCode -is "USD", then 1 unit is one US dollar.`, - }, - }, - }, - ExactlyOneOf: []string{"amount.0.specified_amount", "amount.0.last_period_amount"}, - }, - }, - }, - }, - "billing_account": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `ID of the billing account to set a budget on.`, - }, - "threshold_rules": { - Type: schema.TypeList, - Required: true, - Description: `Rules that trigger alerts (notifications of thresholds being -crossed) when spend exceeds the specified percentages of the -budget.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "threshold_percent": { - Type: schema.TypeFloat, - Required: true, - Description: `Send an alert when this threshold is exceeded. This is a -1.0-based percentage, so 0.5 = 50%. Must be >= 0.`, - }, - "spend_basis": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{"CURRENT_SPEND", "FORECASTED_SPEND", ""}, false), - Description: `The type of basis used to determine if spend has passed -the threshold. Default value: "CURRENT_SPEND" Possible values: ["CURRENT_SPEND", "FORECASTED_SPEND"]`, - Default: "CURRENT_SPEND", - }, - }, - }, - }, - "all_updates_rule": { - Type: schema.TypeList, - Optional: true, - Description: `Defines notifications that are sent on every update to the -billing account's spend, regardless of the thresholds defined -using threshold rules.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "disable_default_iam_recipients": { - Type: schema.TypeBool, - Optional: true, - Description: `Boolean. When set to true, disables default notifications sent -when a threshold is exceeded. Default recipients are -those with Billing Account Administrators and Billing -Account Users IAM roles for the target account.`, - Default: false, - }, - "monitoring_notification_channels": { - Type: schema.TypeList, - Optional: true, - Description: `The full resource name of a monitoring notification -channel in the form -projects/{project_id}/notificationChannels/{channel_id}. -A maximum of 5 channels are allowed.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - AtLeastOneOf: []string{"all_updates_rule.0.pubsub_topic", "all_updates_rule.0.monitoring_notification_channels"}, - }, - "pubsub_topic": { - Type: schema.TypeString, - Optional: true, - Description: `The name of the Cloud Pub/Sub topic where budget related -messages will be published, in the form -projects/{project_id}/topics/{topic_id}. Updates are sent -at regular intervals to the topic.`, - AtLeastOneOf: []string{"all_updates_rule.0.pubsub_topic", "all_updates_rule.0.monitoring_notification_channels"}, - }, - "schema_version": { - Type: schema.TypeString, - Optional: true, - Description: `The schema version of the notification. Only "1.0" is -accepted. It represents the JSON schema as defined in -https://cloud.google.com/billing/docs/how-to/budgets#notification_format.`, - Default: "1.0", - }, - }, - }, - }, - "budget_filter": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `Filters that define which resources are used to compute the actual -spend against the budget.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "credit_types": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `A set of subaccounts of the form billingAccounts/{account_id}, -specifying that usage from only this set of subaccounts should -be included in the budget. If a subaccount is set to the name of -the parent account, usage from the parent account will be included. -If the field is omitted, the report will include usage from the parent -account and all subaccounts, if they exist.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - AtLeastOneOf: []string{"budget_filter.0.projects", "budget_filter.0.credit_types_treatment", "budget_filter.0.services", "budget_filter.0.subaccounts", "budget_filter.0.labels"}, - }, - "credit_types_treatment": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{"INCLUDE_ALL_CREDITS", "EXCLUDE_ALL_CREDITS", "INCLUDE_SPECIFIED_CREDITS", ""}, false), - Description: `Specifies how credits should be treated when determining spend -for threshold calculations. Default value: "INCLUDE_ALL_CREDITS" Possible values: ["INCLUDE_ALL_CREDITS", "EXCLUDE_ALL_CREDITS", "INCLUDE_SPECIFIED_CREDITS"]`, - Default: "INCLUDE_ALL_CREDITS", - AtLeastOneOf: []string{"budget_filter.0.projects", "budget_filter.0.credit_types_treatment", "budget_filter.0.services", "budget_filter.0.subaccounts", "budget_filter.0.labels"}, - }, - "labels": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - Description: `A single label and value pair specifying that usage from only -this set of labeled resources should be included in the budget.`, - Elem: &schema.Schema{Type: schema.TypeString}, - AtLeastOneOf: []string{"budget_filter.0.projects", "budget_filter.0.credit_types_treatment", "budget_filter.0.services", "budget_filter.0.subaccounts", "budget_filter.0.labels"}, - }, - "projects": { - Type: schema.TypeList, - Optional: true, - Description: `A set of projects of the form projects/{project_number}, -specifying that usage from only this set of projects should be -included in the budget. If omitted, the report will include -all usage for the billing account, regardless of which project -the usage occurred on.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - AtLeastOneOf: []string{"budget_filter.0.projects", "budget_filter.0.credit_types_treatment", "budget_filter.0.services", "budget_filter.0.subaccounts", "budget_filter.0.labels"}, - }, - "services": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `A set of services of the form services/{service_id}, -specifying that usage from only this set of services should be -included in the budget. If omitted, the report will include -usage for all the services. The service names are available -through the Catalog API: -https://cloud.google.com/billing/v1/how-tos/catalog-api.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - AtLeastOneOf: []string{"budget_filter.0.projects", "budget_filter.0.credit_types_treatment", "budget_filter.0.services", "budget_filter.0.subaccounts", "budget_filter.0.labels"}, - }, - "subaccounts": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `A set of subaccounts of the form billingAccounts/{account_id}, -specifying that usage from only this set of subaccounts should -be included in the budget. If a subaccount is set to the name of -the parent account, usage from the parent account will be included. -If the field is omitted, the report will include usage from the parent -account and all subaccounts, if they exist.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - AtLeastOneOf: []string{"budget_filter.0.projects", "budget_filter.0.credit_types_treatment", "budget_filter.0.services", "budget_filter.0.subaccounts", "budget_filter.0.labels"}, - }, - }, - }, - }, - "display_name": { - Type: schema.TypeString, - Optional: true, - Description: `User data for display name in UI. Must be <= 60 chars.`, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Description: `Resource name of the budget. The resource name -implies the scope of a budget. Values are of the form -billingAccounts/{billingAccountId}/budgets/{budgetId}.`, - }, - }, - } -} - -func ResourceBillingBudgetUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - - rawState["name"] = tpgresource.GetResourceNameFromSelfLink(rawState["name"].(string)) - - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} diff --git a/mmv1/templates/terraform/state_migrations/go/certificate_manager_certificate.go.tmpl b/mmv1/templates/terraform/state_migrations/go/certificate_manager_certificate.go.tmpl deleted file mode 100644 index c4bc16128c72..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/certificate_manager_certificate.go.tmpl +++ /dev/null @@ -1,209 +0,0 @@ -func ResourceCertificateManagerCertificateUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - // Version 0 didn't support location. Default it to global. - rawState["location"] = "global" - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} - -func resourceCertificateManagerCertificateResourceV0() *schema.Resource { - return &schema.Resource{ - Create: resourceCertificateManagerCertificateCreate, - Read: resourceCertificateManagerCertificateRead, - Update: resourceCertificateManagerCertificateUpdate, - Delete: resourceCertificateManagerCertificateDelete, - - Importer: &schema.ResourceImporter{ - State: resourceCertificateManagerCertificateImport, - }, - - Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(20 * time.Minute), - Update: schema.DefaultTimeout(20 * time.Minute), - Delete: schema.DefaultTimeout(20 * time.Minute), - }, - - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `A user-defined name of the certificate. Certificate names must be unique -The name must be 1-64 characters long, and match the regular expression [a-zA-Z][a-zA-Z0-9_-]* which means the first character must be a letter, -and all following characters must be a dash, underscore, letter or digit.`, - }, - "description": { - Type: schema.TypeString, - Optional: true, - Description: `A human-readable description of the resource.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - Description: `Set of label tags associated with the Certificate resource.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "managed": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Configuration and state of a Managed Certificate. -Certificate Manager provisions and renews Managed Certificates -automatically, for as long as it's authorized to do so.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "dns_authorizations": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.ProjectNumberDiffSuppress, - Description: `Authorizations that will be used for performing domain authorization`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "domains": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `The domains for which a managed SSL certificate will be generated. -Wildcard domains are only supported with DNS challenge resolution`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "authorization_attempt_info": { - Type: schema.TypeList, - Computed: true, - Description: `Detailed state of the latest authorization attempt for each domain -specified for this Managed Certificate.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "details": { - Type: schema.TypeString, - Computed: true, - Description: `Human readable explanation for reaching the state. Provided to help -address the configuration issues. -Not guaranteed to be stable. For programmatic access use 'failure_reason' field.`, - }, - "domain": { - Type: schema.TypeString, - Computed: true, - Description: `Domain name of the authorization attempt.`, - }, - "failure_reason": { - Type: schema.TypeString, - Computed: true, - Description: `Reason for failure of the authorization attempt for the domain.`, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `State of the domain for managed certificate issuance.`, - }, - }, - }, - }, - "provisioning_issue": { - Type: schema.TypeList, - Computed: true, - Description: `Information about issues with provisioning this Managed Certificate.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "details": { - Type: schema.TypeString, - Computed: true, - Description: `Human readable explanation about the issue. Provided to help address -the configuration issues. -Not guaranteed to be stable. For programmatic access use 'reason' field.`, - }, - "reason": { - Type: schema.TypeString, - Computed: true, - Description: `Reason for provisioning failures.`, - }, - }, - }, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `A state of this Managed Certificate.`, - }, - }, - }, - ExactlyOneOf: []string{"self_managed", "managed"}, - }, - "scope": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - DiffSuppressFunc: certManagerDefaultScopeDiffSuppress, - Description: `The scope of the certificate. - -DEFAULT: Certificates with default scope are served from core Google data centers. -If unsure, choose this option. - -EDGE_CACHE: Certificates with scope EDGE_CACHE are special-purposed certificates, -served from non-core Google data centers. -Currently allowed only for managed certificates.`, - Default: "DEFAULT", - }, - "self_managed": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Certificate data for a SelfManaged Certificate. -SelfManaged Certificates are uploaded by the user. Updating such -certificates before they expire remains the user's responsibility.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "certificate_pem": { - Type: schema.TypeString, - Optional: true, - Deprecated: "Deprecated in favor of `pem_certificate`", - Description: `**Deprecated** The certificate chain in PEM-encoded form. - -Leaf certificate comes first, followed by intermediate ones if any.`, - Sensitive: true, - ExactlyOneOf: []string{"self_managed.0.certificate_pem", "self_managed.0.pem_certificate"}, - }, - "pem_certificate": { - Type: schema.TypeString, - Optional: true, - Description: `The certificate chain in PEM-encoded form. - -Leaf certificate comes first, followed by intermediate ones if any.`, - ExactlyOneOf: []string{"self_managed.0.certificate_pem", "self_managed.0.pem_certificate"}, - }, - "pem_private_key": { - Type: schema.TypeString, - Optional: true, - Description: `The private key of the leaf certificate in PEM-encoded form.`, - Sensitive: true, - ExactlyOneOf: []string{"self_managed.0.private_key_pem", "self_managed.0.pem_private_key"}, - }, - "private_key_pem": { - Type: schema.TypeString, - Optional: true, - Deprecated: "Deprecated in favor of `pem_private_key`", - Description: `**Deprecated** The private key of the leaf certificate in PEM-encoded form.`, - Sensitive: true, - ExactlyOneOf: []string{"self_managed.0.private_key_pem", "self_managed.0.pem_private_key"}, - }, - }, - }, - ExactlyOneOf: []string{"self_managed", "managed"}, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/certificate_manager_certificate_issuance_config.go.tmpl b/mmv1/templates/terraform/state_migrations/go/certificate_manager_certificate_issuance_config.go.tmpl deleted file mode 100644 index a25e7c5fb69f..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/certificate_manager_certificate_issuance_config.go.tmpl +++ /dev/null @@ -1,132 +0,0 @@ -func resourceCertificateManagerCertificateIssuanceConfigResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "certificate_authority_config": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `The CA that issues the workload certificate. It includes the CA address, type, authentication to CA service, etc.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "certificate_authority_service_config": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Defines a CertificateAuthorityServiceConfig.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "ca_pool": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareResourceNames, - Description: `A CA pool resource used to issue a certificate. -The CA pool string has a relative resource path following the form -"projects/{project}/locations/{location}/caPools/{caPool}".`, - }, - }, - }, - }, - }, - }, - }, - "key_algorithm": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"RSA_2048", "ECDSA_P256"}), - Description: `Key algorithm to use when generating the private key. Possible values: ["RSA_2048", "ECDSA_P256"]`, - }, - "lifetime": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Lifetime of issued certificates. A duration in seconds with up to nine fractional digits, ending with 's'. -Example: "1814400s". Valid values are from 21 days (1814400s) to 30 days (2592000s)`, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `A user-defined name of the certificate issuance config. -CertificateIssuanceConfig names must be unique globally.`, - }, - "rotation_window_percentage": { - Type: schema.TypeInt, - Required: true, - ForceNew: true, - Description: `It specifies the percentage of elapsed time of the certificate lifetime to wait before renewing the certificate. -Must be a number between 1-99, inclusive. -You must set the rotation window percentage in relation to the certificate lifetime so that certificate renewal occurs at least 7 days after -the certificate has been issued and at least 7 days before it expires.`, - }, - "description": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `One or more paragraphs of text description of a CertificateIssuanceConfig.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Description: `'Set of label tags associated with the CertificateIssuanceConfig resource. - An object containing a list of "key": value pairs. Example: { "name": "wrench", "count": "3" }. - - -**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}, - }, - "location": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The Certificate Manager location. If not specified, "global" is used.`, - Default: "global", - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - Description: `The creation timestamp of a CertificateIssuanceConfig. Timestamp is in RFC3339 UTC "Zulu" format, -accurate to nanoseconds with up to nine fractional digits. -Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".`, - }, - "effective_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: 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}, - }, - "terraform_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: 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: `The last update timestamp of a CertificateIssuanceConfig. Timestamp is in RFC3339 UTC "Zulu" format, -accurate to nanoseconds with up to nine fractional digits. -Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceCertificateManagerCertificateIssuanceConfigUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - return tpgresource.TerraformLabelsStateUpgrade(rawState) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/certificate_manager_dns_authorization.go.tmpl b/mmv1/templates/terraform/state_migrations/go/certificate_manager_dns_authorization.go.tmpl deleted file mode 100644 index b3d29dc64136..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/certificate_manager_dns_authorization.go.tmpl +++ /dev/null @@ -1,91 +0,0 @@ -func ResourceCertificateManagerDnsAuthorizationUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - // Version 0 didn't support location. Default it to global. - rawState["location"] = "global" - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} - -func resourceCertificateManagerDnsAuthorizationResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "domain": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `A domain which is being authorized. A DnsAuthorization resource covers a -single domain and its wildcard, e.g. authorization for "example.com" can -be used to issue certificates for "example.com" and "*.example.com".`, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Name of the resource; provided by the client when the resource is created. -The name must be 1-64 characters long, and match the regular expression [a-zA-Z][a-zA-Z0-9_-]* which means the first character must be a letter, -and all following characters must be a dash, underscore, letter or digit.`, - }, - "description": { - Type: schema.TypeString, - Optional: true, - Description: `A human-readable description of the resource.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - Description: `Set of label tags associated with the DNS Authorization 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}, - }, - "dns_resource_record": { - Type: schema.TypeList, - Computed: true, - Description: `The structure describing the DNS Resource Record that needs to be added -to DNS configuration for the authorization to be usable by -certificate.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "data": { - Type: schema.TypeString, - Computed: true, - Description: `Data of the DNS Resource Record.`, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Description: `Fully qualified name of the DNS Resource Record. -E.g. '_acme-challenge.example.com'.`, - }, - "type": { - Type: schema.TypeString, - Computed: true, - Description: `Type of the DNS Resource Record.`, - }, - }, - }, - }, - "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}, - }, - "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}, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - } - -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/cloud_build_trigger.go.tmpl b/mmv1/templates/terraform/state_migrations/go/cloud_build_trigger.go.tmpl deleted file mode 100644 index 2146c27cfe4f..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/cloud_build_trigger.go.tmpl +++ /dev/null @@ -1,982 +0,0 @@ -func ResourceCloudBuildTriggerUpgradeV1(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - // Versions 0 and 1 didn't support location. Default them to global. - rawState["location"] = "global" - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} - -func resourceCloudBuildTriggerResourceV1() *schema.Resource { - // Cloud Build Triggers started with V1 since its beginnings. - return resourceCloudBuildTriggerResourceV0() -} - -func ResourceCloudBuildTriggerUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - // Do nothing as V0 and V1 are exactly the same. - return rawState, nil -} - -func resourceCloudBuildTriggerResourceV0() *schema.Resource { - return &schema.Resource{ - Create: resourceCloudBuildTriggerCreate, - Read: resourceCloudBuildTriggerRead, - Update: resourceCloudBuildTriggerUpdate, - Delete: resourceCloudBuildTriggerDelete, - - Importer: &schema.ResourceImporter{ - State: resourceCloudBuildTriggerImport, - }, - - Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(20 * time.Minute), - Update: schema.DefaultTimeout(20 * time.Minute), - Delete: schema.DefaultTimeout(20 * time.Minute), - }, - - SchemaVersion: 1, - CustomizeDiff: stepTimeoutCustomizeDiff, - - Schema: map[string]*schema.Schema{ - "approval_config": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `Configuration for manual approval to start a build invocation of this BuildTrigger. -Builds created by this trigger will require approval before they execute. -Any user with a Cloud Build Approver role for the project can approve a build.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "approval_required": { - Type: schema.TypeBool, - Optional: true, - Description: `Whether or not approval is needed. If this is set on a build, it will become pending when run, -and will need to be explicitly approved to start.`, - Default: false, - }, - }, - }, - }, - "build": { - Type: schema.TypeList, - Optional: true, - Description: `Contents of the build template. Either a filename or build template must be provided.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "step": { - Type: schema.TypeList, - Required: true, - Description: `The operations to be performed on the workspace.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: `The name of the container image that will run this particular build step. -If the image is available in the host's Docker daemon's cache, it will be -run directly. If not, the host will attempt to pull the image first, using -the builder service account's credentials if necessary. -The Docker daemon's cache will already have the latest versions of all of -the officially supported build steps (see https://github.com/GoogleCloudPlatform/cloud-builders -for images and examples). -The Docker daemon will also have cached many of the layers for some popular -images, like "ubuntu", "debian", but they will be refreshed at the time -you attempt to use them. -If you built an image in a previous build step, it will be stored in the -host's Docker daemon's cache and is available to use as the name for a -later build step.`, - }, - "args": { - Type: schema.TypeList, - Optional: true, - Description: `A list of arguments that will be presented to the step when it is started. -If the image used to run the step's container has an entrypoint, the args -are used as arguments to that entrypoint. If the image does not define an -entrypoint, the first element in args is used as the entrypoint, and the -remainder will be used as arguments.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "dir": { - Type: schema.TypeString, - Optional: true, - Description: `Working directory to use when running this step's container. -If this value is a relative path, it is relative to the build's working -directory. If this value is absolute, it may be outside the build's working -directory, in which case the contents of the path may not be persisted -across build step executions, unless a 'volume' for that path is specified. -If the build specifies a 'RepoSource' with 'dir' and a step with a -'dir', -which specifies an absolute path, the 'RepoSource' 'dir' is ignored -for the step's execution.`, - }, - "entrypoint": { - Type: schema.TypeString, - Optional: true, - Description: `Entrypoint to be used instead of the build step image's -default entrypoint. -If unset, the image's default entrypoint is used`, - }, - "env": { - Type: schema.TypeList, - Optional: true, - Description: `A list of environment variable definitions to be used when -running a step. -The elements are of the form "KEY=VALUE" for the environment variable -"KEY" being given the value "VALUE".`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "id": { - Type: schema.TypeString, - Optional: true, - Description: `Unique identifier for this build step, used in 'wait_for' to -reference this build step as a dependency.`, - }, - "secret_env": { - Type: schema.TypeList, - Optional: true, - Description: `A list of environment variables which are encrypted using -a Cloud Key -Management Service crypto key. These values must be specified in -the build's 'Secret'.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "timeout": { - Type: schema.TypeString, - Optional: true, - Description: `Time limit for executing this build step. If not defined, -the step has no -time limit and will be allowed to continue to run until either it -completes or the build itself times out.`, - }, - "timing": { - Type: schema.TypeString, - Optional: true, - Description: `Output only. Stores timing information for executing this -build step.`, - }, - "volumes": { - Type: schema.TypeList, - Optional: true, - Description: `List of volumes to mount into the build step. -Each volume is created as an empty volume prior to execution of the -build step. Upon completion of the build, volumes and their contents -are discarded. -Using a named volume in only one step is not valid as it is -indicative of a build request with an incorrect configuration.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: `Name of the volume to mount. -Volume names must be unique per build step and must be valid names for -Docker volumes. Each named volume must be used by at least two build steps.`, - }, - "path": { - Type: schema.TypeString, - Required: true, - Description: `Path at which to mount the volume. -Paths must be absolute and cannot conflict with other volume paths on -the same build step or with certain reserved volume paths.`, - }, - }, - }, - }, - "wait_for": { - Type: schema.TypeList, - Optional: true, - Description: `The ID(s) of the step(s) that this build step depends on. -This build step will not start until all the build steps in 'wait_for' -have completed successfully. If 'wait_for' is empty, this build step -will start when all previous build steps in the 'Build.Steps' list -have completed successfully.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - }, - }, - }, - "artifacts": { - Type: schema.TypeList, - Optional: true, - Description: `Artifacts produced by the build that should be uploaded upon successful completion of all build steps.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "images": { - Type: schema.TypeList, - Optional: true, - Description: `A list of images to be pushed upon the successful completion of all build steps. -The images will be pushed using the builder service account's credentials. -The digests of the pushed images will be stored in the Build resource's results field. -If any of the images fail to be pushed, the build is marked FAILURE.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "objects": { - Type: schema.TypeList, - Optional: true, - Description: `A list of objects to be uploaded to Cloud Storage upon successful completion of all build steps. -Files in the workspace matching specified paths globs will be uploaded to the -Cloud Storage location using the builder service account's credentials. -The location and generation of the uploaded objects will be stored in the Build resource's results field. -If any objects fail to be pushed, the build is marked FAILURE.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "location": { - Type: schema.TypeString, - Optional: true, - Description: `Cloud Storage bucket and optional object path, in the form "gs://bucket/path/to/somewhere/". -Files in the workspace matching any path pattern will be uploaded to Cloud Storage with -this location as a prefix.`, - }, - "paths": { - Type: schema.TypeList, - Optional: true, - Description: `Path globs used to match files in the build's workspace.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "timing": { - Type: schema.TypeList, - Computed: true, - Description: `Output only. Stores timing information for pushing all artifact objects.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_time": { - Type: schema.TypeString, - Optional: true, - Description: `End of time span. -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".`, - }, - "start_time": { - Type: schema.TypeString, - Optional: true, - Description: `Start of time span. -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".`, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - "available_secrets": { - Type: schema.TypeList, - Optional: true, - Description: `Secrets and secret environment variables.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "secret_manager": { - Type: schema.TypeList, - Required: true, - Description: `Pairs a secret environment variable with a SecretVersion in Secret Manager.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "env": { - Type: schema.TypeString, - Required: true, - Description: `Environment variable name to associate with the secret. Secret environment -variables must be unique across all of a build's secrets, and must be used -by at least one build step.`, - }, - "version_name": { - Type: schema.TypeString, - Required: true, - Description: `Resource name of the SecretVersion. In format: projects/*/secrets/*/versions/*`, - }, - }, - }, - }, - }, - }, - }, - "images": { - Type: schema.TypeList, - Optional: true, - Description: `A list of images to be pushed upon the successful completion of all build steps. -The images are pushed using the builder service account's credentials. -The digests of the pushed images will be stored in the Build resource's results field. -If any of the images fail to be pushed, the build status is marked FAILURE.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "logs_bucket": { - Type: schema.TypeString, - Optional: true, - Description: `Google Cloud Storage bucket where logs should be written. -Logs file names will be of the format ${logsBucket}/log-${build_id}.txt.`, - }, - "options": { - Type: schema.TypeList, - Optional: true, - Description: `Special options for this build.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "disk_size_gb": { - Type: schema.TypeInt, - Optional: true, - Description: `Requested disk size for the VM that runs the build. Note that this is NOT "disk free"; -some of the space will be used by the operating system and build utilities. -Also note that this is the minimum disk size that will be allocated for the build -- -the build may run with a larger disk than requested. At present, the maximum disk size -is 1000GB; builds that request more than the maximum are rejected with an error.`, - }, - "dynamic_substitutions": { - Type: schema.TypeBool, - Optional: true, - Description: `Option to specify whether or not to apply bash style string operations to the substitutions. -NOTE this is always enabled for triggered builds and cannot be overridden in the build configuration file.`, - }, - "env": { - Type: schema.TypeList, - Optional: true, - Description: `A list of global environment variable definitions that will exist for all build steps -in this build. If a variable is defined in both globally and in a build step, -the variable will use the build step value. -The elements are of the form "KEY=VALUE" for the environment variable "KEY" being given the value "VALUE".`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "log_streaming_option": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateEnum([]string{"STREAM_DEFAULT", "STREAM_ON", "STREAM_OFF", ""}), - Description: `Option to define build log streaming behavior to Google Cloud Storage. Possible values: ["STREAM_DEFAULT", "STREAM_ON", "STREAM_OFF"]`, - }, - "logging": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateEnum([]string{"LOGGING_UNSPECIFIED", "LEGACY", "GCS_ONLY", "STACKDRIVER_ONLY", "CLOUD_LOGGING_ONLY", "NONE", ""}), - Description: `Option to specify the logging mode, which determines if and where build logs are stored. Possible values: ["LOGGING_UNSPECIFIED", "LEGACY", "GCS_ONLY", "STACKDRIVER_ONLY", "CLOUD_LOGGING_ONLY", "NONE"]`, - }, - "machine_type": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateEnum([]string{"UNSPECIFIED", "N1_HIGHCPU_8", "N1_HIGHCPU_32", "E2_HIGHCPU_8", "E2_HIGHCPU_32", ""}), - Description: `Compute Engine machine type on which to run the build. Possible values: ["UNSPECIFIED", "N1_HIGHCPU_8", "N1_HIGHCPU_32", "E2_HIGHCPU_8", "E2_HIGHCPU_32"]`, - }, - "requested_verify_option": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateEnum([]string{"NOT_VERIFIED", "VERIFIED", ""}), - Description: `Requested verifiability options. Possible values: ["NOT_VERIFIED", "VERIFIED"]`, - }, - "secret_env": { - Type: schema.TypeList, - Optional: true, - Description: `A list of global environment variables, which are encrypted using a Cloud Key Management -Service crypto key. These values must be specified in the build's Secret. These variables -will be available to all build steps in this build.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "source_provenance_hash": { - Type: schema.TypeList, - Optional: true, - Description: `Requested hash for SourceProvenance. Possible values: ["NONE", "SHA256", "MD5"]`, - Elem: &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: verify.ValidateEnum([]string{"NONE", "SHA256", "MD5"}), - }, - }, - "substitution_option": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateEnum([]string{"MUST_MATCH", "ALLOW_LOOSE", ""}), - Description: `Option to specify behavior when there is an error in the substitution checks. -NOTE this is always set to ALLOW_LOOSE for triggered builds and cannot be overridden -in the build configuration file. Possible values: ["MUST_MATCH", "ALLOW_LOOSE"]`, - }, - "volumes": { - Type: schema.TypeList, - Optional: true, - Description: `Global list of volumes to mount for ALL build steps -Each volume is created as an empty volume prior to starting the build process. -Upon completion of the build, volumes and their contents are discarded. Global -volume names and paths cannot conflict with the volumes defined a build step. -Using a global volume in a build with only one step is not valid as it is indicative -of a build request with an incorrect configuration.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Optional: true, - Description: `Name of the volume to mount. -Volume names must be unique per build step and must be valid names for Docker volumes. -Each named volume must be used by at least two build steps.`, - }, - "path": { - Type: schema.TypeString, - Optional: true, - Description: `Path at which to mount the volume. -Paths must be absolute and cannot conflict with other volume paths on the same -build step or with certain reserved volume paths.`, - }, - }, - }, - }, - "worker_pool": { - Type: schema.TypeString, - Optional: true, - Description: `Option to specify a WorkerPool for the build. Format projects/{project}/workerPools/{workerPool} -This field is experimental.`, - }, - }, - }, - }, - "queue_ttl": { - Type: schema.TypeString, - Optional: true, - Description: `TTL in queue for this build. If provided and the build is enqueued longer than this value, -the build will expire and the build status will be EXPIRED. -The TTL starts ticking from createTime. -A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".`, - }, - "secret": { - Type: schema.TypeList, - Optional: true, - Description: `Secrets to decrypt using Cloud Key Management Service.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "kms_key_name": { - Type: schema.TypeString, - Required: true, - Description: `Cloud KMS key name to use to decrypt these envs.`, - }, - "secret_env": { - Type: schema.TypeMap, - Optional: true, - Description: `Map of environment variable name to its encrypted value. -Secret environment variables must be unique across all of a build's secrets, -and must be used by at least one build step. Values can be at most 64 KB in size. -There can be at most 100 secret values across all of a build's secrets.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - }, - }, - }, - "source": { - Type: schema.TypeList, - Optional: true, - Description: `The location of the source files to build. -One of 'storageSource' or 'repoSource' must be provided.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "repo_source": { - Type: schema.TypeList, - Optional: true, - Description: `Location of the source in a Google Cloud Source Repository.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "repo_name": { - Type: schema.TypeString, - Required: true, - Description: `Name of the Cloud Source Repository.`, - }, - "branch_name": { - Type: schema.TypeString, - Optional: true, - Description: `Regex matching branches to build. Exactly one a of branch name, tag, or commit SHA must be provided. -The syntax of the regular expressions accepted is the syntax accepted by RE2 and -described at https://github.com/google/re2/wiki/Syntax`, - ExactlyOneOf: []string{"build.0.source.0.repo_source.0.branch_name", "build.0.source.0.repo_source.0.commit_sha", "build.0.source.0.repo_source.0.tag_name"}, - }, - "commit_sha": { - Type: schema.TypeString, - Optional: true, - Description: `Explicit commit SHA to build. Exactly one a of branch name, tag, or commit SHA must be provided.`, - ExactlyOneOf: []string{"build.0.source.0.repo_source.0.branch_name", "build.0.source.0.repo_source.0.commit_sha", "build.0.source.0.repo_source.0.tag_name"}, - }, - "dir": { - Type: schema.TypeString, - Optional: true, - Description: `Directory, relative to the source root, in which to run the build. -This must be a relative path. If a step's dir is specified and is an absolute path, -this value is ignored for that step's execution.`, - }, - "invert_regex": { - Type: schema.TypeBool, - Optional: true, - Description: `Only trigger a build if the revision regex does NOT match the revision regex.`, - }, - "project_id": { - Type: schema.TypeString, - Optional: true, - Description: `ID of the project that owns the Cloud Source Repository. -If omitted, the project ID requesting the build is assumed.`, - }, - "substitutions": { - Type: schema.TypeMap, - Optional: true, - Description: `Substitutions to use in a triggered build. Should only be used with triggers.run`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "tag_name": { - Type: schema.TypeString, - Optional: true, - Description: `Regex matching tags to build. Exactly one a of branch name, tag, or commit SHA must be provided. -The syntax of the regular expressions accepted is the syntax accepted by RE2 and -described at https://github.com/google/re2/wiki/Syntax`, - ExactlyOneOf: []string{"build.0.source.0.repo_source.0.branch_name", "build.0.source.0.repo_source.0.commit_sha", "build.0.source.0.repo_source.0.tag_name"}, - }, - }, - }, - }, - "storage_source": { - Type: schema.TypeList, - Optional: true, - Description: `Location of the source in an archive file in Google Cloud Storage.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "bucket": { - Type: schema.TypeString, - Required: true, - Description: `Google Cloud Storage bucket containing the source.`, - }, - "object": { - Type: schema.TypeString, - Required: true, - Description: `Google Cloud Storage object containing the source. -This object must be a gzipped archive file (.tar.gz) containing source to build.`, - }, - "generation": { - Type: schema.TypeString, - Optional: true, - Description: `Google Cloud Storage generation for the object. -If the generation is omitted, the latest generation will be used`, - }, - }, - }, - }, - }, - }, - }, - "substitutions": { - Type: schema.TypeMap, - Optional: true, - Description: `Substitutions data for Build resource.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "tags": { - Type: schema.TypeList, - Optional: true, - Description: `Tags for annotation of a Build. These are not docker tags.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "timeout": { - Type: schema.TypeString, - Optional: true, - Description: `Amount of time that this build should be allowed to run, to second granularity. -If this amount of time elapses, work on the build will cease and the build status will be TIMEOUT. -This timeout must be equal to or greater than the sum of the timeouts for build steps within the build. -The expected format is the number of seconds followed by s. -Default time is ten minutes (600s).`, - Default: "600s", - }, - }, - }, - ExactlyOneOf: []string{"filename", "build", "git_file_source"}, - }, - "description": { - Type: schema.TypeString, - Optional: true, - Description: `Human-readable description of the trigger.`, - }, - "disabled": { - Type: schema.TypeBool, - Optional: true, - Description: `Whether the trigger is disabled or not. If true, the trigger will never result in a build.`, - }, - "filename": { - Type: schema.TypeString, - Optional: true, - Description: `Path, from the source root, to a file whose contents is used for the template. -Either a filename or build template must be provided. Set this only when using trigger_template or github. -When using Pub/Sub, Webhook or Manual set the file name using git_file_source instead.`, - ExactlyOneOf: []string{"filename", "build", "git_file_source"}, - }, - "filter": { - Type: schema.TypeString, - Optional: true, - Description: `A Common Expression Language string. Used only with Pub/Sub and Webhook.`, - }, - "git_file_source": { - Type: schema.TypeList, - Optional: true, - Description: `The file source describing the local or remote Build template.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "path": { - Type: schema.TypeString, - Required: true, - Description: `The path of the file, with the repo root as the root of the path.`, - }, - "repo_type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: verify.ValidateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"}), - Description: `The type of the repo, since it may not be explicit from the repo field (e.g from a URL). -Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"]`, - }, - "revision": { - Type: schema.TypeString, - Optional: true, - Description: `The branch, tag, arbitrary ref, or SHA version of the repo to use when resolving the -filename (optional). This field respects the same syntax/resolution as described here: https://git-scm.com/docs/gitrevisions -If unspecified, the revision from which the trigger invocation originated is assumed to be the revision from which to read the specified path.`, - }, - "uri": { - Type: schema.TypeString, - Optional: true, - Description: `The URI of the repo (optional). If unspecified, the repo from which the trigger -invocation originated is assumed to be the repo from which to read the specified path.`, - }, - }, - }, - ExactlyOneOf: []string{"filename", "git_file_source", "build"}, - }, - "github": { - Type: schema.TypeList, - Optional: true, - Description: `Describes the configuration of a trigger that creates a build whenever a GitHub event is received. -One of 'trigger_template', 'github', 'pubsub_config' or 'webhook_config' must be provided.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Optional: true, - Description: `Name of the repository. For example: The name for -https://github.com/googlecloudplatform/cloud-builders is "cloud-builders".`, - }, - "owner": { - Type: schema.TypeString, - Optional: true, - Description: `Owner of the repository. For example: The owner for -https://github.com/googlecloudplatform/cloud-builders is "googlecloudplatform".`, - }, - "pull_request": { - Type: schema.TypeList, - Optional: true, - Description: `filter to match changes in pull requests. Specify only one of 'pull_request' or 'push'.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "branch": { - Type: schema.TypeString, - Required: true, - Description: `Regex of branches to match.`, - }, - "comment_control": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateEnum([]string{"COMMENTS_DISABLED", "COMMENTS_ENABLED", "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY", ""}), - Description: `Whether to block builds on a "/gcbrun" comment from a repository owner or collaborator. Possible values: ["COMMENTS_DISABLED", "COMMENTS_ENABLED", "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY"]`, - }, - "invert_regex": { - Type: schema.TypeBool, - Optional: true, - Description: `If true, branches that do NOT match the git_ref will trigger a build.`, - }, - }, - }, - ExactlyOneOf: []string{"github.0.pull_request", "github.0.push"}, - }, - "push": { - Type: schema.TypeList, - Optional: true, - Description: `filter to match changes in refs, like branches or tags. Specify only one of 'pull_request' or 'push'.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "branch": { - Type: schema.TypeString, - Optional: true, - Description: `Regex of branches to match. Specify only one of branch or tag.`, - ExactlyOneOf: []string{"github.0.push.0.branch", "github.0.push.0.tag"}, - }, - "invert_regex": { - Type: schema.TypeBool, - Optional: true, - Description: `When true, only trigger a build if the revision regex does NOT match the git_ref regex.`, - }, - "tag": { - Type: schema.TypeString, - Optional: true, - Description: `Regex of tags to match. Specify only one of branch or tag.`, - ExactlyOneOf: []string{"github.0.push.0.branch", "github.0.push.0.tag"}, - }, - }, - }, - ExactlyOneOf: []string{"github.0.pull_request", "github.0.push"}, - }, - }, - }, - AtLeastOneOf: []string{"trigger_template", "github", "pubsub_config", "webhook_config", "source_to_build"}, - }, - "ignored_files": { - Type: schema.TypeList, - Optional: true, - Description: `ignoredFiles and includedFiles are file glob matches using https://golang.org/pkg/path/filepath/#Match -extended with support for '**'. -If ignoredFiles and changed files are both empty, then they are not -used to determine whether or not to trigger a build. -If ignoredFiles is not empty, then we ignore any files that match any -of the ignored_file globs. If the change has no files that are outside -of the ignoredFiles globs, then we do not trigger a build.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "include_build_logs": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateEnum([]string{"INCLUDE_BUILD_LOGS_UNSPECIFIED", "INCLUDE_BUILD_LOGS_WITH_STATUS", ""}), - Description: `Build logs will be sent back to GitHub as part of the checkrun -result. Values can be INCLUDE_BUILD_LOGS_UNSPECIFIED or -INCLUDE_BUILD_LOGS_WITH_STATUS Possible values: ["INCLUDE_BUILD_LOGS_UNSPECIFIED", "INCLUDE_BUILD_LOGS_WITH_STATUS"]`, - }, - "included_files": { - Type: schema.TypeList, - Optional: true, - Description: `ignoredFiles and includedFiles are file glob matches using https://golang.org/pkg/path/filepath/#Match -extended with support for '**'. -If any of the files altered in the commit pass the ignoredFiles filter -and includedFiles is empty, then as far as this filter is concerned, we -should trigger the build. -If any of the files altered in the commit pass the ignoredFiles filter -and includedFiles is not empty, then we make sure that at least one of -those files matches a includedFiles glob. If not, then we do not trigger -a build.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `Name of the trigger. Must be unique within the project.`, - }, - "pubsub_config": { - Type: schema.TypeList, - Optional: true, - Description: `PubsubConfig describes the configuration of a trigger that creates -a build whenever a Pub/Sub message is published. -One of 'trigger_template', 'github', 'pubsub_config' 'webhook_config' or 'source_to_build' must be provided.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "topic": { - Type: schema.TypeString, - Required: true, - Description: `The name of the topic from which this subscription is receiving messages.`, - }, - "service_account_email": { - Type: schema.TypeString, - Optional: true, - Description: `Service account that will make the push request.`, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `Potential issues with the underlying Pub/Sub subscription configuration. -Only populated on get requests.`, - }, - "subscription": { - Type: schema.TypeString, - Computed: true, - Description: `Output only. Name of the subscription.`, - }, - }, - }, - AtLeastOneOf: []string{"trigger_template", "github", "pubsub_config", "webhook_config", "source_to_build"}, - }, - "service_account": { - Type: schema.TypeString, - Optional: true, - Description: `The service account used for all user-controlled operations including -triggers.patch, triggers.run, builds.create, and builds.cancel. -If no service account is set, then the standard Cloud Build service account -([PROJECT_NUM]@system.gserviceaccount.com) will be used instead. -Format: projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`, - }, - "source_to_build": { - Type: schema.TypeList, - Optional: true, - Description: `The repo and ref of the repository from which to build. -This field is used only for those triggers that do not respond to SCM events. -Triggers that respond to such events build source at whatever commit caused the event. -This field is currently only used by Webhook, Pub/Sub, Manual, and Cron triggers. -One of 'trigger_template', 'github', 'pubsub_config' 'webhook_config' or 'source_to_build' must be provided.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "ref": { - Type: schema.TypeString, - Required: true, - Description: `The branch or tag to use. Must start with "refs/" (required).`, - }, - "repo_type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: verify.ValidateEnum([]string{"UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"}), - Description: `The type of the repo, since it may not be explicit from the repo field (e.g from a URL). -Values can be UNKNOWN, CLOUD_SOURCE_REPOSITORIES, GITHUB, BITBUCKET Possible values: ["UNKNOWN", "CLOUD_SOURCE_REPOSITORIES", "GITHUB", "BITBUCKET"]`, - }, - "uri": { - Type: schema.TypeString, - Required: true, - Description: `The URI of the repo (required).`, - }, - }, - }, - AtLeastOneOf: []string{"trigger_template", "github", "pubsub_config", "webhook_config", "source_to_build"}, - }, - "substitutions": { - Type: schema.TypeMap, - Optional: true, - Description: `Substitutions data for Build resource.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "tags": { - Type: schema.TypeList, - Optional: true, - Description: `Tags for annotation of a BuildTrigger`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "trigger_template": { - Type: schema.TypeList, - Optional: true, - Description: `Template describing the types of source changes to trigger a build. -Branch and tag names in trigger templates are interpreted as regular -expressions. Any branch or tag change that matches that regular -expression will trigger a build. -One of 'trigger_template', 'github', 'pubsub_config', 'webhook_config' or 'source_to_build' must be provided.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "branch_name": { - Type: schema.TypeString, - Optional: true, - Description: `Name of the branch to build. Exactly one a of branch name, tag, or commit SHA must be provided. -This field is a regular expression.`, - ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"}, - }, - "commit_sha": { - Type: schema.TypeString, - Optional: true, - Description: `Explicit commit SHA to build. Exactly one of a branch name, tag, or commit SHA must be provided.`, - ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"}, - }, - "dir": { - Type: schema.TypeString, - Optional: true, - Description: `Directory, relative to the source root, in which to run the build. -This must be a relative path. If a step's dir is specified and -is an absolute path, this value is ignored for that step's -execution.`, - }, - "invert_regex": { - Type: schema.TypeBool, - Optional: true, - Description: `Only trigger a build if the revision regex does NOT match the revision regex.`, - }, - "project_id": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `ID of the project that owns the Cloud Source Repository. If -omitted, the project ID requesting the build is assumed.`, - }, - "repo_name": { - Type: schema.TypeString, - Optional: true, - Description: `Name of the Cloud Source Repository. If omitted, the name "default" is assumed.`, - Default: "default", - }, - "tag_name": { - Type: schema.TypeString, - Optional: true, - Description: `Name of the tag to build. Exactly one of a branch name, tag, or commit SHA must be provided. -This field is a regular expression.`, - ExactlyOneOf: []string{"trigger_template.0.branch_name", "trigger_template.0.tag_name", "trigger_template.0.commit_sha"}, - }, - }, - }, - AtLeastOneOf: []string{"trigger_template", "github", "pubsub_config", "webhook_config", "source_to_build"}, - }, - "webhook_config": { - Type: schema.TypeList, - Optional: true, - Description: `WebhookConfig describes the configuration of a trigger that creates -a build whenever a webhook is sent to a trigger's webhook URL. -One of 'trigger_template', 'github', 'pubsub_config' 'webhook_config' or 'source_to_build' must be provided.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "secret": { - Type: schema.TypeString, - Required: true, - Description: `Resource name for the secret required as a URL parameter.`, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `Potential issues with the underlying Pub/Sub subscription configuration. -Only populated on get requests.`, - }, - }, - }, - AtLeastOneOf: []string{"trigger_template", "github", "pubsub_config", "webhook_config", "source_to_build"}, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - Description: `Time when the trigger was created.`, - }, - "trigger_id": { - Type: schema.TypeString, - Computed: true, - Description: `The unique identifier for the trigger.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/cloud_run_domain_mapping.go.tmpl b/mmv1/templates/terraform/state_migrations/go/cloud_run_domain_mapping.go.tmpl deleted file mode 100644 index 8dd3a6aa3559..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/cloud_run_domain_mapping.go.tmpl +++ /dev/null @@ -1,281 +0,0 @@ -var domainMappingGoogleProvidedLocationLabel = "cloud.googleapis.com/location" -var domainMappingGoogleProvidedOverrideLabel = "run.googleapis.com/overrideAt" - -var domainMappingGoogleProvidedLabels = []string{ - domainMappingGoogleProvidedLocationLabel, - domainMappingGoogleProvidedOverrideLabel, -} - -func DomainMappingLabelDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for the labels provided by Google - for _, label := range domainMappingGoogleProvidedLabels { - if strings.Contains(k, label) && new == "" { - return true - } - } - - // Let diff be determined by labels (above) - if strings.Contains(k, "labels.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} - -func resourceCloudRunDomainMappingResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "location": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The location of the cloud run instance. eg us-central1`, - }, - "metadata": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `Metadata associated with this DomainMapping.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "namespace": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `In Cloud Run the namespace must be equal to either the -project ID or project number.`, - }, - "annotations": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - ForceNew: true, - DiffSuppressFunc: cloudrunAnnotationDiffSuppress, - Description: `Annotations is a key value map stored with a resource that -may be set by external tools to store and retrieve arbitrary metadata. More -info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations - -**Note**: The Cloud Run API may add additional annotations that were not provided in your config. -If terraform plan shows a diff where a server-side annotation is added, you can add it to your config -or apply the lifecycle.ignore_changes rule to the metadata.0.annotations field.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "labels": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - ForceNew: true, - DiffSuppressFunc: DomainMappingLabelDiffSuppress, - Description: `Map of string keys and values that can be used to organize and categorize -(scope and select) objects. May match selectors of replication controllers -and routes. -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "generation": { - Type: schema.TypeInt, - Computed: true, - Description: `A sequence number representing a specific generation of the desired state.`, - }, - "resource_version": { - Type: schema.TypeString, - Computed: true, - Description: `An opaque value that represents the internal version of this object that -can be used by clients to determine when objects have changed. May be used -for optimistic concurrency, change detection, and the watch operation on a -resource or set of resources. They may only be valid for a -particular resource or set of resources. - -More info: -https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency`, - }, - "self_link": { - Type: schema.TypeString, - Computed: true, - Description: `SelfLink is a URL representing this object.`, - }, - "uid": { - Type: schema.TypeString, - Computed: true, - Description: `UID is a unique id generated by the server on successful creation of a resource and is not -allowed to change on PUT operations. - -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids`, - }, - }, - }, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Name should be a [verified](https://support.google.com/webmasters/answer/9008080) domain`, - }, - "spec": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `The spec for this DomainMapping.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "route_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - Description: `The name of the Cloud Run Service that this DomainMapping applies to. -The route must exist.`, - }, - "certificate_mode": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"NONE", "AUTOMATIC", ""}), - Description: `The mode of the certificate. Default value: "AUTOMATIC" Possible values: ["NONE", "AUTOMATIC"]`, - Default: "AUTOMATIC", - }, - "force_override": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `If set, the mapping will override any mapping set before this spec was set. -It is recommended that the user leaves this empty to receive an error -warning about a potential conflict and only set it once the respective UI -has given such a warning.`, - }, - }, - }, - }, - "status": { - Type: schema.TypeList, - Computed: true, - Description: `The current status of the DomainMapping.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "resource_records": { - Type: schema.TypeList, - Optional: true, - Description: `The resource records required to configure this domain mapping. These -records must be added to the domain's DNS configuration in order to -serve the application via this domain mapping.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "type": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateEnum([]string{"A", "AAAA", "CNAME", ""}), - Description: `Resource record type. Example: 'AAAA'. Possible values: ["A", "AAAA", "CNAME"]`, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Description: `Relative name of the object affected by this record. Only applicable for -'CNAME' records. Example: 'www'.`, - }, - "rrdata": { - Type: schema.TypeString, - Computed: true, - Description: `Data for this record. Values vary by record type, as defined in RFC 1035 -(section 5) and RFC 1034 (section 3.6.1).`, - }, - }, - }, - }, - "conditions": { - Type: schema.TypeList, - Computed: true, - Description: `Array of observed DomainMappingConditions, indicating the current state -of the DomainMapping.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "message": { - Type: schema.TypeString, - Computed: true, - Description: `Human readable message indicating details about the current status.`, - }, - "reason": { - Type: schema.TypeString, - Computed: true, - Description: `One-word CamelCase reason for the condition's current status.`, - }, - "status": { - Type: schema.TypeString, - Computed: true, - Description: `Status of the condition, one of True, False, Unknown.`, - }, - "type": { - Type: schema.TypeString, - Computed: true, - Description: `Type of domain mapping condition.`, - }, - }, - }, - }, - "mapped_route_name": { - Type: schema.TypeString, - Computed: true, - Description: `The name of the route that the mapping currently points to.`, - }, - "observed_generation": { - Type: schema.TypeInt, - Computed: true, - Description: `ObservedGeneration is the 'Generation' of the DomainMapping that -was last processed by the controller.`, - }, - }, - }, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceCloudRunDomainMappingUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - - if rawState["metadata"] != nil { - rawMetadatas := rawState["metadata"].([]interface{}) - if len(rawMetadatas) > 0 && rawMetadatas[0] != nil { - // Upgrade labels fields - rawMetadata := rawMetadatas[0].(map[string]interface{}) - - rawLabels := rawMetadata["labels"] - rawTerraformLabels := rawMetadata["terraform_labels"] - if rawLabels != nil { - labels := make(map[string]interface{}) - effectiveLabels := make(map[string]interface{}) - - for k, v := range rawLabels.(map[string]interface{}) { - effectiveLabels[k] = v - - if !strings.Contains(k, domainMappingGoogleProvidedLocationLabel) && !strings.Contains(k, domainMappingGoogleProvidedOverrideLabel) { - labels[k] = v - } - } - - rawMetadata["labels"] = labels - rawMetadata["effective_labels"] = effectiveLabels - - if rawTerraformLabels == nil { - rawMetadata["terraform_labels"] = labels - } - } - - upgradeAnnotations(rawMetadata) - - rawState["metadata"] = []interface{}{rawMetadata} - } - } - - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} diff --git a/mmv1/templates/terraform/state_migrations/go/cloud_run_service.go.tmpl b/mmv1/templates/terraform/state_migrations/go/cloud_run_service.go.tmpl deleted file mode 100644 index f5d3d215d3e2..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/cloud_run_service.go.tmpl +++ /dev/null @@ -1,1099 +0,0 @@ -var cloudRunGoogleProvidedAnnotations = regexp.MustCompile(`serving\.knative\.dev/(?:(?:creator)|(?:lastModifier))$|run\.googleapis\.com/(?:(?:ingress-status)|(?:operation-id))$|cloud\.googleapis\.com/(?:(?:location))`) - -func cloudrunAnnotationDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for the annotations provided by Google - if cloudRunGoogleProvidedAnnotations.MatchString(k) && new == "" { - return true - } - - if strings.HasSuffix(k, "run.googleapis.com/ingress") { - return old == "all" && new == "" - } - - // Let diff be determined by annotations (above) - if strings.Contains(k, "annotations.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} - -var cloudRunGoogleProvidedLabels = regexp.MustCompile(`cloud\.googleapis\.com/(?:(?:location))`) - -func cloudrunLabelDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for the labels provided by Google - if cloudRunGoogleProvidedLabels.MatchString(k) && new == "" { - return true - } - - // Let diff be determined by labels (above) - if strings.Contains(k, "labels.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} - -func resourceCloudRunServiceResourceV1() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "location": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The location of the cloud run instance. eg us-central1`, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Name must be unique within a Google Cloud project and region. -Is required when creating resources. Name is primarily intended -for creation idempotence and configuration definition. Cannot be updated. -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names`, - }, - "template": { - Type: schema.TypeList, - Optional: true, - Description: `template holds the latest specification for the Revision to -be stamped out. The template references the container image, and may also -include labels and annotations that should be attached to the Revision. -To correlate a Revision, and/or to force a Revision to be created when the -spec doesn't otherwise change, a nonce label may be provided in the -template metadata. For more details, see: -https://github.com/knative/serving/blob/main/docs/client-conventions.md#associate-modifications-with-revisions - -Cloud Run does not currently support referencing a build that is -responsible for materializing the container image from source.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "spec": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `RevisionSpec holds the desired state of the Revision (from the client).`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "containers": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `Containers defines the unit of execution for this Revision.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "image": { - Type: schema.TypeString, - Required: true, - Description: `Docker image name. This is most often a reference to a container located -in the container registry, such as gcr.io/cloudrun/hello`, - }, - "args": { - Type: schema.TypeList, - Optional: true, - Description: `Arguments to the entrypoint. -The docker image's CMD is used if this is not provided.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "command": { - Type: schema.TypeList, - Optional: true, - Description: `Entrypoint array. Not executed within a shell. -The docker image's ENTRYPOINT is used if this is not provided.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "env": { - Type: schema.TypeSet, - Optional: true, - Description: `List of environment variables to set in the container.`, - Elem: cloudrunServiceSpecTemplateSpecContainersContainersEnvSchema(), - // Default schema.HashSchema is used. - }, - "env_from": { - Type: schema.TypeList, - Optional: true, - Deprecated: "`env_from` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.", - ForceNew: true, - Description: `List of sources to populate environment variables in the container. -All invalid keys will be reported as an event when the container is starting. -When a key exists in multiple sources, the value associated with the last source will -take precedence. Values defined by an Env with a duplicate key will take -precedence.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "config_map_ref": { - Type: schema.TypeList, - Optional: true, - Description: `The ConfigMap to select from.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "local_object_reference": { - Type: schema.TypeList, - Optional: true, - Description: `The ConfigMap to select from.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: `Name of the referent.`, - }, - }, - }, - }, - "optional": { - Type: schema.TypeBool, - Optional: true, - Description: `Specify whether the ConfigMap must be defined`, - }, - }, - }, - }, - "prefix": { - Type: schema.TypeString, - Optional: true, - Description: `An optional identifier to prepend to each key in the ConfigMap.`, - }, - "secret_ref": { - Type: schema.TypeList, - Optional: true, - Description: `The Secret to select from.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "local_object_reference": { - Type: schema.TypeList, - Optional: true, - Description: `The Secret to select from.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: `Name of the referent.`, - }, - }, - }, - }, - "optional": { - Type: schema.TypeBool, - Optional: true, - Description: `Specify whether the Secret must be defined`, - }, - }, - }, - }, - }, - }, - }, - "liveness_probe": { - Type: schema.TypeList, - Optional: true, - Description: `Periodic probe of container liveness. Container will be restarted if the probe fails.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "failure_threshold": { - Type: schema.TypeInt, - Optional: true, - Description: `Minimum consecutive failures for the probe to be considered failed after -having succeeded. Defaults to 3. Minimum value is 1.`, - Default: 3, - }, - "grpc": { - Type: schema.TypeList, - Optional: true, - Description: `GRPC specifies an action involving a GRPC port.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "port": { - Type: schema.TypeInt, - Computed: true, - Optional: true, - Description: `Port number to access on the container. Number must be in the range 1 to 65535. -If not specified, defaults to the same value as container.ports[0].containerPort.`, - }, - "service": { - Type: schema.TypeString, - Optional: true, - Description: `The name of the service to place in the gRPC HealthCheckRequest -(see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). -If this is not specified, the default behavior is defined by gRPC.`, - }, - }, - }, - ExactlyOneOf: []string{}, - }, - "http_get": { - Type: schema.TypeList, - Optional: true, - Description: `HttpGet specifies the http request to perform.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "http_headers": { - Type: schema.TypeList, - Optional: true, - Description: `Custom headers to set in the request. HTTP allows repeated headers.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: `The header field name.`, - }, - "value": { - Type: schema.TypeString, - Optional: true, - Description: `The header field value.`, - Default: "", - }, - }, - }, - }, - "path": { - Type: schema.TypeString, - Optional: true, - Description: `Path to access on the HTTP server. If set, it should not be empty string.`, - Default: "/", - }, - "port": { - Type: schema.TypeInt, - Computed: true, - Optional: true, - Description: `Port number to access on the container. Number must be in the range 1 to 65535. -If not specified, defaults to the same value as container.ports[0].containerPort.`, - }, - }, - }, - ExactlyOneOf: []string{}, - }, - "initial_delay_seconds": { - Type: schema.TypeInt, - Optional: true, - Description: `Number of seconds after the container has started before the probe is -initiated. -Defaults to 0 seconds. Minimum value is 0. Maximum value is 3600.`, - Default: 0, - }, - "period_seconds": { - Type: schema.TypeInt, - Optional: true, - Description: `How often (in seconds) to perform the probe. -Default to 10 seconds. Minimum value is 1. Maximum value is 3600.`, - Default: 10, - }, - "timeout_seconds": { - Type: schema.TypeInt, - Optional: true, - Description: `Number of seconds after which the probe times out. -Defaults to 1 second. Minimum value is 1. Maximum value is 3600. -Must be smaller than period_seconds.`, - Default: 1, - }, - }, - }, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `Name of the container`, - }, - "ports": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `List of open ports in the container.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "container_port": { - Type: schema.TypeInt, - Optional: true, - Description: `Port number the container listens on. This must be a valid port number (between 1 and 65535). Defaults to "8080".`, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `If specified, used to specify which protocol to use. Allowed values are "http1" (HTTP/1) and "h2c" (HTTP/2 end-to-end). Defaults to "http1".`, - }, - "protocol": { - Type: schema.TypeString, - Optional: true, - Description: `Protocol for port. Must be "TCP". Defaults to "TCP".`, - }, - }, - }, - }, - "resources": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `Compute Resources required by this container. Used to set values such as max memory`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "limits": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - Description: `Limits describes the maximum amount of compute resources allowed. -The values of the map is string form of the 'quantity' k8s type: -https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "requests": { - Type: schema.TypeMap, - Optional: true, - Description: `Requests describes the minimum amount of compute resources required. -If Requests is omitted for a container, it defaults to Limits if that is -explicitly specified, otherwise to an implementation-defined value. -The values of the map is string form of the 'quantity' k8s type: -https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - }, - }, - }, - "startup_probe": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `Startup probe of application within the container. -All other probes are disabled if a startup probe is provided, until it -succeeds. Container will not be added to service endpoints if the probe fails.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "failure_threshold": { - Type: schema.TypeInt, - Optional: true, - Description: `Minimum consecutive failures for the probe to be considered failed after -having succeeded. Defaults to 3. Minimum value is 1.`, - Default: 3, - }, - "grpc": { - Type: schema.TypeList, - Optional: true, - Description: `GRPC specifies an action involving a GRPC port.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "port": { - Type: schema.TypeInt, - Computed: true, - Optional: true, - Description: `Port number to access on the container. Number must be in the range 1 to 65535. -If not specified, defaults to the same value as container.ports[0].containerPort.`, - }, - "service": { - Type: schema.TypeString, - Optional: true, - Description: `The name of the service to place in the gRPC HealthCheckRequest -(see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). -If this is not specified, the default behavior is defined by gRPC.`, - }, - }, - }, - ExactlyOneOf: []string{}, - }, - "http_get": { - Type: schema.TypeList, - Optional: true, - Description: `HttpGet specifies the http request to perform.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "http_headers": { - Type: schema.TypeList, - Optional: true, - Description: `Custom headers to set in the request. HTTP allows repeated headers.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: `The header field name.`, - }, - "value": { - Type: schema.TypeString, - Optional: true, - Description: `The header field value.`, - Default: "", - }, - }, - }, - }, - "path": { - Type: schema.TypeString, - Optional: true, - Description: `Path to access on the HTTP server. If set, it should not be empty string.`, - Default: "/", - }, - "port": { - Type: schema.TypeInt, - Computed: true, - Optional: true, - Description: `Port number to access on the container. Number must be in the range 1 to 65535. -If not specified, defaults to the same value as container.ports[0].containerPort.`, - }, - }, - }, - ExactlyOneOf: []string{}, - }, - "initial_delay_seconds": { - Type: schema.TypeInt, - Optional: true, - Description: `Number of seconds after the container has started before the probe is -initiated. -Defaults to 0 seconds. Minimum value is 0. Maximum value is 240.`, - Default: 0, - }, - "period_seconds": { - Type: schema.TypeInt, - Optional: true, - Description: `How often (in seconds) to perform the probe. -Default to 10 seconds. Minimum value is 1. Maximum value is 240.`, - Default: 10, - }, - "tcp_socket": { - Type: schema.TypeList, - Optional: true, - Description: `TcpSocket specifies an action involving a TCP port.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "port": { - Type: schema.TypeInt, - Computed: true, - Optional: true, - Description: `Port number to access on the container. Number must be in the range 1 to 65535. -If not specified, defaults to the same value as container.ports[0].containerPort.`, - }, - }, - }, - ExactlyOneOf: []string{}, - }, - "timeout_seconds": { - Type: schema.TypeInt, - Optional: true, - Description: `Number of seconds after which the probe times out. -Defaults to 1 second. Minimum value is 1. Maximum value is 3600. -Must be smaller than periodSeconds.`, - Default: 1, - }, - }, - }, - }, - "volume_mounts": { - Type: schema.TypeList, - Optional: true, - Description: `Volume to mount into the container's filesystem. -Only supports SecretVolumeSources.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "mount_path": { - Type: schema.TypeString, - Required: true, - Description: `Path within the container at which the volume should be mounted. Must -not contain ':'.`, - }, - "name": { - Type: schema.TypeString, - Required: true, - Description: `This must match the Name of a Volume.`, - }, - }, - }, - }, - "working_dir": { - Type: schema.TypeString, - Optional: true, - Deprecated: "`working_dir` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.", - ForceNew: true, - Description: `Container's working directory. -If not specified, the container runtime's default will be used, which -might be configured in the container image.`, - }, - }, - }, - }, - "container_concurrency": { - Type: schema.TypeInt, - Computed: true, - Optional: true, - Description: `ContainerConcurrency specifies the maximum allowed in-flight (concurrent) -requests per container of the Revision. Values are: -- '0' thread-safe, the system should manage the max concurrency. This is - the default value. -- '1' not-thread-safe. Single concurrency -- '2-N' thread-safe, max concurrency of N`, - }, - "service_account_name": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `Email address of the IAM service account associated with the revision of the -service. The service account represents the identity of the running revision, -and determines what permissions the revision has. If not provided, the revision -will use the project's default service account.`, - }, - "timeout_seconds": { - Type: schema.TypeInt, - Computed: true, - Optional: true, - Description: `TimeoutSeconds holds the max duration the instance is allowed for responding to a request.`, - }, - "volumes": { - Type: schema.TypeList, - Optional: true, - Description: `Volume represents a named volume in a container.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: `Volume's name.`, - }, -{{- if ne $.TargetVersionName "ga" }} - "empty_dir": { - Type: schema.TypeList, - Optional: true, - Description: `Ephemeral storage which can be backed by real disks (HD, SSD), network storage or memory (i.e. tmpfs). For now only in memory (tmpfs) is supported. It is ephemeral in the sense that when the sandbox is taken down, the data is destroyed with it (it does not persist across sandbox runs).`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "medium": { - Type: schema.TypeString, - Optional: true, - Description: `The medium on which the data is stored. The default is "" which means to use the node's default medium. Must be an empty string (default) or Memory.`, - }, - "size_limit": { - Type: schema.TypeString, - Optional: true, - Description: `Limit on the storage usable by this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. This field's values are of the 'Quantity' k8s type: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir.`, - }, - }, - }, - }, -{{- end }} - "secret": { - Type: schema.TypeList, - Optional: true, - Description: `The secret's value will be presented as the content of a file whose -name is defined in the item path. If no items are defined, the name of -the file is the secret_name.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "secret_name": { - Type: schema.TypeString, - Required: true, - 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}. -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.`, - }, - "default_mode": { - Type: schema.TypeInt, - Optional: true, - Description: `Mode bits to use on created files by default. Must be a value between 0000 -and 0777. Defaults to 0644. Directories within the path are not affected by -this setting. This might be in conflict with other options that affect the -file mode, like fsGroup, and the result can be other mode bits set.`, - }, - "items": { - Type: schema.TypeList, - Optional: true, - Description: `If unspecified, the volume will expose a file whose name is the -secret_name. -If specified, the key will be used as the version to fetch from Cloud -Secret Manager and the path will be the name of the file exposed in the -volume. When items are defined, they must specify a key and a path.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "key": { - Type: schema.TypeString, - Required: true, - Description: `The Cloud Secret Manager secret version. -Can be 'latest' for the latest value or an integer for a specific version.`, - }, - "path": { - Type: schema.TypeString, - Required: true, - Description: `The relative path of the file to map the key to. -May not be an absolute path. -May not contain the path element '..'. -May not start with the string '..'.`, - }, - "mode": { - Type: schema.TypeInt, - Optional: true, - Description: `Mode bits to use on this file, must be a value between 0000 and 0777. If -not specified, the volume defaultMode will be used. This might be in -conflict with other options that affect the file mode, like fsGroup, and -the result can be other mode bits set.`, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - "serving_state": { - Type: schema.TypeString, - Computed: true, - Deprecated: "`serving_state` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.", - Description: `ServingState holds a value describing the state the resources -are in for this Revision. -It is expected -that the system will manipulate this based on routability and load.`, - }, - }, - }, - }, - "metadata": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `Optional metadata for this Revision, including labels and annotations. -Name will be generated by the Configuration. To set minimum instances -for this revision, use the "autoscaling.knative.dev/minScale" annotation -key. To set maximum instances for this revision, use the -"autoscaling.knative.dev/maxScale" annotation key. To set Cloud SQL -connections for the revision, use the "run.googleapis.com/cloudsql-instances" -annotation key.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "annotations": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - DiffSuppressFunc: cloudrunTemplateAnnotationDiffSuppress, - Description: `Annotations is a key value map stored with a resource that -may be set by external tools to store and retrieve arbitrary metadata. More -info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations - -**Note**: The Cloud Run API may add additional annotations that were not provided in your config. -If terraform plan shows a diff where a server-side annotation is added, you can add it to your config -or apply the lifecycle.ignore_changes rule to the metadata.0.annotations field. - -Annotations with 'run.googleapis.com/' and 'autoscaling.knative.dev' are restricted. Use the following annotation -keys to configure features on a Revision template: - -- 'autoscaling.knative.dev/maxScale' sets the [maximum number of container - instances](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--max-instances) of the Revision to run. -- 'autoscaling.knative.dev/minScale' sets the [minimum number of container - instances](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--min-instances) of the Revision to run. -- 'run.googleapis.com/client-name' sets the client name calling the Cloud Run API. -- 'run.googleapis.com/cloudsql-instances' sets the [Cloud SQL - instances](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--add-cloudsql-instances) the Revision connects to. -- 'run.googleapis.com/cpu-throttling' sets whether to throttle the CPU when the container is not actively serving - requests. See https://cloud.google.com/sdk/gcloud/reference/run/deploy#--[no-]cpu-throttling. -- 'run.googleapis.com/encryption-key-shutdown-hours' sets the number of hours to wait before an automatic shutdown - server after CMEK key revocation is detected. -- 'run.googleapis.com/encryption-key' sets the [CMEK key](https://cloud.google.com/run/docs/securing/using-cmek) - reference to encrypt the container with. -- 'run.googleapis.com/execution-environment' sets the [execution - environment](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--execution-environment) - where the application will run. -- 'run.googleapis.com/post-key-revocation-action-type' sets the - [action type](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--post-key-revocation-action-type) - after CMEK key revocation. -- 'run.googleapis.com/secrets' sets a list of key-value pairs to set as - [secrets](https://cloud.google.com/run/docs/configuring/secrets#yaml). -- 'run.googleapis.com/sessionAffinity' sets whether to enable - [session affinity](https://cloud.google.com/sdk/gcloud/reference/beta/run/deploy#--[no-]session-affinity) - for connections to the Revision. -- 'run.googleapis.com/startup-cpu-boost' sets whether to allocate extra CPU to containers on startup. - See https://cloud.google.com/sdk/gcloud/reference/run/deploy#--[no-]cpu-boost. -- 'run.googleapis.com/vpc-access-connector' sets a [VPC connector](https://cloud.google.com/run/docs/configuring/connecting-vpc#terraform_1) - for the Revision. -- 'run.googleapis.com/vpc-access-egress' sets the outbound traffic to send through the VPC connector for this resource. - See https://cloud.google.com/sdk/gcloud/reference/run/deploy#--vpc-egress.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "labels": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - DiffSuppressFunc: cloudrunTemplateLabelDiffSuppress, - Description: `Map of string keys and values that can be used to organize and categorize -(scope and select) objects.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `Name must be unique within a Google Cloud project and region. -Is required when creating resources. Name is primarily intended -for creation idempotence and configuration definition. Cannot be updated.`, - }, - "namespace": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `In Cloud Run the namespace must be equal to either the -project ID or project number. It will default to the resource's project.`, - }, - "generation": { - Type: schema.TypeInt, - Computed: true, - Description: `A sequence number representing a specific generation of the desired state.`, - }, - "resource_version": { - Type: schema.TypeString, - Computed: true, - Description: `An opaque value that represents the internal version of this object that -can be used by clients to determine when objects have changed. May be used -for optimistic concurrency, change detection, and the watch operation on a -resource or set of resources. They may only be valid for a -particular resource or set of resources.`, - }, - "self_link": { - Type: schema.TypeString, - Computed: true, - Description: `SelfLink is a URL representing this object.`, - }, - "uid": { - Type: schema.TypeString, - Computed: true, - Description: `UID is a unique id generated by the server on successful creation of a resource and is not -allowed to change on PUT operations.`, - }, - }, - }, - }, - }, - }, - }, - "traffic": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `Traffic specifies how to distribute traffic over a collection of Knative Revisions -and Configurations`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "percent": { - Type: schema.TypeInt, - Required: true, - Description: `Percent specifies percent of the traffic to this Revision or Configuration.`, - }, - "latest_revision": { - Type: schema.TypeBool, - Optional: true, - Description: `LatestRevision may be optionally provided to indicate that the latest ready -Revision of the Configuration should be used for this traffic target. When -provided LatestRevision must be true if RevisionName is empty; it must be -false when RevisionName is non-empty.`, - }, - "revision_name": { - Type: schema.TypeString, - Optional: true, - Description: `RevisionName of a specific revision to which to send this portion of traffic.`, - }, - "tag": { - Type: schema.TypeString, - Optional: true, - Description: `Tag is optionally used to expose a dedicated url for referencing this target exclusively.`, - }, - "url": { - Type: schema.TypeString, - Computed: true, - Description: `URL displays the URL for accessing tagged traffic targets. URL is displayed in status, -and is disallowed on spec. URL must contain a scheme (e.g. http://) and a hostname, -but may not contain anything else (e.g. basic auth, url path, etc.)`, - }, - }, - }, - }, - - "metadata": { - Type: schema.TypeList, - Computed: true, - Optional: true, - Description: `Metadata associated with this Service, including name, namespace, labels, -and annotations.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "annotations": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - DiffSuppressFunc: cloudrunAnnotationDiffSuppress, - Description: `Annotations is a key value map stored with a resource that -may be set by external tools to store and retrieve arbitrary metadata. More -info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations - -**Note**: The Cloud Run API may add additional annotations that were not provided in your config. -If terraform plan shows a diff where a server-side annotation is added, you can add it to your config -or apply the lifecycle.ignore_changes rule to the metadata.0.annotations field. - -Annotations with 'run.googleapis.com/' and 'autoscaling.knative.dev' are restricted. Use the following annotation -keys to configure features on a Service: - -- 'run.googleapis.com/binary-authorization-breakglass' sets the [Binary Authorization breakglass](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--breakglass). -- 'run.googleapis.com/binary-authorization' sets the [Binary Authorization](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--binary-authorization). -- 'run.googleapis.com/client-name' sets the client name calling the Cloud Run API. -- 'run.googleapis.com/custom-audiences' sets the [custom audiences](https://cloud.google.com/sdk/gcloud/reference/alpha/run/deploy#--add-custom-audiences) - that can be used in the audience field of ID token for authenticated requests. -- 'run.googleapis.com/description' sets a user defined description for the Service. -- 'run.googleapis.com/ingress' sets the [ingress settings](https://cloud.google.com/sdk/gcloud/reference/run/deploy#--ingress) - for the Service. For example, '"run.googleapis.com/ingress" = "all"'. -- 'run.googleapis.com/launch-stage' sets the [launch stage](https://cloud.google.com/run/docs/troubleshooting#launch-stage-validation) - when a preview feature is used. For example, '"run.googleapis.com/launch-stage": "BETA"'`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "labels": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - DiffSuppressFunc: cloudrunLabelDiffSuppress, - Description: `Map of string keys and values that can be used to organize and categorize -(scope and select) objects. May match selectors of replication controllers -and routes.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "namespace": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `In Cloud Run the namespace must be equal to either the -project ID or project number.`, - }, - "generation": { - Type: schema.TypeInt, - Computed: true, - Description: `A sequence number representing a specific generation of the desired state.`, - }, - "resource_version": { - Type: schema.TypeString, - Computed: true, - Description: `An opaque value that represents the internal version of this object that -can be used by clients to determine when objects have changed. May be used -for optimistic concurrency, change detection, and the watch operation on a -resource or set of resources. They may only be valid for a -particular resource or set of resources.`, - }, - "self_link": { - Type: schema.TypeString, - Computed: true, - Description: `SelfLink is a URL representing this object.`, - }, - "uid": { - Type: schema.TypeString, - Computed: true, - Description: `UID is a unique id generated by the server on successful creation of a resource and is not -allowed to change on PUT operations.`, - }, - }, - }, - }, - "status": { - Type: schema.TypeList, - Computed: true, - Description: `The current status of the Service.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "conditions": { - Type: schema.TypeList, - Computed: true, - Description: `Array of observed Service Conditions, indicating the current ready state of the service.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "message": { - Type: schema.TypeString, - Computed: true, - Description: `Human readable message indicating details about the current status.`, - }, - "reason": { - Type: schema.TypeString, - Computed: true, - Description: `One-word CamelCase reason for the condition's current status.`, - }, - "status": { - Type: schema.TypeString, - Computed: true, - Description: `Status of the condition, one of True, False, Unknown.`, - }, - "type": { - Type: schema.TypeString, - Computed: true, - Description: `Type of domain mapping condition.`, - }, - }, - }, - }, - "latest_created_revision_name": { - Type: schema.TypeString, - Computed: true, - Description: `From ConfigurationStatus. LatestCreatedRevisionName is the last revision that was created -from this Service's Configuration. It might not be ready yet, for that use -LatestReadyRevisionName.`, - }, - "latest_ready_revision_name": { - Type: schema.TypeString, - Computed: true, - Description: `From ConfigurationStatus. LatestReadyRevisionName holds the name of the latest Revision -stamped out from this Service's Configuration that has had its "Ready" condition become -"True".`, - }, - "observed_generation": { - Type: schema.TypeInt, - Computed: true, - Description: `ObservedGeneration is the 'Generation' of the Route that was last processed by the -controller. - -Clients polling for completed reconciliation should poll until observedGeneration = -metadata.generation and the Ready condition's status is True or False.`, - }, - "traffic": { - Type: schema.TypeList, - Computed: true, - Description: `Traffic specifies how to distribute traffic over a collection of Knative Revisions -and Configurations`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "latest_revision": { - Type: schema.TypeBool, - Computed: true, - Description: `LatestRevision may be optionally provided to indicate that the latest ready -Revision of the Configuration should be used for this traffic target. When -provided LatestRevision must be true if RevisionName is empty; it must be -false when RevisionName is non-empty.`, - }, - "percent": { - Type: schema.TypeInt, - Computed: true, - Description: `Percent specifies percent of the traffic to this Revision or Configuration.`, - }, - "revision_name": { - Type: schema.TypeString, - Computed: true, - Description: `RevisionName of a specific revision to which to send this portion of traffic.`, - }, - "tag": { - Type: schema.TypeString, - Computed: true, - Description: `Tag is optionally used to expose a dedicated url for referencing this target exclusively.`, - }, - "url": { - Type: schema.TypeString, - Computed: true, - Description: `URL displays the URL for accessing tagged traffic targets. URL is displayed in status, -and is disallowed on spec. URL must contain a scheme (e.g. http://) and a hostname, -but may not contain anything else (e.g. basic auth, url path, etc.)`, - }, - }, - }, - }, - "url": { - Type: schema.TypeString, - Computed: true, - Description: `From RouteStatus. URL holds the url that will distribute traffic over the provided traffic -targets. It generally has the form -https://{route-hash}-{project-hash}-{cluster-level-suffix}.a.run.app`, - }, - }, - }, - }, - "autogenerate_revision_name": { - Type: schema.TypeBool, - Optional: true, - Default: false, - Description: `If set to 'true', the revision name (template.metadata.name) will be omitted and -autogenerated by Cloud Run. This cannot be set to 'true' while 'template.metadata.name' -is also set. -(For legacy support, if 'template.metadata.name' is unset in state while -this field is set to false, the revision name will still autogenerate.)`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func upgradeAnnotations(rawMetadata map[string]interface{}) { - rawAnnotations := rawMetadata["annotations"] - if rawAnnotations != nil { - annotations := make(map[string]interface{}) - effectiveAnnotations := make(map[string]interface{}) - - for k, v := range rawAnnotations.(map[string]interface{}) { - effectiveAnnotations[k] = v - - if !(cloudRunGoogleProvidedAnnotations.MatchString(k) || (strings.HasSuffix(k, "run.googleapis.com/ingress") && v == "all")) { - annotations[k] = v - } - } - - rawMetadata["annotations"] = annotations - rawMetadata["effective_annotations"] = effectiveAnnotations - } -} - -func ResourceCloudRunServiceUpgradeV1(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - - if rawState["metadata"] != nil { - rawMetadatas := rawState["metadata"].([]interface{}) - - // Upgrade labels fields - if len(rawMetadatas) > 0 && rawMetadatas[0] != nil { - rawMetadata := rawMetadatas[0].(map[string]interface{}) - - rawLabels := rawMetadata["labels"] - if rawLabels != nil { - labels := make(map[string]interface{}) - effectiveLabels := make(map[string]interface{}) - - for k, v := range rawLabels.(map[string]interface{}) { - effectiveLabels[k] = v - - if !cloudRunGoogleProvidedLabels.MatchString(k) { - labels[k] = v - } - } - - rawMetadata["labels"] = labels - rawMetadata["effective_labels"] = effectiveLabels - } - - upgradeAnnotations(rawMetadata) - - rawState["metadata"] = []interface{}{rawMetadata} - } - } - - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} diff --git a/mmv1/templates/terraform/state_migrations/go/datastream_private_connection.go.tmpl b/mmv1/templates/terraform/state_migrations/go/datastream_private_connection.go.tmpl deleted file mode 100644 index 4beedd6ac2bd..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/datastream_private_connection.go.tmpl +++ /dev/null @@ -1,115 +0,0 @@ -func resourceDatastreamPrivateConnectionResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "display_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Display name.`, - }, - "location": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name of the location this private connection is located in.`, - }, - "private_connection_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The private connectivity identifier.`, - }, - "vpc_peering_config": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `The VPC Peering configuration is used to create VPC peering -between Datastream and the consumer's VPC.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "subnet": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `A free subnet for peering. (CIDR of /29)`, - }, - "vpc": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Fully qualified name of the VPC that Datastream will peer to. -Format: projects/{project}/global/{networks}/{name}`, - }, - }, - }, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Description: `Labels. - -**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}, - }, - "effective_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: 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}, - }, - "error": { - Type: schema.TypeList, - Computed: true, - Description: `The PrivateConnection error in case of failure.`, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "details": { - Type: schema.TypeMap, - Optional: true, - Description: `A list of messages that carry the error details.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "message": { - Type: schema.TypeString, - Optional: true, - Description: `A message containing more information about the error that occurred.`, - }, - }, - }, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Description: `The resource's name.`, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `State of the PrivateConnection.`, - }, - "terraform_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: true, - Description: `The combination of labels configured directly on the resource - and default labels configured on the provider.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceDatastreamPrivateConnectionUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - return tpgresource.TerraformLabelsStateUpgrade(rawState) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/filestore_instance.go.tmpl b/mmv1/templates/terraform/state_migrations/go/filestore_instance.go.tmpl deleted file mode 100644 index 597bf6f1c304..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/filestore_instance.go.tmpl +++ /dev/null @@ -1,188 +0,0 @@ -func resourceFilestoreInstanceResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "file_shares": { - Type: schema.TypeList, - Required: true, - Description: `File system shares on the instance. For this version, only a -single file share is supported.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "capacity_gb": { - Type: schema.TypeInt, - Required: true, - Description: `File share capacity in GiB. This must be at least 1024 GiB -for the standard tier, or 2560 GiB for the premium tier.`, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name of the fileshare (16 characters or less)`, - }, - "nfs_export_options": { - Type: schema.TypeList, - Optional: true, - Description: `Nfs Export Options. There is a limit of 10 export options per file share.`, - MaxItems: 10, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "access_mode": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{"READ_ONLY", "READ_WRITE", ""}, false), - Description: `Either READ_ONLY, for allowing only read requests on the exported directory, -or READ_WRITE, for allowing both read and write requests. The default is READ_WRITE. Default value: "READ_WRITE" Possible values: ["READ_ONLY", "READ_WRITE"]`, - Default: "READ_WRITE", - }, - "anon_gid": { - Type: schema.TypeInt, - Optional: true, - Description: `An integer representing the anonymous group id with a default value of 65534. -Anon_gid may only be set with squashMode of ROOT_SQUASH. An error will be returned -if this field is specified for other squashMode settings.`, - }, - "anon_uid": { - Type: schema.TypeInt, - Optional: true, - Description: `An integer representing the anonymous user id with a default value of 65534. -Anon_uid may only be set with squashMode of ROOT_SQUASH. An error will be returned -if this field is specified for other squashMode settings.`, - }, - "ip_ranges": { - Type: schema.TypeList, - Optional: true, - Description: `List of either IPv4 addresses, or ranges in CIDR notation which may mount the file share. -Overlapping IP ranges are not allowed, both within and across NfsExportOptions. An error will be returned. -The limit is 64 IP ranges/addresses for each FileShareConfig among all NfsExportOptions.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "squash_mode": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{"NO_ROOT_SQUASH", "ROOT_SQUASH", ""}, false), - Description: `Either NO_ROOT_SQUASH, for allowing root access on the exported directory, or ROOT_SQUASH, -for not allowing root access. The default is NO_ROOT_SQUASH. Default value: "NO_ROOT_SQUASH" Possible values: ["NO_ROOT_SQUASH", "ROOT_SQUASH"]`, - Default: "NO_ROOT_SQUASH", - }, - }, - }, - }, - }, - }, - }, - "name": { - Type: schema.TypeString, - Required: true, - Description: `The resource name of the instance.`, - }, - "networks": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `VPC networks to which the instance is connected. For this version, -only a single network is supported.`, - MinItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "modes": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - Description: `IP versions for which the instance has -IP addresses assigned. Possible values: ["ADDRESS_MODE_UNSPECIFIED", "MODE_IPV4", "MODE_IPV6"]`, - Elem: &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validation.StringInSlice([]string{"ADDRESS_MODE_UNSPECIFIED", "MODE_IPV4", "MODE_IPV6"}, false), - }, - }, - "network": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name of the GCE VPC network to which the -instance is connected.`, - }, - "connect_mode": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"DIRECT_PEERING", "PRIVATE_SERVICE_ACCESS", ""}, false), - Description: `The network connect mode of the Filestore instance. -If not provided, the connect mode defaults to -DIRECT_PEERING. Default value: "DIRECT_PEERING" Possible values: ["DIRECT_PEERING", "PRIVATE_SERVICE_ACCESS"]`, - Default: "DIRECT_PEERING", - }, - "reserved_ip_range": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `A /29 CIDR block that identifies the range of IP -addresses reserved for this instance.`, - }, - "ip_addresses": { - Type: schema.TypeList, - Computed: true, - Description: `A list of IPv4 or IPv6 addresses.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - }, - }, - }, - "tier": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"TIER_UNSPECIFIED", "STANDARD", "PREMIUM", "BASIC_HDD", "BASIC_SSD", "HIGH_SCALE_SSD", "ZONAL"}, false), - Description: `The service tier of the instance. Possible values: ["TIER_UNSPECIFIED", "STANDARD", "PREMIUM", "BASIC_HDD", "BASIC_SSD", "HIGH_SCALE_SSD", "ZONAL"]`, - }, - "zone": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name of the Filestore zone of the instance.`, - }, - "description": { - Type: schema.TypeString, - Optional: true, - Description: `A description of the instance.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - Description: `Resource labels to represent user-provided metadata.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - Description: `Creation timestamp in RFC3339 text format.`, - }, - "etag": { - Type: schema.TypeString, - Computed: true, - Description: `Server-specified ETag for the instance resource to prevent -simultaneous updates from overwriting each other.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - } -} - -func ResourceFilestoreInstanceUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - - rawState["location"] = rawState["zone"] - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} diff --git a/mmv1/templates/terraform/state_migrations/go/gke_hub_membership.go.tmpl b/mmv1/templates/terraform/state_migrations/go/gke_hub_membership.go.tmpl deleted file mode 100644 index b7c1415f5f0a..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/gke_hub_membership.go.tmpl +++ /dev/null @@ -1,91 +0,0 @@ -func resourceGKEHubMembershipResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "membership_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The client-provided identifier of the membership.`, - }, - "authority": { - Type: schema.TypeList, - Optional: true, - Description: `Authority encodes how Google will recognize identities from this Membership. -See the workload identity documentation for more details: -https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "issuer": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `A JSON Web Token (JWT) issuer URI. 'issuer' must start with 'https://' and // be a valid -with length <2000 characters. For example: 'https://container.googleapis.com/v1/projects/my-project/locations/us-west1/clusters/my-cluster' (must be 'locations' rather than 'zones'). If the cluster is provisioned with Terraform, this is '"https://container.googleapis.com/v1/${google_container_cluster.my-cluster.id}"'.`, - }, - }, - }, - }, - "endpoint": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `If this Membership is a Kubernetes API server hosted on GKE, this is a self link to its GCP resource.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "gke_cluster": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `If this Membership is a Kubernetes API server hosted on GKE, this is a self link to its GCP resource.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "resource_link": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: suppressGkeHubEndpointSelfLinkDiff, - Description: `Self-link of the GCP resource for the GKE cluster. -For example: '//container.googleapis.com/projects/my-project/zones/us-west1-a/clusters/my-cluster'. -It can be at the most 1000 characters in length. If the cluster is provisioned with Terraform, -this can be '"//container.googleapis.com/${google_container_cluster.my-cluster.id}"' or -'google_container_cluster.my-cluster.id'.`, - }, - }, - }, - }, - }, - }, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - Description: `Labels to apply to this membership.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Description: `The unique identifier of the membership.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - } -} - -func ResourceGKEHubMembershipUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - - // Version 0 didn't support location. Default it to global. - rawState["location"] = "global" - - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} diff --git a/mmv1/templates/terraform/state_migrations/go/kms_crypto_key.go.tmpl b/mmv1/templates/terraform/state_migrations/go/kms_crypto_key.go.tmpl deleted file mode 100644 index 9d344cb1f5b9..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/kms_crypto_key.go.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -func resourceKMSCryptoKeyResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "key_ring": { - Type: schema.TypeString, - Required: true, - }, - "rotation_period": { - Type: schema.TypeString, - Optional: true, - }, - "version_template": { - Type: schema.TypeList, - Optional: true, - }, - "self_link": { - Type: schema.TypeString, - }, - }, - } -} - -func ResourceKMSCryptoKeyUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - - config := meta.(*transport_tpg.Config) - keyRingId := rawState["key_ring"].(string) - parsed, err := parseKmsKeyRingId(keyRingId, config) - if err != nil { - return nil, err - } - rawState["key_ring"] = parsed.KeyRingId() - - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} diff --git a/mmv1/templates/terraform/state_migrations/go/ml_engine_model.go.tmpl b/mmv1/templates/terraform/state_migrations/go/ml_engine_model.go.tmpl deleted file mode 100644 index 4d353f6913d0..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/ml_engine_model.go.tmpl +++ /dev/null @@ -1,95 +0,0 @@ -func resourceMLEngineModelResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name specified for the model.`, - }, - "default_version": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `The default version of the model. This version will be used to handle -prediction requests that do not specify a version.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name specified for the version when it was created.`, - }, - }, - }, - }, - "description": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The description specified for the model when it was created.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Description: `One or more labels that you can add, to organize your models. - -**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}, - }, - "online_prediction_console_logging": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `If true, online prediction nodes send stderr and stdout streams to Stackdriver Logging`, - }, - "online_prediction_logging": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `If true, online prediction access logs are sent to StackDriver Logging.`, - }, - "regions": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `The list of regions where the model is going to be deployed. -Currently only one region per model is supported`, - MaxItems: 1, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "effective_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: 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}, - }, - "terraform_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: true, - Description: `The combination of labels configured directly on the resource - and default labels configured on the provider.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceMLEngineModelUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - return tpgresource.TerraformLabelsStateUpgrade(rawState) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/monitoring_monitored_project.go.tmpl b/mmv1/templates/terraform/state_migrations/go/monitoring_monitored_project.go.tmpl deleted file mode 100644 index 9dc51b7fd2f7..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/monitoring_monitored_project.go.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -func resourceMonitoringMonitoredProjectResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "metrics_scope": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareResourceNames, - Description: `Required. The resource name of the existing Metrics Scope that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareResourceNames, - Description: `Immutable. The resource name of the 'MonitoredProject'. On input, the resource name includes the scoping project ID and monitored project ID. On output, it contains the equivalent project numbers. Example: 'locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}'`, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - Description: `Output only. The time when this 'MonitoredProject' was created.`, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceMonitoringMonitoredProjectUpgradeV0(_ context.Context, rawState map[string]any, meta any) (map[string]any, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - - rawState["id"] = strings.TrimPrefix(rawState["id"].(string), "v1/") - - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} diff --git a/mmv1/templates/terraform/state_migrations/go/network_services_service_binding.go.tmpl b/mmv1/templates/terraform/state_migrations/go/network_services_service_binding.go.tmpl deleted file mode 100644 index f9368b715908..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/network_services_service_binding.go.tmpl +++ /dev/null @@ -1,71 +0,0 @@ -func resourceNetworkServicesServiceBindingResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Name of the ServiceBinding resource.`, - }, - "service": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The full Service Directory Service name of the format -projects/*/locations/*/namespaces/*/services/*`, - }, - "description": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `A free-text description of the resource. Max length 1024 characters.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Description: `Set of label tags associated with the ServiceBinding 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 ServiceBinding was created in UTC.`, - }, - "effective_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: 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}, - }, - "terraform_labels": { - Type: schema.TypeMap, - Computed: true, - ForceNew: 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 ServiceBinding was updated in UTC.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceNetworkServicesServiceBindingUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - return tpgresource.TerraformLabelsStateUpgrade(rawState) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/notebooks_instance.go.tmpl b/mmv1/templates/terraform/state_migrations/go/notebooks_instance.go.tmpl deleted file mode 100644 index 069dacdd5216..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/notebooks_instance.go.tmpl +++ /dev/null @@ -1,407 +0,0 @@ -const notebooksInstanceGoogleProvidedLabel = "goog-caip-notebook" - -func NotebooksInstanceLabelDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - // Suppress diffs for the label provided by Google - if strings.Contains(k, notebooksInstanceGoogleProvidedLabel) && new == "" { - return true - } - - // Let diff be determined by labels (above) - if strings.Contains(k, "labels.%") { - return true - } - - // For other keys, don't suppress diff. - return false -} - -func resourceNotebooksInstanceResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "location": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - Description: `A reference to the zone where the machine resides.`, - }, - "machine_type": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - Description: `A reference to a machine type which defines VM kind.`, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name specified for the Notebook instance.`, - }, - "accelerator_config": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `The hardware accelerator used on this instance. If you use accelerators, -make sure that your configuration has enough vCPUs and memory to support the -machineType you have selected.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "core_count": { - Type: schema.TypeInt, - Required: true, - ForceNew: true, - Description: `Count of cores of this accelerator.`, - }, - "type": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"ACCELERATOR_TYPE_UNSPECIFIED", "NVIDIA_TESLA_K80", "NVIDIA_TESLA_P100", "NVIDIA_TESLA_V100", "NVIDIA_TESLA_P4", "NVIDIA_TESLA_T4", "NVIDIA_TESLA_T4_VWS", "NVIDIA_TESLA_P100_VWS", "NVIDIA_TESLA_P4_VWS", "NVIDIA_TESLA_A100", "TPU_V2", "TPU_V3"}), - Description: `Type of this accelerator. Possible values: ["ACCELERATOR_TYPE_UNSPECIFIED", "NVIDIA_TESLA_K80", "NVIDIA_TESLA_P100", "NVIDIA_TESLA_V100", "NVIDIA_TESLA_P4", "NVIDIA_TESLA_T4", "NVIDIA_TESLA_T4_VWS", "NVIDIA_TESLA_P100_VWS", "NVIDIA_TESLA_P4_VWS", "NVIDIA_TESLA_A100", "TPU_V2", "TPU_V3"]`, - }, - }, - }, - }, - "boot_disk_size_gb": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: `The size of the boot disk in GB attached to this instance, -up to a maximum of 64000 GB (64 TB). The minimum recommended value is 100 GB. -If not specified, this defaults to 100.`, - }, - "boot_disk_type": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME", ""}), - Description: `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME"]`, - }, - "container_image": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Use a container image to start the notebook instance.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The path to the container image repository. -For example: gcr.io/{project_id}/{imageName}`, - }, - "tag": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The tag of the container image. If not specified, this defaults to the latest tag.`, - }, - }, - }, - ExactlyOneOf: []string{"vm_image", "container_image"}, - }, - "custom_gpu_driver_path": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Specify a custom Cloud Storage path where the GPU driver is stored. -If not specified, we'll automatically choose from official GPU drivers.`, - }, - "data_disk_size_gb": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: `The size of the data disk in GB attached to this instance, -up to a maximum of 64000 GB (64 TB). -You can choose the size of the data disk based on how big your notebooks and data are. -If not specified, this defaults to 100.`, - }, - "data_disk_type": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME", ""}), - Description: `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME"]`, - }, - "disk_encryption": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"DISK_ENCRYPTION_UNSPECIFIED", "GMEK", "CMEK", ""}), - DiffSuppressFunc: tpgresource.EmptyOrDefaultStringSuppress("DISK_ENCRYPTION_UNSPECIFIED"), - Description: `Disk encryption method used on the boot and data disks, defaults to GMEK. Possible values: ["DISK_ENCRYPTION_UNSPECIFIED", "GMEK", "CMEK"]`, - }, - "install_gpu_driver": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Whether the end user authorizes Google Cloud to install GPU driver -on this instance. If this field is empty or set to false, the GPU driver -won't be installed. Only applicable to instances with GPUs.`, - }, - "instance_owners": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `The list of owners of this instance after creation. -Format: alias@example.com. -Currently supports one owner only. -If not specified, all of the service account users of -your VM instance's service account can use the instance.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "kms_key": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The KMS key used to encrypt the disks, only applicable if diskEncryption is CMEK. -Format: projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}`, - }, - "labels": { - Type: schema.TypeMap, - Computed: true, - Optional: true, - DiffSuppressFunc: NotebooksInstanceLabelDiffSuppress, - Description: `Labels to apply to this instance. These can be later modified by the setLabels method. -An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "metadata": { - Type: schema.TypeMap, - Optional: true, - Description: `Custom metadata to apply to this instance. -An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "network": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - Description: `The name of the VPC that this instance is in. -Format: projects/{project_id}/global/networks/{network_id}`, - }, - "nic_type": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"UNSPECIFIED_NIC_TYPE", "VIRTIO_NET", "GVNIC", ""}), - Description: `The type of vNIC driver. Possible values: ["UNSPECIFIED_NIC_TYPE", "VIRTIO_NET", "GVNIC"]`, - }, - "no_proxy_access": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `The notebook instance will not register with the proxy..`, - }, - "no_public_ip": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `No public IP will be assigned to this instance.`, - }, - "no_remove_data_disk": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `If true, the data disk will not be auto deleted when deleting the instance.`, - }, - "post_startup_script": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Path to a Bash script that automatically runs after a -notebook instance fully boots up. The path must be a URL -or Cloud Storage path (gs://path-to-file/file-name).`, - }, - "reservation_affinity": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Reservation Affinity for consuming Zonal reservation.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "consume_reservation_type": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"NO_RESERVATION", "ANY_RESERVATION", "SPECIFIC_RESERVATION"}), - Description: `The type of Compute Reservation. Possible values: ["NO_RESERVATION", "ANY_RESERVATION", "SPECIFIC_RESERVATION"]`, - }, - "key": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Corresponds to the label key of reservation resource.`, - }, - "values": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Corresponds to the label values of reservation resource.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - }, - }, - }, - "service_account": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `The service account on this instance, giving access to other -Google Cloud services. You can use any service account within -the same project, but you must have the service account user -permission to use the instance. If not specified, -the Compute Engine default service account is used.`, - }, - "service_account_scopes": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Optional. The URIs of service account scopes to be included in Compute Engine instances. -If not specified, the following scopes are defined: -- https://www.googleapis.com/auth/cloud-platform -- https://www.googleapis.com/auth/userinfo.email`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "shielded_instance_config": { - Type: schema.TypeList, - Computed: true, - Optional: true, - ForceNew: true, - Description: `A set of Shielded Instance options. Check [Images using supported Shielded VM features] -Not all combinations are valid`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "enable_integrity_monitoring": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Defines whether the instance has integrity monitoring enabled. Enables monitoring and attestation of the -boot integrity of the instance. The attestation is performed against the integrity policy baseline. -This baseline is initially derived from the implicitly trusted boot image when the instance is created. -Enabled by default.`, - Default: true, - }, - "enable_secure_boot": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Defines whether the instance has Secure Boot enabled. Secure Boot helps ensure that the system only runs -authentic software by verifying the digital signature of all boot components, and halting the boot process -if signature verification fails. -Disabled by default.`, - }, - "enable_vtpm": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: `Defines whether the instance has the vTPM enabled. -Enabled by default.`, - Default: true, - }, - }, - }, - }, - "subnet": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - Description: `The name of the subnet that this instance is in. -Format: projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}`, - }, - "tags": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `The Compute Engine tags to add to instance.`, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "vm_image": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `Use a Compute Engine VM image to start the notebook instance.`, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "project": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name of the Google Cloud project that this VM image belongs to. -Format: projects/{project_id}`, - }, - "image_family": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Use this VM image family to find the image; the newest image in this family will be used.`, - }, - "image_name": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Use VM image name to find the image.`, - }, - }, - }, - ExactlyOneOf: []string{"vm_image", "container_image"}, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `Instance creation time`, - }, - "proxy_uri": { - Type: schema.TypeString, - Computed: true, - Description: `The proxy endpoint that is used to access the Jupyter notebook. -Only returned when the resource is in a 'PROVISIONED' state. If -needed you can utilize 'terraform apply -refresh-only' to await -the population of this value.`, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `The state of this instance.`, - }, - "update_time": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `Instance update time.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func ResourceNotebooksInstanceUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - return tpgresource.LabelsStateUpgrade(rawState, notebooksInstanceGoogleProvidedLabel) -} \ No newline at end of file diff --git a/mmv1/templates/terraform/state_migrations/go/workflows_workflow.go.tmpl b/mmv1/templates/terraform/state_migrations/go/workflows_workflow.go.tmpl deleted file mode 100644 index 89e14b615b3e..000000000000 --- a/mmv1/templates/terraform/state_migrations/go/workflows_workflow.go.tmpl +++ /dev/null @@ -1,90 +0,0 @@ -func resourceWorkflowsWorkflowResourceV0() *schema.Resource { - return &schema.Resource{ - Schema: map[string]*schema.Schema{ - "description": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: `Description of the workflow provided by the user. Must be at most 1000 unicode characters long.`, - }, - "labels": { - Type: schema.TypeMap, - Optional: true, - Description: `A set of key/value label pairs to assign to this Workflow.`, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - Description: `Name of the Workflow.`, - }, - "region": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `The region of the workflow.`, - }, - "service_account": { - Type: schema.TypeString, - Computed: true, - Optional: true, - ForceNew: true, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, - Description: `Name of the service account associated with the latest workflow version. This service -account represents the identity of the workflow and determines what permissions the workflow has. - -Format: projects/{project}/serviceAccounts/{account}.`, - }, - "source_contents": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: `Workflow code to be executed. The size limit is 32KB.`, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - Description: `The timestamp of when the workflow was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.`, - }, - "revision_id": { - Type: schema.TypeString, - Computed: true, - Description: `The revision of the workflow. A new one is generated if the service account or source contents is changed.`, - }, - "state": { - Type: schema.TypeString, - Computed: true, - Description: `State of the workflow deployment.`, - }, - "update_time": { - Type: schema.TypeString, - Computed: true, - Description: `The timestamp of when the workflow was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.`, - }, - "name_prefix": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ConflictsWith: []string{"name"}, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - } -} - -func ResourceWorkflowsWorkflowUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - log.Printf("[DEBUG] Attributes before migration: %#v", rawState) - - rawState["name"] = tpgresource.GetResourceNameFromSelfLink(rawState["name"].(string)) - - log.Printf("[DEBUG] Attributes after migration: %#v", rawState) - return rawState, nil -} diff --git a/mmv1/templates/terraform/update_encoder/active_directory_domain_trust.go.tmpl b/mmv1/templates/terraform/update_encoder/active_directory_domain_trust.go.tmpl index 02629593db47..73e789b487a3 100644 --- a/mmv1/templates/terraform/update_encoder/active_directory_domain_trust.go.tmpl +++ b/mmv1/templates/terraform/update_encoder/active_directory_domain_trust.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} wrappedReq := map[string]interface{}{ "targetDomainName": obj["targetDomainName"], "targetDnsIpAddresses": obj["targetDnsIpAddresses"], diff --git a/mmv1/templates/terraform/update_encoder/compute_per_instance_config.go.tmpl b/mmv1/templates/terraform/update_encoder/compute_per_instance_config.go.tmpl index 12c2c63915ee..a74f9acd93d0 100644 --- a/mmv1/templates/terraform/update_encoder/compute_per_instance_config.go.tmpl +++ b/mmv1/templates/terraform/update_encoder/compute_per_instance_config.go.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // updates and creates use different wrapping object names wrappedReq := map[string]interface{}{ "perInstanceConfigs": []interface{}{obj}, diff --git a/mmv1/templates/terraform/update_encoder/compute_service_attachment.go.tmpl b/mmv1/templates/terraform/update_encoder/compute_service_attachment.go.tmpl index cc3abdc946a6..aca47912a356 100644 --- a/mmv1/templates/terraform/update_encoder/compute_service_attachment.go.tmpl +++ b/mmv1/templates/terraform/update_encoder/compute_service_attachment.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // need to send value in PATCH due to validation bug on api b/198329756 nameProp := d.Get("name") if v, ok := d.GetOkExists("name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) { diff --git a/mmv1/templates/terraform/update_encoder/containeranalysis_occurrence.go.tmpl b/mmv1/templates/terraform/update_encoder/containeranalysis_occurrence.go.tmpl index 86c6021054f7..819a3fd5a775 100644 --- a/mmv1/templates/terraform/update_encoder/containeranalysis_occurrence.go.tmpl +++ b/mmv1/templates/terraform/update_encoder/containeranalysis_occurrence.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} // Note is required, even for PATCH noteNameProp, err := expandContainerAnalysisOccurrenceNoteName(d.Get("note_name"), d, meta.(*transport_tpg.Config)) if err != nil { @@ -20,4 +18,4 @@ if err != nil { obj["noteName"] = noteNameProp } -return resource<%= object.resource_name -%>Encoder(d, meta, obj) +return resource{{$.ResourceName}}Encoder(d, meta, obj) diff --git a/mmv1/templates/terraform/update_encoder/dlp_stored_info_type.go.tmpl b/mmv1/templates/terraform/update_encoder/dlp_stored_info_type.go.tmpl index 0e83e629b1b9..77e8bad7c5bf 100644 --- a/mmv1/templates/terraform/update_encoder/dlp_stored_info_type.go.tmpl +++ b/mmv1/templates/terraform/update_encoder/dlp_stored_info_type.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) newObj["config"] = obj return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/active_directory_domain_trust.go.tmpl b/mmv1/templates/terraform/update_encoder/go/active_directory_domain_trust.go.tmpl deleted file mode 100644 index 73e789b487a3..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/active_directory_domain_trust.go.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} -wrappedReq := map[string]interface{}{ - "targetDomainName": obj["targetDomainName"], - "targetDnsIpAddresses": obj["targetDnsIpAddresses"], -} -return wrappedReq, nil diff --git a/mmv1/templates/terraform/update_encoder/go/cloud_scheduler.go.tmpl b/mmv1/templates/terraform/update_encoder/go/cloud_scheduler.go.tmpl deleted file mode 100644 index 8a9b4e7e9da9..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/cloud_scheduler.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -delete(obj, "paused") // Field doesn't exist in API -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/update_encoder/go/compute_network.go.tmpl b/mmv1/templates/terraform/update_encoder/go/compute_network.go.tmpl deleted file mode 100644 index 084107f2772e..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/compute_network.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -delete(obj, "numeric_id") // Field doesn't exist in the API -return obj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/compute_per_instance_config.go.tmpl b/mmv1/templates/terraform/update_encoder/go/compute_per_instance_config.go.tmpl deleted file mode 100644 index a74f9acd93d0..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/compute_per_instance_config.go.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} -// updates and creates use different wrapping object names -wrappedReq := map[string]interface{}{ - "perInstanceConfigs": []interface{}{obj}, -} -return wrappedReq, nil diff --git a/mmv1/templates/terraform/update_encoder/go/compute_service_attachment.go.tmpl b/mmv1/templates/terraform/update_encoder/go/compute_service_attachment.go.tmpl deleted file mode 100644 index aca47912a356..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/compute_service_attachment.go.tmpl +++ /dev/null @@ -1,26 +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. -*/ -}} -// need to send value in PATCH due to validation bug on api b/198329756 -nameProp := d.Get("name") -if v, ok := d.GetOkExists("name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) { - obj["name"] = nameProp -} - - -// need to send value in PATCH due to validation bug on api b/198308475 -enableProxyProtocolProp := d.Get("enable_proxy_protocol") -if v, ok := d.GetOkExists("enable_proxy_protocol"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, enableProxyProtocolProp)) { - obj["enableProxyProtocol"] = enableProxyProtocolProp -} - -return obj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/containeranalysis_occurrence.go.tmpl b/mmv1/templates/terraform/update_encoder/go/containeranalysis_occurrence.go.tmpl deleted file mode 100644 index 819a3fd5a775..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/containeranalysis_occurrence.go.tmpl +++ /dev/null @@ -1,21 +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. -*/ -}} -// Note is required, even for PATCH -noteNameProp, err := expandContainerAnalysisOccurrenceNoteName(d.Get("note_name"), d, meta.(*transport_tpg.Config)) -if err != nil { - return nil, err -} else if v, ok := d.GetOkExists("note_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(noteNameProp)) && (ok || !reflect.DeepEqual(v, noteNameProp)) { - obj["noteName"] = noteNameProp -} - -return resource{{$.ResourceName}}Encoder(d, meta, obj) diff --git a/mmv1/templates/terraform/update_encoder/go/dlp_stored_info_type.go.tmpl b/mmv1/templates/terraform/update_encoder/go/dlp_stored_info_type.go.tmpl deleted file mode 100644 index 77e8bad7c5bf..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/dlp_stored_info_type.go.tmpl +++ /dev/null @@ -1,15 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["config"] = obj - return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/hyper_disk.go.tmpl b/mmv1/templates/terraform/update_encoder/go/hyper_disk.go.tmpl deleted file mode 100644 index b25b8afbbf7c..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/hyper_disk.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ - -if (d.HasChange("provisioned_iops") && strings.Contains(d.Get("type").(string), "hyperdisk")) || (d.HasChange("provisioned_throughput") && strings.Contains(d.Get("type").(string), "hyperdisk")) || (d.HasChange("access_mode") && strings.Contains(d.Get("type").(string), "hyperdisk")) { - nameProp := d.Get("name") - if v, ok := d.GetOkExists("name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) { - obj["name"] = nameProp - } -} -return obj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/kms_crypto_key.go.tmpl b/mmv1/templates/terraform/update_encoder/go/kms_crypto_key.go.tmpl deleted file mode 100644 index 434e56534504..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/kms_crypto_key.go.tmpl +++ /dev/null @@ -1,25 +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. -*/ -}} - // if rotationPeriod is changed, nextRotationTime must also be set. - if d.HasChange("rotation_period") && d.Get("rotation_period") != "" { - rotationPeriod := d.Get("rotation_period").(string) - nextRotation, err := kmsCryptoKeyNextRotation(time.Now(), rotationPeriod) - - if err != nil { - return nil, fmt.Errorf("Error setting CryptoKey rotation period: %s", err.Error()) - } - - obj["nextRotationTime"] = nextRotation - } - - return obj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/managed_dns_zone.go.tmpl b/mmv1/templates/terraform/update_encoder/go/managed_dns_zone.go.tmpl deleted file mode 100644 index 5a10048b0811..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/managed_dns_zone.go.tmpl +++ /dev/null @@ -1,11 +0,0 @@ - // The upstream update method (https://cloud.google.com/dns/docs/reference/v1/managedZones/update) - // requires the full ManagedZones object, therefore, we need to keep some input only values in the struct - // and then reuse it in the update - nameServers, ok := d.GetOkExists("name_servers") - if !ok { - nameServers = []string{} - } - obj["nameServers"] = nameServers - obj["id"] = d.Get("managed_zone_id") - obj["creationTime"] = d.Get("creation_time") - return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/update_encoder/go/notebooks_instance.go.tmpl b/mmv1/templates/terraform/update_encoder/go/notebooks_instance.go.tmpl deleted file mode 100644 index 4171986de2fb..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/notebooks_instance.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -// Update requests use "items" as the api name instead of "metadata" -// https://cloud.google.com/vertex-ai/docs/workbench/reference/rest/v1/projects.locations.instances/updateMetadataItems -if metadata, ok := obj["metadata"]; ok { - obj["items"] = metadata - delete(obj, "metadata") -} -return obj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/org_policy_custom_constraint.go.tmpl b/mmv1/templates/terraform/update_encoder/go/org_policy_custom_constraint.go.tmpl deleted file mode 100644 index fa265685fea9..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/org_policy_custom_constraint.go.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -// need to send resource_types in all PATCH requests -resourceTypesProp := d.Get("resource_types") -if v, ok := d.GetOkExists("resource_types"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, resourceTypesProp)) { - obj["resourceTypes"] = resourceTypesProp -} - -return obj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/private_cloud.go.tmpl b/mmv1/templates/terraform/update_encoder/go/private_cloud.go.tmpl deleted file mode 100644 index 10f85bd78b90..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/private_cloud.go.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -delete(obj, "managementCluster") -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/update_encoder/go/pubsub_schema.tmpl b/mmv1/templates/terraform/update_encoder/go/pubsub_schema.tmpl deleted file mode 100644 index e6340c6d724a..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/pubsub_schema.tmpl +++ /dev/null @@ -1,17 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["name"] = d.Id() - obj["name"] = d.Id() - newObj["schema"] = obj - return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/pubsub_subscription.tmpl b/mmv1/templates/terraform/update_encoder/go/pubsub_subscription.tmpl deleted file mode 100644 index d03dcf048f73..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/pubsub_subscription.tmpl +++ /dev/null @@ -1,15 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["subscription"] = obj -return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/pubsub_topic.tmpl b/mmv1/templates/terraform/update_encoder/go/pubsub_topic.tmpl deleted file mode 100644 index 629cd8eb0753..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/pubsub_topic.tmpl +++ /dev/null @@ -1,15 +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. -*/ -}} - newObj := make(map[string]interface{}) - newObj["topic"] = obj -return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/reservation.go.tmpl b/mmv1/templates/terraform/update_encoder/go/reservation.go.tmpl deleted file mode 100644 index 0aa16a8869a7..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/reservation.go.tmpl +++ /dev/null @@ -1,126 +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. -*/ -}} - newObj := make(map[string]interface{}) - config := meta.(*transport_tpg.Config) - maskId := "" - firstProject := true - urlUpdateMask := "" - - if d.HasChange("share_settings") { - // Get name. - nameProp, err := expandComputeReservationName(d.Get("name"), d, config) - if err != nil { - return nil, fmt.Errorf("Invalid value for name: %s", err) - } else if v, ok := d.GetOkExists("name"); !tpgresource.IsEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) { - newObj["name"] = nameProp - } - // Get zone. - zoneProp, err := expandComputeReservationZone(d.Get("zone"), d, config) - if err != nil { - return nil, fmt.Errorf("Invalid value for zone: %s", err) - } else if v, ok := d.GetOkExists("zone"); !tpgresource.IsEmptyValue(reflect.ValueOf(zoneProp)) && (ok || !reflect.DeepEqual(v, zoneProp)) { - newObj["zone"] = zoneProp - } - transformed := make(map[string]interface{}) - // Set shareType. - transformed["shareType"] = "SPECIFIC_PROJECTS" - // Set project_map. - projectMap := make(map[string]interface{}) - old, new := d.GetChange("share_settings") - - var before *schema.Set - if oldSlice, ok := old.([]interface{}); ok && len(oldSlice) > 0 { - if oldMap, ok := oldSlice[0].(map[string]interface{})["project_map"]; ok { - before = oldMap.(*schema.Set) - } else { - before = schema.NewSet(schema.HashString, []interface{}{}) - } - } else { - before = schema.NewSet(schema.HashString, []interface{}{}) - } - var after *schema.Set - if newSlice, ok := new.([]interface{}); ok && len(newSlice) > 0 { - if newMap, ok := newSlice[0].(map[string]interface{})["project_map"]; ok { - after = newMap.(*schema.Set) - } else { - after = schema.NewSet(schema.HashString, []interface{}{}) - } - } else { - after = schema.NewSet(schema.HashString, []interface{}{}) - } - - for _, raw := range after.Difference(before).List() { - original := raw.(map[string]interface{}) - singleProject := make(map[string]interface{}) - // set up project_map. - transformedProjectId := original["project_id"] - if val := reflect.ValueOf(transformedProjectId); val.IsValid() && !tpgresource.IsEmptyValue(val) { - singleProject["projectId"] = transformedProjectId - } - transformedId, err := tpgresource.ExpandString(original["id"], d, config) - if err != nil { - return nil, fmt.Errorf("Invalid value for id: %s", err) - } - projectMap[transformedId] = singleProject - // add added projects to updateMask - if !firstProject { - maskId = fmt.Sprintf("%s%s", "&paths=shareSettings.projectMap.", original["id"]) - } else { - maskId = fmt.Sprintf("%s%s", "?paths=shareSettings.projectMap.", original["id"]) - firstProject = false - } - decodedPath, _ := url.QueryUnescape(maskId) - urlUpdateMask = urlUpdateMask + decodedPath - } - transformed["projectMap"] = projectMap - newObj["shareSettings"] = transformed - - // add removed projects to updateMask - firstProject = true - for _, raw := range before.Difference(after).List() { - original := raw.(map[string]interface{}) - // To remove a project we need project number. - projectId := fmt.Sprintf("%s", original["project_id"]) - projectIdOrNum := projectId - _, err := strconv.Atoi(projectId) - // convert id to number. - if err != nil { - config := meta.(*transport_tpg.Config) - project, err := config.NewResourceManagerClient(config.UserAgent).Projects.Get(projectId).Do() - if err != nil { - return nil, fmt.Errorf("Invalid value for projectId: %s", err) - } - projectNum := project.ProjectNumber - projectIdOrNum = fmt.Sprintf("%d", projectNum) - } - if !firstProject { - maskId = fmt.Sprintf("%s%s", "&paths=shareSettings.projectMap.", projectIdOrNum) - } else { - maskId = fmt.Sprintf("%s%s", "?paths=shareSettings.projectMap.", projectIdOrNum) - firstProject = false - } - decodedPath, _ := url.QueryUnescape(maskId) - urlUpdateMask = urlUpdateMask + decodedPath - } - newObj["urlUpdateMask"] = urlUpdateMask - } - - // Resize. - if obj["specificReservation"] != nil { - count := obj["specificReservation"].(map[string]interface{})["count"] - if count != nil { - newObj["specificSkuCount"] = obj["specificReservation"].(map[string]interface{})["count"] - } - } - - return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/resource_compute_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/update_encoder/go/resource_compute_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index 1e3c847c6c09..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/resource_compute_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -config := meta.(*transport_tpg.Config) - -predefinedRulesProp, err := expandComputeFirewallPolicyWithRulesRule(d.Get("predefined_rules"), d, config) -if err != nil { - return nil, err -} - -rules := obj["rules"].([]interface{}) -obj["rules"] = append(rules, predefinedRulesProp) - -return obj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/resource_compute_network_firewall_policy_with_rules.go.tmpl b/mmv1/templates/terraform/update_encoder/go/resource_compute_network_firewall_policy_with_rules.go.tmpl deleted file mode 100644 index a503293a6f87..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/resource_compute_network_firewall_policy_with_rules.go.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -config := meta.(*transport_tpg.Config) - -predefinedRulesProp, err := expandComputeNetworkFirewallPolicyWithRulesRule(d.Get("predefined_rules"), d, config) -if err != nil { - return nil, err -} - -rules := obj["rules"].([]interface{}) -obj["rules"] = append(rules, predefinedRulesProp) - -return obj, nil - - - - diff --git a/mmv1/templates/terraform/update_encoder/go/source_repo_repository.tmpl b/mmv1/templates/terraform/update_encoder/go/source_repo_repository.tmpl deleted file mode 100644 index ba3310dad1e9..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/source_repo_repository.tmpl +++ /dev/null @@ -1,26 +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. -*/ -}} - // Add "topic" field using pubsubConfig map key - pubsubConfigsVal := obj["pubsubConfigs"] - if pubsubConfigsVal != nil { - pubsubConfigs := pubsubConfigsVal.(map[string]interface{}) - for key := range pubsubConfigs { - config := pubsubConfigs[key].(map[string]interface{}) - config["topic"] = key - } - } - - // Nest request body in "repo" field - newObj := make(map[string]interface{}) - newObj["repo"] = obj - return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/spanner_database.go.tmpl b/mmv1/templates/terraform/update_encoder/go/spanner_database.go.tmpl deleted file mode 100644 index 85d3d94dc062..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/spanner_database.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. -*/ -}} - -if obj["versionRetentionPeriod"] != nil || obj["extraStatements"] != nil { - old, new := d.GetChange("ddl") - oldDdls := old.([]interface{}) - newDdls := new.([]interface{}) - updateDdls := []string{} - - //Only new ddl statments to be add to update call - for i := len(oldDdls); i < len(newDdls); i++ { - if newDdls[i] != nil { - updateDdls = append(updateDdls, newDdls[i].(string)) - } - } - - //Add statement to update version_retention_period property, if needed - if d.HasChange("version_retention_period") { - dbName := d.Get("name") - retentionDdl := fmt.Sprintf("ALTER DATABASE `%s` SET OPTIONS (version_retention_period=\"%s\")", dbName, obj["versionRetentionPeriod"]) - if dialect, ok := d.GetOk("database_dialect"); ok && dialect == "POSTGRESQL" { - retentionDdl = fmt.Sprintf("ALTER DATABASE \"%s\" SET spanner.version_retention_period TO \"%s\"", dbName, obj["versionRetentionPeriod"]) - } - updateDdls = append(updateDdls, retentionDdl) - } - - obj["statements"] = updateDdls - delete(obj, "name") - delete(obj, "versionRetentionPeriod") - delete(obj, "instance") - delete(obj, "extraStatements") -} -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/update_encoder/go/spanner_instance_config_update.go.tmpl b/mmv1/templates/terraform/update_encoder/go/spanner_instance_config_update.go.tmpl deleted file mode 100644 index 6805f5d6b35d..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/spanner_instance_config_update.go.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -project, err := tpgresource.GetProject(d, meta.(*transport_tpg.Config)) -if err != nil { -return nil, err -} -obj["name"] = fmt.Sprintf("projects/%s/instanceConfigs/%s", project, obj["name"]) -newObj := make(map[string]interface{}) -newObj["instanceConfig"] = obj -return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/ssl_policy.tmpl b/mmv1/templates/terraform/update_encoder/go/ssl_policy.tmpl deleted file mode 100644 index 3dd77710418a..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/ssl_policy.tmpl +++ /dev/null @@ -1,22 +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. -*/ -}} -// TODO(https://github.com/GoogleCloudPlatform/magic-modules/issues/184): Handle fingerprint consistently -obj["fingerprint"] = d.Get("fingerprint") - -// TODO(https://github.com/GoogleCloudPlatform/magic-modules/issues/183): Can we generalize this -// Send a null fields if customFeatures is empty. -if v, ok := obj["customFeatures"]; ok && len(v.([]interface{})) == 0 { - obj["customFeatures"] = nil -} - -return obj, nil diff --git a/mmv1/templates/terraform/update_encoder/go/vertex_ai_index_endpoint_deployed_index.go.tmpl b/mmv1/templates/terraform/update_encoder/go/vertex_ai_index_endpoint_deployed_index.go.tmpl deleted file mode 100644 index ef56b550bd2c..000000000000 --- a/mmv1/templates/terraform/update_encoder/go/vertex_ai_index_endpoint_deployed_index.go.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -obj["id"] = obj["deployedIndexId"] -delete(obj, "deployedIndexId") -return obj, nil \ No newline at end of file diff --git a/mmv1/templates/terraform/update_encoder/kms_crypto_key.go.tmpl b/mmv1/templates/terraform/update_encoder/kms_crypto_key.go.tmpl index 387772d099bf..434e56534504 100644 --- a/mmv1/templates/terraform/update_encoder/kms_crypto_key.go.tmpl +++ b/mmv1/templates/terraform/update_encoder/kms_crypto_key.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} // if rotationPeriod is changed, nextRotationTime must also be set. if d.HasChange("rotation_period") && d.Get("rotation_period") != "" { rotationPeriod := d.Get("rotation_period").(string) diff --git a/mmv1/templates/terraform/update_encoder/pubsub_schema.tmpl b/mmv1/templates/terraform/update_encoder/pubsub_schema.tmpl index 2e1efb5be55c..e6340c6d724a 100644 --- a/mmv1/templates/terraform/update_encoder/pubsub_schema.tmpl +++ b/mmv1/templates/terraform/update_encoder/pubsub_schema.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2023 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) newObj["name"] = d.Id() obj["name"] = d.Id() diff --git a/mmv1/templates/terraform/update_encoder/pubsub_subscription.tmpl b/mmv1/templates/terraform/update_encoder/pubsub_subscription.tmpl index d3349ea420b4..d03dcf048f73 100644 --- a/mmv1/templates/terraform/update_encoder/pubsub_subscription.tmpl +++ b/mmv1/templates/terraform/update_encoder/pubsub_subscription.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # 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 - # - # 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) newObj["subscription"] = obj return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/pubsub_topic.tmpl b/mmv1/templates/terraform/update_encoder/pubsub_topic.tmpl index 36a40a045d83..629cd8eb0753 100644 --- a/mmv1/templates/terraform/update_encoder/pubsub_topic.tmpl +++ b/mmv1/templates/terraform/update_encoder/pubsub_topic.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) newObj["topic"] = obj return newObj, nil diff --git a/mmv1/templates/terraform/update_encoder/reservation.go.tmpl b/mmv1/templates/terraform/update_encoder/reservation.go.tmpl index cebe23bc9435..0aa16a8869a7 100644 --- a/mmv1/templates/terraform/update_encoder/reservation.go.tmpl +++ b/mmv1/templates/terraform/update_encoder/reservation.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} newObj := make(map[string]interface{}) config := meta.(*transport_tpg.Config) maskId := "" diff --git a/mmv1/templates/terraform/update_encoder/source_repo_repository.tmpl b/mmv1/templates/terraform/update_encoder/source_repo_repository.tmpl index 903db5ead031..ba3310dad1e9 100644 --- a/mmv1/templates/terraform/update_encoder/source_repo_repository.tmpl +++ b/mmv1/templates/terraform/update_encoder/source_repo_repository.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2019 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. --%> +{{/* + 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. +*/ -}} // Add "topic" field using pubsubConfig map key pubsubConfigsVal := obj["pubsubConfigs"] if pubsubConfigsVal != nil { diff --git a/mmv1/templates/terraform/update_encoder/spanner_database.go.tmpl b/mmv1/templates/terraform/update_encoder/spanner_database.go.tmpl index d95e50b634df..85d3d94dc062 100644 --- a/mmv1/templates/terraform/update_encoder/spanner_database.go.tmpl +++ b/mmv1/templates/terraform/update_encoder/spanner_database.go.tmpl @@ -1,17 +1,15 @@ -<%# The license inside this block applies to this file. - # Copyright 2020 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. --%> +{{/* + 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. +*/ -}} if obj["versionRetentionPeriod"] != nil || obj["extraStatements"] != nil { old, new := d.GetChange("ddl") diff --git a/mmv1/templates/terraform/update_encoder/ssl_policy.tmpl b/mmv1/templates/terraform/update_encoder/ssl_policy.tmpl index 09755e332778..3dd77710418a 100644 --- a/mmv1/templates/terraform/update_encoder/ssl_policy.tmpl +++ b/mmv1/templates/terraform/update_encoder/ssl_policy.tmpl @@ -1,17 +1,15 @@ -<%# 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. --%> +{{/* + 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. +*/ -}} // TODO(https://github.com/GoogleCloudPlatform/magic-modules/issues/184): Handle fingerprint consistently obj["fingerprint"] = d.Get("fingerprint") diff --git a/mmv1/third_party/terraform/acctest/go/test_utils.go.tmpl b/mmv1/third_party/terraform/acctest/go/test_utils.go.tmpl deleted file mode 100644 index 69d453d068ef..000000000000 --- a/mmv1/third_party/terraform/acctest/go/test_utils.go.tmpl +++ /dev/null @@ -1,293 +0,0 @@ - -package acctest - -import ( - "archive/zip" - "bytes" - "context" - "errors" - "fmt" - "io/ioutil" - "math/rand" - "os" - "strings" - "testing" - - "github.com/hashicorp/terraform-plugin-framework/providerserver" - "github.com/hashicorp/terraform-plugin-go/tfprotov5" - "github.com/hashicorp/terraform-plugin-mux/tf5muxserver" - "github.com/hashicorp/terraform-plugin-testing/helper/acctest" - "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-provider-google/google/envvar" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "github.com/hashicorp/terraform-provider-google/google/verify" - googleoauth "golang.org/x/oauth2/google" -) - -func CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName string) func(*terraform.State) error { - return CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName, map[string]struct{}{}) -} - -func CheckDataSourceStateMatchesResourceStateWithIgnores(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 - - 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 strings.HasPrefix(k, "labels.") || strings.HasPrefix(k, "terraform_labels.") || strings.HasPrefix(k, "effective_labels.") { - continue - } - if k == "%" { - continue - } - if dsAttr[k] != rsAttr[k] { - // ignore data sources where an empty list is being compared against a null list. - if k[len(k)-1:] == "#" && (dsAttr[k] == "" || dsAttr[k] == "0") && (rsAttr[k] == "" || rsAttr[k] == "0") { - continue - } - errMsg += fmt.Sprintf("%s is %s; want %s\n", k, dsAttr[k], rsAttr[k]) - } - } - - if errMsg != "" { - return errors.New(errMsg) - } - - return nil - } -} - -// General test utils - -// MuxedProviders returns the correct test provider (between the sdk version or the framework version) -func MuxedProviders(testName string) (func() tfprotov5.ProviderServer, error) { - ctx := context.Background() - - providers := []func() tfprotov5.ProviderServer{ - providerserver.NewProtocol5(NewFrameworkTestProvider(testName)), // framework provider - GetSDKProvider(testName).GRPCProvider, // sdk provider - } - - muxServer, err := tf5muxserver.NewMuxServer(ctx, providers...) - - if err != nil { - return nil, err - } - - return muxServer.ProviderServer, nil -} - -func RandString(t *testing.T, length int) string { - if !IsVcrEnabled() { - return acctest.RandString(length) - } - 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) - } - - r := rand.New(s.source) - result := make([]byte, length) - set := "abcdefghijklmnopqrstuvwxyz012346789" - for i := 0; i < length; i++ { - result[i] = set[r.Intn(len(set))] - } - return string(result) -} - -func RandInt(t *testing.T) int { - if !IsVcrEnabled() { - return acctest.RandInt() - } - 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).Int() -} - -// 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) { - return map[string]func() (tfprotov5.ProviderServer, error){ - "google": func() (tfprotov5.ProviderServer, error) { - provider, err := MuxedProviders(t.Name()) - return provider(), err - }, - } -} - -// ProtoV5ProviderBetaFactories returns the same as ProtoV5ProviderFactories only the provider is mapped with -// "google-beta" to ensure that registry examples use `google-beta` if the example is versioned as beta; -// normal beta tests should continue to use ProtoV5ProviderFactories -func ProtoV5ProviderBetaFactories(t *testing.T) map[string]func() (tfprotov5.ProviderServer, error) { - return map[string]func() (tfprotov5.ProviderServer, error){ -{{/* Add a google-#{version} provider for each version that is supported by this version. This allows us to run google-beta tests within a google-alpha provider. */ -}} -{{ range $aliasedVersion := $.SupportedProviderVersions -}} - "google-{{ $aliasedVersion }}": func() (tfprotov5.ProviderServer, error) { - provider, err := MuxedProviders(t.Name()) - return provider(), err - }, -{{- end }} - } -} - -// This is a Printf sibling (Nprintf; Named Printf), which handles strings like -// Nprintf("Hello %{target}!", map[string]interface{}{"target":"world"}) == "Hello world!". -// This is particularly useful for generated tests, where we don't want to use Printf, -// since that would require us to generate a very particular ordering of arguments. -func Nprintf(format string, params map[string]interface{}) string { - for key, val := range params { - format = strings.Replace(format, "%{"+key+"}", fmt.Sprintf("%v", val), -1) - } - return format -} - -func TestBucketName(t *testing.T) string { - return fmt.Sprintf("%s-%d", "tf-test-bucket", RandInt(t)) -} - -func CreateZIPArchiveForCloudFunctionSource(t *testing.T, sourcePath string) string { - source, err := ioutil.ReadFile(sourcePath) - if err != nil { - t.Fatal(err.Error()) - } - // Create a buffer to write our archive to. - buf := new(bytes.Buffer) - - // Create a new zip archive. - w := zip.NewWriter(buf) - - f, err := w.Create("index.js") - if err != nil { - t.Fatal(err.Error()) - } - _, err = f.Write(source) - if err != nil { - t.Fatal(err.Error()) - } - - // Make sure to check the error on Close. - err = w.Close() - if err != nil { - t.Fatal(err.Error()) - } - // Create temp file to write zip to - tmpfile, err := ioutil.TempFile("", "sourceArchivePrefix") - if err != nil { - t.Fatal(err.Error()) - } - - if _, err := tmpfile.Write(buf.Bytes()); err != nil { - t.Fatal(err.Error()) - } - if err := tmpfile.Close(); err != nil { - t.Fatal(err.Error()) - } - return tmpfile.Name() -} - -func GetAccessTokenFromTestCredsFromEnv(t *testing.T) string { - credentials := envvar.GetTestCredsFromEnv() - - if credentials == "" { - t.Fatalf("no creds provided in test environment: one of %s must be set for acceptance tests", strings.Join(envvar.CredsEnvVars, ", ")) - } - - // Environment might return a path or a JSON - contents, _, err := verify.PathOrContents(credentials) - if err != nil { - t.Fatalf("error determining if creds in test environment are a path or contents: %s", err) - } - // Get googleoauth.Credentials - c, err := googleoauth.CredentialsFromJSON(context.Background(), []byte(contents), transport_tpg.DefaultClientScopes...) - if err != nil { - t.Fatalf("invalid test credentials: %s", err) - } - // Get value for access_token - token, err := c.TokenSource.Token() - if err != nil { - t.Fatalf("Unable to generate test access token: %s", err) - } - return token.AccessToken -} - -// providerConfigEnvNames returns a list of all the environment variables that could be set by a user to configure the provider -func providerConfigEnvNames() []string { - - envs := []string{} - - // Use existing collections of ENV names - envVarsSets := [][]string{ - envvar.CredsEnvVars, // credentials field - envvar.ProjectEnvVars, // project field - envvar.RegionEnvVars, // region field - envvar.ZoneEnvVars, // zone field - } - for _, set := range envVarsSets { - envs = append(envs, set...) - } - - // Add remaining ENVs - envs = append(envs, "GOOGLE_OAUTH_ACCESS_TOKEN") // access_token field - envs = append(envs, "GOOGLE_BILLING_PROJECT") // billing_project field - envs = append(envs, "GOOGLE_IMPERSONATE_SERVICE_ACCOUNT") // impersonate_service_account field - envs = append(envs, "USER_PROJECT_OVERRIDE") // user_project_override field - envs = append(envs, "CLOUDSDK_CORE_REQUEST_REASON") // request_reason field - - envs = append(envs, "GOOGLE_APPLICATION_CREDENTIALS") // ADC used to configure clients when provider lacks credentials and access_token - - return envs -} - -// UnsetProviderConfigEnvs unsets any ENVs in the test environment that -// configure the provider. -// The testing package will restore the original values after the test -func UnsetTestProviderConfigEnvs(t *testing.T) { - envs := providerConfigEnvNames() - if len(envs) > 0 { - for _, k := range envs { - t.Setenv(k, "") - } - } -} - -func SetupTestEnvs(t *testing.T, envValues map[string]string) { - // Set ENVs - if len(envValues) > 0 { - for k, v := range envValues { - t.Setenv(k, v) - } - } -} - -// Returns a fake credentials JSON string with the client_email set to a test-specific value -func GenerateFakeCredentialsJson(testId string) string { - json := fmt.Sprintf(`{"private_key_id": "foo","private_key": "bar","client_email": "%s@example.com","client_id": "id@foo.com","type": "service_account"}`, testId) - return json -} \ No newline at end of file diff --git a/mmv1/third_party/terraform/acctest/test_utils.go.tmpl b/mmv1/third_party/terraform/acctest/test_utils.go.tmpl index 850e39138815..69d453d068ef 100644 --- a/mmv1/third_party/terraform/acctest/test_utils.go.tmpl +++ b/mmv1/third_party/terraform/acctest/test_utils.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package acctest @@ -148,13 +147,13 @@ func ProtoV5ProviderFactories(t *testing.T) map[string]func() (tfprotov5.Provide // normal beta tests should continue to use ProtoV5ProviderFactories func ProtoV5ProviderBetaFactories(t *testing.T) map[string]func() (tfprotov5.ProviderServer, error) { return map[string]func() (tfprotov5.ProviderServer, error){ -<%# Add a google-#{version} provider for each version that is supported by this version. This allows us to run google-beta tests within a google-alpha provider. -%> -<% Api::Product::Version::ORDER[1..Api::Product::Version::ORDER.index(version)].each do |aliased_version| -%> - "google-<%= aliased_version -%>": func() (tfprotov5.ProviderServer, error) { +{{/* Add a google-#{version} provider for each version that is supported by this version. This allows us to run google-beta tests within a google-alpha provider. */ -}} +{{ range $aliasedVersion := $.SupportedProviderVersions -}} + "google-{{ $aliasedVersion }}": func() (tfprotov5.ProviderServer, error) { provider, err := MuxedProviders(t.Name()) return provider(), err }, -<% end -%> +{{- end }} } } diff --git a/mmv1/third_party/terraform/fwmodels/go/provider_model.go.tmpl b/mmv1/third_party/terraform/fwmodels/go/provider_model.go.tmpl deleted file mode 100644 index 252fccb53d54..000000000000 --- a/mmv1/third_party/terraform/fwmodels/go/provider_model.go.tmpl +++ /dev/null @@ -1,74 +0,0 @@ -package fwmodels - -import ( - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/types" -) - -// ProviderModel describes the provider config data model. -type ProviderModel struct { - Credentials types.String `tfsdk:"credentials"` - AccessToken types.String `tfsdk:"access_token"` - ImpersonateServiceAccount types.String `tfsdk:"impersonate_service_account"` - ImpersonateServiceAccountDelegates types.List `tfsdk:"impersonate_service_account_delegates"` - Project types.String `tfsdk:"project"` - BillingProject types.String `tfsdk:"billing_project"` - Region types.String `tfsdk:"region"` - Zone types.String `tfsdk:"zone"` - Scopes types.List `tfsdk:"scopes"` - Batching types.List `tfsdk:"batching"` - UserProjectOverride types.Bool `tfsdk:"user_project_override"` - RequestTimeout types.String `tfsdk:"request_timeout"` - RequestReason types.String `tfsdk:"request_reason"` - UniverseDomain types.String `tfsdk:"universe_domain"` - DefaultLabels types.Map `tfsdk:"default_labels"` - AddTerraformAttributionLabel types.Bool `tfsdk:"add_terraform_attribution_label"` - TerraformAttributionLabelAdditionStrategy types.String `tfsdk:"terraform_attribution_label_addition_strategy"` - - // Generated Products -{{- range $product := $.Products }} - {{ $product.Name }}CustomEndpoint types.String `tfsdk:"{{ underscore $product.Name }}_custom_endpoint"` -{{- end }} - - // Handwritten Products / Versioned / Atypical Entries - CloudBillingCustomEndpoint types.String `tfsdk:"cloud_billing_custom_endpoint"` - ContainerCustomEndpoint types.String `tfsdk:"container_custom_endpoint"` - DataflowCustomEndpoint types.String `tfsdk:"dataflow_custom_endpoint"` - IamCredentialsCustomEndpoint types.String `tfsdk:"iam_credentials_custom_endpoint"` - ResourceManagerV3CustomEndpoint types.String `tfsdk:"resource_manager_v3_custom_endpoint"` -{{- if ne $.TargetVersionName "ga" }} - RuntimeconfigCustomEndpoint types.String `tfsdk:"runtimeconfig_custom_endpoint"` -{{- end }} - IAMCustomEndpoint types.String `tfsdk:"iam_custom_endpoint"` - TagsLocationCustomEndpoint types.String `tfsdk:"tags_location_custom_endpoint"` - - // dcl - ContainerAwsCustomEndpoint types.String `tfsdk:"container_aws_custom_endpoint"` - ContainerAzureCustomEndpoint types.String `tfsdk:"container_azure_custom_endpoint"` - - // dcl generated - ApikeysCustomEndpoint types.String `tfsdk:"apikeys_custom_endpoint"` - 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"` - - GkehubFeatureCustomEndpoint types.String `tfsdk:"gkehub_feature_custom_endpoint"` -} - -type ProviderBatching struct { - SendAfter types.String `tfsdk:"send_after"` - EnableBatching types.Bool `tfsdk:"enable_batching"` -} - -var ProviderBatchingAttributes = map[string]attr.Type{ - "send_after": types.StringType, - "enable_batching": types.BoolType, -} - -// ProviderMetaModel describes the provider meta model -type ProviderMetaModel struct { - ModuleName types.String `tfsdk:"module_name"` -} diff --git a/mmv1/third_party/terraform/fwmodels/provider_model.go.tmpl b/mmv1/third_party/terraform/fwmodels/provider_model.go.tmpl index aad2449e042f..252fccb53d54 100644 --- a/mmv1/third_party/terraform/fwmodels/provider_model.go.tmpl +++ b/mmv1/third_party/terraform/fwmodels/provider_model.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package fwmodels import ( @@ -27,9 +26,9 @@ type ProviderModel struct { TerraformAttributionLabelAdditionStrategy types.String `tfsdk:"terraform_attribution_label_addition_strategy"` // Generated Products -<% products.each do |product| -%> - <%= product[:definitions].name -%>CustomEndpoint types.String `tfsdk:"<%= product[:definitions].name.underscore -%>_custom_endpoint"` -<% end -%> +{{- range $product := $.Products }} + {{ $product.Name }}CustomEndpoint types.String `tfsdk:"{{ underscore $product.Name }}_custom_endpoint"` +{{- end }} // Handwritten Products / Versioned / Atypical Entries CloudBillingCustomEndpoint types.String `tfsdk:"cloud_billing_custom_endpoint"` @@ -37,9 +36,9 @@ type ProviderModel struct { DataflowCustomEndpoint types.String `tfsdk:"dataflow_custom_endpoint"` IamCredentialsCustomEndpoint types.String `tfsdk:"iam_credentials_custom_endpoint"` ResourceManagerV3CustomEndpoint types.String `tfsdk:"resource_manager_v3_custom_endpoint"` -<% unless version == "ga" -%> +{{- if ne $.TargetVersionName "ga" }} RuntimeconfigCustomEndpoint types.String `tfsdk:"runtimeconfig_custom_endpoint"` -<% end -%> +{{- end }} IAMCustomEndpoint types.String `tfsdk:"iam_custom_endpoint"` TagsLocationCustomEndpoint types.String `tfsdk:"tags_location_custom_endpoint"` diff --git a/mmv1/third_party/terraform/fwprovider/framework_provider.go.tmpl b/mmv1/third_party/terraform/fwprovider/framework_provider.go.tmpl index 98dc0d70df4a..470a492f3c84 100644 --- a/mmv1/third_party/terraform/fwprovider/framework_provider.go.tmpl +++ b/mmv1/third_party/terraform/fwprovider/framework_provider.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package fwprovider import ( @@ -20,9 +19,9 @@ import ( "github.com/hashicorp/terraform-provider-google/google/fwtransport" "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" "github.com/hashicorp/terraform-provider-google/version" - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "github.com/hashicorp/terraform-provider-google/google/services/firebase" - <% end -%> + {{- end }} transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) @@ -147,14 +146,14 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest, Optional: true, }, // Generated Products - <% products.each do |product| -%> - "<%= product[:definitions].name.underscore -%>_custom_endpoint": &schema.StringAttribute{ + {{- range $product := $.Products }} + "{{ underscore $product.Name }}_custom_endpoint": &schema.StringAttribute{ Optional: true, Validators: []validator.String{ transport_tpg.CustomEndpointValidator(), }, }, - <% end -%> + {{- end }} // Handwritten Products / Versioned / Atypical Entries "cloud_billing_custom_endpoint": &schema.StringAttribute{ @@ -187,14 +186,14 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest, transport_tpg.CustomEndpointValidator(), }, }, - <% unless version == "ga" -%> + {{- if ne $.TargetVersionName "ga" }} "runtimeconfig_custom_endpoint": &schema.StringAttribute{ Optional: true, Validators: []validator.String{ transport_tpg.CustomEndpointValidator(), }, }, - <% end -%> + {{- end }} "iam_custom_endpoint": &schema.StringAttribute{ Optional: true, Validators: []validator.String{ @@ -272,11 +271,11 @@ func (p *FrameworkProvider) DataSources(_ context.Context) []func() datasource.D return []func() datasource.DataSource{ resourcemanager.NewGoogleClientConfigDataSource, resourcemanager.NewGoogleClientOpenIDUserinfoDataSource, - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} firebase.NewGoogleFirebaseAndroidAppConfigDataSource, firebase.NewGoogleFirebaseAppleAppConfigDataSource, firebase.NewGoogleFirebaseWebAppConfigDataSource, - <% end -%> + {{- end }} } } diff --git a/mmv1/third_party/terraform/fwprovider/framework_provider_access_token_test.go.tmpl b/mmv1/third_party/terraform/fwprovider/framework_provider_access_token_test.go.tmpl index fae0ab28b584..f90b4919ba78 100644 --- a/mmv1/third_party/terraform/fwprovider/framework_provider_access_token_test.go.tmpl +++ b/mmv1/third_party/terraform/fwprovider/framework_provider_access_token_test.go.tmpl @@ -1,11 +1,10 @@ -<% autogen_exception -%> package fwprovider_test import ( "fmt" -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} "os" -<% end -%> +{{- end }} "regexp" "testing" @@ -26,12 +25,12 @@ func TestAccFwProvider_access_token(t *testing.T) { // Schema-level validation "when access_token is set to an empty string in the config the value isn't ignored and results in an error": testAccFwProvider_access_token_emptyStringValidation, "access_token conflicts with credentials": testAccFwProvider_access_token_conflictsWithCredentials, - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} // Usage // Beta-only generation is needed because we need to access a PF-implemented data source linked to resource in an API. // Currently this only exists in TPGB. "access_token can be used to authenticate the provider": testAccFwProvider_access_token_authInUse, - <% end -%> + {{- end }} } for name, tc := range testCases { @@ -219,7 +218,7 @@ credentials = "%s" }) } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} func testAccFwProvider_access_token_authInUse(t *testing.T) { acctest.SkipIfVcr(t) // Skip because Firebase is weird with VCR, and we have to use Firebase resources in the test @@ -264,7 +263,7 @@ func testAccFwProvider_access_token_authInUse(t *testing.T) { }, }) } -<% end -%> +{{- end }} // testAccFwProvider_access_tokenInProviderBlock allows setting the access_token argument in a provider block. // This function uses data.google_provider_config_plugin_framework because it is implemented with the SDKv2 @@ -313,7 +312,7 @@ output "access_token" { `, context) } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} func testAccFwProvider_access_token_useAccessToken(context map[string]interface{}) string { return acctest.Nprintf(` provider "google" { @@ -337,4 +336,4 @@ data "google_firebase_apple_app_config" "my_app_config" { } `, context) } -<% end -%> \ No newline at end of file +{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/fwprovider/framework_provider_test.go.tmpl b/mmv1/third_party/terraform/fwprovider/framework_provider_test.go.tmpl index fef2bc8102c1..0a910cabedaf 100644 --- a/mmv1/third_party/terraform/fwprovider/framework_provider_test.go.tmpl +++ b/mmv1/third_party/terraform/fwprovider/framework_provider_test.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package fwprovider_test import ( @@ -48,7 +47,7 @@ func TestAccFrameworkProviderBasePath_setInvalidBasePath(t *testing.T) { ExternalProviders: map[string]resource.ExternalProvider{ "google": { VersionConstraint: "4.58.0", - Source: "hashicorp/google<%= "-" + version unless version == 'ga' -%>", + Source: "hashicorp/google{{- if ne $.TargetVersionName "ga" -}}-{{$.TargetVersionName}}{{- end }}", }, }, Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", acctest.RandString(t, 10)), @@ -76,7 +75,7 @@ func TestAccFrameworkProviderBasePath_setBasePath(t *testing.T) { ExternalProviders: map[string]resource.ExternalProvider{ "google": { VersionConstraint: "4.58.0", - Source: "hashicorp/google<%= "-" + version unless version == 'ga' -%>", + Source: "hashicorp/google{{- if ne $.TargetVersionName "ga" -}}-{{$.TargetVersionName}}{{- end }}", }, }, Config: testAccFrameworkProviderBasePath_setBasePath("https://www.googleapis.com/dns/v1beta2/", acctest.RandString(t, 10)), @@ -85,7 +84,7 @@ func TestAccFrameworkProviderBasePath_setBasePath(t *testing.T) { ExternalProviders: map[string]resource.ExternalProvider{ "google": { VersionConstraint: "4.58.0", - Source: "hashicorp/google<%= "-" + version unless version == 'ga' -%>", + Source: "hashicorp/google{{- if ne $.TargetVersionName "ga" -}}-{{$.TargetVersionName}}{{- end }}", }, }, ResourceName: "google_dns_managed_zone.foo", @@ -224,7 +223,7 @@ func testAccCheckDNSManagedZoneDestroyProducerFramework(t *testing.T) func(s *te p := acctest.GetFwTestProvider(t) - url, err := fwresource.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") + url, err := fwresource.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{"{{"}}DNSBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/managedZones/{{"{{"}}name{{"}}"}}") if err != nil { return err } @@ -259,7 +258,7 @@ func testAccCheckComputeAddressDestroyProducer(t *testing.T) func(s *terraform.S config := acctest.GoogleProviderConfig(t) - url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}") + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/addresses/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/third_party/terraform/fwprovider/go/framework_provider.go.tmpl b/mmv1/third_party/terraform/fwprovider/go/framework_provider.go.tmpl deleted file mode 100644 index 470a492f3c84..000000000000 --- a/mmv1/third_party/terraform/fwprovider/go/framework_provider.go.tmpl +++ /dev/null @@ -1,297 +0,0 @@ -package fwprovider - -import ( - "context" - - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/function" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/provider" - "github.com/hashicorp/terraform-plugin-framework/provider/metaschema" - "github.com/hashicorp/terraform-plugin-framework/provider/schema" - "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types" - - "github.com/hashicorp/terraform-provider-google/google/functions" - "github.com/hashicorp/terraform-provider-google/google/fwmodels" - "github.com/hashicorp/terraform-provider-google/google/fwtransport" - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - "github.com/hashicorp/terraform-provider-google/version" - {{- if ne $.TargetVersionName "ga" }} - "github.com/hashicorp/terraform-provider-google/google/services/firebase" - {{- end }} - - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Ensure the implementation satisfies the expected interfaces -var ( - _ provider.ProviderWithMetaSchema = &FrameworkProvider{} - _ provider.ProviderWithFunctions = &FrameworkProvider{} -) - -// New is a helper function to simplify provider server and testing implementation. -func New() provider.ProviderWithMetaSchema { - return &FrameworkProvider{ - Version: version.ProviderVersion, - } -} - -// FrameworkProvider is the provider implementation. -type FrameworkProvider struct { - fwtransport.FrameworkProviderConfig - Version string -} - -// Metadata returns the provider type name. -func (p *FrameworkProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse) { - resp.TypeName = "google" - resp.Version = p.Version -} - -// MetaSchema returns the provider meta schema. -func (p *FrameworkProvider) MetaSchema(_ context.Context, _ provider.MetaSchemaRequest, resp *provider.MetaSchemaResponse) { - resp.Schema = metaschema.Schema{ - Attributes: map[string]metaschema.Attribute{ - "module_name": metaschema.StringAttribute{ - Optional: true, - }, - }, - } -} - -// Schema defines the provider-level schema for configuration data. -func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) { - resp.Schema = schema.Schema{ - Attributes: map[string]schema.Attribute{ - "credentials": schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - stringvalidator.ConflictsWith(path.Expressions{ - path.MatchRoot("access_token"), - }...), - CredentialsValidator(), - NonEmptyStringValidator(), - }, - }, - "access_token": schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - stringvalidator.ConflictsWith(path.Expressions{ - path.MatchRoot("credentials"), - }...), - NonEmptyStringValidator(), - }, - }, - "impersonate_service_account": schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - NonEmptyStringValidator(), - }, - }, - "impersonate_service_account_delegates": schema.ListAttribute{ - Optional: true, - ElementType: types.StringType, - }, - "project": schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - NonEmptyStringValidator(), - }, - }, - "billing_project": schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - NonEmptyStringValidator(), - }, - }, - "region": schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - NonEmptyStringValidator(), - }, - }, - "zone": schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - NonEmptyStringValidator(), - }, - }, - "scopes": schema.ListAttribute{ - Optional: true, - ElementType: types.StringType, - }, - "user_project_override": schema.BoolAttribute{ - Optional: true, - }, - "request_timeout": schema.StringAttribute{ - Optional: true, - }, - "request_reason": schema.StringAttribute{ - Optional: true, - }, - "universe_domain": schema.StringAttribute{ - Optional: true, - }, - "default_labels": schema.MapAttribute{ - Optional: true, - ElementType: types.StringType, - }, - "add_terraform_attribution_label": schema.BoolAttribute{ - Optional: true, - }, - "terraform_attribution_label_addition_strategy": schema.StringAttribute{ - Optional: true, - }, - // Generated Products - {{- range $product := $.Products }} - "{{ underscore $product.Name }}_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - {{- end }} - - // Handwritten Products / Versioned / Atypical Entries - "cloud_billing_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - "container_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - "dataflow_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - "iam_credentials_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - "resource_manager_v3_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - {{- if ne $.TargetVersionName "ga" }} - "runtimeconfig_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - {{- end }} - "iam_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - "tags_location_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - - // dcl - "container_aws_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - "container_azure_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, - }, - Blocks: map[string]schema.Block{ - "batching": schema.ListNestedBlock{ - NestedObject: schema.NestedBlockObject{ - Attributes: map[string]schema.Attribute{ - "send_after": schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - NonNegativeDurationValidator(), - }, - }, - "enable_batching": schema.BoolAttribute{ - Optional: true, - }, - }, - }, - }, - }, - } - - transport_tpg.ConfigureDCLCustomEndpointAttributesFramework(&resp.Schema) -} - -// Configure prepares an API client for data sources and resources. -func (p *FrameworkProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { - var data fwmodels.ProviderModel - - resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - - if resp.Diagnostics.HasError() { - return - } - - // Configuration values are now available. - p.LoadAndValidateFramework(ctx, &data, req.TerraformVersion, &resp.Diagnostics, p.Version) - if resp.Diagnostics.HasError() { - return - } - - // This is how we make provider configuration info (configured clients, default project, etc) available to resources and data sources - // implemented using the plugin-framework. The resources' Configure functions receive this data in the ConfigureRequest argument. - resp.DataSourceData = &p.FrameworkProviderConfig - resp.ResourceData = &p.FrameworkProviderConfig -} - - -// DataSources defines the data sources implemented in the provider. -func (p *FrameworkProvider) DataSources(_ context.Context) []func() datasource.DataSource { - return []func() datasource.DataSource{ - resourcemanager.NewGoogleClientConfigDataSource, - resourcemanager.NewGoogleClientOpenIDUserinfoDataSource, - {{- if ne $.TargetVersionName "ga" }} - firebase.NewGoogleFirebaseAndroidAppConfigDataSource, - firebase.NewGoogleFirebaseAppleAppConfigDataSource, - firebase.NewGoogleFirebaseWebAppConfigDataSource, - {{- end }} - } -} - -// Resources defines the resources implemented in the provider. -func (p *FrameworkProvider) Resources(_ context.Context) []func() resource.Resource { - return nil -} - -// Functions defines the provider functions implemented in the provider. -func (p *FrameworkProvider) Functions(_ context.Context) []func() function.Function { - return []func() function.Function{ - functions.NewLocationFromIdFunction, - functions.NewNameFromIdFunction, - functions.NewProjectFromIdFunction, - functions.NewRegionFromIdFunction, - functions.NewRegionFromZoneFunction, - functions.NewZoneFromIdFunction, - } -} diff --git a/mmv1/third_party/terraform/fwprovider/go/framework_provider_access_token_test.go.tmpl b/mmv1/third_party/terraform/fwprovider/go/framework_provider_access_token_test.go.tmpl deleted file mode 100644 index f90b4919ba78..000000000000 --- a/mmv1/third_party/terraform/fwprovider/go/framework_provider_access_token_test.go.tmpl +++ /dev/null @@ -1,339 +0,0 @@ -package fwprovider_test - -import ( - "fmt" -{{- if ne $.TargetVersionName "ga" }} - "os" -{{- end }} - "regexp" - "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" -) - -// TestAccFwProvider_access_token is a series of acc tests asserting how the plugin-framework provider handles access_token arguments -// It is plugin-framework specific because the HCL used provisions plugin-framework-implemented resources -// It is a counterpart to TestAccSdkProvider_access_token -func TestAccFwProvider_access_token(t *testing.T) { - testCases := map[string]func(t *testing.T){ - // Configuring the provider using inputs - "config takes precedence over environment variables": testAccFwProvider_access_token_configPrecedenceOverEnvironmentVariables, - "when access_token is unset in the config, environment variables are used in a given order": testAccFwProvider_access_token_precedenceOrderEnvironmentVariables, // GOOGLE_OAUTH_ACCESS_TOKEN - - // Schema-level validation - "when access_token is set to an empty string in the config the value isn't ignored and results in an error": testAccFwProvider_access_token_emptyStringValidation, - "access_token conflicts with credentials": testAccFwProvider_access_token_conflictsWithCredentials, - {{- if ne $.TargetVersionName "ga" }} - // Usage - // Beta-only generation is needed because we need to access a PF-implemented data source linked to resource in an API. - // Currently this only exists in TPGB. - "access_token can be used to authenticate the provider": testAccFwProvider_access_token_authInUse, - {{- end }} - } - - for name, tc := range testCases { - // shadow the tc variable into scope so that when - // the loop continues, if t.Run hasn't executed tc(t) - // yet, we don't have a race condition - // see https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables - tc := tc - t.Run(name, func(t *testing.T) { - tc(t) - }) - } -} - -func testAccFwProvider_access_token_configPrecedenceOverEnvironmentVariables(t *testing.T) { - acctest.SkipIfVcr(t) // Test doesn't interact with API - - accessToken := "my-access-token" - - // ensure all possible access_token env vars set; show they aren't used instead - t.Setenv("GOOGLE_OAUTH_ACCESS_TOKEN", accessToken) - - // ensure credentials ENVs not set; they're used over access_token - for _, env := range envvar.CredsEnvVars { - t.Setenv(env, "") - } - - providerAccessToken := "foobar" - - context := map[string]interface{}{ - "access_token": providerAccessToken, - } - - acctest.VcrTest(t, resource.TestCase{ - // No PreCheck for checking ENVs - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - // Apply-time error; bad value in config is used over of good values in ENVs - Config: testAccFwProvider_access_tokenInProviderBlock(context), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.google_provider_config_plugin_framework.default", "access_token", providerAccessToken), - )}, - }, - }) -} - -func testAccFwProvider_access_token_precedenceOrderEnvironmentVariables(t *testing.T) { - acctest.SkipIfVcr(t) // Test doesn't interact with API - /* - These are all the ENVs for access_token - GOOGLE_OAUTH_ACCESS_TOKEN - */ - - GOOGLE_OAUTH_ACCESS_TOKEN := "GOOGLE_OAUTH_ACCESS_TOKEN" - - context := map[string]interface{}{} - - acctest.VcrTest(t, resource.TestCase{ - // No PreCheck for checking ENVs - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - // GOOGLE_OAUTH_ACCESS_TOKEN is used if config doesn't provide a value - PreConfig: func() { - t.Setenv("GOOGLE_OAUTH_ACCESS_TOKEN", GOOGLE_OAUTH_ACCESS_TOKEN) //used - }, - Config: testAccFwProvider_access_tokenInEnvsOnly(context), - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.google_provider_config_plugin_framework.default", "access_token", GOOGLE_OAUTH_ACCESS_TOKEN), - ), - }, - }, - }) -} - -func testAccFwProvider_access_token_emptyStringValidation(t *testing.T) { - acctest.SkipIfVcr(t) // Test doesn't interact with API - - accessToken := "my-access-token" - - // ensure all access_token env vars set - t.Setenv("GOOGLE_OAUTH_ACCESS_TOKEN", accessToken) - - context := map[string]interface{}{ - "access_token": "", // empty string used - } - - acctest.VcrTest(t, resource.TestCase{ - // No PreCheck for checking ENVs - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccFwProvider_access_tokenInProviderBlock(context), - PlanOnly: true, - ExpectError: regexp.MustCompile("expected a non-empty string"), - }, - }, - }) -} - -func testAccFwProvider_access_token_conflictsWithCredentials(t *testing.T) { - acctest.SkipIfVcr(t) // Test doesn't interact with API - - goodCredentials := envvar.GetTestCredsFromEnv() - - // unset ENVs for both access_token and credentials - t.Setenv("GOOGLE_OAUTH_ACCESS_TOKEN", "") - for _, env := range envvar.CredsEnvVars { - t.Setenv(env, "") - } - - accessToken := "my-access-token" - credentials := "./path/to/fake/credentials.json" - - providerBlockBoth := fmt.Sprintf(` -access_token = "%s" -credentials = "%s" -`, accessToken, credentials) - - providerAccessTokenOnly := fmt.Sprintf(` - access_token = "%s" - `, accessToken) - - providerCredentialsOnly := fmt.Sprintf(` - credentials = "%s" - `, credentials) - - contextBoth := map[string]interface{}{ - "fields": providerBlockBoth, - } - - contextAccessTokenOnly := map[string]interface{}{ - "fields": providerAccessTokenOnly, - } - - contextCredentialsOnly := map[string]interface{}{ - "fields": providerCredentialsOnly, - } - - acctest.VcrTest(t, resource.TestCase{ - // No PreCheck for checking ENVs - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - // Conflicts when both set in the provider block in the configuration - Config: testAccFwProvider_access_token_conflictingFields(contextBoth), - ExpectError: regexp.MustCompile("Attribute \"access_token\" cannot be specified when \"credentials\" is specified"), - }, - { - // No conflict when access_token in the provider block, credentials in ENVs. - PreConfig: func() { - t.Setenv("GOOGLE_CREDENTIALS", credentials) - t.Setenv("GOOGLE_OAUTH_ACCESS_TOKEN", "") - }, - Config: testAccFwProvider_access_token_conflictingFields(contextAccessTokenOnly), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.google_provider_config_plugin_framework.default", "access_token", accessToken), - // not set as ENV not used - resource.TestCheckNoResourceAttr("data.google_provider_config_plugin_framework.default", "credentials"), - ), - }, - { - // No conflict when credentials in the provider block, access_token in ENVs. - PreConfig: func() { - t.Setenv("GOOGLE_CREDENTIALS", "") - t.Setenv("GOOGLE_OAUTH_ACCESS_TOKEN", accessToken) - }, - Config: testAccFwProvider_access_token_conflictingFields(contextCredentialsOnly), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.google_provider_config_sdk.default", "credentials", credentials), - // not set, as ENV not used - resource.TestCheckNoResourceAttr("data.google_provider_config_sdk.default", "access_token"), - ), - ExpectError: regexp.MustCompile("JSON credentials are not valid"), - }, - { - PreConfig: func() { - t.Setenv("GOOGLE_CREDENTIALS", goodCredentials) - }, - Destroy: true, - Config: "// Empty config and good credentials in this step to avoid post-test destroy error", - }, - }, - }) -} - -{{ if ne $.TargetVersionName `ga` -}} -func testAccFwProvider_access_token_authInUse(t *testing.T) { - acctest.SkipIfVcr(t) // Skip because Firebase is weird with VCR, and we have to use Firebase resources in the test - - // Skip if not running in a acc test environment, - // as acc test environment variables needed to get accessToken - if v := os.Getenv("TF_ACC"); v == "" { - t.Skip("Acceptance tests skipped unless env 'TF_ACC' set") - } - - // Access token to pass in via config - accessToken := acctest.GetAccessTokenFromTestCredsFromEnv(t) - - context := map[string]interface{}{ - "access_token": accessToken, - "random_suffix": acctest.RandString(t, 10), - "bundle_id": "apple.app." + acctest.RandString(t, 5), - "display_name": "tf-test Display Name AppleAppConfig DataSource", - "app_store_id": 12345, - "team_id": 1234567890, - } - - acctest.VcrTest(t, resource.TestCase{ - // No PreCheck for checking ENVs - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - PreConfig: func() { - // unset all relevant ENVs, so value passed in via - // context is the only usable input - t.Setenv("GOOGLE_OAUTH_ACCESS_TOKEN", "") - for _, env := range envvar.CredsEnvVars { - t.Setenv(env, "") - } - }, - Config: testAccFwProvider_access_token_useAccessToken(context), - Check: resource.ComposeAggregateTestCheckFunc( - // Assert provider is using access_token argument for auth, not credentials - resource.TestCheckResourceAttrSet("data.google_provider_config_plugin_framework.default", "access_token"), - resource.TestCheckNoResourceAttr("data.google_provider_config_plugin_framework.default", "credentials"), - ), - }, - }, - }) -} -{{- end }} - -// testAccFwProvider_access_tokenInProviderBlock allows setting the access_token argument in a provider block. -// This function uses data.google_provider_config_plugin_framework because it is implemented with the SDKv2 -func testAccFwProvider_access_tokenInProviderBlock(context map[string]interface{}) string { - return acctest.Nprintf(` -provider "google" { - access_token = "%{access_token}" -} - -data "google_provider_config_plugin_framework" "default" {} - -output "access_token" { - value = data.google_provider_config_plugin_framework.default.access_token - sensitive = true -} -`, context) -} - -// testAccFwProvider_access_tokenInEnvsOnly allows testing when the access_token argument -// is only supplied via ENVs -func testAccFwProvider_access_tokenInEnvsOnly(context map[string]interface{}) string { - return acctest.Nprintf(` -data "google_provider_config_plugin_framework" "default" {} - -output "access_token" { - value = data.google_provider_config_plugin_framework.default.access_token - sensitive = true -} -`, context) -} - -// testAccFwProvider_access_token_conflictingFields allows setting multiple fields in the provider -// block to test conflict validation in the provider schema -func testAccFwProvider_access_token_conflictingFields(context map[string]interface{}) string { - return acctest.Nprintf(` -provider "google" { -%{fields} -} - -data "google_provider_config_plugin_framework" "default" {} - -output "access_token" { - value = data.google_provider_config_plugin_framework.default.access_token - sensitive = true -} -`, context) -} - -{{ if ne $.TargetVersionName `ga` -}} -func testAccFwProvider_access_token_useAccessToken(context map[string]interface{}) string { - return acctest.Nprintf(` -provider "google" { - access_token = "%{access_token}" -} - -data "google_provider_config_plugin_framework" "default" { -} - -resource "google_firebase_apple_app" "my_app_config" { - project = data.google_provider_config_plugin_framework.default.project - bundle_id = "%{bundle_id}" - display_name = "%{display_name}" - app_store_id = "%{app_store_id}" - team_id = "%{team_id}" -} - -// This is implemented with plugin-framework so tests our use of access_token in a PF specific way -data "google_firebase_apple_app_config" "my_app_config" { - app_id = google_firebase_apple_app.my_app_config.app_id -} -`, context) -} -{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/fwprovider/go/framework_provider_test.go.tmpl b/mmv1/third_party/terraform/fwprovider/go/framework_provider_test.go.tmpl deleted file mode 100644 index 0a910cabedaf..000000000000 --- a/mmv1/third_party/terraform/fwprovider/go/framework_provider_test.go.tmpl +++ /dev/null @@ -1,286 +0,0 @@ -package fwprovider_test - -import ( - "fmt" - "regexp" - "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/fwresource" - "github.com/hashicorp/terraform-provider-google/google/fwtransport" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -func TestAccFrameworkProviderMeta_setModuleName(t *testing.T) { - // TODO: https://github.com/hashicorp/terraform-provider-google/issues/14158 - acctest.SkipIfVcr(t) - t.Parallel() - - moduleName := "my-module" - managedZoneName := fmt.Sprintf("tf-test-zone-%s", acctest.RandString(t, 10)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t), - Steps: []resource.TestStep{ - { - Config: testAccFrameworkProviderMeta_setModuleName(moduleName, managedZoneName, acctest.RandString(t, 10)), - }, - }, - }) -} - -func TestAccFrameworkProviderBasePath_setInvalidBasePath(t *testing.T) { - t.Parallel() - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), - Steps: []resource.TestStep{ - { - ExternalProviders: map[string]resource.ExternalProvider{ - "google": { - VersionConstraint: "4.58.0", - Source: "hashicorp/google{{- if ne $.TargetVersionName "ga" -}}-{{$.TargetVersionName}}{{- end }}", - }, - }, - Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", acctest.RandString(t, 10)), - ExpectError: regexp.MustCompile("got HTTP response code [4-5][0-9]{2} with body"), - }, - { - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", acctest.RandString(t, 10)), - ExpectError: regexp.MustCompile("got HTTP response code [4-5][0-9]{2} with body"), - }, - }, - }) -} - -func TestAccFrameworkProviderBasePath_setBasePath(t *testing.T) { - // TODO: https://github.com/hashicorp/terraform-provider-google/issues/14158 - acctest.SkipIfVcr(t) - t.Parallel() - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t), - Steps: []resource.TestStep{ - { - ExternalProviders: map[string]resource.ExternalProvider{ - "google": { - VersionConstraint: "4.58.0", - Source: "hashicorp/google{{- if ne $.TargetVersionName "ga" -}}-{{$.TargetVersionName}}{{- end }}", - }, - }, - Config: testAccFrameworkProviderBasePath_setBasePath("https://www.googleapis.com/dns/v1beta2/", acctest.RandString(t, 10)), - }, - { - ExternalProviders: map[string]resource.ExternalProvider{ - "google": { - VersionConstraint: "4.58.0", - Source: "hashicorp/google{{- if ne $.TargetVersionName "ga" -}}-{{$.TargetVersionName}}{{- end }}", - }, - }, - ResourceName: "google_dns_managed_zone.foo", - ImportState: true, - ImportStateVerify: true, - }, - { - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Config: testAccFrameworkProviderBasePath_setBasePath("https://www.googleapis.com/dns/v1beta2/", acctest.RandString(t, 10)), - }, - { - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - ResourceName: "google_dns_managed_zone.foo", - ImportState: true, - ImportStateVerify: true, - }, - { - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Config: testAccFrameworkProviderBasePath_setBasePathstep3("https://www.googleapis.com/dns/v1beta2/", acctest.RandString(t, 10)), - }, - }, - }) -} - -func testAccFrameworkProviderMeta_setModuleName(key, managedZoneName, recordSetName string) string { - return fmt.Sprintf(` -terraform { - provider_meta "google" { - module_name = "%s" - } -} - -provider "google" {} - -resource "google_dns_managed_zone" "zone" { - name = "%s-hashicorptest-com" - dns_name = "%s.hashicorptest.com." -} - -resource "google_dns_record_set" "rs" { - managed_zone = google_dns_managed_zone.zone.name - name = "%s.${google_dns_managed_zone.zone.dns_name}" - type = "A" - ttl = 300 - rrdatas = [ - "192.168.1.0", - ] -} - -data "google_dns_record_set" "rs" { - managed_zone = google_dns_record_set.rs.managed_zone - name = google_dns_record_set.rs.name - type = google_dns_record_set.rs.type -}`, key, managedZoneName, managedZoneName, recordSetName) -} - -func testAccFrameworkProviderBasePath_setBasePath(endpoint, name string) string { - return fmt.Sprintf(` -provider "google" { - alias = "dns_custom_endpoint" - dns_custom_endpoint = "%s" -} - -resource "google_dns_managed_zone" "foo" { - provider = google.dns_custom_endpoint - name = "tf-test-zone-%s" - dns_name = "tf-test-zone-%s.hashicorptest.com." - description = "QA DNS zone" -} - -data "google_dns_managed_zone" "qa" { - provider = google.dns_custom_endpoint - name = google_dns_managed_zone.foo.name -}`, endpoint, name, name) -} - -func testAccFrameworkProviderBasePath_setBasePathstep3(endpoint, name string) string { - return fmt.Sprintf(` -provider "google" { - alias = "dns_custom_endpoint" - dns_custom_endpoint = "%s" -} - -resource "google_dns_managed_zone" "foo" { - provider = google.dns_custom_endpoint - name = "tf-test-zone-%s" - dns_name = "tf-test-zone-%s.hashicorptest.com." - description = "QA DNS zone" -} -`, endpoint, name, name) -} - - -// Copy the function from the provider_test package to here -// as that function is in the _test.go file and not importable -func testAccProviderBasePath_setBasePath(endpoint, name string) string { - return fmt.Sprintf(` -provider "google" { - alias = "compute_custom_endpoint" - compute_custom_endpoint = "%s" -} - -resource "google_compute_address" "default" { - provider = google.compute_custom_endpoint - name = "tf-test-address-%s" -}`, endpoint, name) -} - -func testAccProviderMeta_setModuleName(key, name string) string { - return fmt.Sprintf(` -terraform { - provider_meta "google" { - module_name = "%s" - } -} - -resource "google_compute_address" "default" { - name = "tf-test-address-%s" -}`, key, name) -} - -// Copy the function testAccCheckComputeAddressDestroyProducer from the dns_test package to here, -// as that function is in the _test.go file and not importable. -// -// testAccCheckDNSManagedZoneDestroyProducerFramework is the framework version of the generated testAccCheckDNSManagedZoneDestroyProducer -// when we automate this, we'll use the automated version and can get rid of this -func testAccCheckDNSManagedZoneDestroyProducerFramework(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_dns_managed_zone" { - continue - } - if strings.HasPrefix(name, "data.") { - continue - } - - p := acctest.GetFwTestProvider(t) - - url, err := fwresource.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{"{{"}}DNSBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/managedZones/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - billingProject := "" - - if !p.BillingProject.IsNull() && p.BillingProject.String() != "" { - billingProject = p.BillingProject.String() - } - - _, diags := fwtransport.SendFrameworkRequest(&p.FrameworkProvider.FrameworkProviderConfig, "GET", billingProject, url, p.UserAgent, nil) - if !diags.HasError() { - return fmt.Errorf("DNSManagedZone still exists at %s", url) - } - } - - return nil - } -} - -// Copy the Mmv1 generated function testAccCheckComputeAddressDestroyProducer from the compute_test package to here, -// as that function is in the _test.go file and not importable. -func testAccCheckComputeAddressDestroyProducer(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_compute_address" { - continue - } - if strings.HasPrefix(name, "data.") { - continue - } - - config := acctest.GoogleProviderConfig(t) - - url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/addresses/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - billingProject := "" - - if config.BillingProject != "" { - billingProject = config.BillingProject - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, - }) - if err == nil { - return fmt.Errorf("ComputeAddress still exists at %s", url) - } - } - - return nil - } -} diff --git a/mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl b/mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl index cc0005bac96c..e528c6749f0a 100644 --- a/mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl +++ b/mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package fwtransport import ( @@ -57,9 +56,9 @@ type FrameworkProviderConfig struct { DefaultLabels types.Map // paths for client setup - <% products.each do |product| -%> - <%= product[:definitions].name -%>BasePath string - <% end -%> + {{- range $product := $.Products }} + {{ $product.Name }}BasePath string + {{- end }} } // LoadAndValidateFramework handles the bulk of configuring the provider @@ -75,7 +74,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context, p.Context = ctx // Handle User Agent string - p.UserAgent = CompileUserAgentString(ctx, "terraform-provider-google<%= "-" + version unless version == 'ga' -%>", tfVersion, providerversion) + p.UserAgent = CompileUserAgentString(ctx, "terraform-provider-google{{- if ne $.TargetVersionName "ga" -}}-{{$.TargetVersionName}}{{- end }}", tfVersion, providerversion) // opt in extension for adding to the User-Agent header if ext := os.Getenv("GOOGLE_TERRAFORM_USERAGENT_EXTENSION"); ext != "" { ua := p.UserAgent @@ -99,9 +98,9 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context, // Setup Base Paths for clients // Generated products - <% products.map.each do |product| -%> - p.<%= product[:definitions].name -%>BasePath = data.<%= product[:definitions].name -%>CustomEndpoint.ValueString() - <% end -%> + {{- range $product := $.Products }} + p.{{ $product.Name }}BasePath = data.{{ $product.Name }}CustomEndpoint.ValueString() + {{- end }} // Temporary p.Credentials = data.Credentials @@ -236,16 +235,16 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo } // Generated Products -<% products.each do |product| -%> - if data.<%= product[:definitions].name -%>CustomEndpoint.IsNull() { +{{- range $product := $.Products }} + if data.{{ $product.Name }}CustomEndpoint.IsNull() { customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_<%= product[:definitions].name.underscore.upcase -%>_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.<%= product[:definitions].name -%>BasePathKey]) + "GOOGLE_{{ upper (underscore $product.Name) }}_CUSTOM_ENDPOINT", + }, transport_tpg.DefaultBasePaths[transport_tpg.{{ $product.Name }}BasePathKey]) if customEndpoint != nil { - data.<%= product[:definitions].name -%>CustomEndpoint = types.StringValue(customEndpoint.(string)) + data.{{ $product.Name }}CustomEndpoint = types.StringValue(customEndpoint.(string)) } } -<% end -%> +{{- end }} // Handwritten Products / Versioned / Atypical Entries if data.CloudBillingCustomEndpoint.IsNull() { @@ -302,7 +301,7 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo } } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} if data.RuntimeConfigCustomEndpoint.IsNull() { customEndpoint := transport_tpg.MultiEnvDefault([]string{ "GOOGLE_RUNTIMECONFIG_CUSTOM_ENDPOINT", @@ -311,7 +310,7 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo data.RuntimeConfigCustomEndpoint = types.StringValue(customEndpoint.(string)) } } -<% end -%> +{{- end }} if data.IAMCustomEndpoint.IsNull() { customEndpoint := transport_tpg.MultiEnvDefault([]string{ diff --git a/mmv1/third_party/terraform/fwtransport/framework_provider_clients.go.tmpl b/mmv1/third_party/terraform/fwtransport/framework_provider_clients.go.tmpl index 78bbcb79372d..1001fa557202 100644 --- a/mmv1/third_party/terraform/fwtransport/framework_provider_clients.go.tmpl +++ b/mmv1/third_party/terraform/fwtransport/framework_provider_clients.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package fwtransport import ( @@ -6,9 +5,9 @@ import ( "strings" "google.golang.org/api/dns/v1" -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} firebase "google.golang.org/api/firebase/v1beta1" -<% end -%> +{{- end }} "google.golang.org/api/option" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -38,7 +37,7 @@ func (p *FrameworkProviderConfig) NewDnsClient(userAgent string, diags *diag.Dia return clientDns } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} func (p *FrameworkProviderConfig) NewFirebaseClient(userAgent string, diags *diag.Diagnostics) *firebase.Service { firebaseClientBasePath := transport_tpg.RemoveBasePathVersion(p.FirebaseBasePath) firebaseClientBasePath = strings.ReplaceAll(firebaseClientBasePath, "/firebase/", "") @@ -53,4 +52,4 @@ func (p *FrameworkProviderConfig) NewFirebaseClient(userAgent string, diags *dia return clientFirebase } -<% end -%> +{{- end }} diff --git a/mmv1/third_party/terraform/fwtransport/go/framework_config.go.tmpl b/mmv1/third_party/terraform/fwtransport/go/framework_config.go.tmpl deleted file mode 100644 index e528c6749f0a..000000000000 --- a/mmv1/third_party/terraform/fwtransport/go/framework_config.go.tmpl +++ /dev/null @@ -1,728 +0,0 @@ -package fwtransport - -import ( - "context" - "fmt" - "net/http" - "os" - "regexp" - "strconv" - "time" - - "golang.org/x/oauth2" - googleoauth "golang.org/x/oauth2/google" - - "google.golang.org/api/option" - "google.golang.org/api/transport" - "google.golang.org/grpc" - - "github.com/hashicorp/go-cleanhttp" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "github.com/hashicorp/terraform-plugin-log/tflog" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging" - - "github.com/hashicorp/terraform-provider-google/google/fwmodels" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "github.com/hashicorp/terraform-provider-google/google/verify" - - grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" - "github.com/sirupsen/logrus" -) - -type FrameworkProviderConfig struct { - // Temporary, as we'll replace use of FrameworkProviderConfig with transport_tpg.Config soon - // transport_tpg.Config has a Credentials field, hence this change is needed - Credentials types.String - AccessToken types.String - // End temporary - - BillingProject types.String - Client *http.Client - Context context.Context - gRPCLoggingOptions []option.ClientOption - PollInterval time.Duration - Project types.String - Region types.String - Zone types.String - RequestBatcherIam *transport_tpg.RequestBatcher - RequestBatcherServiceUsage *transport_tpg.RequestBatcher - Scopes types.List - TokenSource oauth2.TokenSource - UniverseDomain types.String - UserAgent string - UserProjectOverride types.Bool - DefaultLabels types.Map - - // paths for client setup - {{- range $product := $.Products }} - {{ $product.Name }}BasePath string - {{- end }} -} - -// LoadAndValidateFramework handles the bulk of configuring the provider -// it is pulled out so that we can manually call this from our testing provider as well -func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context, data *fwmodels.ProviderModel, tfVersion string, diags *diag.Diagnostics, providerversion string) { - - // Set defaults if needed - p.HandleDefaults(ctx, data, diags) - if diags.HasError() { - return - } - - p.Context = ctx - - // Handle User Agent string - p.UserAgent = CompileUserAgentString(ctx, "terraform-provider-google{{- if ne $.TargetVersionName "ga" -}}-{{$.TargetVersionName}}{{- end }}", tfVersion, providerversion) - // opt in extension for adding to the User-Agent header - if ext := os.Getenv("GOOGLE_TERRAFORM_USERAGENT_EXTENSION"); ext != "" { - ua := p.UserAgent - p.UserAgent = fmt.Sprintf("%s %s", ua, ext) - } - - // Set up client configuration - p.SetupClient(ctx, *data, diags) - if diags.HasError() { - return - } - - // gRPC Logging setup - p.SetupGrpcLogging() - - // Handle Batching Config - batchingConfig := GetBatchingConfig(ctx, data.Batching, diags) - if diags.HasError() { - return - } - - // Setup Base Paths for clients - // Generated products - {{- range $product := $.Products }} - p.{{ $product.Name }}BasePath = data.{{ $product.Name }}CustomEndpoint.ValueString() - {{- end }} - - // Temporary - p.Credentials = data.Credentials - p.AccessToken = data.AccessToken - // End temporary - - // Copy values from the ProviderModel struct containing data about the provider configuration (present only when responsing to ConfigureProvider rpc calls) - // to the FrameworkProviderConfig struct that will be passed and available to all resources/data sources - p.Context = ctx - p.BillingProject = data.BillingProject - p.DefaultLabels = data.DefaultLabels - p.Project = data.Project - p.Region = GetRegionFromRegionSelfLink(data.Region) - p.Scopes = data.Scopes - p.Zone = data.Zone - p.UserProjectOverride = data.UserProjectOverride - p.PollInterval = 10 * time.Second - p.UniverseDomain = data.UniverseDomain - p.RequestBatcherServiceUsage = transport_tpg.NewRequestBatcher("Service Usage", ctx, batchingConfig) - p.RequestBatcherIam = transport_tpg.NewRequestBatcher("IAM", ctx, batchingConfig) -} - -// HandleDefaults will handle all the defaults necessary in the provider -func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmodels.ProviderModel, diags *diag.Diagnostics) { - if (data.AccessToken.IsNull() || data.AccessToken.IsUnknown()) && (data.Credentials.IsNull() || data.Credentials.IsUnknown()) { - credentials := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON", - }, nil) - - if credentials != nil { - data.Credentials = types.StringValue(credentials.(string)) - } - - accessToken := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_OAUTH_ACCESS_TOKEN", - }, nil) - - if accessToken != nil { - data.AccessToken = types.StringValue(accessToken.(string)) - } - } - - if (data.ImpersonateServiceAccount.IsNull() || data.ImpersonateServiceAccount.IsUnknown()) && os.Getenv("GOOGLE_IMPERSONATE_SERVICE_ACCOUNT") != "" { - data.ImpersonateServiceAccount = types.StringValue(os.Getenv("GOOGLE_IMPERSONATE_SERVICE_ACCOUNT")) - } - - if data.Project.IsNull() || data.Project.IsUnknown() { - project := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_PROJECT", - "GOOGLE_CLOUD_PROJECT", - "GCLOUD_PROJECT", - "CLOUDSDK_CORE_PROJECT", - }, nil) - if project != nil { - data.Project = types.StringValue(project.(string)) - } - } - - if data.BillingProject.IsNull() && os.Getenv("GOOGLE_BILLING_PROJECT") != "" { - data.BillingProject = types.StringValue(os.Getenv("GOOGLE_BILLING_PROJECT")) - } - - if data.Region.IsNull() || data.Region.IsUnknown() { - region := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_REGION", - "GCLOUD_REGION", - "CLOUDSDK_COMPUTE_REGION", - }, nil) - - if region != nil { - data.Region = types.StringValue(region.(string)) - } - } - - if data.Zone.IsNull() || data.Zone.IsUnknown() { - zone := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_ZONE", - "GCLOUD_ZONE", - "CLOUDSDK_COMPUTE_ZONE", - }, nil) - - if zone != nil { - data.Zone = types.StringValue(zone.(string)) - } - } - - if len(data.Scopes.Elements()) == 0 { - var d diag.Diagnostics - data.Scopes, d = types.ListValueFrom(ctx, types.StringType, transport_tpg.DefaultClientScopes) - diags.Append(d...) - if diags.HasError() { - return - } - } - - if !data.Batching.IsNull() && !data.Batching.IsUnknown() { - var pbConfigs []fwmodels.ProviderBatching - d := data.Batching.ElementsAs(ctx, &pbConfigs, true) - diags.Append(d...) - if diags.HasError() { - return - } - - if pbConfigs[0].SendAfter.IsNull() || pbConfigs[0].SendAfter.IsUnknown() { - pbConfigs[0].SendAfter = types.StringValue("10s") - } - - if pbConfigs[0].EnableBatching.IsNull() || pbConfigs[0].EnableBatching.IsUnknown() { - pbConfigs[0].EnableBatching = types.BoolValue(true) - } - - data.Batching, d = types.ListValueFrom(ctx, types.ObjectType{}.WithAttributeTypes(fwmodels.ProviderBatchingAttributes), pbConfigs) - } - - if (data.UserProjectOverride.IsNull() || data.UserProjectOverride.IsUnknown()) && os.Getenv("USER_PROJECT_OVERRIDE") != "" { - override, err := strconv.ParseBool(os.Getenv("USER_PROJECT_OVERRIDE")) - if err != nil { - diags.AddError( - "error parsing environment variable `USER_PROJECT_OVERRIDE` into bool", err.Error()) - } - data.UserProjectOverride = types.BoolValue(override) - } - - if (data.RequestReason.IsNull() || data.RequestReason.IsUnknown()) && os.Getenv("CLOUDSDK_CORE_REQUEST_REASON") != "" { - data.RequestReason = types.StringValue(os.Getenv("CLOUDSDK_CORE_REQUEST_REASON")) - } - - if data.RequestTimeout.IsNull() || data.RequestTimeout.IsUnknown() { - data.RequestTimeout = types.StringValue("120s") - } - - // Generated Products -{{- range $product := $.Products }} - if data.{{ $product.Name }}CustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_{{ upper (underscore $product.Name) }}_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.{{ $product.Name }}BasePathKey]) - if customEndpoint != nil { - data.{{ $product.Name }}CustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } -{{- end }} - - // Handwritten Products / Versioned / Atypical Entries - if data.CloudBillingCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_CLOUD_BILLING_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths["cloud_billing_custom_endpoint"]) - if customEndpoint != nil { - data.CloudBillingCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.ComposerCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_COMPOSER_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.ComposerBasePathKey]) - if customEndpoint != nil { - data.ComposerCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.ContainerCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_CONTAINER_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.ContainerBasePathKey]) - if customEndpoint != nil { - data.ContainerCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.DataflowCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_DATAFLOW_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.DataflowBasePathKey]) - if customEndpoint != nil { - data.DataflowCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.IamCredentialsCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_IAM_CREDENTIALS_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.IamCredentialsBasePathKey]) - if customEndpoint != nil { - data.IamCredentialsCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.ResourceManagerV3CustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_RESOURCE_MANAGER_V3_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.ResourceManagerV3BasePathKey]) - if customEndpoint != nil { - data.ResourceManagerV3CustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - -{{ if ne $.TargetVersionName `ga` -}} - if data.RuntimeConfigCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_RUNTIMECONFIG_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.RuntimeConfigBasePathKey]) - if customEndpoint != nil { - data.RuntimeConfigCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } -{{- end }} - - if data.IAMCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_IAM_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.IAMBasePathKey]) - if customEndpoint != nil { - data.IAMCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.ServiceNetworkingCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_SERVICE_NETWORKING_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.ServiceNetworkingBasePathKey]) - if customEndpoint != nil { - data.ServiceNetworkingCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.TagsLocationCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_TAGS_LOCATION_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.TagsLocationBasePathKey]) - if customEndpoint != nil { - data.TagsLocationCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - // dcl - if data.ContainerAwsCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_CONTAINERAWS_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.ContainerAwsBasePathKey]) - if customEndpoint != nil { - data.ContainerAwsCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.ContainerAzureCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_CONTAINERAZURE_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.ContainerAzureBasePathKey]) - if customEndpoint != nil { - data.ContainerAzureCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - // DCL generated defaults - if data.ApikeysCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_APIKEYS_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.ApikeysCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.AssuredWorkloadsCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_ASSURED_WORKLOADS_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.AssuredWorkloadsCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.CloudBuildWorkerPoolCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_CLOUD_BUILD_WORKER_POOL_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.CloudBuildWorkerPoolCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.CloudResourceManagerCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_CLOUD_RESOURCE_MANAGER_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.CloudResourceManagerCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.DataplexCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_DATAPLEX_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.DataplexCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.EventarcCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_EVENTARC_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.EventarcCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.FirebaserulesCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_FIREBASERULES_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.FirebaserulesCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.NetworkConnectivityCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_NETWORK_CONNECTIVITY_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.NetworkConnectivityCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } - - if data.RecaptchaEnterpriseCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_RECAPTCHA_ENTERPRISE_CUSTOM_ENDPOINT", - }, "") - if customEndpoint != nil { - data.RecaptchaEnterpriseCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } -} - -func (p *FrameworkProviderConfig) SetupClient(ctx context.Context, data fwmodels.ProviderModel, diags *diag.Diagnostics) { - tokenSource := GetTokenSource(ctx, data, false, diags) - if diags.HasError() { - return - } - - cleanCtx := context.WithValue(ctx, oauth2.HTTPClient, cleanhttp.DefaultClient()) - - // 1. MTLS TRANSPORT/CLIENT - sets up proper auth headers - client, _, err := transport.NewHTTPClient(cleanCtx, option.WithTokenSource(tokenSource)) - if err != nil { - diags.AddError("error creating new http client", err.Error()) - return - } - - // Userinfo is fetched before request logging is enabled to reduce additional noise. - p.logGoogleIdentities(ctx, data, diags) - if diags.HasError() { - return - } - - // 2. Logging Transport - ensure we log HTTP requests to GCP APIs. - loggingTransport := logging.NewTransport("Google", client.Transport) - - // 3. Retry Transport - retries common temporary errors - // Keep order for wrapping logging so we log each retried request as well. - // This value should be used if needed to create shallow copies with additional retry predicates. - // See ClientWithAdditionalRetries - retryTransport := transport_tpg.NewTransportWithDefaultRetries(loggingTransport) - - // 4. Header Transport - outer wrapper to inject additional headers we want to apply - // before making requests - headerTransport := transport_tpg.NewTransportWithHeaders(retryTransport) - if !data.RequestReason.IsNull() { - headerTransport.Set("X-Goog-Request-Reason", data.RequestReason.ValueString()) - } - - // Ensure $userProject is set for all HTTP requests using the client if specified by the provider config - // See https://cloud.google.com/apis/docs/system-parameters - if data.UserProjectOverride.ValueBool() && !data.BillingProject.IsNull() { - headerTransport.Set("X-Goog-User-Project", data.BillingProject.ValueString()) - } - - // Set final transport value. - client.Transport = headerTransport - - // This timeout is a timeout per HTTP request, not per logical operation. - timeout, err := time.ParseDuration(data.RequestTimeout.ValueString()) - if err != nil { - diags.AddError("error parsing request timeout", err.Error()) - } - client.Timeout = timeout - - p.TokenSource = tokenSource - p.Client = client -} - -func (p *FrameworkProviderConfig) SetupGrpcLogging() { - logger := logrus.StandardLogger() - - logrus.SetLevel(logrus.DebugLevel) - logrus.SetFormatter(&transport_tpg.Formatter{ - TimestampFormat: "2006/01/02 15:04:05", - LogFormat: "%time% [%lvl%] %msg% \n", - }) - - alwaysLoggingDeciderClient := func(ctx context.Context, fullMethodName string) bool { return true } - grpc_logrus.ReplaceGrpcLogger(logrus.NewEntry(logger)) - - p.gRPCLoggingOptions = append( - p.gRPCLoggingOptions, option.WithGRPCDialOption(grpc.WithUnaryInterceptor( - grpc_logrus.PayloadUnaryClientInterceptor(logrus.NewEntry(logger), alwaysLoggingDeciderClient))), - option.WithGRPCDialOption(grpc.WithStreamInterceptor( - grpc_logrus.PayloadStreamClientInterceptor(logrus.NewEntry(logger), alwaysLoggingDeciderClient))), - ) -} - -func (p *FrameworkProviderConfig) logGoogleIdentities(ctx context.Context, data fwmodels.ProviderModel, diags *diag.Diagnostics) { - // GetCurrentUserEmailFramework doesn't pass an error back from logGoogleIdentities, so we want - // a separate diagnostics here - var d diag.Diagnostics - - if data.ImpersonateServiceAccount.IsNull() || data.ImpersonateServiceAccount.IsUnknown() { - - tokenSource := GetTokenSource(ctx, data, true, diags) - if diags.HasError() { - return - } - - p.Client = oauth2.NewClient(ctx, tokenSource) // p.Client isn't initialised fully when this code is called. - - email := GetCurrentUserEmailFramework(p, p.UserAgent, &d) - if d.HasError() { - tflog.Info(ctx, "error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope?") - } - - tflog.Info(ctx, fmt.Sprintf("Terraform is using this identity: %s", email)) - return - } - - // Drop Impersonated ClientOption from OAuth2 TokenSource to infer original identity - tokenSource := GetTokenSource(ctx, data, true, diags) - if diags.HasError() { - return - } - - p.Client = oauth2.NewClient(ctx, tokenSource) // p.Client isn't initialised fully when this code is called. - email := GetCurrentUserEmailFramework(p, p.UserAgent, &d) - if d.HasError() { - tflog.Info(ctx, "error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope?") - } - - tflog.Info(ctx, fmt.Sprintf("Terraform is configured with service account impersonation, original identity: %s, impersonated identity: %s", email, data.ImpersonateServiceAccount.ValueString())) - - // Add the Impersonated ClientOption back in to the OAuth2 TokenSource - tokenSource = GetTokenSource(ctx, data, false, diags) - if diags.HasError() { - return - } - - p.Client = oauth2.NewClient(ctx, tokenSource) // p.Client isn't initialised fully when this code is called. - - return -} - -// Configuration helpers - -// GetTokenSource gets token source based on the Google Credentials configured. -// If initialCredentialsOnly is true, don't follow the impersonation settings and return the initial set of creds. -func GetTokenSource(ctx context.Context, data fwmodels.ProviderModel, initialCredentialsOnly bool, diags *diag.Diagnostics) oauth2.TokenSource { - creds := GetCredentials(ctx, data, initialCredentialsOnly, diags) - - return creds.TokenSource -} - -// GetCredentials gets credentials with a given scope (clientScopes). -// If initialCredentialsOnly is true, don't follow the impersonation -// settings and return the initial set of creds instead. -func GetCredentials(ctx context.Context, data fwmodels.ProviderModel, initialCredentialsOnly bool, diags *diag.Diagnostics) googleoauth.Credentials { - var clientScopes []string - var delegates []string - - if !data.Scopes.IsNull() && !data.Scopes.IsUnknown() { - d := data.Scopes.ElementsAs(ctx, &clientScopes, false) - diags.Append(d...) - if diags.HasError() { - return googleoauth.Credentials{} - } - } - - if !data.ImpersonateServiceAccountDelegates.IsNull() && !data.ImpersonateServiceAccountDelegates.IsUnknown() { - d := data.ImpersonateServiceAccountDelegates.ElementsAs(ctx, &delegates, false) - diags.Append(d...) - if diags.HasError() { - return googleoauth.Credentials{} - } - } - - if !data.AccessToken.IsNull() && !data.AccessToken.IsUnknown() { - contents, _, err := verify.PathOrContents(data.AccessToken.ValueString()) - if err != nil { - diags.AddError("error loading access token", err.Error()) - return googleoauth.Credentials{} - } - - token := &oauth2.Token{AccessToken: contents} - if !data.ImpersonateServiceAccount.IsNull() && !initialCredentialsOnly { - opts := []option.ClientOption{option.WithTokenSource(oauth2.StaticTokenSource(token)), option.ImpersonateCredentials(data.ImpersonateServiceAccount.ValueString(), delegates...), option.WithScopes(clientScopes...)} - creds, err := transport.Creds(context.TODO(), opts...) - if err != nil { - diags.AddError("error impersonating credentials", err.Error()) - return googleoauth.Credentials{} - } - return *creds - } - - tflog.Info(ctx, "Authenticating using configured Google JSON 'access_token'...") - tflog.Info(ctx, fmt.Sprintf(" -- Scopes: %s", clientScopes)) - return googleoauth.Credentials{ - TokenSource: transport_tpg.StaticTokenSource{oauth2.StaticTokenSource(token)}, - } - } - - if !data.Credentials.IsNull() && !data.Credentials.IsUnknown() { - contents, _, err := verify.PathOrContents(data.Credentials.ValueString()) - if err != nil { - diags.AddError(fmt.Sprintf("error loading credentials: %s", err), err.Error()) - return googleoauth.Credentials{} - } - if len(contents) == 0 { - diags.AddError("error loading credentials", "provided credentials are empty") - return googleoauth.Credentials{} - } - - if !data.ImpersonateServiceAccount.IsNull() && !initialCredentialsOnly { - opts := []option.ClientOption{option.WithCredentialsJSON([]byte(contents)), option.ImpersonateCredentials(data.ImpersonateServiceAccount.ValueString(), delegates...), option.WithScopes(clientScopes...)} - creds, err := transport.Creds(context.TODO(), opts...) - if err != nil { - diags.AddError("error impersonating credentials", err.Error()) - return googleoauth.Credentials{} - } - return *creds - } - - creds, err := transport.Creds(ctx, option.WithCredentialsJSON([]byte(contents)), option.WithScopes(clientScopes...)) - if err != nil { - diags.AddError("unable to parse credentials", err.Error()) - return googleoauth.Credentials{} - } - - tflog.Info(ctx, "Authenticating using configured Google JSON 'credentials'...") - tflog.Info(ctx, fmt.Sprintf(" -- Scopes: %s", clientScopes)) - return *creds - } - - if !data.ImpersonateServiceAccount.IsNull() && !initialCredentialsOnly { - opts := option.ImpersonateCredentials(data.ImpersonateServiceAccount.ValueString(), delegates...) - creds, err := transport.Creds(context.TODO(), opts, option.WithScopes(clientScopes...)) - if err != nil { - diags.AddError("error impersonating credentials", err.Error()) - return googleoauth.Credentials{} - } - - return *creds - } - - tflog.Info(ctx, "Authenticating using DefaultClient...") - tflog.Info(ctx, fmt.Sprintf(" -- Scopes: %s", clientScopes)) - creds, err := transport.Creds(context.Background(), option.WithScopes(clientScopes...)) - if err != nil { - diags.AddError(fmt.Sprintf("Attempted to load application default credentials since neither `credentials` nor `access_token` was set in the provider block. "+ - "No credentials loaded. To use your gcloud credentials, run 'gcloud auth application-default login'"), err.Error()) - return googleoauth.Credentials{} - } - - return *creds -} - -// GetBatchingConfig returns the batching config object given the -// provider configuration set for batching -func GetBatchingConfig(ctx context.Context, data types.List, diags *diag.Diagnostics) *transport_tpg.BatchingConfig { - bc := &transport_tpg.BatchingConfig{ - SendAfter: time.Second * transport_tpg.DefaultBatchSendIntervalSec, - EnableBatching: true, - } - - // Handle if entire batching block is null/unknown - if data.IsNull() || data.IsUnknown() { - return bc - } - - var pbConfigs []fwmodels.ProviderBatching - d := data.ElementsAs(ctx, &pbConfigs, true) - diags.Append(d...) - if diags.HasError() { - return bc - } - - sendAfter, err := time.ParseDuration(pbConfigs[0].SendAfter.ValueString()) - if err != nil { - diags.AddError("error parsing send after time duration", err.Error()) - return bc - } - - bc.SendAfter = sendAfter - - if !pbConfigs[0].EnableBatching.IsNull() { - bc.EnableBatching = pbConfigs[0].EnableBatching.ValueBool() - } - - return bc -} - -func GetRegionFromRegionSelfLink(selfLink basetypes.StringValue) basetypes.StringValue { - re := regexp.MustCompile("/compute/[a-zA-Z0-9]*/projects/[a-zA-Z0-9-]*/regions/([a-zA-Z0-9-]*)") - value := selfLink.String() - switch { - case re.MatchString(value): - if res := re.FindStringSubmatch(value); len(res) == 2 && res[1] != "" { - region := res[1] - return types.StringValue(region) - } - } - return selfLink -} diff --git a/mmv1/third_party/terraform/fwtransport/go/framework_provider_clients.go.tmpl b/mmv1/third_party/terraform/fwtransport/go/framework_provider_clients.go.tmpl deleted file mode 100644 index 1001fa557202..000000000000 --- a/mmv1/third_party/terraform/fwtransport/go/framework_provider_clients.go.tmpl +++ /dev/null @@ -1,55 +0,0 @@ -package fwtransport - -import ( - "fmt" - "strings" - - "google.golang.org/api/dns/v1" -{{- if ne $.TargetVersionName "ga" }} - firebase "google.golang.org/api/firebase/v1beta1" -{{- end }} - "google.golang.org/api/option" - - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-log/tflog" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Methods to create new services from config -// Some base paths below need the version and possibly more of the path -// set on them. The client libraries are inconsistent about which values they need; -// while most only want the host URL, some older ones also want the version and some -// of those "projects" as well. You can find out if this is required by looking at -// the basePath value in the client library file. - -func (p *FrameworkProviderConfig) NewDnsClient(userAgent string, diags *diag.Diagnostics) *dns.Service { - dnsClientBasePath := transport_tpg.RemoveBasePathVersion(p.DNSBasePath) - dnsClientBasePath = strings.ReplaceAll(dnsClientBasePath, "/dns/", "") - tflog.Info(p.Context, fmt.Sprintf("Instantiating Google Cloud DNS client for path %s", dnsClientBasePath)) - clientDns, err := dns.NewService(p.Context, option.WithHTTPClient(p.Client)) - if err != nil { - diags.AddWarning("error creating client dns", err.Error()) - return nil - } - clientDns.UserAgent = userAgent - clientDns.BasePath = dnsClientBasePath - - return clientDns -} - -{{ if ne $.TargetVersionName `ga` -}} -func (p *FrameworkProviderConfig) NewFirebaseClient(userAgent string, diags *diag.Diagnostics) *firebase.Service { - firebaseClientBasePath := transport_tpg.RemoveBasePathVersion(p.FirebaseBasePath) - firebaseClientBasePath = strings.ReplaceAll(firebaseClientBasePath, "/firebase/", "") - tflog.Info(p.Context, fmt.Sprintf("Instantiating Google Cloud firebase client for path %s", firebaseClientBasePath)) - clientFirebase, err := firebase.NewService(p.Context, option.WithHTTPClient(p.Client)) - if err != nil { - diags.AddWarning("error creating client firebase", err.Error()) - return nil - } - clientFirebase.UserAgent = userAgent - clientFirebase.BasePath = firebaseClientBasePath - - return clientFirebase -} -{{- end }} diff --git a/mmv1/third_party/terraform/provider/go/provider.go.tmpl b/mmv1/third_party/terraform/provider/go/provider.go.tmpl deleted file mode 100644 index bece351a6b7f..000000000000 --- a/mmv1/third_party/terraform/provider/go/provider.go.tmpl +++ /dev/null @@ -1,416 +0,0 @@ -package provider - -import ( - "context" - "fmt" - "os" - "strings" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/version" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "github.com/hashicorp/terraform-provider-google/google/verify" -) - -// Provider returns a *schema.Provider. -func Provider() *schema.Provider { - - // The mtls service client gives the type of endpoint (mtls/regular) - // at client creation. Since we use a shared client for requests we must - // rewrite the endpoints to be mtls endpoints for the scenario where - // mtls is enabled. - if isMtls() { - // if mtls is enabled switch all default endpoints to use the mtls endpoint - for key, bp := range transport_tpg.DefaultBasePaths { - transport_tpg.DefaultBasePaths[key] = getMtlsEndpoint(bp) - } - } - - provider := &schema.Provider{ - Schema: map[string]*schema.Schema{ - "credentials": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCredentials, - ConflictsWith: []string{"access_token"}, - }, - - "access_token": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateEmptyStrings, - ConflictsWith: []string{"credentials"}, - }, - - "impersonate_service_account": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateEmptyStrings, - }, - - "impersonate_service_account_delegates": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - - "project": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateEmptyStrings, - }, - - "billing_project": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateEmptyStrings, - }, - - "region": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateEmptyStrings, - }, - - "zone": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateEmptyStrings, - }, - - "scopes": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - - "universe_domain": { - Type: schema.TypeString, - Optional: true, - }, - - "batching": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "send_after": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidateNonNegativeDuration(), - }, - "enable_batching": { - Type: schema.TypeBool, - Optional: true, - }, - }, - }, - }, - - "user_project_override": { - Type: schema.TypeBool, - Optional: true, - }, - - "request_timeout": { - Type: schema.TypeString, - Optional: true, - }, - - "request_reason": { - Type: schema.TypeString, - Optional: true, - }, - - "default_labels": { - Type: schema.TypeMap, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - - "add_terraform_attribution_label": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - - "terraform_attribution_label_addition_strategy": { - Type: schema.TypeString, - Optional: true, - }, - - // Generated Products - {{- range $product := $.Products }} - "{{ underscore $product.Name }}_custom_endpoint": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: transport_tpg.ValidateCustomEndpoint, - }, - {{- end }} - - // Handwritten Products / Versioned / Atypical Entries - transport_tpg.CloudBillingCustomEndpointEntryKey: transport_tpg.CloudBillingCustomEndpointEntry, - transport_tpg.ComposerCustomEndpointEntryKey: transport_tpg.ComposerCustomEndpointEntry, - transport_tpg.ContainerCustomEndpointEntryKey: transport_tpg.ContainerCustomEndpointEntry, - transport_tpg.DataflowCustomEndpointEntryKey: transport_tpg.DataflowCustomEndpointEntry, - transport_tpg.IamCredentialsCustomEndpointEntryKey: transport_tpg.IamCredentialsCustomEndpointEntry, - transport_tpg.ResourceManagerV3CustomEndpointEntryKey: transport_tpg.ResourceManagerV3CustomEndpointEntry, - {{- if ne $.TargetVersionName "ga" }} - transport_tpg.RuntimeConfigCustomEndpointEntryKey: transport_tpg.RuntimeConfigCustomEndpointEntry, - {{- end }} - transport_tpg.IAMCustomEndpointEntryKey: transport_tpg.IAMCustomEndpointEntry, - transport_tpg.ServiceNetworkingCustomEndpointEntryKey: transport_tpg.ServiceNetworkingCustomEndpointEntry, - transport_tpg.TagsLocationCustomEndpointEntryKey: transport_tpg.TagsLocationCustomEndpointEntry, - - // dcl - transport_tpg.ContainerAwsCustomEndpointEntryKey: transport_tpg.ContainerAwsCustomEndpointEntry, - transport_tpg.ContainerAzureCustomEndpointEntryKey: transport_tpg.ContainerAzureCustomEndpointEntry, - }, - - ProviderMetaSchema: map[string]*schema.Schema{ - "module_name": { - Type: schema.TypeString, - Optional: true, - }, - }, - - DataSourcesMap: DatasourceMap(), - ResourcesMap: ResourceMap(), - } - - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { - return ProviderConfigure(ctx, d, provider) - } - - transport_tpg.ConfigureDCLProvider(provider) - - return provider -} - -func DatasourceMap() map[string]*schema.Resource { - datasourceMap, _ := DatasourceMapWithErrors() - return datasourceMap -} - -func DatasourceMapWithErrors() (map[string]*schema.Resource, error) { - return mergeResourceMaps( - handwrittenDatasources, - generatedIAMDatasources, - handwrittenIAMDatasources, - ) -} - -func ResourceMap() map[string]*schema.Resource { - resourceMap, _ := ResourceMapWithErrors() - return resourceMap -} - -func ResourceMapWithErrors() (map[string]*schema.Resource, error) { - return mergeResourceMaps( - generatedResources, - handwrittenResources, - handwrittenIAMResources, - dclResources, - ) -} - -func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Provider) (interface{}, diag.Diagnostics) { - err := transport_tpg.HandleSDKDefaults(d) - if err != nil { - return nil, diag.FromErr(err) - } - - config := transport_tpg.Config{ - Project: d.Get("project").(string), - Region: d.Get("region").(string), - Zone: d.Get("zone").(string), - UserProjectOverride: d.Get("user_project_override").(bool), - BillingProject: d.Get("billing_project").(string), -{{- if or (eq $.TargetVersionName "") (eq $.TargetVersionName "ga") }} - UserAgent: p.UserAgent("terraform-provider-google", version.ProviderVersion), -{{- else }} - UserAgent: p.UserAgent("terraform-provider-google-{{ $.TargetVersionName }}", version.ProviderVersion), -{{- end }} - } - - // opt in extension for adding to the User-Agent header - if ext := os.Getenv("GOOGLE_TERRAFORM_USERAGENT_EXTENSION"); ext != "" { - ua := config.UserAgent - config.UserAgent = fmt.Sprintf("%s %s", ua, ext) - } - - if v, ok := d.GetOk("request_timeout"); ok { - var err error - config.RequestTimeout, err = time.ParseDuration(v.(string)) - if err != nil { - return nil, diag.FromErr(err) - } - } - - if v, ok := d.GetOk("request_reason"); ok { - config.RequestReason = v.(string) - } - - // Check for primary credentials in config. Note that if neither is set, ADCs - // will be used if available. - if v, ok := d.GetOk("access_token"); ok { - config.AccessToken = v.(string) - } - - if v, ok := d.GetOk("credentials"); ok { - config.Credentials = v.(string) - } - - // only check environment variables if neither value was set in config- this - // means config beats env var in all cases. - if config.AccessToken == "" && config.Credentials == "" { - config.Credentials = transport_tpg.MultiEnvSearch([]string{ - "GOOGLE_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON", - }) - - config.AccessToken = transport_tpg.MultiEnvSearch([]string{ - "GOOGLE_OAUTH_ACCESS_TOKEN", - }) - } - - // Set the universe domain to the configured value, if any - if v, ok := d.GetOk("universe_domain"); ok { - config.UniverseDomain = v.(string) - } - - // Configure DCL basePath - transport_tpg.ProviderDCLConfigure(d, &config) - - // Replace hostname by the universe_domain field. - if config.UniverseDomain != "" && config.UniverseDomain != "googleapis.com" { - for key, basePath := range transport_tpg.DefaultBasePaths { - transport_tpg.DefaultBasePaths[key] = strings.ReplaceAll(basePath, "googleapis.com", config.UniverseDomain) - } - } - - err = transport_tpg.SetEndpointDefaults(d) - if err != nil { - return nil, diag.FromErr(err) - } - transport_tpg.HandleDCLCustomEndpointDefaults(d) - - // Given that impersonate_service_account is a secondary auth method, it has - // no conflicts to worry about. We pull the env var in a DefaultFunc. - if v, ok := d.GetOk("impersonate_service_account"); ok { - config.ImpersonateServiceAccount = v.(string) - } - - delegates := d.Get("impersonate_service_account_delegates").([]interface{}) - if len(delegates) > 0 { - config.ImpersonateServiceAccountDelegates = make([]string, len(delegates)) - } - for i, delegate := range delegates { - config.ImpersonateServiceAccountDelegates[i] = delegate.(string) - } - - scopes := d.Get("scopes").([]interface{}) - if len(scopes) > 0 { - config.Scopes = make([]string, len(scopes)) - } - for i, scope := range scopes { - config.Scopes[i] = scope.(string) - } - - config.DefaultLabels = make(map[string]string) - defaultLabels := d.Get("default_labels").(map[string]interface{}) - - for k, v := range defaultLabels { - config.DefaultLabels[k] = v.(string) - } - - config.AddTerraformAttributionLabel = d.Get("add_terraform_attribution_label").(bool) - if config.AddTerraformAttributionLabel { - config.TerraformAttributionLabelAdditionStrategy = transport_tpg.CreateOnlyAttributionStrategy - if v, ok := d.GetOk("terraform_attribution_label_addition_strategy"); ok { - config.TerraformAttributionLabelAdditionStrategy = v.(string) - } - switch config.TerraformAttributionLabelAdditionStrategy { - case transport_tpg.CreateOnlyAttributionStrategy, transport_tpg.ProactiveAttributionStrategy: - default: - return nil, diag.FromErr(fmt.Errorf("unrecognized terraform_attribution_label_addition_strategy %q", config.TerraformAttributionLabelAdditionStrategy)) - } - } - - batchCfg, err := transport_tpg.ExpandProviderBatchingConfig(d.Get("batching")) - if err != nil { - return nil, diag.FromErr(err) - } - config.BatchingConfig = batchCfg - - // Generated products - {{- range $product := $.Products }} - config.{{ $product.Name }}BasePath = d.Get("{{ underscore $product.Name }}_custom_endpoint").(string) - {{- end }} - - // Handwritten Products / Versioned / Atypical Entries - config.CloudBillingBasePath = d.Get(transport_tpg.CloudBillingCustomEndpointEntryKey).(string) - config.ComposerBasePath = d.Get(transport_tpg.ComposerCustomEndpointEntryKey).(string) - config.ContainerBasePath = d.Get(transport_tpg.ContainerCustomEndpointEntryKey).(string) - config.DataflowBasePath = d.Get(transport_tpg.DataflowCustomEndpointEntryKey).(string) - config.IamCredentialsBasePath = d.Get(transport_tpg.IamCredentialsCustomEndpointEntryKey).(string) - config.ResourceManagerV3BasePath = d.Get(transport_tpg.ResourceManagerV3CustomEndpointEntryKey).(string) - {{- if ne $.TargetVersionName "ga" }} - config.RuntimeConfigBasePath = d.Get(transport_tpg.RuntimeConfigCustomEndpointEntryKey).(string) - {{- end }} - config.IAMBasePath = d.Get(transport_tpg.IAMCustomEndpointEntryKey).(string) - config.ServiceUsageBasePath = d.Get(transport_tpg.ServiceUsageCustomEndpointEntryKey).(string) - config.BigtableAdminBasePath = d.Get(transport_tpg.BigtableAdminCustomEndpointEntryKey).(string) - config.TagsLocationBasePath = d.Get(transport_tpg.TagsLocationCustomEndpointEntryKey).(string) - - // dcl - config.ContainerAwsBasePath = d.Get(transport_tpg.ContainerAwsCustomEndpointEntryKey).(string) - config.ContainerAzureBasePath = d.Get(transport_tpg.ContainerAzureCustomEndpointEntryKey).(string) - - stopCtx, ok := schema.StopContext(ctx) - if !ok { - stopCtx = ctx - } - if err := config.LoadAndValidate(stopCtx); err != nil { - return nil, diag.FromErr(err) - } - - // Verify that universe domains match between credentials and configuration - if v, ok := d.GetOk("universe_domain"); ok { - if config.UniverseDomain == "" && v.(string) != "googleapis.com" { // v can't be "", as it wouldn't pass `ok` above - return nil, diag.FromErr(fmt.Errorf("Universe domain mismatch: '%s' supplied directly to Terraform with no matching universe domain in credentials. Credentials with no 'universe_domain' set are assumed to be in the default universe.", v)) - } else if v.(string) != config.UniverseDomain && !(config.UniverseDomain == "" && v.(string) == "googleapis.com") { - return nil, diag.FromErr(fmt.Errorf("Universe domain mismatch: '%s' does not match the universe domain '%s' supplied directly to Terraform. The 'universe_domain' provider configuration must match the universe domain supplied by credentials.", config.UniverseDomain, v)) - } - } else if config.UniverseDomain != "" && config.UniverseDomain != "googleapis.com" { - return nil, diag.FromErr(fmt.Errorf("Universe domain mismatch: Universe domain '%s' was found in credentials without a corresponding 'universe_domain' provider configuration set. Please set 'universe_domain' to '%s' or use different credentials.", config.UniverseDomain, config.UniverseDomain)) - } - - return &config, nil -} - -func mergeResourceMaps(ms ...map[string]*schema.Resource) (map[string]*schema.Resource, error) { - merged := make(map[string]*schema.Resource) - duplicates := []string{} - - for _, m := range ms { - for k, v := range m { - if _, ok := merged[k]; ok { - duplicates = append(duplicates, k) - } - - merged[k] = v - } - } - - var err error - if len(duplicates) > 0 { - err = fmt.Errorf("saw duplicates in mergeResourceMaps: %v", duplicates) - } - - return merged, err -} diff --git a/mmv1/third_party/terraform/provider/go/provider_mmv1_resources.go.tmpl b/mmv1/third_party/terraform/provider/go/provider_mmv1_resources.go.tmpl deleted file mode 100644 index 51881c4c2df0..000000000000 --- a/mmv1/third_party/terraform/provider/go/provider_mmv1_resources.go.tmpl +++ /dev/null @@ -1,457 +0,0 @@ -package provider - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - {{- range $service := $.GetMmv1ServicesInVersion $.Products }} - "github.com/hashicorp/terraform-provider-google/google/services/{{ $service }}" - {{- end }} - - {{ if eq $.TargetVersionName `ga` }} - "github.com/hashicorp/terraform-provider-google/google/services/composer" - {{- end }} - "github.com/hashicorp/terraform-provider-google/google/services/container" - "github.com/hashicorp/terraform-provider-google/google/services/containeraws" - "github.com/hashicorp/terraform-provider-google/google/services/containerazure" - "github.com/hashicorp/terraform-provider-google/google/services/dataflow" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" -) - -// Datasources -var handwrittenDatasources = map[string]*schema.Resource{ - // ####### START handwritten datasources ########### - "google_access_approval_folder_service_account": accessapproval.DataSourceAccessApprovalFolderServiceAccount(), - "google_access_approval_organization_service_account": accessapproval.DataSourceAccessApprovalOrganizationServiceAccount(), - "google_access_approval_project_service_account": accessapproval.DataSourceAccessApprovalProjectServiceAccount(), - "google_active_folder": resourcemanager.DataSourceGoogleActiveFolder(), - "google_alloydb_locations": alloydb.DataSourceAlloydbLocations(), - "google_alloydb_supported_database_flags": alloydb.DataSourceAlloydbSupportedDatabaseFlags(), - "google_artifact_registry_docker_image": artifactregistry.DataSourceArtifactRegistryDockerImage(), - "google_artifact_registry_locations": artifactregistry.DataSourceGoogleArtifactRegistryLocations(), - "google_artifact_registry_repository": artifactregistry.DataSourceArtifactRegistryRepository(), - "google_apphub_discovered_workload": apphub.DataSourceApphubDiscoveredWorkload(), - "google_app_engine_default_service_account": appengine.DataSourceGoogleAppEngineDefaultServiceAccount(), - "google_apphub_application": apphub.DataSourceGoogleApphubApplication(), - "google_apphub_discovered_service": apphub.DataSourceApphubDiscoveredService(), - {{- if ne $.TargetVersionName "ga" }} - "google_backup_dr_management_server": backupdr.DataSourceGoogleCloudBackupDRService(), - {{- end }} - "google_beyondcorp_app_connection": beyondcorp.DataSourceGoogleBeyondcorpAppConnection(), - "google_beyondcorp_app_connector": beyondcorp.DataSourceGoogleBeyondcorpAppConnector(), - "google_beyondcorp_app_gateway": beyondcorp.DataSourceGoogleBeyondcorpAppGateway(), - "google_billing_account": billing.DataSourceGoogleBillingAccount(), - "google_bigquery_tables": bigquery.DataSourceGoogleBigQueryTables(), - "google_bigquery_dataset": bigquery.DataSourceGoogleBigqueryDataset(), - "google_bigquery_default_service_account": bigquery.DataSourceGoogleBigqueryDefaultServiceAccount(), - "google_certificate_manager_certificates": certificatemanager.DataSourceGoogleCertificateManagerCertificates(), - "google_certificate_manager_certificate_map": certificatemanager.DataSourceGoogleCertificateManagerCertificateMap(), - "google_cloudbuild_trigger": cloudbuild.DataSourceGoogleCloudBuildTrigger(), - "google_cloudfunctions_function": cloudfunctions.DataSourceGoogleCloudFunctionsFunction(), - "google_cloudfunctions2_function": cloudfunctions2.DataSourceGoogleCloudFunctions2Function(), - {{- if ne $.TargetVersionName "ga" }} - "google_cloud_asset_resources_search_all": cloudasset.DataSourceGoogleCloudAssetResourcesSearchAll(), - {{- end }} - "google_cloud_asset_search_all_resources": cloudasset.DataSourceGoogleCloudAssetSearchAllResources(), - "google_cloud_identity_groups": cloudidentity.DataSourceGoogleCloudIdentityGroups(), - "google_cloud_identity_group_memberships": cloudidentity.DataSourceGoogleCloudIdentityGroupMemberships(), - "google_cloud_identity_group_transitive_memberships": cloudidentity.DataSourceGoogleCloudIdentityGroupTransitiveMemberships(), - "google_cloud_identity_group_lookup": cloudidentity.DataSourceGoogleCloudIdentityGroupLookup(), - "google_cloud_quotas_quota_info": cloudquotas.DataSourceGoogleCloudQuotasQuotaInfo(), - "google_cloud_quotas_quota_infos": cloudquotas.DataSourceGoogleCloudQuotasQuotaInfos(), - "google_cloud_run_locations": cloudrun.DataSourceGoogleCloudRunLocations(), - "google_cloud_run_service": cloudrun.DataSourceGoogleCloudRunService(), - "google_cloud_run_v2_job": cloudrunv2.DataSourceGoogleCloudRunV2Job(), - "google_cloud_run_v2_service": cloudrunv2.DataSourceGoogleCloudRunV2Service(), - "google_composer_environment": composer.DataSourceGoogleComposerEnvironment(), - {{- if ne $.TargetVersionName "ga" }} - "google_composer_user_workloads_config_map": composer.DataSourceGoogleComposerUserWorkloadsConfigMap(), - "google_composer_user_workloads_secret": composer.DataSourceGoogleComposerUserWorkloadsSecret(), - {{- end }} - "google_composer_image_versions": composer.DataSourceGoogleComposerImageVersions(), - "google_compute_address": compute.DataSourceGoogleComputeAddress(), - "google_compute_addresses": compute.DataSourceGoogleComputeAddresses(), - "google_compute_backend_service": compute.DataSourceGoogleComputeBackendService(), - "google_compute_backend_bucket": compute.DataSourceGoogleComputeBackendBucket(), - "google_compute_default_service_account": compute.DataSourceGoogleComputeDefaultServiceAccount(), - "google_compute_disk": compute.DataSourceGoogleComputeDisk(), - "google_compute_forwarding_rule": compute.DataSourceGoogleComputeForwardingRule(), - "google_compute_forwarding_rules": compute.DataSourceGoogleComputeForwardingRules(), - "google_compute_global_address": compute.DataSourceGoogleComputeGlobalAddress(), - "google_compute_global_forwarding_rule": compute.DataSourceGoogleComputeGlobalForwardingRule(), - "google_compute_ha_vpn_gateway": compute.DataSourceGoogleComputeHaVpnGateway(), - "google_compute_health_check": compute.DataSourceGoogleComputeHealthCheck(), - "google_compute_image": compute.DataSourceGoogleComputeImage(), - "google_compute_instance": compute.DataSourceGoogleComputeInstance(), - "google_compute_instance_group": compute.DataSourceGoogleComputeInstanceGroup(), - "google_compute_instance_group_manager": compute.DataSourceGoogleComputeInstanceGroupManager(), - "google_compute_instance_serial_port": compute.DataSourceGoogleComputeInstanceSerialPort(), - "google_compute_instance_template": compute.DataSourceGoogleComputeInstanceTemplate(), - "google_compute_lb_ip_ranges": compute.DataSourceGoogleComputeLbIpRanges(), - "google_compute_machine_types": compute.DataSourceGoogleComputeMachineTypes(), - "google_compute_network": compute.DataSourceGoogleComputeNetwork(), - "google_compute_networks": compute.DataSourceGoogleComputeNetworks(), - "google_compute_network_endpoint_group": compute.DataSourceGoogleComputeNetworkEndpointGroup(), - "google_compute_network_peering": compute.DataSourceComputeNetworkPeering(), - "google_compute_node_types": compute.DataSourceGoogleComputeNodeTypes(), - "google_compute_regions": compute.DataSourceGoogleComputeRegions(), - "google_compute_region_disk": compute.DataSourceGoogleComputeRegionDisk(), - "google_compute_region_instance_group": compute.DataSourceGoogleComputeRegionInstanceGroup(), - "google_compute_region_instance_template": compute.DataSourceGoogleComputeRegionInstanceTemplate(), - "google_compute_region_network_endpoint_group": compute.DataSourceGoogleComputeRegionNetworkEndpointGroup(), - "google_compute_region_ssl_certificate": compute.DataSourceGoogleRegionComputeSslCertificate(), - "google_compute_reservation": compute.DataSourceGoogleComputeReservation(), - "google_compute_resource_policy": compute.DataSourceGoogleComputeResourcePolicy(), - "google_compute_router": compute.DataSourceGoogleComputeRouter(), - "google_compute_router_nat": compute.DataSourceGoogleComputeRouterNat(), - "google_compute_router_status": compute.DataSourceGoogleComputeRouterStatus(), - "google_compute_security_policy": compute.DataSourceGoogleComputeSecurityPolicy(), - "google_compute_snapshot": compute.DataSourceGoogleComputeSnapshot(), - "google_compute_ssl_certificate": compute.DataSourceGoogleComputeSslCertificate(), - "google_compute_ssl_policy": compute.DataSourceGoogleComputeSslPolicy(), - "google_compute_subnetwork": compute.DataSourceGoogleComputeSubnetwork(), - "google_compute_subnetworks": compute.DataSourceGoogleComputeSubnetworks(), - "google_compute_vpn_gateway": compute.DataSourceGoogleComputeVpnGateway(), - "google_compute_zones": compute.DataSourceGoogleComputeZones(), - "google_container_azure_versions": containerazure.DataSourceGoogleContainerAzureVersions(), - "google_container_aws_versions": containeraws.DataSourceGoogleContainerAwsVersions(), - "google_container_attached_versions": containerattached.DataSourceGoogleContainerAttachedVersions(), - "google_container_attached_install_manifest": containerattached.DataSourceGoogleContainerAttachedInstallManifest(), - "google_container_cluster": container.DataSourceGoogleContainerCluster(), - "google_container_engine_versions": container.DataSourceGoogleContainerEngineVersions(), - "google_container_registry_image": containeranalysis.DataSourceGoogleContainerImage(), - "google_container_registry_repository": containeranalysis.DataSourceGoogleContainerRepo(), - "google_dataproc_metastore_service": dataprocmetastore.DataSourceDataprocMetastoreService(), - "google_datastream_static_ips": datastream.DataSourceGoogleDatastreamStaticIps(), - "google_dns_keys": dns.DataSourceDNSKeys(), - "google_dns_managed_zone": dns.DataSourceDnsManagedZone(), - "google_dns_managed_zones": dns.DataSourceDnsManagedZones(), - "google_dns_record_set": dns.DataSourceDnsRecordSet(), - "google_gke_hub_membership_binding": gkehub2.DataSourceGoogleGkeHubMembershipBinding(), - "google_filestore_instance": filestore.DataSourceGoogleFilestoreInstance(), - "google_iam_policy": resourcemanager.DataSourceGoogleIamPolicy(), - "google_iam_role": resourcemanager.DataSourceGoogleIamRole(), - "google_iam_testable_permissions": resourcemanager.DataSourceGoogleIamTestablePermissions(), - {{- if ne $.TargetVersionName "ga" }} - "google_iam_workload_identity_pool": iambeta.DataSourceIAMBetaWorkloadIdentityPool(), - "google_iam_workload_identity_pool_provider": iambeta.DataSourceIAMBetaWorkloadIdentityPoolProvider(), - {{- end }} - "google_iap_client": iap.DataSourceGoogleIapClient(), - "google_kms_crypto_key": kms.DataSourceGoogleKmsCryptoKey(), - "google_kms_crypto_keys": kms.DataSourceGoogleKmsCryptoKeys(), - "google_kms_crypto_key_version": kms.DataSourceGoogleKmsCryptoKeyVersion(), - "google_kms_crypto_key_latest_version": kms.DataSourceGoogleKmsLatestCryptoKeyVersion(), - "google_kms_crypto_key_versions": kms.DataSourceGoogleKmsCryptoKeyVersions(), - "google_kms_key_ring": kms.DataSourceGoogleKmsKeyRing(), - "google_kms_key_rings": kms.DataSourceGoogleKmsKeyRings(), - "google_kms_secret": kms.DataSourceGoogleKmsSecret(), - "google_kms_secret_ciphertext": kms.DataSourceGoogleKmsSecretCiphertext(), - {{- if ne $.TargetVersionName "ga" }} - "google_kms_secret_asymmetric": kms.DataSourceGoogleKmsSecretAsymmetric(), - "google_firebase_android_app": firebase.DataSourceGoogleFirebaseAndroidApp(), - "google_firebase_apple_app": firebase.DataSourceGoogleFirebaseAppleApp(), - "google_firebase_hosting_channel": firebasehosting.DataSourceGoogleFirebaseHostingChannel(), - "google_firebase_web_app": firebase.DataSourceGoogleFirebaseWebApp(), - {{- end }} - "google_folder": resourcemanager.DataSourceGoogleFolder(), - "google_folders": resourcemanager.DataSourceGoogleFolders(), - "google_folder_organization_policy": resourcemanager.DataSourceGoogleFolderOrganizationPolicy(), - "google_logging_folder_settings": logging.DataSourceGoogleLoggingFolderSettings(), - "google_logging_organization_settings": logging.DataSourceGoogleLoggingOrganizationSettings(), - "google_logging_project_cmek_settings": logging.DataSourceGoogleLoggingProjectCmekSettings(), - "google_logging_project_settings": logging.DataSourceGoogleLoggingProjectSettings(), - "google_logging_sink": logging.DataSourceGoogleLoggingSink(), - "google_monitoring_notification_channel": monitoring.DataSourceMonitoringNotificationChannel(), - "google_monitoring_cluster_istio_service": monitoring.DataSourceMonitoringServiceClusterIstio(), - "google_monitoring_istio_canonical_service": monitoring.DataSourceMonitoringIstioCanonicalService(), - "google_monitoring_mesh_istio_service": monitoring.DataSourceMonitoringServiceMeshIstio(), - "google_monitoring_app_engine_service": monitoring.DataSourceMonitoringServiceAppEngine(), - "google_monitoring_uptime_check_ips": monitoring.DataSourceGoogleMonitoringUptimeCheckIps(), - "google_netblock_ip_ranges": resourcemanager.DataSourceGoogleNetblockIpRanges(), - "google_organization": resourcemanager.DataSourceGoogleOrganization(), - "google_privateca_certificate_authority": privateca.DataSourcePrivatecaCertificateAuthority(), - "google_project": resourcemanager.DataSourceGoogleProject(), - "google_projects": resourcemanager.DataSourceGoogleProjects(), - "google_project_organization_policy": resourcemanager.DataSourceGoogleProjectOrganizationPolicy(), - "google_project_service": resourcemanager.DataSourceGoogleProjectService(), - "google_pubsub_subscription": pubsub.DataSourceGooglePubsubSubscription(), - "google_pubsub_topic": pubsub.DataSourceGooglePubsubTopic(), - {{- if ne $.TargetVersionName "ga" }} - "google_runtimeconfig_config": runtimeconfig.DataSourceGoogleRuntimeconfigConfig(), - "google_runtimeconfig_variable": runtimeconfig.DataSourceGoogleRuntimeconfigVariable(), - {{- end }} - "google_secret_manager_regional_secret": secretmanagerregional.DataSourceSecretManagerRegionalRegionalSecret(), - "google_secret_manager_secret": secretmanager.DataSourceSecretManagerSecret(), - "google_secret_manager_secrets": secretmanager.DataSourceSecretManagerSecrets(), - "google_secret_manager_secret_version": secretmanager.DataSourceSecretManagerSecretVersion(), - "google_secret_manager_secret_version_access": secretmanager.DataSourceSecretManagerSecretVersionAccess(), - "google_service_account": resourcemanager.DataSourceGoogleServiceAccount(), - "google_service_account_access_token": resourcemanager.DataSourceGoogleServiceAccountAccessToken(), - "google_service_account_id_token": resourcemanager.DataSourceGoogleServiceAccountIdToken(), - "google_service_account_jwt": resourcemanager.DataSourceGoogleServiceAccountJwt(), - "google_service_account_key": resourcemanager.DataSourceGoogleServiceAccountKey(), - "google_site_verification_token": siteverification.DataSourceSiteVerificationToken(), - "google_sourcerepo_repository": sourcerepo.DataSourceGoogleSourceRepoRepository(), - "google_spanner_instance": spanner.DataSourceSpannerInstance(), - "google_sql_ca_certs": sql.DataSourceGoogleSQLCaCerts(), - "google_sql_tiers": sql.DataSourceGoogleSQLTiers(), - "google_sql_database_instance_latest_recovery_time": sql.DataSourceSqlDatabaseInstanceLatestRecoveryTime(), - "google_sql_backup_run": sql.DataSourceSqlBackupRun(), - "google_sql_databases": sql.DataSourceSqlDatabases(), - "google_sql_database": sql.DataSourceSqlDatabase(), - "google_sql_database_instance": sql.DataSourceSqlDatabaseInstance(), - "google_sql_database_instances": sql.DataSourceSqlDatabaseInstances(), - "google_service_networking_peered_dns_domain": servicenetworking.DataSourceGoogleServiceNetworkingPeeredDNSDomain(), - "google_storage_bucket": storage.DataSourceGoogleStorageBucket(), - "google_storage_buckets": storage.DataSourceGoogleStorageBuckets(), - "google_storage_bucket_object": storage.DataSourceGoogleStorageBucketObject(), - "google_storage_bucket_objects": storage.DataSourceGoogleStorageBucketObjects(), - "google_storage_bucket_object_content": storage.DataSourceGoogleStorageBucketObjectContent(), - "google_storage_object_signed_url": storage.DataSourceGoogleSignedUrl(), - "google_storage_project_service_account": storage.DataSourceGoogleStorageProjectServiceAccount(), - "google_storage_transfer_project_service_account": storagetransfer.DataSourceGoogleStorageTransferProjectServiceAccount(), - "google_tags_tag_key": tags.DataSourceGoogleTagsTagKey(), - "google_tags_tag_keys": tags.DataSourceGoogleTagsTagKeys(), - "google_tags_tag_value": tags.DataSourceGoogleTagsTagValue(), - "google_tags_tag_values": tags.DataSourceGoogleTagsTagValues(), - "google_tpu_tensorflow_versions": tpu.DataSourceTpuTensorflowVersions(), - {{- if ne $.TargetVersionName "ga" }} - "google_tpu_v2_runtime_versions": tpuv2.DataSourceTpuV2RuntimeVersions(), - "google_tpu_v2_accelerator_types": tpuv2.DataSourceTpuV2AcceleratorTypes(), - {{- end }} - "google_vpc_access_connector": vpcaccess.DataSourceVPCAccessConnector(), - "google_redis_instance": redis.DataSourceGoogleRedisInstance(), - "google_vertex_ai_index": vertexai.DataSourceVertexAIIndex(), - "google_vmwareengine_cluster": vmwareengine.DataSourceVmwareengineCluster(), - "google_vmwareengine_external_access_rule": vmwareengine.DataSourceVmwareengineExternalAccessRule(), - "google_vmwareengine_external_address": vmwareengine.DataSourceVmwareengineExternalAddress(), - "google_vmwareengine_network": vmwareengine.DataSourceVmwareengineNetwork(), - "google_vmwareengine_network_peering": vmwareengine.DataSourceVmwareengineNetworkPeering(), - "google_vmwareengine_network_policy": vmwareengine.DataSourceVmwareengineNetworkPolicy(), - "google_vmwareengine_nsx_credentials": vmwareengine.DataSourceVmwareengineNsxCredentials(), - "google_vmwareengine_private_cloud": vmwareengine.DataSourceVmwareenginePrivateCloud(), - "google_vmwareengine_subnet": vmwareengine.DataSourceVmwareengineSubnet(), - "google_vmwareengine_vcenter_credentials": vmwareengine.DataSourceVmwareengineVcenterCredentials(), - // ####### END handwritten datasources ########### -} - -var generatedIAMDatasources = map[string]*schema.Resource{ - // ####### START generated IAM datasources ########### - {{- range $object := $.ResourcesForVersion }} - {{- if $object.IamClassName }} - "{{ $object.TerraformName }}_iam_policy": tpgiamresource.DataSourceIamPolicy({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer), - {{- end }} - {{- end }} - // ####### END generated IAM datasources ########### -} - -var handwrittenIAMDatasources = map[string]*schema.Resource{ - // ####### START non-generated IAM datasources ########### - "google_bigtable_instance_iam_policy": tpgiamresource.DataSourceIamPolicy(bigtable.IamBigtableInstanceSchema, bigtable.NewBigtableInstanceUpdater), - "google_bigtable_table_iam_policy": tpgiamresource.DataSourceIamPolicy(bigtable.IamBigtableTableSchema, bigtable.NewBigtableTableUpdater), - "google_bigquery_dataset_iam_policy": tpgiamresource.DataSourceIamPolicy(bigquery.IamBigqueryDatasetSchema, bigquery.NewBigqueryDatasetIamUpdater), - "google_billing_account_iam_policy": tpgiamresource.DataSourceIamPolicy(billing.IamBillingAccountSchema, billing.NewBillingAccountIamUpdater), - "google_dataproc_cluster_iam_policy": tpgiamresource.DataSourceIamPolicy(dataproc.IamDataprocClusterSchema, dataproc.NewDataprocClusterUpdater), - "google_dataproc_job_iam_policy": tpgiamresource.DataSourceIamPolicy(dataproc.IamDataprocJobSchema, dataproc.NewDataprocJobUpdater), - "google_folder_iam_policy": tpgiamresource.DataSourceIamPolicy(resourcemanager.IamFolderSchema, resourcemanager.NewFolderIamUpdater), - "google_healthcare_dataset_iam_policy": tpgiamresource.DataSourceIamPolicy(healthcare.IamHealthcareDatasetSchema, healthcare.NewHealthcareDatasetIamUpdater), - "google_healthcare_dicom_store_iam_policy": tpgiamresource.DataSourceIamPolicy(healthcare.IamHealthcareDicomStoreSchema, healthcare.NewHealthcareDicomStoreIamUpdater), - "google_healthcare_fhir_store_iam_policy": tpgiamresource.DataSourceIamPolicy(healthcare.IamHealthcareFhirStoreSchema, healthcare.NewHealthcareFhirStoreIamUpdater), - "google_healthcare_hl7_v2_store_iam_policy": tpgiamresource.DataSourceIamPolicy(healthcare.IamHealthcareHl7V2StoreSchema, healthcare.NewHealthcareHl7V2StoreIamUpdater), - "google_kms_key_ring_iam_policy": tpgiamresource.DataSourceIamPolicy(kms.IamKmsKeyRingSchema, kms.NewKmsKeyRingIamUpdater), - "google_kms_crypto_key_iam_policy": tpgiamresource.DataSourceIamPolicy(kms.IamKmsCryptoKeySchema, kms.NewKmsCryptoKeyIamUpdater), - "google_spanner_instance_iam_policy": tpgiamresource.DataSourceIamPolicy(spanner.IamSpannerInstanceSchema, spanner.NewSpannerInstanceIamUpdater), - "google_spanner_database_iam_policy": tpgiamresource.DataSourceIamPolicy(spanner.IamSpannerDatabaseSchema, spanner.NewSpannerDatabaseIamUpdater), - "google_storage_managed_folder_iam_policy": tpgiamresource.DataSourceIamPolicy(storage.StorageManagedFolderIamSchema, storage.StorageManagedFolderIamUpdaterProducer), - "google_organization_iam_policy": tpgiamresource.DataSourceIamPolicy(resourcemanager.IamOrganizationSchema, resourcemanager.NewOrganizationIamUpdater), - "google_project_iam_policy": tpgiamresource.DataSourceIamPolicy(resourcemanager.IamProjectSchema, resourcemanager.NewProjectIamUpdater), - "google_pubsub_subscription_iam_policy": tpgiamresource.DataSourceIamPolicy(pubsub.IamPubsubSubscriptionSchema, pubsub.NewPubsubSubscriptionIamUpdater), - "google_service_account_iam_policy": tpgiamresource.DataSourceIamPolicy(resourcemanager.IamServiceAccountSchema, resourcemanager.NewServiceAccountIamUpdater), - // ####### END non-generated IAM datasources ########### -} - -// Resources -// Generated resources: {{ $.ResourceCount }} -// Generated IAM resources: {{ $.IAMResourceCount }} -// Total generated resources: {{ plus $.ResourceCount $.IAMResourceCount }} -var generatedResources = map[string]*schema.Resource{ - {{- range $object := $.ResourcesForVersion }} - {{- if $object.ResourceName }} - "{{ $object.TerraformName }}": {{ $object.ResourceName }}(), - {{- end }} - {{- if $object.IamClassName }} - "{{ $object.TerraformName }}_iam_binding": tpgiamresource.ResourceIamBinding({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), - "{{ $object.TerraformName }}_iam_member": tpgiamresource.ResourceIamMember({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), - "{{ $object.TerraformName }}_iam_policy": tpgiamresource.ResourceIamPolicy({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), - {{- end }} - {{- end }} -} - -var handwrittenResources = map[string]*schema.Resource{ - // ####### START handwritten resources ########### - "google_app_engine_application": appengine.ResourceAppEngineApplication(), - "google_apigee_sharedflow": apigee.ResourceApigeeSharedFlow(), - "google_apigee_sharedflow_deployment": apigee.ResourceApigeeSharedFlowDeployment(), - "google_apigee_flowhook": apigee.ResourceApigeeFlowhook(), - "google_apigee_keystores_aliases_pkcs12": apigee.ResourceApigeeKeystoresAliasesPkcs12(), - "google_apigee_keystores_aliases_key_cert_file": apigee.ResourceApigeeKeystoresAliasesKeyCertFile(), - "google_bigquery_table": bigquery.ResourceBigQueryTable(), - "google_bigtable_gc_policy": bigtable.ResourceBigtableGCPolicy(), - "google_bigtable_instance": bigtable.ResourceBigtableInstance(), - "google_bigtable_table": bigtable.ResourceBigtableTable(), - "google_bigtable_authorized_view": bigtable.ResourceBigtableAuthorizedView(), - "google_billing_subaccount": resourcemanager.ResourceBillingSubaccount(), - "google_cloudfunctions_function": cloudfunctions.ResourceCloudFunctionsFunction(), - "google_composer_environment": composer.ResourceComposerEnvironment(), - {{- if ne $.TargetVersionName "ga" }} - "google_composer_user_workloads_secret": composer.ResourceComposerUserWorkloadsSecret(), - {{- end }} - "google_compute_attached_disk": compute.ResourceComputeAttachedDisk(), - "google_compute_instance": compute.ResourceComputeInstance(), - "google_compute_disk_async_replication": compute.ResourceComputeDiskAsyncReplication(), - "google_compute_router_peer": compute.ResourceComputeRouterBgpPeer(), - {{- if ne $.TargetVersionName "ga" }} - "google_compute_instance_from_machine_image": compute.ResourceComputeInstanceFromMachineImage(), - {{- end }} - "google_compute_instance_from_template": compute.ResourceComputeInstanceFromTemplate(), - "google_compute_instance_group": compute.ResourceComputeInstanceGroup(), - "google_compute_instance_group_manager": compute.ResourceComputeInstanceGroupManager(), - "google_compute_instance_template": compute.ResourceComputeInstanceTemplate(), - "google_compute_network_peering": compute.ResourceComputeNetworkPeering(), - "google_compute_project_default_network_tier": compute.ResourceComputeProjectDefaultNetworkTier(), - "google_compute_project_metadata": compute.ResourceComputeProjectMetadata(), - "google_compute_project_metadata_item": compute.ResourceComputeProjectMetadataItem(), - "google_compute_region_instance_group_manager": compute.ResourceComputeRegionInstanceGroupManager(), - "google_compute_region_instance_template": compute.ResourceComputeRegionInstanceTemplate(), - "google_compute_router_interface": compute.ResourceComputeRouterInterface(), - "google_compute_security_policy": compute.ResourceComputeSecurityPolicy(), - "google_compute_shared_vpc_host_project": compute.ResourceComputeSharedVpcHostProject(), - "google_compute_shared_vpc_service_project": compute.ResourceComputeSharedVpcServiceProject(), - "google_compute_target_pool": compute.ResourceComputeTargetPool(), - "google_container_cluster": container.ResourceContainerCluster(), - "google_container_node_pool": container.ResourceContainerNodePool(), - "google_container_registry": containeranalysis.ResourceContainerRegistry(), - "google_dataflow_job": dataflow.ResourceDataflowJob(), - {{- if ne $.TargetVersionName "ga" }} - "google_dataflow_flex_template_job": dataflow.ResourceDataflowFlexTemplateJob(), - {{- end }} - "google_dataproc_cluster": dataproc.ResourceDataprocCluster(), - "google_dataproc_job": dataproc.ResourceDataprocJob(), - "google_dns_record_set": dns.ResourceDnsRecordSet(), - "google_endpoints_service": servicemanagement.ResourceEndpointsService(), - "google_folder": resourcemanager.ResourceGoogleFolder(), - "google_folder_organization_policy": resourcemanager.ResourceGoogleFolderOrganizationPolicy(), - "google_logging_billing_account_sink": logging.ResourceLoggingBillingAccountSink(), - "google_logging_billing_account_exclusion": logging.ResourceLoggingExclusion(logging.BillingAccountLoggingExclusionSchema, logging.NewBillingAccountLoggingExclusionUpdater, logging.BillingAccountLoggingExclusionIdParseFunc), - "google_logging_billing_account_bucket_config": logging.ResourceLoggingBillingAccountBucketConfig(), - "google_logging_organization_sink": logging.ResourceLoggingOrganizationSink(), - "google_logging_organization_exclusion": logging.ResourceLoggingExclusion(logging.OrganizationLoggingExclusionSchema, logging.NewOrganizationLoggingExclusionUpdater, logging.OrganizationLoggingExclusionIdParseFunc), - "google_logging_organization_bucket_config": logging.ResourceLoggingOrganizationBucketConfig(), - "google_logging_folder_sink": logging.ResourceLoggingFolderSink(), - "google_logging_folder_exclusion": logging.ResourceLoggingExclusion(logging.FolderLoggingExclusionSchema, logging.NewFolderLoggingExclusionUpdater, logging.FolderLoggingExclusionIdParseFunc), - "google_logging_folder_bucket_config": logging.ResourceLoggingFolderBucketConfig(), - "google_logging_project_sink": logging.ResourceLoggingProjectSink(), - "google_logging_project_exclusion": logging.ResourceLoggingExclusion(logging.ProjectLoggingExclusionSchema, logging.NewProjectLoggingExclusionUpdater, logging.ProjectLoggingExclusionIdParseFunc), - "google_logging_project_bucket_config": logging.ResourceLoggingProjectBucketConfig(), - "google_monitoring_dashboard": monitoring.ResourceMonitoringDashboard(), - "google_os_config_os_policy_assignment": osconfig.ResourceOSConfigOSPolicyAssignment(), - {{- if ne $.TargetVersionName "ga" }} - "google_project_service_identity": resourcemanager.ResourceProjectServiceIdentity(), - {{- end }} - "google_service_networking_connection": servicenetworking.ResourceServiceNetworkingConnection(), - "google_sql_database_instance": sql.ResourceSqlDatabaseInstance(), - "google_sql_ssl_cert": sql.ResourceSqlSslCert(), - "google_sql_user": sql.ResourceSqlUser(), - "google_organization_iam_custom_role": resourcemanager.ResourceGoogleOrganizationIamCustomRole(), - "google_organization_policy": resourcemanager.ResourceGoogleOrganizationPolicy(), - "google_project": resourcemanager.ResourceGoogleProject(), - "google_project_default_service_accounts": resourcemanager.ResourceGoogleProjectDefaultServiceAccounts(), - "google_project_service": resourcemanager.ResourceGoogleProjectService(), - "google_project_iam_custom_role": resourcemanager.ResourceGoogleProjectIamCustomRole(), - "google_project_iam_member_remove": resourcemanager.ResourceGoogleProjectIamMemberRemove(), - "google_project_organization_policy": resourcemanager.ResourceGoogleProjectOrganizationPolicy(), - "google_project_usage_export_bucket": compute.ResourceProjectUsageBucket(), - {{- if ne $.TargetVersionName "ga" }} - "google_runtimeconfig_config": runtimeconfig.ResourceRuntimeconfigConfig(), - "google_runtimeconfig_variable": runtimeconfig.ResourceRuntimeconfigVariable(), - {{- end }} - "google_service_account": resourcemanager.ResourceGoogleServiceAccount(), - "google_service_account_key": resourcemanager.ResourceGoogleServiceAccountKey(), - "google_service_networking_peered_dns_domain": servicenetworking.ResourceGoogleServiceNetworkingPeeredDNSDomain(), - "google_storage_bucket": storage.ResourceStorageBucket(), - "google_storage_bucket_acl": storage.ResourceStorageBucketAcl(), - "google_storage_bucket_object": storage.ResourceStorageBucketObject(), - "google_storage_object_acl": storage.ResourceStorageObjectAcl(), - "google_storage_default_object_acl": storage.ResourceStorageDefaultObjectAcl(), - "google_storage_notification": storage.ResourceStorageNotification(), - "google_storage_transfer_job": storagetransfer.ResourceStorageTransferJob(), - "google_tags_location_tag_binding": tags.ResourceTagsLocationTagBinding(), - // ####### END handwritten resources ########### -} - -var handwrittenIAMResources = map[string]*schema.Resource{ - // ####### START non-generated IAM resources ########### - "google_bigtable_instance_iam_binding": tpgiamresource.ResourceIamBinding(bigtable.IamBigtableInstanceSchema, bigtable.NewBigtableInstanceUpdater, bigtable.BigtableInstanceIdParseFunc), - "google_bigtable_instance_iam_member": tpgiamresource.ResourceIamMember(bigtable.IamBigtableInstanceSchema, bigtable.NewBigtableInstanceUpdater, bigtable.BigtableInstanceIdParseFunc), - "google_bigtable_instance_iam_policy": tpgiamresource.ResourceIamPolicy(bigtable.IamBigtableInstanceSchema, bigtable.NewBigtableInstanceUpdater, bigtable.BigtableInstanceIdParseFunc), - "google_bigtable_table_iam_binding": tpgiamresource.ResourceIamBinding(bigtable.IamBigtableTableSchema, bigtable.NewBigtableTableUpdater, bigtable.BigtableTableIdParseFunc), - "google_bigtable_table_iam_member": tpgiamresource.ResourceIamMember(bigtable.IamBigtableTableSchema, bigtable.NewBigtableTableUpdater, bigtable.BigtableTableIdParseFunc), - "google_bigtable_table_iam_policy": tpgiamresource.ResourceIamPolicy(bigtable.IamBigtableTableSchema, bigtable.NewBigtableTableUpdater, bigtable.BigtableTableIdParseFunc), - "google_bigquery_dataset_iam_binding": tpgiamresource.ResourceIamBinding(bigquery.IamBigqueryDatasetSchema, bigquery.NewBigqueryDatasetIamUpdater, bigquery.BigqueryDatasetIdParseFunc), - "google_bigquery_dataset_iam_member": tpgiamresource.ResourceIamMember(bigquery.IamMemberBigqueryDatasetSchema, bigquery.NewBigqueryDatasetIamMemberUpdater, bigquery.BigqueryDatasetIdParseFunc), - "google_bigquery_dataset_iam_policy": tpgiamresource.ResourceIamPolicy(bigquery.IamBigqueryDatasetSchema, bigquery.NewBigqueryDatasetIamUpdater, bigquery.BigqueryDatasetIdParseFunc), - "google_billing_account_iam_binding": tpgiamresource.ResourceIamBinding(billing.IamBillingAccountSchema, billing.NewBillingAccountIamUpdater, billing.BillingAccountIdParseFunc), - "google_billing_account_iam_member": tpgiamresource.ResourceIamMember(billing.IamBillingAccountSchema, billing.NewBillingAccountIamUpdater, billing.BillingAccountIdParseFunc), - "google_billing_account_iam_policy": tpgiamresource.ResourceIamPolicy(billing.IamBillingAccountSchema, billing.NewBillingAccountIamUpdater, billing.BillingAccountIdParseFunc), - "google_dataproc_cluster_iam_binding": tpgiamresource.ResourceIamBinding(dataproc.IamDataprocClusterSchema, dataproc.NewDataprocClusterUpdater, dataproc.DataprocClusterIdParseFunc), - "google_dataproc_cluster_iam_member": tpgiamresource.ResourceIamMember(dataproc.IamDataprocClusterSchema, dataproc.NewDataprocClusterUpdater, dataproc.DataprocClusterIdParseFunc), - "google_dataproc_cluster_iam_policy": tpgiamresource.ResourceIamPolicy(dataproc.IamDataprocClusterSchema, dataproc.NewDataprocClusterUpdater, dataproc.DataprocClusterIdParseFunc), - "google_dataproc_job_iam_binding": tpgiamresource.ResourceIamBinding(dataproc.IamDataprocJobSchema, dataproc.NewDataprocJobUpdater, dataproc.DataprocJobIdParseFunc), - "google_dataproc_job_iam_member": tpgiamresource.ResourceIamMember(dataproc.IamDataprocJobSchema, dataproc.NewDataprocJobUpdater, dataproc.DataprocJobIdParseFunc), - "google_dataproc_job_iam_policy": tpgiamresource.ResourceIamPolicy(dataproc.IamDataprocJobSchema, dataproc.NewDataprocJobUpdater, dataproc.DataprocJobIdParseFunc), - "google_folder_iam_binding": tpgiamresource.ResourceIamBinding(resourcemanager.IamFolderSchema, resourcemanager.NewFolderIamUpdater, resourcemanager.FolderIdParseFunc), - "google_folder_iam_member": tpgiamresource.ResourceIamMember(resourcemanager.IamFolderSchema, resourcemanager.NewFolderIamUpdater, resourcemanager.FolderIdParseFunc), - "google_folder_iam_policy": tpgiamresource.ResourceIamPolicy(resourcemanager.IamFolderSchema, resourcemanager.NewFolderIamUpdater, resourcemanager.FolderIdParseFunc), - "google_folder_iam_audit_config": tpgiamresource.ResourceIamAuditConfig(resourcemanager.IamFolderSchema, resourcemanager.NewFolderIamUpdater, resourcemanager.FolderIdParseFunc), - "google_healthcare_dataset_iam_binding": tpgiamresource.ResourceIamBinding(healthcare.IamHealthcareDatasetSchema, healthcare.NewHealthcareDatasetIamUpdater, healthcare.DatasetIdParseFunc, tpgiamresource.IamWithBatching), - "google_healthcare_dataset_iam_member": tpgiamresource.ResourceIamMember(healthcare.IamHealthcareDatasetSchema, healthcare.NewHealthcareDatasetIamUpdater, healthcare.DatasetIdParseFunc, tpgiamresource.IamWithBatching), - "google_healthcare_dataset_iam_policy": tpgiamresource.ResourceIamPolicy(healthcare.IamHealthcareDatasetSchema, healthcare.NewHealthcareDatasetIamUpdater, healthcare.DatasetIdParseFunc), - "google_healthcare_dicom_store_iam_binding": tpgiamresource.ResourceIamBinding(healthcare.IamHealthcareDicomStoreSchema, healthcare.NewHealthcareDicomStoreIamUpdater, healthcare.DicomStoreIdParseFunc, tpgiamresource.IamWithBatching), - "google_healthcare_dicom_store_iam_member": tpgiamresource.ResourceIamMember(healthcare.IamHealthcareDicomStoreSchema, healthcare.NewHealthcareDicomStoreIamUpdater, healthcare.DicomStoreIdParseFunc, tpgiamresource.IamWithBatching), - "google_healthcare_dicom_store_iam_policy": tpgiamresource.ResourceIamPolicy(healthcare.IamHealthcareDicomStoreSchema, healthcare.NewHealthcareDicomStoreIamUpdater, healthcare.DicomStoreIdParseFunc), - "google_healthcare_fhir_store_iam_binding": tpgiamresource.ResourceIamBinding(healthcare.IamHealthcareFhirStoreSchema, healthcare.NewHealthcareFhirStoreIamUpdater, healthcare.FhirStoreIdParseFunc, tpgiamresource.IamWithBatching), - "google_healthcare_fhir_store_iam_member": tpgiamresource.ResourceIamMember(healthcare.IamHealthcareFhirStoreSchema, healthcare.NewHealthcareFhirStoreIamUpdater, healthcare.FhirStoreIdParseFunc, tpgiamresource.IamWithBatching), - "google_healthcare_fhir_store_iam_policy": tpgiamresource.ResourceIamPolicy(healthcare.IamHealthcareFhirStoreSchema, healthcare.NewHealthcareFhirStoreIamUpdater, healthcare.FhirStoreIdParseFunc), - "google_healthcare_hl7_v2_store_iam_binding": tpgiamresource.ResourceIamBinding(healthcare.IamHealthcareHl7V2StoreSchema, healthcare.NewHealthcareHl7V2StoreIamUpdater, healthcare.Hl7V2StoreIdParseFunc, tpgiamresource.IamWithBatching), - "google_healthcare_hl7_v2_store_iam_member": tpgiamresource.ResourceIamMember(healthcare.IamHealthcareHl7V2StoreSchema, healthcare.NewHealthcareHl7V2StoreIamUpdater, healthcare.Hl7V2StoreIdParseFunc, tpgiamresource.IamWithBatching), - "google_healthcare_hl7_v2_store_iam_policy": tpgiamresource.ResourceIamPolicy(healthcare.IamHealthcareHl7V2StoreSchema, healthcare.NewHealthcareHl7V2StoreIamUpdater, healthcare.Hl7V2StoreIdParseFunc), - "google_kms_key_ring_iam_binding": tpgiamresource.ResourceIamBinding(kms.IamKmsKeyRingSchema, kms.NewKmsKeyRingIamUpdater, kms.KeyRingIdParseFunc), - "google_kms_key_ring_iam_member": tpgiamresource.ResourceIamMember(kms.IamKmsKeyRingSchema, kms.NewKmsKeyRingIamUpdater, kms.KeyRingIdParseFunc), - "google_kms_key_ring_iam_policy": tpgiamresource.ResourceIamPolicy(kms.IamKmsKeyRingSchema, kms.NewKmsKeyRingIamUpdater, kms.KeyRingIdParseFunc), - "google_kms_crypto_key_iam_binding": tpgiamresource.ResourceIamBinding(kms.IamKmsCryptoKeySchema, kms.NewKmsCryptoKeyIamUpdater, kms.CryptoIdParseFunc), - "google_kms_crypto_key_iam_member": tpgiamresource.ResourceIamMember(kms.IamKmsCryptoKeySchema, kms.NewKmsCryptoKeyIamUpdater, kms.CryptoIdParseFunc), - "google_kms_crypto_key_iam_policy": tpgiamresource.ResourceIamPolicy(kms.IamKmsCryptoKeySchema, kms.NewKmsCryptoKeyIamUpdater, kms.CryptoIdParseFunc), - "google_spanner_instance_iam_binding": tpgiamresource.ResourceIamBinding(spanner.IamSpannerInstanceSchema, spanner.NewSpannerInstanceIamUpdater, spanner.SpannerInstanceIdParseFunc), - "google_spanner_instance_iam_member": tpgiamresource.ResourceIamMember(spanner.IamSpannerInstanceSchema, spanner.NewSpannerInstanceIamUpdater, spanner.SpannerInstanceIdParseFunc), - "google_spanner_instance_iam_policy": tpgiamresource.ResourceIamPolicy(spanner.IamSpannerInstanceSchema, spanner.NewSpannerInstanceIamUpdater, spanner.SpannerInstanceIdParseFunc), - "google_spanner_database_iam_binding": tpgiamresource.ResourceIamBinding(spanner.IamSpannerDatabaseSchema, spanner.NewSpannerDatabaseIamUpdater, spanner.SpannerDatabaseIdParseFunc), - "google_spanner_database_iam_member": tpgiamresource.ResourceIamMember(spanner.IamSpannerDatabaseSchema, spanner.NewSpannerDatabaseIamUpdater, spanner.SpannerDatabaseIdParseFunc), - "google_spanner_database_iam_policy": tpgiamresource.ResourceIamPolicy(spanner.IamSpannerDatabaseSchema, spanner.NewSpannerDatabaseIamUpdater, spanner.SpannerDatabaseIdParseFunc), - "google_storage_managed_folder_iam_binding": tpgiamresource.ResourceIamBinding(storage.StorageManagedFolderIamSchema, storage.StorageManagedFolderIamUpdaterProducer, storage.StorageManagedFolderIdParseFunc), - "google_storage_managed_folder_iam_member": tpgiamresource.ResourceIamMember(storage.StorageManagedFolderIamSchema, storage.StorageManagedFolderIamUpdaterProducer, storage.StorageManagedFolderIdParseFunc), - "google_storage_managed_folder_iam_policy": tpgiamresource.ResourceIamPolicy(storage.StorageManagedFolderIamSchema, storage.StorageManagedFolderIamUpdaterProducer, storage.StorageManagedFolderIdParseFunc), - "google_organization_iam_binding": tpgiamresource.ResourceIamBinding(resourcemanager.IamOrganizationSchema, resourcemanager.NewOrganizationIamUpdater, resourcemanager.OrgIdParseFunc), - "google_organization_iam_member": tpgiamresource.ResourceIamMember(resourcemanager.IamOrganizationSchema, resourcemanager.NewOrganizationIamUpdater, resourcemanager.OrgIdParseFunc), - "google_organization_iam_policy": tpgiamresource.ResourceIamPolicy(resourcemanager.IamOrganizationSchema, resourcemanager.NewOrganizationIamUpdater, resourcemanager.OrgIdParseFunc), - "google_organization_iam_audit_config": tpgiamresource.ResourceIamAuditConfig(resourcemanager.IamOrganizationSchema, resourcemanager.NewOrganizationIamUpdater, resourcemanager.OrgIdParseFunc), - "google_project_iam_policy": tpgiamresource.ResourceIamPolicy(resourcemanager.IamProjectSchema, resourcemanager.NewProjectIamUpdater, resourcemanager.ProjectIdParseFunc), - "google_project_iam_binding": tpgiamresource.ResourceIamBinding(resourcemanager.IamProjectSchema, resourcemanager.NewProjectIamUpdater, resourcemanager.ProjectIdParseFunc, tpgiamresource.IamWithBatching), - "google_project_iam_member": tpgiamresource.ResourceIamMember(resourcemanager.IamProjectSchema, resourcemanager.NewProjectIamUpdater, resourcemanager.ProjectIdParseFunc, tpgiamresource.IamWithBatching), - "google_project_iam_audit_config": tpgiamresource.ResourceIamAuditConfig(resourcemanager.IamProjectSchema, resourcemanager.NewProjectIamUpdater, resourcemanager.ProjectIdParseFunc, tpgiamresource.IamWithBatching), - "google_pubsub_subscription_iam_binding": tpgiamresource.ResourceIamBinding(pubsub.IamPubsubSubscriptionSchema, pubsub.NewPubsubSubscriptionIamUpdater, pubsub.PubsubSubscriptionIdParseFunc), - "google_pubsub_subscription_iam_member": tpgiamresource.ResourceIamMember(pubsub.IamPubsubSubscriptionSchema, pubsub.NewPubsubSubscriptionIamUpdater, pubsub.PubsubSubscriptionIdParseFunc), - "google_pubsub_subscription_iam_policy": tpgiamresource.ResourceIamPolicy(pubsub.IamPubsubSubscriptionSchema, pubsub.NewPubsubSubscriptionIamUpdater, pubsub.PubsubSubscriptionIdParseFunc), - "google_service_account_iam_binding": tpgiamresource.ResourceIamBinding(resourcemanager.IamServiceAccountSchema, resourcemanager.NewServiceAccountIamUpdater, resourcemanager.ServiceAccountIdParseFunc), - "google_service_account_iam_member": tpgiamresource.ResourceIamMember(resourcemanager.IamServiceAccountSchema, resourcemanager.NewServiceAccountIamUpdater, resourcemanager.ServiceAccountIdParseFunc), - "google_service_account_iam_policy": tpgiamresource.ResourceIamPolicy(resourcemanager.IamServiceAccountSchema, resourcemanager.NewServiceAccountIamUpdater, resourcemanager.ServiceAccountIdParseFunc), - // ####### END non-generated IAM resources ########### -} diff --git a/mmv1/third_party/terraform/provider/go/provider_test.go.tmpl b/mmv1/third_party/terraform/provider/go/provider_test.go.tmpl deleted file mode 100644 index 046e242ae8e7..000000000000 --- a/mmv1/third_party/terraform/provider/go/provider_test.go.tmpl +++ /dev/null @@ -1,431 +0,0 @@ -package provider_test - -import ( - "fmt" - "regexp" - "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/provider" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -func TestProvider(t *testing.T) { - if err := provider.Provider().InternalValidate(); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestProvider_impl(t *testing.T) { - var _ *schema.Provider = provider.Provider() -} - -func TestProvider_noDuplicatesInResourceMap(t *testing.T) { - _, err := provider.ResourceMapWithErrors() - if err != nil { - t.Error(err) - } -} - -func TestProvider_noDuplicatesInDatasourceMap(t *testing.T) { - _, err := provider.DatasourceMapWithErrors() - if err != nil { - t.Error(err) - } -} - -func TestAccProviderBasePath_setBasePath(t *testing.T) { - t.Parallel() - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccProviderBasePath_setBasePath("https://www.googleapis.com/compute/beta/", acctest.RandString(t, 10)), - }, - { - ResourceName: "google_compute_address.default", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func TestAccProviderBasePath_setInvalidBasePath(t *testing.T) { - t.Parallel() - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccProviderBasePath_setBasePath("https://www.example.com/compute/beta/", acctest.RandString(t, 10)), - ExpectError: regexp.MustCompile("got HTTP response code [4-5][0-9]{2} with body"), - }, - }, - }) -} - -func TestAccProviderMeta_setModuleName(t *testing.T) { - t.Parallel() - - moduleName := "my-module" - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckComputeAddressDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccProviderMeta_setModuleName(moduleName, acctest.RandString(t, 10)), - }, - { - ResourceName: "google_compute_address.default", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func TestAccProviderUserProjectOverride(t *testing.T) { - // Parallel fine-grained resource creation - acctest.SkipIfVcr(t) - t.Parallel() - - org := envvar.GetTestOrgFromEnv(t) - billing := envvar.GetTestBillingAccountFromEnv(t) - pid := "tf-test-" + acctest.RandString(t, 10) - topicName := "tf-test-topic-" + acctest.RandString(t, 10) - - config := acctest.BootstrapConfig(t) - accessToken, err := acctest.SetupProjectsAndGetAccessToken(org, billing, pid, "pubsub", config) - if err != nil { - t.Error(err) - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - // No TestDestroy since that's not really the point of this test - Steps: []resource.TestStep{ - { - Config: testAccProviderUserProjectOverride_step2(accessToken, pid, false, topicName), - ExpectError: regexp.MustCompile("Cloud Pub/Sub API has not been used"), - }, - { - Config: testAccProviderUserProjectOverride_step2(accessToken, pid, true, topicName), - }, - { - ResourceName: "google_pubsub_topic.project-2-topic", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, - }, - { - Config: testAccProviderUserProjectOverride_step3(accessToken, true), - }, - }, - }) -} - -// Do the same thing as TestAccProviderUserProjectOverride, but using a resource that gets its project via -// a reference to a different resource instead of a project field. -func TestAccProviderIndirectUserProjectOverride(t *testing.T) { - // Parallel fine-grained resource creation - acctest.SkipIfVcr(t) - t.Parallel() - - org := envvar.GetTestOrgFromEnv(t) - billing := envvar.GetTestBillingAccountFromEnv(t) - pid := "tf-test-" + acctest.RandString(t, 10) - - config := acctest.BootstrapConfig(t) - accessToken, err := acctest.SetupProjectsAndGetAccessToken(org, billing, pid, "cloudkms", config) - if err != nil { - t.Error(err) - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - // No TestDestroy since that's not really the point of this test - Steps: []resource.TestStep{ - { - Config: testAccProviderIndirectUserProjectOverride_step2(pid, accessToken, false), - ExpectError: regexp.MustCompile(`Cloud Key Management Service \(KMS\) API has not been used`), - }, - { - Config: testAccProviderIndirectUserProjectOverride_step2(pid, accessToken, true), - }, - { - ResourceName: "google_kms_crypto_key.project-2-key", - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccProviderIndirectUserProjectOverride_step3(accessToken, true), - }, - }, - }) -} - -func TestAccProviderEmptyStrings(t *testing.T) { - t.Parallel() - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - // No TestDestroy since that's not really the point of this test - Steps: []resource.TestStep{ - // When no values are set in the provider block there are no errors - // This test case is a control to show validation doesn't accidentally flag unset fields - // The "" argument is a lack of key = value being passed into the provider block - { - Config: testAccProvider_checkPlanTimeErrors("", acctest.RandString(t, 10)), - PlanOnly: true, - ExpectNonEmptyPlan: true, - }, - // credentials as an empty string causes a validation error - { - Config: testAccProvider_checkPlanTimeErrors(`credentials = ""`, acctest.RandString(t, 10)), - PlanOnly: true, - ExpectNonEmptyPlan: true, - ExpectError: regexp.MustCompile(`expected a non-empty string`), - }, - // access_token as an empty string causes a validation error - { - Config: testAccProvider_checkPlanTimeErrors(`access_token = ""`, acctest.RandString(t, 10)), - PlanOnly: true, - ExpectNonEmptyPlan: true, - ExpectError: regexp.MustCompile(`expected a non-empty string`), - }, - // impersonate_service_account as an empty string causes a validation error - { - Config: testAccProvider_checkPlanTimeErrors(`impersonate_service_account = ""`, acctest.RandString(t, 10)), - PlanOnly: true, - ExpectNonEmptyPlan: true, - ExpectError: regexp.MustCompile(`expected a non-empty string`), - }, - // project as an empty string causes a validation error - { - Config: testAccProvider_checkPlanTimeErrors(`project = ""`, acctest.RandString(t, 10)), - PlanOnly: true, - ExpectNonEmptyPlan: true, - ExpectError: regexp.MustCompile(`expected a non-empty string`), - }, - // billing_project as an empty string causes a validation error - { - Config: testAccProvider_checkPlanTimeErrors(`billing_project = ""`, acctest.RandString(t, 10)), - PlanOnly: true, - ExpectNonEmptyPlan: true, - ExpectError: regexp.MustCompile(`expected a non-empty string`), - }, - // region as an empty string causes a validation error - { - Config: testAccProvider_checkPlanTimeErrors(`region = ""`, acctest.RandString(t, 10)), - PlanOnly: true, - ExpectNonEmptyPlan: true, - ExpectError: regexp.MustCompile(`expected a non-empty string`), - }, - // zone as an empty string causes a validation error - { - Config: testAccProvider_checkPlanTimeErrors(`zone = ""`, acctest.RandString(t, 10)), - PlanOnly: true, - ExpectNonEmptyPlan: true, - ExpectError: regexp.MustCompile(`expected a non-empty string`), - }, - }, - }) -} - -func testAccProviderBasePath_setBasePath(endpoint, name string) string { - return fmt.Sprintf(` -provider "google" { - alias = "compute_custom_endpoint" - compute_custom_endpoint = "%s" -} - -resource "google_compute_address" "default" { - provider = google.compute_custom_endpoint - name = "tf-test-address-%s" -}`, endpoint, name) -} - -func testAccProviderMeta_setModuleName(key, name string) string { - return fmt.Sprintf(` -terraform { - provider_meta "google" { - module_name = "%s" - } -} - -resource "google_compute_address" "default" { - name = "tf-test-address-%s" -}`, key, name) -} - -// Set up two projects. Project 1 has a service account that is used to create a -// pubsub topic in project 2. The pubsub API is only enabled in project 2, -// which causes the create to fail unless user_project_override is set to true. - -func testAccProviderUserProjectOverride_step2(accessToken, pid string, override bool, topicName string) string { - return fmt.Sprintf(` -// See step 3 below, which is really step 2 minus the pubsub topic. -// Step 3 exists because provider configurations can't be removed while objects -// created by that provider still exist in state. Step 3 will remove the -// pubsub topic so the whole config can be deleted. -%s - -resource "google_pubsub_topic" "project-2-topic" { - provider = google.project-1-token - project = "%s-2" - - name = "%s" - labels = { - foo = "bar" - } -} -`, testAccProviderUserProjectOverride_step3(accessToken, override), pid, topicName) -} - -func testAccProviderUserProjectOverride_step3(accessToken string, override bool) string { - return fmt.Sprintf(` -provider "google" { - alias = "project-1-token" - access_token = "%s" - user_project_override = %v -} -`, accessToken, override) -} - -func testAccProviderIndirectUserProjectOverride_step2(pid, accessToken string, override bool) string { - return fmt.Sprintf(` -// See step 3 below, which is really step 2 minus the kms resources. -// Step 3 exists because provider configurations can't be removed while objects -// created by that provider still exist in state. Step 3 will remove the -// kms resources so the whole config can be deleted. -%s - -resource "google_kms_key_ring" "project-2-keyring" { - provider = google.project-1-token - project = "%s-2" - - name = "%s" - location = "us-central1" -} - -resource "google_kms_crypto_key" "project-2-key" { - provider = google.project-1-token - name = "%s" - key_ring = google_kms_key_ring.project-2-keyring.id -} - -data "google_kms_secret_ciphertext" "project-2-ciphertext" { - provider = google.project-1-token - crypto_key = google_kms_crypto_key.project-2-key.id - plaintext = "my-secret" -} -`, testAccProviderIndirectUserProjectOverride_step3(accessToken, override), pid, pid, pid) -} - -func testAccProviderIndirectUserProjectOverride_step3(accessToken string, override bool) string { - return fmt.Sprintf(` -provider "google" { - alias = "project-1-token" - - access_token = "%s" - user_project_override = %v -} -`, accessToken, override) -} - -// Copy the Mmv1 generated function testAccCheckComputeAddressDestroyProducer from the compute_test package to here, -// as that function is in the _test.go file and not importable. -func testAccCheckComputeAddressDestroyProducer(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_compute_address" { - continue - } - if strings.HasPrefix(name, "data.") { - continue - } - - config := acctest.GoogleProviderConfig(t) - - url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/addresses/{{"{{"}}name{{"}}"}}") - if err != nil { - return err - } - - billingProject := "" - - if config.BillingProject != "" { - billingProject = config.BillingProject - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, - }) - if err == nil { - return fmt.Errorf("ComputeAddress still exists at %s", url) - } - } - - return nil - } -} - -func testAccProviderCredentials_actWithCredsFromEnv(name string) string { - return fmt.Sprintf(` -provider "google" { - alias = "testing_credentials" - -} - -resource "google_compute_address" "default" { - provider = google.testing_credentials - name = "%s" -}`, name) -} - -func testAccProviderCredentials_actWithCredsFromEnv_emptyString(name string) string { - return fmt.Sprintf(` -provider "google" { - alias = "testing_credentials" - credentials = "" -} - -resource "google_compute_address" "default" { - provider = google.testing_credentials - name = "%s" -}`, name) -} - -func testAccProvider_checkPlanTimeErrors(providerArgument, randString string) string { - return fmt.Sprintf(` -provider "google" { - %s -} - -# A random resource so that the test can generate a plan (can't check validation errors when plan is empty) -resource "google_pubsub_topic" "example" { - name = "tf-test-planned-resource-%s" -} -`, providerArgument, randString) -} diff --git a/mmv1/third_party/terraform/provider/provider.go.tmpl b/mmv1/third_party/terraform/provider/provider.go.tmpl index 3c4dce74acd3..bece351a6b7f 100644 --- a/mmv1/third_party/terraform/provider/provider.go.tmpl +++ b/mmv1/third_party/terraform/provider/provider.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package provider import ( @@ -144,13 +143,13 @@ func Provider() *schema.Provider { }, // Generated Products - <% products.each do |product| -%> - "<%= product[:definitions].name.underscore -%>_custom_endpoint": { + {{- range $product := $.Products }} + "{{ underscore $product.Name }}_custom_endpoint": { Type: schema.TypeString, Optional: true, ValidateFunc: transport_tpg.ValidateCustomEndpoint, }, - <% end -%> + {{- end }} // Handwritten Products / Versioned / Atypical Entries transport_tpg.CloudBillingCustomEndpointEntryKey: transport_tpg.CloudBillingCustomEndpointEntry, @@ -159,9 +158,9 @@ func Provider() *schema.Provider { transport_tpg.DataflowCustomEndpointEntryKey: transport_tpg.DataflowCustomEndpointEntry, transport_tpg.IamCredentialsCustomEndpointEntryKey: transport_tpg.IamCredentialsCustomEndpointEntry, transport_tpg.ResourceManagerV3CustomEndpointEntryKey: transport_tpg.ResourceManagerV3CustomEndpointEntry, - <% unless version == "ga" -%> + {{- if ne $.TargetVersionName "ga" }} transport_tpg.RuntimeConfigCustomEndpointEntryKey: transport_tpg.RuntimeConfigCustomEndpointEntry, - <% end -%> + {{- end }} transport_tpg.IAMCustomEndpointEntryKey: transport_tpg.IAMCustomEndpointEntry, transport_tpg.ServiceNetworkingCustomEndpointEntryKey: transport_tpg.ServiceNetworkingCustomEndpointEntry, transport_tpg.TagsLocationCustomEndpointEntryKey: transport_tpg.TagsLocationCustomEndpointEntry, @@ -230,11 +229,11 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr Zone: d.Get("zone").(string), UserProjectOverride: d.Get("user_project_override").(bool), BillingProject: d.Get("billing_project").(string), -<% if version.nil? || version == 'ga' -%> +{{- if or (eq $.TargetVersionName "") (eq $.TargetVersionName "ga") }} UserAgent: p.UserAgent("terraform-provider-google", version.ProviderVersion), -<% else -%> - UserAgent: p.UserAgent("terraform-provider-google-<%= version -%>", version.ProviderVersion), -<% end -%> +{{- else }} + UserAgent: p.UserAgent("terraform-provider-google-{{ $.TargetVersionName }}", version.ProviderVersion), +{{- end }} } // opt in extension for adding to the User-Agent header @@ -349,9 +348,9 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr config.BatchingConfig = batchCfg // Generated products - <% products.map.each do |product| -%> - config.<%= product[:definitions].name -%>BasePath = d.Get("<%= product[:definitions].name.underscore -%>_custom_endpoint").(string) - <% end -%> + {{- range $product := $.Products }} + config.{{ $product.Name }}BasePath = d.Get("{{ underscore $product.Name }}_custom_endpoint").(string) + {{- end }} // Handwritten Products / Versioned / Atypical Entries config.CloudBillingBasePath = d.Get(transport_tpg.CloudBillingCustomEndpointEntryKey).(string) @@ -360,9 +359,9 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr config.DataflowBasePath = d.Get(transport_tpg.DataflowCustomEndpointEntryKey).(string) config.IamCredentialsBasePath = d.Get(transport_tpg.IamCredentialsCustomEndpointEntryKey).(string) config.ResourceManagerV3BasePath = d.Get(transport_tpg.ResourceManagerV3CustomEndpointEntryKey).(string) - <% unless version == "ga" -%> + {{- if ne $.TargetVersionName "ga" }} config.RuntimeConfigBasePath = d.Get(transport_tpg.RuntimeConfigCustomEndpointEntryKey).(string) - <% end -%> + {{- end }} config.IAMBasePath = d.Get(transport_tpg.IAMCustomEndpointEntryKey).(string) config.ServiceUsageBasePath = d.Get(transport_tpg.ServiceUsageCustomEndpointEntryKey).(string) config.BigtableAdminBasePath = d.Get(transport_tpg.BigtableAdminCustomEndpointEntryKey).(string) 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 911429b0cdb5..51881c4c2df0 100644 --- a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl +++ b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl @@ -1,16 +1,15 @@ -<% autogen_exception -%> package provider import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - <% get_mmv1_services_in_version(products, version).each do |service| -%> - "github.com/hashicorp/terraform-provider-google/google/services/<%= service -%>" - <% end -%> + {{- range $service := $.GetMmv1ServicesInVersion $.Products }} + "github.com/hashicorp/terraform-provider-google/google/services/{{ $service }}" + {{- end }} - <% if version == 'ga' -%> + {{ if eq $.TargetVersionName `ga` }} "github.com/hashicorp/terraform-provider-google/google/services/composer" - <% end -%> + {{- end }} "github.com/hashicorp/terraform-provider-google/google/services/container" "github.com/hashicorp/terraform-provider-google/google/services/containeraws" "github.com/hashicorp/terraform-provider-google/google/services/containerazure" @@ -34,9 +33,9 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_app_engine_default_service_account": appengine.DataSourceGoogleAppEngineDefaultServiceAccount(), "google_apphub_application": apphub.DataSourceGoogleApphubApplication(), "google_apphub_discovered_service": apphub.DataSourceApphubDiscoveredService(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_backup_dr_management_server": backupdr.DataSourceGoogleCloudBackupDRService(), - <% end -%> + {{- end }} "google_beyondcorp_app_connection": beyondcorp.DataSourceGoogleBeyondcorpAppConnection(), "google_beyondcorp_app_connector": beyondcorp.DataSourceGoogleBeyondcorpAppConnector(), "google_beyondcorp_app_gateway": beyondcorp.DataSourceGoogleBeyondcorpAppGateway(), @@ -49,9 +48,9 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_cloudbuild_trigger": cloudbuild.DataSourceGoogleCloudBuildTrigger(), "google_cloudfunctions_function": cloudfunctions.DataSourceGoogleCloudFunctionsFunction(), "google_cloudfunctions2_function": cloudfunctions2.DataSourceGoogleCloudFunctions2Function(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_cloud_asset_resources_search_all": cloudasset.DataSourceGoogleCloudAssetResourcesSearchAll(), - <% end -%> + {{- end }} "google_cloud_asset_search_all_resources": cloudasset.DataSourceGoogleCloudAssetSearchAllResources(), "google_cloud_identity_groups": cloudidentity.DataSourceGoogleCloudIdentityGroups(), "google_cloud_identity_group_memberships": cloudidentity.DataSourceGoogleCloudIdentityGroupMemberships(), @@ -64,10 +63,10 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_cloud_run_v2_job": cloudrunv2.DataSourceGoogleCloudRunV2Job(), "google_cloud_run_v2_service": cloudrunv2.DataSourceGoogleCloudRunV2Service(), "google_composer_environment": composer.DataSourceGoogleComposerEnvironment(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_composer_user_workloads_config_map": composer.DataSourceGoogleComposerUserWorkloadsConfigMap(), "google_composer_user_workloads_secret": composer.DataSourceGoogleComposerUserWorkloadsSecret(), - <% end -%> + {{- end }} "google_composer_image_versions": composer.DataSourceGoogleComposerImageVersions(), "google_compute_address": compute.DataSourceGoogleComputeAddress(), "google_compute_addresses": compute.DataSourceGoogleComputeAddresses(), @@ -132,10 +131,10 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_iam_policy": resourcemanager.DataSourceGoogleIamPolicy(), "google_iam_role": resourcemanager.DataSourceGoogleIamRole(), "google_iam_testable_permissions": resourcemanager.DataSourceGoogleIamTestablePermissions(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_iam_workload_identity_pool": iambeta.DataSourceIAMBetaWorkloadIdentityPool(), "google_iam_workload_identity_pool_provider": iambeta.DataSourceIAMBetaWorkloadIdentityPoolProvider(), - <% end -%> + {{- end }} "google_iap_client": iap.DataSourceGoogleIapClient(), "google_kms_crypto_key": kms.DataSourceGoogleKmsCryptoKey(), "google_kms_crypto_keys": kms.DataSourceGoogleKmsCryptoKeys(), @@ -146,13 +145,13 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_kms_key_rings": kms.DataSourceGoogleKmsKeyRings(), "google_kms_secret": kms.DataSourceGoogleKmsSecret(), "google_kms_secret_ciphertext": kms.DataSourceGoogleKmsSecretCiphertext(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_kms_secret_asymmetric": kms.DataSourceGoogleKmsSecretAsymmetric(), "google_firebase_android_app": firebase.DataSourceGoogleFirebaseAndroidApp(), "google_firebase_apple_app": firebase.DataSourceGoogleFirebaseAppleApp(), "google_firebase_hosting_channel": firebasehosting.DataSourceGoogleFirebaseHostingChannel(), "google_firebase_web_app": firebase.DataSourceGoogleFirebaseWebApp(), - <% end -%> + {{- end }} "google_folder": resourcemanager.DataSourceGoogleFolder(), "google_folders": resourcemanager.DataSourceGoogleFolders(), "google_folder_organization_policy": resourcemanager.DataSourceGoogleFolderOrganizationPolicy(), @@ -176,10 +175,10 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_project_service": resourcemanager.DataSourceGoogleProjectService(), "google_pubsub_subscription": pubsub.DataSourceGooglePubsubSubscription(), "google_pubsub_topic": pubsub.DataSourceGooglePubsubTopic(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_runtimeconfig_config": runtimeconfig.DataSourceGoogleRuntimeconfigConfig(), "google_runtimeconfig_variable": runtimeconfig.DataSourceGoogleRuntimeconfigVariable(), - <% end -%> + {{- end }} "google_secret_manager_regional_secret": secretmanagerregional.DataSourceSecretManagerRegionalRegionalSecret(), "google_secret_manager_secret": secretmanager.DataSourceSecretManagerSecret(), "google_secret_manager_secrets": secretmanager.DataSourceSecretManagerSecrets(), @@ -215,10 +214,10 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_tags_tag_value": tags.DataSourceGoogleTagsTagValue(), "google_tags_tag_values": tags.DataSourceGoogleTagsTagValues(), "google_tpu_tensorflow_versions": tpu.DataSourceTpuTensorflowVersions(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_tpu_v2_runtime_versions": tpuv2.DataSourceTpuV2RuntimeVersions(), "google_tpu_v2_accelerator_types": tpuv2.DataSourceTpuV2AcceleratorTypes(), - <% end -%> + {{- end }} "google_vpc_access_connector": vpcaccess.DataSourceVPCAccessConnector(), "google_redis_instance": redis.DataSourceGoogleRedisInstance(), "google_vertex_ai_index": vertexai.DataSourceVertexAIIndex(), @@ -237,11 +236,11 @@ var handwrittenDatasources = map[string]*schema.Resource{ var generatedIAMDatasources = map[string]*schema.Resource{ // ####### START generated IAM datasources ########### - <% resources_for_version.each do |object| -%> - <% unless object[:iam_class_name].nil? -%> - "<%= object[:terraform_name] -%>_iam_policy": tpgiamresource.DataSourceIamPolicy(<%= object[:iam_class_name] -%>IamSchema, <%= object[:iam_class_name] -%>IamUpdaterProducer), - <% end -%> - <% end -%> + {{- range $object := $.ResourcesForVersion }} + {{- if $object.IamClassName }} + "{{ $object.TerraformName }}_iam_policy": tpgiamresource.DataSourceIamPolicy({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer), + {{- end }} + {{- end }} // ####### END generated IAM datasources ########### } @@ -271,20 +270,20 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{ } // Resources -// Generated resources: <%= resource_count %> -// Generated IAM resources: <%= iam_resource_count %> -// Total generated resources: <%= resource_count + iam_resource_count %> +// Generated resources: {{ $.ResourceCount }} +// Generated IAM resources: {{ $.IAMResourceCount }} +// Total generated resources: {{ plus $.ResourceCount $.IAMResourceCount }} var generatedResources = map[string]*schema.Resource{ - <% resources_for_version.each do |object| -%> - <% unless object[:resource_name].nil? -%> - "<%= object[:terraform_name] -%>": <%= object[:resource_name] -%>(), - <% end -%> - <% unless object[:iam_class_name].nil? -%> - "<%= object[:terraform_name] -%>_iam_binding": tpgiamresource.ResourceIamBinding(<%= object[:iam_class_name] -%>IamSchema, <%= object[:iam_class_name] -%>IamUpdaterProducer, <%= object[:iam_class_name] -%>IdParseFunc), - "<%= object[:terraform_name] -%>_iam_member": tpgiamresource.ResourceIamMember(<%= object[:iam_class_name] -%>IamSchema, <%= object[:iam_class_name] -%>IamUpdaterProducer, <%= object[:iam_class_name] -%>IdParseFunc), - "<%= object[:terraform_name] -%>_iam_policy": tpgiamresource.ResourceIamPolicy(<%= object[:iam_class_name] -%>IamSchema, <%= object[:iam_class_name] -%>IamUpdaterProducer, <%= object[:iam_class_name] -%>IdParseFunc), - <% end -%> - <% end -%> + {{- range $object := $.ResourcesForVersion }} + {{- if $object.ResourceName }} + "{{ $object.TerraformName }}": {{ $object.ResourceName }}(), + {{- end }} + {{- if $object.IamClassName }} + "{{ $object.TerraformName }}_iam_binding": tpgiamresource.ResourceIamBinding({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), + "{{ $object.TerraformName }}_iam_member": tpgiamresource.ResourceIamMember({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), + "{{ $object.TerraformName }}_iam_policy": tpgiamresource.ResourceIamPolicy({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), + {{- end }} + {{- end }} } var handwrittenResources = map[string]*schema.Resource{ @@ -303,16 +302,16 @@ var handwrittenResources = map[string]*schema.Resource{ "google_billing_subaccount": resourcemanager.ResourceBillingSubaccount(), "google_cloudfunctions_function": cloudfunctions.ResourceCloudFunctionsFunction(), "google_composer_environment": composer.ResourceComposerEnvironment(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_composer_user_workloads_secret": composer.ResourceComposerUserWorkloadsSecret(), - <% end -%> + {{- end }} "google_compute_attached_disk": compute.ResourceComputeAttachedDisk(), "google_compute_instance": compute.ResourceComputeInstance(), "google_compute_disk_async_replication": compute.ResourceComputeDiskAsyncReplication(), "google_compute_router_peer": compute.ResourceComputeRouterBgpPeer(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_compute_instance_from_machine_image": compute.ResourceComputeInstanceFromMachineImage(), - <% end -%> + {{- end }} "google_compute_instance_from_template": compute.ResourceComputeInstanceFromTemplate(), "google_compute_instance_group": compute.ResourceComputeInstanceGroup(), "google_compute_instance_group_manager": compute.ResourceComputeInstanceGroupManager(), @@ -332,9 +331,9 @@ var handwrittenResources = map[string]*schema.Resource{ "google_container_node_pool": container.ResourceContainerNodePool(), "google_container_registry": containeranalysis.ResourceContainerRegistry(), "google_dataflow_job": dataflow.ResourceDataflowJob(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_dataflow_flex_template_job": dataflow.ResourceDataflowFlexTemplateJob(), - <% end -%> + {{- end }} "google_dataproc_cluster": dataproc.ResourceDataprocCluster(), "google_dataproc_job": dataproc.ResourceDataprocJob(), "google_dns_record_set": dns.ResourceDnsRecordSet(), @@ -355,9 +354,9 @@ var handwrittenResources = map[string]*schema.Resource{ "google_logging_project_bucket_config": logging.ResourceLoggingProjectBucketConfig(), "google_monitoring_dashboard": monitoring.ResourceMonitoringDashboard(), "google_os_config_os_policy_assignment": osconfig.ResourceOSConfigOSPolicyAssignment(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_project_service_identity": resourcemanager.ResourceProjectServiceIdentity(), - <% end -%> + {{- end }} "google_service_networking_connection": servicenetworking.ResourceServiceNetworkingConnection(), "google_sql_database_instance": sql.ResourceSqlDatabaseInstance(), "google_sql_ssl_cert": sql.ResourceSqlSslCert(), @@ -371,10 +370,10 @@ var handwrittenResources = map[string]*schema.Resource{ "google_project_iam_member_remove": resourcemanager.ResourceGoogleProjectIamMemberRemove(), "google_project_organization_policy": resourcemanager.ResourceGoogleProjectOrganizationPolicy(), "google_project_usage_export_bucket": compute.ResourceProjectUsageBucket(), - <% unless version == 'ga' -%> + {{- if ne $.TargetVersionName "ga" }} "google_runtimeconfig_config": runtimeconfig.ResourceRuntimeconfigConfig(), "google_runtimeconfig_variable": runtimeconfig.ResourceRuntimeconfigVariable(), - <% end -%> + {{- end }} "google_service_account": resourcemanager.ResourceGoogleServiceAccount(), "google_service_account_key": resourcemanager.ResourceGoogleServiceAccountKey(), "google_service_networking_peered_dns_domain": servicenetworking.ResourceGoogleServiceNetworkingPeeredDNSDomain(), diff --git a/mmv1/third_party/terraform/provider/provider_test.go.tmpl b/mmv1/third_party/terraform/provider/provider_test.go.tmpl index c978dbfac06f..046e242ae8e7 100644 --- a/mmv1/third_party/terraform/provider/provider_test.go.tmpl +++ b/mmv1/third_party/terraform/provider/provider_test.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package provider_test import ( @@ -365,7 +364,7 @@ func testAccCheckComputeAddressDestroyProducer(t *testing.T) func(s *terraform.S config := acctest.GoogleProviderConfig(t) - url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/addresses/{{name}}") + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/regions/{{"{{"}}region{{"}}"}}/addresses/{{"{{"}}name{{"}}"}}") if err != nil { return err } diff --git a/mmv1/third_party/terraform/scripts/diff.go.tmpl b/mmv1/third_party/terraform/scripts/diff.go.tmpl index 809ef0b048de..2eb0c4fe077f 100644 --- a/mmv1/third_party/terraform/scripts/diff.go.tmpl +++ b/mmv1/third_party/terraform/scripts/diff.go.tmpl @@ -1,7 +1,5 @@ -<% autogen_exception -%> package main -<% provider_name = version.nil? || version == 'ga' ? 'google' : 'google-' + version -%> import ( "flag" @@ -12,7 +10,7 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - googleOld "github.com/hashicorp/terraform-provider-clean-<%= provider_name -%>/<%= provider_name -%>/provider" + googleOld "github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }}/{{ $.ProviderFromVersion }}/provider" // "github.com/hashicorp/terraform-provider-google/google/provider" will be replaced with corresponding package based on the version when generating the provider package google "github.com/hashicorp/terraform-provider-google/google/provider" ) diff --git a/mmv1/third_party/terraform/scripts/go/diff.go.tmpl b/mmv1/third_party/terraform/scripts/go/diff.go.tmpl deleted file mode 100644 index 2eb0c4fe077f..000000000000 --- a/mmv1/third_party/terraform/scripts/go/diff.go.tmpl +++ /dev/null @@ -1,173 +0,0 @@ -package main - - -import ( - "flag" - "fmt" - "reflect" - "runtime" - "sort" - "strings" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - googleOld "github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }}/{{ $.ProviderFromVersion }}/provider" - // "github.com/hashicorp/terraform-provider-google/google/provider" will be replaced with corresponding package based on the version when generating the provider package - google "github.com/hashicorp/terraform-provider-google/google/provider" -) - -var verbose bool -var vFlag = flag.Bool("verbose", false, "set to true to produce more verbose diffs") -var resourceFlag = flag.String("resource", "", "the name of the terraform resource to diff") - -func main() { - flag.Parse() - if resourceFlag == nil || *resourceFlag == "" { - fmt.Print("resource flag not specified\n") - panic("the resource to diff must be specified") - } - resourceName := *resourceFlag - verbose = *vFlag - m := google.ResourceMap() - res, ok := m[resourceName] - if !ok { - panic(fmt.Sprintf("Unable to find resource in TPGB: %s", resourceName)) - } - m2 := googleOld.ResourceMap() - res2, ok := m2[resourceName] - if !ok { - panic(fmt.Sprintf("Unable to find resource in clean TPGB: %s", resourceName)) - } - fmt.Printf("------------Diffing resource %s------------\n", resourceName) - diffSchema(res2.Schema, res.Schema, []string{}) - fmt.Print("------------Done------------\n") -} - -// Diffs a Terraform resource schema. Calls itself recursively as some fields -// are implemented using schema.Resource as their element type -func diffSchema(old, new map[string]*schema.Schema, path []string) { - var sharedKeys []string - var addedKeys []string - for k := range new { - if _, ok := old[k]; ok { - sharedKeys = append(sharedKeys, k) - } else { - // Key not found in old schema - addedKeys = append(addedKeys, k) - } - } - var missingKeys []string - for k := range old { - if _, ok := new[k]; !ok { - missingKeys = append(missingKeys, k) - } - } - sort.Strings(sharedKeys) - sort.Strings(addedKeys) - sort.Strings(missingKeys) - if len(addedKeys) != 0 { - var qualifiedKeys []string - for _, k := range addedKeys { - qualifiedKeys = append(qualifiedKeys, strings.Join(append(path, k), ".")) - } - fmt.Printf("Fields added in tpgtools: %v\n", qualifiedKeys) - } - if len(missingKeys) != 0 { - var qualifiedKeys []string - for _, k := range missingKeys { - qualifiedKeys = append(qualifiedKeys, strings.Join(append(path, k), ".")) - } - fmt.Printf("Fields missing in tpgtools: %v\n", qualifiedKeys) - } - for _, k := range sharedKeys { - diffSchemaObject(old[k], new[k], append(path, k)) - } -} - -// Diffs a schema.Schema object. Calls itself and diffSchema recursively as -// needed on nested fields. -func diffSchemaObject(old, new *schema.Schema, path []string) { - if old.Required != new.Required { - fmt.Printf("Required status different for path %s, was: %t is now %t\n", strings.Join(path, "."), old.Required, new.Required) - } - if old.Computed != new.Computed { - fmt.Printf("Computed status different for path %s, was: %t is now %t\n", strings.Join(path, "."), old.Computed, new.Computed) - } - if old.Optional != new.Optional { - fmt.Printf("Optional status different for path %s, was: %t is now %t\n", strings.Join(path, "."), old.Optional, new.Optional) - } - if old.ForceNew != new.ForceNew { - fmt.Printf("ForceNew status different for path %s, was: %t is now %t\n", strings.Join(path, "."), old.ForceNew, new.ForceNew) - } - if old.Type != new.Type { - fmt.Printf("Type different for path %s, was: %s is now %s\n", strings.Join(path, "."), old.Type, new.Type) - // Types are different, other diffs won't make sense - return - } - if old.Sensitive != new.Sensitive { - fmt.Printf("Sensitive status different for path %s, was: %t is now %t\n", strings.Join(path, "."), old.Sensitive, new.Sensitive) - } - if old.Deprecated != new.Deprecated { - fmt.Printf("Deprecated status different for path %s, was: %s is now %s\n", strings.Join(path, "."), old.Deprecated, new.Deprecated) - } - if old.MaxItems != new.MaxItems { - fmt.Printf("MaxItems different for path %s, was: %d is now %d\n", strings.Join(path, "."), old.MaxItems, new.MaxItems) - } - if old.MinItems != new.MinItems { - fmt.Printf("MinItems different for path %s, was: %d is now %d\n", strings.Join(path, "."), old.MinItems, new.MinItems) - } - if old.Default != new.Default { - fmt.Printf("Default value different for path %s, was: %v is now %v\n", strings.Join(path, "."), old.Default, new.Default) - } - if old.ConfigMode != new.ConfigMode { - // This is only set on very few complicated resources (instance, container cluster) - fmt.Printf("ConfigMode different for path %s, was: %v is now %v\n", strings.Join(path, "."), old.ConfigMode, new.ConfigMode) - } - // Verbose diffs. Enabled using --verbose flag - if verbose && !reflect.DeepEqual(old.ConflictsWith, new.ConflictsWith) { - fmt.Printf("ConflictsWith different for path %s, was: %v is now %v\n", strings.Join(path, "."), old.ConflictsWith, new.ConflictsWith) - } - oldDiffSuppressFunc := findFunctionName(old.DiffSuppressFunc) - newDiffSuppressFunc := findFunctionName(new.DiffSuppressFunc) - if verbose && oldDiffSuppressFunc != newDiffSuppressFunc { - fmt.Printf("DiffSuppressFunc for path %s, was: %s is now %s\n", strings.Join(path, "."), oldDiffSuppressFunc, newDiffSuppressFunc) - } - oldStateFunc := findFunctionName(old.StateFunc) - newStateFunc := findFunctionName(new.StateFunc) - if verbose && oldStateFunc != newStateFunc { - fmt.Printf("StateFunc for path %s, was: %s is now %s\n", strings.Join(path, "."), oldStateFunc, newStateFunc) - } - oldValidateFunc := findFunctionName(old.ValidateFunc) - newValidateFunc := findFunctionName(new.ValidateFunc) - if verbose && oldValidateFunc != newValidateFunc { - fmt.Printf("ValidateFunc for path %s, was: %s is now %s\n", strings.Join(path, "."), oldValidateFunc, newValidateFunc) - } - oldSet := findFunctionName(old.Set) - newSet := findFunctionName(new.Set) - if verbose && oldSet != newSet { - fmt.Printf("Set function for path %s, was: %s is now %s\n", strings.Join(path, "."), oldSet, newSet) - } - // Recursive calls for nested objects - if old.Type == schema.TypeList || old.Type == schema.TypeMap || old.Type == schema.TypeSet { - oldElem := old.Elem - newElem := new.Elem - if reflect.TypeOf(oldElem) != reflect.TypeOf(newElem) { - fmt.Printf("Elem type different for path %s, was: %T is now %T\n", strings.Join(path, "."), oldElem, newElem) - } - switch v := oldElem.(type) { - case *schema.Resource: - diffSchema(v.Schema, newElem.(*schema.Resource).Schema, path) - case *schema.Schema: - // Primitive unnamed field as only element - diffSchemaObject(v, newElem.(*schema.Schema), append(path, "elem")) - } - } -} -func findFunctionName(f interface{}) string { - ptr := reflect.ValueOf(f).Pointer() - fun := runtime.FuncForPC(ptr) - if fun == nil { - return "" - } - split := strings.Split(fun.Name(), ".") - return split[len(split)-1] -} diff --git a/mmv1/third_party/terraform/scripts/go/run_diff.sh.tmpl b/mmv1/third_party/terraform/scripts/go/run_diff.sh.tmpl deleted file mode 100644 index 79b3987c81b1..000000000000 --- a/mmv1/third_party/terraform/scripts/go/run_diff.sh.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -set -e -set -x -if [ -z "$1" ]; then - echo "Must provide 1 argument - name of resource to diff, e.g. 'google_compute_forwarding_rule'" - exit 1 -fi - -function cleanup() { - go mod edit -dropreplace=github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} - go mod edit -droprequire=github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} -} - -trap cleanup EXIT -if [[ -d ~/go/src/github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} ]]; then - pushd ~/go/src/github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} - git clean -fdx - git reset --hard - git checkout main - git pull - popd -else - mkdir -p ~/go/src/github.com/hashicorp - git clone https://github.com/hashicorp/terraform-provider-{{ $.ProviderFromVersion }} ~/go/src/github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} -fi - - -go mod edit -require=github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }}@v0.0.0 -go mod edit -replace github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }}=$(realpath ~/go/src/github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }}) -go run scripts/diff.go --resource $1 --verbose diff --git a/mmv1/third_party/terraform/scripts/run_diff.sh.tmpl b/mmv1/third_party/terraform/scripts/run_diff.sh.tmpl old mode 100755 new mode 100644 index d009090956e8..79b3987c81b1 --- a/mmv1/third_party/terraform/scripts/run_diff.sh.tmpl +++ b/mmv1/third_party/terraform/scripts/run_diff.sh.tmpl @@ -1,6 +1,4 @@ -<% autogen_exception -%> #!/bin/bash -<% provider_name = version.nil? || version == 'ga' ? 'google' : 'google-' + version -%> set -e set -x if [ -z "$1" ]; then @@ -9,13 +7,13 @@ if [ -z "$1" ]; then fi function cleanup() { - go mod edit -dropreplace=github.com/hashicorp/terraform-provider-clean-<%= provider_name %> - go mod edit -droprequire=github.com/hashicorp/terraform-provider-clean-<%= provider_name %> + go mod edit -dropreplace=github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} + go mod edit -droprequire=github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} } trap cleanup EXIT -if [[ -d ~/go/src/github.com/hashicorp/terraform-provider-clean-<%= provider_name %> ]]; then - pushd ~/go/src/github.com/hashicorp/terraform-provider-clean-<%= provider_name %> +if [[ -d ~/go/src/github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} ]]; then + pushd ~/go/src/github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} git clean -fdx git reset --hard git checkout main @@ -23,10 +21,10 @@ if [[ -d ~/go/src/github.com/hashicorp/terraform-provider-clean-<%= provider_nam popd else mkdir -p ~/go/src/github.com/hashicorp - git clone https://github.com/hashicorp/terraform-provider-<%= provider_name %> ~/go/src/github.com/hashicorp/terraform-provider-clean-<%= provider_name %> + git clone https://github.com/hashicorp/terraform-provider-{{ $.ProviderFromVersion }} ~/go/src/github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }} fi -go mod edit -require=github.com/hashicorp/terraform-provider-clean-<%= provider_name -%>@v0.0.0 -go mod edit -replace github.com/hashicorp/terraform-provider-clean-<%= provider_name -%>=$(realpath ~/go/src/github.com/hashicorp/terraform-provider-clean-<%= provider_name -%>) +go mod edit -require=github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }}@v0.0.0 +go mod edit -replace github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }}=$(realpath ~/go/src/github.com/hashicorp/terraform-provider-clean-{{ $.ProviderFromVersion }}) go run scripts/diff.go --resource $1 --verbose 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 d762f612263d..c10152aabb2a 100644 --- a/mmv1/third_party/terraform/sweeper/gcp_sweeper_test.go.tmpl +++ b/mmv1/third_party/terraform/sweeper/gcp_sweeper_test.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package sweeper_test @@ -7,9 +6,9 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" -<% products.each do |product| -%> - _ "github.com/hashicorp/terraform-provider-google/google/services/<%= product[:definitions].name.downcase -%>" -<% end -%> +{{- range $product := $.Products }} + _ "github.com/hashicorp/terraform-provider-google/google/services/{{ lower $product.Name }}" +{{- end }} // Manually add the services for DCL resource and handwritten resource sweepers if they are not in the above list _ "github.com/hashicorp/terraform-provider-google/google/services/apikeys" diff --git a/mmv1/third_party/terraform/sweeper/go/gcp_sweeper_test.go.tmpl b/mmv1/third_party/terraform/sweeper/go/gcp_sweeper_test.go.tmpl deleted file mode 100644 index c10152aabb2a..000000000000 --- a/mmv1/third_party/terraform/sweeper/go/gcp_sweeper_test.go.tmpl +++ /dev/null @@ -1,30 +0,0 @@ - -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 }} - - // Manually add the services for DCL resource and handwritten resource sweepers if they are not in the above list - _ "github.com/hashicorp/terraform-provider-google/google/services/apikeys" - _ "github.com/hashicorp/terraform-provider-google/google/services/clouddeploy" - _ "github.com/hashicorp/terraform-provider-google/google/services/composer" - _ "github.com/hashicorp/terraform-provider-google/google/services/container" - _ "github.com/hashicorp/terraform-provider-google/google/services/containeraws" - _ "github.com/hashicorp/terraform-provider-google/google/services/containerazure" - _ "github.com/hashicorp/terraform-provider-google/google/services/dataflow" - _ "github.com/hashicorp/terraform-provider-google/google/services/eventarc" - _ "github.com/hashicorp/terraform-provider-google/google/services/firebase" - _ "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" -) - -func TestMain(m *testing.M) { - resource.TestMain(m) -} diff --git a/mmv1/third_party/terraform/tpgiamresource/go/iam.go.tmpl b/mmv1/third_party/terraform/tpgiamresource/go/iam.go.tmpl deleted file mode 100644 index 3222c6adfaee..000000000000 --- a/mmv1/third_party/terraform/tpgiamresource/go/iam.go.tmpl +++ /dev/null @@ -1,567 +0,0 @@ -// Utils for modifying IAM policies for resources across GCP -package tpgiamresource - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "sort" - "strings" - "time" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/errwrap" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "google.golang.org/api/cloudresourcemanager/v1" -) - -const maxBackoffSeconds = 30 -const IamPolicyVersion = 3 - -// These types are implemented per GCP resource type and specify how to do per-resource IAM operations. -// They are used in the generic Terraform IAM resource definitions -// (e.g. _member/_binding/_policy/_audit_config) -type ( - // The ResourceIamUpdater interface is implemented for each GCP resource supporting IAM policy. - // Implementations should be created per resource and should keep track of the resource identifier. - ResourceIamUpdater interface { - // Fetch the existing IAM policy attached to a resource. - GetResourceIamPolicy() (*cloudresourcemanager.Policy, error) - - // Replaces the existing IAM Policy attached to a resource. - SetResourceIamPolicy(policy *cloudresourcemanager.Policy) error - - // A mutex guards against concurrent to call to the SetResourceIamPolicy method. - // The mutex key should be made of the resource type and resource id. - // For example: `iam-project-{id}`. - GetMutexKey() string - - // Returns the unique resource identifier. - GetResourceId() string - - // Textual description of this resource to be used in error message. - // The description should include the unique resource identifier. - DescribeResource() string - } - - // Factory for generating ResourceIamUpdater for given ResourceData resource - NewResourceIamUpdaterFunc func(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (ResourceIamUpdater, error) - - // Describes how to modify a policy for a given Terraform IAM (_policy/_member/_binding/_audit_config) resource - iamPolicyModifyFunc func(p *cloudresourcemanager.Policy) error - - // Parser for Terraform resource identifier (d.Id) for resource whose IAM policy is being changed - ResourceIdParserFunc func(d *schema.ResourceData, config *transport_tpg.Config) error -) - -// Locking wrapper around read-only operation with retries. -func iamPolicyReadWithRetry(updater ResourceIamUpdater) (*cloudresourcemanager.Policy, error) { - mutexKey := updater.GetMutexKey() - transport_tpg.MutexStore.Lock(mutexKey) - defer transport_tpg.MutexStore.Unlock(mutexKey) - - log.Printf("[DEBUG] Retrieving policy for %s\n", updater.DescribeResource()) - var policy *cloudresourcemanager.Policy - err := transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: func() (perr error) { - policy, perr = updater.GetResourceIamPolicy() - return perr - }, - Timeout: 10 * time.Minute, - }) - if err != nil { - return nil, err - } - log.Print(spew.Sprintf("[DEBUG] Retrieved policy for %s: %#v\n", updater.DescribeResource(), policy)) - return policy, nil -} - -// Locking wrapper around read-modify-write cycle for IAM policy. -func iamPolicyReadModifyWrite(updater ResourceIamUpdater, modify iamPolicyModifyFunc) error { - mutexKey := updater.GetMutexKey() - transport_tpg.MutexStore.Lock(mutexKey) - defer transport_tpg.MutexStore.Unlock(mutexKey) - - backoff := time.Second - for { - log.Printf("[DEBUG]: Retrieving policy for %s\n", updater.DescribeResource()) - p, err := updater.GetResourceIamPolicy() - if transport_tpg.IsGoogleApiErrorWithCode(err, 429) { - log.Printf("[DEBUG] 429 while attempting to read policy for %s, waiting %v before attempting again", updater.DescribeResource(), backoff) - time.Sleep(backoff) - continue - } else if err != nil { - return err - } - log.Printf("[DEBUG]: Retrieved policy for %s: %+v\n", updater.DescribeResource(), p) - - err = modify(p) - if err != nil { - return err - } - - log.Printf("[DEBUG]: Setting policy for %s to %+v\n", updater.DescribeResource(), p) - err = updater.SetResourceIamPolicy(p) - if err == nil { - fetchBackoff := 1 * time.Second - for successfulFetches := 0; successfulFetches < 3; { - if fetchBackoff > maxBackoffSeconds*time.Second { - return fmt.Errorf("Error applying IAM policy to %s: Waited too long for propagation.\n", updater.DescribeResource()) - } - time.Sleep(fetchBackoff) - log.Printf("[DEBUG]: Retrieving policy for %s\n", updater.DescribeResource()) - new_p, err := updater.GetResourceIamPolicy() - if err != nil { - // Quota for Read is pretty limited, so watch out for running out of quota. - if transport_tpg.IsGoogleApiErrorWithCode(err, 429) { - fetchBackoff = fetchBackoff * 2 - } else { - return err - } - } - log.Printf("[DEBUG]: Retrieved policy for %s: %+v\n", updater.DescribeResource(), p) - if new_p == nil { - // https://github.com/hashicorp/terraform-provider-google/issues/2625 - fetchBackoff = fetchBackoff * 2 - continue - } - modified_p := new_p - // This relies on the fact that `modify` is idempotent: since other changes might have - // happened between the call to set the policy and now, we just need to make sure that - // our change has been made. 'modify(p) == p' is our check for whether this has been - // correctly applied. - err = modify(modified_p) - if err != nil { - return err - } - if modified_p == new_p { - successfulFetches += 1 - } else { - fetchBackoff = fetchBackoff * 2 - } - } - break - } - if tpgresource.IsConflictError(err) { - log.Printf("[DEBUG]: Concurrent policy changes, restarting read-modify-write after %s\n", backoff) - time.Sleep(backoff) - backoff = backoff * 2 - if backoff > 30*time.Second { - return errwrap.Wrapf(fmt.Sprintf("Error applying IAM policy to %s: Too many conflicts. Latest error: {{"{{"}}err{{"}}"}}", updater.DescribeResource()), err) - } - continue - } - - // retry in the case that a service account is not found. This can happen when a service account is deleted - // out of band. - if isServiceAccountNotFoundError, _ := transport_tpg.IamServiceAccountNotFound(err); isServiceAccountNotFoundError { - // calling a retryable function within a retry loop is not - // strictly the _best_ idea, but this error only happens in - // high-traffic projects anyways - currentPolicy, rerr := iamPolicyReadWithRetry(updater) - if rerr != nil { - if p.Etag != currentPolicy.Etag { - // not matching indicates that there is a new state to attempt to apply - log.Printf("current and old etag did not match for %s, retrying", updater.DescribeResource()) - time.Sleep(backoff) - backoff = backoff * 2 - continue - } - - log.Printf("current and old etag matched for %s, not retrying", updater.DescribeResource()) - } else { - // if the error is non-nil, just fall through and return the base error - log.Printf("[DEBUG]: error checking etag for policy %s. error: %v", updater.DescribeResource(), rerr) - } - } - - log.Printf("[DEBUG]: not retrying IAM policy for %s. error: %v", updater.DescribeResource(), err) - return errwrap.Wrapf(fmt.Sprintf("Error applying IAM policy for %s: {{"{{"}}err{{"}}"}}", updater.DescribeResource()), err) - } - log.Printf("[DEBUG]: Set policy for %s", updater.DescribeResource()) - return nil -} - -// Flattens a list of Bindings so each role+condition has a single Binding with combined members -func MergeBindings(bindings []*cloudresourcemanager.Binding) []*cloudresourcemanager.Binding { - bm := createIamBindingsMap(bindings) - return listFromIamBindingMap(bm) -} - -type conditionKey struct { - Description string - Expression string - Title string -} - -func conditionKeyFromCondition(condition *cloudresourcemanager.Expr) conditionKey { - if condition == nil { - return conditionKey{} - } - return conditionKey{condition.Description, condition.Expression, condition.Title} -} - -func (k conditionKey) Empty() bool { - return k == conditionKey{} -} - -func (k conditionKey) String() string { - return fmt.Sprintf("%s/%s/%s", k.Title, k.Description, k.Expression) -} - -type iamBindingKey struct { - Role string - Condition conditionKey -} - -// Removes a single role+condition binding from a list of Bindings -func filterBindingsWithRoleAndCondition(b []*cloudresourcemanager.Binding, role string, condition *cloudresourcemanager.Expr) []*cloudresourcemanager.Binding { - bMap := createIamBindingsMap(b) - key := iamBindingKey{role, conditionKeyFromCondition(condition)} - delete(bMap, key) - return listFromIamBindingMap(bMap) -} - -// Removes given role+condition/bound-member pairs from the given Bindings (i.e subtraction). -func subtractFromBindings(bindings []*cloudresourcemanager.Binding, toRemove ...*cloudresourcemanager.Binding) []*cloudresourcemanager.Binding { - currMap := createIamBindingsMap(bindings) - toRemoveMap := createIamBindingsMap(toRemove) - - for key, removeSet := range toRemoveMap { - members, ok := currMap[key] - if !ok { - continue - } - // Remove all removed members - for m := range removeSet { - delete(members, m) - } - // Remove role+condition from bindings - if len(members) == 0 { - delete(currMap, key) - } - } - - return listFromIamBindingMap(currMap) -} - -func iamMemberIsCaseSensitive(member string) bool { - // allAuthenticatedUsers and allUsers are special identifiers that are case sensitive. See: - // https://cloud.google.com/iam/docs/overview#all-authenticated-users - return strings.Contains(member, "allAuthenticatedUsers") || strings.Contains(member, "allUsers") || - strings.HasPrefix(member, "principalSet:") || strings.HasPrefix(member, "principal:") || - strings.HasPrefix(member, "principalHierarchy:") -} - -// normalizeIamMemberCasing returns the case adjusted value of an iamMember -// this is important as iam will ignore casing unless it is one of the following -// member types: principalSet, principal, principalHierarchy -// members are in : format -// is case sensitive -// isn't in most cases -// so lowercase the value unless iamMemberIsCaseSensitive and leave the type alone -// since Dec '19 members can be prefixed with "deleted:" to indicate the principal -// has been deleted -func normalizeIamMemberCasing(member string) string { - var pieces []string - if strings.HasPrefix(member, "deleted:") { - pieces = strings.SplitN(member, ":", 3) - if len(pieces) > 2 && !iamMemberIsCaseSensitive(strings.TrimPrefix(member, "deleted:")) { - pieces[2] = strings.ToLower(pieces[2]) - } - } else if strings.HasPrefix(member, "iamMember:") { - pieces = strings.SplitN(member, ":", 3) - if len(pieces) > 2 && !iamMemberIsCaseSensitive(strings.TrimPrefix(member, "iamMember:")) { - pieces[2] = strings.ToLower(pieces[2]) - } - } else if !iamMemberIsCaseSensitive(member) { - pieces = strings.SplitN(member, ":", 2) - if len(pieces) > 1 { - pieces[1] = strings.ToLower(pieces[1]) - } - } - - if len(pieces) > 0 { - member = strings.Join(pieces, ":") - } - return member -} - -// Construct map of role to set of members from list of bindings. -func createIamBindingsMap(bindings []*cloudresourcemanager.Binding) map[iamBindingKey]map[string]struct{} { - bm := make(map[iamBindingKey]map[string]struct{}) - // Get each binding - for _, b := range bindings { - members := make(map[string]struct{}) - key := iamBindingKey{b.Role, conditionKeyFromCondition(b.Condition)} - // Initialize members map - if _, ok := bm[key]; ok { - members = bm[key] - } - // Get each member (user/principal) for the binding - for _, m := range b.Members { - m = normalizeIamMemberCasing(m) - // Add the member - members[m] = struct{}{} - } - if len(members) > 0 { - bm[key] = members - } else { - delete(bm, key) - } - } - return bm -} - -// Return list of Bindings for a map of role to member sets -func listFromIamBindingMap(bm map[iamBindingKey]map[string]struct{}) []*cloudresourcemanager.Binding { - rb := make([]*cloudresourcemanager.Binding, 0, len(bm)) - var keys []iamBindingKey - for k := range bm { - keys = append(keys, k) - } - sort.Slice(keys, func(i, j int) bool { - keyI := keys[i] - keyJ := keys[j] - return fmt.Sprintf("%s%s", keyI.Role, keyI.Condition.String()) < fmt.Sprintf("%s%s", keyJ.Role, keyJ.Condition.String()) - }) - for _, key := range keys { - members := bm[key] - if len(members) == 0 { - continue - } - b := &cloudresourcemanager.Binding{ - Role: key.Role, - Members: tpgresource.StringSliceFromGolangSet(members), - } - if !key.Condition.Empty() { - b.Condition = &cloudresourcemanager.Expr{ - Description: key.Condition.Description, - Expression: key.Condition.Expression, - Title: key.Condition.Title, - } - } - rb = append(rb, b) - } - return rb -} - -// Flattens AuditConfigs so each role has a single Binding with combined members\ -func removeAllAuditConfigsWithService(ac []*cloudresourcemanager.AuditConfig, service string) []*cloudresourcemanager.AuditConfig { - acMap := createIamAuditConfigsMap(ac) - delete(acMap, service) - return listFromIamAuditConfigMap(acMap) -} - -// Build a AuditConfig service to audit log config map -func createIamAuditConfigsMap(auditConfigs []*cloudresourcemanager.AuditConfig) map[string]map[string]map[string]struct{} { - acMap := make(map[string]map[string]map[string]struct{}) - - for _, ac := range auditConfigs { - if _, ok := acMap[ac.Service]; !ok { - acMap[ac.Service] = make(map[string]map[string]struct{}) - } - alcMap := acMap[ac.Service] - for _, alc := range ac.AuditLogConfigs { - if _, ok := alcMap[alc.LogType]; !ok { - alcMap[alc.LogType] = make(map[string]struct{}) - } - memberMap := alcMap[alc.LogType] - // Add members to map for log type. - for _, m := range alc.ExemptedMembers { - memberMap[m] = struct{}{} - } - } - } - - return acMap -} - -// Construct list of AuditConfigs from audit config maps. -func listFromIamAuditConfigMap(acMap map[string]map[string]map[string]struct{}) []*cloudresourcemanager.AuditConfig { - ac := make([]*cloudresourcemanager.AuditConfig, 0, len(acMap)) - - for service, logConfigMap := range acMap { - if len(logConfigMap) == 0 { - continue - } - - logConfigs := make([]*cloudresourcemanager.AuditLogConfig, 0, len(logConfigMap)) - for logType, memberSet := range logConfigMap { - alc := &cloudresourcemanager.AuditLogConfig{ - LogType: logType, - ForceSendFields: []string{"exemptedMembers"}, - } - if len(memberSet) > 0 { - alc.ExemptedMembers = tpgresource.StringSliceFromGolangSet(memberSet) - } - logConfigs = append(logConfigs, alc) - } - - ac = append(ac, &cloudresourcemanager.AuditConfig{ - Service: service, - AuditLogConfigs: logConfigs, - }) - } - return ac -} - -func jsonPolicyDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - if old == "" && new == "" { - return true - } - - var oldPolicy, newPolicy cloudresourcemanager.Policy - if old != "" && new != "" { - if err := json.Unmarshal([]byte(old), &oldPolicy); err != nil { - log.Printf("[ERROR] Could not unmarshal old policy %s: %v", old, err) - return false - } - if err := json.Unmarshal([]byte(new), &newPolicy); err != nil { - log.Printf("[ERROR] Could not unmarshal new policy %s: %v", new, err) - return false - } - - return compareIamPolicies(&newPolicy, &oldPolicy) - } - - return false -} - -func compareIamPolicies(a, b *cloudresourcemanager.Policy) bool { - if a.Etag != b.Etag { - log.Printf("[DEBUG] policies etag differ: %q vs %q", a.Etag, b.Etag) - return false - } - if a.Version != b.Version { - log.Printf("[DEBUG] policies version differ: %q vs %q", a.Version, b.Version) - return false - } - if !CompareBindings(a.Bindings, b.Bindings) { - log.Printf("[DEBUG] policies bindings differ: %#v vs %#v", a.Bindings, b.Bindings) - return false - } - if !CompareAuditConfigs(a.AuditConfigs, b.AuditConfigs) { - log.Printf("[DEBUG] policies audit configs differ: %#v vs %#v", a.AuditConfigs, b.AuditConfigs) - return false - } - return true -} - -func CompareBindings(a, b []*cloudresourcemanager.Binding) bool { - aMap := createIamBindingsMap(a) - bMap := createIamBindingsMap(b) - return reflect.DeepEqual(aMap, bMap) -} - -func CompareAuditConfigs(a, b []*cloudresourcemanager.AuditConfig) bool { - aMap := createIamAuditConfigsMap(a) - bMap := createIamAuditConfigsMap(b) - return reflect.DeepEqual(aMap, bMap) -} - -type IamSettings struct { - DeprecationMessage string - EnableBatching bool -} - -func NewIamSettings(options ...func(*IamSettings)) *IamSettings { - settings := &IamSettings{} - for _, o := range options { - o(settings) - } - return settings -} - -func IamWithDeprecationMessage(message string) func(s *IamSettings) { - return func(s *IamSettings) { - s.DeprecationMessage = message - } -} - -func IamWithGAResourceDeprecation() func (s *IamSettings) { - {{- if eq $.TargetVersionName "ga" }} - return IamWithDeprecationMessage("This resource has been deprecated in the google (GA) provider, and will only be available in the google-beta provider in a future release.") - {{- else }} - return IamWithDeprecationMessage("") - {{- end }} -} - -func IamWithBatching (s *IamSettings) { - s.EnableBatching = true -} - -// Util to deref and print auditConfigs -func DebugPrintAuditConfigs(bs []*cloudresourcemanager.AuditConfig) string { - v, _ := json.MarshalIndent(bs, "", "\t") - return string(v) -} - -// Util to deref and print bindings -func DebugPrintBindings(bs []*cloudresourcemanager.Binding) string { - v, _ := json.MarshalIndent(bs, "", "\t") - return string(v) -} - -// Returns a map representing iam bindings that are in the first map but not the second. -func missingBindingsMap(aMap, bMap map[iamBindingKey]map[string]struct{}) map[iamBindingKey]map[string]struct{} { - results := make(map[iamBindingKey]map[string]struct{}) - for key, aMembers := range aMap { - if bMembers, ok := bMap[key]; ok { - // The key is in both maps. - resultMembers := make(map[string]struct{}) - - for aMember := range aMembers { - if _, ok := bMembers[aMember]; !ok { - // The member is in a but not in b. - resultMembers[aMember] = struct{}{} - } - } - for bMember := range bMembers { - if _, ok := aMembers[bMember]; !ok { - // The member is in b but not in a. - resultMembers[bMember] = struct{}{} - } - } - - if len(resultMembers) > 0 { - results[key] = resultMembers - } - } else { - // The key is in map a but not map b. - results[key] = aMembers - } - } - - for key, bMembers := range bMap { - if _, ok := aMap[key]; !ok { - // The key is in map b but not map a. - results[key] = bMembers - } - } - - return results -} - -// Returns the bindings that are in the first set of bindings but not the second. -func MissingBindings(a, b []*cloudresourcemanager.Binding) []*cloudresourcemanager.Binding { - aMap := createIamBindingsMap(a) - bMap := createIamBindingsMap(b) - - var results []*cloudresourcemanager.Binding - for key, membersSet := range missingBindingsMap(aMap, bMap) { - members := make([]string, 0, len(membersSet)) - for member := range membersSet { - members = append(members, member) - } - results = append(results, &cloudresourcemanager.Binding{ - Role: key.Role, - Members: members, - }) - } - return results -} diff --git a/mmv1/third_party/terraform/tpgiamresource/go/iam_test.go.tmpl b/mmv1/third_party/terraform/tpgiamresource/go/iam_test.go.tmpl deleted file mode 100644 index dbf666ea50e4..000000000000 --- a/mmv1/third_party/terraform/tpgiamresource/go/iam_test.go.tmpl +++ /dev/null @@ -1,1333 +0,0 @@ -package tpgiamresource - -import ( - "reflect" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "google.golang.org/api/cloudresourcemanager/v1" -) - -func TestIamMergeBindings(t *testing.T) { - testCases := []struct { - input []*cloudresourcemanager.Binding - expect []*cloudresourcemanager.Binding - }{ - // Nothing to merge - return same list - { - input: []*cloudresourcemanager.Binding{}, - expect: []*cloudresourcemanager.Binding{}, - }, - // No members returns no binding - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - }, - { - Role: "role-2", - Members: []string{"member-2"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-2", - Members: []string{"member-2"}, - }, - }, - }, - // Nothing to merge - return same list - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1"}, - }, - }, - }, - // Nothing to merge - return same list - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1"}, - }, - { - Role: "role-2", - Members: []string{"member-2"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1"}, - }, - { - Role: "role-2", - Members: []string{"member-2"}, - }, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1"}, - }, - { - Role: "role-1", - Members: []string{"member-2"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - { - Role: "role-1", - Members: []string{"member-3"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2", "member-3"}, - }, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-3", "member-4"}, - }, - { - Role: "role-1", - Members: []string{"member-2", "member-1"}, - }, - { - Role: "role-2", - Members: []string{"member-1"}, - }, - { - Role: "role-1", - Members: []string{"member-5"}, - }, - { - Role: "role-3", - Members: []string{"member-1"}, - }, - { - Role: "role-2", - Members: []string{"member-2"}, - }, - {Role: "empty-role", Members: []string{}}, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2", "member-3", "member-4", "member-5"}, - }, - { - Role: "role-2", - Members: []string{"member-1", "member-2"}, - }, - { - Role: "role-3", - Members: []string{"member-1"}, - }, - }, - }, -{{- if ne $.TargetVersionName "ga" }} - // Same role+members, different condition - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - }, - }, - // Same role, same condition - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - { - Role: "role-1", - Members: []string{"member-3"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2", "member-3"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - }, - }, - // Different roles, same condition - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - { - Role: "role-2", - Members: []string{"member-3"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - { - Role: "role-2", - Members: []string{"member-3"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - }, - }, - }, - }, -{{- end }} - } - - for _, tc := range testCases { - got := MergeBindings(tc.input) - if !CompareBindings(got, tc.expect) { - t.Errorf("Unexpected value for MergeBindings(%s).\nActual: %s\nExpected: %s\n", - DebugPrintBindings(tc.input), DebugPrintBindings(got), DebugPrintBindings(tc.expect)) - } - } -} - -func TestIamFilterBindingsWithRoleAndCondition(t *testing.T) { - testCases := []struct { - input []*cloudresourcemanager.Binding - role string - conditionTitle string - expect []*cloudresourcemanager.Binding - }{ - // No-op - { - input: []*cloudresourcemanager.Binding{}, - role: "role-1", - expect: []*cloudresourcemanager.Binding{}, - }, - // Remove one binding - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - role: "role-1", - expect: []*cloudresourcemanager.Binding{}, - }, - // Remove multiple bindings - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - { - Role: "role-1", - Members: []string{"member-3"}, - }, - }, - role: "role-1", - expect: []*cloudresourcemanager.Binding{}, - }, - // Remove multiple bindings and leave some. - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - { - Role: "role-2", - Members: []string{"member-1"}, - }, - { - Role: "role-3", - Members: []string{"member-1", "member-3"}, - }, - { - Role: "role-1", - Members: []string{"member-2"}, - }, - { - Role: "role-2", - Members: []string{"member-1", "member-2"}, - }, - }, - role: "role-1", - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-2", - Members: []string{"member-1"}, - }, - { - Role: "role-3", - Members: []string{"member-1", "member-3"}, - }, - { - Role: "role-2", - Members: []string{"member-1", "member-2"}, - }, - }, - }, -{{- if ne $.TargetVersionName "ga" }} - // Remove one binding with condition - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - { - Role: "role-1", - Members: []string{"member-3", "member-4"}, - Condition: &cloudresourcemanager.Expr{Title: "condition-1"}, - }, - }, - role: "role-1", - conditionTitle: "condition-1", - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - }, -{{- end }} - } - - for _, tc := range testCases { - got := filterBindingsWithRoleAndCondition(tc.input, tc.role, &cloudresourcemanager.Expr{Title: tc.conditionTitle}) - if !CompareBindings(got, tc.expect) { - t.Errorf("Got unexpected value for removeAllBindingsWithRole(%s, %s).\nActual: %s\nExpected: %s", - DebugPrintBindings(tc.input), tc.role, DebugPrintBindings(got), DebugPrintBindings(tc.expect)) - } - } -} - -func TestIamSubtractFromBindings(t *testing.T) { - testCases := []struct { - input []*cloudresourcemanager.Binding - remove []*cloudresourcemanager.Binding - expect []*cloudresourcemanager.Binding - }{ - { - input: []*cloudresourcemanager.Binding{}, - remove: []*cloudresourcemanager.Binding{}, - expect: []*cloudresourcemanager.Binding{}, - }, - // Empty input should no-op return empty - { - input: []*cloudresourcemanager.Binding{}, - remove: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - expect: []*cloudresourcemanager.Binding{}, - }, - // Empty removal should return original expect - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - remove: []*cloudresourcemanager.Binding{}, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - }, - // Removal not in input should no-op - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-1+"}, - }, - }, - remove: []*cloudresourcemanager.Binding{ - { - Role: "role-2", - Members: []string{"member-2"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-1+"}, - }, - }, - }, - // Same input/remove should return empty - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - remove: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - expect: []*cloudresourcemanager.Binding{}, - }, - // Single removal - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-2"}, - }, - }, - remove: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-2"}, - }, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-2", "member-3"}, - }, - { - Role: "role-2", - Members: []string{"member-1"}, - }, - { - Role: "role-1", - Members: []string{"member-1"}, - }, - { - Role: "role-3", - Members: []string{"member-1"}, - }, - { - Role: "role-2", - Members: []string{"member-2"}, - }, - }, - remove: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-2", "member-4"}, - }, - { - Role: "role-2", - Members: []string{"member-2"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-3"}, - }, - { - Role: "role-2", - Members: []string{"member-1"}, - }, - { - Role: "role-3", - Members: []string{"member-1"}, - }, - }, - }, -{{- if ne $.TargetVersionName "ga" }} - // With conditions - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-2", "member-3"}, - }, - { - Role: "role-2", - Members: []string{"member-1"}, - }, - { - Role: "role-1", - Members: []string{"member-1"}, - }, - { - Role: "role-3", - Members: []string{"member-1"}, - }, - { - Role: "role-2", - Members: []string{"member-1"}, - Condition: &cloudresourcemanager.Expr{Title: "condition-1"}, - }, - }, - remove: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-2", "member-4"}, - }, - { - Role: "role-2", - Members: []string{"member-1"}, - Condition: &cloudresourcemanager.Expr{Title: "condition-1"}, - }, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"member-1", "member-3"}, - }, - { - Role: "role-2", - Members: []string{"member-1"}, - }, - { - Role: "role-3", - Members: []string{"member-1"}, - }, - }, - }, -{{- end }} - } - - for _, tc := range testCases { - got := subtractFromBindings(tc.input, tc.remove...) - if !CompareBindings(got, tc.expect) { - t.Errorf("Unexpected value for subtractFromBindings(%s, %s).\nActual: %s\nExpected: %s\n", - DebugPrintBindings(tc.input), DebugPrintBindings(tc.remove), DebugPrintBindings(got), DebugPrintBindings(tc.expect)) - } - } -} - -func TestIamCreateIamBindingsMap(t *testing.T) { - testCases := []struct { - input []*cloudresourcemanager.Binding - expect map[iamBindingKey]map[string]struct{} - }{ - { - input: []*cloudresourcemanager.Binding{}, - expect: map[iamBindingKey]map[string]struct{}{}, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"user-1", "user-2"}, - }, - }, - expect: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"user-1": {}, "user-2": {}}, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"user-1", "user-2"}, - }, - { - Role: "role-1", - Members: []string{"user-3"}, - }, - }, - expect: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"user-1": {}, "user-2": {}, "user-3": {}}, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"user-1", "user-2"}, - }, - { - Role: "role-2", - Members: []string{"user-1"}, - }, - }, - expect: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"user-1": {}, "user-2": {}}, - {"role-2", conditionKey{}}: {"user-1": {}}, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"user-1", "user-2"}, - }, - { - Role: "role-2", - Members: []string{"user-1"}, - }, - { - Role: "role-1", - Members: []string{"user-3"}, - }, - { - Role: "role-2", - Members: []string{"user-2"}, - }, - { - Role: "role-3", - Members: []string{"user-3"}, - }, - }, - expect: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"user-1": {}, "user-2": {}, "user-3": {}}, - {"role-2", conditionKey{}}: {"user-1": {}, "user-2": {}}, - {"role-3", conditionKey{}}: {"user-3": {}}, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"deleted:serviceAccount:useR-1", "user-2"}, - }, - { - Role: "role-2", - Members: []string{"deleted:user:user-1"}, - }, - { - Role: "role-1", - Members: []string{"serviceAccount:user-3"}, - }, - { - Role: "role-2", - Members: []string{"user-2"}, - }, - { - Role: "role-3", - Members: []string{"user-3"}, - }, - { - Role: "role-4", - Members: []string{"deleted:principal:useR-1"}, - }, - }, - expect: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"deleted:serviceAccount:user-1": {}, "user-2": {}, "serviceAccount:user-3": {}}, - {"role-2", conditionKey{}}: {"deleted:user:user-1": {}, "user-2": {}}, - {"role-3", conditionKey{}}: {"user-3": {}}, - {"role-4", conditionKey{}}: {"deleted:principal:useR-1": {}}, - }, - }, - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"principalSet://iam.googleapis.com/projects/1066737951711/locations/global/workloadIdentityPools/example-pool/attribute.aws_role/arn:aws:sts::999999999999:assumed-role/some-eu-central-1-lambdaRole"}, - }, - { - Role: "role-2", - Members: []string{"principal://iam.googleapis.com/projects/1066737951711/locations/global/workloadIdentityPools/example-pool/attribute.aws_role/arn:aws:sts::999999999999:assumed-role/some-eu-central-1-lambdaRole"}, - }, - { - Role: "role-1", - Members: []string{"serviceAccount:useR-3"}, - }, - { - Role: "role-2", - Members: []string{"user-2"}, - }, - { - Role: "role-3", - Members: []string{"user-3"}, - }, - { - Role: "role-3", - Members: []string{"principalHierarchy://iam.googleapis.com/projects/1066737951711/locations/global/workloadIdentityPools"}, - }, - }, - expect: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"principalSet://iam.googleapis.com/projects/1066737951711/locations/global/workloadIdentityPools/example-pool/attribute.aws_role/arn:aws:sts::999999999999:assumed-role/some-eu-central-1-lambdaRole": {}, "serviceAccount:user-3": {}}, - {"role-2", conditionKey{}}: {"principal://iam.googleapis.com/projects/1066737951711/locations/global/workloadIdentityPools/example-pool/attribute.aws_role/arn:aws:sts::999999999999:assumed-role/some-eu-central-1-lambdaRole": {}, "user-2": {}}, - {"role-3", conditionKey{}}: {"principalHierarchy://iam.googleapis.com/projects/1066737951711/locations/global/workloadIdentityPools": {}, "user-3": {}}, - }, - }, -{{- if ne $.TargetVersionName "ga" }} - { - input: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"user-1", "user-2"}, - }, - { - Role: "role-2", - Members: []string{"user-1"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - Description: "condition-1-desc", - Expression: "condition-1-expr", - }, - }, - { - Role: "role-2", - Members: []string{"user-2"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-1", - Description: "condition-1-desc", - Expression: "condition-1-expr", - }, - }, - { - Role: "role-2", - Members: []string{"user-1"}, - Condition: &cloudresourcemanager.Expr{ - Title: "condition-2", - Description: "condition-2-desc", - Expression: "condition-2-expr", - }, - }, - }, - expect: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"user-1": {}, "user-2": {}}, - { - Role: "role-2", - Condition: conditionKey{ - Title: "condition-1", - Description: "condition-1-desc", - Expression: "condition-1-expr", - }, - }: {"user-1": {}, "user-2": {}}, - { - Role: "role-2", - Condition: conditionKey{ - Title: "condition-2", - Description: "condition-2-desc", - Expression: "condition-2-expr", - }, - }: {"user-1": {}}, - }, - }, -{{- end }} - } - - for _, tc := range testCases { - got := createIamBindingsMap(tc.input) - if !reflect.DeepEqual(got, tc.expect) { - t.Errorf("Unexpected value for createIamBindingsMap(%s).\nActual: %#v\nExpected: %#v\n", - DebugPrintBindings(tc.input), got, tc.expect) - } - } -} - -func TestIamMember_MemberDiffSuppress(t *testing.T) { - type IamMemberTestcase struct { - name string - old string - new string - equal bool - } - var iamMemberTestcases = []IamMemberTestcase{ - { - name: "control", - old: "somevalue", - new: "somevalue", - equal: true, - }, - { - name: "principal same casing", - old: "principal:someValueHere", - new: "principal:someValueHere", - equal: true, - }, - { - name: "principal not same casing", - old: "principal:somevalueHere", - new: "principal:someValuehere", - equal: false, - }, - { - name: "principalSet same casing", - old: "principalSet:someValueHere", - new: "principalSet:someValueHere", - equal: true, - }, - { - name: "principalSet not same casing", - old: "principalSet:somevalueHere", - new: "principalSet:someValuehere", - equal: false, - }, - { - name: "principalHierarchy same casing", - old: "principalHierarchy:someValueHere", - new: "principalHierarchy:someValueHere", - equal: true, - }, - { - name: "principalHierarchy not same casing", - old: "principalHierarchy:somevalueHere", - new: "principalHierarchy:someValuehere", - equal: false, - }, - { - name: "serviceAccount same casing", - old: "serviceAccount:same@case.com", - new: "serviceAccount:same@case.com", - equal: true, - }, - { - name: "serviceAccount diff casing", - old: "serviceAccount:sAme@casE.com", - new: "serviceAccount:same@case.com", - equal: true, - }, - { - name: "random diff", - old: "serviasfsfljJKLSD", - new: "servicsFDJKLSFJdfjdlkfsf", - equal: false, - }, - } - - for _, testcase := range iamMemberTestcases { - areEqual := iamMemberCaseDiffSuppress("", testcase.old, testcase.new, &schema.ResourceData{}) - if areEqual != testcase.equal { - t.Errorf("Testcase %s failed: expected equality to be %t but got %t", testcase.name, testcase.equal, areEqual) - } - } -} - -func TestIamListFromIamBindingMap(t *testing.T) { - testCases := []struct { - input map[iamBindingKey]map[string]struct{} - expect []*cloudresourcemanager.Binding - }{ - { - input: map[iamBindingKey]map[string]struct{}{}, - expect: []*cloudresourcemanager.Binding{}, - }, - { - input: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"user-1": {}, "user-2": {}}, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"user-1", "user-2"}, - }, - }, - }, - { - input: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"user-1": {}}, - {"role-2", conditionKey{}}: {"user-1": {}, "user-2": {}}, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"user-1"}, - }, - { - Role: "role-2", - Members: []string{"user-1", "user-2"}, - }, - }, - }, - { - input: map[iamBindingKey]map[string]struct{}{ - {"role-1", conditionKey{}}: {"user-1": {}, "user-2": {}}, - {"role-2", conditionKey{}}: {}, - }, - expect: []*cloudresourcemanager.Binding{ - { - Role: "role-1", - Members: []string{"user-1", "user-2"}, - }, - }, - }, - } - - for _, tc := range testCases { - got := listFromIamBindingMap(tc.input) - if !CompareBindings(got, tc.expect) { - t.Errorf("Unexpected value for subtractFromBindings(%v).\nActual: %#v\nExpected: %#v\n", - tc.input, DebugPrintBindings(got), DebugPrintBindings(tc.expect)) - } - } -} - -func TestIamRemoveAllAuditConfigsWithService(t *testing.T) { - testCases := []struct { - input []*cloudresourcemanager.AuditConfig - service string - expect []*cloudresourcemanager.AuditConfig - }{ - // No-op - { - service: "foo.googleapis.com", - input: []*cloudresourcemanager.AuditConfig{}, - expect: []*cloudresourcemanager.AuditConfig{}, - }, - // No-op - service not in audit configs - { - service: "bar.googleapis.com", - input: []*cloudresourcemanager.AuditConfig{ - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - }, - }, - }, - }, - expect: []*cloudresourcemanager.AuditConfig{ - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - }, - }, - }, - }, - }, - // Single removal - { - service: "foo.googleapis.com", - input: []*cloudresourcemanager.AuditConfig{ - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - }, - }, - }, - }, - expect: []*cloudresourcemanager.AuditConfig{}, - }, - // Multiple removal/merge - { - service: "kms.googleapis.com", - input: []*cloudresourcemanager.AuditConfig{ - { - Service: "kms.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - }, - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-1"}, - }, - }, - }, - { - Service: "iam.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-1"}, - }, - }, - }, - { - Service: "kms.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-2"}, - }, - }, - }, - { - Service: "iam.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-2"}, - }, - }, - }, - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-1"}, - }, - }, - }, - { - Service: "kms.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-3", "user-4"}, - }, - { - LogType: "DATA_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - }, - }, - }, - expect: []*cloudresourcemanager.AuditConfig{ - { - Service: "iam.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - }, - }, - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-1"}, - }, - }, - }, - }, - }, - } - - for _, tc := range testCases { - got := removeAllAuditConfigsWithService(tc.input, tc.service) - if !CompareAuditConfigs(got, tc.expect) { - t.Errorf("Got unexpected value for removeAllAuditConfigsWithService(%s, %s).\nActual: %s\nExpected: %s", - DebugPrintAuditConfigs(tc.input), tc.service, DebugPrintAuditConfigs(got), DebugPrintAuditConfigs(tc.expect)) - } - } -} - -func TestIamCreateIamAuditConfigsMap(t *testing.T) { - testCases := []struct { - input []*cloudresourcemanager.AuditConfig - expect map[string]map[string]map[string]struct{} - }{ - { - input: []*cloudresourcemanager.AuditConfig{}, - expect: make(map[string]map[string]map[string]struct{}), - }, - { - input: []*cloudresourcemanager.AuditConfig{ - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - }, - }, - }, - }, - expect: map[string]map[string]map[string]struct{}{ - "foo.googleapis.com": { - "ADMIN_READ": map[string]struct{}{}, - }, - }, - }, - { - input: []*cloudresourcemanager.AuditConfig{ - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-1"}, - }, - }, - }, - }, - expect: map[string]map[string]map[string]struct{}{ - "foo.googleapis.com": { - "ADMIN_READ": map[string]struct{}{"user-1": {}, "user-2": {}}, - "DATA_WRITE": map[string]struct{}{"user-1": {}}, - }, - }, - }, - { - input: []*cloudresourcemanager.AuditConfig{ - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-1"}, - }, - }, - }, - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "DATA_READ", - ExemptedMembers: []string{"user-2"}, - }, - }, - }, - }, - expect: map[string]map[string]map[string]struct{}{ - "foo.googleapis.com": { - "ADMIN_READ": map[string]struct{}{"user-1": {}, "user-2": {}}, - "DATA_WRITE": map[string]struct{}{"user-1": {}}, - "DATA_READ": map[string]struct{}{"user-2": {}}, - }, - }, - }, - { - input: []*cloudresourcemanager.AuditConfig{ - { - Service: "kms.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - }, - }, - }, - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-1"}, - }, - }, - }, - { - Service: "kms.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - }, - }, - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "DATA_READ", - ExemptedMembers: []string{"user-2"}, - }, - }, - }, - }, - expect: map[string]map[string]map[string]struct{}{ - "kms.googleapis.com": { - "ADMIN_READ": map[string]struct{}{"user-1": {}, "user-2": {}}, - }, - "foo.googleapis.com": { - "ADMIN_READ": map[string]struct{}{"user-1": {}, "user-2": {}}, - "DATA_WRITE": map[string]struct{}{"user-1": {}}, - "DATA_READ": map[string]struct{}{"user-2": {}}, - }, - }, - }, - } - - for _, tc := range testCases { - got := createIamAuditConfigsMap(tc.input) - if !reflect.DeepEqual(got, tc.expect) { - t.Errorf("Unexpected value for createIamAuditConfigsMap(%s).\nActual: %#v\nExpected: %#v\n", - DebugPrintAuditConfigs(tc.input), got, tc.expect) - } - } -} - -func TestIamListFromIamAuditConfigsMap(t *testing.T) { - testCases := []struct { - input map[string]map[string]map[string]struct{} - expect []*cloudresourcemanager.AuditConfig - }{ - { - input: make(map[string]map[string]map[string]struct{}), - expect: []*cloudresourcemanager.AuditConfig{}, - }, - { - input: map[string]map[string]map[string]struct{}{ - "foo.googleapis.com": {"ADMIN_READ": map[string]struct{}{}}, - }, - expect: []*cloudresourcemanager.AuditConfig{ - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - }, - }, - }, - }, - }, - { - input: map[string]map[string]map[string]struct{}{ - "foo.googleapis.com": { - "ADMIN_READ": map[string]struct{}{"user-1": {}, "user-2": {}}, - "DATA_WRITE": map[string]struct{}{"user-1": {}}, - "DATA_READ": map[string]struct{}{}, - }, - }, - expect: []*cloudresourcemanager.AuditConfig{ - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-1"}, - }, - { - LogType: "DATA_READ", - }, - }, - }, - }, - }, - { - input: map[string]map[string]map[string]struct{}{ - "kms.googleapis.com": { - "ADMIN_READ": map[string]struct{}{}, - "DATA_READ": map[string]struct{}{"user-1": {}, "user-2": {}}, - }, - "foo.googleapis.com": { - "ADMIN_READ": map[string]struct{}{"user-1": {}, "user-2": {}}, - "DATA_WRITE": map[string]struct{}{"user-1": {}}, - "DATA_READ": map[string]struct{}{"user-2": {}}, - }, - }, - expect: []*cloudresourcemanager.AuditConfig{ - { - Service: "kms.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - }, - { - LogType: "DATA_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - }, - }, - { - Service: "foo.googleapis.com", - AuditLogConfigs: []*cloudresourcemanager.AuditLogConfig{ - { - LogType: "ADMIN_READ", - ExemptedMembers: []string{"user-1", "user-2"}, - }, - { - LogType: "DATA_WRITE", - ExemptedMembers: []string{"user-1"}, - }, - { - LogType: "DATA_READ", - ExemptedMembers: []string{"user-2"}, - }, - }, - }, - }, - }, - } - - for _, tc := range testCases { - got := listFromIamAuditConfigMap(tc.input) - if !CompareAuditConfigs(got, tc.expect) { - t.Errorf("Unexpected value for listFromIamAuditConfigMap(%+v).\nActual: %s\nExpected: %s\n", - tc.input, DebugPrintAuditConfigs(got), DebugPrintAuditConfigs(tc.expect)) - } - } -} diff --git a/mmv1/third_party/terraform/tpgiamresource/iam.go.tmpl b/mmv1/third_party/terraform/tpgiamresource/iam.go.tmpl index ce9fce404baf..3222c6adfaee 100644 --- a/mmv1/third_party/terraform/tpgiamresource/iam.go.tmpl +++ b/mmv1/third_party/terraform/tpgiamresource/iam.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> // Utils for modifying IAM policies for resources across GCP package tpgiamresource @@ -152,7 +151,7 @@ func iamPolicyReadModifyWrite(updater ResourceIamUpdater, modify iamPolicyModify time.Sleep(backoff) backoff = backoff * 2 if backoff > 30*time.Second { - return errwrap.Wrapf(fmt.Sprintf("Error applying IAM policy to %s: Too many conflicts. Latest error: {{err}}", updater.DescribeResource()), err) + return errwrap.Wrapf(fmt.Sprintf("Error applying IAM policy to %s: Too many conflicts. Latest error: {{"{{"}}err{{"}}"}}", updater.DescribeResource()), err) } continue } @@ -181,7 +180,7 @@ func iamPolicyReadModifyWrite(updater ResourceIamUpdater, modify iamPolicyModify } log.Printf("[DEBUG]: not retrying IAM policy for %s. error: %v", updater.DescribeResource(), err) - return errwrap.Wrapf(fmt.Sprintf("Error applying IAM policy for %s: {{err}}", updater.DescribeResource()), err) + return errwrap.Wrapf(fmt.Sprintf("Error applying IAM policy for %s: {{"{{"}}err{{"}}"}}", updater.DescribeResource()), err) } log.Printf("[DEBUG]: Set policy for %s", updater.DescribeResource()) return nil @@ -485,11 +484,11 @@ func IamWithDeprecationMessage(message string) func(s *IamSettings) { } func IamWithGAResourceDeprecation() func (s *IamSettings) { - <% if version == 'ga' -%> + {{- if eq $.TargetVersionName "ga" }} return IamWithDeprecationMessage("This resource has been deprecated in the google (GA) provider, and will only be available in the google-beta provider in a future release.") - <% else -%> + {{- else }} return IamWithDeprecationMessage("") - <% end -%> + {{- end }} } func IamWithBatching (s *IamSettings) { diff --git a/mmv1/third_party/terraform/tpgiamresource/iam_test.go.tmpl b/mmv1/third_party/terraform/tpgiamresource/iam_test.go.tmpl index 687f64293a54..dbf666ea50e4 100644 --- a/mmv1/third_party/terraform/tpgiamresource/iam_test.go.tmpl +++ b/mmv1/third_party/terraform/tpgiamresource/iam_test.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package tpgiamresource import ( @@ -154,7 +153,7 @@ func TestIamMergeBindings(t *testing.T) { }, }, }, -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} // Same role+members, different condition { input: []*cloudresourcemanager.Binding{ @@ -247,7 +246,7 @@ func TestIamMergeBindings(t *testing.T) { }, }, }, -<% end -%> +{{- end }} } for _, tc := range testCases { @@ -338,7 +337,7 @@ func TestIamFilterBindingsWithRoleAndCondition(t *testing.T) { }, }, }, -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} // Remove one binding with condition { input: []*cloudresourcemanager.Binding{ @@ -361,7 +360,7 @@ func TestIamFilterBindingsWithRoleAndCondition(t *testing.T) { }, }, }, -<% end -%> +{{- end }} } for _, tc := range testCases { @@ -517,7 +516,7 @@ func TestIamSubtractFromBindings(t *testing.T) { }, }, }, -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} // With conditions { input: []*cloudresourcemanager.Binding{ @@ -569,7 +568,7 @@ func TestIamSubtractFromBindings(t *testing.T) { }, }, }, -<% end -%> +{{- end }} } for _, tc := range testCases { @@ -728,7 +727,7 @@ func TestIamCreateIamBindingsMap(t *testing.T) { {"role-3", conditionKey{}}: {"principalHierarchy://iam.googleapis.com/projects/1066737951711/locations/global/workloadIdentityPools": {}, "user-3": {}}, }, }, -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} { input: []*cloudresourcemanager.Binding{ { @@ -783,7 +782,7 @@ func TestIamCreateIamBindingsMap(t *testing.T) { }: {"user-1": {}}, }, }, -<% end -%> +{{- end }} } for _, tc := range testCases { diff --git a/mmv1/third_party/terraform/tpgresource/go/tpgtools_custom_flattens.go.tmpl b/mmv1/third_party/terraform/tpgresource/go/tpgtools_custom_flattens.go.tmpl deleted file mode 100644 index 8c32d4eca8e3..000000000000 --- a/mmv1/third_party/terraform/tpgresource/go/tpgtools_custom_flattens.go.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -package tpgresource - -import ( - containeraws "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containeraws{{ $.DCLVersion }}" - containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure{{ $.DCLVersion }}" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -func FlattenContainerAwsNodePoolManagement(obj *containeraws.NodePoolManagement, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if obj == nil { - return nil - } - transformed := make(map[string]interface{}) - - if obj.AutoRepair == nil || obj.Empty() { - transformed["auto_repair"] = false - } else { - transformed["auto_repair"] = obj.AutoRepair - } - - return []interface{}{transformed} -} - -func FlattenContainerAzureNodePoolManagement(obj *containerazure.NodePoolManagement, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - if obj == nil { - return nil - } - transformed := make(map[string]interface{}) - - if obj.AutoRepair == nil || obj.Empty() { - transformed["auto_repair"] = false - } else { - transformed["auto_repair"] = obj.AutoRepair - } - - return []interface{}{transformed} -} diff --git a/mmv1/third_party/terraform/tpgresource/tpgtools_custom_flattens.go.tmpl b/mmv1/third_party/terraform/tpgresource/tpgtools_custom_flattens.go.tmpl index 744d61c084ed..8c32d4eca8e3 100644 --- a/mmv1/third_party/terraform/tpgresource/tpgtools_custom_flattens.go.tmpl +++ b/mmv1/third_party/terraform/tpgresource/tpgtools_custom_flattens.go.tmpl @@ -1,9 +1,8 @@ -<% autogen_exception -%> package tpgresource import ( - containeraws "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containeraws<%= dcl_version(version) -%>" - containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure<%= dcl_version(version) -%>" + containeraws "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containeraws{{ $.DCLVersion }}" + containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure{{ $.DCLVersion }}" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" diff --git a/mmv1/third_party/terraform/transport/config.go.tmpl b/mmv1/third_party/terraform/transport/config.go.tmpl index 608c51d57778..94506f6230c9 100644 --- a/mmv1/third_party/terraform/transport/config.go.tmpl +++ b/mmv1/third_party/terraform/transport/config.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package transport import ( @@ -37,31 +36,31 @@ import ( "google.golang.org/api/certificatemanager/v1" "google.golang.org/api/cloudbilling/v1" "google.golang.org/api/cloudbuild/v1" -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} cloudidentity "google.golang.org/api/cloudidentity/v1beta1" -<% else -%> +{{- else }} "google.golang.org/api/cloudidentity/v1" -<% end -%> +{{- end }} "google.golang.org/api/cloudfunctions/v1" "google.golang.org/api/cloudiot/v1" "google.golang.org/api/cloudkms/v1" "google.golang.org/api/cloudresourcemanager/v1" resourceManagerV3 "google.golang.org/api/cloudresourcemanager/v3" -<% if version == "ga" -%> +{{- if eq $.TargetVersionName "ga" }} "google.golang.org/api/composer/v1" -<% else -%> +{{- else }} "google.golang.org/api/composer/v1beta1" -<% end -%> -<% if version == "ga" -%> +{{- end }} +{{- if eq $.TargetVersionName "ga" }} "google.golang.org/api/compute/v1" -<% else -%> +{{- else }} compute "google.golang.org/api/compute/v0.beta" -<% end -%> -<% if version == 'ga' -%> +{{- end }} +{{- if eq $.TargetVersionName "ga" }} "google.golang.org/api/container/v1" -<% else -%> +{{- else }} container "google.golang.org/api/container/v1beta1" -<% end -%> +{{- end }} dataflow "google.golang.org/api/dataflow/v1b3" "google.golang.org/api/dataproc/v1" "google.golang.org/api/dns/v1" @@ -71,9 +70,9 @@ import ( cloudlogging "google.golang.org/api/logging/v2" "google.golang.org/api/pubsub/v1" runadminv2 "google.golang.org/api/run/v2" -<% unless version == 'ga' -%> +{{- if ne $.TargetVersionName "ga" }} runtimeconfig "google.golang.org/api/runtimeconfig/v1beta1" -<% end -%> +{{- end }} "google.golang.org/api/servicemanagement/v1" "google.golang.org/api/servicenetworking/v1" "google.golang.org/api/serviceusage/v1" @@ -206,9 +205,9 @@ type Config struct { tokenSource oauth2.TokenSource - <% products.each do |product| -%> - <%= product[:definitions].name -%>BasePath string - <% end -%> + {{ range $product := $.Products }} + {{ $product.Name }}BasePath string + {{- end }} CloudBillingBasePath string ContainerBasePath string @@ -228,9 +227,9 @@ type Config struct { RequestBatcherIam *RequestBatcher } -<% products.each do |product| -%> -const <%= product[:definitions].name -%>BasePathKey = "<%= product[:definitions].name -%>" -<% end -%> +{{- range $product := $.Products }} +const {{ $product.Name }}BasePathKey = "{{ $product.Name }}" +{{- end }} const CloudBillingBasePathKey = "CloudBilling" const ContainerBasePathKey = "Container" const DataflowBasePathKey = "Dataflow" @@ -244,23 +243,23 @@ const TagsLocationBasePathKey = "TagsLocation" // Generated product base paths var DefaultBasePaths = map[string]string{ -<% products.each do |product| -%> - <%= product[:definitions].name -%>BasePathKey : "<%= product[:definitions].base_url -%>", -<% end -%> +{{- range $product := $.Products }} + {{ $product.Name }}BasePathKey : "{{ $product.BaseUrl }}", +{{- end }} CloudBillingBasePathKey : "https://cloudbilling.googleapis.com/v1/", -<% if version == "ga" -%> +{{- if eq $.TargetVersionName "ga" }} ContainerBasePathKey : "https://container.googleapis.com/v1/", -<% else -%> +{{- else }} ContainerBasePathKey : "https://container.googleapis.com/v1beta1/", -<% end -%> +{{- end }} DataflowBasePathKey : "https://dataflow.googleapis.com/v1b3/", IAMBasePathKey : "https://iam.googleapis.com/v1/", IamCredentialsBasePathKey : "https://iamcredentials.googleapis.com/v1/", ResourceManagerV3BasePathKey : "https://cloudresourcemanager.googleapis.com/v3/", BigtableAdminBasePathKey : "https://bigtableadmin.googleapis.com/v2/", - ContainerAwsBasePathKey: "https://{{location}}-gkemulticloud.googleapis.com/v1/", - ContainerAzureBasePathKey: "https://{{location}}-gkemulticloud.googleapis.com/v1/", - TagsLocationBasePathKey: "https://{{location}}-cloudresourcemanager.googleapis.com/v3/", + ContainerAwsBasePathKey: "https://{{"{{"}}location{{"}}"}}-gkemulticloud.googleapis.com/v1/", + ContainerAzureBasePathKey: "https://{{"{{"}}location{{"}}"}}-gkemulticloud.googleapis.com/v1/", + TagsLocationBasePathKey: "https://{{"{{"}}location{{"}}"}}-cloudresourcemanager.googleapis.com/v3/", } var DefaultClientScopes = []string{ @@ -335,13 +334,13 @@ func HandleSDKDefaults(d *schema.ResourceData) error { func SetEndpointDefaults(d *schema.ResourceData) error { // Generated Products - <% products.each do |product| -%> - if d.Get("<%= product[:definitions].name.underscore -%>_custom_endpoint") == "" { - d.Set("<%= product[:definitions].name.underscore -%>_custom_endpoint", MultiEnvDefault([]string{ - "GOOGLE_<%= product[:definitions].name.underscore.upcase -%>_CUSTOM_ENDPOINT", - }, DefaultBasePaths[<%= product[:definitions].name -%>BasePathKey])) + {{- range $product := $.Products }} + if d.Get("{{ underscore $product.Name }}_custom_endpoint") == "" { + d.Set("{{ underscore $product.Name }}_custom_endpoint", MultiEnvDefault([]string{ + "GOOGLE_{{ upper (underscore $product.Name) }}_CUSTOM_ENDPOINT", + }, DefaultBasePaths[{{ $product.Name }}BasePathKey])) } - <% end -%> + {{- end }} if d.Get(CloudBillingCustomEndpointEntryKey) == "" { d.Set(CloudBillingCustomEndpointEntryKey, MultiEnvDefault([]string{ @@ -379,13 +378,13 @@ func SetEndpointDefaults(d *schema.ResourceData) error { }, DefaultBasePaths[ResourceManagerV3BasePathKey])) } - <% unless version == "ga" -%> + {{ if ne $.TargetVersionName `ga` -}} if d.Get(RuntimeConfigCustomEndpointEntryKey) == "" { d.Set(RuntimeConfigCustomEndpointEntryKey, MultiEnvDefault([]string{ "GOOGLE_RUNTIMECONFIG_CUSTOM_ENDPOINT", }, DefaultBasePaths[RuntimeConfigBasePathKey])) } - <% end -%> + {{- end }} if d.Get(IAMCustomEndpointEntryKey) == "" { d.Set(IAMCustomEndpointEntryKey, MultiEnvDefault([]string{ @@ -802,7 +801,7 @@ func (c *Config) NewResourceManagerV3Client(userAgent string) *resourceManagerV3 return clientResourceManagerV3 } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} func(c *Config) NewRuntimeconfigClient(userAgent string) *runtimeconfig.Service { runtimeConfigClientBasePath := RemoveBasePathVersion(c.RuntimeConfigBasePath) log.Printf("[INFO] Instantiating Google Cloud Runtimeconfig client for path %s", runtimeConfigClientBasePath) @@ -816,7 +815,7 @@ func(c *Config) NewRuntimeconfigClient(userAgent string) *runtimeconfig.Service return clientRuntimeconfig } -<% end -%> +{{- end }} func (c *Config) NewIamClient(userAgent string) *iam.Service { iamClientBasePath := RemoveBasePathVersion(c.IAMBasePath) @@ -1262,20 +1261,20 @@ func (c *Config) GetCredentials(clientScopes []string, initialCredentialsOnly bo return *creds, nil } -// Remove the `/{{version}}/` from a base path if present. +// Remove the `/{{"{{"}}version{{"}}"}}/` from a base path if present. func RemoveBasePathVersion(url string) string { re := regexp.MustCompile(`(?Phttp[s]://.*)(?P/[^/]+?/$)`) return re.ReplaceAllString(url, "$1/") } // For a consumer of config.go that isn't a full fledged provider and doesn't -// have its own endpoint mechanism such as sweepers, init {{service}}BasePath +// have its own endpoint mechanism such as sweepers, init {{"{{"}}service{{"}}"}}BasePath // values to a default. After using this, you should call config.LoadAndValidate. func ConfigureBasePaths(c *Config) { // Generated Products - <% products.map.each do |product| -%> - c.<%= product[:definitions].name -%>BasePath = DefaultBasePaths[<%= product[:definitions].name -%>BasePathKey] - <% end -%> + {{- range $product := $.Products }} + c.{{ $product.Name }}BasePath = DefaultBasePaths[{{ $product.Name }}BasePathKey] + {{- end }} // Handwritten Products / Versioned / Atypical Entries c.CloudBillingBasePath = DefaultBasePaths[CloudBillingBasePathKey] diff --git a/mmv1/third_party/terraform/transport/go/config.go.tmpl b/mmv1/third_party/terraform/transport/go/config.go.tmpl deleted file mode 100644 index 94506f6230c9..000000000000 --- a/mmv1/third_party/terraform/transport/go/config.go.tmpl +++ /dev/null @@ -1,1354 +0,0 @@ -package transport - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "log" - "net/http" - "regexp" - "strconv" - "strings" - "time" - "os" - - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - - grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" - - "github.com/hashicorp/go-cleanhttp" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/sirupsen/logrus" - "google.golang.org/api/option" - "google.golang.org/api/option/internaloption" - - "github.com/hashicorp/terraform-provider-google/google/verify" - - "golang.org/x/oauth2" - "google.golang.org/grpc" - googleoauth "golang.org/x/oauth2/google" - appengine "google.golang.org/api/appengine/v1" - "google.golang.org/api/bigquery/v2" - "google.golang.org/api/bigtableadmin/v2" - "google.golang.org/api/certificatemanager/v1" - "google.golang.org/api/cloudbilling/v1" - "google.golang.org/api/cloudbuild/v1" -{{- if ne $.TargetVersionName "ga" }} - cloudidentity "google.golang.org/api/cloudidentity/v1beta1" -{{- else }} - "google.golang.org/api/cloudidentity/v1" -{{- end }} - "google.golang.org/api/cloudfunctions/v1" - "google.golang.org/api/cloudiot/v1" - "google.golang.org/api/cloudkms/v1" - "google.golang.org/api/cloudresourcemanager/v1" - resourceManagerV3 "google.golang.org/api/cloudresourcemanager/v3" -{{- if eq $.TargetVersionName "ga" }} - "google.golang.org/api/composer/v1" -{{- else }} - "google.golang.org/api/composer/v1beta1" -{{- end }} -{{- if eq $.TargetVersionName "ga" }} - "google.golang.org/api/compute/v1" -{{- else }} - compute "google.golang.org/api/compute/v0.beta" -{{- end }} -{{- if eq $.TargetVersionName "ga" }} - "google.golang.org/api/container/v1" -{{- else }} - container "google.golang.org/api/container/v1beta1" -{{- end }} - dataflow "google.golang.org/api/dataflow/v1b3" - "google.golang.org/api/dataproc/v1" - "google.golang.org/api/dns/v1" - healthcare "google.golang.org/api/healthcare/v1" - "google.golang.org/api/iam/v1" - iamcredentials "google.golang.org/api/iamcredentials/v1" - cloudlogging "google.golang.org/api/logging/v2" - "google.golang.org/api/pubsub/v1" - runadminv2 "google.golang.org/api/run/v2" -{{- if ne $.TargetVersionName "ga" }} - runtimeconfig "google.golang.org/api/runtimeconfig/v1beta1" -{{- end }} - "google.golang.org/api/servicemanagement/v1" - "google.golang.org/api/servicenetworking/v1" - "google.golang.org/api/serviceusage/v1" - "google.golang.org/api/sourcerepo/v1" - "google.golang.org/api/spanner/v1" - sqladmin "google.golang.org/api/sqladmin/v1beta4" - "google.golang.org/api/storage/v1" - "google.golang.org/api/storagetransfer/v1" - "google.golang.org/api/transport" -) - -type ProviderMeta struct { - ModuleName string `cty:"module_name"` -} - -type Formatter struct { - TimestampFormat string - LogFormat string -} - -// Borrowed logic from https://github.com/sirupsen/logrus/blob/master/json_formatter.go and https://github.com/t-tomalak/logrus-easy-formatter/blob/master/formatter.go -func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error) { - // Suppress logs if TF_LOG is not DEBUG or TRACE - if !logging.IsDebugOrHigher() { - return nil, nil - } - - // Also suppress based on log content - // - frequent transport spam - // - ListenSocket logs from gRPC - isTransportSpam := strings.Contains(entry.Message, "transport is closing") - listenSocketRegex := regexp.MustCompile(`\[Server #\d+( ListenSocket #\d+)*\]`) // Match patterns like `[Server #00]` or `[Server #00 ListenSocket #00]` - isListenSocketLog := listenSocketRegex.MatchString(entry.Message) - if isTransportSpam || isListenSocketLog { - return nil, nil - } - - output := f.LogFormat - entry.Level = logrus.DebugLevel // Force Entries to be Debug - - timestampFormat := f.TimestampFormat - - output = strings.Replace(output, "%time%", entry.Time.Format(timestampFormat), 1) - - output = strings.Replace(output, "%msg%", entry.Message, 1) - - level := strings.ToUpper(entry.Level.String()) - output = strings.Replace(output, "%lvl%", level, 1) - - var gRPCMessageFlag bool - for k, val := range entry.Data { - switch v := val.(type) { - case string: - output = strings.Replace(output, "%"+k+"%", v, 1) - case int: - s := strconv.Itoa(v) - output = strings.Replace(output, "%"+k+"%", s, 1) - case bool: - s := strconv.FormatBool(v) - output = strings.Replace(output, "%"+k+"%", s, 1) - } - - if k != "system" { - gRPCMessageFlag = true - } - } - - if gRPCMessageFlag { - data := make(logrus.Fields, len(entry.Data)+4) - for k, v := range entry.Data { - switch v := v.(type) { - case error: - // Otherwise errors are ignored by `encoding/json` - // https://github.com/sirupsen/logrus/issues/137 - data[k] = v.Error() - default: - data[k] = v - } - } - - var b *bytes.Buffer - if entry.Buffer != nil { - b = entry.Buffer - } else { - b = &bytes.Buffer{} - } - - encoder := json.NewEncoder(b) - encoder.SetIndent("", " ") - if err := encoder.Encode(data); err != nil { - return nil, fmt.Errorf("failed to marshal fields to JSON, %w", err) - } - - finalOutput := append([]byte(output), b.Bytes()...) - return finalOutput, nil - } - - return []byte(output), nil -} - -// Config is the configuration structure used to instantiate the Google -// provider. -type Config struct { - DCLConfig - AccessToken string - Credentials string - ImpersonateServiceAccount string - ImpersonateServiceAccountDelegates []string - Project string - Region string - BillingProject string - Zone string - UniverseDomain string - Scopes []string - BatchingConfig *BatchingConfig - UserProjectOverride bool - RequestReason string - RequestTimeout time.Duration - DefaultLabels map[string]string - AddTerraformAttributionLabel bool - TerraformAttributionLabelAdditionStrategy string - // PollInterval is passed to retry.StateChangeConf in common_operation.go - // It controls the interval at which we poll for successful operations - PollInterval time.Duration - - Client *http.Client - Context context.Context - UserAgent string - gRPCLoggingOptions []option.ClientOption - - tokenSource oauth2.TokenSource - - {{ range $product := $.Products }} - {{ $product.Name }}BasePath string - {{- end }} - - CloudBillingBasePath string - ContainerBasePath string - DataflowBasePath string - IamCredentialsBasePath string - ResourceManagerV3BasePath string - IAMBasePath string - CloudIoTBasePath string - BigtableAdminBasePath string - TagsLocationBasePath string - - // dcl - ContainerAwsBasePath string - ContainerAzureBasePath string - - RequestBatcherServiceUsage *RequestBatcher - RequestBatcherIam *RequestBatcher -} - -{{- range $product := $.Products }} -const {{ $product.Name }}BasePathKey = "{{ $product.Name }}" -{{- end }} -const CloudBillingBasePathKey = "CloudBilling" -const ContainerBasePathKey = "Container" -const DataflowBasePathKey = "Dataflow" -const IAMBasePathKey = "IAM" -const IamCredentialsBasePathKey = "IamCredentials" -const ResourceManagerV3BasePathKey = "ResourceManagerV3" -const BigtableAdminBasePathKey = "BigtableAdmin" -const ContainerAwsBasePathKey = "ContainerAws" -const ContainerAzureBasePathKey = "ContainerAzure" -const TagsLocationBasePathKey = "TagsLocation" - -// Generated product base paths -var DefaultBasePaths = map[string]string{ -{{- range $product := $.Products }} - {{ $product.Name }}BasePathKey : "{{ $product.BaseUrl }}", -{{- end }} - CloudBillingBasePathKey : "https://cloudbilling.googleapis.com/v1/", -{{- if eq $.TargetVersionName "ga" }} - ContainerBasePathKey : "https://container.googleapis.com/v1/", -{{- else }} - ContainerBasePathKey : "https://container.googleapis.com/v1beta1/", -{{- end }} - DataflowBasePathKey : "https://dataflow.googleapis.com/v1b3/", - IAMBasePathKey : "https://iam.googleapis.com/v1/", - IamCredentialsBasePathKey : "https://iamcredentials.googleapis.com/v1/", - ResourceManagerV3BasePathKey : "https://cloudresourcemanager.googleapis.com/v3/", - BigtableAdminBasePathKey : "https://bigtableadmin.googleapis.com/v2/", - ContainerAwsBasePathKey: "https://{{"{{"}}location{{"}}"}}-gkemulticloud.googleapis.com/v1/", - ContainerAzureBasePathKey: "https://{{"{{"}}location{{"}}"}}-gkemulticloud.googleapis.com/v1/", - TagsLocationBasePathKey: "https://{{"{{"}}location{{"}}"}}-cloudresourcemanager.googleapis.com/v3/", -} - -var DefaultClientScopes = []string{ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/userinfo.email", -} - -const AttributionKey = "goog-terraform-provisioned" -const AttributionValue = "true" -const CreateOnlyAttributionStrategy = "CREATION_ONLY" -const ProactiveAttributionStrategy = "PROACTIVE" - -func HandleSDKDefaults(d *schema.ResourceData) error { - if d.Get("impersonate_service_account") == "" { - d.Set("impersonate_service_account", MultiEnvDefault([]string{ - "GOOGLE_IMPERSONATE_SERVICE_ACCOUNT", - }, nil)) - } - - if d.Get("project") == "" { - d.Set("project", MultiEnvDefault([]string{ - "GOOGLE_PROJECT", - "GOOGLE_CLOUD_PROJECT", - "GCLOUD_PROJECT", - "CLOUDSDK_CORE_PROJECT", - }, nil)) - } - - if d.Get("billing_project") == "" { - d.Set("billing_project", MultiEnvDefault([]string{ - "GOOGLE_BILLING_PROJECT", - }, nil)) - } - - if d.Get("region") == "" { - d.Set("region", MultiEnvDefault([]string{ - "GOOGLE_REGION", - "GCLOUD_REGION", - "CLOUDSDK_COMPUTE_REGION", - }, nil)) - } - - if d.Get("zone") == "" { - d.Set("zone", MultiEnvDefault([]string{ - "GOOGLE_ZONE", - "GCLOUD_ZONE", - "CLOUDSDK_COMPUTE_ZONE", - }, nil)) - } - - if _, ok := d.GetOkExists("user_project_override"); !ok { - override := MultiEnvDefault([]string{ - "USER_PROJECT_OVERRIDE", - }, nil) - - if override != nil { - b, err := strconv.ParseBool(override.(string)) - if err != nil { - return err - } - d.Set("user_project_override", b) - } - } - - if d.Get("request_reason") == "" { - d.Set("request_reason", MultiEnvDefault([]string{ - "CLOUDSDK_CORE_REQUEST_REASON", - }, nil)) - } - return nil -} - -func SetEndpointDefaults(d *schema.ResourceData) error { - // Generated Products - {{- range $product := $.Products }} - if d.Get("{{ underscore $product.Name }}_custom_endpoint") == "" { - d.Set("{{ underscore $product.Name }}_custom_endpoint", MultiEnvDefault([]string{ - "GOOGLE_{{ upper (underscore $product.Name) }}_CUSTOM_ENDPOINT", - }, DefaultBasePaths[{{ $product.Name }}BasePathKey])) - } - {{- end }} - - if d.Get(CloudBillingCustomEndpointEntryKey) == "" { - d.Set(CloudBillingCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_CLOUD_BILLING_CUSTOM_ENDPOINT", - }, DefaultBasePaths[CloudBillingBasePathKey])) - } - - if d.Get(ComposerCustomEndpointEntryKey) == "" { - d.Set(ComposerCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_COMPOSER_CUSTOM_ENDPOINT", - }, DefaultBasePaths[ComposerBasePathKey])) - } - - if d.Get(ContainerCustomEndpointEntryKey) == "" { - d.Set(ContainerCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_CONTAINER_CUSTOM_ENDPOINT", - }, DefaultBasePaths[ContainerBasePathKey])) - } - - if d.Get(DataflowCustomEndpointEntryKey) == "" { - d.Set(DataflowCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_DATAFLOW_CUSTOM_ENDPOINT", - }, DefaultBasePaths[DataflowBasePathKey])) - } - - if d.Get(IamCredentialsCustomEndpointEntryKey) == "" { - d.Set(IamCredentialsCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_IAM_CREDENTIALS_CUSTOM_ENDPOINT", - }, DefaultBasePaths[IamCredentialsBasePathKey])) - } - - if d.Get(ResourceManagerV3CustomEndpointEntryKey) == "" { - d.Set(ResourceManagerV3CustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_RESOURCE_MANAGER_V3_CUSTOM_ENDPOINT", - }, DefaultBasePaths[ResourceManagerV3BasePathKey])) - } - - {{ if ne $.TargetVersionName `ga` -}} - if d.Get(RuntimeConfigCustomEndpointEntryKey) == "" { - d.Set(RuntimeConfigCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_RUNTIMECONFIG_CUSTOM_ENDPOINT", - }, DefaultBasePaths[RuntimeConfigBasePathKey])) - } - {{- end }} - - if d.Get(IAMCustomEndpointEntryKey) == "" { - d.Set(IAMCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_IAM_CUSTOM_ENDPOINT", - }, DefaultBasePaths[IAMBasePathKey])) - } - - if d.Get(ServiceNetworkingCustomEndpointEntryKey) == "" { - d.Set(ServiceNetworkingCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_SERVICE_NETWORKING_CUSTOM_ENDPOINT", - }, DefaultBasePaths[ServiceNetworkingBasePathKey])) - } - - if d.Get(TagsLocationCustomEndpointEntryKey) == "" { - d.Set(TagsLocationCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_TAGS_LOCATION_CUSTOM_ENDPOINT", - }, DefaultBasePaths[TagsLocationBasePathKey])) - } - - if d.Get(ContainerAwsCustomEndpointEntryKey) == "" { - d.Set(ContainerAwsCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_CONTAINERAWS_CUSTOM_ENDPOINT", - }, DefaultBasePaths[ContainerAwsBasePathKey])) - } - - if d.Get(ContainerAzureCustomEndpointEntryKey) == "" { - d.Set(ContainerAzureCustomEndpointEntryKey, MultiEnvDefault([]string{ - "GOOGLE_CONTAINERAZURE_CUSTOM_ENDPOINT", - }, DefaultBasePaths[ContainerAzureBasePathKey])) - } - - return nil -} - -func (c *Config) LoadAndValidate(ctx context.Context) error { - if len(c.Scopes) == 0 { - c.Scopes = DefaultClientScopes - } - - c.Context = ctx - - tokenSource, err := c.getTokenSource(c.Scopes, false) - if err != nil { - return err - } - - c.tokenSource = tokenSource - - cleanCtx := context.WithValue(ctx, oauth2.HTTPClient, cleanhttp.DefaultClient()) - - // 1. MTLS TRANSPORT/CLIENT - sets up proper auth headers - client, _, err := transport.NewHTTPClient(cleanCtx, option.WithTokenSource(tokenSource)) - if err != nil { - return err - } - - // Userinfo is fetched before request logging is enabled to reduce additional noise. - err = c.logGoogleIdentities() - if err != nil { - return err - } - - // 2. Logging Transport - ensure we log HTTP requests to GCP APIs. - loggingTransport := logging.NewTransport("Google", client.Transport) - - // 3. Retry Transport - retries common temporary errors - // Keep order for wrapping logging so we log each retried request as well. - // This value should be used if needed to create shallow copies with additional retry predicates. - // See ClientWithAdditionalRetries - retryTransport := NewTransportWithDefaultRetries(loggingTransport) - - // 4. Header Transport - outer wrapper to inject additional headers we want to apply - // before making requests - headerTransport := NewTransportWithHeaders(retryTransport) - if c.RequestReason != "" { - headerTransport.Set("X-Goog-Request-Reason", c.RequestReason) - } - - // Ensure $userProject is set for all HTTP requests using the client if specified by the provider config - // See https://cloud.google.com/apis/docs/system-parameters - if c.UserProjectOverride && c.BillingProject != "" { - headerTransport.Set("X-Goog-User-Project", c.BillingProject) - } - - // Set final transport value. - client.Transport = headerTransport - - // This timeout is a timeout per HTTP request, not per logical operation. - client.Timeout = c.synchronousTimeout() - - c.Client = client - c.Context = ctx - c.Region = GetRegionFromRegionSelfLink(c.Region) - c.RequestBatcherServiceUsage = NewRequestBatcher("Service Usage", ctx, c.BatchingConfig) - c.RequestBatcherIam = NewRequestBatcher("IAM", ctx, c.BatchingConfig) - c.PollInterval = 10 * time.Second - - // gRPC Logging setup - logger := logrus.StandardLogger() - - logrus.SetLevel(logrus.DebugLevel) - logrus.SetFormatter(&Formatter{ - TimestampFormat: "2006/01/02 15:04:05", - LogFormat: "%time% [%lvl%] %msg% \n", - }) - - alwaysLoggingDeciderClient := func(ctx context.Context, fullMethodName string) bool { return true } - grpc_logrus.ReplaceGrpcLogger(logrus.NewEntry(logger)) - - c.gRPCLoggingOptions = append( - c.gRPCLoggingOptions, option.WithGRPCDialOption(grpc.WithUnaryInterceptor( - grpc_logrus.PayloadUnaryClientInterceptor(logrus.NewEntry(logger), alwaysLoggingDeciderClient))), - option.WithGRPCDialOption(grpc.WithStreamInterceptor( - grpc_logrus.PayloadStreamClientInterceptor(logrus.NewEntry(logger), alwaysLoggingDeciderClient))), - ) - - return nil -} - -func ExpandProviderBatchingConfig(v interface{}) (*BatchingConfig, error) { - config := &BatchingConfig{ - SendAfter: time.Second * DefaultBatchSendIntervalSec, - EnableBatching: true, - } - - if v == nil { - return config, nil - } - ls := v.([]interface{}) - if len(ls) == 0 || ls[0] == nil { - return config, nil - } - - cfgV := ls[0].(map[string]interface{}) - if sendAfterV, ok := cfgV["send_after"]; ok && sendAfterV != "" { - SendAfter, err := time.ParseDuration(sendAfterV.(string)) - if err != nil { - return nil, fmt.Errorf("unable to parse duration from 'send_after' value %q", sendAfterV) - } - config.SendAfter = SendAfter - } - - if enable, ok := cfgV["enable_batching"]; ok { - config.EnableBatching = enable.(bool) - } - - return config, nil -} - -func (c *Config) synchronousTimeout() time.Duration { - if c.RequestTimeout == 0 { - return 120 * time.Second - } - return c.RequestTimeout -} - -// Print Identities executing terraform API Calls. -func (c *Config) logGoogleIdentities() error { - if c.ImpersonateServiceAccount == "" { - - tokenSource, err := c.getTokenSource(c.Scopes, true) - if err != nil { - return err - } - c.Client = oauth2.NewClient(c.Context, tokenSource) // c.Client isn't initialised fully when this code is called. - - email, err := GetCurrentUserEmail(c, c.UserAgent) - if err != nil { - log.Printf("[INFO] error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: %s", err) - } - - log.Printf("[INFO] Terraform is using this identity: %s", email) - - return nil - - } - - // Drop Impersonated ClientOption from OAuth2 TokenSource to infer original identity - - tokenSource, err := c.getTokenSource(c.Scopes, true) - if err != nil { - return err - } - c.Client = oauth2.NewClient(c.Context, tokenSource) // c.Client isn't initialised fully when this code is called. - - email, err := GetCurrentUserEmail(c, c.UserAgent) - if err != nil { - log.Printf("[INFO] error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: %s", err) - } - - log.Printf("[INFO] Terraform is configured with service account impersonation, original identity: %s, impersonated identity: %s", email, c.ImpersonateServiceAccount) - - // Add the Impersonated ClientOption back in to the OAuth2 TokenSource - - tokenSource, err = c.getTokenSource(c.Scopes, false) - if err != nil { - return err - } - c.Client = oauth2.NewClient(c.Context, tokenSource) // c.Client isn't initialised fully when this code is called. - - return nil -} - -// Get a TokenSource based on the Google Credentials configured. -// If initialCredentialsOnly is true, don't follow the impersonation settings and return the initial set of creds. -func (c *Config) getTokenSource(clientScopes []string, initialCredentialsOnly bool) (oauth2.TokenSource, error) { - creds, err := c.GetCredentials(clientScopes, initialCredentialsOnly) - if err != nil { - return nil, fmt.Errorf("%s", err) - } - return creds.TokenSource, nil -} - -// Methods to create new services from config -// Some base paths below need the version and possibly more of the path -// set on them. The client libraries are inconsistent about which values they need; -// while most only want the host URL, some older ones also want the version and some -// of those "projects" as well. You can find out if this is required by looking at -// the basePath value in the client library file. -func (c *Config) NewCertificateManagerClient(userAgent string) *certificatemanager.Service { - certificateManagerClientBasePath := RemoveBasePathVersion(c.CertificateManagerBasePath) - log.Printf("[INFO] Instantiating Certificate Manager client for path %s", certificateManagerClientBasePath) - clientCertificateManager, err := certificatemanager.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client certificate manager: %s", err) - return nil - } - clientCertificateManager.UserAgent = userAgent - clientCertificateManager.BasePath = certificateManagerClientBasePath - - return clientCertificateManager -} - -func (c *Config) NewComputeClient(userAgent string) *compute.Service { - log.Printf("[INFO] Instantiating GCE client for path %s", c.ComputeBasePath) - clientCompute, err := compute.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client compute: %s", err) - return nil - } - clientCompute.UserAgent = userAgent - clientCompute.BasePath = c.ComputeBasePath - - return clientCompute -} - -func (c *Config) NewContainerClient(userAgent string) *container.Service { - containerClientBasePath := RemoveBasePathVersion(c.ContainerBasePath) - log.Printf("[INFO] Instantiating GKE client for path %s", containerClientBasePath) - clientContainer, err := container.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client container: %s", err) - return nil - } - clientContainer.UserAgent = userAgent - clientContainer.BasePath = containerClientBasePath - - return clientContainer -} - -func (c *Config) NewDnsClient(userAgent string) *dns.Service { - dnsClientBasePath := RemoveBasePathVersion(c.DNSBasePath) - dnsClientBasePath = strings.ReplaceAll(dnsClientBasePath, "/dns/", "") - log.Printf("[INFO] Instantiating Google Cloud DNS client for path %s", dnsClientBasePath) - clientDns, err := dns.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client dns: %s", err) - return nil - } - clientDns.UserAgent = userAgent - clientDns.BasePath = dnsClientBasePath - - return clientDns -} - -func (c *Config) NewKmsClientWithCtx(ctx context.Context, userAgent string) *cloudkms.Service { - kmsClientBasePath := RemoveBasePathVersion(c.KMSBasePath) - log.Printf("[INFO] Instantiating Google Cloud KMS client for path %s", kmsClientBasePath) - clientKms, err := cloudkms.NewService(ctx, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client kms: %s", err) - return nil - } - clientKms.UserAgent = userAgent - clientKms.BasePath = kmsClientBasePath - - return clientKms -} - -func (c *Config) NewKmsClient(userAgent string) *cloudkms.Service { - return c.NewKmsClientWithCtx(c.Context, userAgent) -} - -func (c *Config) NewLoggingClient(userAgent string) *cloudlogging.Service { - loggingClientBasePath := RemoveBasePathVersion(c.LoggingBasePath) - log.Printf("[INFO] Instantiating Google Stackdriver Logging client for path %s", loggingClientBasePath) - clientLogging, err := cloudlogging.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client logging: %s", err) - return nil - } - clientLogging.UserAgent = userAgent - clientLogging.BasePath = loggingClientBasePath - - return clientLogging -} - -func (c *Config) NewStorageClient(userAgent string) *storage.Service { - storageClientBasePath := c.StorageBasePath - log.Printf("[INFO] Instantiating Google Storage client for path %s", storageClientBasePath) - clientStorage, err := storage.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client storage: %s", err) - return nil - } - clientStorage.UserAgent = userAgent - clientStorage.BasePath = storageClientBasePath - - return clientStorage -} - -// For object uploads, we need to override the specific timeout because they are long, synchronous operations. -func (c *Config) NewStorageClientWithTimeoutOverride(userAgent string, timeout time.Duration) *storage.Service { - storageClientBasePath := c.StorageBasePath - log.Printf("[INFO] Instantiating Google Storage client for path %s", storageClientBasePath) - // Copy the existing HTTP client (which has no unexported fields [as of Oct 2021 at least], so this is safe). - // We have to do this because otherwise we will accidentally change the timeout for all other - // synchronous operations, which would not be desirable. - httpClient := &http.Client{ - Transport: c.Client.Transport, - CheckRedirect: c.Client.CheckRedirect, - Jar: c.Client.Jar, - Timeout: timeout, - } - clientStorage, err := storage.NewService(c.Context, option.WithHTTPClient(httpClient)) - if err != nil { - log.Printf("[WARN] Error creating client storage: %s", err) - return nil - } - clientStorage.UserAgent = userAgent - clientStorage.BasePath = storageClientBasePath - - return clientStorage -} - -func (c *Config) NewSqlAdminClient(userAgent string) *sqladmin.Service { - sqlClientBasePath := RemoveBasePathVersion(RemoveBasePathVersion(c.SQLBasePath)) - log.Printf("[INFO] Instantiating Google SqlAdmin client for path %s", sqlClientBasePath) - clientSqlAdmin, err := sqladmin.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client storage: %s", err) - return nil - } - clientSqlAdmin.UserAgent = userAgent - clientSqlAdmin.BasePath = sqlClientBasePath - - return clientSqlAdmin -} - -func (c *Config) NewPubsubClient(userAgent string) *pubsub.Service { - pubsubClientBasePath := RemoveBasePathVersion(c.PubsubBasePath) - log.Printf("[INFO] Instantiating Google Pubsub client for path %s", pubsubClientBasePath) - wrappedPubsubClient := ClientWithAdditionalRetries(c.Client, PubsubTopicProjectNotReady) - clientPubsub, err := pubsub.NewService(c.Context, option.WithHTTPClient(wrappedPubsubClient)) - if err != nil { - log.Printf("[WARN] Error creating client pubsub: %s", err) - return nil - } - clientPubsub.UserAgent = userAgent - clientPubsub.BasePath = pubsubClientBasePath - - return clientPubsub -} - -func (c *Config) NewDataflowClient(userAgent string) *dataflow.Service { - dataflowClientBasePath := RemoveBasePathVersion(c.DataflowBasePath) - log.Printf("[INFO] Instantiating Google Dataflow client for path %s", dataflowClientBasePath) - clientDataflow, err := dataflow.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client dataflow: %s", err) - return nil - } - clientDataflow.UserAgent = userAgent - clientDataflow.BasePath = dataflowClientBasePath - - return clientDataflow -} - -func (c *Config) NewResourceManagerClient(userAgent string) *cloudresourcemanager.Service { - resourceManagerBasePath := RemoveBasePathVersion(c.ResourceManagerBasePath) - log.Printf("[INFO] Instantiating Google Cloud ResourceManager client for path %s", resourceManagerBasePath) - clientResourceManager, err := cloudresourcemanager.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client resource manager: %s", err) - return nil - } - clientResourceManager.UserAgent = userAgent - clientResourceManager.BasePath = resourceManagerBasePath - - return clientResourceManager -} - -func (c *Config) NewResourceManagerV3Client(userAgent string) *resourceManagerV3.Service { - resourceManagerV3BasePath := RemoveBasePathVersion(c.ResourceManagerV3BasePath) - log.Printf("[INFO] Instantiating Google Cloud ResourceManager V3 client for path %s", resourceManagerV3BasePath) - clientResourceManagerV3, err := resourceManagerV3.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client resource manager v3: %s", err) - return nil - } - clientResourceManagerV3.UserAgent = userAgent - clientResourceManagerV3.BasePath = resourceManagerV3BasePath - - return clientResourceManagerV3 -} - -{{ if ne $.TargetVersionName `ga` -}} -func(c *Config) NewRuntimeconfigClient(userAgent string) *runtimeconfig.Service { - runtimeConfigClientBasePath := RemoveBasePathVersion(c.RuntimeConfigBasePath) - log.Printf("[INFO] Instantiating Google Cloud Runtimeconfig client for path %s", runtimeConfigClientBasePath) - clientRuntimeconfig, err := runtimeconfig.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client runtime config: %s", err) - return nil - } - clientRuntimeconfig.UserAgent = userAgent - clientRuntimeconfig.BasePath = runtimeConfigClientBasePath - - return clientRuntimeconfig -} -{{- end }} - -func (c *Config) NewIamClient(userAgent string) *iam.Service { - iamClientBasePath := RemoveBasePathVersion(c.IAMBasePath) - log.Printf("[INFO] Instantiating Google Cloud IAM client for path %s", iamClientBasePath) - clientIAM, err := iam.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client iam: %s", err) - return nil - } - clientIAM.UserAgent = userAgent - clientIAM.BasePath = iamClientBasePath - - return clientIAM -} - -func (c *Config) NewIamCredentialsClient(userAgent string) *iamcredentials.Service { - iamCredentialsClientBasePath := RemoveBasePathVersion(c.IamCredentialsBasePath) - log.Printf("[INFO] Instantiating Google Cloud IAMCredentials client for path %s", iamCredentialsClientBasePath) - clientIamCredentials, err := iamcredentials.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client iam credentials: %s", err) - return nil - } - clientIamCredentials.UserAgent = userAgent - clientIamCredentials.BasePath = iamCredentialsClientBasePath - - return clientIamCredentials -} - -func (c *Config) NewServiceManClient(userAgent string) *servicemanagement.APIService { - serviceManagementClientBasePath := RemoveBasePathVersion(c.ServiceManagementBasePath) - log.Printf("[INFO] Instantiating Google Cloud Service Management client for path %s", serviceManagementClientBasePath) - clientServiceMan, err := servicemanagement.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client service management: %s", err) - return nil - } - clientServiceMan.UserAgent = userAgent - clientServiceMan.BasePath = serviceManagementClientBasePath - - return clientServiceMan -} - -func (c *Config) NewServiceUsageClient(userAgent string) *serviceusage.Service { - serviceUsageClientBasePath := RemoveBasePathVersion(c.ServiceUsageBasePath) - log.Printf("[INFO] Instantiating Google Cloud Service Usage client for path %s", serviceUsageClientBasePath) - clientServiceUsage, err := serviceusage.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client service usage: %s", err) - return nil - } - clientServiceUsage.UserAgent = userAgent - clientServiceUsage.BasePath = serviceUsageClientBasePath - - return clientServiceUsage -} - -func (c *Config) NewBillingClient(userAgent string) *cloudbilling.APIService { - cloudBillingClientBasePath := RemoveBasePathVersion(c.CloudBillingBasePath) - log.Printf("[INFO] Instantiating Google Cloud Billing client for path %s", cloudBillingClientBasePath) - clientBilling, err := cloudbilling.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client billing: %s", err) - return nil - } - clientBilling.UserAgent = userAgent - clientBilling.BasePath = cloudBillingClientBasePath - - return clientBilling -} - -func (c *Config) NewBuildClient(userAgent string) *cloudbuild.Service { - cloudBuildClientBasePath := RemoveBasePathVersion(c.CloudBuildBasePath) - log.Printf("[INFO] Instantiating Google Cloud Build client for path %s", cloudBuildClientBasePath) - clientBuild, err := cloudbuild.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client build: %s", err) - return nil - } - clientBuild.UserAgent = userAgent - clientBuild.BasePath = cloudBuildClientBasePath - - return clientBuild -} - -func (c *Config) NewCloudFunctionsClient(userAgent string) *cloudfunctions.Service { - cloudFunctionsClientBasePath := RemoveBasePathVersion(c.CloudFunctionsBasePath) - log.Printf("[INFO] Instantiating Google Cloud CloudFunctions Client for path %s", cloudFunctionsClientBasePath) - clientCloudFunctions, err := cloudfunctions.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client cloud functions: %s", err) - return nil - } - clientCloudFunctions.UserAgent = userAgent - clientCloudFunctions.BasePath = cloudFunctionsClientBasePath - - return clientCloudFunctions -} - -func (c *Config) NewSourceRepoClient(userAgent string) *sourcerepo.Service { - sourceRepoClientBasePath := RemoveBasePathVersion(c.SourceRepoBasePath) - log.Printf("[INFO] Instantiating Google Cloud Source Repo client for path %s", sourceRepoClientBasePath) - clientSourceRepo, err := sourcerepo.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client source repo: %s", err) - return nil - } - clientSourceRepo.UserAgent = userAgent - clientSourceRepo.BasePath = sourceRepoClientBasePath - - return clientSourceRepo -} - -func (c *Config) NewBigQueryClient(userAgent string) *bigquery.Service { - bigQueryClientBasePath := c.BigQueryBasePath - log.Printf("[INFO] Instantiating Google Cloud BigQuery client for path %s", bigQueryClientBasePath) - wrappedBigQueryClient := ClientWithAdditionalRetries(c.Client, IamMemberMissing) - clientBigQuery, err := bigquery.NewService(c.Context, option.WithHTTPClient(wrappedBigQueryClient)) - if err != nil { - log.Printf("[WARN] Error creating client big query: %s", err) - return nil - } - clientBigQuery.UserAgent = userAgent - clientBigQuery.BasePath = bigQueryClientBasePath - - return clientBigQuery -} - -func (c *Config) NewSpannerClient(userAgent string) *spanner.Service { - spannerClientBasePath := RemoveBasePathVersion(c.SpannerBasePath) - log.Printf("[INFO] Instantiating Google Cloud Spanner client for path %s", spannerClientBasePath) - clientSpanner, err := spanner.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client source repo: %s", err) - return nil - } - clientSpanner.UserAgent = userAgent - clientSpanner.BasePath = spannerClientBasePath - - return clientSpanner -} - -func (c *Config) NewDataprocClient(userAgent string) *dataproc.Service { - dataprocClientBasePath := RemoveBasePathVersion(c.DataprocBasePath) - log.Printf("[INFO] Instantiating Google Cloud Dataproc client for path %s", dataprocClientBasePath) - clientDataproc, err := dataproc.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client dataproc: %s", err) - return nil - } - clientDataproc.UserAgent = userAgent - clientDataproc.BasePath = dataprocClientBasePath - - return clientDataproc -} - -func (c *Config) NewCloudIoTClient(userAgent string) *cloudiot.Service { - cloudIoTClientBasePath := RemoveBasePathVersion(c.CloudIoTBasePath) - log.Printf("[INFO] Instantiating Google Cloud IoT Core client for path %s", cloudIoTClientBasePath) - clientCloudIoT, err := cloudiot.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client cloud iot: %s", err) - return nil - } - clientCloudIoT.UserAgent = userAgent - clientCloudIoT.BasePath = cloudIoTClientBasePath - - return clientCloudIoT -} - -func (c *Config) NewAppEngineClient(userAgent string) *appengine.APIService { - appEngineClientBasePath := RemoveBasePathVersion(c.AppEngineBasePath) - log.Printf("[INFO] Instantiating App Engine client for path %s", appEngineClientBasePath) - clientAppEngine, err := appengine.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client appengine: %s", err) - return nil - } - clientAppEngine.UserAgent = userAgent - clientAppEngine.BasePath = appEngineClientBasePath - - return clientAppEngine -} - -func (c *Config) NewComposerClient(userAgent string) *composer.Service { - composerClientBasePath := RemoveBasePathVersion(c.ComposerBasePath) - log.Printf("[INFO] Instantiating Cloud Composer client for path %s", composerClientBasePath) - clientComposer, err := composer.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client composer: %s", err) - return nil - } - clientComposer.UserAgent = userAgent - clientComposer.BasePath = composerClientBasePath - - return clientComposer -} - -func (c *Config) NewServiceNetworkingClient(userAgent string) *servicenetworking.APIService { - serviceNetworkingClientBasePath := RemoveBasePathVersion(c.ServiceNetworkingBasePath) - log.Printf("[INFO] Instantiating Service Networking client for path %s", serviceNetworkingClientBasePath) - clientServiceNetworking, err := servicenetworking.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client service networking: %s", err) - return nil - } - clientServiceNetworking.UserAgent = userAgent - clientServiceNetworking.BasePath = serviceNetworkingClientBasePath - - return clientServiceNetworking -} - -func (c *Config) NewStorageTransferClient(userAgent string) *storagetransfer.Service { - storageTransferClientBasePath := RemoveBasePathVersion(c.StorageTransferBasePath) - log.Printf("[INFO] Instantiating Google Cloud Storage Transfer client for path %s", storageTransferClientBasePath) - clientStorageTransfer, err := storagetransfer.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client storage transfer: %s", err) - return nil - } - clientStorageTransfer.UserAgent = userAgent - clientStorageTransfer.BasePath = storageTransferClientBasePath - - return clientStorageTransfer -} - -func (c *Config) NewHealthcareClient(userAgent string) *healthcare.Service { - healthcareClientBasePath := RemoveBasePathVersion(c.HealthcareBasePath) - log.Printf("[INFO] Instantiating Google Cloud Healthcare client for path %s", healthcareClientBasePath) - clientHealthcare, err := healthcare.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client healthcare: %s", err) - return nil - } - clientHealthcare.UserAgent = userAgent - clientHealthcare.BasePath = healthcareClientBasePath - - return clientHealthcare -} - -func (c *Config) NewCloudIdentityClient(userAgent string) *cloudidentity.Service { - cloudidentityClientBasePath := RemoveBasePathVersion(c.CloudIdentityBasePath) - log.Printf("[INFO] Instantiating Google Cloud CloudIdentity client for path %s", cloudidentityClientBasePath) - clientCloudIdentity, err := cloudidentity.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client cloud identity: %s", err) - return nil - } - clientCloudIdentity.UserAgent = userAgent - clientCloudIdentity.BasePath = cloudidentityClientBasePath - - return clientCloudIdentity -} - -func (c *Config) BigTableClientFactory(userAgent string) *BigtableClientFactory { - bigtableClientFactory := &BigtableClientFactory{ - UserAgent: userAgent, - TokenSource: c.tokenSource, - gRPCLoggingOptions: c.gRPCLoggingOptions, - BillingProject: c.BillingProject, - UserProjectOverride: c.UserProjectOverride, - } - - return bigtableClientFactory -} - -// Unlike other clients, the Bigtable Admin client doesn't use a single -// service. Instead, there are several distinct services created off -// the base service object. To imitate most other handwritten clients, -// we expose those directly instead of providing the `Service` object -// as a factory. -func (c *Config) NewBigTableProjectsInstancesClient(userAgent string) *bigtableadmin.ProjectsInstancesService { - bigtableAdminBasePath := RemoveBasePathVersion(c.BigtableAdminBasePath) - log.Printf("[INFO] Instantiating Google Cloud BigtableAdmin for path %s", bigtableAdminBasePath) - clientBigtable, err := bigtableadmin.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client big table projects instances: %s", err) - return nil - } - clientBigtable.UserAgent = userAgent - clientBigtable.BasePath = bigtableAdminBasePath - clientBigtableProjectsInstances := bigtableadmin.NewProjectsInstancesService(clientBigtable) - - return clientBigtableProjectsInstances -} - -func (c *Config) NewBigTableProjectsInstancesTablesClient(userAgent string) *bigtableadmin.ProjectsInstancesTablesService { - bigtableAdminBasePath := RemoveBasePathVersion(c.BigtableAdminBasePath) - log.Printf("[INFO] Instantiating Google Cloud BigtableAdmin for path %s", bigtableAdminBasePath) - clientBigtable, err := bigtableadmin.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client projects instances tables: %s", err) - return nil - } - clientBigtable.UserAgent = userAgent - clientBigtable.BasePath = bigtableAdminBasePath - clientBigtableProjectsInstancesTables := bigtableadmin.NewProjectsInstancesTablesService(clientBigtable) - - return clientBigtableProjectsInstancesTables -} - -func (c *Config) NewCloudRunV2Client(userAgent string) *runadminv2.Service { - runAdminV2ClientBasePath := RemoveBasePathVersion(RemoveBasePathVersion(c.CloudRunV2BasePath)) - log.Printf("[INFO] Instantiating Google Cloud Run Admin v2 client for path %s", runAdminV2ClientBasePath) - clientRunAdminV2, err := runadminv2.NewService(c.Context, option.WithHTTPClient(c.Client)) - if err != nil { - log.Printf("[WARN] Error creating client run admin: %s", err) - return nil - } - clientRunAdminV2.UserAgent = userAgent - clientRunAdminV2.BasePath = runAdminV2ClientBasePath - - return clientRunAdminV2 -} - -// StaticTokenSource is used to be able to identify static token sources without reflection. -type StaticTokenSource struct { - oauth2.TokenSource -} - -// Get a set of credentials with a given scope (clientScopes) based on the Config object. -// If initialCredentialsOnly is true, don't follow the impersonation settings and return the initial set of creds -// instead. -func (c *Config) GetCredentials(clientScopes []string, initialCredentialsOnly bool) (googleoauth.Credentials, error) { - // UniverseDomain is assumed to be the previously set provider-configured value for access tokens - if c.AccessToken != "" { - contents, _, err := verify.PathOrContents(c.AccessToken) - if err != nil { - return googleoauth.Credentials{}, fmt.Errorf("Error loading access token: %s", err) - } - - token := &oauth2.Token{AccessToken: contents} - if c.ImpersonateServiceAccount != "" && !initialCredentialsOnly { - opts := []option.ClientOption{option.WithTokenSource(oauth2.StaticTokenSource(token)), option.ImpersonateCredentials(c.ImpersonateServiceAccount, c.ImpersonateServiceAccountDelegates...), option.WithScopes(clientScopes...)} - creds, err := transport.Creds(context.TODO(), opts...) - if err != nil { - return googleoauth.Credentials{}, err - } - return *creds, nil - } - - log.Printf("[INFO] Authenticating using configured Google JSON 'access_token'...") - log.Printf("[INFO] -- Scopes: %s", clientScopes) - return googleoauth.Credentials{ - TokenSource: StaticTokenSource{oauth2.StaticTokenSource(token)}, - }, nil - } - - // UniverseDomain is set by the credential file's "universe_domain" field - if c.Credentials != "" { - contents, _, err := verify.PathOrContents(c.Credentials) - if err != nil { - return googleoauth.Credentials{}, fmt.Errorf("error loading credentials: %s", err) - } - - var content map[string]any - if err := json.Unmarshal([]byte(contents), &content); err != nil { - return googleoauth.Credentials{}, fmt.Errorf("error unmarshaling credentials: %s", err) - } - - if content["universe_domain"] != nil { - c.UniverseDomain = content["universe_domain"].(string) - } else { - // Unset UniverseDomain if not found in credentials file - c.UniverseDomain = "" - } - - if c.ImpersonateServiceAccount != "" && !initialCredentialsOnly { - opts := []option.ClientOption{option.WithCredentialsJSON([]byte(contents)), option.ImpersonateCredentials(c.ImpersonateServiceAccount, c.ImpersonateServiceAccountDelegates...), option.WithScopes(clientScopes...)} - creds, err := transport.Creds(context.TODO(), opts...) - if err != nil { - return googleoauth.Credentials{}, err - } - return *creds, nil - } - - if c.UniverseDomain != "" && c.UniverseDomain != "googleapis.com" { - creds, err := transport.Creds(c.Context, option.WithCredentialsJSON([]byte(contents)), option.WithScopes(clientScopes...), internaloption.EnableJwtWithScope()) - if err != nil { - return googleoauth.Credentials{}, fmt.Errorf("unable to parse credentials from '%s': %s", contents, err) - } - log.Printf("[INFO] Authenticating using configured Google JSON 'credentials'...") - log.Printf("[INFO] -- Scopes: %s", clientScopes) - log.Printf("[INFO] -- Sending EnableJwtWithScope option") - return *creds, nil - } else { - creds, err := transport.Creds(c.Context, option.WithCredentialsJSON([]byte(contents)), option.WithScopes(clientScopes...)) - if err != nil { - return googleoauth.Credentials{}, fmt.Errorf("unable to parse credentials from '%s': %s", contents, err) - } - log.Printf("[INFO] Authenticating using configured Google JSON 'credentials'...") - log.Printf("[INFO] -- Scopes: %s", clientScopes) - return *creds, nil - } - } - - var creds *googleoauth.Credentials - var err error - if c.ImpersonateServiceAccount != "" && !initialCredentialsOnly { - opts := option.ImpersonateCredentials(c.ImpersonateServiceAccount, c.ImpersonateServiceAccountDelegates...) - creds, err = transport.Creds(context.TODO(), opts, option.WithScopes(clientScopes...)) - if err != nil { - return googleoauth.Credentials{}, err - } - } else { - log.Printf("[INFO] Authenticating using DefaultClient...") - log.Printf("[INFO] -- Scopes: %s", clientScopes) - - if c.UniverseDomain != "" && c.UniverseDomain != "googleapis.com" { - log.Printf("[INFO] -- Sending JwtWithScope option") - creds, err = transport.Creds(context.Background(), option.WithScopes(clientScopes...), internaloption.EnableJwtWithScope()) - if err != nil { - return googleoauth.Credentials{}, fmt.Errorf("Attempted to load application default credentials since neither `credentials` nor `access_token` was set in the provider block. No credentials loaded. To use your gcloud credentials, run 'gcloud auth application-default login'. Original error: %w", err) - } - } else { - creds, err = transport.Creds(context.Background(), option.WithScopes(clientScopes...)) - if err != nil { - return googleoauth.Credentials{}, fmt.Errorf("Attempted to load application default credentials since neither `credentials` nor `access_token` was set in the provider block. No credentials loaded. To use your gcloud credentials, run 'gcloud auth application-default login'. Original error: %w", err) - } - } - } - - if creds.JSON != nil { - var content map[string]any - if err := json.Unmarshal([]byte(creds.JSON), &content); err != nil { - log.Printf("[WARN] error unmarshaling credentials, skipping Universe Domain detection") - c.UniverseDomain = "" - } else if content["universe_domain"] != nil { - c.UniverseDomain = content["universe_domain"].(string) - } else { - // Unset UniverseDomain if not found in ADC credentials file - c.UniverseDomain = "" - } - } else { - // creds.GetUniverseDomain may retrieve a domain from the metadata server - ud, err := creds.GetUniverseDomain() - if err != nil { - log.Printf("[WARN] Error retrieving universe domain: %s", err) - } - c.UniverseDomain = ud - } - - return *creds, nil -} - -// Remove the `/{{"{{"}}version{{"}}"}}/` from a base path if present. -func RemoveBasePathVersion(url string) string { - re := regexp.MustCompile(`(?Phttp[s]://.*)(?P/[^/]+?/$)`) - return re.ReplaceAllString(url, "$1/") -} - -// For a consumer of config.go that isn't a full fledged provider and doesn't -// have its own endpoint mechanism such as sweepers, init {{"{{"}}service{{"}}"}}BasePath -// values to a default. After using this, you should call config.LoadAndValidate. -func ConfigureBasePaths(c *Config) { - // Generated Products - {{- range $product := $.Products }} - c.{{ $product.Name }}BasePath = DefaultBasePaths[{{ $product.Name }}BasePathKey] - {{- end }} - - // Handwritten Products / Versioned / Atypical Entries - c.CloudBillingBasePath = DefaultBasePaths[CloudBillingBasePathKey] - c.ComposerBasePath = DefaultBasePaths[ComposerBasePathKey] - c.ContainerBasePath = DefaultBasePaths[ContainerBasePathKey] - c.DataprocBasePath = DefaultBasePaths[DataprocBasePathKey] - c.DataflowBasePath = DefaultBasePaths[DataflowBasePathKey] - c.IamCredentialsBasePath = DefaultBasePaths[IamCredentialsBasePathKey] - c.ResourceManagerV3BasePath = DefaultBasePaths[ResourceManagerV3BasePathKey] - c.IAMBasePath = DefaultBasePaths[IAMBasePathKey] - c.BigQueryBasePath = DefaultBasePaths[BigQueryBasePathKey] - c.BigtableAdminBasePath = DefaultBasePaths[BigtableAdminBasePathKey] - c.TagsLocationBasePath = DefaultBasePaths[TagsLocationBasePathKey] -} - -func GetCurrentUserEmail(config *Config, userAgent string) (string, error) { - // When environment variables UserProjectOverride and BillingProject are set for the provider, - // the header X-Goog-User-Project is set for the API requests. - // But it causes an error when calling GetCurrentUserEmail. Set the project to be "NO_BILLING_PROJECT_OVERRIDE". - // And then it triggers the header X-Goog-User-Project to be set to empty string. - - // See https://github.com/golang/oauth2/issues/306 for a recommendation to do this from a Go maintainer - // URL retrieved from https://accounts.google.com/.well-known/openid-configuration - res, err := SendRequest(SendRequestOptions{ - Config: config, - Method: "GET", - Project: "NO_BILLING_PROJECT_OVERRIDE", - RawURL: "https://openidconnect.googleapis.com/v1/userinfo", - UserAgent: userAgent, - }) - - if err != nil { - return "", fmt.Errorf("error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: %s", err) - } - if res["email"] == nil { - return "", fmt.Errorf("error retrieving email from userinfo. email was nil in the response.") - } - return res["email"].(string), nil -} - -func MultiEnvSearch(ks []string) string { - for _, k := range ks { - if v := os.Getenv(k); v != "" { - return v - } - } - return "" -} - -// MultiEnvDefault is a helper function that returns the value of the first -// environment variable in the given list that returns a non-empty value. If -// none of the environment variables return a value, the default value is -// returned. -func MultiEnvDefault(ks []string, dv interface{}) interface{} { - for _, k := range ks { - if v := os.Getenv(k); v != "" { - return v - } - } - return dv -} - -func CustomEndpointValidator() validator.String { - return stringvalidator.RegexMatches(regexp.MustCompile(`.*/[^/]+/$`), "") -} - -// return the region a selfLink is referring to -func GetRegionFromRegionSelfLink(selfLink string) string { - re := regexp.MustCompile("/compute/[a-zA-Z0-9]*/projects/[a-zA-Z0-9-]*/regions/([a-zA-Z0-9-]*)") - switch { - case re.MatchString(selfLink): - if res := re.FindStringSubmatch(selfLink); len(res) == 2 && res[1] != "" { - return res[1] - } - } - return selfLink -} diff --git a/mmv1/third_party/terraform/transport/go/provider_handwritten_endpoint.go.tmpl b/mmv1/third_party/terraform/transport/go/provider_handwritten_endpoint.go.tmpl deleted file mode 100644 index f42ba038e969..000000000000 --- a/mmv1/third_party/terraform/transport/go/provider_handwritten_endpoint.go.tmpl +++ /dev/null @@ -1,131 +0,0 @@ -package transport - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/verify" -) - -// For generated resources, endpoint entries live in product-specific provider -// files. Collect handwritten ones here. If any of these are modified, be sure -// to update the provider_reference docs page. - -var CloudBillingCustomEndpointEntryKey = "cloud_billing_custom_endpoint" -var CloudBillingCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var ComposerCustomEndpointEntryKey = "composer_custom_endpoint" -var ComposerCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var ContainerCustomEndpointEntryKey = "container_custom_endpoint" -var ContainerCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var DataflowCustomEndpointEntryKey = "dataflow_custom_endpoint" -var DataflowCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var IAMCustomEndpointEntryKey = "iam_custom_endpoint" -var IAMCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var IamCredentialsCustomEndpointEntryKey = "iam_credentials_custom_endpoint" -var IamCredentialsCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var ResourceManagerV3CustomEndpointEntryKey = "resource_manager_v3_custom_endpoint" -var ResourceManagerV3CustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -{{ if ne $.TargetVersionName `ga` -}} -var RuntimeConfigCustomEndpointEntryKey = "runtimeconfig_custom_endpoint" -var RuntimeConfigCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} -{{- end }} - -var ServiceNetworkingCustomEndpointEntryKey = "service_networking_custom_endpoint" -var ServiceNetworkingCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var ServiceUsageCustomEndpointEntryKey = "service_usage_custom_endpoint" -var ServiceUsageCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, - DefaultFunc: schema.MultiEnvDefaultFunc([]string{ - "GOOGLE_SERVICE_USAGE_CUSTOM_ENDPOINT", - }, DefaultBasePaths[ServiceUsageBasePathKey]), -} - -var BigtableAdminCustomEndpointEntryKey = "bigtable_custom_endpoint" -var BigtableAdminCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, - DefaultFunc: schema.MultiEnvDefaultFunc([]string{ - "GOOGLE_BIGTABLE_CUSTOM_ENDPOINT", - }, DefaultBasePaths[BigtableAdminBasePathKey]), -} - -var PrivatecaCertificateTemplateEndpointEntryKey = "privateca_custom_endpoint" -var PrivatecaCertificateTemplateCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, - DefaultFunc: schema.MultiEnvDefaultFunc([]string{ - "GOOGLE_PRIVATECA_CUSTOM_ENDPOINT", - }, DefaultBasePaths[PrivatecaBasePathKey]), -} - -var ContainerAwsCustomEndpointEntryKey = "container_aws_custom_endpoint" -var ContainerAwsCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var ContainerAzureCustomEndpointEntryKey = "container_azure_custom_endpoint" -var ContainerAzureCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -var TagsLocationCustomEndpointEntryKey = "tags_location_custom_endpoint" -var TagsLocationCustomEndpointEntry = &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: ValidateCustomEndpoint, -} - -func ValidateCustomEndpoint(v interface{}, k string) (ws []string, errors []error) { - re := `.*/[^/]+/$` - return verify.ValidateRegexp(re)(v, k) -} diff --git a/mmv1/third_party/terraform/transport/provider_handwritten_endpoint.go.tmpl b/mmv1/third_party/terraform/transport/provider_handwritten_endpoint.go.tmpl index 79cc5bb749fa..f42ba038e969 100644 --- a/mmv1/third_party/terraform/transport/provider_handwritten_endpoint.go.tmpl +++ b/mmv1/third_party/terraform/transport/provider_handwritten_endpoint.go.tmpl @@ -1,4 +1,3 @@ -<% autogen_exception -%> package transport import ( @@ -59,14 +58,14 @@ var ResourceManagerV3CustomEndpointEntry = &schema.Schema{ ValidateFunc: ValidateCustomEndpoint, } -<% unless version == 'ga' -%> +{{ if ne $.TargetVersionName `ga` -}} var RuntimeConfigCustomEndpointEntryKey = "runtimeconfig_custom_endpoint" var RuntimeConfigCustomEndpointEntry = &schema.Schema{ Type: schema.TypeString, Optional: true, ValidateFunc: ValidateCustomEndpoint, } -<% end -%> +{{- end }} var ServiceNetworkingCustomEndpointEntryKey = "service_networking_custom_endpoint" var ServiceNetworkingCustomEndpointEntry = &schema.Schema{