Skip to content

Commit

Permalink
Add support for parameter manager parameter resource `google_paramete…
Browse files Browse the repository at this point in the history
…r_manager_parameter` (#12630) (#20886)

[upstream:ef139e7f42d948fdbd9db0db64ceba6b1a8480b0]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jan 10, 2025
1 parent ec92e34 commit e2e8ae6
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/12630.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_parameter_manager_parameter`
```
5 changes: 5 additions & 0 deletions .teamcity/components/inputs/services_beta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,11 @@ var ServicesListBeta = mapOf(
"displayName" to "Parallelstore",
"path" to "./google/services/parallelstore"
),
"parametermanager" to mapOf(
"name" to "parametermanager",
"displayName" to "Parametermanager",
"path" to "./google-beta/services/parametermanager"
),
"parametermanagerregional" to mapOf(
"name" to "parametermanagerregional",
"displayName" to "Parametermanagerregional",
Expand Down
5 changes: 5 additions & 0 deletions .teamcity/components/inputs/services_ga.kt
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ var ServicesListGa = mapOf(
"displayName" to "Parallelstore",
"path" to "./google/services/parallelstore"
),
"parametermanager" to mapOf(
"name" to "parametermanager",
"displayName" to "Parametermanager",
"path" to "./google/services/parametermanager"
),
"parametermanagerregional" to mapOf(
"name" to "parametermanagerregional",
"displayName" to "Parametermanagerregional",
Expand Down
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
202 changes: 202 additions & 0 deletions website/docs/r/parameter_manager_parameter.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
---
# ----------------------------------------------------------------------------
#
# *** 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 resource is a logical parameter.
---

# google_parameter_manager_parameter

A Parameter resource is a logical 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 Parameter, see:

* [API documentation](https://cloud.google.com/secret-manager/parameter-manager/docs/reference/rest/v1/projects.locations.parameters)

<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_config_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 Config Basic


```hcl
resource "google_parameter_manager_parameter" "parameter-basic" {
provider = google-beta
parameter_id = "parameter"
}
```
<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_with_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 With Format


```hcl
resource "google_parameter_manager_parameter" "parameter-with-format" {
provider = google-beta
parameter_id = "parameter"
format = "JSON"
}
```
<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_with_labels&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 With Labels


```hcl
resource "google_parameter_manager_parameter" "parameter-with-labels" {
provider = google-beta
parameter_id = "parameter"
labels = {
key1 = "val1"
key2 = "val2"
key3 = "val3"
key4 = "val4"
key5 = "val5"
}
}
```

## Argument Reference

The following arguments are supported:


* `parameter_id` -
(Required)
This must be unique within the project.


- - -


* `labels` -
(Optional)
The labels assigned to this Parameter.
Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes,
and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes,
and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
No more than 64 labels can be assigned to a given resource.
An object containing a list of "key": value pairs. Example:
{ "name": "wrench", "mass": "1.3kg", "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.

* `format` -
(Optional)
The format type of the parameter resource.
Default value is `UNFORMATTED`.
Possible values are: `UNFORMATTED`, `YAML`, `JSON`.

* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.


## Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

* `id` - an identifier for the resource with format `projects/{{project}}/locations/global/parameters/{{parameter_id}}`

* `name` -
The resource name of the Parameter. Format:
`projects/{{project}}/locations/global/parameters/{{parameter_id}}`

* `create_time` -
The time at which the Parameter was created.

* `update_time` -
The time at which the Parameter was updated.

* `policy_member` -
Policy member strings of a Google Cloud resource.
Structure is [documented below](#nested_policy_member).

* `terraform_labels` -
The combination of labels configured directly on the resource
and default labels configured on the provider.

* `effective_labels` -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.


<a name="nested_policy_member"></a>The `policy_member` block contains:

* `iam_policy_uid_principal` -
(Output)
IAM policy binding member referring to a Google Cloud resource by system-assigned unique identifier.
If a resource is deleted and recreated with the same name, the binding will not be applicable to the
new resource. Format:
`principal://parametermanager.googleapis.com/projects/{{project}}/uid/locations/global/parameters/{{uid}}`

* `iam_policy_name_principal` -
(Output)
IAM policy binding member referring to a Google Cloud resource by user-assigned name. If a
resource is deleted and recreated with the same name, the binding will be applicable to the
new resource. Format:
`principal://parametermanager.googleapis.com/projects/{{project}}/name/locations/global/parameters/{{parameter_id}}`

## 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


Parameter can be imported using any of these accepted formats:

* `projects/{{project}}/locations/global/parameters/{{parameter_id}}`
* `{{project}}/{{parameter_id}}`
* `{{parameter_id}}`


In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Parameter using one of the formats above. For example:

```tf
import {
id = "projects/{{project}}/locations/global/parameters/{{parameter_id}}"
to = google_parameter_manager_parameter.default
}
```

When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Parameter can be imported using one of the formats above. For example:

```
$ terraform import google_parameter_manager_parameter.default projects/{{project}}/locations/global/parameters/{{parameter_id}}
$ terraform import google_parameter_manager_parameter.default {{project}}/{{parameter_id}}
$ terraform import google_parameter_manager_parameter.default {{parameter_id}}
```

## User Project Overrides

This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ The following arguments are supported:

* `format` -
(Optional)
The format type of the regional parameter. Default value is UNFORMATTED.
The format type of the regional parameter.
Default value is `UNFORMATTED`.
Possible values are: `UNFORMATTED`, `YAML`, `JSON`.

* `project` - (Optional) The ID of the project in which the resource belongs.
Expand Down

0 comments on commit e2e8ae6

Please sign in to comment.