From 44b0b9405873e6912c1bcd98b47cad649fc7f6fb Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 24 Oct 2022 13:46:54 -0700 Subject: [PATCH] Add new resource WorkforcePool (#6719) (#12863) * added workforce pool * fixed bugs * renamed the product and fixed an error message * updated version setting * changed to provider-beta * updated id validator * updated parent field * fixed bugs Signed-off-by: Modular Magician Signed-off-by: Modular Magician --- .changelog/6719.txt | 3 + ...m_workforce_pool_workforce_pool_id_test.go | 1 + ..._iam_workforce_pool_workforce_pool_test.go | 1 + .../docs/r/iam_workforce_pool.html.markdown | 152 ++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 .changelog/6719.txt create mode 100644 google/resource_iam_workforce_pool_workforce_pool_id_test.go create mode 100644 google/resource_iam_workforce_pool_workforce_pool_test.go create mode 100644 website/docs/r/iam_workforce_pool.html.markdown diff --git a/.changelog/6719.txt b/.changelog/6719.txt new file mode 100644 index 0000000000..a5f6191250 --- /dev/null +++ b/.changelog/6719.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +`google_iam_workforce_pool` +``` diff --git a/google/resource_iam_workforce_pool_workforce_pool_id_test.go b/google/resource_iam_workforce_pool_workforce_pool_id_test.go new file mode 100644 index 0000000000..71664db3c8 --- /dev/null +++ b/google/resource_iam_workforce_pool_workforce_pool_id_test.go @@ -0,0 +1 @@ +package google diff --git a/google/resource_iam_workforce_pool_workforce_pool_test.go b/google/resource_iam_workforce_pool_workforce_pool_test.go new file mode 100644 index 0000000000..71664db3c8 --- /dev/null +++ b/google/resource_iam_workforce_pool_workforce_pool_test.go @@ -0,0 +1 @@ +package google diff --git a/website/docs/r/iam_workforce_pool.html.markdown b/website/docs/r/iam_workforce_pool.html.markdown new file mode 100644 index 0000000000..40dbbc27a8 --- /dev/null +++ b/website/docs/r/iam_workforce_pool.html.markdown @@ -0,0 +1,152 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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: "Cloud IAM" +page_title: "Google: google_iam_workforce_pool" +description: |- + Represents a collection of external workforces. +--- + +# google\_iam\_workforce\_pool + +Represents a collection of external workforces. Provides namespaces for +federated users that can be referenced in IAM policies. +Note: Ask your Google Cloud account team to request access to workforce identity +federation for your billing/quota project. The account team notifies you when the project is +granted access. + +~> **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 WorkforcePool, see: + +* [API documentation](https://cloud.google.com/iam/docs/reference/rest/v1/locations.workforcePools) +* How-to Guides + * [Manage pools](https://cloud.google.com/iam/docs/manage-workforce-identity-pools-providers#manage_pools) + +## Example Usage - Iam Workforce Pool Basic + + +```hcl +resource "google_iam_workforce_pool" "example" { + provider = google-beta + + workforce_pool_id = "example-pool" + parent = "organizations/123456789" + location = "global" +} +``` +## Example Usage - Iam Workforce Pool Full + + +```hcl +resource "google_iam_workforce_pool" "example" { + provider = google-beta + + workforce_pool_id = "example-pool" + parent = "organizations/123456789" + location = "global" + display_name = "Display name" + description = "A sample workforce pool." + disabled = false + session_duration = "7200s" +} +``` + +## Argument Reference + +The following arguments are supported: + + +* `location` - + (Required) + The location for the resource. + +* `workforce_pool_id` - + (Required) + The name of the pool. The ID must be a globally unique string of 6 to 63 lowercase letters, + digits, or hyphens. It must start with a letter, and cannot have a trailing hyphen. + The prefix `gcp-` is reserved for use by Google, and may not be specified. + +* `parent` - + (Required) + Immutable. The resource name of the parent. Format: `organizations/{org-id}`. + + +- - - + + +* `display_name` - + (Optional) + A user-specified display name of the pool in Google Cloud Console. Cannot exceed 32 characters. + +* `description` - + (Optional) + A user-specified description of the pool. Cannot exceed 256 characters. + +* `disabled` - + (Optional) + Whether the pool is disabled. You cannot use a disabled pool to exchange tokens, + or use existing tokens to access resources. If the pool is re-enabled, existing tokens grant access again. + +* `session_duration` - + (Optional) + Duration that the Google Cloud access tokens, console sign-in sessions, + and `gcloud` sign-in sessions from this pool are valid. + Must be greater than 15 minutes (900s) and less than 12 hours (43200s). + If `sessionDuration` is not configured, minted credentials have a default duration of one hour (3600s). + A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: "`3.5s`". + + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + +* `id` - an identifier for the resource with format `locations/{{location}}/workforcePools/{{workforce_pool_id}}` + +* `name` - + Output only. The resource name of the pool. + Format: `locations/{location}/workforcePools/{workforcePoolId}` + +* `state` - + Output only. The state of the pool. + * STATE_UNSPECIFIED: State unspecified. + * ACTIVE: The pool is active, and may be used in Google Cloud policies. + * DELETED: The pool is soft-deleted. Soft-deleted pools are permanently deleted + after approximately 30 days. You can restore a soft-deleted pool using + [UndeleteWorkforcePool][WorkforcePools.UndeleteWorkforcePool]. + You cannot reuse the ID of a soft-deleted pool until it is permanently deleted. + While a pool is deleted, you cannot use it to exchange tokens, or use + existing tokens to access resources. If the pool is undeleted, existing + tokens grant access again. + + +## Timeouts + +This resource provides the following +[Timeouts](/docs/configuration/resources.html#timeouts) configuration options: + +- `create` - Default is 20 minutes. +- `update` - Default is 20 minutes. +- `delete` - Default is 20 minutes. + +## Import + + +WorkforcePool can be imported using any of these accepted formats: + +``` +$ terraform import google_iam_workforce_pool.default locations/{{location}}/workforcePools/{{workforce_pool_id}} +$ terraform import google_iam_workforce_pool.default {{location}}/{{workforce_pool_id}} +```