forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite - 9/17 refresh (GoogleCloudPlatform#11745)
- Loading branch information
Showing
33 changed files
with
1,075 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 161 additions & 0 deletions
161
mmv1/products/secretmanagerregional/go_RegionalSecretVersion.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# Copyright 2024 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Warning: This is a temporary file, and should not be edited directly | ||
--- | ||
name: 'RegionalSecretVersion' | ||
description: | | ||
A regional secret version resource. | ||
docs: | ||
optional_properties: | | ||
* `is_secret_data_base64` - (Optional) If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is. | ||
base_url: '{{name}}' | ||
self_link: '{{name}}' | ||
create_url: '{{secret}}:addVersion' | ||
delete_url: '{{name}}:destroy' | ||
delete_verb: 'POST' | ||
import_format: | ||
- 'projects/{{%project}}/locations/{{%location}}/secrets/{{%secret_id}}/versions/{{%version}}' | ||
timeouts: | ||
insert_minutes: 20 | ||
update_minutes: 20 | ||
delete_minutes: 20 | ||
custom_code: | ||
extra_schema_entry: 'templates/terraform/extra_schema_entry/go/secret_version_is_secret_data_base64.go.tmpl' | ||
decoder: 'templates/terraform/decoders/go/treat_destroyed_state_as_gone.tmpl' | ||
pre_create: 'templates/terraform/pre_create/go/secret_manager_regional_secret_version.go.tmpl' | ||
post_create: 'templates/terraform/post_create/go/regional_secret_version.go.tmpl' | ||
pre_read: 'templates/terraform/pre_read/go/secret_manager_regional_secret_version.go.tmpl' | ||
custom_update: 'templates/terraform/custom_update/go/regional_secret_version.go.tmpl' | ||
pre_delete: 'templates/terraform/pre_delete/go/regional_secret_version_deletion_policy.go.tmpl' | ||
custom_import: 'templates/terraform/custom_import/go/regional_secret_version.go.tmpl' | ||
# Sweeper skipped as this resource has customized deletion. | ||
exclude_sweeper: true | ||
examples: | ||
- name: 'regional_secret_version_basic' | ||
primary_resource_id: 'regional_secret_version_basic' | ||
vars: | ||
secret_id: 'secret-version' | ||
data: 'secret-data' | ||
- name: 'regional_secret_version_with_base64_data' | ||
primary_resource_id: 'regional_secret_version_base64' | ||
vars: | ||
secret_id: 'secret-version' | ||
data: 'secret-data.pfx' | ||
test_vars_overrides: | ||
'data': '"./test-fixtures/binary-file.pfx"' | ||
ignore_read_extra: | ||
- 'is_secret_data_base64' | ||
- name: 'regional_secret_version_disabled' | ||
primary_resource_id: 'regional_secret_version_disabled' | ||
vars: | ||
secret_id: 'secret-version' | ||
data: 'secret-data' | ||
- name: 'regional_secret_version_deletion_policy_abandon' | ||
primary_resource_id: 'regional_secret_version_deletion_policy' | ||
vars: | ||
secret_id: 'secret-version' | ||
data: 'secret-data' | ||
ignore_read_extra: | ||
- 'deletion_policy' | ||
- name: 'regional_secret_version_deletion_policy_disable' | ||
primary_resource_id: 'regional_secret_version_deletion_policy' | ||
vars: | ||
secret_id: 'secret-version' | ||
data: 'secret-data' | ||
ignore_read_extra: | ||
- 'deletion_policy' | ||
virtual_fields: | ||
- name: 'deletion_policy' | ||
description: | | ||
The deletion policy for the regional secret version. Setting `ABANDON` allows the resource | ||
to be abandoned rather than deleted. Setting `DISABLE` allows the resource to be | ||
disabled rather than deleted. Default is `DELETE`. Possible values are: | ||
* DELETE | ||
* DISABLE | ||
* ABANDON | ||
type: String | ||
default_value: "DELETE" | ||
parameters: | ||
- name: 'secret' | ||
type: ResourceRef | ||
description: | | ||
Secret Manager regional secret resource. | ||
url_param_only: true | ||
required: true | ||
immutable: true | ||
resource: 'RegionalSecret' | ||
imports: 'name' | ||
- name: 'location' | ||
type: String | ||
description: | | ||
Location of Secret Manager regional secret resource. | ||
url_param_only: true | ||
output: true | ||
properties: | ||
- name: 'name' | ||
type: String | ||
description: | | ||
The resource name of the regional secret version. Format: | ||
`projects/{{project}}/locations/{{location}}/secrets/{{secret_id}}/versions/{{version}}` | ||
output: true | ||
- name: 'createTime' | ||
type: String | ||
description: | | ||
The time at which the regional secret version was created. | ||
output: true | ||
- name: 'destroyTime' | ||
type: String | ||
description: | | ||
The time at which the regional secret version was destroyed. Only present if state is DESTROYED. | ||
output: true | ||
- name: 'customerManagedEncryption' | ||
type: NestedObject | ||
description: | | ||
The customer-managed encryption configuration of the regional secret. | ||
output: true | ||
properties: | ||
- name: 'kmsKeyVersionName' | ||
type: String | ||
description: | | ||
The resource name of the Cloud KMS CryptoKey used to encrypt secret payloads. | ||
output: true | ||
- name: 'version' | ||
type: String | ||
description: | | ||
The version of the Regional Secret. | ||
output: true | ||
custom_flatten: 'templates/terraform/custom_flatten/go/regional_secret_version_version.go.tmpl' | ||
- name: 'enabled' | ||
type: Boolean | ||
description: | | ||
The current state of the regional secret version. | ||
api_name: state | ||
custom_flatten: 'templates/terraform/custom_flatten/go/secret_version_enable.go.tmpl' | ||
custom_expand: 'templates/terraform/custom_expand/go/regional_secret_version_enable.go.tmpl' | ||
default_value: true | ||
- name: 'payload' | ||
type: NestedObject | ||
description: The secret payload of the Regional SecretVersion. | ||
required: true | ||
custom_flatten: 'templates/terraform/custom_flatten/go/regional_secret_version_access.go.tmpl' | ||
flatten_object: true | ||
properties: | ||
- name: 'secret_data' | ||
type: String | ||
description: The secret data. Must be no larger than 64KiB. | ||
api_name: data | ||
required: true | ||
immutable: true | ||
sensitive: true | ||
custom_expand: 'templates/terraform/custom_expand/go/secret_version_secret_data.go.tmpl' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
mmv1/templates/terraform/custom_expand/go/regional_secret_version_enable.go.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{{/* | ||
The license inside this block applies to this file | ||
Copyright 2024 Google Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES 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, "{{"{{"}}SecretManagerRegionalBasePath{{"}}"}}{{"{{"}}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 | ||
} |
Oops, something went wrong.