-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for parameter manager regional parameter version resource…
… `google_parameter_manager_regional_parameter_version` (#12642) (#20914) [upstream:d04d7133bf93380891791e5a5211b965e210c3bb] Signed-off-by: Modular Magician <[email protected]>
- Loading branch information
1 parent
e1c6c53
commit 00bb0a0
Showing
5 changed files
with
193 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:new-resource | ||
`google_parameter_manager_regional_parameter_version` | ||
``` |
3 changes: 3 additions & 0 deletions
3
...es/parametermanagerregional/resource_parameter_manager_regional_parameter_version_test.go
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,3 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
package parametermanagerregional_test |
4 changes: 4 additions & 0 deletions
4
google/services/parametermanagerregional/test-fixtures/parameter_data_json_format.json
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,4 @@ | ||
{ | ||
"key1": "value1", | ||
"key2": "value2" | ||
} |
2 changes: 2 additions & 0 deletions
2
google/services/parametermanagerregional/test-fixtures/parameter_data_yaml_format.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,2 @@ | ||
key1: "value1" | ||
key2: "value2" |
181 changes: 181 additions & 0 deletions
181
website/docs/r/parameter_manager_regional_parameter_version.html.markdown
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,181 @@ | ||
--- | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
# | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# This file is automatically generated by Magic Modules and manual | ||
# changes will be clobbered when the file is regenerated. | ||
# | ||
# Please read more about how to change this file in | ||
# .github/CONTRIBUTING.md. | ||
# | ||
# ---------------------------------------------------------------------------- | ||
subcategory: "Parameter Manager" | ||
description: |- | ||
A Regional Parameter Version resource that stores the actual value of the regional parameter. | ||
--- | ||
|
||
# google_parameter_manager_regional_parameter_version | ||
|
||
A Regional Parameter Version resource that stores the actual value of the regional parameter. | ||
|
||
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. | ||
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. | ||
|
||
To get more information about RegionalParameterVersion, see: | ||
|
||
* [API documentation](https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters.versions) | ||
|
||
~> **Warning:** All arguments including the following potentially sensitive | ||
values will be stored in the raw state as plain text: `payload.parameter_data`. | ||
[Read more about sensitive data in state](https://www.terraform.io/language/state/sensitive-data). | ||
|
||
<div class = "oics-button" style="float: right; margin: 0 0 -15px"> | ||
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=regional_parameter_version_basic&open_in_editor=main.tf" target="_blank"> | ||
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> | ||
</a> | ||
</div> | ||
## Example Usage - Regional Parameter Version Basic | ||
|
||
|
||
```hcl | ||
resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { | ||
provider = google-beta | ||
parameter_id = "regional_parameter" | ||
location = "us-central1" | ||
} | ||
resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-basic" { | ||
provider = google-beta | ||
parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id | ||
parameter_version_id = "regional_parameter_version" | ||
parameter_data = "regional-parameter-version-data" | ||
} | ||
``` | ||
<div class = "oics-button" style="float: right; margin: 0 0 -15px"> | ||
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=regional_parameter_version_with_json_format&open_in_editor=main.tf" target="_blank"> | ||
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> | ||
</a> | ||
</div> | ||
## Example Usage - Regional Parameter Version With Json Format | ||
|
||
|
||
```hcl | ||
resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { | ||
provider = google-beta | ||
parameter_id = "regional_parameter" | ||
format = "JSON" | ||
location = "us-central1" | ||
} | ||
resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-json-format" { | ||
provider = google-beta | ||
parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id | ||
parameter_version_id = "regional_parameter_version" | ||
parameter_data = file("parameter_data_json_format.yaml") | ||
} | ||
``` | ||
<div class = "oics-button" style="float: right; margin: 0 0 -15px"> | ||
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=regional_parameter_version_with_yaml_format&open_in_editor=main.tf" target="_blank"> | ||
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> | ||
</a> | ||
</div> | ||
## Example Usage - Regional Parameter Version With Yaml Format | ||
|
||
|
||
```hcl | ||
resource "google_parameter_manager_regional_parameter" "regional-parameter-basic" { | ||
provider = google-beta | ||
parameter_id = "regional_parameter" | ||
format = "YAML" | ||
location = "us-central1" | ||
} | ||
resource "google_parameter_manager_regional_parameter_version" "regional-parameter-version-with-yaml-format" { | ||
provider = google-beta | ||
parameter = google_parameter_manager_regional_parameter.regional-parameter-basic.id | ||
parameter_version_id = "regional_parameter_version" | ||
parameter_data = file("parameter_data_yaml_format.yaml") | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
|
||
* `parameter_data` - | ||
(Required) | ||
The Regional Parameter data. | ||
**Note**: This property is sensitive and will not be displayed in the plan. | ||
|
||
* `parameter` - | ||
(Required) | ||
Parameter Manager Regional Parameter resource. | ||
|
||
* `parameter_version_id` - | ||
(Required) | ||
Version ID of the Regional Parameter Version Resource. This must be unique within the Regional Parameter. | ||
|
||
|
||
- - - | ||
|
||
|
||
* `disabled` - | ||
(Optional) | ||
The current state of Regional Parameter Version. This field is only applicable for updating Regional Parameter Version. | ||
|
||
|
||
## Attributes Reference | ||
|
||
In addition to the arguments listed above, the following computed attributes are exported: | ||
|
||
* `id` - an identifier for the resource with format `{{parameter}}/versions/{{parameter_version_id}}` | ||
|
||
* `name` - | ||
The resource name of the Regional Parameter Version. Format: | ||
`projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` | ||
|
||
* `create_time` - | ||
The time at which the Regional Parameter Version was created. | ||
|
||
* `update_time` - | ||
The time at which the Regional Parameter Version was updated. | ||
|
||
* `location` - | ||
Location of Parameter Manager Regional parameter resource. | ||
|
||
|
||
## Timeouts | ||
|
||
This resource provides the following | ||
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: | ||
|
||
- `create` - Default is 20 minutes. | ||
- `update` - Default is 20 minutes. | ||
- `delete` - Default is 20 minutes. | ||
|
||
## Import | ||
|
||
|
||
RegionalParameterVersion can be imported using any of these accepted formats: | ||
|
||
* `projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` | ||
|
||
|
||
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import RegionalParameterVersion using one of the formats above. For example: | ||
|
||
```tf | ||
import { | ||
id = "projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}/versions/{{parameter_version_id}}" | ||
to = google_parameter_manager_regional_parameter_version.default | ||
} | ||
``` | ||
|
||
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), RegionalParameterVersion can be imported using one of the formats above. For example: | ||
|
||
``` | ||
$ terraform import google_parameter_manager_regional_parameter_version.default projects/{{project}}/locations/{{location}}/parameters/{{parameter_id}}/versions/{{parameter_version_id}} | ||
``` |