Skip to content

Commit f143725

Browse files
Add workload identity pool managed identity. (#14048) (#22979)
[upstream:5c950742071115adea135fc70e9dc6e91843edc7] Signed-off-by: Modular Magician <[email protected]>
1 parent dea596e commit f143725

File tree

2 files changed

+209
-0
lines changed

2 files changed

+209
-0
lines changed

.changelog/14048.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_iam_workload_identity_pool_managed_identity` (beta)
3+
```
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
---
2+
# ----------------------------------------------------------------------------
3+
#
4+
# *** AUTO GENERATED CODE *** Type: MMv1 ***
5+
#
6+
# ----------------------------------------------------------------------------
7+
#
8+
# This code is generated by Magic Modules using the following:
9+
#
10+
# Configuration: https:#github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/iambeta/WorkloadIdentityPoolManagedIdentity.yaml
11+
# Template: https:#github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform/resource.html.markdown.tmpl
12+
#
13+
# DO NOT EDIT this file directly. Any changes made to this file will be
14+
# overwritten during the next generation cycle.
15+
#
16+
# ----------------------------------------------------------------------------
17+
subcategory: "Cloud IAM"
18+
description: |-
19+
Represents a managed identity for a workload identity pool namespace.
20+
---
21+
22+
# google_iam_workload_identity_pool_managed_identity
23+
24+
Represents a managed identity for a workload identity pool namespace.
25+
26+
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
27+
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
28+
29+
To get more information about WorkloadIdentityPoolManagedIdentity, see:
30+
31+
* [API documentation](https://cloud.google.com/iam/docs/reference/rest/v1/projects.locations.workloadIdentityPools.namespaces.managedIdentities)
32+
* How-to Guides
33+
* [Configure managed workload identity authentication for Compute Engine](https://cloud.google.com/iam/docs/create-managed-workload-identities)
34+
* [Configure managed workload identity authentication for GKE](https://cloud.google.com/iam/docs/create-managed-workload-identities-gke)
35+
36+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
37+
<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=iam_workload_identity_pool_managed_identity_basic&open_in_editor=main.tf" target="_blank">
38+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
39+
</a>
40+
</div>
41+
## Example Usage - Iam Workload Identity Pool Managed Identity Basic
42+
43+
44+
```hcl
45+
resource "google_iam_workload_identity_pool" "pool" {
46+
provider = google-beta
47+
48+
workload_identity_pool_id = "example-pool"
49+
mode = "TRUST_DOMAIN"
50+
}
51+
52+
resource "google_iam_workload_identity_pool_namespace" "ns" {
53+
provider = google-beta
54+
55+
workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id
56+
workload_identity_pool_namespace_id = "example-namespace"
57+
}
58+
59+
resource "google_iam_workload_identity_pool_managed_identity" "example" {
60+
provider = google-beta
61+
62+
workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id
63+
workload_identity_pool_namespace_id = google_iam_workload_identity_pool_namespace.ns.workload_identity_pool_namespace_id
64+
workload_identity_pool_managed_identity_id = "example-managed-identity"
65+
}
66+
```
67+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
68+
<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=iam_workload_identity_pool_managed_identity_full&open_in_editor=main.tf" target="_blank">
69+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
70+
</a>
71+
</div>
72+
## Example Usage - Iam Workload Identity Pool Managed Identity Full
73+
74+
75+
```hcl
76+
resource "google_iam_workload_identity_pool" "pool" {
77+
provider = google-beta
78+
79+
workload_identity_pool_id = "example-pool"
80+
mode = "TRUST_DOMAIN"
81+
}
82+
83+
resource "google_iam_workload_identity_pool_namespace" "ns" {
84+
provider = google-beta
85+
86+
workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id
87+
workload_identity_pool_namespace_id = "example-namespace"
88+
}
89+
90+
resource "google_iam_workload_identity_pool_managed_identity" "example" {
91+
provider = google-beta
92+
93+
workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id
94+
workload_identity_pool_namespace_id = google_iam_workload_identity_pool_namespace.ns.workload_identity_pool_namespace_id
95+
workload_identity_pool_managed_identity_id = "example-managed-identity"
96+
description = "Example Managed Identity in a Workload Identity Pool Namespace"
97+
disabled = true
98+
}
99+
```
100+
101+
## Argument Reference
102+
103+
The following arguments are supported:
104+
105+
106+
* `workload_identity_pool_id` -
107+
(Required)
108+
The ID to use for the pool, which becomes the final component of the resource name. This
109+
value should be 4-32 characters, and may contain the characters [a-z0-9-]. The prefix
110+
`gcp-` is reserved for use by Google, and may not be specified.
111+
112+
* `workload_identity_pool_namespace_id` -
113+
(Required)
114+
The ID to use for the namespace. This value must:
115+
* contain at most 63 characters
116+
* contain only lowercase alphanumeric characters or `-`
117+
* start with an alphanumeric character
118+
* end with an alphanumeric character
119+
120+
The prefix `gcp-` will be reserved for future uses.
121+
122+
* `workload_identity_pool_managed_identity_id` -
123+
(Required)
124+
The ID to use for the managed identity. This value must:
125+
* contain at most 63 characters
126+
* contain only lowercase alphanumeric characters or `-`
127+
* start with an alphanumeric character
128+
* end with an alphanumeric character
129+
130+
The prefix `gcp-` will be reserved for future uses.
131+
132+
133+
- - -
134+
135+
136+
* `description` -
137+
(Optional)
138+
A description of the managed identity. Cannot exceed 256 characters.
139+
140+
* `disabled` -
141+
(Optional)
142+
Whether the managed identity is disabled. If disabled, credentials may no longer be issued for
143+
the identity, however existing credentials will still be accepted until they expire.
144+
145+
* `project` - (Optional) The ID of the project in which the resource belongs.
146+
If it is not provided, the provider project is used.
147+
148+
149+
## Attributes Reference
150+
151+
In addition to the arguments listed above, the following computed attributes are exported:
152+
153+
* `id` - an identifier for the resource with format `projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}/namespaces/{{workload_identity_pool_namespace_id}}/managedIdentities/{{workload_identity_pool_managed_identity_id}}`
154+
155+
* `name` -
156+
The resource name of the managed identity as
157+
`projects/{project_number}/locations/global/workloadIdentityPools/{workload_identity_pool_id}/namespaces/{workload_identity_pool_namespace_id}/managedIdentities/{workload_identity_pool_managed_identity_id}`.
158+
159+
* `state` -
160+
The current state of the managed identity.
161+
* `ACTIVE`: The managed identity is active.
162+
* `DELETED`: The managed identity is soft-deleted. Soft-deleted managed identities are
163+
permanently deleted after approximately 30 days. You can restore a soft-deleted managed
164+
identity using UndeleteWorkloadIdentityPoolManagedIdentity. You cannot reuse the ID of a
165+
soft-deleted managed identity until it is permanently deleted.
166+
167+
168+
## Timeouts
169+
170+
This resource provides the following
171+
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
172+
173+
- `create` - Default is 20 minutes.
174+
- `update` - Default is 20 minutes.
175+
- `delete` - Default is 20 minutes.
176+
177+
## Import
178+
179+
180+
WorkloadIdentityPoolManagedIdentity can be imported using any of these accepted formats:
181+
182+
* `projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}/namespaces/{{workload_identity_pool_namespace_id}}/managedIdentities/{{workload_identity_pool_managed_identity_id}}`
183+
* `{{project}}/{{workload_identity_pool_id}}/{{workload_identity_pool_namespace_id}}/{{workload_identity_pool_managed_identity_id}}`
184+
* `{{workload_identity_pool_id}}/{{workload_identity_pool_namespace_id}}/{{workload_identity_pool_managed_identity_id}}`
185+
186+
187+
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import WorkloadIdentityPoolManagedIdentity using one of the formats above. For example:
188+
189+
```tf
190+
import {
191+
id = "projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}/namespaces/{{workload_identity_pool_namespace_id}}/managedIdentities/{{workload_identity_pool_managed_identity_id}}"
192+
to = google_iam_workload_identity_pool_managed_identity.default
193+
}
194+
```
195+
196+
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), WorkloadIdentityPoolManagedIdentity can be imported using one of the formats above. For example:
197+
198+
```
199+
$ terraform import google_iam_workload_identity_pool_managed_identity.default projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}/namespaces/{{workload_identity_pool_namespace_id}}/managedIdentities/{{workload_identity_pool_managed_identity_id}}
200+
$ terraform import google_iam_workload_identity_pool_managed_identity.default {{project}}/{{workload_identity_pool_id}}/{{workload_identity_pool_namespace_id}}/{{workload_identity_pool_managed_identity_id}}
201+
$ terraform import google_iam_workload_identity_pool_managed_identity.default {{workload_identity_pool_id}}/{{workload_identity_pool_namespace_id}}/{{workload_identity_pool_managed_identity_id}}
202+
```
203+
204+
## User Project Overrides
205+
206+
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).

0 commit comments

Comments
 (0)