Skip to content

Commit

Permalink
template moves - script #3
Browse files Browse the repository at this point in the history
  • Loading branch information
c2thorn committed Sep 16, 2024
1 parent 6f7c48e commit 4486b27
Show file tree
Hide file tree
Showing 4,129 changed files with 9,715 additions and 96,592 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
26 changes: 12 additions & 14 deletions mmv1/templates/terraform/constants/access_approval.go.tmpl
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions mmv1/templates/terraform/constants/agent_pool.go.tmpl
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -19,4 +19,4 @@ func waitForAgentPoolReady(d *schema.ResourceData, config *transport_tpg.Config,
}
})
}
<% end -%>
{{- end }}
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
26 changes: 12 additions & 14 deletions mmv1/templates/terraform/constants/backend_service.go.tmpl
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
26 changes: 12 additions & 14 deletions mmv1/templates/terraform/constants/billing_budget.tmpl
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
@@ -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{
Expand Down
26 changes: 12 additions & 14 deletions mmv1/templates/terraform/constants/binaryauthorization_policy.tmpl
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
26 changes: 12 additions & 14 deletions mmv1/templates/terraform/constants/cert_manager.tmpl
Original file line number Diff line number Diff line change
@@ -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 == "" {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -19,4 +19,4 @@ func waitForRegistrationActive(d *schema.ResourceData, config *transport_tpg.Con
}
})
}
<% end -%>
{{- end }}
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
30 changes: 14 additions & 16 deletions mmv1/templates/terraform/constants/datastream_stream.go.tmpl
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -78,4 +76,4 @@ func resourceDatastreamStreamDatabaseIdDiffSuppress(_, old, new string, _ *schem
return old == new
}

<% end -%>
{{ end }}
8 changes: 4 additions & 4 deletions mmv1/templates/terraform/constants/disk.tmpl
Original file line number Diff line number Diff line change
@@ -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") {
Expand All @@ -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 {
Expand Down
26 changes: 12 additions & 14 deletions mmv1/templates/terraform/constants/dlp_stored_info_type.go.tmpl
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions mmv1/templates/terraform/constants/firebase_project.go.tmpl
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -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)
}
Expand Down
Loading

0 comments on commit 4486b27

Please sign in to comment.