Skip to content

Commit 80324e4

Browse files
jaideokamelinath
andauthored
Terraform changes for SCIM Token API (#15727)
Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
1 parent 552bd23 commit 80324e4

File tree

6 files changed

+380
-8
lines changed

6 files changed

+380
-8
lines changed

mmv1/products/iamworkforcepool/WorkforcePoolProviderScimTenant.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ description: |
1818
The SCIM tenant configuration allows for the synchronization of user/group identities from external identity provider into Google Cloud using the System for Cross-domain Identity Management (SCIM) protocol.
1919
references:
2020
guides:
21-
'QUICKSTART_TITLE': 'https://cloud.google.com/iam/docs/workforce-sign-in-microsoft-entra-id-scalable-groups?group_type=extended#extended-attributes'
22-
api: 'https://cloud.google.com/sdk/gcloud/reference/iam/workforce-pools/providers/scim-tenants'
21+
'Configure a SCIM Tenant': 'https://cloud.google.com/iam/docs/workforce-sign-in-microsoft-entra-id-scalable-groups?group_type=extended#extended-attributes'
22+
api: 'https://docs.cloud.google.com/iam/docs/reference/rest/v1/locations.workforcePools.providers.scimTenants'
2323
base_url: 'locations/{{location}}/workforcePools/{{workforce_pool_id}}/providers/{{provider_id}}/scimTenants'
2424
self_link: 'locations/{{location}}/workforcePools/{{workforce_pool_id}}/providers/{{provider_id}}/scimTenants/{{scim_tenant_id}}'
2525
create_url: 'locations/{{location}}/workforcePools/{{workforce_pool_id}}/providers/{{provider_id}}/scimTenants?workforcePoolProviderScimTenantId={{scim_tenant_id}}'
@@ -66,15 +66,14 @@ properties:
6666
output: true
6767
description: |
6868
The current state of the scim tenant.
69-
* STATE_UNSPECIFIED: State unspecified.
7069
* ACTIVE: The scim tenant is active and may be used to validate authentication credentials.
7170
* DELETED: The scim tenant is soft-deleted. Soft-deleted scim tenants are permanently
7271
deleted after approximately 30 days.
7372
enum_values:
7473
- 'STATE_UNSPECIFIED'
7574
- 'ACTIVE'
7675
- 'DELETED'
77-
- name: 'baseURI'
76+
- name: 'baseUri'
7877
type: String
7978
description: |
8079
Represents the base URI as defined in [RFC 7644, Section
@@ -83,6 +82,19 @@ properties:
8382
Format:
8483
https://iamscim.googleapis.com/{version}/{tenant_id}/
8584
output: true
85+
- name: 'claimMapping'
86+
type: KeyValuePairs
87+
description: Maps BYOID claims to SCIM claims. This is a required field for new SCIM Tenants being created.
88+
- name: 'purgeTime'
89+
type: Time
90+
description: The timestamp that represents the time when the SCIM tenant is purged.
91+
output: true
92+
- name: 'serviceAgent'
93+
type: String
94+
description: |
95+
Service Agent created by SCIM Tenant API. SCIM tokens created under
96+
this tenant will be attached to this service agent.
97+
output: true
8698
parameters:
8799
- name: 'location'
88100
type: String
@@ -98,7 +110,7 @@ parameters:
98110
url_param_only: true
99111
required: true
100112
immutable: true
101-
- name: 'ProviderId'
113+
- name: 'providerId'
102114
type: String
103115
description: |
104116
The ID of the provider.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Copyright 2025 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: 'WorkforcePoolProviderScimToken'
16+
description: |
17+
Represents a SCIM Token for a Workforce Pool Provider Scim Tenant.
18+
The SCIM Token is used for authenticating SCIM provisioning requests during the synchronization of user/group identities from external identity provider into Google Cloud using the System for Cross-domain Identity Management (SCIM) protocol. This needs to be provided in the Secret (Long Lived) Token field when configuring SCIM on an IdP.
19+
references:
20+
guides:
21+
'Create a SCIM Token for the SCIM Tenant': 'https://cloud.google.com/iam/docs/workforce-sign-in-microsoft-entra-id-scalable-groups?group_type=extended#extended-attributes'
22+
api: 'https://docs.cloud.google.com/iam/docs/reference/rest/v1/locations.workforcePools.providers.scimTenants.tokens'
23+
base_url: 'locations/{{location}}/workforcePools/{{workforce_pool_id}}/providers/{{provider_id}}/scimTenants/{{scim_tenant_id}}/tokens'
24+
self_link: 'locations/{{location}}/workforcePools/{{workforce_pool_id}}/providers/{{provider_id}}/scimTenants/{{scim_tenant_id}}/tokens/{{scim_token_id}}'
25+
create_url: 'locations/{{location}}/workforcePools/{{workforce_pool_id}}/providers/{{provider_id}}/scimTenants/{{scim_tenant_id}}/tokens?workforcePoolProviderScimTokenId={{scim_token_id}}'
26+
27+
import_format:
28+
- 'locations/{{location}}/workforcePools/{{workforce_pool_id}}/providers/{{provider_id}}/scimTenants/{{scim_tenant_id}}/tokens/{{scim_token_id}}'
29+
update_verb: 'PATCH'
30+
update_mask: true
31+
timeouts:
32+
insert_minutes: 20
33+
delete_minutes: 20
34+
custom_code:
35+
decoder: 'templates/terraform/decoders/treat_deleted_state_as_gone.go.tmpl'
36+
post_create: 'templates/terraform/post_create/sleep.go.tmpl'
37+
post_update: 'templates/terraform/post_create/sleep.go.tmpl'
38+
examples:
39+
- name: 'iam_workforce_pool_provider_scim_token_basic'
40+
primary_resource_id: "example"
41+
vars:
42+
workforce_pool_id: 'example-pool'
43+
provider_id: 'example-prvdr'
44+
scim_tenant_id: 'example-tenant'
45+
scim_token_id: 'example-scim-token'
46+
test_env_vars:
47+
org_id: 'ORG_ID'
48+
properties:
49+
- name: 'name'
50+
type: String
51+
description: |
52+
Identifier. The resource name of the scim token.
53+
Format: `locations/{location}/workforcePools/{workforce_pool}/providers/{workforce_pool_provider}/scimTenants/{scim_tenant_id}/tokens/{scim_token_id}`
54+
output: true
55+
- name: 'displayName'
56+
type: String
57+
description:
58+
A user-specified display name for the scim token. Cannot exceed 32 characters.
59+
- name: 'securityToken'
60+
type: String
61+
description:
62+
The token string provided to the IdP for authentication and will be set only during creation.
63+
output: true
64+
- name: 'state'
65+
type: Enum
66+
description: |
67+
The current state of the scim token.
68+
* ACTIVE: The token is active and may be used to provision users and groups.
69+
* DELETED: The token is soft-deleted. Soft-deleted tokens are permanently deleted after approximately 30 days.
70+
output: true
71+
enum_values:
72+
- 'STATE_UNSPECIFIED'
73+
- 'ACTIVE'
74+
- 'DELETED'
75+
parameters:
76+
- name: 'location'
77+
type: String
78+
description: |
79+
The location for the resource.
80+
url_param_only: true
81+
required: true
82+
immutable: true
83+
- name: 'workforcePoolId'
84+
type: String
85+
description: |
86+
The ID of the Workforce Pool.
87+
url_param_only: true
88+
required: true
89+
immutable: true
90+
- name: 'providerId'
91+
type: String
92+
description: |
93+
The ID of the Provider.
94+
url_param_only: true
95+
required: true
96+
immutable: true
97+
- name: 'scimTenantId'
98+
type: String
99+
description: |
100+
The ID of the SCIM Tenant.
101+
url_param_only: true
102+
required: true
103+
immutable: true
104+
- name: 'scimTokenId'
105+
type: String
106+
description: |
107+
The ID to use for the SCIM Token, which becomes the final component of the resource name. This value should be 4-32 characters and follow the pattern: `([a-z]([a-z0-9\\-]{2,30}[a-z0-9]))`.
108+
url_param_only: true
109+
required: true
110+
immutable: true

mmv1/templates/terraform/examples/iam_workforce_pool_provider_scim_tenant_basic.tf.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ resource "google_iam_workforce_pool_provider_scim_tenant" "{{$.PrimaryResourceId
3838
scim_tenant_id = "example-scim-tenant"
3939
display_name = "Example SCIM Tenant"
4040
description = "A basic SCIM tenant for IAM Workforce Pool Provider"
41-
# state is output only, not settable
41+
claim_mapping = {
42+
"google.subject" = "user.externalId",
43+
"google.group" = "group.externalId"
44+
}
45+
# state, base_uri, purge_time and service_agent are output only, not settable
4246
}
4347

4448

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
resource "google_iam_workforce_pool" "pool" {
2+
workforce_pool_id = "{{index $.Vars "workforce_pool_id"}}"
3+
parent = "organizations/{{index $.TestEnvVars "org_id"}}"
4+
location = "global"
5+
}
6+
7+
resource "google_iam_workforce_pool_provider" "provider" {
8+
location = "global"
9+
workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id
10+
provider_id = "{{index $.Vars "provider_id"}}"
11+
attribute_mapping = {
12+
"google.subject" = "assertion.sub"
13+
}
14+
oidc {
15+
issuer_uri = "https://accounts.thirdparty.com"
16+
client_id = "client-id"
17+
client_secret {
18+
value {
19+
plain_text = "client-secret"
20+
}
21+
}
22+
web_sso_config {
23+
response_type = "CODE"
24+
assertion_claims_behavior = "MERGE_USER_INFO_OVER_ID_TOKEN_CLAIMS"
25+
additional_scopes = ["groups", "roles"]
26+
}
27+
}
28+
display_name = "Display name"
29+
description = "A sample OIDC workforce pool provider."
30+
disabled = false
31+
attribute_condition = "true"
32+
}
33+
34+
resource "google_iam_workforce_pool_provider_scim_tenant" "tenant" {
35+
location = "global"
36+
workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id
37+
provider_id = google_iam_workforce_pool_provider.provider.provider_id
38+
scim_tenant_id = "{{index $.Vars "scim_tenant_id"}}"
39+
display_name = "SCIM Tenant display Name"
40+
description = "A SCIM Tenant for IAM Workforce Pool Provider"
41+
claim_mapping = {
42+
"google.subject" = "user.externalId",
43+
"google.group" = "group.externalId"
44+
}
45+
# state, base_uri, purge_time and service_agent are output only, not settable
46+
}
47+
48+
resource "google_iam_workforce_pool_provider_scim_token" "{{$.PrimaryResourceId}}" {
49+
location = "global"
50+
workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id
51+
provider_id = google_iam_workforce_pool_provider.provider.provider_id
52+
scim_tenant_id = google_iam_workforce_pool_provider_scim_tenant.tenant.scim_tenant_id
53+
scim_token_id = "example-scim-token"
54+
display_name = "SCIM Token display Name"
55+
# security_token and state are output only, not settable
56+
}
57+

mmv1/third_party/terraform/services/iamworkforcepool/resource_iam_workforce_pool_provider_scim_tenant_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
7+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
78

89
"github.com/hashicorp/terraform-provider-google/google/acctest"
910
"github.com/hashicorp/terraform-provider-google/google/envvar"
@@ -33,6 +34,11 @@ func TestAccIAMWorkforcePoolWorkforcePoolProviderScimTenant_update(t *testing.T)
3334
},
3435
{
3536
Config: testAccIAMWorkforcePoolWorkforcePoolProviderScimTenant_update(context),
37+
ConfigPlanChecks: resource.ConfigPlanChecks{
38+
PreApply: []plancheck.PlanCheck{
39+
plancheck.ExpectResourceAction("google_iam_workforce_pool_provider_scim_tenant.scim_tenant", plancheck.ResourceActionUpdate),
40+
},
41+
},
3642
},
3743
{
3844
ResourceName: "google_iam_workforce_pool_provider_scim_tenant.scim_tenant",
@@ -86,7 +92,11 @@ resource "google_iam_workforce_pool_provider_scim_tenant" "scim_tenant" {
8692
scim_tenant_id = "example-scim-tenant"
8793
display_name = "Example SCIM Tenant"
8894
description = "A basic SCIM tenant for IAM Workforce Pool Provider"
89-
# state is output only, not settable
95+
claim_mapping = {
96+
"google.subject" = "user.externalId",
97+
"google.group" = "group.externalId"
98+
}
99+
# state, base_uri, purge_time and service_agent are output only, not settable
90100
}
91101
92102
`, context)
@@ -134,7 +144,11 @@ resource "google_iam_workforce_pool_provider_scim_tenant" "scim_tenant" {
134144
scim_tenant_id = "example-scim-tenant"
135145
display_name = "Example SCIM Tenant - Updated"
136146
description = "A basic SCIM tenant for IAM Workforce Pool Provider - Updated"
137-
# state is output only, not settable
147+
claim_mapping = {
148+
"google.subject" = "user.externalId",
149+
"google.group" = "group.externalId"
150+
}
151+
# state, base_uri, purge_time and service_agent are output only, not settable
138152
}
139153
`, context)
140154
}

0 commit comments

Comments
 (0)