-
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 parameter version resource `google_…
…parameter_manager_parameter_version` (#12641) (#20992) [upstream:6f96f4ccfd514c5f15b85c2e9f93d27659eb19e0] Signed-off-by: Modular Magician <magic-modules@google.com>
- Loading branch information
1 parent
6ea3aae
commit 49dd365
Showing
6 changed files
with
195 additions
and
8 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_parameter_version` | ||
``` |
3 changes: 3 additions & 0 deletions
3
google/services/parametermanager/resource_parameter_manager_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 parametermanager_test |
4 changes: 0 additions & 4 deletions
4
google/services/parametermanagerregional/test-fixtures/parameter_data_json_format.json
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
google/services/parametermanagerregional/test-fixtures/parameter_data_yaml_format.yaml
This file was deleted.
Oops, something went wrong.
181 changes: 181 additions & 0 deletions
181
website/docs/r/parameter_manager_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 Parameter Version resource that stores the actual value of the parameter. | ||
--- | ||
|
||
# google_parameter_manager_parameter_version | ||
|
||
A Parameter Version resource that stores the actual value of the 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 ParameterVersion, 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=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 - Parameter Version Basic | ||
|
||
|
||
```hcl | ||
resource "google_parameter_manager_parameter" "parameter-basic" { | ||
provider = google-beta | ||
parameter_id = "parameter" | ||
} | ||
resource "google_parameter_manager_parameter_version" "parameter-version-basic" { | ||
provider = google-beta | ||
parameter = google_parameter_manager_parameter.parameter-basic.id | ||
parameter_version_id = "parameter_version" | ||
parameter_data = "app-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=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 - Parameter Version With Json Format | ||
|
||
|
||
```hcl | ||
resource "google_parameter_manager_parameter" "parameter-basic" { | ||
provider = google-beta | ||
parameter_id = "parameter" | ||
format = "JSON" | ||
} | ||
resource "google_parameter_manager_parameter_version" "parameter-version-with-json-format" { | ||
provider = google-beta | ||
parameter = google_parameter_manager_parameter.parameter-basic.id | ||
parameter_version_id = "parameter_version" | ||
parameter_data = jsonencode({ | ||
"key1": "val1", | ||
"key2": "val2" | ||
}) | ||
} | ||
``` | ||
<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=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 - Parameter Version With Yaml Format | ||
|
||
|
||
```hcl | ||
resource "google_parameter_manager_parameter" "parameter-basic" { | ||
provider = google-beta | ||
parameter_id = "parameter" | ||
format = "YAML" | ||
} | ||
resource "google_parameter_manager_parameter_version" "parameter-version-with-yaml-format" { | ||
provider = google-beta | ||
parameter = google_parameter_manager_parameter.parameter-basic.id | ||
parameter_version_id = "parameter_version" | ||
parameter_data = yamlencode({ | ||
"key1": "val1", | ||
"key2": "val2" | ||
}) | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
|
||
* `parameter_data` - | ||
(Required) | ||
The Parameter data. | ||
**Note**: This property is sensitive and will not be displayed in the plan. | ||
|
||
* `parameter` - | ||
(Required) | ||
Parameter Manager Parameter resource. | ||
|
||
* `parameter_version_id` - | ||
(Required) | ||
Version ID of the Parameter Version Resource. This must be unique within the Parameter. | ||
|
||
|
||
- - - | ||
|
||
|
||
* `disabled` - | ||
(Optional) | ||
The current state of Parameter Version. This field is only applicable for updating 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 Parameter Version. Format: | ||
`projects/{{project}}/locations/global/parameters/{{parameter_id}}/versions/{{parameter_version_id}}` | ||
|
||
* `create_time` - | ||
The time at which the Parameter Version was created. | ||
|
||
* `update_time` - | ||
The time at which the Parameter Version was updated. | ||
|
||
|
||
## 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 | ||
|
||
|
||
ParameterVersion can be imported using any of these accepted formats: | ||
|
||
* `projects/{{project}}/locations/global/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 ParameterVersion using one of the formats above. For example: | ||
|
||
```tf | ||
import { | ||
id = "projects/{{project}}/locations/global/parameters/{{parameter_id}}/versions/{{parameter_version_id}}" | ||
to = google_parameter_manager_parameter_version.default | ||
} | ||
``` | ||
|
||
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), ParameterVersion can be imported using one of the formats above. For example: | ||
|
||
``` | ||
$ terraform import google_parameter_manager_parameter_version.default projects/{{project}}/locations/global/parameters/{{parameter_id}}/versions/{{parameter_version_id}} | ||
``` |
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